Off-line simulation method and system of EMS optimization algorithm
Through offline simulation methods and systems, historical data is used to simulate the operation scenario of EMS optimization algorithm, and the problem of time-consuming and costly verification and development of EMS optimization algorithms in the existing technology is solved, fast and low-cost testing and verification are achieved, and development efficiency and problem analysis capabilities are improved.
Patent Information
- Application Number
- CN202411634661.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-14
AI Technical Summary
In the prior art, the verification and development of EMS optimization algorithms rely on the hardware deployment of actual devices, resulting in time-consuming and costly development and iteration, and it is difficult to truly and efficiently verify the performance of the algorithm in special weather and uncommon problems.
Offline simulation methods and systems are adopted to simulate the operating scenarios of photovoltaic power generation equipment, user-side power equipment and battery equipment by replaying historical data, and offline simulation of EMS optimization algorithm is realized, hardware deployment is omitted, cost is reduced, and the scope of application of simulation methods and systems is expanded.
It realizes fast, comprehensive and low-cost testing and verification of EMS optimization algorithms, improves algorithm development efficiency, and can truly replicate problem scenarios and program status in the current line without relying on actual equipment, significantly improving the efficiency of problem analysis and positioning.
Smart Images

Figure CN119623249A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of energy management technology, and in particular to an off-line simulation method, an off-line simulation system, a computer device, and a computer-readable storage medium for an EMS optimization algorithm. Background Art
[0002] Energy Management System (EMS) is a technology that monitors, controls and optimizes energy consumption. For home applications, the management objects of the Energy Management System (EMS) include power generation equipment, energy storage equipment and power consumption equipment. Power generation equipment includes photovoltaic equipment, wind power equipment, etc., power consumption equipment includes various household appliances, and energy storage equipment includes household energy storage equipment, portable energy storage equipment, etc. During the operation of the energy management system, the EMS optimization algorithm collects data on photovoltaic production capacity and household load energy consumption in real time, and then predicts household electricity consumption and photovoltaic power generation in the short term in the future, and combines electricity price information to generate corresponding battery charging and discharging control strategies to adjust the use of electricity from different sources, ultimately achieving the goal of saving electricity bills for users.
[0003] For the simulation of EMS optimization algorithms, the current common solution is to deploy the algorithms to the EMS side and verify and improve the algorithms based on the actual operating environment of the equipment, which is called hardware-in-the-loop simulation. This solution relies on the actual deployed equipment and requires a long period of data accumulation. The development and iteration of the algorithm is time-consuming and costly.
[0004] How to verify and develop optimization algorithms in a realistic, efficient and low-cost manner is an important technical problem that needs to be solved at present. Summary of the invention
[0005] In view of this, embodiments of the present application provide an offline simulation method, an offline simulation system, a computer device, and a computer-readable storage medium for an EMS optimization algorithm to solve at least one problem existing in the background technology.
[0006] In a first aspect, an embodiment of the present application provides an offline simulation method of an EMS optimization algorithm, comprising the following steps: S10, obtaining a historical data set of the EMS in a predetermined time period, wherein the historical data set includes a plurality of single-group status data collected at predetermined time intervals, wherein the single-group status data includes power generation data, power consumption data, and battery status data; S20, loading the data of a part of the time period in the historical data set into the EMS simulation system for initialization, wherein the EMS simulation system includes a power generation equipment simulation module, a battery simulation module and a load simulation module; S30, reading the current state of the EMS simulation system, and using the current state data and the state data read historically as algorithm input; S40, scheduling the EMS optimization algorithm to execute, and obtaining the algorithm execution result under the current state of the EMS simulation system; S50, loading a single set of state data at the next moment into the EMS simulation system according to the data acquisition timing, and updating its state; Steps S30 to S50 are repeated until the EMS optimization algorithm simulation is completed.
[0007] In combination with the first aspect of the present application, in an optional implementation, the algorithm execution result includes a battery charge and discharge plan, and in step S50, the state of the battery simulation module is updated according to the battery charge and discharge plan.
[0008] In conjunction with the first aspect of the present application, in an optional implementation manner, the algorithm execution result includes a battery charging and discharging plan, and after step S40, the following further includes: S41, controlling the charging and discharging process of the battery simulation module according to the battery charging and discharging plan, and updating the state of the battery simulation module at the next moment; The step S50 includes: loading the power generation data and the power consumption data in the single set of status data at the next moment into the EMS simulation system.
[0009] In conjunction with the first aspect of the present application, in an optional implementation manner, step S41 includes the following steps: S411, obtaining initial charge and discharge power and charge and discharge duration according to the charge and discharge plan; S412, querying the real-time charge and discharge power and real-time power of the battery simulation module, generating the target charge and discharge power of the next control cycle according to the real-time charge and discharge power, and generating the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function, wherein the predetermined control cycle is less than the predetermined time interval; S413, calculating the battery power of the next control cycle according to the real-time power, the actual charge and discharge power of the next control cycle, and the upper and lower limits of the battery capacity; S414, updating the power of the battery simulation module according to the battery power of the next control cycle, and updating the real-time charge and discharge power of the battery simulation module according to the charge and discharge target power of the next control cycle, and updating the simulation timestamp; Steps S412 to S414 are repeated until the state update of the battery simulation module at the next moment is completed.
[0010] In conjunction with the first aspect of the present application, in an optional implementation manner, the battery power of the next control period is calculated according to the real-time power, the actual charge and discharge power of the next control period, and the upper and lower limits of the battery capacity, and the calculation formula is as follows: , among which, BP t+v is the battery power of the next control cycle t+v, BP t is the real-time power of the battery simulation module, p is the actual charge and discharge power of the next control cycle, v is the control cycle, and They are the upper and lower limits of battery capacity, min{} is the minimum value, and max{} is the maximum value.
[0011] In conjunction with the first aspect of the present application, in an optional implementation manner, the battery charge and discharge response function of the battery simulation module is a linear function, and the linear function expression is as follows: , where p is the actual charge and discharge power, p 0 is the real-time charge and discharge power, P s is the difference between the real-time charge and discharge power and the target charge and discharge power, α is the battery convergence speed, and N is the random disturbance.
[0012] In a second aspect, an embodiment of the present application provides an offline simulation system of an EMS optimization algorithm, which is used to implement the method described in any one of the above aspects, including: An EMS simulation system includes a photovoltaic simulation module, a battery simulation module and a load simulation module, wherein the EMS simulation module is used to simulate the system state of the EMS; A data playback module, used to obtain a historical data set of the EMS for a predetermined period of time, and load the historical data set into the EMS simulation system; The simulation scheduling module is used to read the state of the EMS simulation system and call the EMS optimization algorithm to execute, so as to obtain the execution results of the EMS simulation system in different states.
[0013] In conjunction with the second aspect of the present application, in an optional implementation, the algorithm execution result includes a battery charge and discharge plan, and the simulation scheduling module is further used to update the state of the battery simulation module according to the battery charge and discharge plan.
[0014] In combination with the second aspect of the present application, in an optional embodiment, it also includes a control simulation module, the execution result includes a battery charge and discharge plan, and the control simulation module is used to control the battery simulation module to perform charging and discharging and update the status of the battery simulation module according to the battery charge and discharge plan.
[0015] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above aspects when executing the computer program.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the above aspects.
[0017] The offline simulation method, offline simulation system, computer device and computer-readable storage medium of the EMS optimization algorithm provided in the embodiment of the present application adopt digital simulation technology, and simulate photovoltaic power generation equipment, user-side power equipment and battery equipment by replaying historical data, which can accurately reproduce the real operation scenarios of various types of equipment such as power generation equipment, power equipment and energy storage equipment, so as to test the operation of the EMS optimization algorithm in different scenarios, omit the hardware deployment of the algorithm, avoid being limited by special weather and uncommon problems during hardware-in-the-loop testing, reduce costs, expand the scope of application of the simulation method and system, and improve the efficiency of algorithm testing and verification. Through the combined use of the three working modes, the full-process test and verification of the EMS optimization algorithm can be realized, which greatly improves the efficiency of the test and verification of the EMS optimization algorithm and greatly improves the efficiency of algorithm development.
[0018] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A schematic diagram of an offline simulation system of an EMS optimization algorithm provided in one embodiment of the present application; Figure 2 A flow chart of an offline simulation method of an EMS optimization algorithm provided in one embodiment of the present application; Figure 3 A flow chart of an offline simulation method of an EMS optimization algorithm provided by another embodiment of the present application; Figure 4 A schematic diagram of an offline simulation system of an EMS optimization algorithm provided in another embodiment of the present application; Figure 5 A flowchart of an offline simulation method of an EMS optimization algorithm provided in another embodiment of the present application; Figure 6 A schematic diagram of a computer device provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the technical solutions and beneficial effects of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are clearly and completely described below by listing specific embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0022] It should be noted that the terms "first", "second", etc. used in this application may be used in this article to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element, rather than to describe a specific order or sequence. The terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions and do not exclude the presence or addition of one or more other features.
[0023] The ability of an optimization algorithm depends on the efficiency of its development, update and iteration. It requires that the algorithm development can effectively reproduce the algorithm results in the problem scenario to help locate and analyze the problem, and after the algorithm is optimized, efficiently verify the effect on a rich set of scenarios to ensure the effectiveness of the algorithm in each scenario.
[0024] The inventors found that the current hardware-in-the-loop test method is mostly used for testing and verifying control algorithms in a short period of time (minutes). However, for verification of special weather conditions and uncommon problems, the uncontrollability of the external environment will result in the testing and verification of the algorithm being limited by the difficulty of reproducing the problem scenario and the frequency of occurrence, making problem analysis and location very difficult or impossible. For the problem analysis method through logs, it is impossible to restore the complete problem due to the lack of key information, and it is also impossible to provide a verification method for the new version of the algorithm.
[0025] In this regard, an embodiment of the present application provides an offline simulation method and system for an EMS optimization algorithm, which is suitable for application scenarios such as home energy management, building energy management, or community energy management.
[0026] The offline simulation system of the EMS optimization algorithm is used to simulate the real operating environment of the EMS optimization algorithm in order to test and verify the EMS optimization algorithm. The test object of the offline simulation system includes the optimization algorithm module 01, which takes power generation data, power consumption data and battery status data as input, establishes and solves the optimization problem of the battery charging and discharging behavior based on the prediction of future power generation and power consumption, and finally outputs the battery charging and discharging plan for a period of time in the future.
[0027] First, please refer to Figure 1 , the offline simulation system provided in one embodiment of the present application includes: an EMS simulation system 10, a data playback module 20 and a simulation scheduling module 30. The EMS simulation system 10 is used to simulate the system state of the EMS. The EMS simulation system 10 includes a power generation simulation module 11, a battery simulation module 13 and a load simulation module 12. The power generation simulation module 11 is used to simulate the power production of photovoltaic, wind power and other power generation equipment in a real environment, and provide the power production or power data of the photovoltaic system at the time of data collection. This application is illustrated with a photovoltaic simulation module. The load simulation module 12 is used to simulate the power usage of the load in a real environment, and provide the power consumption data of the household load end at various times. The battery simulation module 13 is used to simulate the battery part of the energy storage device, and provide the battery status information at a certain moment and the battery state change after receiving the charge and discharge instructions. The battery status information includes the state of charge (SOC).
[0028] The data playback module 20 is used to obtain the historical data set of the EMS in a predetermined time period and load the historical data set into the EMS simulation system. The data playback module 20 is used to load the data collected on the real device and provide the data required by other simulation modules during the simulation scheduling execution.
[0029] The simulation scheduling module 30 is used to read the state of the EMS simulation system and call the EMS optimization algorithm to execute, and obtain the execution results of the EMS simulation system in different states. The simulation scheduling module simulates the data collection process of various devices on the real device side, and reads the latest state data from each module of the EMS simulation system 10. The simulation scheduling module 30 coordinates the data playback module 20, the EMS simulation system 10, the optimization algorithm module 01 and other modules, reads the state of each module of the EMS simulation system to generate the input required by the optimization algorithm, calls the optimization algorithm module 01 to execute the optimization algorithm, obtains the algorithm output result, and saves it in a file for subsequent analysis.
[0030] For a detailed description of the offline simulation system and its various modules, please refer to the relevant content below.
[0031] refer to Figure 2The offline simulation method of the EMS optimization algorithm provided in one embodiment of the present application comprises the following steps: S10, obtaining a historical data set of the EMS in a predetermined time period, the historical data set including multiple single-group status data collected at predetermined time intervals, the single-group status data including power generation data, power consumption data and battery status data. Optionally, the power generation data includes photovoltaic output, photovoltaic power generation power, etc. at the time of collection; the power consumption data includes load meter reading data; and the battery status data includes battery status data at the time of collection.
[0032] Optionally, the above-mentioned predetermined time period includes more than 1 day to achieve the test and verification of the optimization algorithm over a longer time span. Optionally, the predetermined time interval for data collection is 10 to 20 minutes, that is, the total photovoltaic output / power generation, load meter readings, and battery status data at that moment are collected every 10 to 20 minutes (for example, 15 minutes). Each single group of status data at the time of collection is arranged in time sequence to form a historical data set including multiple single groups of status data.
[0033] S20, load the data of some time periods in the historical data set to the EMS simulation system 10 for initialization. The EMS simulation system includes a power generation equipment simulation module 11, a battery simulation module 13 and a load simulation module 12. The data playback module 20 confirms the existence of the collected data file and preloads the data of some time periods. Optionally, the data of some time periods are data collected in the historical data set with a time span of 2 to 5 days. In the initialization stage of the offline simulation system, the data playback module 20 loads the historical data set of the partial time period (for example, 3 days) to initialize the offline simulation system, loads the power generation data to the power generation equipment simulation module 11, loads the power consumption data to the load simulation module 12, and loads the battery status data to the battery simulation module 13. The single set of status data at the latest collection time is used as the EMS simulation system state at the simulation start time T, recorded as the state at time T, including the state of the power generation equipment simulation module 11, the state of the battery simulation module 13 and the state of the load simulation module 12 at time T. The initialization of the battery simulation module 13 includes initializing the upper and lower limits of the battery power, the maximum charge and discharge power, and the battery conversion efficiency. The state of the battery simulation module 13 at time T includes the battery power or state of charge (SOC) at that time.
[0034] S30, read the current state data of the EMS simulation system 10, and use the current state number and the historically read state data as algorithm input. After the EMS simulation system 10 is initialized, the current state data read is the state at time T, and the historical state data read is the state before time T. For example, the historical data set loaded into the EMS simulation system during initialization includes 3 days of historical data, and each day's historical data includes a single set of state data collected every 15 minutes on that day, and the set of state data includes photovoltaic power generation data, battery state data, and load power consumption data at a certain collection time. For example, time T is 12 noon on the most recent day, and the historical state data read at this time is the state before time T. After the EMS simulation system status is updated, the current state read is the state data at the update time T+1, and the historical state data read is the state before time T+1, and so on.
[0035] S40, schedule the execution of the EMS optimization algorithm to obtain the algorithm execution result under the current state of the EMS simulation system 10. The simulation scheduling module 30 generates the input data required for the operation of the optimization algorithm module 01 based on the current state data of each simulation module of the EMS simulation system 10 read in step S30 and the historical state data read in the past, including: historical photovoltaic production, historical load meter readings and the latest battery state data, and then calls the optimization algorithm and obtains the output of the optimization algorithm. The output result of the optimization algorithm includes the battery charging and discharging plan at the next moment.
[0036] The optimization algorithm takes historical photovoltaic production, load meter readings and battery status data as inputs, and establishes and solves the battery charging and discharging behavior based on the prediction of future photovoltaic production and load power consumption, and finally outputs the battery charging and discharging plan for the battery in the future. Optionally, the future period of time is a predetermined time interval. After the simulation scheduling module 30 obtains the algorithm output results, it saves them in a file for subsequent analysis.
[0037] S50, load the next-time single-group state data to the EMS simulation system 10 according to the data acquisition sequence, and update its state. The data playback module 20 performs the loading of a single-group state data in the historical data set each time, as a new data source for each simulation module of the EMS simulation system 10, for reading by the simulation scheduling module 30. For example, after the state of the EMS simulation system 10 at time T is read, the single-group state data at time T+1 is used to update the state of the EMS simulation system 10 to the state at time T+1, including the total output of the photovoltaic module at time T+1, the load meter reading, and the SOC state of the battery.
[0038] Repeat steps S30 to S50 until the optimization algorithm simulation is completed. The simulation process of this embodiment is called the first working mode, which sequentially performs the steps of reading the state of the EMS simulation system 10, scheduling the optimization algorithm module, and updating the state of each module of the EMS simulation system 10. The state of the EMS simulation system 10 is read, the algorithm is executed, and then the state of the EMS simulation system 10 is read as a cycle, and then the reading step of the new state data of the EMS simulation system 10 is started again and the next cycle is started, and the algorithm simulation iteration is finally completed. When the data in the historical data set is fully loaded according to the acquisition timing, the algorithm simulation iteration is completed. The algorithm simulation can also be ended by setting a termination condition, and the algorithm simulation iteration is completed when the termination condition is reached.
[0039] This application adopts digital simulation technology, based on historical data collected in the scene, by reusing the data collected when the photovoltaic energy storage system is online, and then playing back the historical data, simulating photovoltaic power generation equipment, user-side power equipment and battery equipment, and can accurately reproduce the operating scenarios of various types of equipment such as photovoltaic power generation equipment, power equipment and energy storage equipment at the time, so as to test the operation of the EMS optimization algorithm in different scenarios, so as to facilitate a quick and comprehensive evaluation of the execution effect of the optimization algorithm in actual conditions.
[0040] In this way, the development and testing of the EMS optimization algorithm can be independent of the actual physical equipment, ensuring that the verification results of the optimization algorithm can truly reflect the actual situation after the algorithm is actually deployed on the device side. On the one hand, the deployment process of the algorithm is omitted, and the problem scenarios and program status when online can be accurately reproduced, so that the analysis and location of the problem can be traced, and the running results of the algorithm at the time of the problem can be understood, which improves the efficiency of problem analysis and location. The reproduced problem scenarios can also be tested after the algorithm is improved to verify the solution to the problem, which accelerates the testing and release process of the optimization algorithm; on the other hand, large-scale testing and rapid iteration of the optimization algorithm are realized, which improves the development efficiency of the optimization algorithm.
[0041] In addition, the offline simulation method of this embodiment can achieve a longer time span, such as simulation of the optimization algorithm operating environment for more than one day, avoiding the short-term testing of hardware-in-the-loop testing, as well as being restricted by special weather conditions and uncommon problems, shortening the algorithm testing cycle, and expanding the scope of application of the simulation system.
[0042] In possible implementations of this application, reference Figure 3, the offline simulation method adopts the second working mode to run. Specifically, the difference between the second working mode and the first working mode includes: the algorithm execution result includes a battery charge and discharge plan, and in step S50, the state of the battery simulation module 13 is updated according to the battery charge and discharge plan. The optimization algorithm generates an execution result including a battery charge and discharge plan according to the state of the EMS simulation system at each moment. After obtaining the execution result, the simulation scheduling module 30 loads it into the battery simulation module 13, and the battery simulation module 13 updates the state of the EMS simulation system 10 at the next moment according to the charge and discharge plan in the execution result.
[0043] In the second working mode, the battery simulation module 13 simulates the amount of energy that the battery can store, and accurately responds to the charge and discharge instructions to complete the charging or discharging of the battery. There is no delay in the response of the battery simulation module 13 to the charge and discharge instructions. When the scheduling optimization algorithm module 01 is executed, a battery charge and discharge plan within a predetermined time (D minutes) is generated. The battery simulation module 13 of the EMS simulation system 10 responds to the battery charge and discharge instructions generated by the optimization algorithm and updates the battery simulation module state at the next time T+1. The predetermined time preferably selects the data collection time interval.
[0044] The updating process is as follows: Assuming that the optimization algorithm execution result indicates that a 10 kwh battery discharges at a power of 4 kw for 15 minutes, the energy of the battery simulation module 13 at the current moment T is 10 kwh, and the theoretical value of the power at the next moment T+1 is:
[0045] The theoretical value is limited to the upper and lower limits of the battery power, and the state of the battery simulation module at the next time T+1 is obtained: , among which, BP T+1 Indicates the battery power at time T+1, BP T represents the battery power at time T, p represents the charge and discharge rate output by the optimization algorithm at time T, that is, the charge and discharge power of the battery, D represents the charge and discharge time of the battery, and are the upper and lower limits of battery capacity, min{} is the minimum value, and max{} is the maximum value. The state of the battery simulation module 13 at the next time T+1 will be updated to 9 kwh (10 kwh - 4kw×0.25h = 9kwh).
[0046] The power of the battery simulation module 13 at the next moment will be charged or discharged according to the execution result of the optimization algorithm at the current moment, but will not exceed the upper or lower limit of the battery energy set by the system.
[0047] In a possible implementation, the algorithm execution result includes a battery charge and discharge plan. Scheduling the EMS optimization algorithm at the current moment will generate a battery charge and discharge plan for the next moment. The simulation scheduling module 30 of the offline simulation system is also used to update the state of the battery simulation module 12 according to the battery charge and discharge plan. After obtaining the execution result, the simulation scheduling module 30 loads it into the battery simulation module 13 to update its state at the next moment. For a detailed description of each module, please refer to the relevant description of the offline simulation method of the EMS optimization algorithm in the above embodiment, which will not be repeated here.
[0048] In the first working mode, the execution result of the optimization algorithm will not affect the state of the battery simulation module 13 in the EMS simulation system 10, and its state depends entirely on the battery state recorded in the historical data set. The primary purpose of this mode is to reproduce the operation of the optimization algorithm at the problem site to assist in problem analysis. The difference between the second working mode and the first working mode is that after initialization, the state of the battery simulation module 13 will update its state according to the execution result of each algorithm to simulate the charging and discharging process of the battery. Then the state of the battery simulation module 13 will be used as the input of the optimization algorithm at the next moment to affect the next execution result of the optimization algorithm, thus forming a closed loop. The second working mode solves the problem of how to evaluate the actual effects of different versions of algorithms accumulated over a long period of time in a given scenario.
[0049] The testing of traditional hardware-in-the-loop systems is limited by the current test conditions (photovoltaic and power consumption under specific weather conditions) on the one hand, and on the other hand, it is necessary to wait for the response of the real battery, which means that it takes a long time to complete the actual charging and discharging. Compared with the hardware-in-the-loop system, the battery simulation module in the second working mode simulates the battery charging and discharging process according to the charging and discharging plan. The time granularity of a single simulation is at the minute level, and the execution time of the optimization algorithm only takes a dozen seconds. Therefore, the second working mode can complete the verification of specific scenarios at a speed of nearly 100 times, which can greatly improve the algorithm verification efficiency by nearly 100 times. It can also ensure that the coverage of the use scenarios is wide enough, and can also compare the final performance of different algorithms on the same set of scenarios. It greatly improves the iteration efficiency of the optimization algorithm, ensures the verification coverage of the algorithm in a wide range of scenarios, and for uncommon test situations, it can also be repeatedly tested and verified through simulation, and no longer needs to wait for the actual occurrence of special scenarios.
[0050] refer to Figure 4In another embodiment of the present application, the offline simulation system also includes a control simulation module 40, which is used for the battery charge and discharge plan to control the battery simulation module 13 to execute charge and discharge and update the state of the battery simulation module 13 to achieve accurate simulation of the battery control system. The battery charge and discharge plan includes the charge and discharge time and the charge and discharge amount or charge and discharge power. The control simulation module 40 is also used to obtain the current actual charge and discharge power of the battery simulation module 13. The control simulation module 40 obtains the actual charge and discharge power of the current battery simulation module 13 at a certain frequency, such as 10Hz, and adjusts the battery charge and discharge target power in real time to ensure that the total charge and discharge amount of the battery within the battery charge and discharge plan time is consistent with the charge and discharge plan output by the optimization algorithm module 01.
[0051] refer to Figure 5 In another embodiment of the present application, the offline simulation method adopts the third working mode to operate. By simulating the battery control system, the response delay and random error between the battery and the battery control system in the actual test are restored as much as possible, so that the simulation results can be closer to the operation on the real device. The difference between the third working mode and the second working mode includes: the algorithm execution result includes the battery charging and discharging plan, and step S40 also includes step S41 after step S40, which controls the charging and discharging process of the battery simulation module according to the battery charging and discharging plan to obtain the state of the battery simulation module at the next moment; step S50 includes: loading the power generation data and power consumption data in the single group of state data at the next moment to the EMS simulation system 10. The data playback module 20 loads the power generation data in the single group of state data at the next moment to the power generation simulation module 11, and loads the power consumption data in the single group of state data at the next moment to the load simulation module 12. The state of the battery simulation module 13 is updated by the control simulation module 40. The battery charging and discharging plan includes the initial charging and discharging power and the charging and discharging duration. The state of the battery simulation module at the next moment includes the charging and discharging target power and the battery power.
[0052] Step S41 includes the following steps: S411, obtaining initial charge and discharge power and charge and discharge duration according to the charge and discharge plan. The control simulation module 40 can obtain the initial charge and discharge power and charge and discharge duration from the charge and discharge plan of the optimization algorithm execution result.
[0053] S412, query the real-time charge and discharge power and real-time power of the battery simulation module 13, generate the charge and discharge target power of the next control cycle according to the real-time charge and discharge power, and generate the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function. The control simulation module 40 generates the charge and discharge target power at intervals of a predetermined control cycle. The predetermined control cycle is less than the data acquisition time interval T. The acquisition time interval T is in the minute level, and the control cycle of the control simulation module 40 is in the millisecond level, such as 100ms. Generate the charge and discharge target power based on the PID control principle. Since there is a delay in the actual battery charge and discharge, there will be a discharge slightly higher than the planned average charge and discharge power in a short period of time to compensate for the initial power shortage. The PID control principle can be used to simulate the real charge and discharge process, and ensure that the total charge and discharge amount of the battery in a collection time interval is consistent with the output of the optimization algorithm module. The control simulation module 40 obtains the actual charge and discharge power of the current simulated battery module at a certain frequency, such as 10Hz, and generates the battery charge and discharge target power of the next control cycle.
[0054] The actual charge and discharge power is used to simulate the actual power change during the battery charge and discharge process. The control simulation module 40 generates the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function. The real-time charge and discharge power at the beginning of the control cycle is the initial charge and discharge power. The battery charge and discharge response function is a linear function or a nonlinear function. The linear function expression is as follows:
[0055] p 0 is the real-time charge and discharge power, p is the actual charge and discharge power, P s is the difference between the real-time charge and discharge power and the target charge and discharge power, α is the convergence speed of the battery, 1 / α means that the battery converges to the target power within a certain time, and N is the random disturbance, representing the charge and discharge power jitter.
[0056] N is selected from Gaussian distribution or Poisson distribution. Taking Gaussian distribution as an example, , where μ is the mean and σ is the variance.
[0057] Optional, α=0.05~0.5; μ=0, σ=0.01~1.
[0058] When a nonlinear function is selected as the battery charge and discharge response function, the response function can be obtained through training of a machine learning model. First, a battery charge and discharge model based on a machine learning model is established, and then input and output data in the actual control process of the device end are collected to obtain a battery charge and discharge data set. The battery charge and discharge model is trained using the data set to obtain a nonlinear battery charge and discharge response function. The use of a nonlinear function can more accurately simulate the power change process of the battery on the device end. Optionally, the machine learning method includes a random forest or a neural network.
[0059] S413, calculating the battery power of the next control cycle according to the real-time power, the actual charge and discharge power of the next control cycle, and the upper and lower limits of the battery capacity.
[0060] The calculation formula is as follows: , among which, BP t+v is the battery power of the next control cycle t+v, BP t is the real-time power of the battery simulation module, p is the actual charge and discharge power of the next control cycle, v is the control cycle, and They are the upper and lower limits of battery capacity, min{} is the minimum value, and max{} is the maximum value.
[0061] Optionally, the control period v = 50ms to 200ms. The charging and discharging power p is, for example, 4kWh.
[0062] S414, update the power of the battery simulation module 13 according to the battery power of the next control cycle, and update the real-time charge and discharge power of the battery simulation module 13 according to the charge and discharge target power of the next control cycle, and update the simulation timestamp. The control simulation module 40 controls the state update of the battery simulation module 13 in the control cycle, including the battery power and the real-time charge and discharge power. The control simulation module 40 sets the power of the battery simulation module 13 to the battery power of the next control cycle, and sets the real-time charge and discharge power of the battery simulation module 13 to the charge and discharge target power of the next control cycle.
[0063] Steps S412 to S414 are repeated until the state update of the battery simulation module 13 at the next time T+1 is completed.
[0064] At the beginning of the control cycle, first obtain the initial charge and discharge power and charge and discharge duration according to the charge and discharge plan, query the real-time charge and discharge power and real-time power of the battery simulation module 13, generate the charge and discharge target power of the next control cycle according to the real-time charge and discharge power, and generate the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function. At the beginning of the control cycle, the real-time charge and discharge power of the battery simulation module 13 is the initial charge and discharge power. Update the real-time charge and discharge power of the next control cycle of the battery simulation module 13 to the charge and discharge target power of the next control cycle. The control simulation module 40 generates the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function, and then calculates the battery power of the next control cycle T+v according to the real-time power, the actual charge and discharge power of the next control cycle, and the upper and lower limits of the battery capacity. Finally, update the battery power of the battery simulation module at the time T+v according to the battery power. At this point, a control process is completed and the simulation timestamp is updated.
[0065] Repeat the above process to complete the status update of the second control cycle T+2v. Similarly, complete the battery simulation module status update (T+1 moment) of a data collection time interval (D minutes). When the simulation timestamp reaches the charge and discharge duration or the data collection time interval, the status update of the battery simulation module at the next moment is completed.
[0066] After the control simulation module 40 is executed and the status update of the battery simulation module 13 is completed, the simulation system completes a scheduling cycle of a data collection time interval, and then reads the next data record (a single group of status data at the next collection time T+1), and starts the iteration of the next data collection time interval 2T. And so on, the data loading and simulation of the entire historical data set are finally completed.
[0067] The third operating mode can perform end-to-end simulation verification of the optimization algorithm module and battery control, realize the operation stability verification of the entire algorithm link, and provide an operation effect that is closer to the actual device-side execution. The difference between the third operating mode and the second operating mode is that the state update of a single data acquisition time interval of the simulated battery is expanded to include the execution process of the control simulation module 40 and a more fine-grained and realistic battery state update that takes into account the control cycle. Compared with hardware-in-the-loop testing, it can improve test efficiency by dozens of times.
[0068] In a possible implementation, the offline simulation system of the EMS optimization algorithm further includes a control simulation module 40, which is used to control the battery simulation module 13 to perform charging and discharging according to the battery charging and discharging plan and update the state of the battery simulation module, and the data playback module 20 is used to load the power generation data and power consumption data in the next single group of state data to the power generation simulation module 11 and the load simulation module 12 of the EMS simulation system. The control simulation module 40 is used to execute the various sub-steps of step S41, that is, to execute the following steps: S411, obtaining initial charging and discharging power and charging and discharging time according to the charging and discharging plan; S412, querying the real-time charge and discharge power and real-time power of the battery simulation module 13, generating the target charge and discharge power of the next control cycle according to the real-time charge and discharge power, and generating the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function, wherein the predetermined control cycle is less than the predetermined time interval; S413, calculating the battery power of the next control cycle according to the real-time power, the actual charge and discharge power of the next control cycle, and the upper and lower limits of the battery capacity; S414, updating the power of the battery simulation module according to the battery power of the next control cycle, and updating the real-time charge and discharge power of the battery simulation module 13 according to the charge and discharge target power of the next control cycle, and updating the simulation timestamp; Steps S412 to S414 are repeated until the state update of the battery simulation module at the next moment is completed.
[0069] For a detailed description of each module, reference may be made to the related description of the offline simulation method of the EMS optimization algorithm in the above embodiment, which will not be repeated here.
[0070] The combined use of the above three working modes can realize the full-process testing and verification of the EMS optimization algorithm, greatly improving the efficiency of testing and verification of the EMS optimization algorithm, shortening the algorithm development cycle, and making the operating results closer to the results on the actual device side.
[0071] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0072] It is understood that the above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0073] For the relevant contents of each module in this embodiment, reference may be made to the relevant contents of the units with the same figure marks in any of the aforementioned embodiments, and will not be repeated here.
[0074] The embodiment of the present application further provides a computer device, including a memory 101 and a processor 102, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the offline simulation method of any of the above embodiments are implemented.
[0075] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the offline simulation method of any of the above embodiments are implemented.
[0076] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0077] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An off-line simulation method for an EMS optimization algorithm, characterized in that: The following steps are involved: S10, obtaining a historical data set of the EMS in a predetermined time period, wherein the historical data set includes a plurality of single-group status data collected at predetermined time intervals, wherein the single-group status data includes power generation data, power consumption data, and battery status data; S20, loading the data of a part of the time period in the historical data set into the EMS simulation system for initialization, wherein the EMS simulation system includes a power generation equipment simulation module, a battery simulation module and a load simulation module; S30, reading the current state of the EMS simulation system, and using the current state data and the state data read historically as algorithm input; S40, scheduling the EMS optimization algorithm to execute, and obtaining the algorithm execution result under the current state of the EMS simulation system; S50, loading a single set of status data at the next moment into the EMS simulation system according to the data acquisition timing, and updating its status; Steps S30 to S50 are repeated until the EMS optimization algorithm simulation is completed.
2. The off-line simulation method of the EMS optimization algorithm according to claim 1, characterized in that: The algorithm execution result includes a battery charge and discharge plan. In step S50, the state of the battery simulation module is updated according to the battery charge and discharge plan.
3. The off-line simulation method of the EMS optimization algorithm according to claim 1, characterized in that: The algorithm execution result includes a battery charging and discharging plan, and after step S40, the following steps are further included: S41, controlling the charging and discharging process of the battery simulation module according to the battery charging and discharging plan, and updating the state of the battery simulation module at the next moment; The step S50 includes: loading the power generation data and the power consumption data in the single set of status data at the next moment into the EMS simulation system.
4. The off-line simulation method of the EMS optimization algorithm according to claim 3 is characterized in that: Step S41 includes the following steps: S411, obtaining initial charge and discharge power and charge and discharge duration according to the charge and discharge plan; S412, querying the real-time charge and discharge power and real-time power of the battery simulation module, generating the target charge and discharge power of the next control cycle according to the real-time charge and discharge power, and generating the actual charge and discharge power of the next control cycle according to the real-time charge and discharge power and the battery charge and discharge response function, wherein the predetermined control cycle is less than the predetermined time interval; S413, calculating the battery power of the next control cycle according to the real-time power, the actual charge and discharge power of the next control cycle, and the upper and lower limits of the battery capacity; S414, updating the power of the battery simulation module according to the battery power of the next control cycle, and updating the real-time charge and discharge power of the battery simulation module according to the charge and discharge target power of the next control cycle, and updating the simulation timestamp; Steps S412 to S414 are repeated until the state update of the battery simulation module at the next moment is completed.
5. The off-line simulation method of the EMS optimization algorithm according to claim 4, characterized in that: The battery power of the next control cycle is calculated according to the real-time power, the actual charge and discharge power of the next control cycle, and the upper and lower limits of the battery capacity. The calculation formula is as follows: , among which, BP t+v is the battery power of the next control cycle t+v, BP t is the real-time power of the battery simulation module, p is the actual charge and discharge power of the next control cycle, v is the control cycle, and They are the upper and lower limits of battery capacity, min{} is the minimum value, and max{} is the maximum value.
6. The off-line simulation method of the EMS optimization algorithm according to claim 1, characterized in that: The battery charge and discharge response function of the battery simulation module is a linear function, and the linear function expression is as follows: , where p is the actual charge and discharge power, p0 is the real-time charge and discharge power, P s is the difference between the real-time charge and discharge power and the target charge and discharge power, α is the battery convergence speed, and N is the random disturbance.
7. An off-line simulation system of an EMS optimization algorithm, used to implement the method described in any one of claims 1 to 6, characterized in that: include: An EMS simulation system includes a photovoltaic simulation module, a battery simulation module and a load simulation module, wherein the EMS simulation module is used to simulate the system state of the EMS; A data playback module, used to obtain a historical data set of the EMS for a predetermined period of time, and load the historical data set into the EMS simulation system; The simulation scheduling module is used to read the state of the EMS simulation system and call the EMS optimization algorithm to execute, so as to obtain the execution results of the EMS simulation system in different states.
8. The off-line simulation system of the EMS optimization algorithm according to claim 7, characterized in that: The algorithm execution result includes a battery charge and discharge plan, and the simulation scheduling module is further used to update the state of the battery simulation module according to the battery charge and discharge plan.
9. The off-line simulation system of the EMS optimization algorithm according to claim 7, characterized in that: It also includes a control simulation module, the execution result includes a battery charge and discharge plan, and the control simulation module is used to control the battery simulation module to perform charge and discharge and update the state of the battery simulation module according to the battery charge and discharge plan.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.