s Ioc Manual

download s Ioc Manual

of 14

Transcript of s Ioc Manual

  • 7/30/2019 s Ioc Manual

    1/14

    IOCar ds Simu l at i on Syst em

    by M anuel Vlez

    Transla t i on by Ma nolo Hernndez-Pea M.revised by Ja ime Pi rn ie

    www.opencockp i t s . com- August 2004 -

  • 7/30/2019 s Ioc Manual

    2/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 2

    0. TABLE OF CONTENT

    1. INTRO

    1.1. IOCP protocol

    1.2. Structure of the IOC simulation system

    1.3. System based on events

    1.4. IOCP server

    2. IOCARDS SIMULATION SYSTEM -SIOC-

    2.1. System variables

    2.2. SIOC modules. Types of links to system variables

    2.2.1. FSUIPC module

    2.2.2. IOCP client module2.2.3. IOCards connection module

    2.2.3.1. Connection to IOCards SW (switches)2.2.3.2. Connection to IOCards outputs2.2.3.3. Connection to IOCards displays2.2.3.4. Connection to IOCards encoders

    2.3. CONFIG-SIOC software to define variables and scripts

    2.3.1. Files options2.3.2. Edition options2.3.3. Other options

    2.4. Programming scripts

    2.4.1. Local variables2.4.2. ASIGNACIN command2.4.3. Function command2.4.4. Condition IF command (If condition X happens...)2.4.5. Condition ELSE command (In other case...)2.4.6. Never ending loops2.4.7. Examples

    2.5. SIOC software. IOC server and application core.

  • 7/30/2019 s Ioc Manual

    3/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 3

    1. INTRO

    1.1. IOCP protocol

    The IOCP protocol (IOCards Protocol) provides a link between IOCards andother software running in different PCs. It works with the TCP/IP protocol and ispossible to use it in a local network and on the internet.

    This protocol has many advantages in comparison with other ones that linkhardware or modules with flight simulators:

    - Much faster.- Consumes less resources.- Based in events.- Doesnt need other applications (like WideFS) to link to other PCs.

    - Multiplatform (MS Flight Simulator and X-Plane).- Totally freeware (for non commercial use).

    1.2. Structure of the IOC simulation system

    The IOC simulation systemhas been designed to cover things that IOCards cannot solve, going farther away than the electronic concept.

    By using IOC, we are able to make all types of user defined simulations thataffect not only to the electronics (IOCards) but to the flight simulation (or themodules associated with it).

    The system uses the IOCP protocol as the method of sending information andaccessing the systems internal variables.

  • 7/30/2019 s Ioc Manual

    4/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 4

    The core of SS-IOC is based on:

    - IOCP server able to generate any input or output for a variable created with IOC.- IOCP client module that accesses to other systems (like Fsimulator usingIOCPserver.dll, or X-Plane using XLUIPC).- FSUIPC client module that accesses to other systems (like Fsimulator, ProjectMagenta).- Linking module to IOCards that directly controls the cards from the system.-Visual scripts programmer, with special functions, mathematical formulaes,timers, conditions, etc.

    1.3. System based on events

    The whole system is based on events.

    An event can be defined as a group of operations that are executed whensomething happens.

    In our system, the events can be launched by several causes:

    1) When a state or the value of an internal variable changes.2) When a timer defines it.3) When a change in the inputs happens.

    Cases 2 and 3 can be reduced to case 1: when a state or the value of aninternal variable changes.

  • 7/30/2019 s Ioc Manual

    5/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 5

    1.4. IOCP server

    The system SIOC turns around an IOCP server. Up to 10,000 IOCP variables canbe defined in this software. Each variable can have an associated script whichwill be executed when the variable is enabled.

    In addition to the internal access of these variables, they can be accessedfrom any other client application connected to the server. The client will be ableto launch an event due to a variable value or read the values.

    The events can be launched internally or by an external script. With theassignment command, the value of an internal variable can be modified and theassociated script will be executed.

    The clients, when connected to the server, inform the server about whichvariables are the ones they are going to work with.

    The working block diagram would be:

    VAR value has

    been changed

    Client have this VAR

    in your list ?

    RUN VAR

    script

    Send new

    value of VAR

    to clients

    END

    EVENT

    Launch others

    events

    YESNO

    So, if there are no changes in the variables, no events are produced, and noinformation is sent (this is the reason why this protocol is much faster than otherones like FSUIPC).

  • 7/30/2019 s Ioc Manual

    6/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 6

    2. IOCARDS SIMULATION SYSTEM -SIOC-

    2.1. System variables

    Programming the SIOC system is based in its variables definitions and theassociated scripts (events).

    Each variable is defined by its number (from 0 to 9999). Any client connectedto the SIOC server and that requires information about variable #0134, is makingreference to the variable defined with that number. The client will be informedabout any modification in the value of the variable. In addition, any modificationin the variable ordered by the client will produce the execution of thecorresponding event and the associated script.

    In addition of the identification number, each variable can have adescription and an initial value (optional). This value will be considered when theprogram starts running.

    To access to the rest of modules managed by SIOC, variables have a specialfeature: they can be linkedto that modules, so any change in the variable willaffect to the module, and any action in the modules will affect the linkedvariables (and its scripts).

    The way to control the SIOC modules is through the linked variables.

    When we define a link, the software will ask to introduce the module data wewant to use. In the example, when we link the variable to the IOCards switchesmodule (SW IOCards), the software asks for the input number associated to the

  • 7/30/2019 s Ioc Manual

    7/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 7

    switch and its type.

    Variables always store an integer value in the range -2147483648 to2147483647. If we want to save decimal values, well have to make a conversion.

    For example, if we want to save the number 1.0345, we would save 10000 timesthis value: 10345. If we want to recover it, we would have to divide it by 10000.This is this way due to the IOCP protocol specifications.

    2.2. SIOC modules. Types of links to system variables

    There are three basic modules which we can to link with our variables:FSUIPC, IOCP and IOCards.

    We can also define a variable with no module link. Any change in this

    variable wont affect to any module.

    The way of working with modules is always the same: variables take theirvalues as a result of an event launched by a module and then the correspondingscript is executed; or when the variables states change, the event is launched andthe corresponding module is informed.

    So, we have three different types of links: delivery or output, reception orinput andbi-directional or input/output.

    2.2.1. FSUIPC module

    With this module we will connect directly with Flight Simulator (FSUIPC mustbe installed) or with WideFS. Other software (like Project Magenta) can be runningat the same time.

    SIOC variables can be linked to this module in two modes: delivery to FSUIPCor reception from FSUIPC.

    In the first case (delivery to FSUIPC) we have to define the destinationoffset (with $ before the number, i.e. $0B00), the destination FSUIPC variablelenght (described in the SDK information at Pete Dowson website) and, optionally,an initial value.

    In this mode, once the event has been launched with its script, the value ofthe variable will be sent to the corresponding offset.

    In the second case (reception from FSUIPC) we have to define the originoffset and its length.

    The system reads periodically (refresh time is set in the *.ini file) and ifthe offset value is different from the one read in the previous loop, an event issent to the associated variable, the new variable value will be the one read fromthe FSUIPC offset value and the corresponding script will be executed.

    As the information from FSUIPC may be codified, is interesting to include inthe scripts the functions that convert the values in a format to be used by anothervariable.

  • 7/30/2019 s Ioc Manual

    8/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 8

    2.2.2. IOCP client module

    This module (included in the SIOC) is different from the IOCP server (alsoincluded).

    When we talk about variables of the SIOC IOCP server, we talk about SIOCvariables; but when we talk about IOCP client module, we are talking about othervariables that are located in another server. We will access these variables withour client module.

    SIOC can be connected to any IOCP server by setting the IP address and theTCP/IP port in the *.ini configuration file. The server could be XPLUIPC for X-Plane (SIOC could then access to X-Plane variables), IOCPServer.dll for FlightSimulator, or any other IOCP server in our local network or in the internet,including additional SIOC systems.

    The link between this module and the variables is abidirectional mode: whenthe variable change, the client informs the server about the change; and when theserver sends a notification about a variable to the client, the corresponding eventis launched.

    When we define our variable, we have to set the destination variableidentification number, and if we want, an initial value.

    2.2.3. IOCards connection module

    This module directly links SIOC with an IOCards system connected to the samePC.

    This is not the only way to connect with an IOCards system as we can alsoconnect the IOCards IOCP client to the SIOC IOCP server.

    Depending on how we define the connection with IOCards, variables will act ina different way.

    We can have connections with delivery and reception of information.

    2.2.3.1. Connection to IOCards SW (switches)

    In this case, variables will connect directly to IOCard master cardinputs.We have to define the input number and its type (same values as the ones defined in

    the IOCards software).

    This is a reception type connection, so SIOC will launch an event when thereis a change in the input value. The variable will be 0 when the input is disabled,and will be 1 when enabled. When the event and its corresponding script islaunched, the user can define commands for whatever action he wants to make.

    2.2.3.2. Connection to IOCards outputs

    As previously, the variable will connect directly to the IOCard Master cardoutputs. Then we have to define the number of the output.

  • 7/30/2019 s Ioc Manual

    9/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 9

    The type of connection in this case is delivery, and the script is launchedjust before sending the command enabled/disabled to the variable.

    To make the module understand the variable must be disabled, the value forthe associated variablemust be 0; if the variable must be enabled, the value mustbe any different from 0.

    2.2.3.3. Connection to IOCards displays

    This connection will control the displays cards through the associatedvariables. The type of connection is delivery. We have to define the first figureidentification number and the number of figures. Optionally we can define the typewhich will define alternative ways of working.

    The associated variable will store the number to be represented with thedisplays. The script is launched before the value is displayed on the display.

    2.2.3.4. Connection to IOCards encoders

    This one is a reception type connection. When a rotary-encoder is turned, theevent will be launched, and the variable value will be the increment/decrementgenerated by the encoder.When the encoder stops, the variable will change to 0.

    The variable is changed twice, but the script is only launched when thevariable value is different from 0.

    For this connection we have to define the encoder initial input in mastercard, the acceleration and the type of encoder (same parameters than the ones in

    IOCards software).

    2.3. CONFIG-SIOC software to define variables and scripts

    With this software the user can define how SIOC will operate, defining thevariables we are interested in, the links to different modules and the parameters.

    Additionally, we can include specific commands for each variable that will beexecuted when the corresponding event is launched.

    The software shows a tree form diagram with several levels. The first levelis the variable definition and then the commands in the order they will be

    executed. Another condition levels can be defined under the commands, but they willbe only executed if the condition is complied.

  • 7/30/2019 s Ioc Manual

    10/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 10

    We can edit the variables and commands through the options menu or directlyfrom the menu that popup when the right button on the mouse is clicked.

    2.3.1. Files options

    We can create a new file, open an existing file, save the presentconfiguration (and save as...) and exit the program.

    2.3.2. Editing options

    We can edit the variables and commands through the options menu or directlyfrom the menu that pops up when the right button on the mouse is clicked.

    When creating a new variable, the software will show a square where welldefine the variable or commands.

    When we click on a variable or command, it will be darkened.

    When we double click on the square, a formwill appear and we will be able toselect different options. In this form, only the mandatory options will beaccessible. The rest will be shown blurred.

    When we click OK in the form, it will adopt another shape, corresponding with

    the variable or command configuration. So we can check at a glance what type ofvariables and command we are working with.

    To insert a new variable, we have to select an existing one and then selectthe option insert variable. The new variable will be placed just above the oneselected, and with a square shape.

    We will follow the same procedure to insert a new command(with the optioninsert command).

    When a variable is selected, we can create a command (create command). Asquare will appear indented under the selected variable. This will mean that thiscommand is part of the script corresponding with the variable. From this point, we

  • 7/30/2019 s Ioc Manual

    11/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 11

    can insert or create new commands that will build the script. The order ofexecution will be the order in the tree, from up to down.

    In the case of commands with condition clauses, we can create indentedcommands (once selected the first one). These additional commands will be onlyexecuted when the condition is true.

    To delete any variable or command, we will select it and then select delete(eliminar). If the line we want to delete has indented commands the program willadvise about it.

    2.3.3. Other options

    Other available options are to expandand collect the branches of the tree.This buttons will expand and collect the whole tree. If we only want to expand onebranch, we will do it by clicking on the +, the branch will expand.

    Another option is change the language. Once selected, well have to restartthe software.

    2.4. Programming scripts

    For each variable, we can define a sequence of commands that will be executedwhen the event corresponding with the variable is launched.

    We can use assignments and use conditionals functions and commands.

    We can also use variables for timing purposes and temporary values.

    2.4.1. Local variables

    When a script starts, some local variables are automatically created. Theirvalues only last as long as the script is running and they store temporary values.

    There are two types of local variables: reals and Booleans:

    The real ones store real values, decimals or integers, positive or negatives,in the range 5.0 x 10^-324 a 1.7 x 10^308.

    There are three real local variables, defined as L0, L1 and L2.

    The Booleans ones store the value of a condition that can be true or false.They are mainly used to build complex conditions from simple ones (in theconditional commands only one condition is allowed).

    There are three boolean variables, defined as C0, C1 and C2.

    For example, to define a condition like if L0>5 and L05, C1 = L0

  • 7/30/2019 s Ioc Manual

    12/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 12

    2.4.2. ASIGNACIN command

    This command is used to store the value of a variable (or the result ofoperations between variables) into another one.

    The first parameter is the destination variable (a local one or one in theserver). If it is a local boolean variable, the rest of parameters can only beconditions with variables or values or a direct storage of another booleanvariable.

    If the destination variable is one of the server variables, it will take thatvalue. If the value is different from the one it had just before, the associatedevent will be launched in that point of the script.

    In the folding menu, we can see the available variables for each operation,

    taking into account that for an assignment in a variable script, the variable cannever be the destination of an assignment (infinite loop).

    The rest of parameters can be local variables, server variables or realconstant values (integers or decimals, positives or negatives).

    In this case the variable will take the value of the operation made with theparameters.

    If the destination variable is a server one and the value to be stored is notan integer, it will be automatically rounded.

    We can apply the following operators: + , - , * , / , AND , OR (the last two

    with numeric variables make binary operations).

    For conditions we can use: > , >= , = ,

  • 7/30/2019 s Ioc Manual

    13/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 13

    will change to false ( i.e. NOT(C0) ).

    TOOGLE: Not implemented yet.

    TIMER: Not implemented yet.

    2.4.4. CONDICIN IF command (If condition X happens...)

    This command lets us to execute a group of commands if the condition iscomplied.

    The group of commands will be defined for those command lines indentedunderthe IF command.

    The parameters for this command can be: a condition between variables andconstants, or a boolean variable (if it is true, the condition is true), or 2

    boolean variables related withAND or OR(that would be true if the final result istrue).

    If the condition is not complied (false), then the process will continue withthe following command in the script.

    2.4.5. CONDICIN ELSE command (In other case...)

    This command also lets us to execute a group of commands.

    Its always following a CONDITION IF command. If the condition if is notcomplied, then the else one would be executed, and the opposite.

  • 7/30/2019 s Ioc Manual

    14/14

    SIOC user m anualSIOC user manual ve r 1 .0ve r 1 .0

    Page 14

    2.4.6. Never ending loops

    A dangerous case when programming is the never ending loop.

    This happens when events are launched in a recurrent way, when an eventstarts another one and this starts the first one again. The execution never ends.The process only stops when an overflow error happens.

    2.4.7. Examples

    With all variables, commands, function... well be able to build complexsimulations.

    Configurations and examples from our members will be published atwww.opencockpits.com

    2.5. SIOC software. IOC server and application core.

    SIOC.EXE is the software that reads the configuration file and starts the IOCserver and the different modules.

    The basic parameters of the software are defined in the SIOC.INIconfiguration file. The file explains the use of each parameter.

    SIOC.EXE can be run in the same PC as the simulator or in another one,connecting both PCs through the FSUIPC client or the IOCP client (defining the

    corresponding TCP/IP parameters).

    The state of the IOCP server and all the active modules will be shown on thescreen.