how can tango work with a PLC?

Hello Guys,
I am a new tango user. I am trying to understand how it is possible to create a SCADA application using Tango. For example, a typical scada application communicates with a PLC or multiple PLCs and allows you to read, write, archive various process variables in the PLC. Tango controls allow you to read and write PLC variables for example MODBUS, ADS, PROFIBUS etc. I recently read "TANGO Device Servers Design & Implementation Guidelines" where it is clearly written that process variables such as temperature, pressure, level, speed etc. are process variables that are device attributes. There may be about 200 such variables in my process. The question is how should I read these variables from the PLC and write them to the PLC? If I use a read command with Modbus or ADS, I can read them all at once. There are many examples of using tango to communicate these protocols with a PLC. If I use read attributes I will be forced to read each variable individually. This will require multiple calls to multiple attribute methods for each process variable I suppose. Is there a mechanism that allows process variables to be read from the PLC using tango controls commands, e.g. read the range of registers from to with all process variables, and then set attribute values? Do I have to call the methods of reading attributes from the PLC for each variable separately? Because each attribute will have different properties, such as min max ranges, etc. How should it work in practice if I have to build a system based on PLC and SCADA using tango controls and, for example, Taurus or SARANDA?
Thank You
Hi Dariuz,

Welcome to Tango.

That's a good question you have!

Based on my experience to solve your task I would create a command with no arguments, something like `updateAttributeValues`. Inside that function, you are in control of updating Tango attributes (those will be simply data fields BTW). Each individual read to an attribute with this design won't trigger any hardware calls. That command may be called from within your Tango server or from the outside on a regular basis etc…

This a high-level idea, feel free to adapt it to your specific needs.

Hope this helps.
Edited 4 weeks ago
Thank you Ingvord
This actually solves the problem. I just tested it and it works. However, I have a question. Is it possible to have a solution that consists of two device servers. The first reads data from the PLC and transfers it to the second device server. I mean increasing the universality of the solution in the event of, for example, changing the transmission protocol. The data server from the PLC would create dynamic attributes as needed. It then forwarded to the second device server using forwarded attribute class. Does your experience allow you to say that it is possible?

Have a nice day!
Hi Dariuz,

You can handle any available device from another device using DeviceProxy. This will allow you to access properties/attributes/commands from that device.
Guillaume DI FRANCO
Thales - Software Engineer Manager
Does your experience allow you to say that it is possible?
Yes, totally! For that particular case it is sometimes beneficial, depending on your exact setup, of course, to have Tango device server only as a facade, while all the backend infrastructure may be built using other solutions, like plain ZMQ, MQTT, HTTP, or any other. This way you can fairly easy integrate with Tango subsystem of any complexity and flexibility. Those are only limited by your design decisions.

Say, if we extend that example with `updateAttributeValues` command, inside it you can actually make another network call into your subsystem, wait for the data, and then update the attributes.
Everything sounds promising.
Thanks for the tips, I'll try to experiment a bit now.
Thank you for your help
Register or login to create to post a reply.