Simple Text Instruction Processor

Last modified by Michael Sibayan on 2016/04/05 11:34

In March 2016, the RCI was migrated to STIP. This is to allow more flexiblity within applications and readability of program text. STIP is designed primarily for autonomously modifing the value of network shared variables, but can be extended to handle other commands than described below. 
The software deployed on the cRIO-9704 controlling the atmospheric and soil gas sampling valves is designed to allow either direct user (operator) control or automated control via a text file containing instructions. The instructions are described below.

Instructions are white space delimited and separated by line (carriage return + line feed "CRLF").
The first word of each line is the command and must be completely uppercase in order for it to be correctly identified by the compiler.
Each following word is considered an argument and case is generally arbitrary.
Lines beginning with a number sign (#) or a white space ( ) are considered comments and will be ignored by the compiler.

Custom instructions can be defined by the application developer
Any unhandled instruction (non pre-defined instructions) are passed out of the processor's execute function. This can be useful for creating a set of application specific instructions.

An example program is shown here:

# Create selector aliases
ALIAS V1 INTEGER ni.var.psp://localhost/selectors/ATMO_V1
ALIAS V2 INTEGER ni.var.psp://localhost/selectors/ATMO_V2
ALIAS V3 INTEGER ni.var.psp://localhost/selectors/ATMO_V3

# Create solenoid controls
ALIAS Solenoid1 BOOLEAN ni.var.io://localhost/Mod7/DO0
ALIAS Solenoid2 BOOLEAN ni.var.io://localhost/Mod7/DO1

# set starting state of all solenoids
SET Solenoid1 false
SET Solenoid2 false

# set position of all selector valves
SET V1 1
SET V2 1

# wait until 00 or 30 minutes past hour
TIME-SYNC 30

# sampling routine
SET V1 25
WAIT 5
RECORD LEO-G_STD-299ppm_LI-7000

SET V1 26
WAIT 5
RECORD LEO-G_STD-350ppm_LI-7000

LOAD gas-sampling-routine.txt

Pre-defined Instructions

INITIALIZE
No parameters. Sends the processor into the initialization state. This state is predefined by the application and can be used to perform a software reset of the module.

ALIAS {name} {type} {url}
Adds an alias to a shared variable (controllable element). 

  • name: The user defined name of this element (white spaces are not allowed). Examples of names are "Selector4", "Valve1", "MySelectorIsPurple". Names must be unique. If you add attempt to add two elements with the same name, only the last created will exist.
  • type: The data type of variable. Valid types are BOOLEAN, INTEGER, DOUBLE.
  • {path}: The shared variable's url.

SET {name} {value}
Sets the value of a control element. For a selector, it moves a named selector to the requested position. For boolean, double, string, etc. control elements, it simply sets the value of the network variable.

  • name: Name of the control element. This element must be configured in the list prior to use.
  • value: Requested value of the element. This must be a valid value otherwise the operation fails (e.g. 1 - 28 for a 28 position selector, true/false/on/off for a boolean).

WAIT {seconds}
Waits a requested number of seconds to elapse.

  • seconds: Time in seconds to wait.

WAIT-UNTIL {date-time}
Waits until the specified date and time.
Wait-until {date-time} is more precise than wait {seconds} for long wait times.

  • date-time: The date and time this instruction will wait for. The format for this time-stamp must be YYYYMMDDHHMMSS. An example would be 20150501043100 for May 1, 2015 at 04:31:00. The year must be in 4-digit format and all other elements in 2-digit format. The hour-of-day must be in 24-hour format.

TIME-SYNC {minute}
Waits until the time synchronizes with the requested time interval
(e.g. if minutes = 15 and the time is 12:36, this command will wait until 12:45. Similarly, if the time is 12:02 it would wait until 12:15)

  • minute: Time interval in minutes to wait for.

LOAD {file}
Loads a text file into memory and compiles the text into a list of commands to process. This operation deletes all previously queued commands.

  • file: Full file path of the file to load. In general, this is only the file name which will exist in the folder /c/programs. For a compact RIO you must use the convention /c/folder/sub-folder/filename.extension

INTERRUPT
Stops everything and clears the command queue.

CLEAR
Clears the command queue.

CLEAR-ALIASES
Clears the list of aliases

Tags:
Created by Michael Sibayan on 2016/04/04 14:23

This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.0.1 - Documentation