Reputation: 5396
I have no experience with PLC's whatsoever, but for the next project that I will be doing, I will have to develop an application that will communicate with a PLC. Basically, I will get an XML-message which I have to forward to the PLC. I won't be doing the development of the PLC code, but I would like to understand how I can design the PLC data structures (resembling the xml schema as closely as possible) and send messages to the PLC.
The programming language of the application is not yet chosen, so an example in any language would be fine.
Upvotes: 1
Views: 1301
Reputation: 31403
This will be somewhat different depending on the language you use, the platform, and the type of PLC. The general interface looks like :
communication OPC/COM/
protocol OLE/ETC
[PLC] <-----------> [tag/data server] <-------> [YourGUIApp]
The general idea is that the PLC has a working set of memory for bits, words, and other data types. Via some communication protocol (Modbus, FINS, KSequence, etc) a local system service on your HMI/PC will retain a local image of a specific, user-defined, set of memory areas in the PLC which your application needs to either read from or write to. Associated with the server will be a development library which you can import into your project and use to access the PLC via this local service.
Usually you will have some means to read from memory locations in the PLC, write to them, and many libraries can also raise events when data changes, for example, so all you need to do is hook onto the event and grab the data for each data point of interest.
Unfortunately, until you have selected a PLC and language it may be difficult to decide on an optimized structure for your data. There is a fair bit of variabilty in how the above process works between manufacturers. Without knowing this I would think that you are fine to make whatever structures you like in your application, you just may need to add another layer at some point to make the final step between your data structure and the call to the PLC library. In the end, you are really just passing simple variables back and forth - booleans, integers, floats, etc.
Upvotes: 6