Background technology
The interconnected scale of current China electrical network constantly enlarges, and national Da Qu networks gradually, and market-orientedization of electricity transaction causes that operational mode is changeable, and these complex electric network situations all require us to set up and the similar l-G simulation test environment of actual electric network.If simulation process and electric power system actual moving process are synchronous, be called real-time simulation, electric power system actual device (as protective relaying device, field regulator etc.) can be inserted analogue system this moment and carry out closed test,, provide reference for device inserts actual electric network with the operation characteristic of checkout gear; Faster than the electric power system actual moving process, be called faster than real time simulation as simulation process, but the analogue system anticipatory analysis had the accident that practical power systems may occur this moment, and then can take measures to avoid accident to take place or the minimizing causality loss.Therefore, realize electric power system in real time and faster than real time simulation the guarantee power network safety operation is had significance.In recent years, development and improvement of computer science along with cheap PC group, parallel computing has obtained extensive use (adopting parallel calculating method to improve the speed that electric power system tide calculates as patent CN1641957) in electrical network analysis calculates, real-time and the faster than real time simulation that realizes large-scale electrical power system has possessed basic condition, can adopt the parallel artificial technology that big electric power networks is divided into some subnets, distribute to the different node machine of a group of planes as the subnet machine, select a node machine as main control computer again, to realize parallel computation and then to significantly improve computational speed.At present, based on the Linux platform, in the subnetting parallel artificial that 10000 node level scale electric power system electromechanical transients-electro-magnetic transient is mixed, adopt MPI multiple programming model and Myrinet network can realize faster than real time simulation, the calculating of 10 seconds 7.71 seconds dynamic process times spent finishes, wherein the electromechanical transient simulation step-length is 10ms, and the electromagnetic transient simulation step-length is 50us.
In Simulation Application, cheap hardware PC group system, (SuSE) Linux OS, MPICH parallel Programming running environment and Myrinet express network have constituted real-time parallel simulation calculation platform jointly.But because (SuSE) Linux OS itself is a time-sharing system, its dispatching algorithm, the system call that can not interrupt, interruption masking, the use of device drives and virtual memory, cause the system time unpredictability, although adopt parallel computation can guarantee that overall simulation process equals or faster than the actual physics process, but the simulation process that can not guarantee each step all accurately equals or faster than the actual physics process, the non real-time characteristic of linux system itself can cause other time jitter of simulation step length Millisecond, the time jitter that single step-length is brought has influenced the emulation of follow-up all step-lengths, so be difficult to realize the dynamic hard real-time simulation process in the strict step-length time (the electromagnetic transient simulation representative value is 50us), thus can not guarantee real-time simulation strict with system operation time synchronously in addition super real-time be that big power grid accident carries out computational analysis and also and then for the electrical network prevention and control races against time.
Summary of the invention
In order to solve the problems of the technologies described above, the present invention is on the basis of introducing real time operating system RTLinux, handle by MPICH and GM program being carried out real time implementation, a kind of method that makes up real-time parallel simulation calculation platform is provided, provide the real-time parallel estimated performance thereby use for the upper strata grid simulation.MPICH is a kind of most important realization of MPI (Message Passing Interface, message passing interface) standard, and MPI transmits the industrial standard that API works out for the message of the different MPP business men of unification.GM (Glenn ' s Message) be the user's attitude communication protocol that is applicable to the Myrinet network.
According to an aspect of the present invention, the invention discloses a kind of construction method of the grid simulation real-time parallel computing system based on MPI, described system is used to set up the Mathematical Modeling of each element of electric power system, the Mathematical Modeling of the whole network is divided into the plurality of sub pessimistic concurrency control according to algorithm, and the group of planes MPI message passing mechanism by the Myrinet network, main controlled node is assigned to the subnet model on the group of planes computing node and calculates; It is characterized in that, described method is introduced real time operating system RTLinux in described system, described system is carried out real time implementation to be handled, set up the upper strata grid simulation computing application module handled through real time implementation, MPICH module and GM module in real time in real time, thereby provide the real-time parallel estimated performance for system; Wherein, described upper strata grid simulation computing application module is that particular user is used, and it finishes data and distribution and the calculating of calculation procedure between group of planes computing node by the MPI function interface; Described real-time MPICH module is handled by traditional MPICH being carried out real time implementation, is used to provide a kind of between a plurality of processes of same node or the real-time communication mechanism between a plurality of processes of different node; Described real-time GM module comprises GM function library GM Library, driver GM Driver and Myrinet control program GM MCP three parts, and the GM module can be intercepted and captured the real-time interrupt of Myrinet hardware in real time, and is responsible for receiving and handling this hardware real-time interrupt.
Wherein, real time implementation to upper strata grid simulation computing application module, MPICH, GM Library is to realize real time access at user's space; it adopts RTLinux PSDD real-time protection thread mode with the real-time correspondence department of upper strata grid simulation computing application module, MPICH, the GM Library real-time thread that is placed in, and preferentially calls the assurance hard real-time under the control of RTLinux Real-Time Scheduling device.
Described real time implementation to the imitative true computing application module of electrical network in upper strata, MPICH, GM Library is handled and specifically be may further comprise the steps:
(a) to use mlockall (MCL_CURRENT|MCL_FUTURE) function locking process memory headroom during the real-time program application initializes, and, the user carries out preassignment for using internal memory, in follow-up internal memory operation, use storage allocation as far as possible, enlarge the program stack space by rtl_growstack (stacksize);
(b) realize at function on the real-time function call path and subfunction thereof, avoid occurring memory allocation function and linux system call function, can not use some may change the libc function of memory mapping area.
Wherein, GM Driver is carried out the real time implementation processing adopt the real-time kernel programming mode to carry out, during operation it is loaded in the RTLinux kernel, the concrete steps that real time implementation is handled are as follows:
(a) the linux system call function of GM Driver program replaces to real-time built-in function;
(b) GM MCP is after driver GD Driver initialization and be loaded into the SRAM area operation of Myrinet network interface card;
(c) use the real-time interrupt Accreditation System that the Myrinet hardware interrupts is registered as real-time interrupt;
(d) will change back GM Driver program code and correctly compile and be linked to the real-time storehouse of RTLinux after, just can be in being loaded into real-time kernel so that GM Driver provides real time access and response for GM LibraryAPI.
According to a further aspect in the invention, the invention discloses the constructed grid simulation real-time parallel computing system of the above-mentioned construction method of a kind of usefulness based on MPI.
The invention has the beneficial effects as follows: adopt technical scheme of the present invention, can be large-scale electrical power system provides the real-time parallel simulation calculation of strict step-length, reduced step-length time jitter number of times and amplitude, assurance can be to the super real-time and hard real-time dynamic simulation of electric power system.
Embodiment
Be elaborated below in conjunction with accompanying drawing.In the following description,, set forth specific details in order to explain rather than to limit, for example specific structure, framework, interface, technology etc. are so that provide a detailed understanding to the various aspects of the invention of asking for protection.Yet, benefit from content disclosed in this invention, the various aspects that the present invention asks for protection can realize that according to other modes different with these specific detail this is conspicuous for one of ordinary skill in the art.In some instances, omitted description, made the description of present invention become obscure to avoid unnecessary details to known equipment, circuit and method.
In the present invention, we are on the basis of introducing hard real-time operating system RTLinux, to the platform software on the (SuSE) Linux OS, for example MPICH concurrent software, GM software etc. carry out the real time implementation processing, thereby the basic parallel computing platform and the application of hard real-time can be provided for the grid simulation computing application.
Hard real-time operating system RTLinux is a kind of hard real-time operating system based on Linux, and it has increased virtual level between linux kernel and hardware, thereby has constructed a real-time kernel of distinguishing mutually with linux kernel.RTLinux has realized the Real-Time Scheduling core that can try to be the first efficiently simultaneously, takes over comprehensively and interrupts, and can move real-time task thereon.And the MPI simulation calculation is exactly to set up the Mathematical Modeling of each element of electric power system, the Mathematical Modeling of the whole network is divided into the plurality of sub pessimistic concurrency control according to algorithm, and utilize the group of planes MPI message passing mechanism of Myrinet network, main controlled node is assigned to the subnet model on the group of planes computing node and calculates, so main controlled node and computing node will guarantee to calculate in real time and communication.
Based on above analysis, by the introducing of hard real-time operating system RTLinux, can provide complete real-time solution for digital grid simulation parallel computing platform, remedied the defective of linux system aspect real-time.The patent part will introduce the implementation method based on the MPI simulation real-time parallel computing platform.
To introduce architecture of the present invention below in detail and realize details.
1. architecture
Grid simulation real-time parallel computing platform based on MPI mainly comprises real-time MPICH, real-time two modules of GM, and concrete structure as shown in Figure 2.Wherein the simulation calculation program on real-time parallel computing platform upper strata is that particular user is used, and it finishes data and distribution and the calculating of calculation procedure between cluster nodes by the MPI function interface.In real time the MPICH module is by carrying out the transformation of real time implementation to traditional MPICH, provides a kind of between a plurality of processes of same node or the real-time communication mechanism between a plurality of processes of different node.The GM module mainly comprises GM function library (GM Library), driver (GM Driver) and Myrinet control program (GM MCP) three parts in real time.In the time of system initialization, the GM module has been registered real-time interrupt by the Myrinet Real Time Drive in real time.GM drives and intercepts and captures internodal request of data by hardware interrupts in real time, and judges whether this interruption belongs to real-time interrupt, if real-time interrupt just is responsible for receiving, handling this request of data by the GM Real Time Drive.
2. function and assembly real time implementation
In order to realize the MPI simulation real-time parallel computing platform, must take different programming mode (real-time kernel programming mode and PSDD programming mode) to carry out real time implementation with assembly to numerous program parts such as the interrupt system of traditional MPICH and GM system, initialize process, call functions and handle.
2.1 real-time kernel programming mode
At the GM driver section in the GM system, GM Driver function comprises and loading and initialization MCP, and the region of memory and the register mappings of network interface arrived client layer etc.Consider the limitation of user's space driver, GM Driver adopts the real-time kernel programming mode, during operation it is loaded in the RTLinux kernel.The real time implementation process is as follows:
(a) the linux system call function with GM Driver program replaces to real-time built-in function, rtl_open for example, rtl_close, rtl_read, rtl_write, functions such as rtl_ioctl.
(b) GM MCP is after driver GD Driver initialization and be loaded into the SRAM area operation of Myrinet network interface card;
(c) use the real-time interrupt Accreditation System that the Myrinet hardware interrupts is registered as real-time interrupt.In the RTLinux system, when the GM Real Time Drive is loaded, the interrupt service subroutine of invocation facility driver in the RTLinux interrupt vector table, and will revise kernel resource symbol table, service that this module provided and resource just receive hardware interrupts by the RTlinux system, again by the system call Interrupt Service Routine.
Use real-time interrupt can obtain the packet that arrives on the hardware apace.When data reached, system can produce real-time interrupt, by quick IE DMA hardware device data was copied to the Installed System Memory from Myrinet hardware in the real-time system.
(d) will change back GM Driver program code and correctly compile and be linked to the real-time storehouse of RTLinux after, just can be in being loaded into real-time kernel so that GM Driver provides real time access and response for GM Library API.
2.2PSDD programming mode
Simulation calculation program on the platform, MPICH and GM Library realize real time access at user's space, and it adopts the PSDD pattern with the real-time correspondence department real-time thread that is placed in, and preferentially calls the assurance hard real-time under the control of Real-Time Scheduling device.The real time implementation process is as follows:
(a) during initialization, real-time system is distributed real-time in advance, use mlockall (MCL_CURRENT|MCL_FUTURE) function locking process memory headroom, and, the user carries out preassignment for using internal memory, in follow-up internal memory operation, use storage allocation as far as possible, also will enlarge the program stack space by rtl_growstack (stacksize).
(b) function on the real-time function call path and subfunction thereof realize among computing application program, MPICH, the GM Library, avoid malloc (), free memory allocation function such as () and fork (), exec (), popen (), system system calls such as () function, can not use some may change the libc function of memory mapping area.
(c) the real-time function in the calculation procedure is inserted the RTLinux real-time thread and handle in the function, real-time utility function calls the MPI function after the real time implementation downwards.
The real-time MPI function that this patent is realized according to above-mentioned execution mode comprises: MPI_COMM_RANK, MPI_COMM _ SIZE, MPI_Comm_group, MPI_RECV, MPI_SEND, MPI_SENDRECV, MPI_ALLGATHERE, MPI_ALLGATHERV, MPI_SCATTER, MPI_BARRIER, MPI_BCAST, MPI_Allreduce etc.
3. test
In order to verify the real-time of using that said method makes up based on the grid simulation real-time parallel computing platform of MPI, make up the test environment of one 3 node, concrete configuration is as shown in table 1.
The tabulation of table 1 test environment
Method of testing adopts the MPI of test circumference ratio to calculate, and wherein time performance test period of node 1 is the root process operation of a circumference ratio of test, and time performance test period of node 2 and node 3 is the non-root processes operation of a circumference ratio of test.(process0, process1 process2) picked up counting after synchronously, and were a time-count cycle after corresponding MPI operation is finished from three processes during length gauge time cycle.Time-count cycle, testing time was 10000 times.Test result such as Fig. 3~shown in Figure 8.
Find through test, compare with Linux MPICH-GM that the average communication performance of carrying out the parallel artificial computing platform improves about 10% approximately, maximal jitter amplitude can reduce by 50%~80%.All real time implementation MPI communications are in identical test loop number of times, and the number of times of shake has significantly degradation, and the time jitter amplitude reduction in the MPI of all real time implementations communication and controlled, satisfy the hard real-time demand that MPI uses in real time.
Invention has been described according to specific exemplary embodiment herein.It will be conspicuous carrying out suitable replacement to one skilled in the art or revise under not departing from the scope of the present invention.Exemplary embodiment only is illustrative, rather than to the restriction of scope of the present invention, scope of the present invention is by appended claim definition.