Task
There are several computers that need to be connected to one network, regardless of the operating system, hardware platform, data transfer method and network location. The created network will allow transferring data from an industrial computer managing a technological process to various consumers (with further processing of this data), with the possibility of feedback (for sending commands to be executed).
Possible means of execution
There are several ways to connect computers to one network. For example, VPN. In this case, it is inconvenient that you have to shovel the firmware of an industrial computer, or intervene in the logic of the AWS. In the first case, I don’t want to reflash at all, and there are no necessary tools / skills, the costs of studying the platform are irrationally high. Intervention in the logic of the AWS (SCADA InTuch) will also lead to a loss of warranty. In addition, it is quite important to ensure the work of the AWP in real time, and this is a guarantee of the system’s instant response to the control action. Neither more nor less, but someone will save life.
What else do we have? Well, for example, SSH. Not suitable for similar reasons. Although the level of required security is quite consistent, but the complexity of the alterations drives into a dead end.
Acceptable solution to the problem
So, in the insides of working systems do not climb. The system provides quite affordable means of exchanging information in simple forms with simple means. As a rule, this is a text with timestamps, an indication of the level of warning messages, a report on the execution of commands.
')
Nothing prevents you from taking this data from a machine running an automated workplace and then working with it on a separate machine. Since the machine for communication is separate - you can not fear for hangs, crashes and falls at the most inconvenient point in time. However, this behavior will talk about a bad question, and as a result - a bad decision. In addition, the car may not be physically located at a hazardous industrial facility (HIF, required to register with Rostechnadzor), often there is no space for additional equipment at the facility, and if so, it will be necessary to carry out design activities, licensing, re-registration, etc. In the end, it is also expensive and time consuming. And communication channels, as a rule, are laid in advance, and are standard means.
The mode of communication of computers, obviously, should not be based on DNS, TCP \ IP, UDP directly.
Technology selection
It is quite clear that it is extremely expensive to create communication devices from scratch. Relying on low-level tools is also unprofitable because of the hard binding. Obviously, this will be a high-level protocol, relying on existing developments.
Features of any SCADA-system is that the volume of transmitted data is not great at all, but at the same time, there must be efficiency. It is clear that when trying to connect SCADA on a PC and a mobile phone (with Java), it is necessary to ensure the speed of information delivery. T. o. from the specified high-level protocols are excluded email. mail, ftp and other are strongly limited. Means designed for long periods of time.
The most appropriate type of communication will be a protocol based on the transfer of short messages. Theoretically, any Internet pagers can be considered as a basis: ICQ, mail.ru, MSN, jabber and about a dozen others. Practically, from all variety, there are only a couple of pieces. For example, ICQ is a closed protocol and can change at any time. In addition, if a copywriter calculates that his protocol is being used “for other purposes”, more than financial problems will arise. For the same reasons, all commercial or closed protocols are dropped. Rarely, protocols either do not have normal support or do not provide an acceptable quality of communication. Ultimately, thanks to the openness, the presence of the mass of libraries, transports and extensions, here it is our winner - jabber.
Leverage effect
Technically, you can arrange a leapfrog with windows manipulation - in one place I read data from a file / socket, sent a message to the window to pop up to the foreground, emulate keystrokes, to insert the desired message, and then emulate pressing the “send” button, minimizing the window. This inverse-rectal method has the right to exist. Exactly, for more than three years, the AWS of the wagon depot manager has been functioning, due to the fact that some clever man decided that the printer is necessarily connected to the com port, and there is no de facto printing subsystem in Windows either. (almost all ways to solve the problem, including virtual DOS-printers) were tried.
In this case, interests, after all, the human solution to the problem. The human solution involves a complete, compact mechanism, not annoying every second arbitrary manipulations with horses, mouse and keyboard. In any case, you cannot work with such a machine (at least, not under one account, and not on one desktop).
Jabber has both a large group of users and advanced means of interaction. Decentralized network, the ability to legally raise your server, and connect with others - nicely completes the prospect. However, there are more than enough servers on the Internet, and the need for a private server arises more than rarely. Once again, it should be repeated: it is possible to transfer large amounts of data, but one should not abuse the kindness of those who maintain the server.
Means of production
Python was chosen as the programming language. It is quite lightweight, "batteries are included," is not limited to licensing, is under all platforms, portable. This is quite enough to justify the choice.
In the kit to Python, you still have to add one “battery” -
xmpppy . This is an additional library specifically designed to work on the XMPP / jabber protocol. It does not develop officially, but the community almost daily adds something to it (there were no official releases for a long time). There are several examples of its use on the Internet’s runet, they are easily searched, links will be given if necessary).
So, the code with comments sufficient to provide a computer-to-computer / mobile phone / smartphone / touchpad connection. It is understood that the information comes to the jabber-client.
The given code is sufficiently commented to solve 99.5% of the tasks in the future.
For industrial purposes, it is not recommended to use the operating system family of Windows. This is not just another round of holivar, it is a sad experience in industrial applications. everything else, the possibility of bundling external equipment and software PC stuffing is very limited compared to competitors. With a strong desire and an excess amount of money, this problem can be solved, but if “the trousers look the same, why pay more”?
Short summary
In the given example, the mechanism of communication of the automated workplace and the client from the beginning to the end is not disclosed. Only the part that provides the connection of an arbitrarily large number of computers with an arbitrarily strange, networked, located machine has been solved. Further expansion of handlers (or the logic of one handler) will allow solving an unlimited number of tasks on creating an information infrastructure. Built-in security features allow you to close initially a lot of gaps. Using a high-level protocol allows you to create additional add-ins on top of it in the interests of users. Providing a stable connection will reduce the time and money for diagnostics and troubleshooting. The described procedure will save more than one hour of free time and nerves for the CAM engineers. External devices connected to a PC (sensors, burglar / fire alarm, measuring instruments) can be monitored and programmed remotely.