Posts by Chrisoft

    I tried here but It is not exact.

    Message Aircraft.Wind :


    Message Aircraft.Position :


    1. double __wind_spd = sqrt(__wind.x*__wind.x + __wind.y*__wind.y + __wind.z*__wind.z); // m/s
    2. tm_vector3d east = __wind * tmcoordinates_GetEastAt(__position);
    3. tm_vector3d north = __wind * tmcoordinates_GetNorthAt(__position);
    4. __wind_cap = 90.0 - (atan2(east.x, north.y)) * 180.0 / M_PI;

    for 180° wind direction, __wind_cap gives me 57°, there is something wrong.



    Hi Jan

    Thanks for this reply, in this line

    wind_heading = ( atan2( wind * GetEastAt( position ), wind * GetNorthAt( position )) ) * 180.0 / PI - 90.0

    I tried this formula but wind, GetEastAt and GetNorthAt return tm_vector3d variable.

    So for funtion atan2 need double variable.

    I don't know which x y or z I have to use.

    Sorry my lack of understanding.




    I'd like to have correct formula to calculate speed and direction wind from data 3D vector Aircraft.Wind in 3 components (U, V, W) or XYZ.

    I managed to calculate speed = _wind_speed = sqrt(pow(_wind.x,2.0) + pow(_wind.y,2.0) + pow(_wind.z,2.0));

    But to calculate direction, I don't found for the moment, I tried this formula : _wind_dir = (atan2(_wind.y, _wind.x)*180.0) / M_PI;



    I found other data don't give us results.

    Here is some concerned data :

    - "Aircraft.Category.Jet", TYPE_DOUBLE, gives always 0.0 (with different aircraft)

    - "Aircraft.Category.Glider" , TYPE_DOUBLE, gives always 0.0 (with different aircraft)

    - "Aircraft.OnGround", TYPE_DOUBLE, gives always 1.0 or 0.0 (aircraft onground or not)

    - "Aircraft.OnRunway", TYPE_DOUBLE, gives always 0.0 (on message list debug, it displays "void" I don't know exactly what data type is)

    - "Aircraft.Crashed", TYPE_DOUBLE, gives always 0.0 (trying crash but come back quickly)

    I don't know you have also same problem. I tried this code :




    In fact, I found soluce.

    For data "Flaps", there are 3 different Flags.

    So I add condition to obtain an exact result from data.

    Here is :

    1. ...
    2. else if ((sh == MessageAircraftFlaps.GetID()) && (message.GetFlags().GetFlags() == 65540)) {
    3. _fs_flaps = message.GetDouble();
    4. }
    5. ...


    I'm making a little external DLL.

    I remark on data "Flaps", some aircraft like Boeing 747 shows always same value 0.523560 after changing flaps position.

    For Airbus A320, it works. It displays different position from 0.0 to 1.0.

    For data "Gear", it works no problem, it shows position from 0.0 to 1.0.

    Here is my code :

    Any idea about this problem?