Share this

Liquid level monitoring and control based on PLC and PC monitoring and management software

2026-04-06 07:45:07 · · #1
Abstract: Liquid level measurement and control is a crucial component of pharmaceutical tank control. This paper introduces the implementation method of developing a PLC-based liquid level measurement and control system, and elaborates on the method of developing a software interface between this system and other control links using a VB application. Key words: Measurement Control, Liquid Level, PLC, VB 1. Overview To meet the requirements of pharmaceutical manufacturing processes, factories require large- capacity sealed dome tanks for mixing and storing pharmaceutical raw materials. Based on the requirements of the entire production process, it is necessary to be able to measure the liquid level in the sealed dome tank in real time to accurately understand the volume of the liquid inside the tank, and to control the liquid level through on-site or remote operation. Simultaneously , the remote computer monitoring and management software connects with the on-site control process and exchanges data with other process control systems in the factory to achieve unified control of the entire pharmaceutical production process. Because the original method was based on personnel on duty, this method was not only labor-intensive, but also could not form an organic whole with the entire production process, resulting in low safety and reliability. Therefore, in order to meet the requirements of the system control task book, the electrical control system scheme in this paper is as follows: a remote PC is used as the system host to communicate with the PLC (slave) on site. The PLC realizes communication, on-site display interface display, acquisition of liquid level analog data, logic control, and audible and visual alarms. The electrical control system design introduced in this paper mainly includes the following aspects: (1) Selection of PLC, display panel, and continuous liquid level acquisition sensor. (2) Implementation of system control functions. (3) Software programming of host computer and slave computer. 2. Control content and requirements As shown in Figure 1, the control design task needs to achieve the following objectives: (1) It can monitor and record changes in liquid level in real time, and can manually set and automatically control the height value of liquid level. (2) The system can be controlled in automatic and manual modes. (3) The content displayed on the field display interface mainly includes: current liquid level value, current tank contents, set liquid level height, status of inlet and outlet solenoid valves, real-time fault alarms and historical fault alarms, etc. (4) Communication adopts RS-485 bus communication mode, so that the PLC can communicate with the remote PC to realize the purpose of controlling the liquid level height and monitoring the liquid level change through the PC. The PC can also communicate with other systems, thus making the entire pharmaceutical production process of the factory an organic whole. [align=center] Figure 1 Automatic Liquid Level Control System[/align] 3. Hardware Configuration and Implementation Method In order to improve the reliability and flexibility of the control system, the system adopts PLC programmable logic controller. The selected PLC is the Siemens S7-200 series, with the central processing unit being the newly released Siemens CPU 224XP AC/DC/Relay. This CPU integrates two RS-485 communication ports, two analog input ports, one analog output port, 14 digital inputs, and 10 relay outputs, offering high cost-effectiveness and meeting all system requirements. For continuous measurement of the liquid level in the tank, a sanitary radar level gauge is selected, with a measurement range of 20 meters and a standard two-wire 4-20mA current output. The sensor's output current signal is converted from 4-20mA to 0-10V via a current/voltage transmitter and connected to the analog input port of the CPU. The field display interface is Siemens' TD200 text display interface, which allows for easy display and setting of parameters, as well as displaying current alarm information and querying historical alarm information. Connecting the TD200 to the PLC only requires a TD/CPU cable to the PLC's communication port PORT0. One end of the 485 bus is connected to the PLC's communication port PORT1, and the other end is connected to the PC's RS-232 serial port via an RS-485/232 level converter, enabling the PC to send command frames to the PLC and receive response frames from the PLC. 4. System Software Programming and Implementation Methods Since the on-site PLC needs to transmit control parameters and real-time information to the remote PC monitoring and management software, the system software includes the PLC program and the PC's monitoring and management software. 4.1 PLC Programming: The program for the 224XP CPU is written, supporting the STEP 7-Micro/WIN V4.0 programming environment. The analog liquid level signal collected by the sensor is sent to the PLC's analog input port, converted by an A/D converter, and sent to the CPU. The input value is retrieved from AIW0. To increase stability, a certain range of sampled values ​​is taken, and the average of multiple sampled values ​​is calculated. Based on the calculated average liquid level over a certain time period, the current actual capacity is determined for production process control, on-site display, and upper computer recording and analysis. The PLC, based on commands from a local or remote PC, controls the input/output solenoid valves and discharge pumps of the tower tank through a series of logical operations to complete the system's predetermined commands and achieve control requirements. The TD200 text display configuration was also performed in the STEP 7-Micro/WIN V4.0 software environment. The programming environment provides an easy-to-use configuration wizard, making the text display interface configuration and use very convenient. 4.2 Development of PC Monitoring and Management Software Microsoft Visual Basic 6.0 provides an efficient visual programming environment with a user-friendly graphical interface. A small amount of interface control code is sufficient to design the standard Windows-style graphical user interface for this system. It supports object-oriented programming, allowing for convenient and rapid development of system analysis and control programs. To enable users to easily and quickly create serial communication programs and database system management, Visual Basic 6.0 provides the MSComm communication control and the ADO database access object library. 4.2.1 Communication between PC Serial Port and PLC Free Port The connection between the monitoring and management software (host computer) and the S7-200 PLC (slave computer) of this system adopts RS-485 bus half-duplex communication. Data is received in the interrupt routine of the MSComm event, and control commands are sent in the interrupt routine of the timer control. The communication between the host computer and the slave computer in this system is achieved by exchanging messages. The slave PLC only sends data when it receives a query command from the host computer. When the slave PLC receives a command from the host computer to modify control parameters, it must send an acknowledgment message before executing the command. (1) OnComm event interrupt service routine…… Private Sub MSComm1_OnComm() Dim GetByte() As Byte Select Case MSComm1.CommEvent Case comEvReceive 'Received 1 character data GetByte = MSComm1.Input Receive_Data = Receive_Data & GetByte(0) …… End Select End Sub …… (2) Timer event interrupt service routine…… Private Sub Timer1_Timer() Dim SendByte() As Byte Send_Data = SendByte() MSComm1.Output = Send_Data …… End Sub …… 4.2.2 Database management program The database format of the PC monitoring and management software of this system adopts the local Microsoft Access database. It records the current liquid level value and saves the historical liquid level value. At the same time, it also records all control parameters. This database can also be shared by other programs to change the control parameters and realize the interface between the entire pharmaceutical production process control and the sub-control system. Therefore, the system introduced in this paper can not only be used as an independent system, but also as a link in the organic whole of factory automation. ADO (ActiveX Data Object) technology is one of the most widely used data access technologies today. The system's monitoring and management software utilizes ADO objects in VB, referencing ADO components to develop applications that manipulate database records. This simply involves adding the "Microsoft ADO Data Control 6.0" component to the form and writing VB program code to connect to and manipulate the database. The following is the code for connecting to the local database: On Error GoTo LoginError Dim strConnection As String Set ConnData = New ADODB.Connection With ConnData .CommandTimeout = 15 .CommandTimeout = 30 End With strConnection = "UID=Admin;PWD=;" & _ "Driver={Microsoft Access Driver (*.mdb)};" & _ "DBQ=" & App.Path & "\db1.Mdb;" ConnData.Open strConnection ConnData.CursorLocation = adUseClient Adodc1.ConnectionString = ConnData.ConnectionString Adodc1.RecordSource = "select * from tbl1" Adodc1.Refresh Set AdoRs = New ADODB.Recordset AdoRs.Open "select * from tbl1", _ ConnData, adOpenForwardOnly, adLockReadOnly Exit Sub LoginError: MsgBox "Unable to establish a connection with the database!" 4.2.3 The development of a database browser is not only about a user-friendly and aesthetically pleasing graphical window interface and reliable database record access code. It also requires convenient database record browsing and analysis methods and interface interfaces. For this purpose, it is necessary to use some database-bound controls to realize the functions of the database browser, and use the drawing command line to realize a simple current and historical original liquid volume change trend chart. This makes the operation simpler and more convenient, and the daily maintenance more user-friendly. 5. Conclusion The electrical design scheme of the liquid level monitoring system and the PC monitoring and management software introduced in this paper have been proven to be feasible in practice. They not only solved the defects before the transformation, but also have stable and reliable performance. They have achieved: (1) Even without a PC (host computer), the PLC system can still run independently and reliably. (2) The PC monitoring and management software coordinates with other links in the entire pharmaceutical production process through a shared database. The control scheme uses PLC as the core of field control, which ensures high reliability of control; using a PC to manage the system or integrate other subsystems reduces costs, facilitates centralized management, and improves the degree of automation. The author believes that this solution is not only applicable to the upgrading and transformation of old industrial production equipment, but also has reference value for centralized management of small and medium-sized process control. References: [1] SIMATIC.S7-200 Programmable Controller System Manual.6ES7298-8FA22-8BH0 [2] Hao Cheng. Research and application of PC-based DCS. Microcomputer Information. 2005.5 [3] Guo Qi. Visual Basic Database System Development Technology. People's Posts and Telecommunications Press, 2003 [4] Fan Yizhi, Chen Liyuan. Visual Basic and RS-232 Serial Communication Control. Tsinghua University Press, 2002
Read next

CATDOLL 136CM Ya (TPE Body with Hard Silicone Head)

Height: 136cm Weight: 23.3kg Shoulder Width: 31cm Bust/Waist/Hip: 60/54/68cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm An...

Articles 2026-02-22