1 / 67

Introduction to SIOC By Manuel Vélez (Translation by Manuel Hdez-Peña)

Introduction to SIOC By Manuel Vélez (Translation by Manuel Hdez-Peña). www.opencockpits.com. Introduction to SIOC. Designed to control not only the electronic hardware, but the simulation too. Balance between power and programming simplicity. Simulation linking element (control core). .

edolie
Télécharger la présentation

Introduction to SIOC By Manuel Vélez (Translation by Manuel Hdez-Peña)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to SIOC By Manuel Vélez (Translation by Manuel Hdez-Peña) www.opencockpits.com

  2. Introduction to SIOC • Designed to control not only the electronic hardware, but the simulation too. • Balance between power and programming simplicity. • Simulation linking element (control core). Introduction to SIOC

  3. SIOC structure SIOC IOCP CLIENTE module IOCP SERVER SIOC Language interface FSUIPC CLIENT module Link with IOCards module Introduction to SIOC

  4. SIOC <-> IOCP • SIOC is based in IOCP protocol. • It’s needed to know how IOCP works to understand SIOC. • SIOC is an IOCP server itself. • SIOC is based in EVENTS. Introduction to SIOC

  5. INPUTS - Joystick - Keyboard… OUTPUTS - Virtual landscape - Sound, gauges… The Flight Simulator Flight Simulator Simulation internal variables Simulation process X times per second Introduction to SIOC

  6. IOCP Server IOCP vars INPUTS - Joystick - Keyboard… OUTPUTS - Virtual landscape - Sound, gauges… Linking to flight simulator Flight Simulator Simulation proccess Simulation internal variables Introduction to SIOC

  7. IOCP Server IOCP vars Linking to flight simulator IOCP Client Flight Simulator Simulation internal variables IOCP Client IOCP Client TCP/IP network Introduction to SIOC

  8. How IOCP works IOCP Client - 1 IOCP Server IOCP vars #0000 = 1 #0000 = 9 TCP/IP connection #0001 = 0 #0002 = 11 #0002 = 23 I want to know about #2 y #4 #0003 = 8 #0004 = 0 #2=23, #4=0 #2=11 #9999 = 1 Client-1 Var #0002 Var #0004 Client-1 Var #0002 Var #0004 Introduction to SIOC

  9. IOCP vs FSUIPC • IOCP is faster because: • The client doesn’t ask for information constantly. • There’s no need of additional software to connect remotely. • IOCP is more efficient because: • Only the required information is sent. • If information doesn’t change, nothing is sent. Introduction to SIOC

  10. System based on events • SIOC is an IOCP server. • SIOC events modify the internal variables (the ones in the internal IOCP server). • There are 3 types of events: • Due to a variable change (internal or external). • Due to a change in the IOCards inputs (digital or analogic). • Due to a Timer action. Introduction to SIOC

  11. Scripts execution due to events Associated script IOCP variable SIOC SIOC Module Iocards, IOCP or FSUIPC A change happens Introduction to SIOC

  12. Events triggered from scripts (1) Associated script IOCP variable SIOC SIOC Module Iocards, IOCP or FSUIPC Change Introduction to SIOC

  13. Events triggered from scripts (2) Associated script IOCP variable SIOC Introduction to SIOC

  14. Diagram: SIOC and other elements connection Introduction to SIOC

  15. SIOC – The golden rule • SIOC only run a script associated to a variable IF THIS VARIABLE CHANGES ITS VALUE. • The only exception is in the case of special variables named SUBROUTINES, that run the associated script EVERY TIME they take part in an assignment or when the CALL command is executed. Introduction to SIOC

  16. SIOC software • There are 2 programs and one configuration file: • Config_SIOC.exe: to define scripts. • SIOC.exe: SIOC core. • SIOC.ini: configuration file. Introduction to SIOC

  17. SIOC.INI • SIOC.INI file configures each SIOC module: IOCP CLIENT module IOCP SERVER SIOC Language interface FSUIPC CLIENT module IOCards linking module Introduction to SIOC

  18. IOCP CLIENT module [ Desactivar el módulo cliente IOCP ] [ Disable IOCP client module ] IOCPclient_disable=yes [ IP del servidor donde debe de conectar el cliente ] [ IOCP client host name ] IOCPclient_host=localhost [ Puerto de envio del protocolo IOCP cliente ] [ IOCP client port ] IOCPclient_port=8090 Introduction to SIOC

  19. SIOC.INI IOCP CLIENT module IOCP SERVER SIOC Language interface FSUIPC CLIENT module IOCards linking module Introduction to SIOC

  20. FSUIPC CLIENT module [ Desabilitar lectura de las FSUIPC ] [ FSUIPC disable mode yes/no ] FSUipcdisable=No [ Refresco recepción FSUIPC ] [ FSUIPC refresh ] FSUipcRefresh=100 Introduction to SIOC

  21. SIOC.INI IOCP CLIENT module IOCP SERVER SIOC Language interface FSUIPC CLIENT module IOCards linking module Introduction to SIOC

  22. IOCards linking module USB=no MUSB=No deviceUSB=2048 USB_AD=0 Port=$0378 FullCompatible=No NCards=1 Expansion=No simulator=No MasterRefresh=10 Introduction to SIOC

  23. SIOC.INI IOCP CLIENT module IOCP SERVER SIOC Language interface FSUIPC CLIENT module IOCards linking module Introduction to SIOC

  24. IOCP server [ Puerto del servidor IOCP ] [ IOCP port ] IOCP_port=8092 [ Tiempo de respuesta máximo de los paquetes IOCP ] [ IOCP Timeout ] IOCP_timeout=4000 Introduction to SIOC

  25. SIOC scriptslanguage // ***************************************************************************** // * Config_SIOC ver 1.8 Beta - By Manolo Vélez - www.opencockpits.com // ***************************************************************************** // * FileName : sioc.txt // * Date : 21/10/2004 Var 0001, Link FSUIPC_IN, Offset $07F2, Length 2 { C0 = TESTBIT V0001 ,15 IF C0 { L0 = 65536 - V0001 V0002 = L0 * -1 } ELSE { V0002 = V0001 } } Var 0002 // Real value for V/S Introduction to SIOC

  26. SIOC scripts language • Variables definition language. Each SIOC variable and its attributes are defined depending on its LINK. • Commands execution language. Functions, assignments, conditions and other types of commands executed in sequence. Introduction to SIOC

  27. Defining variables in SIOC • To work with a SIOC module, we have to link our SIOC variable with the module we want to work with, defining the attributes of the module and which particular element in the module we want to control. • By this link, when our SIOC variable takes a value, an output will be generated via the defined module, and the variable value will change following the calculations made in the module. Introduction to SIOC

  28. Types of LINKS Module LINK definition Description FSUIPC module FSUIPC_OUT Sends data to FSUIPC offsets. FSUIPC_IN Receives data from FSUIPC offsets. IOCP Client module IOCP Sends and receives IOCP variables data. IOCARD_SW Works with IOCards switches (inputs). IOCards module IOCARD_OUT Turns on/off IOCards outputs. IOCARD_DISPLAY Sends data to IOCards displays. IOCARD_ENCODER Receives data from IOCards encoders. IOCARD_ANALOGIC Receives data from IOCards analog inputs. IOCARD_SERVO Moves IOCards servomotors. IOCARD_MOTOR Moves IOCards DC and stepper motors SIOC SUBRUTINE Manages a variable as a Subroutine. Introduction to SIOC

  29. Valid ATTRIBUTES in SIOC Attribute Description Link Defines type of link for the variable Type Defines special characteristics of the element Offset IOCP remote variable number or FSUIPC offset Value Initial value for the variable Length FSUIPC offset lenght Input Initial input in the Master card that variable links to Output Initial output in the Master card that variable links to Digit First figure in the Displays card that defines a number Aceleration Encoder acceleration factor Numbers Number of figures (displays) needed by the variable PosL Left position calibration PosC Centre position calibration PosR Right position calibration Introduction to SIOC

  30. Scripts language main characteristics • Different identifiers, variables, constants and other elements are always separated by spaces, commas, brackets or tabulators. • { and } are used to indicate different levels. • // can be used to insert general comments at the beguining of a line or at the end of a command line as a particular comment. • Only one definition or command is allowed in each line. • There’s no difference between uppercase and lowercase. Introduction to SIOC

  31. Temporary internal variables • We can use different types of temporary internal variables that only are valid for the script associated to a SIOC variable. • There are two types: • Real, named L0, L1 y L2. They can store decimal, integer, positive and negative values in the range 5 x 10^-324 a 1.7 x 10^308. • Boolean, named C0, C1 y C2. They can store the value of a condition (true or false). • We can make reference to a SIOC variable in our scripts by naming it V + number of the SIOC variable, for example V0001. Introduction to SIOC

  32. SIOC variables definition using scripts language Var Number 0-9999 Attribute parameter Attribute parameter … Examples : Var 0001, Link FSUIPC_IN, Offset $07F2, Length 2 Var 0001, Link IOCARD_ENCODER, Input 0, Acceleration 8, Type 1 // Encoder dec. Var 0006, Link IOCARD_DISPLAY, Digit 0, Numbers 5 Var 9023 Introduction to SIOC

  33. Linking a SIOC variable to different modules Var 0001 Defines SIOC variable 0001, ready to be used Var 0006 , Value 360 // We will store heading here Here we define an initial value and insert a particular comment Var 1387, Link FSUIPC_OUT, Offset $0BDE, Length 2 Here we link with FSUIPC module (offset $0BDE, length 2). If variable 1387 changes, the value will be sent to FSUIPC Var 9341, Link FSUIPC_IN, Offset $0C32, Length 4 Variable 9341 will receive the value in offset $0C32 when it changes and the associated script will be launched then. Introduction to SIOC

  34. Linking a SIOC variable to different modules Var 0009 , Link IOCARD_SW, Input 25, Type P Links variable 0009 with a switch connected to IOCards. If input (switch) Changes to OFF the value will be 0, and if input changes to ON value will be 1. Var 0006 , Link IOCARD_OUT, Output 54 // Led del F/D If variable 0006 changes to 1, output 54 in IOCards will be enabled If variable 0006 changes to 0, output 54 in IOCards will be disabled Var 1387, Link IOCARD_DISPLAY, Digit 0, Numbers 3 The value in the variable will be shown on 3 displays starting at #0. If we are using negative values, we have to use one addtional display. Var 9341, Link IOCARD_ENCODER, Input 3, Aceleration 1, Type 1 Each encoder click will send a value between 1 and 1+acceleration to the variable. The encoder is connected to input 3 and the type is defined Variable value will be 0 if encoder doesn’t turn. Introduction to SIOC

  35. Linking a SIOC variable to different modules Var 0009 , Link IOCARD_ANALOGIC, Input #2, PosL 1, PosC 127, PosR 255 Variable receives the value from analog input #2, calibrated with values 1, 127 and 255 (left, center and right). Var 1209 , Link IOCARD_SERVO, Output 7, PosL 1, PosC 127, PosR 255 Servo in output 7 receives the value from variable 1209, previously adjusted with the calibrating parameters. We can define the 10 bits resolution control Var 1387, Link IOCARD_MOTOR, Output 187, Aceleration 14, Type D Depending on the variable value (> or <127), the motor connected to output 187 will turn one way or the other, with an acceleration coefficient of 14 Var 9999, Link SUBRUTINE Variable 9999 will be a SUBROUTINE, so the associated script will be automatically run with the CALL command. Introduction to SIOC

  36. Defining a script associated to a SIOC variable Var Number 0-9999 Attribute parameter Attribute parameter … { Command parameters Command parameters . . . } Example : Var 0001, Link FSUIPC_IN, Offset $07F2, Length 2 { V0002 = V0001 + 1 CALL = V9999 L1 = V0001 * 1.35 L1 = ROUND L1 } Introduction to SIOC

  37. Associated scripts execution SIOC scripts manager SIOC IOCP server Introduction to SIOC

  38. Allowed COMMANDS in SIOC Command Description Assignment With this command we can assign values or calculation to the different SIOC variables. Function Different functions used with different SIOC variables CALL Lets run a script associated to a SUBROUTINE type variable, even send it a parameter. IF condition Run related commans only if the condition is true ELSE condition Part of an IF condition, lets run commands when the IF condition is false. Introduction to SIOC

  39. Allowed OPERATORS in SIOC Operator Description + Adds two variables or constants - Subtracts two variables or constants * Multiplies two variables or constants / Divides two variables or constants AND Logic operation, or AND condition OR Logic operation, or OR condition > “Higher than” condition < “Lower than” condition = “Same as” condition >= “Higher or same as” condition <= “Lower or same as” condition <> “Different” condition Introduction to SIOC

  40. ASSIGNMENT command Variable Variable = Constant Variable Variable Variable = Operator Constant Constant Examples: { V0002 = V0008 * 3.14 L2 = 3.8673 L1 = V0001 AND 128 C1 = L1 < 5 } Introduction to SIOC

  41. FUNCTIONS allowed in SIOC Funtion Description Round Rounds the value to the closest integer Trunc Takes only the integer part from a variable Timer Programs periodic events using a chrono SetBit Sets specific bit in a variable ClearBit Clears specific bit in a variable TestBit Checks if a specific bit is set Not Inverts the value of a boolean variable (C0, C1 or C2) Rotate Does cyclical increases/decreases ToBCD Converts to BCD a decimal value FromBCD Converts to decimal a BCD value Toggle Makes a toggle function with a specific bit in a variable Abs Changes to absolute value the value of a variable Introduction to SIOC

  42. FUNCTIONS definitions Function parameter1 parameter2 parameter3 Variable = parameter can be a variable or a constant. Each function can only have 1, 2 or 3 parameters. The final value is assigned to the variable. Examples : { V0002 = Round L0 L2 = ToBCD V0005 C1 = TestBit V1234 5 V9888 = Timer 100 5 10 } Introduction to SIOC

  43. SIOC functions Variable=Roundparameter1 Rounds the value to the closest integer. Parameter1: Variable, real or integer constant. Variable=Truncparameter1 Takes only the integer part from a variable (converts the decimal value to integer). Parameter1 : Variable, real or integer constant. Variable=SetBitparameter1 Sets to 1 the variable bit indicated in parameter. Parameter1 : Variable, real or integer constant. Introduction to SIOC

  44. SIOC functions Variable=ClearBitparameter1 Sets to 0 the variable bit indicated in parameter. Parameter1 : Variable, real or integer constant. Variable=Toggleparameter1 Makes a toggle (set to 1 then back to 0) the variable bit indicated in the parameter Parameter1 : Variable, real or integer constant. Variable=ToBCDparameter1 Converts the value in parameter1 to BCD format and sends it to variable (this format is very used in FSimulator). Parameter1 : Variable, real or integer constant. Introduction to SIOC

  45. SIOC functions Variable=Absparameter1 Assigns to variable the absolute value (positive) defined in parameter. Parameter1 : Variable, real or integer constant. Variable=FromBCDparameter1 Converts the value in parameter1 from BCD to decimal and assigns it to the variable. Parameter1 : Variable, real or integer constant. Variable=TestBitparameter1 Assigns to the boolean variable a true or false value if the bit value in parameter is 1 or not. Parameter1 : Variable, real or integer constant. Introduction to SIOC

  46. SIOC functions Variable=Notparameter1 Assigns to the boolean variable the opposite value defined in parameter1. Parámetro1 : Boolean variable. Variable=Rotateparameter1 parameter2 parameter3 Increases or decreases the variable value in the quantity defined in parameter3. If the variable gets higher than parameter2, then it changes to the value in parameter1; and the opposite too. Is the typical heading case: parameter1 would be 0 and parameter2 359. Parameter1 : Variable, real or integer constant. Lower value. Parameter2 : Variable, real or integer constant. Higher value. Parameter3 : Variable, real or integer constant. Increment/Decrement Introduction to SIOC

  47. SIOC functions Variable=Timerparameter1 parameter2 parameter3 Starts the variable associated script periodically as set in parameter3 (1/10 sec). In each loop, the variable value is increased in parameter2, ending with the value reaches the value in parameter 1. Parameter1 : Variable, real or integer constant. Final value. Parameter2 : Variable, real or integer constant. Increase/Decrease. Parameter3 : Variable, real or integer constant. Time (1/10 sec). Introduction to SIOC

  48. V0003 V0003 V0003 { script } { script } { script } TIMER function V0003 = Timer 3,1,10 1 sec 1 sec 1 sec V0003=0 V0003=1 V0003=2 V0003=3 Introduction to SIOC

  49. CALL command Variable CALL Variable (subroutine) Constant Executes the variable associated script; optionally, if a parameter is included, the variable will take its value. Anyway, the script is always executed. Example: { CALL V9888 CALL V1001 326 CALL V3004 L0 } Introduction to SIOC

  50. Commands: IF and ELSE conditions IF { commands } Condition ELSE { commands } If condition is true, the commands between the IF brackets will be executed. If condition is false, then the commands between the ELSE brackets will be executed. The ELSE part is an option and must be always placed after the IF part. It is posible to nest up to 100 levels of these type of conditions. Introduction to SIOC

More Related