Monday, April 18, 2011

Implementation of EPICS PLC





The vxWorks driver code contains the tags in scan lists depending on the requested update rate. One thread per PLC handles all read/write requests. EPICS device support allows binary, analog and multi-bit records to use the driver for input and output. Tags must refer to a value of scalar, a single array element or a structure element, not whole arrays or structures. The data types PLC BOOL, SINT, INT, DINT and REAL are handled.

One can change the configuration record at runtime, without rebooting the IOC, e.g. the tag name that a record refers to can be replaced. In case of a communication timeout or error, the driver disconnects from the PLC and attempts periodic reconnects. The driver combines requests as per default for array elements into one array transfer from the first to the highest requested element. This leads to a significant improvement in transfer times, but might have side effects: The IOC will always write the whole array whenever more than one element has been changed by output records. If the same PLC array has been modified by another source (PanelView display) since the last transfer, the IOC is unaware of these changes and will overwrite them. A transfer of array is also size-limited by the aforementioned PLC buffer limit.

The record configuration allows separate array element transfers as a workaround for these cases. The driver sends a CIP_Write_Data message for output records whenever the record is processed. Otherwise it will read the tag from the PLC and update the output record periodically if the value on the PLC differs from the one in the record. The driver keeps statistical information (error counts, last/minimum/maximum transfer time) for each scan list. Analog input records allow access to these values. One problem arose with BOOL arrays since they are transferred as DINT values. For an analog record, a tag of “test” is interpreted as addressing the 5th element of tag “test”. When this is applied to a BOOL array, the result would be the 5th DINT, containing bits 160-191. So for binary records, all array access is assumed to target BOOL arrays, and “test” would be transformed in a request to DINT[0], bit 5. This software has been tested on 68K, PPC and Pentium IOCs. The lower driver layer handles the different byte order.


Labels:

Newer Post Older Post Home

You may also like these ebook:

Get Free PLC eBook directly sent to your email,
and email subscription to program-plc.blogspot.com




We hate SPAM. Your information is never sold or shared with anyone.

Your Email Will Be 100% Secured !

Your email is stored safely on Google FeedBurner