Abstract: This paper presents a power SCADA simulation system and its implementation method. This system has excellent application prospects and advantages in simulation training for production practice. Keywords: Power system; Data acquisition and monitoring control; Simulation; Communication 1 Introduction With the development of the power industry and the continuous expansion of power grid capacity, large interconnected power grids are rapidly forming. The emergence of large generating units, large interconnected power grids, and ultra-high voltage long-distance transmission lines has placed stricter demands on safe, economical, and high-quality power generation and transmission. Consequently, dispatch automation systems capable of real-time automatic data acquisition and monitoring control (SCADA) of power system operation have emerged. Whether dispatchers can correctly operate and use the SCADA system, comprehensively and accurately grasp the operating status of the power system, analyze the operating status with the assistance of the SCADA system, make correct judgments and decisions, and take necessary measures to promptly handle accidents and abnormal situations is of great significance to ensuring the safe, economical, and reliable operation of the power system. However, in actual production, because it is directly connected to production equipment, dispatchers rarely have the opportunity to have a comprehensive understanding of the various operations and operating conditions of the SCADA system. This is extremely detrimental to fully utilizing the effectiveness of the SCADA system and improving the quality of dispatchers. Therefore, we present a power SCADA simulation system and its implementation method to simulate various functions of power SCADA, thereby providing simulation training for dispatchers or university students majoring in electrical engineering. This allows them to master the necessary skills and technical competence before entering production practice. This is highly beneficial for shortening the personnel's technical accumulation cycle, improving production efficiency, and ensuring the safe operation of the system. During the development of this simulation system, we received strong support from relevant personnel of the Water and Power Supply Department of the Tuha Petroleum Exploration and Development Headquarters. It has been built and tested in our professional laboratory for several years, and students have given positive feedback on its effectiveness. 2 System Structure The structure of the entire simulation system is shown in Figure 1. In Figure 1, S1 and S2 are the simulation station equipment, providing station information to the SCADA simulation system; RTU1 and RTU2 are two station terminals; TD1 and TD2 are the communication channels for information transmission; DC is the dispatch center computer system of the SCADA simulation system, composed of multiple microcomputers, as shown in Figure 2. In Figure 2, FCOM is the front-end communication workstation; RTC is the real-time monitoring workstation; HWM is the historical data management workstation; EMS is the energy management workstation; RTNET is the microcomputer real-time network; and RTSV is the real-time server. Considering the economic efficiency of the simulation system, redundant servers and front-end communication workstations are unnecessary. The communication channel uses a shielded four-core communication cable, with modems connected to both ends to enable long-distance information transmission and improve anti-interference capabilities. RTNET uses BNC connectors to connect all computers in the dispatch center into a real-time network using thin cables. Furthermore, since the simulation system cannot be connected to the actual equipment at the plant, information at the plant end is also provided using simulation methods. Switches are used on the simulation information platform to simulate the opening and closing of the plant's circuit breakers to provide remote signaling information; the on/off state of lights is used to simulate remote control information, thereby simulating the operation of the plant's circuit breakers; adjustable inductive loads are used to provide simulation of remote measurements; and DC meters are used to simulate the results of remote adjustment. 3. Simulation System Development 3.1 RTU Development The RTU uses an Intel Pentium 100 host and connects to the plant information simulation console through four functional modules: telemetry, remote signaling, remote control, and remote adjustment, to complete the corresponding functions. It uses the Ministry-issued CDT protocol to communicate with the front-end workstation of the dispatch center. The three key aspects of the real-time communication software design are shown in Figure 3. The flowchart for serial communication port initialization is shown in Figure 4. The communication rate can be set to 600 b/s. Except for the synchronization word, all word structures use (48,40) code, and the synchronization word consists of three groups of EB90. The check bit is calculated algebraically based on the code value of the 40 information bits and the generator polynomial g(x) = x⁸ x² x 1. Since the protocol specifies a check code with a co-base, each bit must be inverted once. The organization format of each information word conforms to the CDT protocol. Communication is carried out using interrupt mode. For interrupt type N, the offset and segment base address of the interrupt service handler are IP≤(4*N,4*N 1), CS≤(4*N 2,4*N 3). The 80x86 series PC specifies that the communication adapter COM1 uses interrupt IRQ4 (N=12) and COM2 uses interrupt IRQ3 (N=11). Therefore, the interrupt vector can be set according to the formula for calculating IP and CS. The corresponding interrupt service routine can be written according to the flowchart shown in Figure 5. The sending character processing is to assemble the text to be sent according to the CDT protocol and then send it. The receiving character processing is to analyze the received information according to the CDT protocol, thereby starting the corresponding execution mechanism or setting the return information and calling the sending character processing program to assemble and send the return information. 3.2 Development of the dispatch center computer system All workstation programs are developed using Delphi on the Windows 98 platform. (1) Development of the front-end communication workstation The front-end part is the hub for information exchange between the dispatch center and RTU, and its real-time performance is high. Therefore, the Windows 98 thread-based multitasking technology is fully utilized, arranging the various functional modules of the front-end into multiple threads. Each thread completes one task. Since multiple threads share the same process address space, they can share the same memory buffer, which greatly improves the efficiency of data exchange. Furthermore, because multiple threads are completely encapsulated within a single process, the difficulty of use and maintenance is reduced. The collaborative work between threads uses the "event" method provided by Windows for thread synchronization, thus balancing system real-time performance and efficiency. After development, the front-end has the following real-time data processing functions: ① RTU communication: Through the RS232 interface from the modem, it connects to a serial port of the front-end machine via a multi-serial port expansion card. Communication between the front-end machine and the RTU can be performed by reading and writing to the serial port. This function fully utilizes the Windows message mechanism, implemented by calling Windows serial communication API functions through Delphi. Similarly, to improve system real-time performance, custom messages are sent directly to the specified window using PostMessage() without going through the message queue. ② Protocol conversion: Converts the CDT format data packets uploaded by the RTU into real-time data for the SCADA system. The commands sent by the workstation to the RTU are converted into command messages in CDT protocol format. ③ Network command listening listens for command sending requests from other nodes on the real-time network and executes various control commands. ④ Network data exchange forwards the real-time data after protocol conversion to the virtual disk of the network real-time server RTSV. (2) The RTSV development simulation system adopts a real-time network with a bus structure of 10 Mb transmission rate. RTSV is a network server, and its C and D drives can be shared with other workstations. The subdirectory C:\AA on the C drive of RTSV is used as I:\AA on each workstation, and the subdirectory D:\SS on the D drive is used as H:\SS on each workstation. At the same time, RTSV is also responsible for synchronizing the clocks of each workstation. Real-time management is a more important software system on RTSV. It exchanges real-time data with the front-end machine through the virtual disk and establishes and provides a real-time database on the virtual disk. In this way, other workstations can call the shared real-time database through the memory file. This virtual disk data exchange method uses computer memory to exchange data, so it is very fast and helps to improve the real-time performance of the entire simulation system. In addition, the real-time management system also provides online coefficient maintenance function for real-time data and is responsible for transferring real-time data to the historical database under the C:\DATA directory at every hour, thus forming the historical data of the simulation system. In this way, other workstations can complete the corresponding management functions by extracting the historical data under I:\DATA. (3) Development of real-time monitoring workstation In order to enable dispatchers to accurately and intuitively understand the current operating status of the power grid, the real-time monitoring main interface adopts the main wiring diagram method, and displays the telemetry values near the symbols of each major equipment (the over-limit of the telemetry value is distinguished by a different and conspicuous color from the normal value), and fills the circuit breaker symbol with color or hollow to indicate its open or closed status, thus intuitively showing the remote signaling information. The telemetry and remote signaling values are obtained by reading the corresponding field values of the real-time database. The telemetry value is updated in 3 to 6 seconds, and the remote signaling information is processed first. Dispatchers can remotely control and adjust the system through the monitoring interface. After selecting the remote control or adjustment object, the command is broadcast to the network. After being listened to by the front-end machine, it is sent to the RTU according to the CDT protocol and the return information is sent back. The real-time monitoring software detects the return information and displays it to the dispatcher for confirmation. Only after confirmation is the command executed by the RTU, which improves the reliability of the system. (4) Development of the historical data management workstation In the SCADA system, historical data management is an important management tool. The program of this workstation is divided into two parts: front-end and back-end. In the back-end, the data under I:\DATA is filtered, processed and statistically calculated and stored in a two-dimensional relational database according to the pre-designed data structure. In the front-end, the statistical query of monitoring data and switch position changes, the addition, deletion and printing of reports, the modification of the quantity, name and other characteristics of the detection quantity, and the updating of the database at the beginning and end of the month are completed through the display screen and human-computer interaction. (5) Development of the energy management workstation Energy management is an important technical measure for verifying the safe and economical operation of the power system. The energy management software first retrieves the relevant data from the real-time database to the local machine. Then, using graphical technology, the power statistics, load curves, load factor, and voltage curves are visually plotted, providing dispatchers with intuitive statistical analysis data. 4. Conclusion This simulation system organically combines computer technology, communication technology, and control technology. Based on the characteristics of the power system, it has developed the essential functions required for a power SCADA system, exhibiting high real-time performance and reliability. After development, it has been tested in our professional laboratory for several years. According to feedback from graduates who have used the system, the simulation system has excellent consistency with the SCADA system used in actual production, enabling them to quickly become competent in dispatching work after entering production positions. The system's role in personnel training has also been praised and recognized by relevant personnel at the Tuha Oilfield Water and Power Supply Department. Therefore, this simulation system has excellent application prospects and advantages in simulation training for production practice.