Share this

Design of a Distributed Computer Monitoring System Based on PLC and PC

2026-04-06 03:34:14 · · #1
Abstract: The power supply system is an important component of a factory. Timely monitoring and alarming of potential faults and production failures are crucial for smooth production operations. This paper introduces the application of Omron PLC and PC host computer in a circuit monitoring system of a petrochemical plant, detailing the system's hardware and software design, as well as communication connections. Keywords: PLC , PC host computer, serial communication In complex power grid systems, traditional fault alarms typically use hardware methods such as alarm beacons and fault indicator lights. This approach has many drawbacks. For example, if the power grid is distributed widely, the fault alarm points are also dispersed, requiring manpower for patrols and inspections, resulting in wasted human resources, and alarms and repairs are not timely; too many fault alarm points require a large number of alarms, complicating the wiring; and hardware alarms provide insufficient fault information, etc. With the widespread application of computer and automation technologies in factories, fault information can be initially monitored via PLC, and then uploaded to the computer for processing, alarm activation, recording, and display. This system offers advantages such as centralized monitoring, manpower savings, and intuitive, comprehensive fault information for easy analysis. II. System Introduction The system uses a PLC to detect the status changes of 48 fault relays. A host PC periodically queries and reads the 61-bit status information from four channels of the PLC (including 48 input points and 13 categorized output points), analyzes it, and manages and records it in a database. The program is developed using Visual Basic 6.0, and the database uses Microsoft Access 2003. Each fault point is marked on the workshop circuit diagram according to its corresponding location, as shown in Figure 1. After the program enters monitoring mode, the PC will check the communication connection with the PLC. If the communication connection is normal, the program will detect changes in the field signals. If the signal changes from normal to alarm, the corresponding indicator light and the overall status indicator light will flash and an audible alarm will sound. The fault information will be displayed in the upper right corner, and the operating status information and fault information will be stored in the database. Clicking the flashing indicator light will stop the flashing and display the current status: red for alarm and light yellow for normal. If the signal changes from alarm to normal, the corresponding indicator light will stop flashing, and the operating status information and fault repair information will be stored in the database. The current status changes from red to light yellow. To view the information of each node, click the indicator light. The upper right frame will display the node's tag number, the corresponding PLC bit, the name of the alarm point, and the contact status. The upper right text box displays the current overall operating status of the system, with corresponding indicator lights indicating "normal" and "alarm" states. Red indicates an alarm, and green indicates normal. [align=center] Figure 1 Alarm Monitoring Screen (Normal Status)[/align] The screen during an alarm is shown in Figure 2. [align=center] Figure 2 Alarm Monitoring Screen (Alarm Status)[/align] III. Monitoring System Composition 1. System Structure The system configuration is shown in Figure 3. This system mainly consists of a host PC and a slave PLC, monitoring 48 fault points and classifying them into 13 categories, then displaying the fault information on the computer screen. The PLC used is Omron C200H, with 3 input modules, 1 output module, and 1 communication module. The two ends of the fault relay are brought out as dry contacts of the PLC. The fault information is converted into switch inputs to the PLC through the input module. The PLC classifies the faults and then communicates with the host computer through RS232-422 converter and RS232C serial port. The host computer reads and processes the fault information for monitoring and alarm. [align=center] Figure 3 System Structure[/align] 2. Software Design The PLC programming of this system is written using CX-ProgrammerV3.1 to realize the initial monitoring of the fault relay by the PLC; the host computer monitoring uses Visual Basic 6.0 to write the main monitoring program to realize the functions of real-time fault monitoring alarm, display, recording, fault point information query and modification, and running status query. (1) PLC program: The program includes three input modules and one output module, which are used to collect and classify 48 fault information and monitor the status of the PLC backup battery. Transfer the fault information to channel 20: Classify the fault: Transfer the PLC backup battery status to channel 23: (2) Host computer program: mainly responsible for serial communication with PLC, reading and analyzing the internal channel status of PLC, and realizing functions such as fault alarm, display, fault point information query, fault information record query and node information modification query on the main interface. When the host computer PC communicates with PLC, it is done in response mode. The host computer sends a set of ASCII character data to PLC. This data is called command block. After receiving the command block, PLC analyzes and considers the command to be normal. Then it operates according to the command and returns the operation result to the host computer. The set of data returned by PLC to host computer is called response block. If PLC receives the command and analyzes and confirms that the command is abnormal, it returns an error command response block to host computer. When the host computer and PLC communicate, PLC is passive. The host computer must send a command block to PLC, and PLC responds and returns the response block to host computer. This program employs multiple communication methods. In multiple communication, the first frame begins with the unit number (i.e., the host link number), followed by a header, message, checksum, and end character (if there is only one frame) or separator (if there are multiple frames). Intermediate frames begin with the message, followed by the checksum and separator; each intermediate frame message has a maximum of 125 characters. The last frame begins with the message, followed by the checksum and end character; each last frame message has a maximum of 124 characters. The checksum (FCS) is an 8-bit binary number converted to a 2-bit character. This 8-bit binary number is the result of a bitwise XOR operation of the ASCII codes of all characters preceding the checksum in a frame. When converting to a character, it is converted from a 2-digit hexadecimal number to the corresponding numeric character. After receiving a command block from the host computer, the PLC analyzes and returns a response block to the host computer, containing a response code. If the PLC successfully completes the host computer's command, the response code is 00; otherwise, the response code contains error information. The serial communication between the host PC and the PLC: The value of Timer2 is set to 2000, that is, the host PC sends a read command to the PLC every 2 seconds to read information. Private Sub Timer2_Timer() Dim a(10) As String a(0) = "@00RR00200004" 'Unit number and header message a(1) = FCS(a(0)) 'Check bit in command format a(2) = a(0) + a(1) + "*" + Chr$(13) 'Command code MSComm1.Output = a(2) 'Send command to PLC a(3) = MSComm1.Input a(4) = Mid$(a(3), 6, 2) 'Response code Call Message(a(4)) 'Error message for calling response code If errortime > 3 Then Timer2.Enabled = False intr = MsgBox(“Communication error, do you want to exit the connection check?”, vbYesNoCancel + vbExclamation, “Communication connection in progress”) If intr = vbYes Then ... Else ... End If End If 'If the communication connection is normal, read the data: a(6) = Mid$(a(3), 24, 2) 'Checksum in the response block a(7) = Mid$(a(3), 1, 23) a(8) = FCS(a(7)) 'Calculate the checksum If a(8) = a(6) Then 'Compare whether the checksums are the same a(9) = Mid$(a(3), 8, 16) a(10) = Hex2Bin$(a(9)) z = a(10) 'Get the PLC internal channel data Else MsgBox ("Checksum is incorrect") ... End If Checksum Calculation Function: Function FCS(ByVal inputstr As String) As String Dim slen, n, xorresult As Integer Dim tempfcs As String slen = Len(inputstr) xorresult = 0 For n = 1 To slen xorresult = xorresult Xor Asc(Mid$(inputstr, n, 1)) Next n tempfcs = Hex$(xorresult) If Len(tempfcs) = 1 Then tempfcs = "0" + tempfcs End If FCS = tempfcs End Function Convert the data in the response code to binary data: Function Hex2Bin$(HexValue$) Const BinTbl = "000000010010001101000101011001111000100110101011110011011110111101111" Dim X, Work$ Work$ = "" For X = 1 To Len(HexValue$) Work$ = Work$ + Mid$(BinTbl, Val("&h" + Mid$(HexValue$, X, 1)) * 4 + 1, 4) Next Hex2Bin$ = Work$ End Function Monitoring program functions: Fault information and node query are shown in Figure 4; PLC battery fault display is shown in Figure 5; The database will record the system running status, the time of fault occurrence and related information, the time of fault repair and related information, and provide query functions as shown in Figure 7; You can view the PLC bit, name, contact status and other information corresponding to the upper tag number on the main interface to facilitate fault analysis, as shown in Figure 8; The overall system running status indicator is shown in Figure 6. [align=center]Figure 6 System Operation Status Indicator Figure 7 Database Query Figure 8 Tag Number Correspondence Information Query[/align] IV. Functions Performed by the Monitoring Program 1. Fault Indication: When an alarm occurs, the corresponding indicator light and the overall status indicator light will flash and sound an alarm. The fault information is displayed in the upper right corner. Clicking the flashing indicator light will stop the flashing and display the current status. An alarm is red, and normal is light yellow. If the fault is repaired, the corresponding indicator light will stop flashing, and the current status will change from red to light yellow. Clicking the indicator light will allow you to view the information of each node. The upper right corner of the graph will display the tag number of the node, the corresponding PLC bit, the name of the alarm point, and the contact status. The upper right corner text box has corresponding indicator lights to display the current overall system operation status. Red indicates an alarm, and green indicates normal. 2. Historical Records: The database records the system operation status, including the tag number, name, PLC bit, contact status, and alarm time of the alarm. When the fault is cleared, the cleared tag number, name, PLC bit, contact status, and fault clearing time are also recorded. The database contains a tag number name correspondence table to facilitate querying the correspondence of each point. 3. Communication Connection: Used to reconnect the communication between the host computer and the slave computer. Clicking the connection button in the toolbar will check the communication connection. 4. Sound Test: Used to test if the sound alarm is normal. If normal, clicking this button will cause the system to emit an alarm sound. 5. Mute: Used to silence the system alarm sound without affecting the flashing indicator lights. V. Conclusion This system is a circuit fault alarm system designed for the production workshop of Qilu Petrochemical Chlor-Alkali Plant and is now in operation. In practical applications, it provides accurate and reliable real-time production data and operates well. It reduces the waste of human resources for the enterprise, improves the working environment of workers in the poor chemical plant production workshop, reduces their workload, and achieves centralized monitoring. The system's scalability also well adapts to the needs of workshop improvement. Monitoring points can be added according to user requirements, and fault classifications in this workshop can be output to the next higher-level monitoring station, which has been well received by users. References: 1. Xu Desun and Tong Jing, *Programmable Logic Controller (PLC) Application Technology*, Shandong Science and Technology Press, 2000. 2. Li Yongfan, *Visual Basic 6.0 Programming and Application*, People's Posts and Telecommunications Press, 2006. 3. Li Changlin, *Visual Basic Serial Communication Technology and Typical Examples*, Tsinghua University Press, 2006.
Read next

CATDOLL 126CM Yoyo (Customer Photos)

Height: 126cm Weight: 23kg Shoulder Width: 32cm Bust/Waist/Hip: 61/58/66cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22
CATDOLL Q 88CM TPE Doll

CATDOLL Q 88CM TPE Doll

Articles
2026-02-22
CATDOLL 128CM Luisa

CATDOLL 128CM Luisa

Articles
2026-02-22