SCADA "BortX" with support for ANSI / ISA-88 control language for ESP8266

Honestly, I really love modern microcontrollers. In particular, produced by the Chinese manufacturer Espressif Systems with a Wi-Fi interface. We are, of course, talking about the ESP8266 and ESP32 , which have great potential in the educational context.



image



Of course, they have their drawbacks. But the price. This is a miracle. In particular, if you buy the conditional "Witty Cloud" for three dollars, in which you don't even have to worry about nutrition and programming. The scope of application in the IoT allows you to create your own automation projects in various ways - in the classic way: by writing code and working in an IDE. Or through the same FLProg. However, as always, there are nuances that somewhat slow down the representation of work within the framework of a typical application of the ESP8266 as a hardware base. And the problem is not at all in the network connection carried out to the home / office local network with Internet access via a router.Devices work diligently and can act as Zigbee coordinators with a certain configuration.



ESP8266 / ESP32 can work both as an access point and end station. During normal LAN operation, the ESP8266 configures itself to endpoint mode. To do this, the device needs to set the SSID of the Wi-Fi network and, in closed networks, the access password. Access point mode is useful for initial configuration of these parameters. In the access point mode, the device is visible during a standard network search in tablets and computers. It remains to connect to the device, open the HTML configuration page and set the network parameters. After that, the device will normally connect to the local network in the terminal station mode.



Managing and visualizing data in real time is an important task.However, a quick start in this business is not always available. But after that, their analysis is necessary. The role of the time line on the graph is also important - to show the frequency and uniformity of measurements. The history of the process is needed for analysis and diagnosis. Without the necessary knowledge and analysis, the full potential of the data remains underutilized, which is a flaw and necessitates a tool that can make numbers and percentages meaningful and make the data easier to understand and interpret. This is necessary in the field of scientific experiment and in the production process.



Online data visualization toolsare the appropriate response to this challenge of the times. Combining data, that is, synthesizing information, seems to be a separate task. Scaling in time, selection of the viewport, scaling along the Y-axis, shifting along the Y-axis are all necessary attributes of visualization tools, thanks to which even the most complex graphs and charts, which you view in the dashboard, will be clear and understandable. One of the options for online data visualization with SCADA support is the new BortX project .



I believe that familiarization with it will help you in conducting experiments in real time (for example, in the simple implementation of your ideas in the educational process). To work, you just need to sew the Sputnik sketch onto your ESP8266. You can familiarize yourself with its code bylink . Modification at your discretion is a prerequisite for working: enter the SSID and password to connect the ESP to your router. By the way, the satellite pilot project is located at .



After downloading the sketch, the microprocessor outputs the information to the Internet in the form of a web page. Registration is not required, because each microprocessor has a unique number and this number is used for access via the Internet. The ID itself can be found by opening the COM port status window in the Arduino IDE (115kbaud / s):



image



By default, TCP port 6110 goesuses the Transmission Control Protocol. TCP is one of the main protocols in TCP / IP networks. TCP is a connection-oriented protocol and requires handshaking to establish end-to-end communication. Only after the connection is established, user data can be sent in both directions. It is possible to set a password for a page, etc. But the most important element of this "system" is the conditional support of the control language from the APCS.



BS-88 control language is based on ISA S-88 standard... An example of a graphical analogue is SFC. The control language allows the ESP to make control strategy decisions based on current conditions and allows the control of the ESP to be ordered according to the needs of certain actions. This language is different from traditional programming languages. The reason is that the language describes the actions to control the manufacturing process.



In accordance with BS-88, the manufacturing process consists of operations that can occur simultaneously, such as heating water and preparing solution components.

In turn, operations are composed of phases that are performed sequentially. There are only two types of control language operators:



  1. Active operators.
  2. Transition operators (with or without condition) (transition).


For example, a water heating operation:

Phase 1: open the water valve;

when the level sensor is triggered, go to phase 2

Phase 2: close the water valve;

turn on the heater ;;

when the temperature reaches 60 degrees, transition to phase 3

Phase 3: turn off the heater;

Stop;

Suppose a water valve is connected to DO, a water level sensor is connected to D5, a heater is connected to D1, and A0 is a temperature sensor.



The script looks like this:



1: $ D0 = 1; // phase1
if($D1 = 1) trans {2}; // wait_for_D5_become_ "on"
2: $ D0 = 0; // phase2
$D2 = 1;
if($0 >= 60) trans {3}; // wait_for_tempeature
3: $D2 = 0;
stop; // end_of_script


The language uses the writing of variables, such as is customary for arduino, but on the panel variables can have a different name, for example: Uakk, Set_Ux, Set_temp. Name substitution is possible in the configuration editor. To access the editor, click on the gear icon in the panel. There are also variables for internal calculations or $ X0- $ X9 memory. They do not have their own fields to display, but you can see them when we set their values ​​for the variable.



$X9 = $ X9 + 1; //  
$ S3 = $ X9; //  $ X9   S3  .


A more complete instruction on the control language of the APCS is posted on the website. In online configuration mode, directly from the site, you can set work scenarios:



image



And set (change) the names of the pin variables:



image



All Articles