CN112016199A - Power system modular modeling method and simulation method based on PSCAD - Google Patents
Power system modular modeling method and simulation method based on PSCAD Download PDFInfo
- Publication number
- CN112016199A CN112016199A CN202010858813.XA CN202010858813A CN112016199A CN 112016199 A CN112016199 A CN 112016199A CN 202010858813 A CN202010858813 A CN 202010858813A CN 112016199 A CN112016199 A CN 112016199A
- Authority
- CN
- China
- Prior art keywords
- elem
- function
- type
- power system
- pscad
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000004088 simulation Methods 0.000 title claims abstract description 21
- 101100499229 Mus musculus Dhrsx gene Proteins 0.000 title claims abstract 14
- 238000013507 mapping Methods 0.000 claims abstract description 30
- 230000003068 static effect Effects 0.000 claims abstract description 9
- 230000006870 function Effects 0.000 claims description 98
- 238000004590 computer program Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 claims description 3
- 238000013461 design Methods 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011960 computer-aided design Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 238000013439 planning Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Supply And Distribution Of Alternating Current (AREA)
Abstract
The invention discloses a PSCAD-based power system modular modeling method and a simulation method, which belong to the field of power system circuit design and simulation and comprise the following steps: creating corresponding custom elements for each element in the power system in the PSCAD, and establishing a connection relation between the custom elements; defining input parameters elem _ type and elem _ num for each custom element, wherein the input parameters elem _ type and elem _ num are respectively used for storing a type and a unique number; writing a function for each type of self-defined element; associating the source file where the user-defined element is located with the functional function source file according to the type; writing a distribution mapping function for each definition element, and defining a script for calling the distribution mapping function; and the distribution mapping function is used for calling the function according to the elem _ type and transferring the static structure variable associated with the custom element according to the elem _ num. The invention effectively solves the problems of repeated programming and code un-reusability existing in independent calling by adding the distribution mapping layer and calling the function of the element according to the element type.
Description
Technical Field
The invention belongs to the field of circuit design and simulation of an electric power system, and particularly relates to a PSCAD-based electric power system modular modeling method and a simulation method.
Background
The electric power system is a large-scale time-varying complex system and plays a very important role in national economy, and the digital simulation of the electric power system becomes an important means for research, planning and design of the electric power system. Therefore, the functional characteristics of the simulation software of the power system have important significance for improving the efficiency and the credibility of research and design.
PSCAD (Power System Computer Aided design) is a powerful and flexible graphical user interface that interfaces with the EMTDC electromagnetic transient simulation engine, allowing users to graphically build circuits, run simulation and analysis results, and manage data in a fully integrated graphical environment. PSCAD provides finished, programmed and tested simulation models, ranging from simple passive components and control functions, to more complex models such as motors, complete FACTS equipment, power lines, and cables. PSCAD provides a user model building method to facilitate the user to create the model that he or she needs, the so-called user-defined element. PSCAD provides three languages of Fortran, C and Matlab to program the user with the function of the customized element. The C language can better give consideration to the performance and the development difficulty of the program, and is widely used in the programming of the user-defined element.
In a conventional modeling method, in order to avoid memory call conflicts of a custom element, an independent call method is usually adopted between the custom element and a function, that is, one user custom element corresponds to one function. According to the requirements of engineering application, a batch of functions with different names but consistent content and implementation functions are created for each type of custom element, and data sources and return objects are identified through one-to-one correspondence between element names and function names, as shown in fig. 1.
The problem of memory calling conflict is solved by completely isolating codes and memory addresses through independent calling, and when a certain type of self-defined elements need to be repeatedly used in a project, the method is complicated in programming and low in working efficiency, and accordingly modeling and simulation efficiency of the power system can be influenced. When an instance of a custom component type needs to be added, a complete function code needs to be copied and the function name needs to be modified, which does not meet the design requirements of componentization and modularization.
Disclosure of Invention
Aiming at the defects and improvement requirements of the prior art, the invention provides a PSCAD-based power system modular modeling method, aiming at solving the technical problem of low modeling efficiency caused by repeated programming and code non-reusability of the traditional method for modeling a power system in PSCAD.
To achieve the above object, according to one aspect of the present invention, there is provided a power system modular modeling method based on PSCAD, including:
establishing corresponding custom elements for each element in the power system in the PSCAD, and establishing a connection relation between the custom elements by using a connecting line element;
defining input parameters elem _ type and elem _ num for each custom element, wherein the input parameters elem _ type and elem _ num are respectively used for storing the type and the unique number of the custom element;
respectively writing corresponding function functions for each type of self-defined elements; according to the type of the self-defined element, associating a source File where the self-defined element is located with a source File storing a corresponding function by using a File Reference element; the function is used for executing a corresponding function according to the input data input _ data of the user-defined element to obtain output data output _ data of the user-defined element;
writing a distribution mapping function for each defined element, and defining a script for calling the distribution mapping function for each defined element so as to obtain a simulation model of the power system;
the distribution mapping function takes an input parameter elem _ type, an input parameter elem _ num, input data input _ data and output data output _ data of a user-defined element as function parameters, and each function parameter is transmitted by a script; the distribution mapping function is used for calling a corresponding function according to the input parameter elem _ type, and in the process of calling the function, a static structure variable related to the user-defined element is transferred according to the input parameter elem _ num; and the static structure body variables correspond to the custom elements one by one and are used for storing variable information required by the execution of the corresponding function.
Further, the script for calling the distribution mapping function is a Fortran script.
Further, if the function of the custom element does not depend on variable information other than the input parameter elem _ type and the input parameter elem _ num, the Fortran script is defined as follows:
call dispatch($elem_type,$elem_num,$input_data,$output_data);
if the function of the custom element depends on other variable information besides the input parameter elem _ type and the input parameter elem _ num, the Fortran script is defined as follows:
call dispatch($elem_type,$elem_num,$var1,…,$varn,$input_data,$output_data);
wherein call represents a subprogram calling statement, dispatch represents a distribution mapping function, var 1-varn are variables except an input parameter elem _ type and an input parameter elem _ num which are depended by a function of a user-defined element, and n is more than or equal to 1.
Further, the variables var 1-varn are each defined in the Paramerters tab.
Further, the Fortran Script is defined in the Script tab.
Further, the input Parameters elem _ type and elem _ num are defined in Parameters tabs.
Further, the function is written in Fortran, C or Matlab languages.
Further, the power system modular modeling method based on PSCAD provided by the invention further comprises the following steps: the association of the functional function source code and the custom element is realized through the Library file, and the custom element and the functional function thereof are packaged into the element Library.
According to another aspect of the present invention, there is provided a power system simulation method, including: the simulation model is established by the PSCAD-based power system modular modeling method, and the power system is simulated.
According to yet another aspect of the present invention, there is provided a computer readable storage medium comprising a stored computer program, wherein the computer program, when executed by a processor, controls an apparatus on which the computer readable storage medium is located to perform the method for modular modeling of a PSCAD-based power system provided by the present invention and/or the method for simulating a power system provided by the present invention.
Generally, by the above technical solution conceived by the present invention, the following beneficial effects can be obtained:
(1) the invention adds a distribution mapping layer between the self-defined element and the function by utilizing the distribution mapping function, and calls the corresponding function according to the element type, therefore, the invention only needs to write and store one function code for each type of self-defined element; in the invention, when the distribution mapping function calls the corresponding function, the static structure body variable corresponding to the element instance is transferred, so that the function of each defined element only operates each private variable, and the memory call conflict is avoided. Generally, by adding a distribution mapping layer between the user-defined element and the function and calling the function of the element according to the element type, the problems of repeated programming and unreusable codes existing in independent calling are effectively solved.
(2) The invention realizes the association of the functional function source code and the user-defined element through the Library file, packages the user-defined element and the functional function thereof into the element Library, and the element Library and the native element Library have the same use mode.
Drawings
FIG. 1 is a diagram of a conventional independent call relationship;
fig. 2 is a diagram of a distribution mapping call relation provided in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
In the present application, the terms "first," "second," and the like (if any) in the description and the drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
In order to effectively solve the technical problem of low modeling efficiency caused by repeated programming and code non-reusability of the conventional independent calling mode in the PSCAD, the invention provides a PSCAD-based power system modular modeling method and a simulation method, and the overall thought of the PSCAD-based power system modular modeling method is as follows: a distribution mapping layer is added between a self-defined element and a function, a processing function of the element is called according to the element type, and meanwhile, static structure body variables which correspond to element instances one to one are used for ensuring that a plurality of different instances in the same element type use the same function, but respective private variables are operated, so that memory calling conflict is avoided.
The following are embodiments, and in the following embodiments, all the functional functions are written based on C language without loss of generality.
Example 1:
a PSCAD-based power system modular modeling method comprises the following steps:
creating a corresponding custom element (Component) for each element in the power system in the PSCAD, and establishing a connection relation between the custom elements by using the connection line element; the connection relation between the self-defined elements is consistent with the connection relation between actual physical elements in the power system, input data input _ data of the self-defined elements are input through input ports of the self-defined elements, and output data output _ data of the self-defined elements are output through output ports of the self-defined elements; in this embodiment, two types of custom elements are specifically created and respectively marked as element a and element B, and each type of element respectively creates two custom element instances which are respectively marked as element a-instance 1, element a-instance 2, element B-instance 1, and element B-instance 2;
defining input parameters elem _ type and elem _ num for each custom element, wherein the input parameters elem _ type and elem _ num are respectively used for storing the type and the unique number of the custom element; specifically, the input Parameters elem _ type and elem _ num are defined in Parameters tabs;
writing corresponding function functions for each type of self-defined element by using a C language, wherein in the embodiment, the function functions of the element A and the element B are func _ a and func _ B respectively; according to the type of the self-defined element, associating a source File where the self-defined element is located with a source File storing a corresponding function by using a File Reference element; the function is used for executing a corresponding function according to the input data input _ data of the user-defined element to obtain output data output _ data of the user-defined element;
writing a distribution mapping function for each defined element, and defining a script for calling the distribution mapping function for each defined element so as to obtain a simulation model of the power system;
the distribution mapping function takes an input parameter elem _ type, an input parameter elem _ num, input data input _ data and output data output _ data of a user-defined element as function parameters, and each function parameter is transmitted by a script; the distribution mapping function is used for calling a corresponding function according to the input parameter elem _ type, and as shown in fig. 2, in the process of calling the function, a static structure variable associated with the custom element is transferred according to the input parameter elem _ num; the static structure body variables correspond to the custom elements one by one and are used for storing variable information required by the execution of the corresponding function;
in this embodiment, the function functions of the element a and the element B do not depend on variable information other than the input parameter elem _ type and the input parameter elem _ num, and the Script for calling the distribution mapping function is a Fortran Script, which is defined in a Script tab and is defined as follows:
call dispatch($elem_type,$elem_num,$input_data,$output_data);
wherein call represents a subprogram calling statement, dispatch represents a distribution mapping function, and $representsan address character; the method has the advantages that the script for calling the distribution mapping function is compiled by using the Fortran language, so that the realization is simple, and the modeling efficiency is improved; it should be noted that the Fortran script is only a preferred embodiment of the present invention, and in some other embodiments of the present invention, the script may be written in other manners;
in some other embodiments of the present invention, the function of the custom element may also depend on the input parameter elem _ type and other variable information besides the input parameter elem _ num, for example, also depend on the name of the custom element, and then the variable elem _ name may be defined in the Parameters tab for storing the name of the custom element, and the corresponding Fortran script is defined as follows:
call dispatch($elem_type,$elem_num,$elem_name,$input_data,$output_data);
for the convenience of subsequent use, the present embodiment further includes: the method comprises the steps of realizing the association of a function source code and a custom element through a Library (. lib) file, and packaging the custom element and the function thereof into a component Library;
the component library constructed by the embodiment has the same use mode as the native component library.
Comparing fig. 1 and fig. 2, in the conventional independent call mode, four function functions need to be written for four component instances, namely, component a-instance 1, component a-instance 2, component B-instance 1, and component B-instance 2; in the embodiment, by adding a distribution mapping function between the custom component instance and the function, only 2 function functions need to be written for four component instances, namely, component a-instance 1, component a-instance 2, component B-instance 1, and component B-instance 2. This distinction will be more apparent as the number of instances of elements under the same class of elements increases. Therefore, the problems of repeated programming and unreusable codes existing in independent calling can be effectively solved, and therefore the modeling efficiency of the power system can be effectively improved.
Example 2:
a power system simulation method, comprising: the simulation model established by the power system modular modeling method based on the PSCAD provided in the above embodiment 1 is used to simulate the power system.
Example 3:
a computer-readable storage medium comprising a stored computer program, wherein when the computer program is executed by a processor, the computer-readable storage medium controls an apparatus to perform the method for modeling power system modularization based on PSCAD provided in embodiment 1 above and/or the method for simulating power system provided in embodiment 2 above.
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and that any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (10)
1. A PSCAD-based power system modular modeling method is characterized by comprising the following steps:
creating corresponding custom elements for each element in the power system in the PSCAD, and establishing a connection relation between the custom elements by using a connecting line element;
defining input parameters elem _ type and elem _ num for each custom element, wherein the input parameters elem _ type and elem _ num are respectively used for storing the type and the unique number of the custom element;
respectively writing corresponding function functions for each type of self-defined elements; according to the type of the self-defined element, associating a source File where the self-defined element is located with a source File storing a corresponding function by using a File Reference element; the function is used for executing a corresponding function according to the input data input _ data of the user-defined element to obtain the output data output _ data of the user-defined element;
writing a distribution mapping function for each defined element, and defining a script for calling the distribution mapping function for each defined element so as to obtain a simulation model of the power system;
the distribution mapping function takes an input parameter elem _ type, an input parameter elem _ num, input data input _ data and output data output _ data of a user-defined element as function parameters, and each function parameter is transmitted by the script; the distribution mapping function is used for calling a corresponding function according to the input parameter elem _ type, and in the process of calling the function, a static structure variable related to a custom element is transferred according to the input parameter elem _ num; and the static structure body variables correspond to the custom elements one by one and are used for storing variable information required by the execution of the corresponding function.
2. The PSCAD-based modular modeling method for an electric power system as recited in claim 1, wherein the script for calling said distribution mapping function is a Fortran script.
3. The PSCAD-based modular modeling method for electric power systems as recited in claim 2, wherein if the function of the custom element does not depend on variable information other than the input parameter elem _ type and the input parameter elem _ num, the Fortran script is defined as follows:
call dispatch($elem_type,$elem_num,$input_data,$output_data);
if the function of the custom element depends on other variable information besides the input parameter elem _ type and the input parameter elem _ num, the Fortran script is defined as follows:
call dispatch($elem_type,$elem_num,$var1,…,$varn,
$input_data,$output_data);
wherein call represents a subprogram calling statement, dispatch represents a distribution mapping function, var 1-varn are variables except an input parameter elem _ type and an input parameter elem _ num which are depended by a function of a user-defined element, and n is more than or equal to 1.
4. The PSCAD-based modular modeling method for an electric power system of claim 3, wherein said Fortran Script is defined in Script tab.
5. The PSCAD-based modular modeling method for electric power systems as recited in claim 3, wherein variables var 1-varn are each defined in Paramerters tabs.
6. The PSCAD-based modular modeling method for electric power systems as recited in claim 1, wherein said input Parameters elem _ type and elem _ num are defined in Parameters tabs.
7. The PSCAD-based power system modular modeling method of claim 1, wherein said functional function is written in Fortran, C or Matlab language.
8. The PSCAD-based modular modeling method for electric power systems as recited in any of claims 1-7, further comprising: the association of the functional function source code and the custom element is realized through the Library file, and the custom element and the functional function thereof are packaged into the element Library.
9. A method for power system simulation, comprising: simulating the power system by using a simulation model established by the PSCAD-based modular modeling method for the power system as recited in any one of claims 1 to 8.
10. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when executed by a processor, controls an apparatus on which the computer-readable storage medium is located to perform the method for modular modeling of a PSCAD-based power system according to any of claims 1-8, and/or the method for simulating a power system according to claim 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010858813.XA CN112016199B (en) | 2020-08-24 | 2020-08-24 | Power system modularization modeling method and simulation method based on PSCAD |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010858813.XA CN112016199B (en) | 2020-08-24 | 2020-08-24 | Power system modularization modeling method and simulation method based on PSCAD |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112016199A true CN112016199A (en) | 2020-12-01 |
CN112016199B CN112016199B (en) | 2023-12-01 |
Family
ID=73505755
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010858813.XA Active CN112016199B (en) | 2020-08-24 | 2020-08-24 | Power system modularization modeling method and simulation method based on PSCAD |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112016199B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113609694A (en) * | 2021-08-13 | 2021-11-05 | 国家电网有限公司华北分部 | PSCAD (power system computer aided design) -based relay protection closed loop simulation system data transmission and synchronization method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100095282A1 (en) * | 2008-10-10 | 2010-04-15 | The Boeing Company | Method, Apparatus And Computer Program Product For Creating Inter-Language Interface |
CN105785793A (en) * | 2016-03-04 | 2016-07-20 | 济南大学 | Digital protection source code level closed-loop simulation method based on PSCAD |
US20160283202A1 (en) * | 2015-03-26 | 2016-09-29 | IfWizard Corporation | Automatically optimizing analytics database server |
CN111221520A (en) * | 2019-12-17 | 2020-06-02 | 特变电工西安柔性输配电有限公司 | Power system controller control algorithm generation method, equipment and readable storage medium |
-
2020
- 2020-08-24 CN CN202010858813.XA patent/CN112016199B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100095282A1 (en) * | 2008-10-10 | 2010-04-15 | The Boeing Company | Method, Apparatus And Computer Program Product For Creating Inter-Language Interface |
US20160283202A1 (en) * | 2015-03-26 | 2016-09-29 | IfWizard Corporation | Automatically optimizing analytics database server |
CN105785793A (en) * | 2016-03-04 | 2016-07-20 | 济南大学 | Digital protection source code level closed-loop simulation method based on PSCAD |
CN111221520A (en) * | 2019-12-17 | 2020-06-02 | 特变电工西安柔性输配电有限公司 | Power system controller control algorithm generation method, equipment and readable storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113609694A (en) * | 2021-08-13 | 2021-11-05 | 国家电网有限公司华北分部 | PSCAD (power system computer aided design) -based relay protection closed loop simulation system data transmission and synchronization method |
CN113609694B (en) * | 2021-08-13 | 2024-01-02 | 国家电网有限公司华北分部 | Relay protection closed loop simulation system data transmission and synchronization method based on PSCAD |
Also Published As
Publication number | Publication date |
---|---|
CN112016199B (en) | 2023-12-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4635208A (en) | Computer-aided design of systems | |
Dennis | Modularity | |
CN104881358A (en) | Program simulation testing method and system | |
CN112016199B (en) | Power system modularization modeling method and simulation method based on PSCAD | |
CN110781126A (en) | FPGA heterogeneous acceleration realization method, system, terminal and storage medium of TensorFlow | |
Tyrrell et al. | Design of reliable software in distributed systems using the conversation scheme | |
CN107122184A (en) | A kind of virtual reality software open type developing system and method | |
CN108205596B (en) | Method for realizing simulation function of serious accident analysis and calculation program of nuclear power plant | |
CN113835688B (en) | Object packaging method of scientific computing language interpreter | |
Gupta et al. | MATRIXx | |
CN112464502B (en) | Optimization and acceleration memory simulation verification method and device, storage medium and terminal | |
CN113805848B (en) | Target machine control software integration method and system | |
Shanmugan et al. | Block-oriented systems simulator (BOSS) | |
US11829689B1 (en) | Systems and methods for creating variant regions in acausal simulation models | |
Ditzel | Reflections on the high-level language symbol computer system | |
CN106094561B (en) | Marine Synthesize Electric Propulsion System modeling and simulating method and device | |
Dertouzos | An introduction to on-line circuit design | |
CN111291474B (en) | Electromagnetic transient simulation custom modeling and secondary development method | |
CN111400994A (en) | Netlist form verification method and device, computer equipment and storage medium | |
Wu et al. | Architecture Design and Internal Implementation of a Universal Coupling Between Controllers and Physics in a Tokamak Flight Simulator | |
Sugimoto et al. | An object‐oriented approach for interactive microprogram simulator | |
Damm et al. | Functional Languages: Compiler Technology and Parallelism (Dagstuhl Seminar 9213) | |
CN111522287A (en) | PLC safety signal processing method, system and storage medium | |
Pristupchik | Open-Source CAE for Electron Beam Optics Design: Challenges and Opportunities | |
CN115343605A (en) | Chip design testing method, system, medium, equipment and FPGA prototype verification platform |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |