Results 1 to 4 of 4

Thread: Weird Offsets

  1. #1
    500+ This must be a daytime job Boeing 747 Flyer's Avatar
    Join Date
    Nov 2009
    Location
    England
    Posts
    635
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Weird Offsets

    Hiya everyone,

    I have, for my 767 Overhead, developed an IRS SIOC script which functions using both SIOC and the IOLCD.exe application (written for an LCD Display).

    The script is designed to display my aircraft's current co-ordinates, GS, track, heading... etc

    It is, for the most, 80% working. However, there are a few offsets that aren't working for me.

    For example, Offset $0580. This is the Aircraft Heading coordinate. In the FSUIPC Offsets Status manual, it states that you must do some calculations... So, I oblidged. Here is my script:

    Code:
    Var 9117, name HDG, Link FSUIPC_IN, Offset $0580, Length 4
    {
    L0 = &HDG * 360
    L1 = DIV L0 4294967296
    V9872 = L1
    }
    However, on the LCD display, the heading is completely messed up! It often displays values such as -12 when I am on heading 272... etc

    Can anyone try this offset and/or do you know of any alternatives I could try?

    Thanks,

    Jack

  2. #2
    300+ Forum Addict
    Join Date
    Jan 2007
    Posts
    496
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Weird Offsets

    Quote Originally Posted by Boeing 747 Flyer View Post
    Offset $0580. This is the Aircraft Heading coordinate. In the FSUIPC Offsets Status manual, it states that you must do some calculations.
    Well, rather, it tells you what the FS units are. FS arranges for the largest possible number (359.99999 ... degrees) to occupy the available 32-bits to the maximum. That effectively means that the number "65536*65536" (one more than the maximum number which can be accommodated) represents 360 (the first heading out of the range 0-359.99999 ...). By doing this it is using those 32 bits to give maximum precision -- more precise, in fact, than a 32-bit Float would give because the latter uses several bits for an exponent.

    Code:
    Var 9117, name HDG, Link FSUIPC_IN, Offset $0580, Length 4
    {
    L0 = &HDG * 360
    L1 = DIV L0 4294967296
    V9872 = L1
    }
    I don't know this form of code, but my questions of it would be:

    1. What is the capacity of the variables represented by L0 and L1? Are they floating point? If they only have 32 bit fixed point capacity, then you are losing much of the value when you multiply by 360, obviously.

    2. Is all this operating with unsigned numbers? If not, if they are signed, then any heading of 180 or over will look negative, of course, as the top bit will be set. If you get a negative result as a consequence you'd have to add 360 to correct it.

    However, on the LCD display, the heading is completely messed up! It often displays values such as -12 when I am on heading 272... etc
    So, evidently, although the offset value you are reading is a 32 bit unsigned number you are treating it as signed. You need to correct for that.

    Pete

  3. #3
    500+ This must be a daytime job Boeing 747 Flyer's Avatar
    Join Date
    Nov 2009
    Location
    England
    Posts
    635
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Weird Offsets

    Hi Pete,

    Good news. I've managed to fix the issue with the true heading Offsets; I used some code provided by Nico Kaan on his website, see here:

    Code:
    Var 3682 name HDG1 Link FSUIPC_IN Offset $0580 Length 4 // true heading
    {
     L0 = &HDG1 * 8.3819E-008
     IF L0 < 0 
    {
     L0 = L0 + 360
     }
     &D_HDG = ROUND L0 
    }
    Where D_HDG value is the calculated unit. All working!!!

    Now, I'm cracking on with the ambient wind offset. I'm using the following formula:

    Code:
    Var 9033, Name WINDDIR, Link FSUIPC_IN, Offset $0E92, Length 2
    {
    L0 = &WINDDIR * 5.9493164063E-03
    &WINDDIRCALC = ROUND L0
    }
    Using the above formula (as per FSUIPC SDK Manuals), I'm getting some strange readings, like "735" and so forth. When completely still and on the ground, I get fairly inaccurate but believable results, like "042". Have I made a mistake?

    Jack

  4. #4
    300+ Forum Addict
    Join Date
    Jan 2007
    Posts
    496
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Weird Offsets

    Quote Originally Posted by Boeing 747 Flyer View Post
    I've managed to fix the issue with the true heading Offsets
    Yes, you are now simply correcting the calculation because you are handling a positive number as if it were signed. As I said.

    Now, I'm cracking on with the ambient wind offset.
    The wind direction at 0E92 is in exactly the same form as the heading, except using 16 bits instead of 32. I expect you've ignored the sign problem again.

    Pete

Similar Threads

  1. Engravity CDU & Win7.. weird 737 CDU menu ??
    By Nick1150 in forum PM Boeing FMC/CDU
    Replies: 1
    Last Post: 12-19-2010, 04:29 PM
  2. Weird video driver problem in Vista32
    By CrashEd in forum Video Interfacing and Hardware
    Replies: 7
    Last Post: 09-18-2009, 12:58 PM
  3. CDU new versions behave weird
    By RobertVdb in forum PM Boeing FMC/CDU
    Replies: 0
    Last Post: 08-03-2008, 11:47 AM
  4. CDU new versions behave weird
    By RobertVdb in forum Magenta Cockpits
    Replies: 0
    Last Post: 08-03-2008, 10:49 AM
  5. CDU Inflight arrival runway change weird!
    By dcutugno in forum PM General Q & A
    Replies: 5
    Last Post: 02-05-2007, 12:13 PM