The handshake used for PC – PLC communication works well if everything is perfect. But what happens if something happens that violates the handshake?
In some countries power loss is an ordinary part of life. Generally PC is supplied by UPS, but PLC is not. In a power loss, PLC lefts the communication unexpectedly.
Even if you are using an industrial PC, it is not stable as a PLC. PC or the software running on PC may be frozen. In this case, PC or software may need a restart.
In the other hand, physical conditions may also violate the handshake. Imagine that boxes crashing on station:
It is possible; sensors may be dirty or defected, or any other unexpected reason may cause this.
Most PLC systems use non-volatile memory for holding data permanently. For a PLC system, it is not difficult at all.
If we are programming the PC, it is obvious that we have to store some information in a file or in database to avoid failure after power loss.
- Store all global variables (handshakes last time interval, all counters etc. and the most important; the last data you wrote in to PLC) in to a text file or database as soon as they changed.
- Restore all global variables on start up.
- Do not execute 'Write all outputs' before restoring all global variables.
VB6.0 example:
Public Property Get Data As Integer
Public Property Let Data(ByVal New_Data As Integer)
End Property
'Get' routine is executed whenever you attempt to read property 'Data' as
A = Data
or
And 'Let' routine is executed whenever you attempt to write property 'Data' as:
or
Use 'Property' as a global variable, add a record routine inside 'Let' and never mind again.
For the example above, restoring the 'm_Data' global variable instead of restoring 'Data' is works faster because restoring 'Data' will cause re-recording the 'Data' again and in some cases it may cause a violation error as 'File Already Open'
Rule 3 is also important. Think about the handshake graphics:
C may assign anything in the memory unless variable is initialised.
If it is not possible to control write and reads?
Some SCADA systems also uses 'Read All Inputs' and 'Write All Outputs' routines for PC – PLC communications. However some of them may execute those routines in a separate thread so it may be possible to write a global variables (mostly named as 'Tag' in SCADA systems) value into PLC before initialising or restoring it.
One solution is using a cyclic counter in PLC. PLC has an increasing counter and PC echoes it into another data memory of PLC. If counter value is equal to the echo, PLC increases the counter and waits the same value from PC. If PC can not update in a certain time, PLC understands that PC has failed, and the data from PC is untrusted. This method also can be used to understand if PC is still working.
Fragmanted Information
This may be dangerous if automation system designers don't take sufficient precautions.
Assume that PC is writing a receipt into PLC data memories, and 'receipt ready' flag is at the beginning of the data memory area.
PLC may apply the receipt as soon as it realises 'receipt ready' flag is set, however receipt may not be ready on time. This results of this design may be difficult to debug.
How can we avoid fragmented information?
- We can use checksum at the beginning or at the end of data memory area reserved for PC's write operations. However, there is still a probability that something may leak because there are too many possibilities to produce the same checksum value.
- We can use the counter solution stated above. Reserve two data memories in the data memory area which is reserved for PC's write. Let the PC fill two data memories with the echo from PLC. If both data memories are same and fresh, PLC can trust that information is consistent and trustable.
Our next post will be about customers. 'Customer is always right and mostly undefined'. And we will have another series with a case study. We are going to examine a data collection system to use for assembly line balancing and reporting the bottle necks on an assembly line.
4 comments:
Hello....
I enjoy your posts. Really informative.
I have PLC blog myself, but it's in Indonesian. I use OMRON.
http://telinks.wordpress.com
Thanks.
Hello,
Thank you very much. Your comment is the first one in InDa notes.
Your opinions are valuable, I am so glad to have a comment.
I also use OMRON, and planning to publish an ActiveX control for FINS communication soon.
replica bags supplier replica bags supplier replica bags qatar
yeezy 350 v2
golden goose sneakers
kyrie shoes
off white hoodie
kyrie shoes
golden goose outlet
kyrie irving shoes
curry 9
bape clothing
jordans
Post a Comment