<?xml version="1.0" encoding="utf-8"?>

<ExportedUserProgram
    Version="1.0.0">
   <VariableTable/>
   <DiscreteIO/>
   <UserProgram
    Name="SimulateSSI"
    Type="STEP"
    Number="0"
    Desc=""
    SingleInstance="False"
    TaskMask="32767">
   <ProgramBlock
       Type="STEP">
      <Declarations
          Declarations="// These variables are only used in this step&#13;&#10;VAR&#13;&#10;&#9;RefAxisNo : DINT;&#9;&#9;// Reference axis number used for the drive input&#13;&#10;&#9;DriveVoltage : REAL;&#9;// Drive voltage to send to the simulator (from the reference axis)&#13;&#10;END_VAR"/>
      <Comment
          Comment="&#13;&#10; SIMULATE SSI&#13;&#10;---------------------------------------------------------------------------------------------------------------------------------------&#13;&#10;&#13;&#10;Get the drive voltage from a reference axis and send it to the simulator using a Direct Output command&#13;&#10;&#13;&#10;The command is sent to the Default Axis so this program can be run simultaneously on multiple tasks for each axis to be simulated.&#13;&#10;&#13;&#10;This step will repeat itself every loop time (default 1 ms)"/>
      <Step>
         <Expression
             Src="// Calculate the reference axis number.&#13;&#10;// This simulator has 8 axes so we add 8 to the simulator axis to get the reference axis&#13;&#10;RefAxisNo := _CurAxis + 8;&#13;&#10;&#13;&#10;// _CurAxis is the default axis number which allows us to run this same program for multiple axes&#13;&#10;&#13;&#10;// Get the drive voltage from the reference axis&#13;&#10;// Limit to +/- 10 V to avoid a command error&#13;&#10;DriveVoltage := MIN(MAX(_Axis[RefAxisNo].Voltage, -10.0), 10.0);"/>
         <Command
             Command="9"
             CmdAxes="0"
             CmdPrm1="DriveVoltage"
             CmdPrm2="10000.0"/>
      </Step>
      <Transition>
         <Jump
             Type="JUMP"
             Next="Repeat"/>
      </Transition>
   </ProgramBlock>
</UserProgram>
</ExportedUserProgram>
