SatVUE Device Lua Documentation
This documentation will describe the variables and functions made available by SatVUE Lua engine. This documentation will not describe how to program in Lua, for this information please see Lua 5.1 Documentation.
The Lua extensions on the SatVUE Device allow you perform custom actions and calculations directly on the SatVUE Device. Scripts can be scheduled to be run periodically, or after specific events such as before or after a sample is taken.
SatVUE Object Properties
- data This is a general purpose variable to for user defined Lua scripts to store data in.
- sendReport This is a boolean value which if true, will trigger a report message(s) transmission.
- sendEioBulkReport This is a boolean value which if true, will trigger an EIO Bulk Report message transmission.
- sendPortReport This is a boolean value which if true, will trigger a EIO Report message transmission.
- sendModbusReport This is a boolean value which if true, will trigger a Modbus Report message transmission.
- sendLoggedData This is a table variable, that if set will trigger a Logged Data message transmission.
SatVUE Object Methods
- getPortValue() Get the last sampled value from an IDP EIO port.
- getPortValues() Get all sampled values from all four IDP EIO ports since last upload.
- getModbusValue() Get the last sampled value from a Modbus slave/register.
- getModbusValues() Get all sampled Modbus values since last upload.
- modbusRead() Enable power and sample all configured Modbus devices.
- eioSample() Enable power and sample all IDP EIO ports.
- eioSetOutput() Sets or clears an IDP EIO port configured as a digital output.
- setDigitalOutput() Sets/clears an output on an IO expansion board within the SatVUE.
- sleep() Pause the script for a number of seconds
- sensorPowerEnable() Enables power on the connectors.
- sensorPowerDisable() Disables power on the connectors.
- sendModbus() Send a Modbus Report to the SatVUE portal.
- sendEio() Send an EIO Report to the SatVUE portal.
- sendEioBulk() Send a multi-sample EIO Report to the SatVUE portal.
Modbus Register Representation
Due to the way the IDP protocol works, all modbus registers are represented as strings. This greatly simplies the storage requires for the device SIN/PIN values within the IDP, but does add some complexities when using modbus via Lua scripts on the device.
A modbus register representation has 4 parts:
The modbus function code
- 1: Read a single coils
- 2: Read a single inputs
- 3: Read a single holding register
- 4: Read a single input register
- 5: Write a single coil
- 6: Write a single holding register
The modbus register type
- u: 16bit unsigned integer
- s: 16bit signed integer
- U: 32bit unsigned integer
- S: 32bit signed integer
- F: 32bit Floating point number
- b: Big endian, High word first
- B: Big endian, Low word first
- l: Little endian, High word first
- L: Little endian, Low word first
- The modbus register address
These parts are combined into a string like 3Fb45, where
- Function Code: Read Holding Register
- Register Type: 32bit Floating Point
- Endianness: Big endian, High word first
- Reg Address: 45
The SatVUE Object
SatVUE defines one table object in the Lua Engine which are made available to the user defined scriptions. This variable exposes some internal functions which can be used to extend the system to suit your needs. This object is named SatVUE.