Results 1 to 5 of 5
  1. #1
    300+ Forum Addict jmig's Avatar
    Join Date
    Apr 2007
    Location
    Lafayette, LA USA
    Posts
    440
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    SIOC Experts: What does this mean?

    I found and borrowed some code for using a pot to set rudder trim. The code listed below works. My question is what do the various math steps do. I would like to understand HOW it works, not just copy.

    The code is:
    Var 0085, Link FSUIPC_OUT, Offset $2EC0, Length 8, Numbers 2 // inicio scrip rudder trim

    Var 0400, Link USB_ANALOGIC, Input 1, PosL 0, PosC 125, PosR 255
    {
    L0 = V0400 * 155
    L0 = L0 - 19530
    V0085 = L0 / 1000
    L1 = L0 / 1000

    I understand the two Variable lines. I understand that L0 is a temp variable.

    Why multiply V0400 by 155?

    Why subtract 19530 from the result?

    Then why divide by 1000?

    Can someone help a programing noob understand?



    John

    System:
    ASUS P5Q SE/R
    Intel Q9550 O/C to 3.4 GHz
    4 GB 1066 DDR2 RAM
    300 GB WD 10,000 RPM Raptor SATA Drive
    GeForce 8800 GT 512 KB RAM
    Matrox TH2Go with three 19" Sumsung 940 BX
    IR Track 4

  2. #2
    150+ Forum Groupie pdpo's Avatar
    Join Date
    Nov 2005
    Location
    belgium
    Posts
    280
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Var 0085, Link FSUIPC_OUT, Offset $2EC0, Length 8, Numbers 2

    Var 0400, Link USB_ANALOGIC, Input 1, PosL 0, PosC 125, PosR 255
    {
    L0 = V0400 * 155
    L0 = L0 - 19530
    V0085 = L0 / 1000
    L1 = L0 / 1000
    }

    Hopw you understand it with the following explanation :
    1) the middle point of the pot should result in 0 so 126 * 155 = 19530 => V0085 will be 0 if the V0400 = 126
    (I would probably change this to 125*155=19375 => so V0085 would be 0 at V0400=125)

    2) the pot can increase then its value to 255 => V0085 = 19.995
    or it can decrease to 0 => V0085 = -19.530

    turning of the rudder trim pot will result in a value from -19.530 to 19.995.
    Now we have defined here the FSUIPC_OUT to have Numbers 2.
    This will make the value be divided by 100 ... so actually the value in the offset will be
    -0.19530 to 0.19995
    if you convert this to degrees you se a rudder trim deflection between - 11.5 to 11.5 degrees.

    in fact , you could rewrite this code and not divide L0 by 1000 to get V0085
    but define the fsuipc_output with Numbers = 5

    This is a quote form the help file in config_sioc.exe
    "Numbers : If we work with 8 bytes FLOAT, this attribute sets the division factor. If we set 1 and FLOAT is 123, the variable will store 12.3."

    Greetings Peter Depoortere

  3. Thanks jmig thanked for this post
  4. #3
    300+ Forum Addict jmig's Avatar
    Join Date
    Apr 2007
    Location
    Lafayette, LA USA
    Posts
    440
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Thank you Peter. This is JUST what I needed to see. It allows me to understand the inner workings of SIOC.

    I have always been a person who wants to understand the "whys" and "wherefore" of things. In this way you can actually the system and figure out what is wrong when it doesn't work according to plan.

    I didn't know sioc.exe had a help file. I will have to look it over.
    John

    System:
    ASUS P5Q SE/R
    Intel Q9550 O/C to 3.4 GHz
    4 GB 1066 DDR2 RAM
    300 GB WD 10,000 RPM Raptor SATA Drive
    GeForce 8800 GT 512 KB RAM
    Matrox TH2Go with three 19" Sumsung 940 BX
    IR Track 4

  5. #4
    2000+ Poster - Never Leaves the Sim Michael Carter's Avatar
    Join Date
    Oct 2006
    Location
    Southern Illinois, USA
    Posts
    3,147
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    I used to drive my math teachers absolutely crazy for that reason.

    I never could get a straight answer out of them. I used to do the same to the Boeing instructors when I went through tech school at Chanute too.

    Amazing how some can teach subjects but not explain the "why".
    Boeing Skunk Works
    Remember...140, 250, and REALLY FAST!

    We don't need no stinkin' ETOPS!



    Powered by FS9 & BOEING

  6. #5
    150+ Forum Groupie pdpo's Avatar
    Join Date
    Nov 2005
    Location
    belgium
    Posts
    280
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Jmig,

    the help file is the one from CONFIG_SIOC.EXE , not the sioc.exe ...
    Anyway, its only when you truly understand an example code that you can start
    fiddling yourself. Once you get the basics , and you understand them well you can
    try out some variations and new things with it....
    Thats my main reason that I dont get started in programming windows (visual C++) ...
    so many classes existing and not really seeing how they work and interact ...
    Still trying...

    Greetz Peter

Similar Threads

  1. Question for experts regarding OC MCP
    By barkay in forum OpenCockpits General Discussion
    Replies: 7
    Last Post: 09-24-2011, 05:31 PM
  2. Some initial questions - Could you offer some answers please experts!
    By darrenw in forum Where to Start Building a Home Cockpit
    Replies: 4
    Last Post: 02-22-2011, 04:57 PM
  3. Sioc / PM
    By mpl330 in forum OpenCockpits General Discussion
    Replies: 6
    Last Post: 02-07-2010, 01:26 PM
  4. Probably a stupid question for PM experts
    By barkay in forum PM Boeing GC
    Replies: 5
    Last Post: 11-26-2008, 10:59 AM
  5. N1 SET and SPD REF - SIOC
    By paoloj in forum OpenCockpits General Discussion
    Replies: 0
    Last Post: 10-28-2008, 05:23 AM