Computer Power Supply Monitoring System in Computer Room Based on VB

Publisher:camuspycLatest update time:2011-08-27 Source: chinaaet Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In order to monitor and manage the computer power supply equipment in the computer room in real time, efficiently and conveniently, and to achieve the goal of centralized monitoring of the computers in the computer room and less manpower on duty, this paper proposes a centralized monitoring system for computer power supply in the computer room. The goal of this system is: through the design of relevant software and hardware, one host (upper computer) can monitor the switch status of multiple computers in multiple computer rooms through a single-chip microcomputer (lower computer). That is, the monitoring software of the host is used to communicate with the single-chip microcomputer to realize the monitoring function of the computer power supply. This system should have the following functions:

(1) Control the on/off status of multiple computers through the keyboard or mouse and detect the on/off status of all computers in the entire computer room.

(2) The upper computer and the lower computer can communicate reliably and in real time.

(3) The interface is clearly designed and fully functional. It is equipped with menus and computer distribution maps of each computer room, as well as a right-click quick menu.

(4) The layout can be automatically adjusted according to the number of computers in different computer rooms.

1 Selection of software and hardware and definition of communication protocol between upper and lower computers

Based on the above goals and functions, to realize this system, we must first solve the following problems:

1.1 Selection of communication channel between host and microcontroller

Serial communication only transmits one bit at a time, and the data voltage processed is only one level, so it is not easy to lose data. If some preventive measures are added, data loss will be even less likely to occur. The serial communication port (RS-232) is a necessary equipment on every computer, usually containing 2 channels, COM1 and COM2. Ordinary computers connect COM1 with a 9-pin connector and COM2 with a 25-pin connector. The new generation of computers connect all RS-232 communication ports with a 9-pin connector. The communication interface usually connected to the computer is RS-232, which is not only practical and simple, but also cheap. Therefore, this system uses RS-232 serial communication for communication between the upper and lower computers.

1.2 Selection of monitoring software development platform

Visual Basic is a visual software development platform under Windows environment. Due to its open structure, Visual Basic allows plug-in controls, so more manufacturers write controls for Visual Basic for system developers to choose from, thus providing developers with a more convenient system development solution. These controls can be used to design interfaces and implement various functions, reducing the workload of programmers and simplifying the interface design process, thereby effectively improving the operating efficiency and reliability of the application. Therefore, this system uses Visual Basic as the monitoring software platform.

MSComm is an ActiveX control provided by Microsoft to simplify serial communication programming under Windows. The MSComm control provides two methods for processing communication: event-driven method and query method.

(1) Event-driven method: The OnComm event is the only event provided by the MSComm control. When data arrives at the port, the port status changes, or a communication error occurs, the OnComm event will be triggered to capture and process these communication events and error information generated during communication. By querying the CommEvent property value, you can obtain complete information about communication events and communication errors, and then process them. This is a powerful method for processing serial port activities, with the advantages of timely program response and high reliability.

(2) Query method: The CommEvent property of the MSComm control returns the event and error type generated in the communication, which is set by the communication control after automatically detecting and tracking the communication status. Therefore, in the applet, the programmer can detect events and communication errors by checking the CommEvent property value after each important program function. This system adopts the query method as a method for handling communication.

1.3 MCU Model and Chip Selection

The single chip microcomputer mainly adopts Intel's MCS-51 series 8031 ​​single chip microcomputer, and is developed using MCS-51 assembly language.

1.4 Definition of the communication protocol between monitoring software and MCU

In order for the host and the microcontroller to communicate in real time and reliably, a good communication protocol must be defined.

The communication parameter settings of this system are shown in Table 1, and the communication protocol used is shown in Table 2.

Among them: Roomadd: computer room code (i.e., address code of the microcontroller), 1 byte, encoded starting from 01H.

Command: command code, 1 byte (the format of the command code is shown in Table 3).

Byte count: data length, the total number of computers to be monitored + 1 (the last frame is the check frame), 1 byte.

PCadd: PC number, each PC number is 1 byte, and the encoding starts from 01H.

Checksum: Arithmetic checksum, 1 byte, obtained by arithmetic addition of all PC numbers modulo 256.

Cmdresponse: The collected data responded by the MCU. The specific format is shown in Table 4.

Where: D7 is 1, indicating that the PC state is "on"; D7 is 0, indicating that the PC state is "off". The PC address is encoded starting from 01H. 00H is agreed to be the feedback signal of successful reception.

2 System Overall Design Module

According to the functions to be achieved by this system, the system can be divided into three modules as shown in Figure 1.

2.1 Monitoring

The monitoring part can be divided into two modules: monitoring and control. The main function of the monitoring module is to detect the switch status of all computers or several computers in the entire computer room. The host sends a monitoring signal to the single-chip microcomputer through the serial port, and then displays the simulated status on the interface according to the feedback signal of the single-chip microcomputer (that is, the simulated computer switch status data). If the feedback signal from the single-chip microcomputer is not received, it will prompt that the operation failed. The main function of the control module is to control the on/off of all computers or several computers in the computer room. The host sends an on/off signal to the single-chip microcomputer through the serial port. If the host receives the operation success signal fed back by the single-chip microcomputer, it means that the operation is successful, and the on/off status of the corresponding computer is displayed on the interface. If the operation success feedback signal from the single-chip microcomputer is not received, it will prompt that the operation failed.

2.2 System Settings

This module makes some settings for the system, such as computer room configuration: including computer room code, computer room name, number of computers in the computer room, setting of scheduled monitoring time, setting of report generation, etc. These settings enable the system to adapt to different needs and operate more flexibly in different occasions.

2.3 History Record Query Management Section

The main function of this module is to record the startup and shutdown time of all computers in each computer room, and provide query function so that managers can know the startup and shutdown time of a certain computer and the startup and shutdown status of a certain computer at a certain moment.

3 Main interface design

The user interface should have the following features:

(1) Easy to use: The interface is concise and clear, and the operation is easy.

(2) Fault-tolerant capability: It has the functions of error diagnosis, error correction and error protection;

(3) The system can provide system response information of different levels of detail according to the user's wishes and needs, including feedback information, prompt information, help information, error information, etc.;

(4) Under the premise of completing specific functions, the user interface should be as simple as possible. The user interface should ensure that users can use the system correctly and reliably and ensure the security of related programs and data.

In order to facilitate the monitoring of management personnel, a graphical human-computer interface is used in the user interface design, striving to be simple and flexible. In the system main screen, one icon represents one computer in the computer room, and icons of different colors are used to represent different states of the computer switch.

4 Initialization Design

Before carrying out functional design, the system must first be initialized and designed. The main initialization process is shown in Figure 2.

4.1 Setting of communication control MSComm

The specific settings of the controls in this system are as follows:

MSComm1.CommPort=1 //Use COM1 as the communication port

MSComm1.PortOpen=True //Open the communication port

MSComm1.InputMode=comInputModeBinary

//Read data in binary format

MSComm1.InputLen=0//each read receive

//The entire contents of the buffer

MSComm1.RThreshold=0 //Use query mode, turn off interrupt

MSComm1.Settings=″9600,n,8,1″ //Communication parameter settings, wave

//Baud rate 9600, no parity check, 8 data bits, 1 stop bit

Since the length of data sent and received is different each time, it is difficult to determine the property value of RThreshold to generate an interrupt; in addition, since the system uses object-oriented programming, each time the sending and receiving of data is triggered by an event, the system uses the value of InBufferCount to decide whether to receive data instead of using an interrupt.

In addition, for the data acquisition and processing system composed of microcomputer and single-chip microcomputer, since data transmission mostly adopts hexadecimal mode, MSComm is set to read data in binary mode.

4.2 Initialize the system according to the computer room configuration data table

Because this system uses a dynamic method to display data, the configuration of the computer room (computer room code, computer room name, number of computers) is stored in the computer room configuration data table in the database ("computer room monitoring.mdb"), so when loading the system, the data in the data table must be retrieved to initialize the system.

This system defines a two-dimensional global array Public pcroom(1 To 100,1 To 2)As Variant to store the computer room data in the computer room configuration data table. The first dimension represents the computer room code, which is set to a maximum of 100 computer rooms, and the number of computer rooms can be increased or decreased by changing the array subscript as needed. Pcroom(i,1) represents the computer room name, Pcroom(i,2) represents the number of computers in the computer room, and i represents the computer room code (1≤i≤100).

4.3 Initialization of controls related to the computer room in the interface

In this system, there are 4 controls related to the computer room name, 2 of which are ComboBox (Combo1, used to display the current computer room list), one in the main interface (Form1), and one in the history query window (frmhistory); the other two are ListBox, which are in the timed monitoring computer room setting window (fixchkset), named lstall and lstsel.

5 Functional design

5.1 Monitoring Module

The main function of the monitoring module is to send a monitoring signal to the microcontroller, requesting to read the power switch status of a specific computer. The monitoring part can be divided into timed operation and non-timed operation (manual operation) according to the operation mode; according to the number of computers monitored, it can be divided into full monitoring and partial monitoring (the number of computers to be monitored is greater than or equal to 1 and less than the total number of computers in the computer room).

The timed monitoring function is set up to enable the computer room managers to know the switch status of specific computers in time. It allows users to set time intervals and select the computers to be operated to drive a monitoring event at regular intervals, thereby returning the switch status of a specific computer at the current moment. This function not only eliminates the trouble of manual operation, but also improves the real-time performance of the system. Users do not have to observe the status of each computer in front of the computer for a long time. As long as the timed monitoring function is set, the system will automatically monitor at regular intervals, and managers can know the usage of these computers by simply checking the historical records. Timed monitoring actually uses a timer control. When the timer time interval is reached, a monitoring event is triggered.

5.2 Control Module

The function to be realized by the control part is to send an on/off signal to the lower computer, requiring the status of a specific computer to be set to on/off. If the correct feedback signal from the lower computer is received, the icon of the corresponding computer is set to on/off on the interface; if an error is received, an error prompt is given. According to the number of computers to be controlled, it can be divided into two categories: partial control (on/off) and full control (all on/all off). The former controls one or more computers, and the latter controls all computers in the current computer room.

5.3 Settings

5.3.1 Change Password

When the system is started, the administrator is required to enter the correct password before logging in. The password can be changed again after logging in.

5.3.2 Generate report settings

This system provides the function of generating reports on the current status and related data of the computer room. The report format is a text file named after the computer room. Users can choose different report generation methods according to their needs.

5.3.3 Setting the timed monitoring room

In addition to providing the scheduled monitoring function, this system also provides the scheduled monitoring of computer rooms to facilitate managers to automatically monitor the computers in multiple computer rooms at regular intervals.

5.3.4 Generate report settings

This system provides the function of generating reports on the current status and related data of the computer room. The report format is a text file named after the computer room, and users can choose different report generation methods according to their needs.

5.3.5 Timed monitoring room settings

In addition to providing the scheduled monitoring function, this system also provides the scheduled monitoring of computer rooms, so that managers can automatically monitor the computers in multiple computer rooms at regular intervals.

5.3.6 Equipment Room Configuration

This system can dynamically change the interface display according to different computer room configurations. This system provides computer room configuration functions to facilitate administrators to change the configuration of the computer room while the system is running.

5.4 History query management

This system can keep a systematic record of the power on and off time of all computers. As long as each computer goes through the process of power on → power off, its data will be stored in the database. These records help managers manage the computer room and understand the use of computers.

6 System security, reliability and real-time performance

6.1 System Security

There are two ways to log in when the system is running. One is for general users, who log in with the user name guest; the other is for administrators, who log in with the user name administrator. The first login method does not require a login password, but its functions are limited. It can only monitor and monitor the computer room, and cannot perform other operations, nor can it set the system or query historical records; the second login method is for administrators, who need to enter the correct password to log in. After a successful login, all functions of the system can be used, including monitoring, setting and query functions.

When the user tries to log in with other usernames, the system will pop up a prompt box to prompt the user to log in with the guest or administrator username. When the user logs in with the username administrator but enters the wrong password, the system will prompt that the password is wrong and ask the user to re-enter. If the user enters the wrong password three times in a row, the system will be forced to exit. The login password is stored in the psw.txt file in the current path and is simply encrypted. Others can open the text file, but they can see the encrypted characters instead of the original text, so it has a certain degree of security.

6.2 System Reliability

6.2.1 Communication Reliability

This system codes each computer room (computer room code) and uses it as the address code of the lower computer, starting from 01H. When the upper computer communicates with a lower computer, it first sends the address code, and then sends the monitoring command code after the handshake is successful. If the correct response signal of the microcontroller is not received within the specified time or the received signal is not 00H, it will be transferred to error processing.

After the first handshake is successful, the upper computer continues to send the monitoring command code and data length (the number of computers to be monitored + 1, 1 is the checksum frame) to the lower computer. After sending, it waits for the microcontroller to send back the correct response signal 00H. If the correct feedback signal is received within the specified time, the second handshake is successful. Otherwise, it goes to error processing.

After the second handshake is successful, the host computer starts to send the PC address to be monitored and accumulates the checksum. After sending, it sends another checksum frame. Then wait for the microcontroller to send back the correct feedback signal 00H (the third handshake). If the timeout or signal error occurs, it will turn to an error.

After the third handshake is successful, the host computer receives a frame of data from the microcontroller. The value of this frame of data indicates the length of data that the lower computer is about to send to the host computer. The host computer receives the data sent back by the microcontroller and accumulates the checksum. If the reception is correct, it sends a 00H signal to the microcontroller, indicating that the operation is successful.

The above three-way handshake provides higher reliability for the communication between the upper computer and the lower computer.

6.2.2 System Reliability

This system provides a more complete error handling mechanism and rich prompt information, thereby improving the reliability of system operation. For example: input error prompts, including inputting illegal characters in the text box, inputting wrong passwords, etc.

6.3 Real-time performance of the system

When the upper computer communicates with the lower computer, the system defines different timeout limits according to the length of the data to be received to ensure the real-time performance of the system.

7 Conclusion

In this system, the single-chip microcomputer is responsible for collecting the analog switch quantity of the power supply. The host can obtain the monitoring signal collected by the single-chip microcomputer through the monitoring software of the system and display it on the interface. At the same time, the monitoring software can control the switch of multiple computers and send these control signals to the single-chip microcomputer. After the single-chip microcomputer receives these control signals, it can drive the corresponding analog devices, reflect these signals on the hardware and feedback the signals to the host, so that the analog status is displayed on the software interface. The menu structure of the interface of this system is clear, the layout is reasonable, the functions are complete, and the response is real-time; the circuit part is reasonably designed, the chip selection is appropriate, and the debugging is convenient; the communication between the host and the single-chip microcomputer is reliable, and the real-time data collection and transmission order are correct.

References

1 Wang Guorong. Visual Basic 6.0 Practical Lecture. Beijing: People's Posts and Telecommunications Press, 1999

2 Li Yudong, Li Lei (eds.). Visual Basic 6.0 Chinese Edition Control Collection. Beijing: Electronic Industry Press, 2000

3. Hao Chunqiang. New Concept Visual Basic 6 Programming. Beijing: Beijing Kehai Group Corporation, 2001

4 Fan Yizhi. Visual Basic and Distributed Monitoring System. Beijing: Tsinghua University Press, 2002

5 Li Chaoqing. PC and MCU data communication technology. Beijing: Beijing University of Aeronautics and Astronautics Press, 2000

6 Teng Zhaosheng, Luo Longfu, Tong Diaosheng. Intelligent detection system and data fusion. Beijing: Machinery Industry Press, 2000

Reference address:Computer Power Supply Monitoring System in Computer Room Based on VB

Previous article:Design of half-bridge laser power supply based on SG3525
Next article:Power Supply Design FAQs

Recommended ReadingLatest update time:2024-11-16 15:27

A Design of Virtual Digital Filter Based on VB
1. Composition of virtual instruments In terms of components, the virtual instrument system is composed of computers , application software and instrument hardware. Computers and instrument hardware are also called VI's general instrument hardware platform. Virtual instruments based on PC plat
[Test Measurement]
Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号