Omron PLC Plugin
Purpose
Purpose of this plugin is to read from Omron PLCs, using the FINS protocol. It MUST run with Python 3.9 or above.
Usage
You run a log to send data to the cloud, or a discover to only display information. There must be a config file when running log or a discover. The config file defines which variables need to be collected, what names they appear on the the Ardexa cloud, units and scaling, what table(s) they variables will be sent to, and the source name(s). An example configuration is shown below.
Example Configuration
The memory location defines which memory relates to which variable. It can begin with the following letter combinations, to designate different types of memory and configuration, as follows:
D16_ = Read a 16 bit word, from DATA MEMORY
DL16_ = Read a 16 bit word, little endian, from DATA MEMORY
D32_ = Read a 32 bit word, from DATA MEMORY
DL32_ = Read a 32 bit word, little endian, from DATA MEMORY
W16_ = Read a 16 bit word, from WORK MEMORY
WL16_ = Read a 16 bit word, little endian, from WORK MEMORY
W32_ = Read a 32 bit word, from WORK MEMORY
WL32_ = Read a 32 bit word, little endian, from WORK MEMORY
EM0_ = Read a 16 bit word, from EM0 MEMORYIf the memory location DOES NOT start with one of the combinations above, it will read a 16 bit word from CIO_MEMORY. For example, the memory location 9000 will read a 16 bit WORD memory from CIO MEMORY, whereas D16_9000 will read a WORD (16 bit) from DATA MEMORY. Reading from CIO MEMORY is always as 16 bit words. In the case of an integers, they will always try to read the value as a signed integers. Example config file as follows. Always verify data accuracy by running a discover first, before committing the plugin to collect data.
# Table, Source Name, Variable Name, Memory Location, Type, Units, Scale, Invalidate, Lookup Table
hydro, hec, AC Voltage 1, 20015, dec, V, 1+10, ,
hydro, hec, Grid Freq, D16_20016, dec, Hz, 0.01, ,
hydro, hec, Cos Phi, DL16_20017, dec, , 100, ,
hydro, hec, PT100 Temperature, 20018, dec, C, 1, ,
hydro, hec, Total Hours, D32_20019, dec, h, 0.1, ,
hydro, hec, DC Current 1, 20030, dec, A, 1, ,
hydro, hec, HDG Setpoint Mode, 20031, bitb, , 1, , 1
hydro, hec, Run Manual, W16_20033, bitb_int, , 1, , 3
hydro, hec, Key Switch, 20040, str, , 1, , mode.dict
hydro, hec, Key Switch2, 20045, str_rep, , 1, , mode.dict
hydro, pid_box, PV- Voltage, W32_20050, int, V, 1, ,
hydro, pid_box, PV- Current, 20051, int, mA, 1, ,
hydro, alarm, Alarm 0 Keyword, 20061, bit, , 1, , container_alarm0.dict
hydro, alarm, Alarm 1, 20063, bool, , 1, ,
hydro, alarm, Alarm 4, 20064, int_bool, , 1, ,
hydro, hec, Total Current, EM0_20065, dec, h, 0.1, >100000,Network Configuration
The Omron FINS protocol uses 6 network node numbers to communication with a PLC.
The
source networkspecifies the address number of the source network (the computer running the driver). The Source Network Address is sometimes referred to as SNA in Omron FINS documentation. The valid range is 0 to 127. The default setting is 0.The
destination networkspecifies the address number of the destination device and is sometimes referred to as DNA in Omron FINS documentation. The valid range is 0 to 127. The default setting is 0.The
source nodespecifies the number of the source node (the computer running the driver). The valid range is 0 to 254. The default setting is 0. However, we have noticed that using a number of104makes the plugin work ok.The
destination nodespecifies the node number of the destination device. The Destination Node is sometimes referred to as DA1 in Omron FINS documentation. The default setting is 0, but it should sometimes be set to the last octet of the PLC's IP address.The
destination unitspecifies the number of the destination device unit number, sometimes referred to as DA2. The valid range is 0 to 255. The default setting is 0.The
source unitspecifies the number of the destination device unit number, sometimes referred to as DA2. The valid range is 0 to 255. The default setting is 0.
The Arguments section below details the arguments covering these items. If you find that you can read data from the PLC, but the data doesn't make sense, it usually means one or more of these arguments have been set incorrectly.
Arguments
Anything that starts with
#is a comment line, and will be ignoredThe
Memory Locationis the Ormon memory location/address.Scalewill only be used fordecimalandintegertypes. An error will be reported if you try and divide an integer, or multiply by anything other than a whole number. The scale can also be a value such as0.75-9, where the-9is a BIAS value (addition or subtraction). In which case it will FIRST subtract the 9, THEN multiply by 0.75. If using a bias value, then it can ONLY be used with adecimaltype.Invalidate. This column will only do the following task": If an entry starts with>, it will invalidate ALL entries in a configuration file, if the value for this entry is greater than the specified amount. For example; if theInvalidatecolumn entry is>10000, then a value of 12,000 will ensure ALL readings in the configuration file are invalidated. Use this item with caution. Also, it will ONLY work ondecvalues. This invalidation feature is intended for those machines that have poor quality control, and sometimes transmit wildly wrong values.In
Lookup Table; Sometimes you want to convert an INT to a keyword, through a lookup table. Or you may want to get a register bit and convert it to a keyword. See examples below.Allowable
Typecolumn values are as follows:dec... Converts the Omron memory location to a decimal. Can be scaled (including division).int... Converts the Omron memory location to an integer. Can only be scaled upwards (not divided). So ascalevalue that is not a whole number will be rejected. See also the explanation forscaleabove, since it can include a bias and scale factor.bool... Omron memory location is converted to an INT. This value is then check as follows: Anything other than0will output aTrue. Else, output will beFalse.int_bool... Omron memory location is converted to an INT. This value is then check as follows: Anything other than0will output a1. Else, output will be0.bin... Converts the Omron memory location to an integer, then to a binary representation.bit... Used with a lookup table (in theLookup Tablecolumn) to define a bit being turned or off. See example contents of file below. Bits start at "1" (not "0"), and are defined in theLookup Tablecolumn.bitb... If a bit in the Omron memory location is turned on/off, it will reflect a boolean ("True"/"False") output.bitb_int... If a bit in the Omron memory location is turned on/off, it will reflect a boolean ("1"/"0") output.str... Treated as an ASCII character. If it can't be converted, it will output an empty fieldstr_rep... Same asstr, but it will clear\0values in the resultant string.
Arguments
ip_addressThis is the IP Address of the Omron PLC. Make sure that Port 9600 is open.config_path. This is the config file location. There must be a config file.--attemptsIs the number of attempts to make to get data from the PLC. The default=2The network parameters can be set using the following arguments. They all default to 0.
Example of "bit" lookup
Bit starts at 1. Include a 0 value to display something (or blank) if no bits are turned on
Example of "str" lookup file
Numbers can be anything, since they are read from a single Omron memory location
Last updated
Was this helpful?