aeromax 10 Posted May 16, 2011 Report Share Posted May 16, 2011 Hi thanks for that Link to post Share on other sites
Aircraft Aviation 2 Posted May 16, 2011 Report Share Posted May 16, 2011 Hi Max, I'm a bit confused at the logic of the script you're using. I personally have not used that logic. Firstly, is your Airspeed Indicator linear? If so, please post the servo values for the "0" position and the "400" knots position. If it is non-linear, please post a picture, so I can figure out the "stepping" required for each section. Regards, Jack Link to post Share on other sites
aeromax 10 Posted May 16, 2011 Author Report Share Posted May 16, 2011 Hi Dear !. Thanks for fast responding. Link to post Share on other sites
Aircraft Aviation 2 Posted May 16, 2011 Report Share Posted May 16, 2011 Hi Max, When I say linear/non-linear, I am talking about the guage itself. A linear gauge means that the gaps between each marking are exactly the same. If they are different, it's non-linear. I shall start writing your script and I will post it here when finished. Jack Link to post Share on other sites
aeromax 10 Posted May 17, 2011 Author Report Share Posted May 17, 2011 ok, i understand it !. Sorry, but i never used sioc before or something like that !. If you like a (macro)-picture of speed-indicator dial; i can send it; just let me know, where if have to do that. thank´s a lot ! Link to post Share on other sites
Aircraft Aviation 2 Posted May 17, 2011 Report Share Posted May 17, 2011 Hi Max, Please try this script: Var 0002, name IAS_Servo, Link USB_SERVOS, Output 1, PosL 0, PosC 562, PosR 988, Type 2 // IAS Servo InstrumentVar 0001, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4, // IAS from SIM{ L0 = DIV &IAS 128 // FSUIPC Conversion Airspeed IAS L0 = ABS L0 // L0 not signed L2 = L0 IF L0 <= 100 // First sector { L1 = L2 * 1.27 // (127 steps/100 values) = 1.27 } ELSE // Is a greater value { L2 = L0 - 100 // L2 only have values for next sector IF L0 <= 200 // Second sector { L1 = L2 * 3.69 // (369 steps / 100 values) = 3.69 L1 = L1 + 127 // Add steps of others sectors (+127) } ELSE { L2 = L0 - 200 // L2 only have values for next sector IF L0 <= 300 // 3. Sector { L1 = L2 * 2.94 // ( 294 / 100) = 2.94 L1 = L1 + 496 // Add steps of others sectors (127 + 369) } ELSE // Out of range { L2 = L0 - 300 // L2 only have values for next sector IF L0 <= 400 // 4. sector { L1 = L2 * 1.980 // (198 steps / 100 values) = 1.980 L1 = L1 + 790 // Add steps of others sectors (127 + 369 + 294) } ELSE { L1 = 988 // Max. position of IAS Gauge } } } } &IAS_Servo = 0 + L1 // Add to minimum (0)}[/CODE] It should work, if the values you gave me are correct. Also, please note, you MUST ensure that your Servo is accurate. Does the servo hit exactly 400 Knots each time you send it the value of 988? Or does it go to 410, or something like that? It MUST be accurate. Please tell me if the script works. Kindest regards, Jack Link to post Share on other sites
aeromax 10 Posted May 17, 2011 Author Report Share Posted May 17, 2011 Yeep. Link to post Share on other sites
Aircraft Aviation 2 Posted May 17, 2011 Report Share Posted May 17, 2011 AWESOME ! THAT´s GREAT !! YES I´LL TRY THAT ONE AND ´LL LET YOU KNOW IF IT WORKS. PERFECT, THANK YOU SO MUCH !! No problem Max, I hope it works! If it doesn't I shall try again for you. Jack Link to post Share on other sites
aeromax 10 Posted May 17, 2011 Author Report Share Posted May 17, 2011 Superb. Link to post Share on other sites
Aircraft Aviation 2 Posted May 17, 2011 Report Share Posted May 17, 2011 Hi Max, That's great! I'm so glad it worked for you. To fix the < 100 Knots issue, I will need a picture (any image, doesn't have to be a photo) of your instrument. It sounds like there are some irregular steps between 0 and 100. I will need to adjust the multiplier value. Kindest regards, Jack Link to post Share on other sites
aeromax 10 Posted May 17, 2011 Author Report Share Posted May 17, 2011 thanks for that Link to post Share on other sites
Aircraft Aviation 2 Posted May 17, 2011 Report Share Posted May 17, 2011 Hi Max, That really is fantastic news, I'm so happy that I could help. In fact, I hadn't written a Servo script in over a year, so I appreciate the practice! Did you solve the airspeed problem between 0 and 100 Knots, or wold you like me to re-write that section of the script still? Kindest regards, Jack Link to post Share on other sites
aeromax 10 Posted May 17, 2011 Author Report Share Posted May 17, 2011 awesome !! Link to post Share on other sites
Aircraft Aviation 2 Posted May 17, 2011 Report Share Posted May 17, 2011 Hi Max, It is no problem, it should be quite easy. Please can you tell me what the gauge reads at 60 Knots (what value in IOCards.test?). Jack Link to post Share on other sites
aeromax 10 Posted May 17, 2011 Author Report Share Posted May 17, 2011 Link to post Share on other sites
Aircraft Aviation 2 Posted May 18, 2011 Report Share Posted May 18, 2011 Hi Max, Okay, try this script: Var 0002, name IAS_Servo, Link USB_SERVOS, Output 1, PosL 0, PosC 562, PosR 988, Type 2 // IAS Servo InstrumentVar 0001, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4, // IAS from SIM{ L0 = DIV &IAS 128 // FSUIPC Conversion Airspeed IAS L0 = ABS L0 // L0 not signed L2 = L0 IF L0 <= 60 // 1. Sector { L1 = L2 * 0.3333333 // ( 20 / 60) = 0.3333...... } ELSE // Out of range { IF L0 <= 100 // 2 sector { L1 = L2 * 2.675 // (107 steps/40 values) = 2.675 L1 = L1 + 20 // Add steps of others sectors (+20) } ELSE // Is a greater value { L2 = L0 - 100 // L2 only have values for next sector IF L0 <= 200 // 3 sector { L1 = L2 * 3.69 // (369 steps / 100 values) = 3.69 L1 = L1 + 127 // Add steps of others sectors (+20 + 107) } ELSE { L2 = L0 - 200 // L2 only have values for next sector IF L0 <= 300 // 4. Sector { L1 = L2 * 2.94 // ( 294 / 100) = 2.94 L1 = L1 + 496 // Add steps of others sectors (20 + 107 + 369) } ELSE // Out of range { L2 = L0 - 300 // L2 only have values for next sector IF L0 <= 400 // 5. sector { L1 = L2 * 1.980 // (198 steps / 100 values) = 1.980 L1 = L1 + 790 // Add steps of others sectors (127 + 369 + 294) } ELSE { L1 = 988 // Max. position of IAS Gauge } } } } &IAS_Servo = 0 + L1 // Add to minimum (0)}}[/CODE] Link to post Share on other sites
aeromax 10 Posted May 18, 2011 Author Report Share Posted May 18, 2011 Yeep. ! Link to post Share on other sites
aeromax 10 Posted May 18, 2011 Author Report Share Posted May 18, 2011 Now using that script with difference. Link to post Share on other sites
Aircraft Aviation 2 Posted May 18, 2011 Report Share Posted May 18, 2011 Hi Max, Of course, you are right. I made a small mathematical error at the start of the script. Try this one instead: Var 0002, name IAS_Servo, Link USB_SERVOS, Output 1, PosL 0, PosC 562, PosR 988, Type 2 // IAS Servo InstrumentVar 0001, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4, // IAS from SIM{ L0 = DIV &IAS 128 // FSUIPC Conversion Airspeed IAS L0 = ABS L0 // L0 not signed L2 = L0 IF L0 <= 60 // 1. Sector { L1 = L2 * 0.333333 // ( 20 / 60) = 0.333333 } ELSE // Out of range { L2 = L0 - 60 // L2 only have values for next sector IF L0 <= 100 // 2 sector { L1 = L2 * 2.675 // (107 steps/40 values) = 2.675 L1 = L1 + 20 // Add steps of others sectors (+20) } ELSE // Is a greater value { L2 = L0 - 100 // L2 only have values for next sector IF L0 <= 200 // 3 sector { L1 = L2 * 3.69 // (369 steps / 100 values) = 3.69 L1 = L1 + 127 // Add steps of others sectors (+20 + 107) } ELSE { L2 = L0 - 200 // L2 only have values for next sector IF L0 <= 300 // 4. Sector { L1 = L2 * 2.94 // ( 294 / 100) = 2.94 L1 = L1 + 496 // Add steps of others sectors (20 + 107 + 369) } ELSE // Out of range { L2 = L0 - 300 // L2 only have values for next sector IF L0 <= 400 // 5. sector { L1 = L2 * 1.980 // (198 steps / 100 values) = 1.980 L1 = L1 + 790 // Add steps of others sectors (127 + 369 + 294) } ELSE { L1 = 988 // Max. position of IAS Gauge } } } } &IAS_Servo = 0 + L1 // Add to minimum (0)}}[/CODE] Regards, Jack Link to post Share on other sites
aeromax 10 Posted May 18, 2011 Author Report Share Posted May 18, 2011 So thats it. Link to post Share on other sites
Aircraft Aviation 2 Posted May 18, 2011 Report Share Posted May 18, 2011 Hi Max, Please try this script for your VSI: Var 0001, name VSI, Link USB_SERVOS, Output 2, PosL 127, PosC 448, PosR 1023, Type 2 // VSI ServoVar 0002, name VSI_D Link FSUIPC_IN, Offset $02C8, Length 4, Type 1 // Vertical Speed{ L0 = &VSI_D * 0.7895 // FSUIPC conversion, L0=VS L0 = ABS L0 // L0 not signed L2 = L0 IF L0 <= 500 // First sector { L1 = L2 * 0.192 // (96 steps/500 values) = 0.192 } ELSE // Is a greater value { L2 = L0 - 500 // L2 only have values for next sector IF L0 <= 1000 // Second sector { L1 = L2 * 0.184 // (92 steps / 500 values) = 0.184 L1 = L1 + 96 // Add steps of others sectors } ELSE { L2 = L0 - 1000 // L2 only have values for next sector IF L0 <= 2000 // 3. Sector { L1 = L2 * 0.131 // ( 131 / 1000) = 0.131 L1 = L1 + 188 // Add steps of others sectors 96 + 92 } ELSE { L2 = L0 - 2000 // L2 only next sector IF L0 <= 4000 // 4. Sector { L1 = L2 * 0.0315 // ( 132 / 2000) =0.066 L1 = L1 + 319 // Add steps of others sectors 92 + 96 + 131 } ELSE // Out of range { L1 = 1023 // Max. position } } } } IF &VSI_D < 0 // If VSI is Negative { &VSI = 572 - L1 // Subctract from center } ELSE { &VSI = 572 + L1 // Else add to center }}[/CODE] Link to post Share on other sites
aeromax 10 Posted May 18, 2011 Author Report Share Posted May 18, 2011 Ok. Link to post Share on other sites
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now