Open automated control system: data exchange with Severstal's open software PLC via Modbus TCP
This project is considering the beginning of integration An open automated process control system and a model-oriented development environment Engee.
Introduction
An open automated process control system in this example is represented by a remote client - an open software programmable logic controller operating in real time at Severstal PLC (OpenSoftPLC). An incremental counter program with reset is running on the PLC control panel. The data exchange between the PLC OP and Engee takes place over Modbus TCP, while the Engee acts as a Modbus Master, forming a control signal and reading data from the PLC OP registers. Engee access to Modbus Slave via Modbus TCP is provided by external support оборудования.
Open automated control system
[Open Automated Process Control System](https://habr.com/ru/companies/severstal/articles/895342 /) (Automated Process Control System) is a national Russian platform for industrial automation being developed by [an interdisciplinary working group] (https://openapc.ru /) with the support of the Ministry of Industry and Trade of the Russian Federation. Its goal is to create a vendor-independent, modular and secure ecosystem for managing production processes, capable of replacing foreign solutions (Siemens, GE, etc.). The project was initiated by Russia's largest industrial companies, including Severstal, EuroChem, Gazprom Neft, LUKOIL, and others.
The technological base of an Open automated Process Control System currently consists of an OP PLC and an integrated development environment (IDE) based on 4diac FORTE. It is an open source environment that supports development in an event-oriented paradigm for distributed process control systems. This approach to the design of modern automated process control systems is described in the international standard [IEC 61499] (https://habr.com/ru/articles/676392 /).
Open Software PLC
The Open Source Software PLC (OP PLC) and IDE are being developed by the IT company Severstal-Infocom (part of PJSC Severstal). . To integrate with Engee, in this example, a remote virtual machine with an OP PLC was started. Data is exchanged with the PLC using the Modbus TCP protocol. The PLC OP acts as a Modbus Slave - it receives a discrete counter reset signal from Engee, and the incremental counter in the PLC control diagram transmits its current value to the registers open for reading. Engee not only resets the counter, but also reads the current value from these registers.
PLC OP control diagram
Control [functional block diagram](https://habr.com/ru/companies/severstal/articles/905334 /) The PLC specification compiled in 4diac FORTE is presented below.
The main elements of the control diagram:
-
FB_CTU- the block of the incremental counter:-
R- reset input, -
CU- direct account entry, -
PV = 6500- set value, -
CV- output of the current value.
-
-
MSLAVE_8_tcp- Modbus TCP Slave configuration block:QI = true- data definition input,PARAMS = '{"host": "158.160.19.43:1502", "update": "500ms", "id":"1" }'- block parameters: Modbus TCP Slave address and port, update period, identifier.IO0 = '.IX'- input of the transmitted data source,IO1 = '.QW'- input of the transmitted data source.
-
IX- discrete data input unit:-
QI = true- data definition input, -
PARAMS = 'c10'- determination of the storage address ( "coil 10") of discrete data, -
IN- data output.
-
-
F_IN_TO_WORD- data conversion unit from the formatintegerin the formatword:-
IN- input format datainteger, -
OUT- format data outputword.
-
-
QW- format data output blockword:-
QI = true- data definition input, -
PARAMS = 'h12'- determination of the storage address ( "holding register 12" ) of data, -
OUT- data input.
-
After assembling and running the diagram for execution, you can see and debug the operation of its elements.:
Checking the connection
Before integrating with Engee, make sure that the address and port of the PLC OP defined in the diagram are readable. You can do this using the utility mbpoll, with the following command:
mbpoll -t 4 -a 1 -r 13 -c 3 158.160.19.43 -p 1502
When executing the command, we should see the current counter value being written to the Modbus TCP Slave Holding Register.:
Communication at the specified address with the Modbus TCP Slave has been established, reading from the specified registers (with an offset) is successful, and the counter value is incremented. Therefore, the part of the project preparation related to the operation of an Open Automated Process Control System has been completed successfully, and we can proceed to the part of preparation and work with Engee.
The example model
Model open_soft_plc_counter.engee It contains the following interface blocks:
-
Modbus TCP Setup - installation of a Modbus TCP connection. The Modbus TCP Slave address must be specified in it. -
158.160.19.43and the port -502, -
Modbus Write Coil - recording discrete data. You must specify the server ID in it. -
1, recording address (coil number) -10, -
Modbus Read Holding Register - reading data from the Holding register. You must specify the server ID in it. -
1, the initial address of the readings (register number) -12and the number of registers being read -1.
The counter reset signal is periodic, from a rectangular pulse generator unit with a period of 5 seconds and a fill factor of 1%.
Connection to external equipment: Modbus TCP
To connect to external equipment, you need to install a module for working with external equipment. The detailed step-by-step process of connecting Engee to low-level computer interfaces is presented in примере.
# Установить модуль можно непосредственно в скрипте, следующей командой:
# engee.package.install("Engee-Device-Manager")
After installing the module and running the client program, we will proceed to modeling.
Simulation
Let's execute the model using software control:
name = "open_soft_plc_counter" # Имя модели
include(joinpath(@__DIR__, "start_model_engee.jl")) # Определяем функцию запуска модели
start_model_engee(name); # Запускаем модель
During the simulation, messages about the communication status, received and sent data should be displayed in the information window of the Engee client program.:
As you can see, the connection is established, the data exchange with the PLC is successful.
Simulation results
The data collected in the simulation (the reset signal and the current counter value) are stored in a variable simout. We will get this data for further plotting on graphs.
data = collect(simout);
t = collect(data[1].time)[:,1];
counter = reduce(vcat, collect(data[2].value)[:,1])
reset = reduce(vcat, collect(data[1].value)[:,1]);
Let's plot the read signals:
gr(size = (1000, 400))
plot(t[505:end], [counter[505:end], 50*reset[505:end]];
seriestype = :step, title = "Счётчик FB_CTU",
xlabel = "Время, с",
label = ["Значение счётчика (CV)" "Сигнал сброса (R)"])
The data received by the Engee model from the PLC OP corresponds to reality, Engee successfully resets the counter operating in the 4diac FORTE diagram.
Conclusion
An example of successful integration of Engee with an open automated process control system is considered: data is exchanged via Modbus TCP Engee with an open software PLC of Severstal. This synergy of advanced design paradigms for automated control systems and controls makes it possible to accelerate the transition to Industry 4.0.
