DeviceIOs

In Sym3 V6.3 a new scripting command (GetDeviceIOs) allows the retrieval of an array of the project DeviceIO entries.

In Sym3 V6.5 the ElementSize field was added. Attempts to use CSV files exported from older projects (or automatically created) may encounter field mis-match errors when imported into a newer version

Properties

All these properties are read only. The name in brackets is the field name from the Device IOs table (where applicable).

Name Type Description
EquipmentName String Gets the equipment name the DeviceIO is attached to (Equipment Name)
EquipmentTypeName String Gets the equipment type name for the DeviceIO entry (Equipment Type)
StartBit Integer Gets the DeviceIO Start bit (Start Bit)
Size Integer Gets the DeviceIO size (SizeElement )
Element Size Integer (1,2, or 4) Gets the DeviceIO element size. The size in bytes of the data element in the device e.g. 2 bytes is 16 bit WORD. Used for bit field validation and byte swapping for Network byte order systems.
ScriptHandler String Gets the DeviceIO script handler name (Script Handler)
Identifier String Gets the DeviceIO identifier property (Identifier/Property) or user defined property.
IsOutput Boolean Gets the state of the type value. True if this DeviceIO is an Output (Type)
DeviceName String Gets the DeviceIO Sevice this IO is attached to (Device)
MessageNumber Integer Gets the message number for the DeviceIO (Message Type)
InvertedLogic Boolean Gets the state of the InvertedLogic value (Inverted Logic)
Comment String Gets the free form comment for this DeviceIO. Supports unicode for languages.
UpdateRate Integer Gets the Update rate for the DeviceIO (Output UpdateRate) Only in CSV file

When exporting as CSV do not place commas in the comments as this will truncate the comment at the comma. If you have commas in comments then export as TSV.

Functions

Array GetDeviceIOs()

Called to get an array of all ‘DeviceIO’ entries

Return value - An array of DeviceIO entries. If there are no DeviceIOs in the project, the function will return an empty array.

 

Script example:

// Get all device IOs
var deviceIOs = GetDeviceIOs();

// Go through each device IO and log properties
for(var i=0; i<deviceIOs.length; i++) {		
  var io = deviceIOs[i];
  LogDebug("Device EquipmentName  = " + io.EquipmentName);
  LogDebug("Device EquipmentTypeName  = " + io.EquipmentTypeName);
  LogDebug("Device StartBit  = " + io.StartBit);
  LogDebug("Device Size  = " + io.Size);
  LogDebug("Device ElementSize  = " + io.ElementSize);
  LogDebug("Device ScriptHandler  = " + io.ScriptHandler);
  LogDebug("Device Identifier  = " + io.Identifier);
  LogDebug("Device IsOutput  = " + io.IsOutput);
  LogDebug("Device DeviceName  = " + io.DeviceName);
  LogDebug("Device MessageType  = " + io.MessageType);
  LogDebug("Device UpdateRate  = " + io.UpdateRate);
  LogDebug("Device Comment  = " + io.Comment);
}

Device IO validate data

The 'Validate data' button on the Device IO list allows a validation of the entered Device IOs. The messages this can produce are:

"Overlap in bit assignment for equipment" - The startbit assigned overlaps with another IO

"Each IO item Element Size to be 1,2 or 4 bytes" - The assigned Element size is not 1, 2 or 4 bytes

"Each IO item needs to be within a XX-bit block" - The assigned IO must be word aligned

"No Device assigned for equipment" - No Device (PLC) has been assigned

"No identifier/property assigned for device output for equipment" - No Identifier or property has been assigned

"No script handler/property assigned for device input for equipment" - No script handler or property has been assigned to an input

"The internal name for equipment XX, start address YY has not been resolved" - Equipment does not match existing equipment or its property

"Failed to find equipment" - The assigned equipment does not exist

"Equipment type name is wrong" - The equipment type assigned does not match the existing equipment type