1
Introduction
Siemens Industrial Control products have a high market share in the industrial control field, S7-200 series PLC is one of the members of the siemens simatic plc family, in the application of Siemens Industrial Control Field occupies an important position. S7-200 series PLC small size, powerful hardware and software, system configuration is convenient, the system composed of it can be connected with the powerful Profibus Field Bus. It has been widely used in all walks of life as soon as it is pushed to the market. However, in the practical engineering application encountered monitoring computer and S7-200 PLC communication problems. Because Siemens S7-200 series PLC than monitoring configuration software WinCC launched late, so WinCC without integrated S7-200 series PLC communication driver; S7-200 series PLC communication protocol is not open, there are also problems with preparing monitoring programs using third-party software. These problems bring some limitations to the application of S7-200 series PLC, in order to solve this practical engineering problem, the author made some research, in this paper, the research results of the communication between S7-200 series PLC and monitoring computer are discussed.
2 S7-200Main Methods of PLC monitoring
In most control systems, only implementing control is not enough. In many cases, you also need to configure the monitoring interface to monitor the system. Through monitoring, the human-computer interaction capability can be increased, so that operators can monitor the system's working conditions in real time and make system operations more convenient.
There are three methods to monitor the control system composed of S7-200 series PLC: Configuration Software Monitoring, third-party software monitoring, touch screen monitoring.
The configuration software WinCC is used for monitoring. It has powerful functions, good flexibility, and high reliability. However, the software price is high, and the communication problem between WinCC and S7-200 series PLC must be solved. This method can be used in complex control systems.
The monitoring software compiled by third-party software is used for monitoring. It has good flexibility and low system investment, and can be applied to various systems. However, the development system requires a lot of work and reliability is difficult to guarantee, and requires a high level of technical experience and technical level. Therefore, you must purchase communication protocol software. This method can be used when the system has limited capital investment and a high level of technical personnel.
Touch screen monitoring, high reliability, easy monitoring implementation, communications between touch screen and PLC problems have been handled by the manufacturer, users do not need to consider communication problems, can greatly shorten the engineering cycle. However, it is flexible and has limited functions. It cannot meet the monitoring requirements of complex control systems and is expensive. This method can be used when the system reliability requirements are high and the construction period is short.
3 WinCCCommunication between configuration software and S7-200 PLC
SIMATIC WinCC adopts the latest 32-bit process monitoring software, with good openness and flexibility. WinCC is a good choice for single-user systems and redundant multi-server/multi-user systems. Through ActiveX, OPC, SQL and other standard interfaces, wincc can easily communicate with other software. WinCC and S7-200 series PLC communication, can use one of the two communication protocols of PPI and Profibus.
1. Implementation of communication between WinCC and S7-200 PLC through PROFIBUS Protocol
(1) software and hardware requirements:
* PC, Windows 98 operating system;
* S7-200 series PLC;
* Cp5412 board or other similar boards, such as CP5611 and cp5613;
* Em277 Profibus DP module;
* PROFIBUS cables and connectors;
* Install the driver of the cp5412 board;
* Install WinCC 4.0 or later;
* Install the com PROFIBUS software.
Hardware connection 1.
Communication hardware connection
(2) Configuration
Open simatic net/COM Profibus, add a new configuration, the main station for the SOFTNET-DP, slave station is EM277 Profibus-DP. Select from 1 to 126 for the master site address. Select 3 to 99 as the slave site address, which is consistent with the address of EM277. Then use the software to Configure the slave site: Open the slave site attribute, select 8 bytes in/8 bytes out in the Configure option (you can select according to your actual needs ). In Parameterize, you can select an offset address, which corresponds to the data zone (Zone V) of the S7-200 series PLC. The default value is 0, that is, starting from VB0. After the configuration is complete, Export the (Export) NCM file to generate *. txt and *. ldb files.
(3) set PG/PC interface.
Select CP_L2_1 in Access Point of the Application and cp1_a2 (Profibus) in Interface Parameter Assignment ). Activate the DP protocol in the property and enter the full path of the *. ldb file in the DP-Database parameter. After the configuration is complete, you can diagnose whether the hardware configuration is correct and whether the communication is successful.
(4) WinCC settings.
Add a new driver in the WinCC variable manager, select profibus dp. CHN for the new driver, select CP5412 (A2) Board 1, and set the Parameters in System Parameters. The CP5412 (A2) board parameter is 1, indicating the card number. The Config parameter is the full path of the *. txt file generated during configuration, and the Watchdog time parameter is 0. Create a new connection. The slave site address is the same as the address of em277.
(5) create a variable.
Variable types In WinCC include In and Out. In and Out are relative to the master station, that is, In indicates that WinCC reads data from the S7-200 series PLC, Out indicates that WinCC writes data to the S7-200 series PLC. In and Out correspond to the data storage Zone V. In this example, VB0 ~ in the Out and PLC Data Storage areas ~ Corresponding to VB7, In corresponds to VB8 ~ Corresponding to VB15.
(6) advantages and disadvantages.
Advantages: This method provides fast data transmission, easy scalability, and good real-time performance. Disadvantages: limited data transmission areas (up to 64 bytes), must also be processed in the PLC, and high hardware costs, the need for CP5412, EM277 Profibus-DP, Profibus bus and other hardware, the Com Profibus software is also required. Application scenarios: Suitable for systems that require high-speed data communication and real-time performance.
2. WinCC and S7-200 series PLC through the PPI protocol communication implementation.
The PPI protocol is a commonly used communication protocol of Siemens S7-200 series PLC, but it is not integrated in WinCC, that is, WinCC cannot directly monitor the control system composed of S7-200 series PLC. S7-200 OPC Server is a kind of interface software specially designed for solving host computer monitoring S7-200 series PLC control system. Therefore, WinCC can easily establish communications with S7-200 series PLC through the software.
(1) software and hardware requirements:
* PC, Windows 98 operating system;
* S7-200 series PLC.
* PC/PPI cable.
* Install S7-200 OPC Server software.
* Install WinCC 4.0 software.
(2) connection:
Set PG/PC interface parameters in the control panel. In Access Point of the Application, select Computing, and the Interface parameter select PC/PPI Cable.
Add a new driver in WinCC variable manager and select OPC for the new driver. CHN, create a new connection in opc group, open the property, select OPC Group Setting, OPC server name is OPCServer. microComputing. Then create a variable in the newly added connection. The Item Name of the variable corresponds to the variable Name used for monitoring in the S7-200 Family PLC. For example, the Item Name is M0.0.
(3) advantages and disadvantages
Advantages: This method is simple to connect, with less hardware investment, and can read and write all the storage areas in the S7-200 series PLC. Disadvantages: the communication speed is slow, OPC software and corresponding authorization are required, and system expansion is not convenient. Application scenarios: Applicable to systems with low speed, low real-time requirements, and limited investment funds.
In addition, it can also communicate through OPC software of other companies, for example, KEPServerEx of KEPServerEx as OPC server, WinCC as OPC client to read and write S7-200 series PLC Internal data zone. The implementation is similar to the second method above, the difference is that the tag must be set up in the OPC server to correspond to the storage address in the S7-200 series PLC.
In the complex system, if there are S7-200 series PLC and S7-300 series PLC in the system, the S7-200 series PLC is generally used as the S7-300 series PLC from the station to the Profibus bus, winCC through S7-300 series PLC S7-200 series PLC monitoring.
4Connection between third-party software and PLC
Some systems have special characteristics and there is no ready-made general software for data processing and system monitoring. This requires you to use a third-party software development platform to develop monitoring software that meets system requirements. This can meet both system requirements and save system investment. However, software developers have high experience and technical requirements.
Third-party software development platform development of monitoring software and S7-200 series PLC communication using PPI protocol interface software: Prodave, MicroComputing, OPC.
Third-party software development platform development of monitoring software and S7-200 series PLC through the free port for communication, protocol custom, the development of monitoring software can call the MSComm control to achieve the communication between the two.
1. Use the Prodave Software Package for communication
Prodave is a software package specifically designed for Siemens PLC products (S7-200, 300, 400 series PLC) and PC/PG for data exchange processing. Prodave integrates data exchange functions in *. DLL or *. LIB files. Various functions of the software can be conveniently called in self-developed monitoring software.
The main functions are:
(1) load_tool PC and PLC system initialization link;
(2) unload_tool disconnects the PC from the PLC system;
(3) and read and write functions in the internal storage area of the PLC.
The monitoring software can conveniently monitor the PLC control system through read/write functions.
2. Use MicroComputing software for communication
After installing MicroComputing, you can directly insert controls in VB or Delphi. The following controls can be inserted: Data controls, Edit controls, Button controls, Label controls, and Slider control.
The main function of Data controls is to connect the above four controls with the S7-200 series PLC, set the event trigger conditions and set the S7-200 series PLC address. The Edit controls, Button controls, Label controls, Slider control can be directly corresponding to the S7-200 series PLC storage resources. Third-party software can directly call the control column on the PLC monitoring, can also be through the function of the S7-200 series PLC read and write operations.
3. Use OPC Server software for Communication Connection
After installing the S7-200 OPC Server software, an OPC Server will be added in the operating system named "OPCServer. Computing ". You can write an OPC client program in VB or Delphi to communicate with the OPC server.
The following describes how to compile an OPC client program in the VB development environment: first, add OPC Automation 2.0 to Project/References in the VB development environment, then write the program that connects to the OPC Server, adds groups, adds entries, and reads and writes data.
The functions used are as follows:
Connect function: establish a connection with OPC Server;
OPCGroups. Add function: Add group;
OPCITems. Additems function: Add entries;
SyncRead function: Synchronous read;
Syncwrite function: Synchronous write.
The OPC server name is "opcserver. computing" and the entry name corresponds to the variable name used for monitoring in the S7-200 series PLC.
4. Use a free port for communication
Insert the MSComm control in VB or Delphi, send and receive data through the serial port according to the custom protocol, and process and monitor the data.
The communication program must also be compiled in the PLC. The process is as follows.
Figure 3 free-port communication Flowchart
5. Summary of advantages and disadvantages:
With prodave, simple implementation, good flexibility, can directly call prodave's function to read and write the internal storage area of S7-200 series PLC, and can meet the needs of large-scale data transmission, simple debugging, it is suitable for engineering applications. However, you need to purchase software and programming is complicated.
Microcomputing is used for ease of use, programming is implemented by controls, and writing is simple. However, it is not flexible and requires software purchase and authorization.
Communication with OPC is flexible and simple in programming, and debugging is simple. Since the OPC protocol is a common protocol, it is supported by many companies and has good universality. However, you need to purchase software and authorization.
It is implemented through free-mouth communication, and the communication protocol is self-developed. The flexibility is good, and the scope of use is extended. No special software is required. However, programming is complex, and complicated programs need to be compiled in PLC, which uses a lot of PLC resources. The MSComm control is used in VB or Delphi to read and write the serial port. The program is complex and the real-time performance is poor.
5Conclusion
The above shows the six monitoring computer and S7-200 series PLC communication implementation methods, they have their own advantages and disadvantages, suitable for different situations of the monitoring control system. The research proves that the above six methods can better realize the communication between the monitoring computer and the S7-200 series PLC for different requirements system, which has high reference value for engineering practice.