Hi All,
I use Sim Avionics suite from FDS and I'm looking for a Sioc script for SimA with my Revolution Simproduct motorized TQ.
But I don't find this script :'( Do you have this script ? Can you help me ?
If I use the ProSim SIOC script for motorized TQ with SimA, it's works?
Thanks a lot
Here you are. You will need to define the appropriate FSUIPC_IO_ini entries with offset addresses and change the offset references in this script to match. Also you may need to change the coding to suit servos/dc motors dependent on your hardware. Also you will need to change the throttle position values etc to suit your throttle This code runs on a Symulatory motorised throttle - the changes are not difficult, if you have some knowledge of SIOC
David
Edited to add comments to key bits of code
// *****************************************************************************
// * Config_SIOC ver 3.5 - By Manolo Vélez - www.opencockpits.com (http://www.opencockpits.com)
// *****************************************************************************
//
// * Editor: Hermann Hummer www.simhard.eu.tt (http://www.simhard.eu.tt) and DJB
Var 0 Value 0
{
&trim_1_servo = 400
&trim_2_servo = 850
&lever2_motor = 0
&lever1_motor = 0
&pegservo = 580
&spdservo = 0
&horn_current = &horn_cutout
}
Var 1, name lever2_motor link USB_DCMOTOR output 3 // Motor control no 2 on USBCDCMotors Card
Var 2, name lever1_motor link USB_DCMOTOR output 1 // Motor control no 1 on USBCDCMotors Card
Var 3, name Lever1_upper, Value 253 // Upper potentiometer value of Lever1 set these values so that the levers do not hit the stops
Var 4, name Lever2_upper, Value 229 // Upper potentiometer value of Lever2 set these values so that the levers do not hit the stops
Var 5, name Lever1_idle, Value 14 // Idle potentiometer value of Lever1 set these values so that the levers do not hit the stops
Var 6, name Lever2_idle, Value 0 // Idle potentiometer value of Lever2 set these values so that the levers do not hit the stops
Var 7, name dead_area1 // to avoid jitter, we need to define a 'dead area' for the potentiometers
Var 8, name break_dist1 // how many points do we need for brake the motors to zero distance for the levers to slow down ie go at lower speed as approaching desired position - stops fast movement for small distances
Var 9, name current_break1 // we can define a brake speed for the motor define slower speed when approaching desired position- stops fast movement for small distances
Var 10, name current_run1 // Speed for motor when running normal speed when not near desired position
Var 11, name dead_area2
Var 12, name break_dist2
Var 13, name current_break2
Var 14, name current_run2
Var 15, name Lever1_factor // Distance FS / PointPot
Var 16, name Lever2_factor // Apply Distance_Pot to Distance FS
Var 17, name Pot1_factor // Distance Pot / PointPot
Var 18, name Pot2_factor // Apply Distance_Pot to Distance Lever
{
&dead_area1 = 3 // to avoid jitter, we need to define a 'dead area' for the potentiometers // the below variables are the ones to fine tune the motor speeds etc
&break_dist1 = 5 // how many points we need for brake the motors to zero
¤t_break1 = 10 // we can define a brake speed for the motor
¤t_run1 = 40 // Speed for motor when running
&dead_area2 = 3
&break_dist2 = 5
¤t_break2 = 10
¤t_run2 = 40
}
Var 19, name Leverdiscon, Link FSUIPC_OUT Offset $310A length 1
Var 20, name Pause, Link FSUIPC_IN, Offset $0262, Length 2 // is Pause mode active?
Var 21 name speed Link FSUIPC_INOUT offset $5377 length 2 // Sorry do not know where I got this offset from, suggest use FSUIPC IAS offset
Var 22, name Lever1_to_FS, Link FSUIPC_OUT, Offset $089A, Length 2 // Send value of Lever1 to FS
Var 23, name Lever2_to_FS, Link FSUIPC_OUT, Offset $0932, Length 2 // Send value of Lever2 to FS
Var 24, name lever2_diff // diff where the Lever2 is and where it should be
Var 25, name lever1_diff // diff where the Lever1 is and where it should be
Var 26 name temp1
Var 27 name temp2
Var 28 name temp3
Var 29, name acongnd, Link FSUIPC_INOUT, Offset $0366, Length 2 // aircraft on ground flag
{
IF &acongnd = 1
{
&pegservo = 545 // remove flight detent sop
IF &spoilerARM = 1
{
&spdservo = 865 // move spoiler arm to full up
&spdservo = DELAY 0 100
&Spdbr_up = 1
}
}
ELSE
{
&pegservo = 705 // set in flight detent stop
}
}
Var 30, Link FSUIPC_IN, name L1_target, Offset $53e0, Length 2 // FSX: Where Lever1 should be SA COMMANDED_THROTTLE_L_POSITION=
{
// because the potentiometer differ in value, we align the potentiometer value to the leverlength
L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 12800 / L0 // Distance Pot = 128 * 100
&Pot1_factor = L1
L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS
L1 = L0 * &Pot1_factor // apply length lever to pot
L1 = L1 / 100
L2 = &L1_target / 100
&Lever1_diff = L1 - L2 // where the lever is and where it should be
IF &AT > 0 // A/T is on
{
CALL &MOTOR_LEVER // subroutine for motor motion
}
}
Var 31, Link FSUIPC_IN, name L2_target, Offset $53e2, Length 2 // FSX: Where Lever2 should be SA COMMANDED_THROTTLE_R_POSITION=
{
L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 12800 / L0 // Distance Pot = 128
&Pot2_factor = L1
L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS
L1 = L0 * &Pot2_factor
L1 = L1 / 100
L2 = &L2_target / 100
&Lever2_diff = L1 - L2
IF &AT > 0 // A/T is on
{
CALL &MOTOR_LEVER // subroutine for motor2 motion
}
}
Var 32, name Lever1_Pot, Link USB_ANALOGIC, Input 3, PosL 0, PosC 127, PosR 254 // Lever1 Pot position on USBCDCMotors Card
{
IF &AT = 0
{
IF &Spdbr_up = 1
{
IF &speed < 25
{
IF &Lever1_Pot > 17
{
&spdservo = 396 // Return spoiler arm to down
&spdservo = DELAY 0 100
}
}
}
L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 16383 / L0 // Distance FS = 16383
L1 = TRUNC L1
&Lever1_factor = L1
L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS
L1 = L0 * &Lever1_factor
L1 = TRUNC L1
&Lever1_to_FS = L1 // Send Lever1 Position to FS
}
}
Var 33, name Lever2_Pot, Link USB_ANALOGIC, Input 4, PosL 0, PosC 127, PosR 254 // Lever2 Pot position on USBCDCMotors Card
{
IF &AT = 0
{
IF &Spdbr_up = 1
{
IF &speed < 25
{
IF &Lever2_Pot > 1
{
&spdservo = 396 // Return spoiler arm to down
&spdservo = DELAY 0 100
}
}
}
L0 = &Lever2_upper - &Lever2_idle // Upper Pot Value - Idle Pot Value
L1 = 16383 / L0 // Distance FS = 16383
L1 = TRUNC L1
&Lever2_factor = L1
L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS
L1 = L0 * &Lever2_factor
L1 = TRUNC L1
&Lever2_to_FS = L1 // Send Lever2 Position to FS
}
}
Var 34, name AT, Link FSUIPC_IN offset $53E4 length 1 // is AutoPilot MasterSwitch active? SA THRUST_REF_MODE=
{
IF &AT = 0 // A/T is OFF
{
&lever1_motor = 0
&lever2_motor = 0 // motor stops
&Leverdiscon = 0 // Connect both LeverPots to FS
}
ELSE
{
&Leverdiscon = 192
}
}
Var 35, name Motor_Lever, Link SUBRUTINE // USB_DC controls motors for Lever1&2
// Motor control 0-127 = left; 129-255 =Right; 0 stops
// Lever no 1
{
L0 = &lever1_diff
L1 = 128
IF L0 < 0
{
L1 = 0 // Motor run direction
}
L0 = ABS L0
L2 = ¤t_run1 + L1 // Lever1 Motor runs at full speed
IF L0 <= &break_dist1
{
L2 = ¤t_break1 + L1 // Lever1 Motor runs with brake speed
}
L0 = ABS L0
IF L0 <= &dead_area1
{
L2 = 0
}
&temp1 = l2
// Lever no 2
L0 = &lever2_diff
L1 = 128
IF L0 < 0
{
L1 = 0
}
L0 = ABS L0
L2 = ¤t_run2 + L1 // Lever2 Motor runs at full speed
IF L0 <= &break_dist2
{
L2 = ¤t_break2 + L1 // Lever2 Motor runs with brake speed
}
L0 = ABS L0
IF L0 <= &dead_area2
{
L2 = 0
}
&Temp3 = &lever1_diff - &lever2_diff // this section tries to keep the levers in sync
&temp3 = ABS &temp3
IF &temp3 <= 3
{
&lever1_motor = L2
&lever2_motor = L2
}
ELSE
{
&temp2 = l2
&lever2_motor = L2
&lever1_motor = &temp1
}
}
Var 36, name Reverser1, Link USB_ANALOGIC, Device 1, Input 2, PosL 5, PosC 125, PosR 255 on USBServos Card
{
IF &acongnd = 1
{
&Leverdiscon = 0
IF &Lever1_Pot < 17
{
L0 = &Reverser1 - 255
L0 = ABS L0
&Lever1_to_FS = L0 * -15.4
}
}
}
Var 37, name Reverser2, Link USB_ANALOGIC, Device 1, Input 1, PosL 5, PosC 125, PosR 255 on USBServos Card
{
IF &acongnd = 1
{
&Leverdiscon = 0
IF &Lever2_Pot < 1
{
L0 = &Reverser2 - 255
L0 = ABS L0
&Lever2_to_FS = L0 * -16
}
}
}
Var 40, name TrWhlNoseUp, Value 242 // TRIMWHEEL NOSE UP 220
Var 41, name TrWhlNoseDn, Value 122 // TRIMWHEEL NOSE DOWN 100
Var 42, name trim_2_servo, Link USB_SERVOS, device 1 Output 4, PosL 1, PosC 511, PosR 1023 on USBServos Card
Var 43, name trim_1_servo, Link USB_SERVOS, device 1 Output 3, PosL 1, PosC 511, PosR 1023 on USBServos Card
Var 44, name trim, Link FSUIPC_INOUT, Offset $0BC0, Length 2, type 1 // elevator trim position
{
L0 = &trim / 40
L1 = 960 - L0
IF L1 < 770
{
L1 = 770
}
IF L1 > 990
{
L1 = 990
}
&Trim_2_servo = L1
&Trim_1_servo = L1 - 527
&trimeski = DELAY &trim ,150
&trimfark = &trim - &trimeski
}
Var 45 name trimstart link SOUND // this section provides trim wheel sound
Var 46 name trimstop link SOUND Type S
Var 49 name trimmotor, Link USB_DCMOTOR, Output 5 on USBDCMotors card
{
IF &trimmotor = 0
{
&trimstop = 1
&trimstop = 0
&trimstop = 2
&trimstop = 0
}
ELSE
{
IF &trimfark > 30
{
&trimstart = 1
&trimstart = 0
}
IF &trimfark < -30
{
&trimstart = 2
&trimstart = 0
}
}
}
Var 50, name trimeski
Var 51, name trimfark
{
IF &AT > 0
{
IF &trimfark > 30
{
&trimmotor = &TrWhlNoseDn
&trimmotor = DELAY 0 ,400
}
IF &trimfark < -30
{
&trimmotor = &TrWhlNoseUp
&trimmotor = DELAY 0 ,400
}
}
}
Var 52, name pegservo, Link USB_SERVOS, Device 1 Output 1, PosL 648, PosC 681, PosR 714 // Flight Detent block on USBServos Card
Var 53, name spoilerFS, Link FSUIPC_INOUT, Offset $0BD0, Length 4 // spoiler position control byte
Var 54, name spoilerARM, Link FSUIPC_INOUT, Offset $0BCC, Length 4 // Spoiler arm (1)
Var 55 name spdservo link usb_servos, Device 1 output 2 posl 390, posc 628, posr 866 on USBServos Card
Var 56 name Spoiler_pot Link USB_Analogic Device 1 Input 3 posl 0 posC 72 posR 144 on USBServos Card
{
IF &Spoiler_pot > 150
{
&Spdbr_up = 1
}
IF &Spoiler_pot = 0
{
&spoilerFS = 0
&Spdbr_up = 0
}
IF &Spoiler_pot > 0
{
IF &Spoiler_pot < 20
{
IF &Spdbr_up = 0
{
&spoilerFS = 4800
}
}
IF &Spoiler_pot > 20
{
L0 = &Spoiler_pot * 64
IF L0 > 5620
{
&spoilerFS = L0
}
}
}
}
var 57 name horn_temp
Var 58 name horn_current
Var 59 name Horn_Cutout link iocard_sw input 1
{
IF &Horn_Cutout <> &horn_current
{
&horn_temp = 1
&horn_current = &horn_cutout
}
IF &Horn_Cutout = 1
{
&Multi_Func = 1091
}
}
Var 60 name TOGA Link FSUIPC_INOUT Offset $53E5 Length 1 // SA Offset for MCP_TOGA=
Var 61 name Toga_btn_CP Link IOCARD_SW Input 6 // TOGA Lever switch
{
&TOGA = &Toga_btn_CP
}
Var 62 name Toga_btn_FO Link IOCARD_SW Input 3 // TOGA Lever switch
{
&TOGA = &Toga_btn_FO
}
Var 63 Name Spdbr_up // Speedbrake Up Flag
Var 64 Name Brake_light Link IOCARD_OUT Output 12 // Parking Brake light
Var 65 Name P_Brake link IOCARD_SW Input 17 // Parking Brake lever
{
&Brake_light = &P_Brake
IF &P_Brake = 1
{
&Multi_Func = 591
}
ELSE
{
&Multi_Func = 590
}
}
Var 66 Name Multi_Func Link FSUIPC_INOUT Offset $53FE Length 2 // Sim Avionics multi function offset
Var 67 Name AT_Disc_FO link IOCARD_SW Input 7 // A/T Disconnect switch
{
IF &AT_Disc_FO = 1
{
&Multi_Func = 564
}
}
Var 68 Name AT_Disc_CP link IOCARD_SW Input 2 // A/T Disconnect switch
{
IF &AT_Disc_CP = 1
{
&Multi_Func = 564
}
}
Var 69, name flappos, Link FSUIPC_INOUT, Offset $0BDC, Length 4 // Flaps control, 0=up, 16383=full.
Var 70 name Flap_Pot Link USB_Analogic Device 1 Input 4 posl 0 posC 127 posR 254 on USBServos Card
{
IF &Flap_Pot <= 205
{
IF &Flap_Pot > 195
{
&flappos = 0
}
}
IF &Flap_Pot <= 176
{
IF &Flap_Pot > 170
{
&flappos = 2047 // flaps 1
}
}
IF &Flap_Pot <= 150
{
IF &Flap_Pot > 140
{
&flappos = 4095 // flaps 2
}
}
IF &Flap_Pot <= 125
{
IF &Flap_Pot > 115
{
&flappos = 6143 // flaps 5
}
}
IF &Flap_Pot <= 95
{
IF &Flap_Pot > 90
{
&flappos = 8191 // flaps 10
}
}
IF &Flap_Pot <= 65
{
IF &Flap_Pot > 60
{
&flappos = 10239 // flaps 15
}
}
IF &Flap_Pot <= 36
{
IF &Flap_Pot > 30
{
&flappos = 12287 // flaps 25
}
}
IF &Flap_Pot <= 5
{
IF &Flap_Pot > 1
{
&flappos = 14335 // flaps 30
}
}
IF &Flap_Pot = 0
{
&flappos = 16383 // flaps 40
}
}
Var 71 Name Fuel_cut_1 Link IOCARD_SW Input 0 // Fuel cut off lever
{
IF &Fuel_cut_1 = 1
{
&Multi_Func = 842
}
ELSE
{
&Multi_Func = 843
}
}
Var 72 Name Fuel_cut_2 Link IOCARD_SW Input 4 // Fuel cut off lever
{
IF &Fuel_cut_2 = 1
{
&Multi_Func = 844
}
ELSE
{
&Multi_Func = 845
}
}