PDA

View Full Version : SIOC Script for Speed-Indicator CS 753 FS2004



aeromax
05-16-2011, 10:50 AM
Hi Folks, :lol:

i´m right new here and is the first topic. first of all, hello to everybody. so, i´m building a multiplex cockpit by original rebuild aircraft parts with belongings e.g. interfaces, servocards, usb-devices. now i trying to fix a speedindicator with Servocard from opencockpits (OC) with Servomotor and SIOC.

I´m using one Westwind Speedindicator 0-400 Kt./ KIAS.

THAT IS THE SCRIPT I´M USING:

var 0
{
&outIAS = 511
}


var 2 name IASin Link FSUIPC_INOUT, Offset $02BC, Length 4 // SPEED HLD
{
L0 = &IASin
L1 = L0 / 128
L2 = L1 * 2
&OutIAS = L1 + L2
}

Var 10 name outIAS Link USB_SERVOS, Output 1, PosL 0, PosC 511, PosR 800, Type 1 // Output Valve

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

The Problem is, if i set the thrust-levers to full forward, the servo turns at first to fast. But if i stop the simulation at 100Kt (753 Captain Sim). and adjust the Speed-(Servo)-Indicator to 100kt back; it works fine; increasing and decreasing speed ist perfect. After landing with RVR and brakes-action to full stop the Speed-(Servo) is turning backwards after reaching 0 Kt. - thats the problem after restart or for a second takeoff.

I fixed a little pin at 0 Kt.marker on dial for needle, but the servo is to strong and turns the cogwheel at axis. Without the pin the neddle stop at close to 300 Kt.

So Anybody now´s about the problem and how to fix that. :?: All devices i got aren´t helpful.

THANKS, regards :-D

fordgt40
05-16-2011, 12:38 PM
What are your servo values when the gauge needle is at 0 knots, 200 knots and 400 knots?

We can then help with amending your code

David

aeromax
05-16-2011, 04:28 PM
Thanks for fast responding; perfect :D

so i tried since my tread here und finished right now. also i tried the values with the script below and it works better now. only in case of decrease speed the needle is a little bit slower (different like 08-10 kts to sim).


var 0
{
&outIAS = 562
}


var 2 name IASin Link FSUIPC_INOUT, Offset $02BC, Length 4 // SPEED HLD
{
L0 = &IASin
L1 = L0 / 41
L2 = L1 * 1.6
&OutIAS = L1 - 150
}

Var 10 name outIAS Link USB_SERVOS, Output 1, PosL 0, PosC 562, PosR 988, Type 1 // Output Valve
------------------------------------------------------------------------------

The script before i got from a other person. Never seen before...SIOC, first time.

That are the Values now (got it with SIOC-Text.exe)
0 = 0
100=127
160=344
200=496
250=658
300=790
400=988

------------------------------------------------------------------------------
Now i changed to this Script but not tested at present:

var 0
{
&outIAS = 496
}


var 2 name IASin Link FSUIPC_INOUT, Offset $02BC, Length 4 // SPEED HLD
{
L0 = &IASin
L1 = L0 / 41
L2 = L1 * 1.6
&OutIAS = L1 - 150
}

Var 10 name outIAS Link USB_SERVOS, Output 1, PosL 0, PosC 496, PosR 988, Type 1 // Output Valve

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

The most problem exist about different speeds. If the speed up is synchronal perfect the decrease of speed is mostly to low and also backwards/reversed.

So i´ll THANK YOU FOR YOUR HELP :-)

fordgt40
05-16-2011, 04:57 PM
Firstly, change

var 0
{
&outIAS = 562
}

to

var 0
{
&outIAS = 0
}

This will set your needle to zero speed when the programme is first run

The values for the servo positions versus speed are not linear. Is this the case with your gauge dial, eg is the distance around the gauge from 0 to 100 much less than the distance from 100 to 200. The reason I ask is that it makes the programming more difficult :roll: This is perhaps why you are seeing a mismatch between the gauge and your real speed. There are also some changes needed to your coding, but first we need to establish whether your gauge face is linear or not

David

kiek
05-16-2011, 05:41 PM
Tip:
Change


var 2 name IASin Link FSUIPC_INOUT, Offset $02BC, Length 4 // SPEED HLD

into


var 2 name IASin Link FSUIPC_IN, Offset $02BC, Length 4 // SPEED HLD

because you only read from that offset (not write to).

Nico

aeromax
05-17-2011, 03:42 AM
sounds perfect. so i gonna test that later on. :D and ´ll let you know

would it be helpful if i post a picture of the dial of the speed-indicator (where i should post it?), because it seems to be, that this one is not really linear (mentioned once before).

so if the speed-indicator is completed and tested ok, i´ll give everybody all the information about the constructions who want to know.

GREAT ! THANK YOU A LOT !!:cool:

aeromax
05-17-2011, 11:49 AM
so if i change to that:

to 0 in place of 562

fordgt40
05-17-2011, 12:00 PM
Here you are. I suggest that you thoroughly read and understand this coding. I have used your servo values for the respective speeds and divided the dial scale into 4 sectors, each with its own scaling factor to allow for the linear progression. You can add additional sectors using this logic and by amending the code. It should work !!:)


var 2 name IASin Link FSUIPC_IN, Offset $02BC, Length 4 // SPEED
{
L0 = &IASin / 128
L0 = ABS L0
IF L0 < 0 // check for less than 0 to avoid overdriving the servo
{
L1 = 0 // minimum range of servo movement
}
ELSE
{
IF L0 < 127 // If speed is less than 127 then it is in the first

sector
{
L1 = L0 * 1.27
}
ELSE
{
IF L0 <= 200 // speed is in the second sector
{
L2 = L0 - 100
L1 = L2 * 3.69 // servo ramp. IAS from 100 to 200 knots moves

the servo 369 units
L1 = L1 + 127
}
ELSE
{
IF L0 <= 300 // speed is in the third sector
{
L2 = L0 - 200
L1 = L2 * 2.94 // servo ramp. IAS from 200 to 300 knots moves

the servo 294 units
L1 = L1 + 496
}
ELSE
{
IF L0 <= 400 // Speed is in 4th sector
{
L2 = L0 - 300
L1 = L2 * 1.98 // servo ramp. IAS from 300 to 400 knots

moves the servo 198 units
L1 = L1 + 790
}
ELSE
{
IF L0 > 400 // If speed greater than 400 then do not

overdrive the servo
{
L1 = 988 // maximum range of servo movement
}
}
}
}
}
}
&OutIAS = L1
}



Var 10 name outIAS Link USB_SERVOS, Output 1, PosL 0, PosC 496, PosR 988 //

aeromax
05-17-2011, 12:24 PM
thanks. good.

Boeing 747 Flyer
05-17-2011, 12:53 PM
Hi Max,

I also posted this on the MH forums for you, but I'll post here too.

it is very similar to Davids, just slightly different in layout. It was taken from my script for an EGT Gauge from a year ago; it works perfectly. I also think David has used the same steps (100 per).


Var 0002, name IAS_Servo, Link USB_SERVOS, Output 1, PosL 0, PosC 562, PosR 988, Type 2 // IAS Servo Instrument

Var 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)
}

Also, changing FSUIPC_INOUT to FSUIPC_IN won't change anything; it will just reduce cycle time (as you are just "looking at" the offset, not sending values to it).

Regards,

Jack

aeromax
05-18-2011, 10:32 AM
..i replied it already, but it is still in proof of administrator.

fordgt40
05-18-2011, 11:28 AM
..i replied it already, but it is still in proof of administrator.

???????????

How did you get on with the script that I wrote for you?

David

fordgt40
05-18-2011, 04:30 PM
I see that you are working with Jack on another forum to develop your script. I am glad that you both have nearly sorted out the problem. Just a shame that I invested time on your behalf for no purpose :-(

David

aeromax
05-18-2011, 06:14 PM
Hi David, sorry for that misunderstanding,

i already wrote one answer and this one twice in case i had added two links after i tried your Script. Also i said thank you for that, but the respond here was; that the administrator have to check the mail before set/ setting online, whyever. Between this time i got the Script from Jack and this one was also tested by me. Then i returned back to this page and there was no answering mail. For that i fixed the short text, that i had sent one mail already. It was never my Intension, that i´ll let you write a script for nothing. Sorry for that misunderstanding here. It is my fault, right. If i can do it well, let me know. For every Information also i can give, no problem. Sorry for that. :(

P.S. i don´t know where my posting from before is ??? how long does it take - to proof ???

best wishes, and really sorry for that !.

fordgt40
05-19-2011, 03:58 AM
Hi

I fully understand now - it is all Matt`s fault - cannot keep up with us :)
Thanks for the explanation. No worries, the matter is closed and good luck

David

aeromax
05-19-2011, 04:34 AM
Hi David,

thanks for your Respond. Appreciate it !. So I'm still wondering where my Posting from before are ?. For that i added two links in Posting before and afterwords (at proceed Submitt/Send) i got the Message that the Admin.have to check before. I thought i did a mistake and sent once again, but the same message. Til Today the Posting isn't here, how can that be ?!.

So never had this before. If i can help or if you need orig.Aircraftparts for FlightSim, let me know.

THANK YOU !. Best Wishes ! Max.