Microgrid energy distribution optimization method based on genetic algorithm

Through the microgrid energy distribution optimization method based on genetic algorithm, the problems of unstable renewable energy and limited energy storage units in the microgrid are solved, and rapid and economical energy distribution optimization is achieved, which improves the stability of the system and the service life of the equipment.

CN120498035APending Publication Date: 2025-08-15QINGDAO ITECHENE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510542466.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The power generation power of renewable energy in the microgrid is unstable, and the energy and power of the energy storage unit are limited, which leads to complex systems and difficulty in finding the optimal energy distribution. The existing optimization algorithms are prone to falling into local optimal or prolonging the solution search time.

Method used

The microgrid energy distribution optimization method based on genetic algorithm is adopted, and the power generation unit is prioritized by collecting operating parameters. The NSGAⅡ genetic algorithm and charge and discharge constraint algorithm are used to adjust the particle swarm to ensure that each iteration of particles meet the constraint conditions, and the optimization objective function accelerates the search for the optimal solution.

Benefits of technology

It reduces the time to find the optimal solution, improves the economy and stability of the energy distribution of the microgrid, and reduces the number of energy storage units exceeding the limit and the use of diesel generators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120498035A_ABST
    Figure CN120498035A_ABST
Patent Text Reader

Abstract

The invention provides a micro-grid energy distribution optimization method based on a genetic algorithm, and belongs to the technical field of micro-grid energy optimization based on computer data processing. The method comprises the following steps: firstly, collecting operation parameters of a micro-grid, then determining the priority and the operation parameters of discharging of a photovoltaic unit, a diesel generator and an energy storage unit, determining a power constraint condition, and taking power instructions of the energy storage unit, the photovoltaic unit and the diesel generator in every N time periods at T moments as an initial particle population of a gene random generation genetic algorithm; dynamically adjusting the generated initialized particle swarm by using a charge and discharge constraint algorithm, and finally, carrying out iterative calculation on the particle swarm generated after adjustment through a genetic algorithm and the charge and discharge constraint algorithm to find an optimal solution; according to the method, it is ensured that particles participating in fitness calculation and iteration each time meet constraint conditions, and the time for finding an optimal solution is shortened. Meanwhile, the algorithm is adjusted by setting the constraint condition meeting the optimization target, and approaching to the optimal solution is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of microgrid energy optimization based on computer data processing, and in particular relates to a microgrid energy distribution optimization method based on genetic algorithm. Background Art

[0002] An island microgrid is a system that, disconnected from the main grid, independently supports load power demand through renewable energy, energy storage, and power electronics. It typically includes multiple renewable clean energy sources, such as photovoltaics, wind power, and tidal power; multiple non-renewable energy sources (diesel generators) as backup / emergency power sources; multiple energy storage units, such as lithium-ion batteries, flow batteries, and sodium-ion batteries, to smooth energy fluctuations; and multiple loads and power electronics to maintain grid stability. Renewable clean energy sources are significantly affected by climate and weather fluctuations, resulting in unstable power generation. Energy storage units have limited energy and power, and are subject to the risk of lifespan degradation and even safety issues due to excessive charging and discharging. Consequently, microgrids are characterized by source and load uncertainty, strong randomness, and system complexity, leading to complex energy distribution. Therefore, optimizing the energy distribution among distributed energy resources and storage to achieve optimal economic, environmental, and service life for the entire system is a key challenge in microgrid development.

[0003] To achieve microgrid energy optimization, traditional approaches rely on predicting future power and state of power generation units and loads using multi-objective optimization algorithms, such as annealing algorithms and genetic algorithms, to solve multiple constraints and optimization objectives to achieve optimal energy allocation. Hard constraints are added to the algorithm, and solutions that fail to meet these constraints (for example, requiring power generation to equal power consumption, or requiring battery SOC to be between 0 and 100) are penalized using a penalty function, resulting in them being considered non-optimal. However, complex systems with numerous solutions and constraints are prone to non-compliant solutions. This approach prolongs the solution search time and can easily lead to local optima. Summary of the Invention

[0004] To solve the above problems, the present invention proposes a microgrid energy distribution optimization method based on genetic algorithm, which includes the following steps: S1, collects the operating parameters of the microgrid; including the predicted photovoltaic power generation and load power consumption in each N time period in the future T time period, the upper and lower limits of the state of charge (SOC) of the energy storage unit, the full charge capacity (SOH), the upper and lower limits of the charge and discharge power, the upper and lower limits of the diesel generator power, and the current state of charge (SOC) of the energy storage unit; S2 determines the discharge priority of the photovoltaic unit, diesel generator, and energy storage unit according to the needs of the microgrid. At the same time, it uses the operating parameters collected by S1 to determine the power constraint conditions. The power instructions of the energy storage unit, photovoltaic unit, and diesel generator in every N time period at time T are used as genes to randomly generate the initial particle population of the NSGAⅡ genetic algorithm. S3, uses the charge-discharge constraint algorithm to dynamically adjust the initialized particle swarm generated by S2 so that the adjusted particle swarm meets the constraint conditions; S4, through the NSGAⅡ genetic algorithm and the charge and discharge constraint algorithm, the initialized particle swarm adjusted in S3 is iteratively calculated to find the optimal solution that meets the optimization conditions; S5, power configuration of the devices in the microgrid including photovoltaic units, diesel generators and energy storage units is performed based on the found optimal solution.

[0005] Preferably, S2 uses the operating parameters collected in S1 to determine the power constraint conditions, specifically including: The power upper and lower limits of the photovoltaic power generation unit, energy storage unit, and diesel unit are constrained. That is, the size of the generated particles cannot exceed the power upper and lower limits of the corresponding units obtained in S1. The corresponding formula is expressed as follows: P i,min ≤P i (t)≤P i,max P i,min Represents the power lower limit of the i-th power generation unit, P i,max represents the upper limit of the power of the i-th power generation unit, P i (t) represents the power of the i-th power generation unit at time t, P i (t) should vary between upper and lower power limits; The total generated power should be equal to the total consumed power. The energy storage unit has the characteristics of charging and discharging. The power is defined as positive during discharge and negative during charging. The corresponding formula is expressed as: P DE (t)+P re (t)+P BAT (t)=P load (t) P DE Represents the total power of all diesel generators in the system, P re Represents the total power of all renewable energy sources in the system, P BAT Represents the total power of all energy storage units in the system, P load Represents the total power of all loads in the system, that is, the power sum of all power generation units and energy storage units at time t needs to be equal to the load power; The SOC of the energy storage unit at the future time T should be within the upper and lower limits of the SOC of the corresponding energy storage unit obtained at S1. The formula is expressed as: SOC min ≤SOC(t)≤SOC max SOC min Represents the lower limit of the SOC usage of the unit, SOC max Represents the upper limit of the SOC usage of the energy storage unit. The SOC of the energy storage unit at time t should not exceed the upper and lower limits.

[0006] Preferably, the charge-discharge constraint algorithm is used to dynamically adjust the initialized particle swarm generated by S3. The specific process is as follows: S31, based on the particles generated in S2, calculates the SOC of the energy storage unit in every N time periods at the future time T. If the SOC of the energy storage unit at time t exceeds its corresponding SOC upper and lower limits, the power is adjusted to make the SOC at time t within the upper and lower limits. The adjustment formula is: When SOC exceeds the upper limit: P (t) = P(t)' + (SOC(t) – SOC max ) / 100 *SOH When SOC exceeds the lower limit: P (t) = P(t)' + (SOC(t) – SOC min ) / 100 *SOH Where P(t)' is the power before adjustment at time t, P(t) is the power after adjustment, and SOC(t) is the SOC before adjustment. If the SOC before adjustment exceeds the upper and lower limits at time t, the energy storage unit is marked, indicating that the energy storage unit will not participate in the adjustment during the power adjustment in S32. S32, based on the adjusted energy storage power calculated in S31 and the power of other parts of the particles generated in S2, based on the power constraint condition, adjust the power every N time periods in the future T time periods; Power adjustment is carried out in chronological order, starting from the initial moment. After the current moment is adjusted, the next moment is adjusted until all moments in the scheduling cycle are adjusted.

[0007] Preferably, the S32 specifically includes: According to the state of the energy storage unit after SOC adjustment, including non-rechargeable, non-dischargeable, rechargeable, and dischargeable, different power adjustment algorithms are used: When the total generated power is greater than the load power, the generated power needs to be reduced. The power reduction priority is: diesel generator > energy storage unit > photovoltaic unit. If the energy storage unit is in a non-rechargeable state, the energy storage unit will no longer participate in the power reduction sequence. When the total generated power is less than the load power, the generated power needs to be increased. The power increase priority is: photovoltaic unit > energy storage unit > diesel generator. If the energy storage is in a non-dischargeable state, the energy storage unit will not participate in the power increase sequence. At the same time, the adjustment of power increase and decrease should be within the upper and lower power limits of each generating unit and the upper and lower SOC limits of the energy storage unit.

[0008] Preferably, the S4 specifically includes the following process: S41, each particle is substituted into the optimization objective function to calculate the fitness value; S42, based on the size of the fitness value, select the individual with the highest fitness as the parent through a tournament method; S43, performing a crossover operation on the selected parent generation to generate a new individual and using the charge-discharge constraint algorithm to adjust the constraints to generate a new individual; S44, performing a gene mutation operation on the new individual generated in S43 and using a charge-discharge constraint algorithm to adjust the constraints to generate a new individual; S46, repeat S41-S44 to iterate new individuals until the stopping condition is reached and the iteration stops; S47, outputs the individual with the best fitness in the population as the power instruction.

[0009] Preferably, the optimization objective function includes:

[0010] in is the total electricity cost during the optimization period, Represents the power of the diesel generator at time t, T is the maximum time of the optimization period, , , is a constant;

[0011]

[0012] Represents the number of penalties. If the SOC of the energy storage unit exceeds the specified value at time t, Set to 1, representing 1 penalty;

[0013]

[0014] Represents the number of starts and stops of the diesel generator, Represents the minimum power to keep the diesel generator on. If the power of the diesel generator is less than Increase or change from a larger value to a smaller value , recorded as a start-stop.

[0015] Compared with the prior art, the present invention has the following beneficial effects: This method improves the genetic algorithm for multi-constraint and multi-optimization objectives in microgrid energy optimization scenarios. By applying conditional constraints during the particle swarm generation phase, it ensures that all particles participating in fitness calculations and iterations meet the constraints, reducing the time required to find the optimal solution. Furthermore, by adjusting the algorithm to meet the optimization objectives, it accelerates the process of approaching the optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is an overall flow chart of the optimization method of the present invention.

[0017] Figure 2 3 is a schematic diagram of the results of using a Markov chain to evaluate the optimization algorithm in an embodiment of the present invention.

[0018] Figure 3 This is a schematic diagram of the power allocation results calculated after 300 iterations using this optimization method. DETAILED DESCRIPTION

[0019] This paper proposes an energy optimization method for a photovoltaic-storage-diesel microgrid based on genetic algorithm. The overall process is as follows: Figure 1 As shown: S1, collects the operating parameters of the microgrid; S2 determines the discharge priority of the photovoltaic unit, diesel generator, and energy storage unit according to the needs of the microgrid. At the same time, it uses the operating parameters collected by S1 to determine the power constraint conditions. The power instructions of the energy storage unit, photovoltaic unit, and diesel generator in every N time period at time T are used as genes to randomly generate the initial particle population of the NSGAⅡ genetic algorithm. S3, uses the charge-discharge constraint algorithm to dynamically adjust the initialized particle swarm generated by S2 so that the adjusted particle swarm meets the constraint conditions; S4, through the NSGAⅡ genetic algorithm and the charge and discharge constraint algorithm, the initialized particle swarm adjusted in S3 is iteratively calculated to find the optimal solution of the load optimization condition; S5, power configuration of the devices in the microgrid including photovoltaic units, diesel generators and energy storage units is performed based on the found optimal solution.

[0020] The specific implementation process of the present invention is further described below in conjunction with specific embodiments.

[0021] S1. Collect the operating parameters of the microgrid The operating parameters obtained in this embodiment include: the predicted photovoltaic power generation and load power consumption of the microgrid every hour in the next 24 hours, the SOC upper and lower limits of the energy storage unit (SOC max , SOC min ), full charge capacity (SOH), upper and lower limits of charge and discharge power (P bat,max , P bat,min ), the upper and lower limits of diesel generator power (P DE,max , P DE,min ) and the current SOC of the energy storage unit. The predicted photovoltaic power generation and load power consumption for the next 24 hours are obtained from the energy management system's prediction module via the database. Other parameters are obtained from the local collector via the gateway.

[0022] S2, based on the needs of the microgrid, determines the discharge priority of the photovoltaic unit, diesel generator, and energy storage unit. At the same time, the operating parameters collected in S1 are used to determine the power constraints. The power instructions of the energy storage unit, photovoltaic unit, and diesel generator in every N time period at time T are used as genes to randomly generate the initial particle population of the NSGAⅡ genetic algorithm. S21. Determine the discharge priority of photovoltaic units, diesel generators, and energy storage units based on the needs of the microgrid. Generally, the discharge priority is: photovoltaic units > energy storage units > diesel generator units. Photovoltaic units are renewable energy, so they are given priority when discharging. Energy storage units are clean energy and are rechargeable, so their discharge order is better than that of diesel generators. Diesel generators are non-renewable energy and have certain pollution to the environment, so their discharge priority order is the lowest.

[0023] S22, determine the power constraints, which generally include the following conditions: 1. The power upper and lower limits of the photovoltaic power generation unit, energy storage unit and diesel unit are constrained, that is, the size of the generated particles cannot exceed the power upper and lower limits of the corresponding units obtained in S1. Corresponding formula expression: P i,min ≤P i (t)≤P i,max P i,min Represents the power lower limit of the i-th power generation unit, P i,max Represents the power upper limit of the i-th power generation unit, P i (t) represents the power of the i-th power generation unit at time t, P i (t) should vary between upper and lower power limits.

[0024] 2. The total generated power should be equal to the total consumed power. The energy storage unit has the nature of charging and discharging. The power is defined as positive when discharging and negative when charging. Therefore, the corresponding formula is expressed as: P DE (t)+P re (t)+P BAT (t)=P load (t) P DE Represents the total power of all diesel generators in the system, P re Represents the total power of all renewable energy sources in the system, P BAT Represents the total power of all energy storage units in the system (in this embodiment, charging is negative and discharging is positive), P load Represents the total power of all loads in the system, that is, the power sum of all power generation units and energy storage units at time t needs to be equal to the load power.

[0025] 3. The SOC of the energy storage unit in the next 24 hours should be within the upper and lower limits of the SOC of the corresponding energy storage unit obtained in S1. The formula is expressed as: SOC min ≤SOC(t) ≤SOC max SOC min Represents the lower limit of the SOC usage of the unit, SOC max Represents the upper limit of the SOC usage of the energy storage unit. The SOC of the energy storage unit at time t should not exceed the upper and lower limits.

[0026] The energy storage unit (P BAT ), photovoltaic unit (P PV ), diesel generator (P DE ) The power instructions for each hour in the next 24 hours are used as genes to randomly generate several initial particle populations.

[0027] S3, using the charge-discharge constraint algorithm to dynamically adjust the initialized particle swarm generated by S2, so that the adjusted particle swarms meet the constraint conditions; According to the designed constraint algorithm, each generated initialization particle in S2 is adjusted and a new particle is generated after the adjustment. The generated new particles can ensure that each one meets the constraint conditions specified in S2. Specifically, it includes: S31 calculates the SOC of the energy storage unit every hour for the next 24 hours based on the particles generated in S22. The calculation formula is:

[0028] If the SOC of the energy storage unit at time t exceeds its corresponding SOC upper and lower limits, the power is adjusted to make the SOC at time t within the upper and lower limits. The adjustment formula is: P (t) = P(t)' + (SOC(t) – SOC max) / 100 *SOH (when SOC exceeds the upper limit), P (t) = P(t)' + (SOC(t) – SOC min ) / 100 *SOH (when SOC exceeds the lower limit). Where P(t)' is the power before adjustment at time t, P(t) is the power after adjustment, and SOC(t) is the SOC before adjustment. If the SOC before adjustment exceeds the upper and lower limits at time t, the energy storage unit is marked, indicating that the energy storage unit will not participate in the adjustment during S23 power adjustment:

[0029] S32, based on the adjusted energy storage power calculated in S31 and the power of other parts of the particles generated in S2, call the power adjustment function every hour for the next 24 hours to adjust the power equation recorded in S22: Different power adjustment algorithms are used depending on the state of the energy storage unit after SOC adjustment (non-rechargeable, non-dischargeable, chargeable and dischargeable). When total generated power exceeds load power, generated power must be reduced. The power reduction priority is: diesel generator > energy storage unit > photovoltaic unit. If the energy storage unit is in a non-rechargeable state, the energy storage unit is not included in the power reduction sequence. When total generated power is less than load power, generated power must be increased. The power increase priority is: photovoltaic unit > energy storage unit > diesel generator. If the energy storage unit is in a non-dischargeable state, the energy storage unit is not included in the power increase sequence. Furthermore, power increase and decrease adjustments should be within the upper and lower power limits of each generating unit and the upper and lower SOC limits of the energy storage unit.

[0030] Power adjustment is carried out in chronological order, starting from the initial moment. After the current moment is adjusted, the next moment is adjusted until all moments in the scheduling cycle are adjusted.

[0031] S4, through the NSGAⅡ genetic algorithm and the charge and discharge constraint algorithm, the initialized particle swarm adjusted in S3 is iteratively calculated to find the optimal solution of the load optimization condition; S41, substituting each particle into the optimization objective function to calculate the fitness value; The optimization objective function is: ①

[0032] in is the total electricity cost during the optimization period, represents the power of the diesel generator at time t, T is the maximum time of the optimization period (24h), , , is a constant.

[0033]

[0034]

[0035] Represents the number of penalties. If the SOC of the energy storage unit exceeds the specified value at time t, Set to 1, representing 1 penalty.

[0036]

[0037]

[0038] Represents the number of starts and stops of the diesel generator, Represents the minimum power to keep the diesel generator on. If the power of the diesel generator is less than Increase or change from a larger value to a smaller value , recorded as a start-stop.

[0039] S42, based on the size of the fitness value, select the individual with the highest fitness as the parent through a tournament method; S43, performing a crossover operation on the selected parent to generate a new individual and using the constraint algorithm specified in S3 to perform constraint adjustment to generate a new individual; S44, performing a gene mutation operation on the new individual generated in S43 and performing constraint adjustment using the constraint algorithm specified in S3 to generate a new individual; S46, repeat S41-S44 to iterate new individuals until the stopping condition is reached and the iteration stops; S47, outputs the individual with the best fitness in the population as the power instruction.

[0040] S5. Configure the power of the devices in the solar-storage-diesel microgrid based on the optimal solution found. S51, decomposing the generated optimal solution into power vectors of the energy storage unit, photovoltaic unit, and diesel generator in every N time periods at time T; S52, sending the power vector decomposed in S51 to the local control unit, which changes the power control instruction according to the frequency of the N period; Figure 2 The Markov chain was used to evaluate the convergence of the iterations after using this optimization method. Without the optimization strategy, the mathematical discrete values of the particles did not converge after 300 iterations. With the optimization strategy, convergence was achieved after 60 generations. This greatly accelerated the genetic algorithm's search for the optimal solution while saving computing resources.

[0041] Figure 3This is the power allocation result calculated after 300 iterations using this optimization method. Compared with the traditional peak-shaving and valley-filling power allocation control logic, it reduces diesel consumption by 3.8% and the number of battery overloads by 38.8%.

[0042] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

[0043] Although the above describes the specific implementation methods of the present invention, it does not limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A microgrid energy distribution optimization method based on genetic algorithm, characterized in that: The following steps are involved: S1, collects the operating parameters of the microgrid; including the predicted photovoltaic power generation and load power consumption in each N time period in the future T time period, the upper and lower limits of the state of charge (SOC) of the energy storage unit, the full charge capacity (SOH), the upper and lower limits of the charge and discharge power, the upper and lower limits of the diesel generator power, and the current state of charge (SOC) of the energy storage unit; S2 determines the discharge priority of the photovoltaic unit, diesel generator, and energy storage unit according to the needs of the microgrid. At the same time, it uses the operating parameters collected by S1 to determine the power constraint conditions. The power instructions of the energy storage unit, photovoltaic unit, and diesel generator in every N time period at time T are used as genes to randomly generate the initial particle population of the NSGAⅡ genetic algorithm. S3, uses the charge-discharge constraint algorithm to dynamically adjust the initialized particle swarm generated by S2 so that the adjusted particle swarm meets the constraint conditions; S4, using NSGAⅡ genetic algorithm and charge-discharge constraint algorithm to iteratively calculate the particle swarm initialized after adjustment in S3 to find the optimal solution that meets the optimization conditions; S5, power configuration of the devices in the microgrid including photovoltaic units, diesel generators and energy storage units is performed based on the found optimal solution.

2. The microgrid energy distribution optimization method based on genetic algorithm according to claim 1, characterized in that: S2 uses the operating parameters collected in S1 to determine the power constraints, including: The power upper and lower limits of the photovoltaic power generation unit, energy storage unit, and diesel unit are constrained. That is, the size of the generated particles cannot exceed the power upper and lower limits of the corresponding units obtained in S1. The corresponding formula is expressed as follows: P i,min ≤P i (t)≤P i,max P i,min Represents the power lower limit of the i-th power generation unit, P i,max Represents the power upper limit of the i-th power generation unit, P i (t) represents the power of the i-th power generation unit at time t, P i (t) should vary between upper and lower power limits; The total generated power should be equal to the total consumed power. The energy storage unit has the characteristics of charging and discharging. The power is defined as positive during discharge and negative during charging. The corresponding formula is expressed as: P DE (t)+P re (t)+P BAT (t)=P load (t) P DE Represents the total power of all diesel generators in the system, P re Represents the total power of all renewable energy sources in the system, P BAT Represents the total power of all energy storage units in the system, P load Represents the total power of all loads in the system, that is, the power sum of all power generation units and energy storage units at time t needs to be equal to the load power; The SOC of the energy storage unit at the future time T should be within the upper and lower limits of the SOC of the corresponding energy storage unit obtained at S1. The formula is expressed as: SOC min ≤SOC(t)≤SOC max SOC min Represents the lower limit of the SOC usage of the unit, SOC max Represents the upper limit of the SOC usage of the energy storage unit. The SOC of the energy storage unit at time t should not exceed the upper and lower limits.

3. The microgrid energy distribution optimization method based on genetic algorithm according to claim 2, characterized in that: Use the charge-discharge constraint algorithm to dynamically adjust the initialized particle swarm generated by S3. The specific process is as follows: S31, based on the particles generated in S2, calculates the SOC of the energy storage unit in every N time periods at the future time T. If the SOC of the energy storage unit at time t exceeds its corresponding SOC upper and lower limits, the power is adjusted to make the SOC at time t within the upper and lower limits. The adjustment formula is: When SOC exceeds the upper limit: P (t) = P(t)' + (SOC(t) – SOC max ) / 100 *SOH When SOC exceeds the lower limit: P (t) = P(t)' + (SOC(t) – SOC min ) / 100 *SOH Where P(t)' is the power before adjustment at time t, P(t) is the power after adjustment, and SOC(t) is the SOC before adjustment. If the SOC before adjustment exceeds the upper and lower limits at time t, the energy storage unit is marked, indicating that the energy storage unit will not participate in the adjustment during the power adjustment in S32. S32, based on the adjusted energy storage power calculated in S31 and the power of other parts of the particles generated in S2, based on the power constraint condition, adjust the power every N time periods in the future T time periods; Power adjustment is carried out in chronological order, starting from the initial moment. After the current moment is adjusted, the next moment is adjusted until all moments in the scheduling cycle are adjusted.

4. The microgrid energy distribution optimization method based on genetic algorithm according to claim 3, characterized in that: The S32 specifically includes: According to the state of the energy storage unit after SOC adjustment, including non-rechargeable, non-dischargeable, rechargeable, and dischargeable, different power adjustment algorithms are used: When the total generated power is greater than the load power, the generated power needs to be reduced. The power reduction priority is: diesel generator > energy storage unit > photovoltaic unit. If the energy storage unit is in a non-rechargeable state, the energy storage unit will no longer participate in the power reduction sequence. When the total generated power is less than the load power, the generated power needs to be increased. The power increase priority is: photovoltaic unit > energy storage unit > diesel generator. If the energy storage is in a non-dischargeable state, the energy storage unit will not participate in the power increase sequence. At the same time, the adjustment of power increase and decrease should be within the upper and lower power limits of each generating unit and the upper and lower SOC limits of the energy storage unit.

5. The microgrid energy distribution optimization method based on genetic algorithm according to claim 1, characterized in that: The S4, specifically The following processes are included: S41, each particle is substituted into the optimization objective function to calculate the fitness value; S42, based on the size of the fitness value, select the individual with the highest fitness as the parent through a tournament method; S43, performing a crossover operation on the selected parent generation to generate a new individual and using the charge-discharge constraint algorithm to adjust the constraints to generate a new individual; S44, performing a gene mutation operation on the new individual generated in S43 and using a charge-discharge constraint algorithm to adjust the constraints to generate a new individual; S46, repeat S41-S44 to iterate new individuals until the stopping condition is reached and the iteration stops; S47, outputs the individual with the best fitness in the population as the power instruction.

6. The microgrid energy distribution optimization method based on genetic algorithm according to claim 5, characterized in that: The optimization objective function includes: in is the total electricity cost during the optimization period, Represents the power of the diesel generator at time t, T is the maximum time of the optimization period, , , is a constant; Represents the number of penalties. If the SOC of the energy storage unit exceeds the specified value at time t, Set to 1, representing 1 penalty; Represents the number of starts and stops of the diesel generator, Represents the minimum power to keep the diesel generator on. If the power of the diesel generator is less than Increase or change from a larger value to a smaller value , recorded as a start-stop.