A Lua script generation method and system for new energy power generation data calculation
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING HUADIAN TIANREN ELECTRIC POWER CONTROL TECH
- Filing Date
- 2022-10-31
- Publication Date
- 2026-08-07
AI Technical Summary
[0006]为解决现有技术中存在的不足,本发明提供一种针对新能源发电数据计算的Lua脚本生成方法,以解决针对新能源发电数据计算的Lua脚本开发难度大、开发效率低、复用性差等技术问题
[0046] The beneficial effect of this invention is that, compared with the prior art, it forms a computational model based on various operators in a pre-packaged algorithm operator library by organizing the relationships between operators and the order of computation, and finally automatically converts and generates Lua script files according to predetermined rules.
Smart Images

Figure CN115718629B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of new energy data technology, specifically to a Lua script generation method and system for calculating new energy power generation data. Background Technology
[0002] With the development of digitalization and intelligence in the field of new energy power generation, business needs in the calculation and processing of time-series data in the production process are becoming increasingly complex, and the complexity of data calculation is also increasing day by day.
[0003] In existing technologies, scripting languages are typically used to write data processing and computational logic, with different scripts developed to perform different computational logic to meet various computational needs. Lua, a compact scripting language written in standard C, can be compiled and run on almost all operating systems and platforms, and is therefore widely used in the field of data processing and computation in new energy power generation.
[0004] Using Lua scripts to complete the calculation and processing of power generation data usually presents the following problems: (1) High development cost and difficulty, developers need to fully understand Lua syntax to complete the relevant development; (2) Low development efficiency, developers need to use scripting languages to develop various functional functions and the function call relationship in order to complete the calculation logic development of specific functions; (3) Poor development reusability, different calculation logics work independently, and similar functions or code are also written in different scripts, which increases the maintenance cost of the calculation logic.
[0005] Prior art document 1 (104868832A) discloses a Lua script generation method, apparatus, terminal, and computer-readable medium. The method includes: obtaining the loading paths of each sub-script corresponding to the target Lua script; obtaining each sub-script according to the loading paths; and combining the sub-scripts according to a preset combination method to generate the target Lua script. The shortcoming of prior art document 1 is that the sub-scripts are pre-defined, and in the final generated Lua file, they are simply stored according to a preset order. The sub-scripts cannot interact with each other, and therefore cannot perform complex calculations. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a Lua script generation method for calculating new energy power generation data, thereby solving the technical problems of high development difficulty, low development efficiency, and poor reusability of Lua scripts for calculating new energy power generation data.
[0007] The present invention adopts the following technical solution.
[0008] A method for generating Lua scripts for new energy power generation data calculation includes:
[0009] Step 1: Encapsulate specific calculation functions for new energy power generation data into Lua operators and form an algorithm operator library;
[0010] Step 2: By organizing the relationships and calculation order among operators in the algorithm operator library, a computational model is formed;
[0011] Step 3: Convert the computational model file storing the computational model according to predetermined rules, and automatically generate a callable Lua script file.
[0012] Preferably, the specific computing functions mentioned in step 1 include: general computing and business computing;
[0013] General-purpose computing is used to perform data I / O read and write, historical data statistics, and dimensional statistics;
[0014] Business calculations are used to complete various professional calculation functions for new energy power generation business.
[0015] Preferably, in step 1, the Lua operator corresponds to an independent Lua function, exists in an independent Lua script file, and is used to complete a specific computational function;
[0016] Each operator has a unique identifier, which is a Lua function name.
[0017] A collection of several operators forms an algorithm operator library;
[0018] The operators in the algorithm operator library are independent of each other;
[0019] Operators in the algorithm operator library are categorized and organized according to their functions.
[0020] Preferably, step 2 specifically includes:
[0021] Step 2.1: Select one or more operators to add to the computation model based on the specific computational function;
[0022] Step 2.2: Organize the relationships between the input parameters and output values of each operator. The input parameters of an operator come from the output values of other operators; manual input constant values can also be output to the input parameters of an operator; the output value of an operator can be output to the input parameters of multiple operators.
[0023] Step 2.3: The computational order of each operator in the computational model is given. The operators and their interrelationships are combined in the execution order to form the computational model.
[0024] Preferably, the computational model is stored using a computational model file, which includes: the selected operators, the relationships between operators, and the order of operator computation;
[0025] The computational model files are stored in XML format;
[0026] Operators can be referenced multiple times within the same computational model file, and multiple instances are distinguished by the operator instance name.
[0027] Preferably, the computational model has one or more input parameters, which are distinguished by formal parameter names;
[0028] The computational model has one or more output values, which are distinguished by formal output names;
[0029] Computational models can be treated as a special category of operators and used in the editing and development of computational models.
[0030] Preferably, the predetermined rules in step 3 include: using the name of the computational model as the name of the Lua function, using the input parameters of the computational model as the parameters of the Lua function, and automatically generating the corresponding Lua function framework;
[0031] Using the operators in the computational model, the relationships between operators, and the order of operator computation, the corresponding Lua function bodies are automatically generated.
[0032] Several computational models automatically generate multiple Lua functions, and these multiple Lua functions are combined to form the final Lua script file;
[0033] The final Lua script file will automatically include references to the Lua script files corresponding to the operators contained in the computation model.
[0034] Generate code to call the corresponding Lua function for each operator in the computational model, based on the operator name.
[0035] The calling code is generated sequentially according to the computation order of the operators in the computation model;
[0036] The operator uses a name formed by combining the operator instance name and the operator form output value identifier as a unique identifier to identify the actual return value of the function called by the operator;
[0037] An operator uses the identifier of the actual return value of the function to which it is output as a unique identifier to identify the actual parameter value of the function called by the operator.
[0038] A Lua script generation system for new energy power generation data calculation includes: an algorithm operator library module, a calculation model configuration module, and a script conversion and generation module, wherein:
[0039] The algorithm operator library module is used to manage various operators and perform various general and business calculation functions.
[0040] The computational model configuration module is used to select operators, specify the relationships between operators, and the order of operator computation to build the computational model;
[0041] The script conversion and generation module is used to convert the computational model according to predetermined rules and automatically generate Lua script files.
[0042] A terminal includes a processor and a storage medium; wherein:
[0043] The storage medium is used to store instructions;
[0044] The processor is configured to operate according to the instructions to execute the steps of a Lua script generation method for calculating new energy power generation data.
[0045] A computer-readable storage medium having a computer program stored thereon, characterized in that, when executed by a processor, the program implements the steps of a Lua script generation method for calculating new energy power generation data.
[0046] The beneficial effect of this invention is that, compared with the prior art, it forms a computational model based on various operators in a pre-packaged algorithm operator library by organizing the relationships between operators and the order of computation, and finally automatically converts and generates Lua script files according to predetermined rules.
[0047] The development and generation of Lua scripts with specific functions can be completed through no-programming development methods such as configuration editing. Computational developers do not need to have a deep understanding of Lua script syntax and details, which improves script development efficiency.
[0048] By encapsulating various computational functions into operators, and allowing data interaction between specified operators when assembling computational models, as well as allowing specified operators to be executed in any order, this approach can be used to build and generate complex computational scripts. Its high reusability reduces the development and maintenance costs of computational data for new energy business production. Attached Figure Description
[0049] Figure 1 This is a flowchart of a Lua script generation method for calculating new energy power generation data in an embodiment of this application.
[0050] Figure 2 This is a schematic diagram of the structure of a Lua script generation system for calculating new energy power generation data in an embodiment of this application. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this invention. The embodiments described in this application are merely some embodiments of this invention, and not all embodiments. Based on the spirit of this invention, other embodiments obtained by those skilled in the art without creative effort are all within the protection scope of this invention.
[0052] To better understand the above technical solutions, the following will provide a detailed explanation of the above technical solutions in conjunction with the accompanying drawings and specific implementation methods.
[0053] Example 1.
[0054] A method for generating Lua scripts for calculating new energy power generation data. For example... Figure 1 As shown, it includes the following steps:
[0055] Step 1: Encapsulate specific calculation functions for new energy power generation data into Lua operators and form an algorithm operator library.
[0056] The specific computing functions include: general computing and business computing; general computing is used to complete data IO read and write, historical data statistics, and dimensional statistics; business computing is used to complete various professional computing functions for new energy power generation business.
[0057] In this preferred embodiment, a specific computational function is encapsulated as a Lua function and stored in a separate Lua script file. The encapsulated object is called an operator.
[0058] Operators are uniquely identified by Lua function names; operators have one or more input parameters, which are identified by Lua function parameter names; operators have one or more output values, which are identified by Lua function output names.
[0059] The following are some operators for calculating new energy power generation data:
[0060] Example 1 of the operators for calculating new energy power generation data is as follows:
[0061]
[0062] Here, "CalTurbineState" is the unique identifier of the operator, which is the function name of the Lua function in the corresponding Lua script file. The operator's function is to merge the states of the wind turbines in the wind farm based on the state simulation. The operator has three input parameters: "stateAnalogArr" (state simulation), "wfName" (site name), and "tm" (calculation time), which correspond to the three formal parameters of the Lua function in the Lua script file. The operator has one output value, "stateArr", which corresponds to the function output name of the Lua function in the Lua script file.
[0063] Another example 2 of the operators for calculating new energy power generation data is shown below:
[0064]
[0065] Among them, "WindFarmStateCal" is the unique identifier of the operator, which adopts the function name of the Lua function in the corresponding Lua script file; the operator's function is to calculate the number of wind turbines and the capacity of each state in the wind farm based on the six wind turbine states; the operator has three input parameters, namely "StateArr" (wind turbine state), "wfName" (site name), and "tm" (calculation time), which correspond to the three formal parameters of the Lua function in the Lua script file; the operator has no output value.
[0066] In the specific implementation of this embodiment, an algorithm operator library is formed by a set of several operators. The operators in the algorithm operator library are classified and organized according to their functions.
[0067] As an optional implementation, operators can be divided into general computing operators and business computing operators; general computing operators perform general computing functions such as data IO reading and writing, historical data statistics, and dimensional statistics; business computing operators perform various professional computing functions for new energy power generation business.
[0068] The following shows several commonly used general-purpose computation operators and their corresponding functions:
[0069] Operator name: Statistic / Operator function: Calculates the arithmetic mean, weighted average, maximum value, and minimum value.
[0070] Operator name: SliceSum / Operator function: Sum the values of the specified points.
[0071] Operator name: SliceAve / Operator function: Calculate the average of point names.
[0072] Operator name: GetHisValues / Operator function: Batch retrieve historical cross-sectional values of tag points based on point name.
[0073] Operator name: GetHisIntervalValues / Operator function: Gets historical values at equal intervals based on point names.
[0074] Operator name: PutHisValues / Operator function: Batch write historical values of tag points based on point name.
[0075] The following shows several commonly used business calculation operators and their corresponding functions:
[0076] Operator name: TurbineErrStopCounts / Operator function: Calculates the total number of turbine failures.
[0077] Operator name: StateCumutativeTime / Operator function: Calculates the cumulative time of the wind turbine status.
[0078] Operator name: WindFarmStateCal / Operator function: Number of wind farms in each state and state capacity.
[0079] Operator name: TurbineRealIdealPower / Operator function: Calculation of theoretical power and theoretical power generation of wind turbines.
[0080] Operator name: TurbineWindHours / Operator function: Calculates the total still wind time and effective wind hours of the fan.
[0081] Operator name: TurbineEnergyLoss / Operator function: Calculates the power loss of the wind turbine.
[0082] Each operator corresponds to an independent Lua function, which exists in a separate Lua script file and can be used to perform specific computational functions.
[0083] Step 2: Organize the operators in the algorithm operator library according to their relationships and calculation order to form a computation model.
[0084] In the specific implementation process, step 2 is implemented as follows:
[0085] First, select one or more operators based on their functions and add them to the computation model.
[0086] The selection of operators is based on the computational functions to be performed, and each operator is selected according to its own function.
[0087] Then, organize the relationships between the input parameters and output values of each operator: the input parameters of an operator come from the output values of other operators; manual input constant values can also be output to the input parameters of an operator; the output values of an operator can be output to the input parameters of multiple operators.
[0088] Finally, adjust the given calculation order of each operator in the calculation model, specifying the order in which the operators are calculated.
[0089] The selected operators, the relationships between operators, and the order of operator calculation together form the computational model.
[0090] By selecting operators, organizing the relationships between operators (i.e., specifying the data interaction relationships between inputs and outputs of operators), and specifying the execution order of operators, a computational model of arbitrary complexity can be constructed, which can be used to build complex computational functions. Specific construction methods are described below.
[0091] An example 3 of the computational model provided in this application is shown below:
[0092]
[0093] The computational model is stored using a computational model file. Preferably, the computational model file is stored in XML format.
[0094] In this example, the calculation model "IndexSystemW_5SecCal" selects operators such as "CalTurbineState" and "WindFarmStateCal".
[0095] The operator “CalTurbineState” is referenced multiple times, and multiple instances are distinguished by the operator instance names “CalTurbineState_S001” and “CalTurbineState_S002”.
[0096] In this example, regarding the input-output relationship: the input parameter "StateArr" of the operator "WindFarmStateCal_S001" uses the output value "stateArr" of the operator "CalTurbineState_S001". To distinguish the input and output of multiple instances of the same operator, the actual name of the input-output associated quantity uses the actual return value of the function called by the output operator as an identifier. The identifier method is a combination of the operator instance name and the operator form output value identifier. Therefore, since the input parameter "StateArr" of the operator "WindFarmStateCal_S001" uses the output value "stateArr" of the operator "CalTurbineState_S001", the actual name of the associated quantity is "CalTurbineState_S001_stateArr".
[0097] The computational model in this example has multiple input parameters, with the formal parameter names being "tm" and "TotalPoint_table.ActivePower";
[0098] The computational model in this example has one output value, whose formal output name is "result".
[0099] Computational models can be treated as a special category of operators and used in the editing and development of computational models.
[0100] The execution order of each operator is CalTurbineState_S001 as 1, WindFarmStateCal_S001 as 2, and CalTurbineState_S002 as 3.
[0101] Step 3: Convert the computational model file according to predetermined rules to automatically generate a callable Lua script file.
[0102] In the specific implementation process, step 3 is implemented as follows:
[0103] First, the corresponding Lua function framework is automatically generated by using the name of the computational model as the Lua function name and the input parameters of the computational model as the Lua function parameters.
[0104] Then, using the operators, relationships between operators, and the order of operator computation in the computation model, the corresponding Lua function bodies are automatically generated. If multiple computation models exist, several computation models will automatically generate multiple Lua functions, which will be combined to form the final Lua script file.
[0105] Finally, the final Lua script file automatically includes references to the Lua script files corresponding to the operators contained in the computation model.
[0106] When converting the computational model provided in Example 3:
[0107] Using the name of the computational model as the name of the Lua function and the input parameters of the computational model as the parameters of the Lua function, the corresponding Lua function framework is automatically generated.
[0108] function IndexSystemW_5SecCal(tm,TotalPoint_table.ActivePower)
[0109] The operators "CalTurbineState" and "WindFarmStateCal" are invoked to generate the corresponding Lua function code according to the operator name and order. The relevant code is as follows:
[0110] local StateArr=CalTurbineState(StateAnalogArr,DYY,tm)
[0111] WindFarmStateCal(StateArr,DYY,tm)
[0112] The input and output of the operator are unique identifiers formed by a combination of "operator instance name + formal output name"; thus, the above script code is transformed into:
[0113] local CalTurbineState_S001_stateArr=CalTurbineState(StateAnalogArr,DYY,tm)
[0114] WindFarmStateCal(CalTurbineState_S001_stateArr,DYY,tm)
[0115] Finally, references to the Lua script files corresponding to the operators contained in the computation model are automatically added to the Lua script files.
[0116] require("CalTurbineState")
[0117] require("WindFarmStateCal")
[0118] This completes the generation of the final callable Lua script file.
[0119] The final Lua script file generated in this embodiment is as follows.
[0120]
[0121] In the specific implementation process of this application embodiment, global variables are used to uniformly store the data used for new energy power generation data calculation; the same global variables are used in the Lua script corresponding to the operator and the final Lua script to share and transmit information.
[0122] Example 2.
[0123] A Lua script generation system for new energy power generation data calculation includes: an algorithm operator library module, a calculation model configuration module, and a script conversion and generation module, wherein:
[0124] The algorithm operator library module is used to manage various operators and perform various general and business calculation functions.
[0125] The computational model configuration module is used to select operators, specify the relationships between operators, and the order of operator computation to build the computational model;
[0126] The script conversion and generation module is used to convert the computational model according to predetermined rules and automatically generate Lua script files.
[0127] Example 3.
[0128] Embodiment 3 of the present invention provides a computer-readable storage medium.
[0129] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in a Lua script generation method for calculating new energy power generation data as described in Embodiment 1 of the present invention.
[0130] The detailed steps are the same as those provided in Example 1 for generating Lua scripts for calculating new energy power generation data, and will not be repeated here.
[0131] Example 4.
[0132] Embodiment 4 of the present invention provides an electronic device.
[0133] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in a Lua script generation method for calculating new energy power generation data as described in Embodiment 1 of the present invention.
[0134] The detailed steps are the same as those provided in Example 1 for generating Lua scripts for new energy power generation data calculation, and will not be repeated here.
[0135] The beneficial effect of this invention is that, compared with the prior art, it forms a computational model based on various operators in a pre-packaged algorithm operator library by organizing the relationships between operators and the order of computation, and finally automatically converts and generates Lua script files according to predetermined rules.
[0136] The development and generation of Lua scripts with specific functions can be completed through no-programming development methods such as configuration editing. Computational developers do not need to have a deep understanding of Lua script syntax and details, which improves script development efficiency.
[0137] By encapsulating various computational functions into operators, and allowing data interaction between specified operators when assembling computational models, as well as allowing specified operators to be executed in any order, this approach can be used to build and generate complex computational scripts. Its high reusability reduces the development and maintenance costs of computational data for new energy business production.
[0138] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.
[0139] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0140] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0141] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0142] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0143] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0144] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.
Claims
1. A Lua script generation method for calculating new energy power generation data, characterized in that, The method includes: Step 1: Encapsulate specific calculation functions for new energy power generation data into Lua operators and form an algorithm operator library; Step 2: By organizing the relationships and calculation order among operators in the algorithm operator library, a computational model is formed; Step 3: Convert the computational model file storing the computational model according to predetermined rules, and automatically generate a callable Lua script file; The predefined rules in step 3 include: using the name of the computational model as the name of the Lua function, using the input parameters of the computational model as the parameters of the Lua function, and automatically generating the corresponding Lua function framework; Using the operators in the computational model, the relationships between operators, and the order of operator computation, the corresponding Lua function bodies are automatically generated. Several computational models automatically generate multiple Lua functions, and these multiple Lua functions are combined to form the final Lua script file; The final Lua script file will automatically include references to the Lua script files corresponding to the operators contained in the computation model.
2. The Lua script generation method for calculating new energy power generation data according to claim 1, characterized in that: The specific computing functions mentioned in step 1 include: general computing and business computing; General-purpose computing is used to perform data I / O read and write, historical data statistics, and dimensional statistics; Business calculations are used to complete various professional calculation functions for new energy power generation business.
3. The Lua script generation method for calculating new energy power generation data according to claim 1, characterized in that: In step 1, the Lua operator corresponds to an independent Lua function, which exists in a separate Lua script file and is used to perform specific computational functions; Each operator has a unique identifier, which is a Lua function name. A collection of operators forms an algorithm operator library; The operators in the algorithm operator library are independent of each other; Operators in the algorithm operator library are categorized and organized according to their functions.
4. The Lua script generation method for new energy power generation data calculation according to claim 1, characterized in that: Step 2 specifically includes: Step 2.1: Select one or more operators to add to the computation model based on the specific computational function; Step 2.2: Organize the relationships between the input parameters and output values of each operator. The input parameters of an operator come from the output values of other operators; manual input constant values can also be output to the input parameters of an operator; the output value of an operator can be output to the input parameters of multiple operators. Step 2.3: The computational order of each operator in the computational model is given. The operators and their interrelationships are combined in the execution order to form the computational model.
5. A Lua script generation method for calculating new energy power generation data according to claim 1 or 4, characterized in that: The computational model is stored using a computational model file, which includes: the selected operators, the relationships between operators, and the order in which operators are computed. The computational model files are stored in XML format; Operators can be referenced multiple times within the same computational model file, and multiple instances are distinguished by the operator instance name.
6. A Lua script generation method for calculating new energy power generation data according to claim 1 or 4, characterized in that: The computational model has one or more input parameters, which are distinguished by their formal parameter names; The computational model has one or more output values, which are distinguished by formal output names; Computational models can be treated as a special category of operators and used in the editing and development of computational models.
7. A Lua script generation method for calculating new energy power generation data according to claim 6, characterized in that: Generate code to call the corresponding Lua function for each operator in the computational model, based on the operator name. The calling code is generated sequentially according to the computation order of the operators in the computation model; The operator uses a name formed by combining the operator instance name and the operator form output value identifier as a unique identifier to identify the actual return value of the function called by the operator; An operator uses the identifier of the actual return value of the function to which it is output as a unique identifier to identify the actual parameter value of the function called by the operator.
8. A Lua script generation system for calculating new energy power generation data using the method of any one of claims 1-7, comprising: The algorithm operator library module, the computational model configuration module, and the script conversion and generation module are characterized by: The algorithm operator library module is used to manage various operators and perform various general and business calculation functions. The computational model configuration module is used to select operators, specify the relationships between operators, and the order of operator computation to build the computational model; The script conversion and generation module is used to convert the computational model according to predetermined rules and automatically generate Lua script files.
9. A terminal, comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the Lua script generation method for calculating new energy power generation data according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the Lua script generation method for calculating new energy power generation data as described in any one of claims 1-7.
Citation Information
Patent Citations
Knowledge data processing method and system
CN104866310A
Data processing method and device, equipment and storage medium
CN114327405A