Optical storage micro-grid energy deployment method and system
Patent Information
- Application Number
- CN202611182824.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-09-25
AI Technical Summary
[0007]本发明的主要目的是提出一种光储微网能量调配方法和系统,旨在解决现有技术中因目标函数权重系数固定而难以适配每日差异化的运行场景、粒子群算法因随机性导致优化结果一致性差、以及日前开环控制无法有效应对预测偏差和实时需量变化的技术问题
[0018]本发明提供的光储微网能量调配方法及系统,通过日运行特征提取机制使遗传算法能够根据不同日期的光伏特征、负荷特征和电价特征对粒子群算法的目标函数权重进行个性化寻优,克服固定权重无法适配每日差异化运行场景的缺陷;通过用遗传算法优化得到的权重系数,引导粒子群算法进行日前储能充放电计划求解,提升优化结果对当日实际运行工况的匹配度;通过构建日间滚动优化模型并以日前计划为基准进行实时修正,使得在面临光伏出力和负荷预测偏差时能够动态调整储能功率设定值,弥补日前开环控制无法应对实时波动的不足;通过将上一控制步长的功率偏差作为反馈量引入当前优化模型,实现对功率跟踪误差的持续修正,有效抑制因设备响应延迟或测量误差导致的累积偏差,保障光储微电网在日前经济性最优与日内安全可靠运行之间的协调统一。
Smart Images

Figure CN122823399A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of microgrid energy management technology, and in particular to a method and system for energy allocation in a photovoltaic-storage microgrid. Background Technology
[0002] With the rapid development of distributed photovoltaic (PV) power generation and energy storage technologies, PV-storage microgrids have become an important form for industrial and commercial parks to achieve efficient utilization of green energy. Against the backdrop of a gradually improving electricity spot market, PV-storage microgrids need to utilize reasonable energy allocation strategies to fully leverage PV power generation to reduce electricity costs while meeting safe operation constraints, and to profit from peak-valley price arbitrage using energy storage systems.
[0003] Currently, day-ahead energy scheduling in photovoltaic-storage microgrids generally adopts a single day-ahead scheduling scheme based on optimization algorithms (such as particle swarm optimization), which optimizes the energy storage charge and discharge power sequence with fixed objective function weight coefficients. However, the above scheme still has the following shortcomings: First, in existing solutions, the objective function weight coefficients of the optimization algorithm are usually set manually based on experience and have fixed values. However, photovoltaic output, load electricity consumption, and electricity price fluctuations vary significantly across different days, and fixed weight coefficients cannot adapt to different daily operating scenarios. For example, on days with high photovoltaic output, the focus should be on increasing photovoltaic absorption rate; on days with high electricity price differences, the focus should be on increasing energy storage arbitrage profits; and on days with high load, the focus should be on suppressing load peaks. Manually fixing weights makes it difficult to achieve personalized adaptation of daily operating strategies, causing the optimization results to deviate from the actual optimal target for that day.
[0004] Second, the particle swarm optimization algorithm itself has inherent randomness, which makes it easy to get trapped in local optima when solving for the energy storage charging and discharging power sequence. This leads to inconsistent optimization results when running the same data multiple times, affecting the stability and reliability of the scheduling scheme.
[0005] Third, the day-ahead dispatch scheme is based on forecast data, but in actual operation, there are forecast errors in photovoltaic output and load. Relying solely on day-ahead open-loop control cannot effectively correct forecast deviations, causing the actual operating effect to deviate from expectations. In particular, in terms of demand control, the day-ahead scheme is difficult to accurately respond to real-time demand changes, which can easily lead to demand electricity cost overruns.
[0006] Therefore, there is an urgent need for a photovoltaic-storage microgrid energy allocation method that can adaptively adjust optimization weights based on daily operating characteristics, improve the consistency of optimization results, and have the ability to make real-time corrections within the day. Summary of the Invention
[0007] The main objective of this invention is to propose an energy allocation method and system for photovoltaic-storage microgrids, aiming to solve the technical problems in the prior art, such as the difficulty in adapting to daily differentiated operating scenarios due to the fixed weight coefficients of the objective function, the poor consistency of optimization results caused by the randomness of particle swarm optimization, and the inability of day-ahead open-loop control to effectively cope with prediction deviations and real-time demand changes.
[0008] To achieve the above objectives, the first aspect of this invention proposes a method for energy allocation in a photovoltaic-storage microgrid, comprising: Step S100: Obtain the day-ahead forecast data and extract the daily operating feature vector based on the day-ahead forecast data; the day-ahead forecast data includes the day-ahead forecast photovoltaic power output sequence, the day-ahead forecast load power consumption sequence, and the day-ahead forecast spot electricity price sequence; Step S200: Using the daily running feature vector as input, a genetic algorithm is used to optimize the combination of weight coefficients of the objective function of the particle swarm optimization algorithm to obtain the daily optimized weight coefficients; Step S300: Input the day-ahead optimization weight coefficients into the day-ahead optimization scheduling model, and use the particle swarm optimization algorithm to solve for the day-ahead energy storage charging and discharging power sequence; Step S400: Obtain real-time daytime state data, construct a daytime rolling optimization model based on the daytime energy storage charging and discharging power sequence, solve the model, and perform real-time correction on the daytime energy storage charging and discharging power sequence to obtain the daytime energy storage charging and discharging power sequence.
[0009] Preferably, step S100 includes: Step S110: Calculate the photovoltaic absorption characteristics based on the predicted photovoltaic power output sequence and the predicted load power consumption sequence; the photovoltaic absorption characteristics include the total daily photovoltaic power generation, the daily surplus photovoltaic power, and the photovoltaic self-consumption rate; Step S120: Calculate the load characteristics based on the predicted load power sequence; the load characteristics include total daily power consumption, daily peak load, daily load fluctuation, and the ratio of peak load to transformer capacity; Step S130: Calculate the electricity price characteristics based on the day-ahead forecasted spot electricity price sequence; the electricity price characteristics include the daily electricity price fluctuation and the maximum difference between the day-ahead electricity prices.
[0010] Preferably, step S200 includes: Step S210: Construct an initial population for the genetic algorithm. Each individual in the initial population contains a set of weight coefficient combinations to be optimized. The weight coefficient combinations include a first weight coefficient determined according to the photovoltaic absorption characteristics, a second weight coefficient determined according to the load characteristics, and a third weight coefficient determined according to the electricity price characteristics. Step S220: For each individual in the initial population, substitute the weight coefficient combination of the current individual into the objective function of the particle swarm optimization algorithm, and call the simplified particle swarm optimization process to perform a fast simulation of the current day prediction data, and use the optimal objective function value output by the simplified particle swarm optimization process as the fitness value of the current individual. Step S230: Based on the fitness value of each individual, perform a selection operation on the current population, and retain a predetermined number of individuals with the best fitness as elite individuals to directly enter the next generation of the population; Step S240: Perform crossover and mutation operations on the selected parent individuals to generate offspring individuals, and add the offspring individuals to the next generation population; Step S250: Repeat steps S220 to S240 until the preset maximum number of generations is reached, and output the weight coefficient combination corresponding to the individual with the best fitness in the final population as the current optimized weight coefficient.
[0011] Preferably, step S210 includes: Step S211: Construct the genotype of each individual in the initial population. The genotype is a three-dimensional vector composed of three weighted coefficient genes, corresponding to the first weighted coefficient, the second weighted coefficient and the third weighted coefficient respectively. The search space of each weighted coefficient is constrained between a preset upper limit and a lower limit of values. Step S212: When deploying for the first time or without accumulating historical operation data, calculate the ideal weight coefficient combination based on the daily operation feature vector, and randomly generate some individuals in the search space with the ideal weight coefficient combination as the mean and the preset standard deviation, while the remaining individuals are generated completely randomly in the search space. Step S213: When historical operation data has been accumulated, call the historical high-quality solution memory library. The historical high-quality solution memory library is used to store the weight coefficient combination marked as high-quality solution in the historical operation days and its corresponding daily operation feature vector. The daily operation feature vector includes the photovoltaic power output feature vector, load electricity consumption feature vector and spot electricity price feature vector of the historical operation days. Step S214: Calculate the Euclidean distance between the daily running feature vector and the feature vector of each record in the memory bank, sort them according to the Euclidean distance from smallest to largest, and select a preset number of records with the highest sorted number as candidate records; Step S215: Select a subset of individual weight coefficient combinations from the candidate records using a weighted roulette wheel method based on fitness values. Apply a random perturbation within a preset range to each selected weight coefficient combination to generate a first type of initial individual. The random perturbation is random noise with an amplitude not exceeding the preset range superimposed on each dimension of the weight coefficient combination. Step S216: Generate a second type of initial individuals according to the ideal weight coefficient combination, and generate a third type of initial individuals completely randomly within the search space. The first type of initial individuals, the second type of initial individuals, and the third type of initial individuals together constitute the complete initial population.
[0012] Preferably, step S240 includes: Step S241: Randomly select the first parent individual and the second parent individual from the parent population formed after the selection operation; Step S242: Determine whether to perform a crossover operation on the first parent individual and the second parent individual based on a preset crossover probability; when not performing a crossover operation, randomly select all genes of the first parent individual or the second parent individual as the genes of the offspring individual; when performing a crossover operation, perform arithmetic crossover on the three weight coefficient genes of the first parent individual and the three weight coefficient genes of the second parent individual respectively, and generate the weight coefficient genes of the offspring individual according to the following formula: In the formula, For the j-th weighted coefficient gene of the offspring individual, For the j-th weighted gene of the first parent individual, For the j-th weighted coefficient gene of the second parent individual, A random number in the range [0,1] that is independently generated along the j-th gene dimension; Step S243: Determine whether to perform a mutation operation on the offspring individuals generated after the crossover operation based on a preset mutation probability; when performing a mutation operation, a random perturbation is superimposed on each weight coefficient gene of the offspring individual, and the mutated weight coefficient genes are generated according to the following formula: In the formula, For the j-th weighted gene after mutation, It represents the random perturbation value uniformly sampled within a preset variation range on the j-th gene dimension; Step S244: Perform boundary constraint processing on each weight coefficient gene after the mutation operation, truncate gene values that exceed the preset upper or lower limit to the nearest boundary value, and supplement the offspring individuals after boundary constraint processing into the next generation population.
[0013] Preferably, step S300 includes: Step S310: Construct an initial population for the particle swarm optimization algorithm. Each particle in the initial population is a multi-dimensional vector. The number of dimensions of the multi-dimensional vector is the same as the total number of scheduling periods divided within the day-ahead scheduling cycle. Each dimension corresponds to the energy storage charging and discharging power value within a scheduling period. Perform intelligent initialization on some particles in the initial population. The intelligent initialization guides the values of each dimension of the particles towards a direction that is conducive to arbitrage based on the day-ahead predicted spot electricity price sequence. The remaining particles are randomly initialized in the search space. Step S320: For each particle in the initial population, the multidimensional vector of the particle is denormalized and then fed into the objective function of the particle swarm optimization algorithm to calculate the fitness value of each particle; the objective function of the particle swarm optimization algorithm adopts a multi-objective function weighted by the pre-day optimization weight coefficient, and the optimization objectives of the multi-objective function include maximizing photovoltaic consumption, maximizing energy storage arbitrage revenue, and minimizing load peak. Step S330: Update the individual historical optimal solution of each particle and the global optimal solution of the particle swarm based on the fitness value of each particle; the individual historical optimal solution is the position with the minimum fitness value found by the current particle in each iteration, and the global optimal solution is the position with the minimum fitness value found by all particles in each iteration. Step S340: Update the flight speed and position of each particle based on the individual historical optimal solution and the global optimal solution; Step S350: Repeat steps S320 to S340 until the preset maximum number of iterations is reached. The global optimal solution obtained at the end of the iteration is denormalized and output as the daytime energy storage charging and discharging power sequence.
[0014] Preferably, step S340 includes: Step S341: In each iteration, select a predetermined proportion of particles with the highest fitness values from the current particle swarm to form an elite particle set. Use a Gaussian mixture model to perform cluster analysis on the position distribution of the elite particle set in the solution space to obtain several Gaussian distribution components. Use the mean vector of each Gaussian distribution component as a candidate attractor. Step S342: The candidate attractors and the global optimal solution together constitute the attractor set for the current iteration. The attractors in the attractor set are deduplicated, and the strength value of each attractor is recorded. The strength value is negatively correlated with the average fitness value of the elite particle that generated the attractor, that is, the smaller the average fitness value, the higher the strength value. Step S343: For each particle in the current particle swarm, calculate the Euclidean distance between the particle's current position and each attractor in the attractor set, and calculate the adaptive weight of the particle's influence by each attractor based on the Euclidean distance and the intensity value. The adaptive weight is proportional to the intensity value and inversely proportional to the square of the Euclidean distance. Step S344: Update the particle's velocity according to the following formula: In the formula, Let be the velocity vector of the i-th particle in the (t+1)-th iteration. Let be the inertia weight for the t-th iteration. Let be the velocity vector of the i-th particle in the t-th iteration. For individual learning factors, The acceleration weight vector is randomly generated within the range [0,1]. Let be the individual historical best position of the i-th particle. Let be the position vector of the i-th particle in the t-th iteration. For attractor learning factors, Let be the set of attractors in the t-th iteration. The number of attractors in the set of attractors. Let be the position vector of the k-th attractor. The adaptive weights for the influence of the k-th attractor on the i-th particle; Step S345: Update the position of the particle according to the following formula: Step S346: Perform boundary constraint processing on the updated flight speed and position of each particle, truncate the speed values that exceed the preset speed limit to the speed limit, and truncate the position values that exceed the search space boundary to the nearest boundary value.
[0015] Preferably, in step S320, the objective function of the particle swarm optimization algorithm is: In the formula, This is the fitness value; These are the three weight coefficients in the weight coefficient combination obtained by the genetic algorithm optimization. This is used to adjust the weight of the photovoltaic power consumption optimization objective in the objective function. This is used to adjust the weight of the energy storage arbitrage optimization objective in the objective function. This is used to adjust the weight of the load smoothing optimization objective in the objective function; Optimize target values for photovoltaic power consumption; Optimize target values for energy storage arbitrage; Optimize target values for load smoothing; Penalty item for exceeding energy storage capacity limits; This is a penalty term for exceeding the absolute boundary of the charged state; This is a penalty item for exceeding the transformer capacity limit; Penalty for exceeding the operating limit in the charged state operating range; Penalties for energy storage systems transmitting data back to the grid; This is a penalty term for arbitrage threshold constraints; Penalties for unreasonable electricity price trends; Incentives for photovoltaic power generation and charging; Incentives for charging at the lowest electricity price point; This is the discharge excitation term at the point of highest electricity price.
[0016] Preferably, step S400 includes: Step S410: Obtain daytime real-time status data and ultra-short-term forecast data. The daytime real-time status data includes the current actual photovoltaic power, actual load power, actual grid interaction power, current energy storage state of charge, and actual energy storage charging and discharging power. The ultra-short-term forecast data includes a photovoltaic power forecast sequence and a load power forecast sequence within a preset future time period. Step S420: Construct an inter-day rolling optimization model. The optimization variable of the inter-day rolling optimization model is a sequence of energy storage power adjustment amounts with a preset number of control steps in the future. The power value at the corresponding moment in the day-ahead energy storage charging and discharging power sequence is superimposed with each adjustment amount in the energy storage power adjustment amount sequence to obtain the energy storage power setpoint. The objective function of the inter-day rolling optimization model includes a real-time optimization term for photovoltaic consumption, a real-time optimization term for energy storage arbitrage, a demand control term, and a tracking term for the day-ahead plan. The tracking term for the day-ahead plan includes a tracking sub-item for energy storage power adjustment amount and a tracking sub-item for state of charge, which are used to constrain the deviation of the energy storage power adjustment amount and the state of charge amount from the day-ahead plan, respectively. The constraints of the inter-day rolling optimization model include upper and lower bound constraints for energy storage power, upper and lower bound constraints for energy storage state of charge, and transformer capacity constraints. The upper and lower bound constraints for energy storage power are dynamically calculated based on the current energy storage state of charge. Step S430: Solve the daytime rolling optimization model, take the first adjustment value in the solution result, and superimpose it with the power value at the corresponding moment in the daytime energy storage charging and discharging power sequence to obtain the power setpoint value sent to the energy storage converter at the current control step size; Step S440: Obtain the deviation between the power setpoint issued in the previous control step and the actual power value executed by the energy storage converter. Introduce the deviation as an additional term into the tracking term of the daytime plan in the daytime rolling optimization model of the current control step, so that the daytime rolling optimization model takes into account the correction of the power deviation when solving, so as to suppress the accumulation of power tracking deviation caused by prediction error or equipment response delay.
[0017] A second aspect of this invention provides a photovoltaic-storage microgrid energy allocation system, comprising: The data acquisition and feature extraction module is used to acquire day-ahead forecast data and extract daily operating feature vectors based on the day-ahead forecast data; the day-ahead forecast data includes the day-ahead forecast photovoltaic power output sequence, the day-ahead forecast load power consumption sequence, and the day-ahead forecast spot electricity price sequence; The weight optimization module is used to optimize the combination of weight coefficients based on the daily operating feature vector using a genetic algorithm to obtain the daily optimized weight coefficients. The day-ahead planning generation module is used to optimize and solve the day-ahead prediction energy storage charging and discharging power sequence by using the particle swarm optimization algorithm based on the day-ahead optimized weight coefficients and the day-ahead prediction data. The daytime correction module is used to acquire real-time daytime state quantities, construct and solve a daytime rolling optimization model based on the daytime energy storage charging and discharging power sequence and the daytime real-time state quantities, and perform real-time correction on the daytime energy storage charging and discharging power sequence to obtain the daytime energy storage charging and discharging power sequence.
[0018] The energy allocation method and system for photovoltaic-storage microgrids provided by this invention enable the genetic algorithm to perform personalized optimization of the objective function weights of the particle swarm optimization algorithm based on the photovoltaic characteristics, load characteristics, and electricity price characteristics of different days through a daily operation feature extraction mechanism. This overcomes the defect that fixed weights cannot adapt to the differentiated daily operation scenarios. By using the weight coefficients obtained by the genetic algorithm optimization, the particle swarm optimization algorithm is guided to solve the day-ahead energy storage charging and discharging plan, improving the matching degree of the optimization results with the actual operating conditions of the day. By constructing a daytime rolling optimization model and making real-time corrections based on the day-ahead plan, the energy storage power setpoint can be dynamically adjusted when faced with deviations in photovoltaic output and load forecasts, compensating for the inability of day-ahead open-loop control to cope with real-time fluctuations. By introducing the power deviation of the previous control step as a feedback quantity into the current optimization model, continuous correction of power tracking error is achieved, effectively suppressing the cumulative deviation caused by equipment response delay or measurement error, and ensuring the coordination and unity between the optimal day-ahead economy and safe and reliable intraday operation of the photovoltaic-storage microgrid.
[0019] Furthermore, this invention also improves the green electricity consumption level by extracting photovoltaic (PV) absorption characteristics to enable the genetic algorithm to perceive the daily PV generation intensity and adaptively adjust the absorption target weights; improves the load smoothing effect and operational safety margin by extracting load characteristics to perceive the degree of fluctuation and transformer margin; improves the arbitrage profit capture capability by extracting electricity price characteristics to perceive the price difference space; constructs a daily operation feature vector through feature normalization to provide a data-driven basis for weight optimization, avoiding reliance on manual experience; drives the genetic algorithm optimization through the daily operation feature vector to adaptively match the weight coefficients to the daily operating conditions; uses simplified PSO rapid simulation as a fitness evaluation basis to effectively verify the merits of the weights in actual optimization scenarios; and retains elites. This algorithm employs a combination of selection, crossover, and mutation to avoid premature convergence; a two-layer optimization architecture to improve overall economy and operational adaptability; the generation of initial individuals centered on ideal weights to improve the quality of the initial solution during the first deployment; the inheritance of historical high-quality genes similar to the current working conditions through a historical high-quality solution memory and Euclidean distance matching; the introduction of appropriate mutations to avoid premature convergence while inheriting high-quality genes through weighted roulette wheel selection and perturbation; the maintenance of population diversity by having three types of individuals jointly constitute the population to improve algorithm adaptability; arithmetic crossover to allow offspring to inherit the superior genes of both parents, improving the efficiency of search space exploration; random perturbation mutation to maintain population diversity and avoid local optima; and a balance between gene inheritance and diversity achieved through crossover and mutation probabilities. Achieving a balance improves the robustness of the global search; boundary constraints ensure that offspring always remain in the effective search space; intelligent initialization guides particles to distribute towards electricity price arbitrage, shortening convergence time; a dynamic inertia weight reduction strategy balances global exploration and local fine-grained optimization; boundary constraints ensure particles remain in the effective search space, improving algorithm stability; Gaussian mixture model clustering extracts multiple candidate attractors, avoiding population diversity loss caused by a single global optimum; candidate attractors and the global optimum together form an attractor set, enhancing particle perception of valuable regions; adaptive weights based on distance and intensity achieve differentiated multi-directional guidance; weighted summation of multiple attractors replaces a single global optimum, improving... The system aims to improve convergence stability and solution quality; enhance the ability to escape local optima by periodically resetting particles; achieve unified evaluation of objectives with different dimensions by weighted summation of three normalized optimization objectives; improve safety by guiding particles away from infeasible regions through seven quadratic penalty terms; enhance adaptability to different constraint types by flexibly switching between two penalty methods; guide particles to evolve towards higher returns through three incentive terms; improve the response speed to changes in actual operating conditions through ultra-short-term forecast rolling correction; avoid real-time decisions deviating from the economic optimization direction by tracking the daily plan; improve the accuracy of demand management by suppressing demand peaks in real time through demand control terms; and suppress the accumulation of power tracking deviation through feedback deviation closed-loop correction.
[0020] In summary, the energy allocation method and system for photovoltaic-storage microgrids proposed in this invention solves the technical problems in the prior art, such as the difficulty in adapting to daily differentiated operating scenarios due to the fixed weight coefficients of the objective function, the poor consistency of optimization results caused by the randomness of the particle swarm optimization algorithm, and the inability of day-ahead open-loop control to effectively cope with prediction deviations and real-time demand changes. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0022] Figure 1 A flowchart of a photovoltaic-storage microgrid energy allocation method provided in an embodiment of the present invention; Figure 2 A flowchart of a daily operation feature vector extraction method provided in an embodiment of the present invention; Figure 3 A flowchart of a day-ahead optimization weight coefficient search method based on a genetic algorithm provided in an embodiment of the present invention; Figure 4 This is a flowchart of a genetic algorithm initial population construction method provided in an embodiment of the present invention; Figure 5 This is a flowchart of a genetic algorithm crossover and mutation operation method provided in an embodiment of the present invention; Figure 6 A flowchart of a day-ahead energy storage charge-discharge power sequence solution method based on particle swarm optimization algorithm provided in an embodiment of the present invention; Figure 7 A flowchart of a particle swarm optimization method guided by multimodal distribution estimation provided in an embodiment of the present invention; Figure 8 A flowchart of a daytime rolling optimization correction method provided in an embodiment of the present invention; Figure 9 This is a schematic diagram of a photovoltaic-storage microgrid energy allocation system provided in an embodiment of the present invention; Figure 10 This is a schematic diagram of the structure of a photovoltaic-storage microgrid energy allocation computer device provided in an embodiment of the present invention; Figure 11 This is a schematic diagram of the actual annual load curve of a transformer provided in an embodiment of the present invention; Figure 12 This is a schematic diagram of a typical daily load curve obtained by adaptive neural network clustering according to an embodiment of the present invention; Figure 13A schematic diagram of the simulation results for the first day provided in an embodiment of the present invention; Figure 14 A schematic diagram of the simulation results for the second day provided in an embodiment of the present invention; Figure 15 This is a schematic diagram of the simulation results on the third day according to an embodiment of the present invention; Figure 16 This is a schematic diagram of the simulation results on the fourth day according to an embodiment of the present invention; Figure 17 This is a schematic diagram of the simulation results on the fifth day according to an embodiment of the present invention; Figure 18 A schematic diagram of the simulation results on the sixth day provided in an embodiment of the present invention; Figure 19 This is a schematic diagram of the simulation results on the seventh day according to an embodiment of the present invention.
[0023] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] It should be noted that if the embodiments of the present invention involve directional indicators, such as up, down, left, right, front, back, etc., the directional indicators are only used to explain the relative positional relationship and movement of the components in a specific posture. If the specific posture changes, the directional indicators will also change accordingly.
[0026] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the meaning of "and / or" throughout the text includes three parallel solutions; for example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0027] like Figures 1 to 8 As shown, the first aspect of this invention proposes a method for energy allocation in a photovoltaic-storage microgrid, comprising: Step S100: Obtain the day-ahead forecast data and extract the daily operating feature vector based on the day-ahead forecast data; the day-ahead forecast data includes the day-ahead forecast photovoltaic power output sequence, the day-ahead forecast load power consumption sequence, and the day-ahead forecast spot electricity price sequence; Step S200: Using the daily running feature vector as input, a genetic algorithm is used to optimize the combination of weight coefficients of the objective function of the particle swarm optimization algorithm to obtain the daily optimized weight coefficients; Step S300: Input the day-ahead optimization weight coefficients into the day-ahead optimization scheduling model, and use the particle swarm optimization algorithm to solve for the day-ahead energy storage charging and discharging power sequence; Step S400: Obtain real-time daytime state data, construct a daytime rolling optimization model based on the daytime energy storage charging and discharging power sequence, solve the model, and perform real-time correction on the daytime energy storage charging and discharging power sequence to obtain the daytime energy storage charging and discharging power sequence.
[0028] For details, see Figure 1As shown, in a specific embodiment of the present invention, the following steps are first taken: First, the predicted photovoltaic power output sequence, load power consumption sequence, and spot electricity price sequence are obtained. Each data sequence contains predicted values for 24 scheduling periods at an hourly granularity. Simultaneously, equipment parameters are read, including transformer capacity, photovoltaic capacity, energy storage capacity, energy storage capacity, energy storage efficiency, and SOC (State of Charge) limit. Then, photovoltaic absorption characteristics are calculated based on the photovoltaic power output sequence and load power consumption sequence, load characteristics are calculated based on the load power consumption sequence, and electricity price characteristics are calculated based on the spot electricity price sequence, collectively forming a daily operating feature vector. Next, using the daily operating feature vector as input, an initial population for a genetic algorithm is constructed. Each individual in the population contains a set of weight coefficients to be optimized, used to adjust the proportions of the three optimization objectives—photovoltaic absorption, energy storage arbitrage, and load smoothing—in the particle swarm optimization objective function. For each individual in the population, the current individual's weight coefficient combination is substituted into the objective function of the particle swarm optimization algorithm, and a simplified particle swarm optimization process is called to quickly simulate the predicted data for the day-ahead, simplifying the optimal output of the particle swarm optimization process. The objective function value is used as the fitness value of the individual. Based on the fitness values of each individual, selection, crossover, and mutation operations are performed on the current population to generate a new generation of population. The above evaluation and evolution operations are repeated until the preset maximum number of generations is reached. The weight coefficient combination corresponding to the individual with the best fitness in the final population is used as the day-ahead optimization weight coefficient output. The day-ahead optimization weight coefficient is input into the day-ahead optimization scheduling model to construct the initial population of the particle swarm optimization algorithm. Each particle is a multi-dimensional vector with the same number of dimensions as the total number of scheduling periods in the day-ahead scheduling cycle. Each dimension corresponds to the energy storage charging and discharging power value in a scheduling period. Intelligent initialization is performed on some particles based on the spot electricity price sequence to guide them toward the direction that is conducive to electricity price arbitrage. The remaining particles are randomly initialized in the search space. The fitness value of each particle is calculated. The individual's historical optimal solution and global optimal solution are updated according to the fitness value, and then the flight speed and position of each particle are updated. This process is repeated until the preset maximum number of iterations is reached. The global optimal solution obtained at the end of the iteration is denormalized and used as the day-ahead energy storage charging and discharging power sequence output.After entering the intraday operation phase, real-time status quantities are acquired at each control step, including the current actual photovoltaic power, actual load power, actual grid interaction power, current energy storage state of charge, and actual energy storage charging and discharging power. Furthermore, ultra-short-term photovoltaic power prediction sequences and load power prediction sequences for a preset future time period are obtained. Based on the day-ahead energy storage charging and discharging power sequence, an intraday rolling optimization model is constructed. The optimization variable is the energy storage power adjustment sequence for a preset number of control steps in the future. The power value at the corresponding moment in the day-ahead energy storage charging and discharging power sequence is superimposed with each adjustment quantity to obtain the energy storage power setpoint. The objective function of this model includes real-time optimization terms for photovoltaic consumption, real-time optimization terms for energy storage arbitrage, demand control terms, and tracking terms for day-ahead plans. Constraints are... The system includes upper and lower bound constraints on energy storage power, upper and lower bound constraints on state of charge, and transformer capacity constraints, dynamically calculated based on the current energy storage state of charge. After solving the daytime rolling optimization model, the first adjustment value is superimposed with the power value at the corresponding moment in the daytime energy storage charge and discharge power sequence to obtain the power setpoint issued to the energy storage converter at the current control step. Simultaneously, the deviation between the power setpoint of the previous control step and the actual power executed by the energy storage converter is obtained. This deviation is introduced as an extra term into the daytime plan tracking term of the daytime rolling optimization model at the current control step, allowing the model to consider power deviation correction during the solution process. Thus, the above optimization and correction process is executed in each control step, achieving continuous updating and closed-loop control of the daytime energy storage charge and discharge power sequence. The basic parameters are shown in Table 1 and the intermediate parameters are shown in Table 2 below. Table 1 Basic Parameter Table Table 2 Intermediate Parameter Table Understandably, this embodiment uses a daily operation feature extraction mechanism to enable the genetic algorithm to personalize the objective function weights of the particle swarm optimization algorithm based on the photovoltaic characteristics, load characteristics, and electricity price characteristics of different days, overcoming the defect that fixed weights cannot adapt to the differentiated daily operation scenarios. By using the weight coefficients obtained by the genetic algorithm optimization, the particle swarm optimization algorithm is guided to solve the day-ahead energy storage charging and discharging plan, improving the matching degree of the optimization results with the actual operating conditions of the day. By constructing a daytime rolling optimization model and making real-time corrections based on the day-ahead plan, the energy storage power setpoint can be dynamically adjusted when facing deviations in photovoltaic output and load forecasts, making up for the inability of day-ahead open-loop control to cope with real-time fluctuations. By introducing the power deviation of the previous control step as a feedback quantity into the current optimization model, continuous correction of power tracking error is achieved, effectively suppressing the cumulative deviation caused by equipment response delay or measurement error, and ensuring the coordination and unity between the optimal day-ahead economy and safe and reliable intraday operation of the photovoltaic-storage microgrid.
[0029] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the elite retention strategy based on fitness value sorting in the genetic algorithm can be replaced with a multi-objective retention strategy based on crowding distance sorting to enhance population diversity; or the demand control term in the daytime rolling optimization model can be replaced with a peak penalty based on a fixed demand statistical period and an advance adjustment mechanism based on demand prediction to enhance the demand suppression effect.
[0030] Preferably, step S100 includes: Step S110: Calculate the photovoltaic absorption characteristics based on the predicted photovoltaic power output sequence and the predicted load power consumption sequence; the photovoltaic absorption characteristics include the total daily photovoltaic power generation, the daily surplus photovoltaic power, and the photovoltaic self-consumption rate; Step S120: Calculate the load characteristics based on the predicted load power sequence; the load characteristics include total daily power consumption, daily peak load, daily load fluctuation, and the ratio of peak load to transformer capacity; Step S130: Calculate the electricity price characteristics based on the day-ahead forecasted spot electricity price sequence; the electricity price characteristics include the daily electricity price fluctuation and the maximum difference between the day-ahead electricity prices.
[0031] For details, see Figure 2 As shown, in a specific embodiment of the present invention, historical daily operation data is first read, including the day-ahead predicted photovoltaic power generation for each scheduling period. Y PV1h Forecasted load power U Load1h And the recent forecast for spot electricity prices EP 1h Based on the above data, key system daily features, including photovoltaic absorption characteristics, load characteristics, and electricity price characteristics, are extracted to guide the evolution of weighting coefficients. The extracted features are then normalized to form a daily operation feature vector.
[0032] Photovoltaic grid integration characteristics include total daily photovoltaic power generation. Y PV1d , solar photovoltaic residual power Y PVR1d Photovoltaic self-consumption rate P PVC It is calculated according to the following formula: Photovoltaic power generation during all scheduling periods The total daily photovoltaic power generation is obtained by summing them up. YPV1d Photovoltaic power generation for each scheduling period Subtract load power If the difference is negative, it is set to zero; if the difference is positive, its absolute value is taken. The absolute values of the differences for all scheduling periods are summed to obtain the daily surplus photovoltaic power. Y PVR1d Total daily photovoltaic power generation Y PV1d Subtract daily surplus solar power Divide by the total daily photovoltaic power generation Y PV1d Obtain the photovoltaic self-consumption rate .
[0033] Load characteristics include total daily electricity consumption U Load1d Daily load peak U Load1hmax Daily load fluctuation std ULoad1h (Standard deviation), peak load With transformer capacity ratio P Lmax As shown in the following formula: Load power for all scheduling periods The total daily electricity consumption is obtained by summing them up. , Load power during all scheduling periods The maximum value is selected as the daily load peak. Calculate the standard deviation of load power for all scheduling periods. std ULoad1h As a daily load fluctuation, the daily load peak Divide by transformer capacity The ratio of peak load to transformer capacity is obtained. .
[0034] Electricity price characteristics include daily electricity price fluctuations std EP (Standard deviation), maximum difference in day-ahead electricity prices EP maxdifference As shown in the following formula: First, calculate the standard deviation (std) of spot electricity prices for all dispatch periods. EP As the daily electricity price fluctuation, then the maximum value of the spot electricity price during all dispatch periods. Subtract the minimum value Get the maximum difference in day-to-day electricity prices .
[0035] After feature extraction, a normalized daily operation feature vector is constructed based on the above daily operation features. The photovoltaic self-consumption rate is a ratio between 0 and 1, and the ratio of peak load to transformer capacity is also a ratio between 0 and 1. Both are directly calculated using their original values. The daily electricity price fluctuation is normalized using the maximum difference in the day-ahead electricity price. The daily load fluctuation is normalized using the maximum fluctuation value of the load power in all dispatch periods. Finally, a daily operation feature vector containing four elements—photovoltaic self-consumption rate, normalized electricity price fluctuation, peak load rate, and normalized load fluctuation—is formed, which is used for subsequent genetic algorithm optimization of the weight coefficients.
[0036] Understandably, this embodiment extracts photovoltaic (PV) consumption characteristics, load characteristics, and electricity price characteristics, enabling the genetic algorithm to adaptively adjust the weights of each optimization objective based on the daily PV generation intensity, load fluctuation severity, and electricity price difference, thereby improving the matching degree of the weight coefficients to the differentiated operating scenarios of the day. By normalizing the above features, a daily operating feature vector is constructed, providing the genetic algorithm with data-driven basis that matches the daily operating conditions, improving the accuracy and adaptability of weight coefficient optimization, and avoiding the imbalance of optimization objectives caused by relying on fixed weight settings based on human experience.
[0037] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the daily load fluctuation can be replaced by the maximum load change rate instead of the standard deviation to more directly reflect the degree of sudden load change; or the time-series correlation coefficient between photovoltaic output and load electricity consumption can be added as a supplementary feature to reflect the degree of matching between photovoltaic output and load demand in the time dimension.
[0038] Preferably, step S200 includes: Step S210: Construct an initial population for the genetic algorithm. Each individual in the initial population contains a set of weight coefficient combinations to be optimized. The weight coefficient combinations include a first weight coefficient determined according to the photovoltaic absorption characteristics, a second weight coefficient determined according to the load characteristics, and a third weight coefficient determined according to the electricity price characteristics. Step S220: For each individual in the initial population, substitute the weight coefficient combination of the current individual into the objective function of the particle swarm optimization algorithm, and call the simplified particle swarm optimization process to perform a fast simulation of the current day prediction data, and use the optimal objective function value output by the simplified particle swarm optimization process as the fitness value of the current individual. Step S230: Based on the fitness value of each individual, perform a selection operation on the current population, and retain a predetermined number of individuals with the best fitness as elite individuals to directly enter the next generation of the population; Step S240: Perform crossover and mutation operations on the selected parent individuals to generate offspring individuals, and add the offspring individuals to the next generation population; Step S250: Repeat steps S220 to S240 until the preset maximum number of generations is reached, and output the weight coefficient combination corresponding to the individual with the best fitness in the final population as the current optimized weight coefficient.
[0039] For details, see Figure 3 As shown, in a specific embodiment of the present invention, a genetic algorithm initial population is constructed using the daily operating feature vector as input. Each individual in the population contains a set of weight coefficient combinations to be optimized, which are used to adjust the proportions of the three optimization objectives—photovoltaic consumption, energy storage arbitrage, and load smoothing—in the particle swarm objective function. In one possible embodiment, when constructing the initial population, the ideal weight coefficient combination is first calculated based on the daily operating feature vector. The ideal value of the first weight coefficient is negatively correlated with the photovoltaic self-consumption rate; the lower the photovoltaic self-consumption rate, the higher the ideal value of the first weight coefficient to enhance photovoltaic consumption. The calculation is performed according to the following formula: In the formula, This represents the ideal value of the first weighting coefficient; This indicates the preset upper limit of the weighting coefficient; This indicates the self-consumption rate of photovoltaic power generation.
[0040] The ideal value of the second weighting coefficient is positively correlated with the normalized electricity price fluctuation, and is also constrained by the photovoltaic (PV) grid integration level. When the PV self-consumption rate is not less than 80%, the ideal value of the second weighting coefficient fully follows the electricity price fluctuation. When the PV self-consumption rate is less than 80%, the ideal value of the second weighting coefficient is reduced by 20% to prioritize PV grid integration, calculated according to the following formula: In the formula, This represents the ideal value of the second weighting coefficient; This indicates fluctuations in electricity prices; This indicates the maximum difference in electricity prices up to the day.
[0041] The ideal value of the third weighting coefficient is positively correlated with peak load rate and load volatility. The higher the peak load rate and the greater the load volatility, the more urgent the need for energy storage to smooth the load. It is calculated according to the following formula: In the formula, This represents the ideal value of the third weighting coefficient; This represents the ratio of peak load to transformer capacity. This indicates daily load fluctuations.
[0042] After calculating the ideal weight coefficient combination, the energy management system applies random perturbation to generate individuals in the initial population within the preset search space, centered on the ideal weight coefficient combination. This causes the weight coefficient gene of each individual to fluctuate around the ideal value within a certain range, thus providing the genetic algorithm with an initial solution set that is both directional and diverse. The optimization range of each weight coefficient in the search space is defined as 0 to 10. w GAmin to w GAmax Population size N GA Set to 50, maximum number of generations. D GA Set to 100. For each individual in the population, substitute the current individual's weight coefficient combination into the objective function of the particle swarm optimization algorithm, and call the simplified particle swarm optimization process to perform a fast simulation on the current predicted data, that is, run the particle swarm optimization with a lower number of particles and fewer iterations. The optimal objective function value output by the simplified particle swarm optimization process is used as the fitness value of that individual. Based on the fitness values of each individual, perform a roulette wheel selection operation on the current population. Take the reciprocal of the original fitness value of each individual and add a very small positive number ε to avoid division by zero error. The original fitness value is then calculated according to the following formula. Converted to a form that facilitates the calculation of selection probabilities form: A higher transformed fitness value indicates better fitness. The transformed fitness values of all individuals are then normalized to calculate the probability of each individual being selected. Calculate according to the following formula: Based on the calculated probability distribution, a predetermined number of individuals are randomly selected from the current population with replacement to serve as parents for the next generation, ensuring that individuals with better fitness have a higher probability of being selected multiple times. Then, an elite retention operation is performed, sorting all individuals in the current population in ascending order of their original fitness values, and selecting the top... n elit Two individuals (two in this example) with the best fitness are unconditionally and unchanged retained in the next generation population to ensure the convergence of the algorithm and avoid the loss of excellent genes. The selected parent individuals are then crossovered with a probability of 0.8. P cross Perform an arithmetic crossover operation, recombine the weight coefficients of the two parent individuals to generate new offspring individuals, and then perform a mutation with a probability of 0.1. P mutaTo maintain population diversity, a small random perturbation is applied to the weight coefficients of offspring individuals, and all generated offspring individuals are added to the next generation population. The fitness assessment, selection, elite retention, crossover, and mutation operations are repeated until the preset maximum number of generations, 100, is reached. Finally, the weight coefficient combination corresponding to the individual with the best fitness is selected from the last generation population. The weights are output as day-ahead optimization weights and used in the particle swarm optimization algorithm in subsequent day-ahead optimization scheduling models. The following table shows the GA optimization algorithm parameters: Table 3 Parameter Table for GA Optimization Algorithm Understandably, this embodiment improves the quality of the initial solution and search efficiency by calculating the ideal values of each weight coefficient based on the daily operating feature vector and applying perturbations centered on the ideal values to generate an initial population; it also improves the quality of the initial solution and search efficiency by adaptively adjusting the ideal values of the first weight coefficient based on the photovoltaic self-consumption rate to strengthen grid integration on days with high photovoltaic power generation and reduce excessive constraints on days with insufficient photovoltaic power generation; it further improves the quality of the initial solution and search efficiency by adjusting the ideal values of the second weight coefficient based on the photovoltaic self-consumption rate to fully exploit arbitrage when grid integration pressure is low and prioritize photovoltaic grid integration when grid integration pressure is high; it further improves the coordination and optimization of photovoltaic grid integration and energy storage arbitrage by adaptively adjusting the ideal values of the third weight coefficient based on the peak load rate and load volatility to strengthen demand suppression in high load and strong fluctuation scenarios and reduce unnecessary restrictions in low load and weak fluctuation scenarios; and it maintains population diversity while ensuring the quality of the initial solution by applying random perturbations centered on the ideal weights to generate an initial population.
[0043] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, roulette wheel selection can be replaced with tournament selection to reduce the impact of fitness value scale differences on selection pressure; or the fixed mutation probability can be replaced with adaptive mutation probability, so that the mutation rate is dynamically adjusted with the number of generations to take into account both early exploration and later convergence; or the fixed number of iterations in the simplified particle swarm can be replaced with an early stopping mechanism based on fitness improvement rate to reduce unnecessary computational overhead; or the upper limit of the search space of the weight coefficient can be adjusted from 10 to other values to adapt to the optimization target requirements of different orders of magnitude.
[0044] Preferably, step S210 includes: Step S211: Construct the genotype of each individual in the initial population. The genotype is a three-dimensional vector composed of three weighted coefficient genes, corresponding to the first weighted coefficient, the second weighted coefficient and the third weighted coefficient respectively. The search space of each weighted coefficient is constrained between a preset upper limit and a lower limit of values. Step S212: When deploying for the first time or without accumulating historical operation data, calculate the ideal weight coefficient combination based on the daily operation feature vector, and randomly generate some individuals in the search space with the ideal weight coefficient combination as the mean and the preset standard deviation, while the remaining individuals are generated completely randomly in the search space. Step S213: When historical operation data has been accumulated, call the historical high-quality solution memory library. The historical high-quality solution memory library is used to store the weight coefficient combination marked as high-quality solution in the historical operation days and its corresponding daily operation feature vector. The daily operation feature vector includes the photovoltaic power output feature vector, load electricity consumption feature vector and spot electricity price feature vector of the historical operation days. Step S214: Calculate the Euclidean distance between the daily running feature vector and the feature vector of each record in the memory bank, sort them according to the Euclidean distance from smallest to largest, and select a preset number of records with the highest sorted number as candidate records; Step S215: Select a subset of individual weight coefficient combinations from the candidate records using a weighted roulette wheel method based on fitness values. Apply a random perturbation within a preset range to each selected weight coefficient combination to generate a first type of initial individual. The random perturbation is random noise with an amplitude not exceeding the preset range superimposed on each dimension of the weight coefficient combination. Step S216: Generate a second type of initial individuals according to the ideal weight coefficient combination, and generate a third type of initial individuals completely randomly within the search space. The first type of initial individuals, the second type of initial individuals, and the third type of initial individuals together constitute the complete initial population.
[0045] For details, see Figure 4 As shown, in a specific embodiment of the present invention, when constructing the initial population of the genetic algorithm, the genotype of each individual in the population is first constructed. Each individual is a three-dimensional vector composed of three weighted genes, each corresponding to a first weighted gene. Second weighting coefficient and the third weighting coefficient The values of each weight coefficient are constrained to a preset upper and lower limit, and the search space is defined as 0 to 10. In the initial deployment or when historical operating data has not been accumulated, an ideal weight coefficient combination is calculated based on the daily operating feature vector. Using this ideal weight coefficient combination as the mean and a preset standard deviation, some individuals are randomly generated within the search space, while the remaining individuals are generated completely randomly within the search space, thus forming the initial population. When historical operating data has been accumulated, the historical high-quality solution memory is invoked. This memory stores the weight coefficient combinations marked as high-quality solutions in historical operating days and their corresponding daily operating feature vectors, specifically including the photovoltaic output feature vector, load electricity consumption feature vector, and spot electricity price feature vector for historical operating days. The Euclidean distance between the daily operating feature vector and the feature vector of each record in the memory is used as the feature similarity. The Euclidean distance is calculated according to the following formula: In the formula, This represents feature similarity; the smaller the value, the more similar the two feature vectors are. This represents the value of the k-th feature component in the daily operational feature vector. This represents the value of the k-th feature component in the daily operational feature vector corresponding to a certain record in the memory bank; n This represents the dimension of the feature vector.
[0046] Sort the records by Euclidean distance from smallest to largest (i.e., from highest to lowest similarity), and select a predetermined number of records from the top of the sorted list as candidate records. Then, select a subset of individuals from the candidate records using a weighted roulette wheel method based on their fitness values. For each selected weighted coefficient combination, add random noise with an amplitude not exceeding a predetermined value to each dimension. Generate the first type of initial individuals according to the following formula: In the formula, The gene value representing the weight coefficient in the j-th dimension of the first type of initial individual generated; This represents the weight coefficient gene value of the i-th record in the j-th dimension among the selected candidate records; Represented as the range of the preset amplitude in the j-th dimension. Random noise values sampled uniformly within the area; This indicates the preset upper limit of the disturbance amplitude.
[0047] Simultaneously, based on the ideal weighting coefficient combination Random noise within a preset amplitude range is superimposed on each dimension, and the second type of initial individuals is generated according to the following formula: In the formula, This represents the weight coefficient gene value of the second type of initial individual in the j-th dimension; This represents the gene value of the weight coefficients in the j-th dimension of the ideal weight coefficient combination; This indicates that the j-th dimension falls within a preset range. Random noise values sampled uniformly within the area; This indicates the preset upper limit of the disturbance amplitude.
[0048] And generate the third type of initial individuals completely randomly within the search space according to the following formula: In the formula, This represents the weight coefficient gene value of the generated third-class initial individual in the j-th dimension; This indicates the preset lower limit of the weighting coefficient; This indicates the preset upper limit of the weighting coefficient; This represents a random number that is uniformly distributed in the range of 0 to 1 in the j-th dimension.
[0049] Finally, the first type of initial individuals, the second type of initial individuals, and the third type of initial individuals together constitute the complete initial population.
[0050] Understandably, this embodiment improves the quality of the initial solution and the search starting point during the first deployment by generating a subset of initial individuals centered around an ideal weight coefficient combination; by calling the historical high-quality solution memory and performing feature similarity matching based on Euclidean distance when historical data has been accumulated, the initial population inherits historical high-quality genes similar to the current working conditions, improving the matching degree between the initial solution and the current scenario; by selecting individuals from candidate records according to a fitness value weighted roulette wheel method and applying random perturbation to the selected solutions, moderate mutation is introduced to increase population diversity while inheriting high-quality genes, avoiding premature convergence; by having the initial population composed of three types of individuals: those derived from historical high-quality solutions, those derived from ideal weights, and completely random individuals, the population maintains broad diversity while making full use of historical experience and theoretical guidance, improving the adaptability and robustness of the genetic algorithm in different scenarios.
[0051] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the Euclidean distance of feature similarity can be replaced with cosine similarity to focus on the direction of feature vectors rather than amplitude differences; or the candidate record selection method of the memory bank can be changed from a fixed number to dynamic screening based on similarity thresholds to adapt to matching requirements under different feature distributions; or roulette wheel selection can be replaced with tournament selection to reduce the impact of fitness value scale differences on selection pressure.
[0052] Preferably, step S240 includes: Step S241: Randomly select the first parent individual and the second parent individual from the parent population formed after the selection operation; Step S242: Determine whether to perform a crossover operation on the first parent individual and the second parent individual based on a preset crossover probability; when not performing a crossover operation, randomly select all genes of the first parent individual or the second parent individual as the genes of the offspring individual; when performing a crossover operation, perform arithmetic crossover on the three weight coefficient genes of the first parent individual and the three weight coefficient genes of the second parent individual respectively, and generate the weight coefficient genes of the offspring individual according to the following formula: In the formula, For the j-th weighted coefficient gene of the offspring individual, For the j-th weighted gene of the first parent individual, For the j-th weighted coefficient gene of the second parent individual, A random number in the range [0,1] that is independently generated along the j-th gene dimension; Step S243: Determine whether to perform a mutation operation on the offspring individuals generated after the crossover operation based on a preset mutation probability; when performing a mutation operation, a random perturbation is superimposed on each weight coefficient gene of the offspring individual, and the mutated weight coefficient genes are generated according to the following formula: In the formula, For the j-th weighted gene after mutation, It represents the random perturbation value uniformly sampled within a preset variation range on the j-th gene dimension; Step S244: Perform boundary constraint processing on each weight coefficient gene after the mutation operation, truncate gene values that exceed the preset upper or lower limit to the nearest boundary value, and supplement the offspring individuals after boundary constraint processing into the next generation population.
[0053] For details, see Figure 5 As shown, in a specific embodiment of the present invention, after retaining elite individuals, the remaining individuals of the new population are generated through crossover and mutation operations. The first and second parent individuals are randomly selected from the already selected parent pool. Whether to perform a crossover operation is determined with a crossover probability of 0.8. If crossover is performed, an arithmetic crossover method is used, and a random mixing coefficient in the range of 0 to 1 is independently generated for each weight dimension. Generate the weighted coefficient genes of offspring individuals according to the following formula: In the formula, For the j-th weighted gene of the offspring individual, For the j-th weighted gene of the first parent individual, Let be the j-th weighted coefficient gene of the second parent individual. If no crossover occurs, the gene from one parent is randomly selected for complete inheritance. Then, a mutation probability of 0.1 is used to determine whether to perform a mutation operation on the generated offspring individuals. If mutation is performed, random perturbations are added to each weighted coefficient gene of the offspring individual, generating the mutated weighted coefficient genes according to the following formula: In the formula For the j-th weighted gene after mutation, This represents a random perturbation value uniformly sampled within the range of -0.2 to 0.2 along the j-th gene dimension. Boundary constraints are applied to each weighted gene after mutation, removing values exceeding a preset upper limit. w GAmax Or lower limit of value w GAmin The gene values are truncated to the nearest boundary value to ensure that the weight coefficients are always within the allowable range. The offspring individuals after boundary constraint processing are added to the next generation population. The new population replaces the old population, and the next iteration begins, until the preset maximum number of generations, 100, is reached. Finally, the weight coefficient combination of the individual with the best fitness is output.
[0054] Understandably, this embodiment improves the efficiency of the search space exploration by performing arithmetic crossover with a preset crossover probability, enabling offspring individuals to inherit superior genetic traits from both parents in different dimensions; it maintains population diversity and avoids premature entrapment by applying random perturbations to offspring individuals with a preset mutation probability; it achieves a balance between the inheritance of superior genes and the maintenance of population diversity by configuring the crossover probability of 0.8 and the mutation probability of 0.1, thus improving the robustness of the algorithm to the search for the global optimum; and it ensures that the offspring generated by the genetic operation are always within the effective search space by applying boundary constraints to the mutated weight coefficients, thus avoiding the generation of invalid solutions.
[0055] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, arithmetic crossover can be replaced with single-point crossover or two-point crossover to simplify the implementation complexity of crossover operations; or a fixed mutation probability can be replaced with an adaptive mutation probability, so that the mutation rate decreases dynamically with the number of generations to balance early exploration and later convergence; or the mutation amplitude can be replaced from a fixed value of 0.2 to a dynamic value that decreases adaptively with the number of generations to improve the local fine-grained optimization ability in the later stages of the search; or roulette wheel selection can be replaced with tournament selection to reduce the impact of fitness value scale differences on selection pressure.
[0056] Preferably, step S300 includes: Step S310: Construct an initial population for the particle swarm optimization algorithm. Each particle in the initial population is a multi-dimensional vector. The number of dimensions of the multi-dimensional vector is the same as the total number of scheduling periods divided within the day-ahead scheduling cycle. Each dimension corresponds to the energy storage charging and discharging power value within a scheduling period. Perform intelligent initialization on some particles in the initial population. The intelligent initialization guides the values of each dimension of the particles towards a direction that is conducive to arbitrage based on the day-ahead predicted spot electricity price sequence. The remaining particles are randomly initialized in the search space. Step S320: For each particle in the initial population, the multidimensional vector of the particle is denormalized and then fed into the objective function of the particle swarm optimization algorithm to calculate the fitness value of each particle; the objective function of the particle swarm optimization algorithm adopts a multi-objective function weighted by the pre-day optimization weight coefficient, and the optimization objectives of the multi-objective function include maximizing photovoltaic consumption, maximizing energy storage arbitrage revenue, and minimizing load peak. Step S330: Update the individual historical optimal solution of each particle and the global optimal solution of the particle swarm based on the fitness value of each particle; the individual historical optimal solution is the position with the minimum fitness value found by the current particle in each iteration, and the global optimal solution is the position with the minimum fitness value found by all particles in each iteration. Step S340: Update the flight speed and position of each particle based on the individual historical optimal solution and the global optimal solution; Step S350: Repeat steps S320 to S340 until the preset maximum number of iterations is reached. The global optimal solution obtained at the end of the iteration is denormalized and output as the daytime energy storage charging and discharging power sequence.
[0057] For details, see Figure 6 As shown, in a specific embodiment of the present invention, the day-ahead optimization weight coefficients are input into the day-ahead optimization scheduling model to construct the initial population of the particle swarm optimization algorithm. Each particle in the population is a multi-dimensional vector. The number of dimensions is the same as the total number of scheduling periods within the day-ahead scheduling cycle (24 in this embodiment), and each dimension corresponds to the energy storage charging and discharging power value within a scheduling period. The expression is as follows: The proportion of the initial population is P smartIni The selected particles undergo intelligent initialization, while the remaining particles are randomly generated in a 0-to-1 space. Intelligent initialization is based on the day-to-day predicted spot electricity price sequence. EP 1h Calculate the hourly electricity price difference before and after As shown in the following formula: When electricity prices are trending upward, the energy storage charging and discharging power during that period should be directed towards charging; when electricity prices are trending downward, it should be directed towards discharging. Since the intelligent initialization function returns a solution in the physical space, normalization is necessary to avoid an excessively large search range leading to ineffective optimization. Furthermore, since the solution in the physical space is within the total energy storage power range [- Se BESS , Se BESS To map the elements within the range [] to the space between 0 and 1, the following formula is used: where... x {i,0} Initialize the particle's position: The flight speed of the i-th particle V i It is also D PSO A dimensional vector is used to initialize the particle's flight velocity, controlling it within the normalized space. In the following formula, the acceleration weight r is a 1-row vector. D PSO The matrix consists of columns whose elements are uniformly distributed random numbers between 0 and 1, so the flight speed is a random number between -0.1 and 0.1. From 1 to the maximum number of iterations D PSO In this process, the objective function is calculated for each particle. Here, the normalized particle position is passed, which needs to be denormalized within the objective function. For each particle, its fitness value is compared with the particle's individual extreme value to update the individual optimal solution. The best position found so far by the i-th particle is called the individual extreme value. p best The expression is shown in the following formula: For each particle, its fitness value is compared with the global optimum to update the global optimal solution. The best position found so far by the entire particle swarm is called the global optimum. g best The expression is shown in the following formula: Upon finding both individual and global extrema, the particle updates its velocity and position in the normalized space according to the following formula. The inertial weight w_t employs a dynamic adjustment strategy, from... f wmax It decreases linearly with the number of iterations until f wmin Calculate according to the following formula: The velocity update formula and the position update formula are as follows: However, it's important to note that particles should have an upper limit on their velocity and a search range within the normalized space. Boundary processing is needed to truncate the upper and lower limits of velocity and position. In this embodiment, the upper limit on velocity is set to 0.2, and the particle velocity should be the minimum of the minimum velocity of all particles and 0.2. When the particle velocity is negative, it should be the maximum of -0.2. Boundary processing controls the velocity within the range of 0 to 1 in the normalized space. Furthermore, to avoid premature convergence and increase diversity, adaptive mutation is performed when updating particle positions. If the global optimum is still greater than a preset threshold (1,000,000 is used as the judgment condition) after every 100 iterations, a particle is randomly reset to avoid premature convergence. The above fitness calculation, individual optimum update, global optimum update, and velocity and position update operations are repeated until the preset maximum number of iterations is reached. D PSO The global optimal solution obtained at the end of the iteration g best By denormalizing from the normalized space to the actual physical space, the energy storage charging and discharging power values for each scheduling period are obtained, which serve as the day-ahead energy storage charging and discharging power sequence. Se BESS1hO The output, the inverse normalization formula is as follows: The following table shows an example of PSO algorithm parameter representation: Table 4 PSO Algorithm Parameter Table Understandably, this embodiment guides some particles towards the direction of electricity price arbitrage through intelligent initialization, thereby increasing the proportion of effective solutions in the initial population and shortening the algorithm's convergence time; it also employs a dynamic inertia weight strategy to adjust the inertia weight from... f wmax linearly decreasing to f wmin In the early stages of iteration, a larger inertia weight is maintained to enhance the global exploration capability, while a smaller inertia weight is adopted in the later stages of iteration to improve the local fine-grained optimization capability, thus balancing the global search and local development of the algorithm. By handling the boundary constraints of velocity and position, it is ensured that the particle is always in the effective search space during flight, avoiding the generation of invalid solutions and improving the stability of the algorithm.
[0058] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the linear decreasing strategy of dynamic inertia weight can be replaced with a non-linear decreasing strategy to optimize the phased emphasis of the search process; or the velocity update formula in the particle swarm algorithm can be replaced with a velocity update formula with a contraction factor to control particle aggregation behavior; or the fixed number of iterations can be... D PSO Replace it with an early stopping mechanism based on fitness improvement rate to reduce unnecessary computational overhead; or add a high-quality solution injection strategy during particle swarm initialization, selecting solutions with similar characteristics to the current day from historical optimization results as the initial positions of some particles to improve the quality of the initial solution.
[0059] Preferably, step S340 includes: Step S341: In each iteration, select a predetermined proportion of particles with the highest fitness values from the current particle swarm to form an elite particle set. Use a Gaussian mixture model to perform cluster analysis on the position distribution of the elite particle set in the solution space to obtain several Gaussian distribution components. Use the mean vector of each Gaussian distribution component as a candidate attractor. Step S342: The candidate attractors and the global optimal solution together constitute the attractor set for the current iteration. The attractors in the attractor set are deduplicated, and the strength value of each attractor is recorded. The strength value is negatively correlated with the average fitness value of the elite particle that generated the attractor, that is, the smaller the average fitness value, the higher the strength value. Step S343: For each particle in the current particle swarm, calculate the Euclidean distance between the particle's current position and each attractor in the attractor set, and calculate the adaptive weight of the particle's influence by each attractor based on the Euclidean distance and the intensity value. The adaptive weight is proportional to the intensity value and inversely proportional to the square of the Euclidean distance. Step S344: Update the particle's velocity according to the following formula: In the formula, Let be the velocity vector of the i-th particle in the (t+1)-th iteration. Let be the inertia weight for the t-th iteration. Let be the velocity vector of the i-th particle in the t-th iteration. For individual learning factors, The acceleration weight vector is randomly generated within the range [0,1]. Let be the individual historical best position of the i-th particle. Let be the position vector of the i-th particle in the t-th iteration. For attractor learning factors, Let be the set of attractors in the t-th iteration. The number of attractors in the set of attractors. Let be the position vector of the k-th attractor. The adaptive weights for the influence of the k-th attractor on the i-th particle; Step S345: Update the position of the particle according to the following formula: Step S346: Perform boundary constraint processing on the updated flight speed and position of each particle, truncate the speed values that exceed the preset speed limit to the speed limit, and truncate the position values that exceed the search space boundary to the nearest boundary value.
[0060] For details, see Figure 7 As shown, in a specific embodiment of the present invention, the particle swarm optimization algorithm first selects a predetermined proportion of particles with high fitness values from the current particle swarm to form an elite particle set in each iteration. A Gaussian mixture model is used to perform cluster analysis on the position distribution of the elite particle set in the solution space, obtaining several Gaussian distribution components. The mean vector of each Gaussian distribution component is used as a candidate attractor. The candidate attractors and the global optimal solution together form the attractor set for the current iteration. Each attractor in the attractor set is deduplicated, and the strength value of each attractor is recorded. This strength value is negatively correlated with the average fitness value of the elite particle that generated the attractor; that is, the smaller the average fitness value, the higher the strength value. For each particle in the current particle swarm, the Euclidean distance between the particle's current position and each attractor in the attractor set is calculated. Based on the Euclidean distance and the strength value, the adaptive weight ω of the particle's influence by each attractor is calculated. ij The calculation method is as follows: In the formula, The adaptive weights for particle i under the influence of attractor j; Let be the Euclidean distance between the current position of particle i and attractor j; Let be the strength value of attractor j, and let the sum of the influence weights of all attractors be 1.
[0061] Then update the particle's velocity according to the following formula: Then update the particle's position according to the following formula: Boundary constraints are applied to the updated flight speed and position of each particle. Speed values exceeding the preset speed limit are truncated to the speed limit, and position values exceeding the search space boundary are truncated to the nearest boundary value.
[0062] Understandably, this embodiment uses a Gaussian mixture model to perform clustering analysis on the elite particle ensemble to obtain multiple candidate attractors. This allows the particle swarm to perceive multiple potential local optima during the evolutionary process, improving the algorithm's adaptability to multi-modal optimization problems. By constructing an attractor set together with candidate attractors and the global optimal solution, particles are guided by the global optimal solution to maintain their convergence direction during updates, while also being pulled by multiple local attractors to maintain population diversity, effectively suppressing premature convergence. By adaptively calculating weights based on the distance between particles and each attractor and the attractor strength, particles are more significantly influenced by closer and stronger attractors, achieving personalized guidance for particle movement direction and improving the ability to find high-quality stable solutions in a single run. By using a multi-attractor guidance mechanism instead of a single global optimal guidance, the algorithm's sensitivity to random initialization is reduced, improving the consistency of results across multiple runs.
[0063] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the number of clusters in the Gaussian mixture model can be replaced by a fixed number of clusters instead of automatic selection to reduce the computational cost per iteration; or the selection ratio of elite particles can be replaced by a strategy that dynamically decreases with the number of iterations to reduce the size of the elite set in the later stages to reduce computational complexity; or the Euclidean distance in the adaptive weight calculation of particle attractors can be replaced by a cosine distance to focus on directional similarity rather than absolute positional differences; or the Euclidean distance from particle to attractor in the velocity update formula can be replaced by a Mahalanobis distance to consider scale differences in various dimensions; or the clustering operation can be replaced by execution every generation instead of every few generations to reduce computational cost.
[0064] Preferably, in step S320, the objective function of the particle swarm optimization algorithm is: In the formula, This is the fitness value; These are the three weight coefficients in the weight coefficient combination obtained by the genetic algorithm optimization. This is used to adjust the weight of the photovoltaic power consumption optimization objective in the objective function. This is used to adjust the weight of the energy storage arbitrage optimization objective in the objective function. This is used to adjust the weight of the load smoothing optimization objective in the objective function; Optimize target values for photovoltaic power consumption; Optimize target values for energy storage arbitrage; Optimize target values for load smoothing; Penalty item for exceeding energy storage capacity limits; This is a penalty term for exceeding the absolute boundary of the charged state; This is a penalty item for exceeding the transformer capacity limit; Penalty for exceeding the operating limit in the charged state operating range; Penalties for energy storage systems transmitting data back to the grid; This is a penalty term for arbitrage threshold constraints; Penalties for unreasonable electricity price trends; Incentives for photovoltaic power generation and charging; Incentives for charging at the lowest electricity price point; This is the discharge excitation term at the point of highest electricity price.
[0065] Specifically, in a specific embodiment of the present invention, the photovoltaic power consumption optimization target value is... This refers to the cumulative daily photovoltaic power generation calculated based on photovoltaic output forecasts and load power consumption forecasts, which represents the load power consumption during each dispatch period. U Load1h Subtract photovoltaic power generation Y PV1h The sum of all negative values; the smaller this value, the more fully the photovoltaic power is utilized; energy storage arbitrage optimization target value. Total discharge revenue generated by energy storage utilizing electricity price differences I BESSD1h Subtract total charging cost C BESSC1h The negative value of total discharge revenue I BESSD1h The total charging cost is calculated by multiplying the discharge power of each discharge period by the corresponding spot electricity price and then summing the results. C BESSC1h The arbitrage profit is calculated by multiplying the charging power of each charging period by the corresponding spot electricity price and then summing the results. The smaller this value, the higher the arbitrage profit. (Load smoothing optimization target value) Power exchange between the power grids during each scheduling period U Grid1h The ratio of valley to peak values, where grid interaction power is calculated by subtracting photovoltaic power from load power and then subtracting energy storage charging and discharging power, indicates that the smaller the value, the smoother the fluctuation of grid interaction power. The three optimization objectives each use a normalization factor. norm 1. norm 2. norm 3. After normalization, multiply by the corresponding day-ahead optimized weight coefficient. W 1. W 2. W 3. The weighted optimization target value is obtained by summing the results. pf 1 to pf 7 is the penalty term. When a particle violates the constraints, the objective function value will increase significantly to guide the search away from infeasible solutions. The table below shows the normalization factor table for the objective function: Table 5. Normalization Factors for Objective Functions to These are penalty terms; when a particle violates the constraints, the objective function value increases significantly to guide the search away from infeasible solutions. Each penalty term is calculated in quadratic form, and the penalty intensity increases quadratically with the amount of violation. This is a penalty item for exceeding energy storage power limits, used to penalize charging and discharging power exceeding the nominal energy storage power. The behavior is calculated according to the following formula: In the formula, The energy storage charge / discharge power value at the point in time when the constraint is violated; for The corresponding penalty coefficient; Se BESS This represents the total energy storage capacity.
[0066] This is a penalty term for exceeding the absolute boundary of the state of charge (SBC). It is used to penalize behaviors that cause the SBC to exceed the physical boundary between 0% and 100% due to charging or discharging. During the charging period, it is constrained based on the maximum rechargeable capacity of the current period; during the discharging period, it is constrained based on the maximum dischargeable capacity of the current period. It is calculated according to the following formula: In the formula, for The corresponding penalty coefficient.
[0067] When using this method, the maximum charge / discharge capacity for the current time period must first be calculated based on the current state of charge to limit the charging / discharging power. If the current time period is a charging period, i.e., Se... BESSC1h If (t)>0, then the maximum rechargeable capacity for the current time period is calculated according to the following formula: In the formula, The state of charge (SOC) of the energy storage system at the end of the previous time period and the beginning of the current time period; This represents the total power of the energy storage system. Unidirectional efficiency when charging an energy storage system.
[0068] When the maximum rechargeable capacity is ≤0, Se BESSC1h (t)=0. The formula for calculating pf2 during discharge is the same as that during charging, and the charging amount is limited to the maximum rechargeable capacity.
[0069] This is a penalty for exceeding transformer capacity limits, used to penalize the power exchange between the microgrid and the main grid. The absolute value exceeds the available capacity of the transformer. The behavior is calculated according to the following formula: In the formula, Let be the power of interaction between the microgrid and the main grid during the t-th scheduling period; This refers to the available capacity of the transformer. for The corresponding penalty coefficient.
[0070] This is a penalty for exceeding the operating limit in the state-of-charge (SOC) range, penalizing SOCs that exceed the previously set SOC operating range. min SOC max In the case of a work zone with a soft constraint, the penalty is less severe than usual. Calculate according to the following formula: In the formula, for The corresponding penalty coefficient; Let SOC be the state of charge during the t-th scheduling period; This represents the highest state of charge (SOC) for energy storage. This represents the lowest state of charge (SOC) for energy storage.
[0071] It should be noted that, and Although they correspond to absolute boundary constraints of the charged state and working interval constraints respectively, the two penalty calculation methods are interchangeable. The penalty method based on energy storage charging and discharging power can also be used for state-of-charge (SOC) operating range constraints. Simply replace the physical boundaries 0% and 100% in the formula for calculating the maximum chargeable / discharge capacity with the operating range boundaries. SOC min and SOC max That's all; The penalty method based on direct boundary crossing of charged states can also be used for absolute boundary constraints of charged states, simply by defining the working interval boundary. SOC min and SOC max Simply replace them with 0% and 100% of the physical boundary. Both methods can effectively limit the operating range of the charged state in their respective applicable scenarios. The specific method to choose can be flexibly determined based on the strictness of the constraint and the convergence characteristics of the optimization problem.
[0072] This is a hard constraint on energy storage backfeeding to the grid, used to penalize the behavior of energy storage systems that independently feed power back to the main grid when the photovoltaic output is insufficient to fully absorb the power. It is calculated according to the following formula: In the formula, for The corresponding penalty coefficient.
[0073] This is a penalty term for the arbitrage threshold constraint, used to penalize behaviors where the charging / discharging state switches between adjacent scheduling periods but the electricity price difference is less than the preset arbitrage trigger threshold, in order to avoid meaningless frequent charging / discharging switches. It is calculated according to the following formula: In the formula, for The corresponding penalty coefficient; The threshold for initiating mains arbitrage; The price difference is the electricity price. When the charging / discharging state switches between adjacent hours, and the price difference between the current hour and the previous hour is less than a set threshold, a penalty is applied to avoid meaningless and frequent switching between charging / discharging states.
[0074] This is a penalty for unreasonable electricity price trends. It is used to punish irrational behaviors such as charging prematurely using grid electricity during a downward trend in electricity prices or discharging prematurely during an upward trend in electricity prices, in order to enhance the revenue generated by energy storage through electricity price differences. This penalty includes three sub-items: a penalty for charging at midnight, a penalty for charging during a downward trend in electricity prices, and a penalty for discharging during an upward trend in electricity prices. in, The zero-point charging penalty sub-item is used to penalize the behavior of charging energy storage from the grid during the zero-point period when the current electricity price is higher than the future average electricity price. It is calculated according to the following formula: In the formula, for The corresponding penalty coefficient; Let be the spot electricity price for the t-th scheduling period; It is the average of the electricity prices for each period from the next period until the time delay for determining the trend of electricity price changes; This refers to the power used by the energy storage system to charge from the mains during the t-th scheduling period. This sub-item is only effective at midnight each day, provided that the energy storage is being charged from the mains and its state of charge is less than the set upper limit at midnight. If the current electricity price is 50% higher than the future average electricity price, then the trend of electricity price changes in a certain period of time will be judged. If the current electricity price is higher than the future average electricity price and the energy storage is still using the grid power to charge at that point, then a penalty will be imposed.
[0075] The "Charging Penalty Sub-item for Electricity Price Decline" penalizes the behavior of charging energy storage systems prematurely using grid power during a price decline, and is calculated according to the following formula: when ,and If the electricity price is trending downwards and the next hour is the lowest point in the electricity price range, a penalty will be imposed if the energy storage uses grid power for charging during the current period.
[0076] The discharge penalty sub-item for rising electricity prices penalizes premature discharge of energy storage during periods of rising electricity prices, and is calculated according to the following formula: when and If the electricity price is trending upward and the next hour is the peak electricity price, a penalty will be imposed if the energy storage is discharged during the current period.
[0077] to This is an incentive term; when a particle exhibits the desired behavior, the objective function value decreases, thus encouraging that behavior. If Se BESS1h (t)>0, meaning the following parameters need to be calculated during charging: First, when the photovoltaic power generation is greater than the load power during that period, the difference between the two is the surplus photovoltaic power; otherwise, the surplus photovoltaic power is 0. Then, the power that the energy storage system can use to charge with the surplus photovoltaic power is the sum of the surplus photovoltaic power and the surplus photovoltaic power. Se BESS1h (t) The smaller of the two values represents the power at which the energy storage system can be charged using mains power. Se BESS1h (t) The value between the amount of the surplus photovoltaic power used for charging the energy storage system and zero is the larger of the following: the surplus photovoltaic power minus the surplus photovoltaic power used for charging the energy storage system and zero; the interaction power between the microgrid and the main grid is the sum of the net load power, the energy storage power charged from the surplus photovoltaic power, and the energy storage power charged from the grid.
[0078] A reward is given for charging using surplus photovoltaic power, calculated according to the following formula: In the formula, Se BESSCPV1h (t) represents the power used by the energy storage system to charge using surplus photovoltaic power during the t-th scheduling period; for The corresponding incentive coefficient; This is the normalization factor for the incentive term.
[0079] A charging reward is given for charging during the lowest electricity price period of the day. The period with the lowest electricity price is identified, and if energy storage is used for charging during this time, regardless of whether grid power or solar power is used, a reward is given, calculated according to the following formula: In the formula, for The corresponding incentive coefficient; The power used by the energy storage system to charge using mains power during the t-th scheduling period.
[0080] The reward for discharging electricity at the peak price is calculated using the following formula: In the formula, for The corresponding incentive coefficient; Let be the discharge power of the energy storage system during the t-th scheduling period.
[0081] It should be noted that all three incentive terms are negative. Their purpose is to reduce the fitness value in the objective function, thereby giving positive rewards to the charging and discharging behavior that meets the expectations, and guiding the particles to evolve in the direction of more efficient photovoltaic absorption and higher arbitrage returns.
[0082] Understandably, this embodiment achieves a unified evaluation of objectives with different dimensions by normalizing and weighting the sum of the three optimization objectives, thereby improving the feasibility of multi-objective collaborative optimization; by introducing seven quadratic penalty terms to apply gradient penalties to safety constraints such as power exceeding limits, state of charge exceeding limits, and transformer capacity exceeding limits, it effectively guides particles away from infeasible regions, improving the safety of optimization results; through pf 2 and pf 4. The flexible interchange of the two penalty calculation methods allows the state-of-charge constraints to choose between power-based or boundary-based penalty methods based on convergence characteristics, improving the algorithm's adaptability to different constraint types. By introducing three incentive terms, positive incentives are given to desired behaviors such as photovoltaic consumption, charging at the lowest electricity price, and discharging at the highest electricity price, guiding particles to evolve towards higher returns and improving the operational economy of the energy storage system.
[0083] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the weighted summation method can be replaced with a multi-objective decision-making method based on fuzzy logic to handle the nonlinear trade-off between objectives; or the fixed penalty coefficient can be replaced with an adaptive penalty coefficient to dynamically adjust the penalty intensity with the number of iterations to balance exploration and constraint satisfaction; or the three incentive terms can be replaced with fixed incentive coefficients to incentive coefficients that are dynamically adjusted with the size of the electricity price difference to improve the accuracy of incentives.
[0084] Preferably, step S400 includes: Step S410: Obtain daytime real-time status data and ultra-short-term forecast data. The daytime real-time status data includes the current actual photovoltaic power, actual load power, actual grid interaction power, current energy storage state of charge, and actual energy storage charging and discharging power. The ultra-short-term forecast data includes a photovoltaic power forecast sequence and a load power forecast sequence within a preset future time period. Step S420: Construct an inter-day rolling optimization model. The optimization variable of the inter-day rolling optimization model is a sequence of energy storage power adjustment amounts with a preset number of control steps in the future. The power value at the corresponding moment in the day-ahead energy storage charging and discharging power sequence is superimposed with each adjustment amount in the energy storage power adjustment amount sequence to obtain the energy storage power setpoint. The objective function of the inter-day rolling optimization model includes a real-time optimization term for photovoltaic consumption, a real-time optimization term for energy storage arbitrage, a demand control term, and a tracking term for the day-ahead plan. The tracking term for the day-ahead plan includes a tracking sub-item for energy storage power adjustment amount and a tracking sub-item for state of charge, which are used to constrain the deviation of the energy storage power adjustment amount and the state of charge amount from the day-ahead plan, respectively. The constraints of the inter-day rolling optimization model include upper and lower bound constraints for energy storage power, upper and lower bound constraints for energy storage state of charge, and transformer capacity constraints. The upper and lower bound constraints for energy storage power are dynamically calculated based on the current energy storage state of charge. Step S430: Solve the daytime rolling optimization model, take the first adjustment value in the solution result, and superimpose it with the power value at the corresponding moment in the daytime energy storage charging and discharging power sequence to obtain the power setpoint value sent to the energy storage converter at the current control step size; Step S440: Obtain the deviation between the power setpoint issued in the previous control step and the actual power value executed by the energy storage converter. Introduce the deviation as an additional term into the tracking term of the daytime plan in the daytime rolling optimization model of the current control step, so that the daytime rolling optimization model takes into account the correction of the power deviation when solving, so as to suppress the accumulation of power tracking deviation caused by prediction error or equipment response delay.
[0085] For details, see Figure 8As shown, in a specific embodiment of the present invention, at each control step, the real-time daytime state quantities are first acquired, including the actual photovoltaic power, actual load power, actual grid interaction power, current energy storage state of charge (SOC), and actual energy storage charging and discharging power. The ultra-short-term photovoltaic power prediction sequence and load power prediction sequence within a preset future time period are also acquired. In this embodiment, the step size is triggered every 5 minutes. Simultaneously, the daytime energy storage charging and discharging power plan, state of charge reference trajectory, and grid interaction power plan are acquired from the daytime optimization module, and the maximum grid interaction power that has occurred within the current demand statistics period is calculated as a key input for real-time demand control. Based on the daytime energy storage charging and discharging power sequence, a daytime rolling optimization model is constructed. The optimization variable of this model is the energy storage power adjustment sequence for a preset number of control steps in the future, defined as follows: In the formula, X This is a sequence of energy storage power adjustment values; This represents the energy storage power adjustment amount at the (k+i)th control step. To optimize the total number of control steps contained in the time domain.
[0086] The power value at the corresponding moment in the current day's energy storage charge and discharge power sequence is superimposed with each adjustment value to obtain the energy storage power setpoint, calculated according to the following formula: In the formula, The power setpoint is sent to the energy storage converter for the (k+1)th control step. This represents the power value corresponding to the (k+1)th control step in the current energy storage charge / discharge power sequence. This represents the energy storage power adjustment for the (k+1)th control step.
[0087] The objective function of the daytime rolling optimization model is a multi-objective weighted sum form, inheriting the daytime scheduling objective while adding a real-time specific objective term, calculated according to the following formula: In the formula, The objective function value for the daytime rolling optimization model; These are the weight coefficients corresponding to each real-time optimization objective; For the m-th penalty term, inherit from the objective function of the previous day. to The logic; For the nth incentive term, inherit from the objective function of the previous day. to The logic.
[0088] in, For the real-time optimization of photovoltaic (PV) power consumption, the calculation is based on ultra-short-term forecasts and real-time adjustments. The use of real-time PV surplus power for charging is encouraged. When energy storage charging (P_BESS(t)) > 0, the calculation follows the formula; otherwise, it is 0: In the formula, For the ultra-short-term photovoltaic power prediction at the t-th control step; For the ultra-short-term load power prediction value at the t-th control step; Let be the energy storage charging and discharging power at the t-th control step, where a positive value indicates charging and a negative value indicates discharging. Unidirectional efficiency when charging an energy storage system; This represents the summation of all control step sizes within the optimization time domain; For the real-time optimization of energy storage arbitrage, the change in revenue due to adjustments is calculated based on the ultra-short-term forecast electricity price. This encourages more charging when the real-time electricity price is lower than the day-ahead plan and more discharging when it is higher. When energy storage discharge, i.e., P_BESS(t) < 0, is calculated according to the following formula: In other cases, calculate according to the following formula: In the formula, Let t be the spot electricity price for the t-th control step. This refers to the unidirectional efficiency of the energy storage system during discharge. The time span for a single control step.
[0089] The load smoothing and demand control item includes two sub-items. f 3r,a and f 3r,b These correspond to the objectives of load smoothing and demand control, respectively. Both are optional; for electricity users requiring demand management, both are enabled simultaneously. f 3r,a and f 3r,b For electricity users who only require demand control, only enable... f 3r,b If the basic electricity billing method for this electricity user is based on capacity, then neither method will be enabled. f 3r,a To minimize grid interaction power fluctuations, it can be minimized. Variance realization: In the formula, Let be the power of interaction between the microgrid and the main grid at the t-th control step, where a positive value indicates power taken from the grid and a negative value indicates power sent to the grid; For the ultra-short-term load power prediction value at the t-th control step; Let t be the predicted ultra-short-term photovoltaic power value at the t-th control step.
[0090] f 3r,b This method is used to suppress peak grid interaction power during the demand statistics period. Its optimization objective is to minimize the estimated maximum demand at the end of the entire optimization period. In the formula, This represents the maximum power exchange between the power grids that has occurred within the current demand statistics period. The power grid interaction sequence is from the (k+1)th control step to the (k+t)th control step. This represents the maximum value of the power exchange between the power grids during that period.
[0091] As a tracking item for the day-ahead plan, used to constrain the deviation of energy storage power adjustment and state of charge from the day-ahead plan, it is calculated according to the following formula: In the formula, The state of charge tracking weighting coefficient is used to control the penalty for deviations of the state of charge from the day-ahead reference trajectory; This is the day-ahead state of charge reference value for the t-th control step; The weighting coefficient for power adjustment is used to control the penalty level of energy storage power adjustment.
[0092] Solving the daytime rolling optimization model yields the optimal sequence of energy storage power adjustment amounts for a predetermined number of control steps in the future. The first adjustment amount from the solution is then selected. ΔP BESS(k+1) The power values at the corresponding moments in the current energy storage charging and discharging power sequence. P BESS,dayahead(k+1) By superimposing these values, the power setpoint value sent to the energy storage converter at the current control step size can be obtained. P BESS(k+1) Simultaneously, obtain the power setpoint sent from the previous control step. P BESS(k) The actual power value performed by the energy storage converter Deviation between Calculate according to the following formula: In the formula, The deviation between the power setpoint and the actual executed power at the kth control step; The power setpoint is sent to the energy storage converter for the kth control step. This represents the actual power value executed by the energy storage converter at the k-th control step.
[0093] This deviation is introduced as an additional term into the day-ahead tracking term of the daytime rolling optimization model at the current control step size. In this context, a deviation correction sub-item is added to the tracking items of the current day's plan. ,in The bias feedback weight coefficient is used to ensure that the model takes into account the correction of power bias during the solution process, and constructs an optimization objective that minimizes the cumulative power tracking error to suppress the accumulation of power tracking bias caused by prediction error or equipment response delay. The above optimization and correction process is executed in each control step until the end of the daily operation cycle.
[0094] Understandably, this embodiment acquires ultra-short-term photovoltaic and load forecast data and constructs a daytime rolling optimization model. Based on the day-ahead plan, it performs local corrections with progressively larger control steps, improving the response speed of the energy storage power setpoint to changes in actual operating conditions. By setting a tracking term for the day-ahead plan in the objective function, daytime corrections are always based on the globally optimal day-ahead plan, preventing real-time decisions from deviating from the day-ahead economic optimization direction. This is achieved through demand control terms. f 3r,b Real-time suppression of peak power interaction in the current statistical period solves the problem of difficulty in accurately controlling peak demand in day-ahead open-loop control, improving the accuracy and effectiveness of demand management. By introducing the deviation between the power setpoint and the actual executed power of the previous control step into the current optimization model as feedback, a closed-loop control mechanism is formed to suppress the accumulation of power tracking deviation caused by equipment response delay or measurement error, thereby improving the stability and reliability of actual operation.
[0095] Based on the above technical solutions, those skilled in the art can make corresponding equivalent improvements according to the specific characteristics of the application scenario or system requirements. For example, the real-time optimization term for photovoltaic consumption in the daytime rolling optimization model can be replaced by the calculation of photovoltaic surplus power based on ultra-short-term predictions with an instant decision based on the measured photovoltaic surplus power at the current moment to improve the response speed; or the control step size of the daytime rolling optimization model can be adjusted from 5 minutes to other time scales to adapt to scenarios with different response speed requirements.
[0096] To further verify the effectiveness of the technical solution of this invention, a proposed photovoltaic-storage integrated project in Shunde District, Foshan City, Guangdong Province was selected for simulation verification. The project plans to add 400kW / 500kWp of photovoltaic capacity and configure 250kW / 522kWh of energy storage under a transformer with a nominal capacity of 630kVA. The simulation analysis was carried out based on the actual data from January 1 to January 7, 2026, a total of 7 days. The data includes the output of surrounding photovoltaic power, the power load of the plant area and the spot electricity price before the node. Figure 11 The actual load curve of the transformer for the entire year of 2025 is shown. Figure 12 This section showcases 15 typical daily load curves obtained through adaptive neural network clustering. Figures 11 to 12 It can be seen that the transformer has significant load characteristics. The peak and stable load periods are concentrated between 9:00 and 12:00, 14:00 and 18:00, and 19:00 and 22:00. The load is extremely low during other periods. It can be inferred that the plant area cannot absorb the photovoltaic power on its own during the peak photovoltaic power generation period at noon. Therefore, the energy storage system needs to restrain charging during the low electricity price period at night and discharge during the higher electricity price period in the morning to reserve space for photovoltaic charging at noon. It should discharge during the peak electricity price period in the evening to obtain the price difference profit. Simulation simulated two scenarios: the original load without photovoltaic and the original load with photovoltaic. In the scenario without photovoltaic, the genetic algorithm was used to optimize the weight coefficients of the particle swarm algorithm based on 7 days of actual data to obtain the optimal weight coefficients [0,8,5]. In the scenario with photovoltaic, in addition to considering the maximum demand of the transformer and the electricity price arbitrage, the energy storage should also prioritize the absorption of photovoltaic green electricity. The optimal weight coefficients were obtained by the genetic algorithm to be [8,8,5]. Figures 13 to 19 Simulation results for days one through seven are presented. The top side of each day's results shows the strategy without light stacking, and the bottom side shows the strategy with light stacking. Figure 13 As can be seen, the overall electricity load of the plant area was low on January 1st, and the electricity price was generally stable, only slightly dropping during the daytime photovoltaic output period. The simulated energy storage operation strategy was to charge at high power at 11:00 AM to increase the state of charge from 5% to 50%, then discharge at 12:00 and 13:00 to obtain some revenue, followed by charging again at the low electricity price from 14:00 to 15:00 to increase the state of charge to 100%, and finally discharging around 18:00 during the peak electricity price period. After photovoltaic stacking, the remaining photovoltaic power was sufficient to charge the energy storage to 100% by noon, so the strategy chose to use the remaining photovoltaic power for charging at a lower power instead of using grid power. The electricity price pattern from January 2nd to January 7th was basically consistent: the lowest electricity price at night, a secondary peak around 8:00 AM, a valley at noon, and the peak of the day around 19:00 PM. The corresponding energy storage strategy was to charge during the lowest electricity price period at night, discharge during the morning peak, charge during the midday valley, and discharge during the evening peak, basically achieving two charge-discharge cycles per day.
[0097] See Figure 9 The second aspect of this invention provides a photovoltaic-storage microgrid energy allocation system, comprising: The data acquisition and feature extraction module is used to acquire day-ahead forecast data and extract daily operating feature vectors based on the day-ahead forecast data; the day-ahead forecast data includes the day-ahead forecast photovoltaic power output sequence, the day-ahead forecast load power consumption sequence, and the day-ahead forecast spot electricity price sequence; The weight optimization module is used to optimize the combination of weight coefficients based on the daily operating feature vector using a genetic algorithm to obtain the daily optimized weight coefficients. The day-ahead planning generation module is used to optimize and solve the day-ahead prediction energy storage charging and discharging power sequence by using the particle swarm optimization algorithm based on the day-ahead optimized weight coefficients and the day-ahead prediction data. The daytime correction module is used to acquire real-time daytime state quantities, construct and solve a daytime rolling optimization model based on the daytime energy storage charging and discharging power sequence and the daytime real-time state quantities, and perform real-time correction on the daytime energy storage charging and discharging power sequence to obtain the daytime energy storage charging and discharging power sequence.
[0098] A third aspect of the present invention also provides a storage medium storing a photovoltaic-storage microgrid energy allocation processing program, wherein when the photovoltaic-storage microgrid energy allocation program is executed by a processor, it implements the steps of the photovoltaic-storage microgrid energy allocation method as described in any of the above embodiments.
[0099] See Figure 10 As shown, a fourth aspect of the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the energy allocation method for a photovoltaic-storage microgrid as described in any embodiment of the first aspect.
[0100] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center for energy allocation in the photovoltaic-storage microgrid, connecting various parts of the entire photovoltaic-storage microgrid energy allocation system through various interfaces and lines.
[0101] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the photovoltaic-storage microgrid energy allocation system by running or executing the computer programs and / or modules stored in the memory and by calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0102] Compared with the prior art, the beneficial effects of the present invention include at least the following: The energy allocation method and system for photovoltaic-storage microgrids provided by this invention enable the genetic algorithm to perform personalized optimization of the objective function weights of the particle swarm optimization algorithm based on the photovoltaic characteristics, load characteristics, and electricity price characteristics of different days through a daily operation feature extraction mechanism. This overcomes the defect that fixed weights cannot adapt to the differentiated daily operation scenarios. By using the weight coefficients obtained by the genetic algorithm optimization, the particle swarm optimization algorithm is guided to solve the day-ahead energy storage charging and discharging plan, improving the matching degree of the optimization results with the actual operating conditions of the day. By constructing a daytime rolling optimization model and making real-time corrections based on the day-ahead plan, the energy storage power setpoint can be dynamically adjusted when faced with deviations in photovoltaic output and load forecasts, compensating for the inability of day-ahead open-loop control to cope with real-time fluctuations. By introducing the power deviation of the previous control step as a feedback quantity into the current optimization model, continuous correction of power tracking error is achieved, effectively suppressing the cumulative deviation caused by equipment response delay or measurement error, and ensuring the coordination and unity between the optimal day-ahead economy and safe and reliable intraday operation of the photovoltaic-storage microgrid.
[0103] Furthermore, this invention also improves the green electricity consumption level by extracting photovoltaic (PV) absorption characteristics to enable the genetic algorithm to perceive the daily PV generation intensity and adaptively adjust the absorption target weights; improves the load smoothing effect and operational safety margin by extracting load characteristics to perceive the degree of fluctuation and transformer margin; improves the arbitrage profit capture capability by extracting electricity price characteristics to perceive the price difference space; constructs a daily operation feature vector through feature normalization to provide a data-driven basis for weight optimization, avoiding reliance on manual experience; drives the genetic algorithm optimization through the daily operation feature vector to adaptively match the weight coefficients to the daily operating conditions; uses simplified PSO rapid simulation as a fitness evaluation basis to effectively verify the merits of the weights in actual optimization scenarios; and retains elites. This algorithm employs a combination of selection, crossover, and mutation to avoid premature convergence; a two-layer optimization architecture to improve overall economy and operational adaptability; the generation of initial individuals centered on ideal weights to improve the quality of the initial solution during the first deployment; the inheritance of historical high-quality genes similar to the current working conditions through a historical high-quality solution memory and Euclidean distance matching; the introduction of appropriate mutations to avoid premature convergence while inheriting high-quality genes through weighted roulette wheel selection and perturbation; the maintenance of population diversity by having three types of individuals jointly constitute the population to improve algorithm adaptability; arithmetic crossover to allow offspring to inherit the superior genes of both parents, improving the efficiency of search space exploration; random perturbation mutation to maintain population diversity and avoid local optima; and a balance between gene inheritance and diversity achieved through crossover and mutation probabilities. Achieving a balance improves the robustness of the global search; boundary constraints ensure that offspring always remain in the effective search space; intelligent initialization guides particles to distribute towards electricity price arbitrage, shortening convergence time; a dynamic inertia weight reduction strategy balances global exploration and local fine-grained optimization; boundary constraints ensure particles remain in the effective search space, improving algorithm stability; Gaussian mixture model clustering extracts multiple candidate attractors, avoiding population diversity loss caused by a single global optimum; candidate attractors and the global optimum together form an attractor set, enhancing particle perception of valuable regions; adaptive weights based on distance and intensity achieve differentiated multi-directional guidance; weighted summation of multiple attractors replaces a single global optimum, improving... The system aims to improve convergence stability and solution quality; enhance the ability to escape local optima by periodically resetting particles; achieve unified evaluation of objectives with different dimensions by weighted summation of three normalized optimization objectives; improve safety by guiding particles away from infeasible regions through seven quadratic penalty terms; enhance adaptability to different constraint types by flexibly switching between two penalty methods; guide particles to evolve towards higher returns through three incentive terms; improve the response speed to changes in actual operating conditions through ultra-short-term forecast rolling correction; avoid real-time decisions deviating from the economic optimization direction by tracking the daily plan; improve the accuracy of demand management by suppressing demand peaks in real time through demand control terms; and suppress the accumulation of power tracking deviation through feedback deviation closed-loop correction.
[0104] In summary, the energy allocation method and system for photovoltaic-storage microgrids proposed in this invention solves the technical problems in the prior art, such as the difficulty in adapting to daily differentiated operating scenarios due to the fixed weight coefficients of the objective function, the poor consistency of optimization results caused by the randomness of the particle swarm optimization algorithm, and the inability of day-ahead open-loop control to effectively cope with prediction deviations and real-time demand changes.
[0105] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention. Equivalent structural transformations made using the description and drawings of the present invention, or direct / indirect applications in other related technical fields, are all included within the scope of patent protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
[0106] It should be noted that the embodiments implemented on the energy allocation system side of the photovoltaic-storage microgrid in this invention can be referenced in conjunction with the embodiments implemented on the energy allocation method side of the photovoltaic-storage microgrid, and will not be described in detail in this invention.
[0107] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for energy allocation in a photovoltaic-storage microgrid, characterized in that, include: Step S100: Obtain the day-ahead forecast data and extract the daily operating feature vector based on the day-ahead forecast data; the day-ahead forecast data includes the day-ahead forecast photovoltaic power output sequence, the day-ahead forecast load power consumption sequence, and the day-ahead forecast spot electricity price sequence; Step S200: Using the daily running feature vector as input, a genetic algorithm is used to optimize the combination of weight coefficients of the objective function of the particle swarm optimization algorithm to obtain the daily optimized weight coefficients; Step S300: Input the day-ahead optimization weight coefficients into the day-ahead optimization scheduling model, and use the particle swarm optimization algorithm to solve for the day-ahead energy storage charging and discharging power sequence; Step S400: Obtain real-time daytime state data, construct a daytime rolling optimization model based on the daytime energy storage charging and discharging power sequence, solve the model, and perform real-time correction on the daytime energy storage charging and discharging power sequence to obtain the daytime energy storage charging and discharging power sequence.
2. The energy allocation method for a photovoltaic-storage microgrid as described in claim 1, characterized in that, Step S100 includes: Step S110: Calculate the photovoltaic absorption characteristics based on the predicted photovoltaic power output sequence and the predicted load power consumption sequence; the photovoltaic absorption characteristics include the total daily photovoltaic power generation, the daily surplus photovoltaic power, and the photovoltaic self-consumption rate; Step S120: Calculate the load characteristics based on the predicted load power sequence; the load characteristics include total daily power consumption, daily peak load, daily load fluctuation, and the ratio of peak load to transformer capacity; Step S130: Calculate the electricity price characteristics based on the day-ahead forecasted spot electricity price sequence; the electricity price characteristics include the daily electricity price fluctuation and the maximum difference between the day-ahead electricity prices.
3. The energy allocation method for a photovoltaic-storage microgrid as described in claim 2, characterized in that, Step S200 includes: Step S210: Construct an initial population for the genetic algorithm. Each individual in the initial population contains a set of weight coefficient combinations to be optimized. The weight coefficient combinations include a first weight coefficient determined according to the photovoltaic absorption characteristics, a second weight coefficient determined according to the load characteristics, and a third weight coefficient determined according to the electricity price characteristics. Step S220: For each individual in the initial population, substitute the weight coefficient combination of the current individual into the objective function of the particle swarm optimization algorithm, and call the simplified particle swarm optimization process to perform a fast simulation of the current day prediction data, and use the optimal objective function value output by the simplified particle swarm optimization process as the fitness value of the current individual. Step S230: Based on the fitness value of each individual, perform a selection operation on the current population, and retain a predetermined number of individuals with the best fitness as elite individuals to directly enter the next generation of the population; Step S240: Perform crossover and mutation operations on the selected parent individuals to generate offspring individuals, and add the offspring individuals to the next generation population; Step S250: Repeat steps S220 to S240 until the preset maximum number of generations is reached, and output the weight coefficient combination corresponding to the individual with the best fitness in the final population as the current optimized weight coefficient.
4. The energy allocation method for a photovoltaic-storage microgrid as described in claim 3, characterized in that, Step S210 includes: Step S211: Construct the genotype of each individual in the initial population. The genotype is a three-dimensional vector composed of three weighted coefficient genes, corresponding to the first weighted coefficient, the second weighted coefficient and the third weighted coefficient respectively. The search space of each weighted coefficient is constrained between a preset upper limit and a lower limit of values. Step S212: When deploying for the first time or without accumulating historical operation data, calculate the ideal weight coefficient combination based on the daily operation feature vector, and randomly generate some individuals in the search space with the ideal weight coefficient combination as the mean and the preset standard deviation, while the remaining individuals are generated completely randomly in the search space. Step S213: When historical operation data has been accumulated, call the historical high-quality solution memory library. The historical high-quality solution memory library is used to store the weight coefficient combination marked as high-quality solution in the historical operation days and its corresponding daily operation feature vector. The daily operation feature vector includes the photovoltaic power output feature vector, load electricity consumption feature vector and spot electricity price feature vector of the historical operation days. Step S214: Calculate the Euclidean distance between the daily running feature vector and the feature vector of each record in the memory bank, sort them according to the Euclidean distance from smallest to largest, and select a preset number of records with the highest sorted number as candidate records; Step S215: Select a subset of individual weight coefficient combinations from the candidate records using a weighted roulette wheel method based on fitness values. Apply a random perturbation within a preset range to each selected weight coefficient combination to generate a first type of initial individual. The random perturbation is random noise with an amplitude not exceeding the preset range superimposed on each dimension of the weight coefficient combination. Step S216: Generate a second type of initial individuals according to the ideal weight coefficient combination, and generate a third type of initial individuals completely randomly within the search space. The first type of initial individuals, the second type of initial individuals, and the third type of initial individuals together constitute the complete initial population.
5. The energy allocation method for a photovoltaic-storage microgrid as described in claim 3, characterized in that, Step S240 includes: Step S241: Randomly select the first parent individual and the second parent individual from the parent population formed after the selection operation; Step S242: Determine whether to perform a crossover operation on the first parent individual and the second parent individual based on a preset crossover probability; when not performing a crossover operation, randomly select all genes of the first parent individual or the second parent individual as the genes of the offspring individual; when performing a crossover operation, perform arithmetic crossover on the three weight coefficient genes of the first parent individual and the three weight coefficient genes of the second parent individual respectively, and generate the weight coefficient genes of the offspring individual according to the following formula: In the formula, For the j-th weighted coefficient gene of the offspring individual, For the j-th weighted gene of the first parent individual, For the j-th weighted coefficient gene of the second parent individual, A random number in the range [0,1] that is independently generated along the j-th gene dimension; Step S243: Determine whether to perform a mutation operation on the offspring individuals generated after the crossover operation based on a preset mutation probability; when performing a mutation operation, a random perturbation is superimposed on each weight coefficient gene of the offspring individual, and the mutated weight coefficient genes are generated according to the following formula: In the formula, For the j-th weighted gene after mutation, It represents the random perturbation value uniformly sampled within a preset variation range on the j-th gene dimension; Step S244: Perform boundary constraint processing on each weight coefficient gene after the mutation operation, truncate gene values that exceed the preset upper or lower limit to the nearest boundary value, and supplement the offspring individuals after boundary constraint processing into the next generation population.
6. The energy allocation method for a photovoltaic-storage microgrid as described in claim 1, characterized in that, Step S300 includes: Step S310: Construct an initial population for the particle swarm optimization algorithm. Each particle in the initial population is a multi-dimensional vector. The number of dimensions of the multi-dimensional vector is the same as the total number of scheduling periods divided within the day-ahead scheduling cycle. Each dimension corresponds to the energy storage charging and discharging power value within a scheduling period. Perform intelligent initialization on some particles in the initial population. The intelligent initialization guides the values of each dimension of the particles towards a direction that is conducive to arbitrage based on the day-ahead predicted spot electricity price sequence. The remaining particles are randomly initialized in the search space. Step S320: For each particle in the initial population, the multidimensional vector of the particle is denormalized and then fed into the objective function of the particle swarm optimization algorithm to calculate the fitness value of each particle; the objective function of the particle swarm optimization algorithm adopts a multi-objective function weighted by the pre-day optimization weight coefficient, and the optimization objectives of the multi-objective function include maximizing photovoltaic consumption, maximizing energy storage arbitrage revenue, and minimizing load peak. Step S330: Update the individual historical optimal solution of each particle and the global optimal solution of the particle swarm based on the fitness value of each particle; the individual historical optimal solution is the position with the minimum fitness value found by the current particle in each iteration, and the global optimal solution is the position with the minimum fitness value found by all particles in each iteration. Step S340: Update the flight speed and position of each particle based on the individual historical optimal solution and the global optimal solution; Step S350: Repeat steps S320 to S340 until the preset maximum number of iterations is reached. The global optimal solution obtained at the end of the iteration is denormalized and output as the daytime energy storage charging and discharging power sequence.
7. The energy allocation method for a photovoltaic-storage microgrid as described in claim 6, characterized in that, Step S340 includes: Step S341: In each iteration, select a predetermined proportion of particles with the highest fitness values from the current particle swarm to form an elite particle set. Use a Gaussian mixture model to perform cluster analysis on the position distribution of the elite particle set in the solution space to obtain several Gaussian distribution components. Use the mean vector of each Gaussian distribution component as a candidate attractor. Step S342: The candidate attractors and the global optimal solution together constitute the attractor set for the current iteration. The attractors in the attractor set are deduplicated, and the strength value of each attractor is recorded. The strength value is negatively correlated with the average fitness value of the elite particle that generated the attractor, that is, the smaller the average fitness value, the higher the strength value. Step S343: For each particle in the current particle swarm, calculate the Euclidean distance between the particle's current position and each attractor in the attractor set, and calculate the adaptive weight of the particle's influence by each attractor based on the Euclidean distance and the intensity value. The adaptive weight is proportional to the intensity value and inversely proportional to the square of the Euclidean distance. Step S344: Update the particle's velocity according to the following formula: In the formula, Let be the velocity vector of the i-th particle in the (t+1)-th iteration. Let be the inertia weight for the t-th iteration. Let be the velocity vector of the i-th particle in the t-th iteration. For individual learning factors, The acceleration weight vector is randomly generated within the range [0,1]. Let be the individual historical best position of the i-th particle. Let be the position vector of the i-th particle in the t-th iteration. For attractor learning factors, Let be the set of attractors in the t-th iteration. The number of attractors in the set of attractors. Let be the position vector of the k-th attractor. The adaptive weights for the influence of the k-th attractor on the i-th particle; Step S345: Update the position of the particle according to the following formula: Step S346: Perform boundary constraint processing on the updated flight speed and position of each particle, truncate the speed values that exceed the preset speed limit to the speed limit, and truncate the position values that exceed the search space boundary to the nearest boundary value.
8. The energy allocation method for a photovoltaic-storage microgrid as described in claim 6, characterized in that, In step S320, the objective function of the particle swarm optimization algorithm is: In the formula, This is the fitness value; These are the three weight coefficients in the weight coefficient combination obtained by the genetic algorithm optimization. This is used to adjust the weight of the photovoltaic power consumption optimization objective in the objective function. This is used to adjust the weight of the energy storage arbitrage optimization objective in the objective function. This is used to adjust the weight of the load smoothing optimization objective in the objective function; Optimize target values for photovoltaic power consumption; Optimize target values for energy storage arbitrage; Optimize target values for load smoothing; Penalty item for exceeding energy storage capacity limits; This is a penalty term for exceeding the absolute boundary of the charged state; This is a penalty item for exceeding the transformer capacity limit; Penalty for exceeding the operating limit in the charged state operating range; Penalties for energy storage systems transmitting data back to the grid; This is a penalty term for arbitrage threshold constraints; Penalties for unreasonable electricity price trends; Incentives for photovoltaic power generation and charging; Incentives for charging at the lowest electricity price point; This is the discharge excitation term at the point of highest electricity price.
9. The energy allocation method for a photovoltaic-storage microgrid as described in claim 1, characterized in that, Step S400 includes: Step S410: Obtain daytime real-time status data and ultra-short-term forecast data. The daytime real-time status data includes the current actual photovoltaic power, actual load power, actual grid interaction power, current energy storage state of charge, and actual energy storage charging and discharging power. The ultra-short-term forecast data includes a photovoltaic power forecast sequence and a load power forecast sequence within a preset future time period. Step S420: Construct an inter-day rolling optimization model. The optimization variable of the inter-day rolling optimization model is a sequence of energy storage power adjustment amounts with a preset number of control steps in the future. The power value at the corresponding moment in the day-ahead energy storage charging and discharging power sequence is superimposed with each adjustment amount in the energy storage power adjustment amount sequence to obtain the energy storage power setpoint. The objective function of the inter-day rolling optimization model includes a real-time optimization term for photovoltaic consumption, a real-time optimization term for energy storage arbitrage, a demand control term, and a tracking term for the day-ahead plan. The tracking term for the day-ahead plan includes a tracking sub-item for energy storage power adjustment amount and a tracking sub-item for state of charge, which are used to constrain the deviation of the energy storage power adjustment amount and the state of charge amount from the day-ahead plan, respectively. The constraints of the inter-day rolling optimization model include upper and lower bound constraints for energy storage power, upper and lower bound constraints for energy storage state of charge, and transformer capacity constraints. The upper and lower bound constraints for energy storage power are dynamically calculated based on the current energy storage state of charge. Step S430: Solve the daytime rolling optimization model, take the first adjustment value in the solution result, and superimpose it with the power value at the corresponding moment in the daytime energy storage charging and discharging power sequence to obtain the power setpoint value sent to the energy storage converter at the current control step size; Step S440: Obtain the deviation between the power setpoint issued in the previous control step and the actual power value executed by the energy storage converter. Introduce the deviation as an additional term into the tracking term of the daytime plan in the daytime rolling optimization model of the current control step, so that the daytime rolling optimization model takes into account the correction of the power deviation when solving, so as to suppress the accumulation of power tracking deviation caused by prediction error or equipment response delay.
10. A photovoltaic-storage microgrid energy distribution system, characterized in that, include: The data acquisition and feature extraction module is used to acquire day-ahead forecast data and extract daily operating feature vectors based on the day-ahead forecast data; the day-ahead forecast data includes the day-ahead forecast photovoltaic power output sequence, the day-ahead forecast load power consumption sequence, and the day-ahead forecast spot electricity price sequence; The weight optimization module is used to optimize the combination of weight coefficients based on the daily operating feature vector using a genetic algorithm to obtain the daily optimized weight coefficients. The day-ahead planning generation module is used to optimize and solve the day-ahead prediction energy storage charging and discharging power sequence by using the particle swarm optimization algorithm based on the day-ahead optimized weight coefficients and the day-ahead prediction data. The daytime correction module is used to acquire real-time daytime state quantities, construct and solve a daytime rolling optimization model based on the daytime energy storage charging and discharging power sequence and the daytime real-time state quantities, and perform real-time correction on the daytime energy storage charging and discharging power sequence to obtain the daytime energy storage charging and discharging power sequence.