IBM TechXchange Group

 View Only
  • 1.  RTRT - Rationale test real time

    Posted 23 days ago
    Edited by Lorraine Rizzuto 18 days ago

    Hi Team,

    I have a question related to the parameter from the below function

    --------------------------------------------------------------------------------
    static float ComputeFactor(float IAS, float Alt, float Temp)
    {
        float  dpp,
               mach,
               last,
               p,
               speed_of_sound,
               TAS;

        if (Alt< -1000.0f) {
            Alt = -1000.0f;
        }
        if (Alt>65000.0f) {
            Alt = 65000.0f;
        }
        if (IAS<20.0f) {
            IAS = 20.0f;
        }
        if (IAS>650.0f) {
            IAS = 650.0f;
        }
        if (Temp<-100.0f) {
            Temp = -100.0f;
        }
        if (Temp>100.0f) {
            Temp = 100.0f;
        }

        if(Alt > ALT_TR) {
            p = P_TR_PSF * expf(-4.806346E-5f * (Alt - ALT_TR));
        }
        else {
            p = P_0_PSF * powf(1 - 6.8755856E-6f * Alt, P_LAPSE);
        }

        dpp  = (P_0_PSF * (powf(1 + 0.2f * (IAS/CS_0)*(IAS/CS_0), 3.5f) - 1) / p) + 1;
        mach = sqrtf(5 * (powf(dpp, 0.2857142857f) - 1));

        if(mach > 1.0f) {
            /* Iterate with Rayliegh's Formula to account for shock effects */
            do {
                last = mach;
                mach = 0.881285f * sqrtf(dpp * powf(1 - 1/(7*mach*mach), 2.5f));
            } while(fabsf(mach-last) > 0.005f);
        }

        speed_of_sound = 643.855f * sqrtf((Temp+273.15f)/273.15f);
        TAS            = speed_of_sound * mach;

        return(TAS/IAS);
    }
    --------------------------------------------------------------------------------

    Issue:
    When input Alt 'init = 65001' is driven then as per the functionality the output should be Alt 'ev = 65000'.
    But test report is reflecting Alt 'ev = 65001'

    Need suggestion on this behavior?

    ------------------------------
    Venkata Krishna Murty Hari
    ------------------------------



  • 2.  RE: RTRT - Rationale test real time

    Posted 18 days ago

    Hi Venkata,

    Can you expose 3 digits after the decimal ''.'' to see if there are a fraction value? 

    Perhaps if the response has to be an integer 65000 then truncate or typecast to Integer...

    Enjoy!



    ------------------------------
    Jean-Claude Chami
    SIA Innovations Inc.

    ------------------------------