A method for joint simulation of a distributed energy system

By combining closed-loop co-simulation of COMSOL and Simulink in a wind-solar-hydrogen storage system, using a radial flow field PEMFC model and adaptive step size adjustment to train a surrogate model, and optimizing control parameters based on internal physical field information, the problems of simulation result distortion and low computational efficiency caused by model simplification in existing technologies are solved, thereby improving simulation accuracy and system reliability.

CN122491068APending Publication Date: 2026-07-31SHANDONG JIANZHU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG JIANZHU UNIV
Filing Date
2026-06-25
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing dynamic simulations of wind-solar-hydrogen storage systems rely on lumped parameter simplified models in MATLAB/Simulink, which cannot effectively combine with the refined PEMFC model in COMSOL. Furthermore, the co-simulation runs with a fixed step size, which cannot balance the solution accuracy of transient processes with the computational efficiency of steady-state processes. The accumulated high-fidelity data is not effectively reused, and the spatial distribution information of the physical field inside the PEMFC is not used for control strategy optimization.

Method used

A radial flow field PEMFC multiphysics coupling model was constructed in the COMSOL Multiphysics platform. It was then used to perform closed-loop co-simulation with the Simulink system-level dynamic model through the LiveLink interface. Adaptive variable step size adjustment and surrogate model training were adopted, and the control parameters were optimized offline by combining the internal physics information of PEMFC.

Benefits of technology

This approach enables the accurate reflection of the internal physical field information of PEMFC in system-level dynamic simulation, improving simulation accuracy and efficiency, optimizing control strategies, and extending the operational life and reliability of PEMFC.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122491068A_ABST
    Figure CN122491068A_ABST
Patent Text Reader

Abstract

This invention relates to the field of energy system simulation, specifically a co-simulation method for distributed energy systems. The method establishes a PEMFC (Physical Environment Component Model) multiphysics coupling model in COMSOL Multiphysics, containing a complete geometric structure and employing radial flow field configurations at both the anode and cathode. A system-level dynamic model and hierarchical control strategy are built in MATLAB / Simulink. Closed-loop co-simulation is performed on both platforms at each time step. During the co-simulation, the simulation step size is adaptively adjusted based on the spatial rate of change of the internal physical fields of the PEMFC. High-fidelity data accumulated from the co-simulation is used to train a surrogate model with physical information constraints to accelerate subsequent simulations. The control strategy parameters are optimized offline with the goal of achieving internal field uniformity. This invention solves the problem of system simulation distortion caused by the simplified PEMFC model, while simultaneously achieving adaptive improvement in simulation efficiency, simulation data reuse, and control parameter optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of energy system simulation, specifically a co-simulation method for distributed energy systems. It uses a radial flow field proton exchange membrane fuel cell multiphysics model established in COMSOL Multiphysics to perform closed-loop co-simulation with a MATLAB / Simulink system-level dynamic model through the LiveLink data interface. Based on the co-simulation platform, it realizes adaptive variable step size acceleration, surrogate model construction, and offline optimization of control parameters, which is used for the study of dynamic characteristics of wind-solar-hydrogen-storage combined heat and power systems. Background Technology

[0002] The combined solar-wind-hydrogen-storage system integrates multiple energy units, including photovoltaic power generation, wind power generation, proton exchange membrane fuel cells (PEMFCs), hydrogen electrolysis, hydrogen storage, and batteries. It represents a crucial technological pathway for achieving efficient renewable energy utilization and stable power supply. Dynamic simulation of this type of multi-energy coupled system is essential for evaluating its operational characteristics, verifying control strategies, and guiding engineering design. The core of system-level dynamic simulation lies in the accuracy of the models for each energy unit. Among these, the accuracy of the PEMFC, as the only controllable power generation module, directly determines the reliability of the entire system simulation results.

[0003] The dynamic simulations of existing wind-solar-hydrogen-storage systems are almost entirely completed within a single MATLAB / Simulink platform. The PEMFC model in this platform employs an equivalent circuit model or a static polarization curve model based on empirical parameters, which is a simplified lumped-parameter model. This simplified model compresses all the multi-physics coupling processes within the PEMFC—convection and diffusion of gas in porous media, electron and proton conduction, electrochemical reaction kinetics, heat generation and transfer, and phase change and transport of liquid water—into a single voltage-current empirical relationship. This completely fails to reflect the influence of the PEMFC's flow field configuration, diffusion layer porosity and thickness, catalyst layer structural parameters, and other geometric and material characteristics on the battery's output characteristics. Consequently, the resulting dynamic response deviations of the PEMFC under high power and variable load conditions are transmitted to other subsystems such as photovoltaic, wind power, and energy storage through the DC bus power balance, causing systematic distortion of the entire system-level simulation results.

[0004] COMSOL Multiphysics possesses powerful multiphysics coupling solution capabilities, enabling the creation of refined 3D PEMFC models that include complete geometry, realistic material properties, and multiphysics coupling mechanisms. However, COMSOL itself lacks the ability to construct complete system-level dynamic models encompassing photovoltaic arrays, wind turbines, electrolyzers, batteries, hydrogen storage tanks, grid-connected inverters, and hierarchical control strategies. Currently, there is no effective method for interactive co-simulation of COMSOL refined PEMFC models with Simulink system-level models at each time step. Furthermore, radial flow fields, as a novel flow field configuration distinct from traditional parallel and serpentine flow fields, exhibit advantages such as short flow paths, low pressure drops, and uniform current density distribution, as the reactant gas diffuses radially outward from the central inlet. However, current research on radial flow field PEMFCs is limited to the single-cell level, and there is no evidence of incorporating them as controllable energy units into wind-solar-hydrogen-storage combined heat and power systems for closed-loop dynamic co-simulation.

[0005] Based on co-simulation, the COMSOL multiphysics model requires iteratively solving all physics control equations until convergence at each simulation time step. This results in long single-step computation times, and running with a fixed small step size throughout the entire simulation duration leads to high overall computational costs. However, excessively large simulation step sizes may cause the loss of crucial transient information during periods of drastic system state changes due to insufficient time resolution. Current technologies lack a means to adaptively adjust the co-simulation step size based on the degree of drastic change in the internal physics fields of the PEMFC. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a co-simulation method for distributed energy systems, aiming to overcome the following deficiencies of existing technologies: (1) The dynamic simulation of wind-solar-hydrogen-storage systems relies entirely on the simplified model of PEMFC lumped parameters within the Simulink platform, and lacks an effective method for closed-loop co-simulation of the refined PEMFC model in COMSOL and the Simulink system-level model; (2) Co-simulation runs with a fixed step size, which cannot balance the solution accuracy of transient processes with the computational efficiency of steady-state processes; (3) The high-fidelity data accumulated by co-simulation is not effectively reused to accelerate subsequent simulation tasks; (4) The spatial distribution information of the PEMFC internal physical field provided by co-simulation is not used for the optimization of control strategy parameters.

[0007] To solve the aforementioned technical problem, the present invention adopts the following technical solution: A co-simulation method for wind-solar-hydrogen storage systems based on a refined radial flow field PEMFC model includes the following steps: S01: Constructing a refined PEMFC multiphysics coupled radial flow field model. A PEMFC model with a complete three-dimensional geometry, including bipolar plates, flow field, gas diffusion layer, catalyst layer, and proton exchange membrane, was established in the COMSOL Multiphysics platform. Both the anode and cathode flow fields adopted a radial flow field configuration where the reactant gas diffuses radially outward from the central inlet and exits from the peripheral outlet. The model coupled and solved the following physical fields in three-dimensional geometric space: the momentum conservation equation describing the fluid flow in the channel and porous media region; the Maxwell-Stefan component conservation equation describing the multi-component convection and diffusion of hydrogen, oxygen, water vapor, and nitrogen; the charge conservation equation describing solid-phase electron conduction and membrane-phase proton conduction; the Butler-Volmer equation describing the kinetics of anodic hydrogen oxidation and cathodic oxygen reduction reactions; the energy conservation equation including electrochemical reaction heat, ohmic heat, and phase change heat source terms; and the liquid water equation describing the phase change and capillary diffusion transport of liquid water in the catalyst layer. Boundary conditions are set as follows: the anode potential is fixed at zero reference potential, and the cathode potential is set to the battery operating voltage V_cell. This operating voltage is dynamically specified by Simulink based on the PEMFC target power and transmitted to COMSOL in real time via the LiveLink interface during co-simulation; the gas flow rates at the anode and cathode inlets are calculated and determined based on the stoichiometry, reference current density, and active area of ​​the catalyst layer; the gauge pressures at the anode and cathode gas outlets are set to zero; and no-slip boundary conditions are applied to all solid walls.

[0008] S02: Building a Simulink System-Level Dynamic Model. In the MATLAB / Simulink platform, a system-level dynamic model of the combined wind, solar, hydrogen, and energy storage system is built, including a photovoltaic array model (based on a single-diode equivalent circuit model), a wind turbine model (based on the wind energy conversion principle, with output power determined by wind speed, impeller radius, air density, and wind energy utilization coefficient), an electrolyzer model (based on the UI characteristic equation, with hydrogen production rate proportional to electrolysis current according to Faraday's law), a hydrogen storage tank model (based on the ideal gas law), a battery model (based on the double sulfuric acid theory's charge-discharge model), a DC bus model, and a grid-connected inverter model. Each subsystem is coupled to the DC bus via its respective DC / DC converter, and the DC bus is connected to the AC bus side via the grid-connected inverter. A hierarchical control strategy is configured. The upper-level energy management layer generates power allocation commands for each subsystem based on the matching relationship between the real-time output and load demand of each subsystem. The lower-level local controllers adjust the duty cycle of the corresponding DC / DC converter according to the power commands. In Simulink, an interface module is reserved for the PEMFC subsystem. The input of this interface module is the reference current or reference power of the PEMFC, and the output is the terminal voltage and actual output power of the PEMFC.

[0009] S03: Establish a cross-software closed-loop co-simulation platform. Using the COMSOL Multiphysics LiveLink for Simulink data interface, establish a bidirectional data link between the PEMFC model from step S01 and the Simulink PEMFC interface module from step S02, thus forming a cross-software closed-loop co-simulation platform. The platform operates as follows within each simulation time step: The upper energy management layer on the Simulink side calculates the power P_FC_ref that the PEMFC should handle based on the current wind and solar power output and load demand. The power outer loop of the PEMFC local controller converts P_FC_ref into a reference current I_ref. Simulink then transmits I_ref to COMSOL via the LiveLink interface. COMSOL adjusts the cathode bipolar plate potential V_sol with I_ref as the target, iteratively solving all physical field control equations on the PEMFC multiphysics refined model until convergence. Then, the solved PEMFC output voltage V_out, output power P_out, catalyst layer oxygen concentration field, membrane water content field, temperature field, and current density field are fed back to Simulink via the LiveLink interface. Simulink uses P_out as the actual output of the PEMFC subsystem, performs bus power balance calculations with photovoltaic power, wind power, battery power, and electrolyzer power, updates system state variables such as DC bus voltage and battery state of charge, and enters the next time step after completing the state update for the current time step. The COMSOL model runs continuously throughout the simulation duration, participating in the aforementioned closed-loop data interaction at each time step.

[0010] S04: Adaptive variable step size adjustment of internal field gradient. During the co-simulation run in step S03, the internal field gradient index G at each simulation time step is calculated using the internal physical field distribution data fed back by COMSOL. ,in , and Δt represents the maximum spatial gradient magnitudes of the membrane water content field, temperature field, and catalyst layer oxygen concentration field at the current time step, respectively, with w1, w2, and w3 being preset weighting coefficients. When G is greater than the preset upper threshold G_high, it indicates that the PEMFC is in a severe transient process, and the simulation step size of the next time step is reduced to Δt_small to improve the transient solution accuracy. When G is less than the preset lower threshold G_low, it indicates that the PEMFC is approaching a steady state, and the simulation step size of the next time step is increased to Δt_large to reduce the total simulation time. When G is between G_low and G_high, the current step size remains unchanged. The upper threshold G_high and lower threshold G_low are calibrated by statistical analysis of the internal field response data of the PEMFC under typical step conditions. To suppress frequent step size switching caused by noise, a minimum step size hold time constraint is introduced.

[0011] S05: Train the PEMFC surrogate model to accelerate subsequent simulations. Using the PEMFC input-output data pairs accumulated during the joint simulation in steps S03 and S04, train a deep neural network-based PEMFC surrogate model. The input data dimensions include: PEMFC operating current, anode inlet flow rate, cathode inlet flow rate, anode inlet humidity, cathode inlet humidity, and operating temperature (six dimensions in total); the output data dimensions include: PEMFC terminal voltage, output power, membrane water content profile, and average oxygen concentration in the cathode catalyst layer. To improve the predictive reliability of the surrogate model in the extrapolation region where the training data is sparse, a physical information-constrained training method is adopted: the loss function L = L_data + λ·L_physics, where L_data is the mean square error between the surrogate model's predicted value and the COMSOL reference value, L_physics is the weighted sum of the residuals after substituting the physical field output by the surrogate model into the PEMFC governing equations, including mass conservation residuals, Maxwell-Stefan component conservation residuals, charge conservation residuals, and energy conservation residuals, and λ is the balance coefficient. After the surrogate model is trained, it replaces the COMSOL model in Simulink co-simulation when performing new simulation tasks. This reduces the single-step solution time of the PEMFC subsystem from minutes of COMSOL iterations to milliseconds of the surrogate model's neural network forward inference, freeing the total simulation time from being constrained by the COMSOL solution speed. After each round of co-simulation, the newly accumulated operating data is added to the training set, and the surrogate model is incrementally fine-tuned. Shallow weights are frozen, and only the top-level parameters are updated, while the physical constraint loss term is retained. This allows the surrogate model to continuously improve its accuracy and operating condition coverage with increasing usage.

[0012] S06: Offline Optimization of Control Parameters Based on Internal Field Information. Using the spatial distribution data of the PEMFC internal physical field output by COMSOL during the co-simulation platform operation in step S03, the PI parameters of the PEMFC local controller in the hierarchical control strategy described in step S02 are optimized offline. Specifically, the spatial uniformity of the PEMFC internal physical field is selected as the optimization objective. A uniformity evaluation function J = α·Var(λ) + β·Var(C_O2) + γ·Var(T) is defined, where Var(λ), Var(C_O2), and Var(T) are the spatial variances of membrane water content, catalyst layer oxygen concentration, and membrane temperature over the active area of ​​the PEMFC, respectively, and α, β, and γ are preset weights. Under typical dynamic conditions, multiple sets of PI parameter combinations are selected and co-simulated separately, recording the time-domain integral value of the PEMFC internal physical field uniformity evaluation function J under each set of parameters. The PI parameter combination that minimizes the time-domain integral value of J is selected as the optimized PEMFC controller parameters. This optimization method utilizes the internal field space distribution information that traditional simplified PEMFC models cannot provide, and can simultaneously take into account the output performance of PEMFC and the uniformity of the internal state, the latter of which directly affects the lifespan and reliability of PEMFC.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention, for the first time, embeds a refined three-dimensional PEMFC model of the radial flow field, incorporating complete geometric structure and multi-physics coupling mechanisms, into the system-level dynamic simulation of a combined wind-solar-hydrogen-storage system. Closed-loop data interaction at each time step is achieved between COMSOL micro-physics field solving and Simulink system-level macro-power balance calculation via the LiveLink interface. The system-level simulation results accurately reflect the influence of micro-parameters such as PEMFC flow field configuration, diffuser porosity, and catalyst layer thickness on the system's macro-dynamic behavior, thus solving the problem of systematic distortion in system simulation results caused by oversimplification of the PEMFC model in existing technologies.

[0014] The present invention proposes an internal field gradient adaptive variable step size mechanism, and dynamically adjusts the joint simulation step size accordingly. When there are drastic changes in the PEMFC, a small step size is used to ensure the transient solution accuracy, and a large step size is used to reduce the computational cost when it tends to a steady state, thus achieving an adaptive balance between simulation accuracy and computational efficiency.

[0015] This invention utilizes high-fidelity data accumulated through co-simulation to train a PEMFC surrogate model, reducing the single-step computation time of PEMFC in subsequent simulation tasks. The surrogate model is trained with physical information constraints to ensure the physical rationality of extrapolation predictions and possesses incremental learning capabilities to continuously improve accuracy. This approach enables the effective reuse of simulation data, allowing the computational efficiency of the co-simulation platform to continuously improve with the number of uses.

[0016] This invention utilizes the unique spatial distribution information of the internal physical field of the PEMFC (Polymer Physical Components) on the co-simulation platform to perform offline optimization of the PI parameters of the control strategy with the goal of improving the uniformity of the internal physical field. The optimized control parameters not only meet the system power response requirements, but also improve the uniformity of membrane water content, oxygen concentration, and temperature within the PEMFC, thereby reducing the risks of local hot spots, membrane drying, and oxygen starvation, and improving the service life and reliability of the PEMFC. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the PEMFC 3D geometric model; Figure 2 A schematic diagram of a radial flow field PEMFC multiphysics coupling model and a distributed energy system; Figure 3 This is a flowchart illustrating the data interaction between COMSOL and Simulink for time-step closed-loop co-simulation via the LiveLink interface in this invention. Figure 4 This is a flowchart of the method described in Example 1; Figure 5 This is a flowchart illustrating the decision logic for adaptive variable step size adjustment of the internal field gradient in this invention. Figure 6 This is a schematic diagram of the proxy model training architecture and the composition of the physical information constraint loss function of the present invention; Figure 7 Flowchart for offline optimization of PI control parameters based on PEMFC internal field information; In the figure: 1. Positive bipolar plate, 2. Anode flow field, 3. Anode gas diffusion layer, 4. Anode catalyst layer, 5. Proton exchange membrane, 6. Cathode catalyst layer, 7. Cathode gas diffusion layer, 8. Cathode flow field, 9. Cathode bipolar plate. Detailed Implementation

[0018] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0019] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings of the specific embodiments. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this patent, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this patent.

[0020] Example 1 This embodiment discloses a co-simulation method for distributed energy systems, such as... Figure 4 As shown, it includes the following steps: SO1. A radial flow field PEMFC multiphysics coupled model was established in the COMSOL Multiphysics platform. The model solved six governing equations in three-dimensional space: momentum conservation was described using the Navier-Stokes and Brinkman equations in the flow channel and porous media region; composition conservation was described using the Maxwell-Stefan equations in the gas diffusion layer and catalyst layer; electron and proton conduction was described using the charge conservation equations in the catalyst layer and proton exchange membrane region; the kinetics of the hydroxide and oxygen reduction reactions were described using the Butler-Volmer equations in the anode and cathode catalyst layers, respectively; reaction heat, ohmic heat, and phase transition heat were described using energy conservation equations in all regions; and phase transition and capillary diffusion were described using the liquid water equations in the cathode catalyst layer. Boundary conditions: the anode bipolar plate potential was fixed at zero reference potential; the cathode bipolar plate potential V_sol was dynamically specified by Simulink in the co-simulation; the inlet gas temperature, component mass fraction, and flow rate of the anode and cathode were set according to the operating conditions; the outlet gauge pressure was zero; and there was no slippage on any wall surface. After verifying mesh independence, the model was saved as a COMSOL model file.

[0021] In this embodiment, the process of constructing the radial flow field PEMFC multiphysics coupling model is as follows: First, a nine-layer PEMFC geometric model is constructed in SolidWorks, such as... Figure 1 As shown, the model comprises a complete nine-layer geometric structure, consisting of, in order: anode bipolar plate 1, anode flow field 2 (radial channel), anode gas diffusion layer 3, anode catalyst layer 4, proton exchange membrane 5, cathode catalyst layer 6, cathode gas diffusion layer 7, cathode flow field 8 (radial channel), and cathode bipolar plate 9. Both the anode and cathode flow fields adopt a radial flow field configuration: a circular inlet is located in the center of the flow field, with multiple outlets evenly distributed in the outer annular region. A mixture of hydrogen and water vapor is introduced into the anode side, while air is introduced into the cathode side. The gas enters from the central inlet and diffuses radially outward, passing through the gas diffusion layer and entering the catalyst layer to participate in the electrochemical reaction. Unreacted gases and product water are discharged from the outer outlets. Figure 1This is a three-dimensional model of a single proton exchange membrane fuel cell. To simulate multiple proton exchange membrane fuel cells, their three-dimensional models can be stacked axially.

[0022] The completed 3D geometric model was exported to COMSOL for mesh generation, and the following physical fields were added in sequence: momentum conservation equation describing fluid flow in the channel and porous media region; Maxwell-Stefan composition conservation equation describing multi-component convection and diffusion of hydrogen, oxygen, water vapor and nitrogen; charge conservation equation describing solid-phase electron conduction and membrane-phase proton conduction; Butler-Volmer equation describing the kinetics of anodic hydroxide oxidation and cathodic oxygen reduction reaction; energy conservation equation including terms for electrochemical reaction heat, ohmic heat and phase change heat source; and liquid water equation describing phase change and capillary diffusion transport of liquid water in the catalyst layer.

[0023] Boundary conditions are set as follows: the anode potential is fixed at zero reference potential, and the cathode potential is set to the battery operating voltage V_cell. This operating voltage is dynamically specified by Simulink based on the PEMFC target power and transmitted to COMSOL in real time through the LiveLink interface during co-simulation. The gas flow rates at the anode and cathode inlets are calculated and determined based on the stoichiometry, reference current density, and active area of ​​the catalyst layer. The gauge pressure at the anode and cathode gas outlets is set to zero. No-slip boundary conditions are applied to all solid walls.

[0024] S02. Build a dynamic model of a combined wind, solar, hydrogen, and energy storage system in the MATLAB / Simulink platform, such as... Figure 2 As shown, the models include: a photovoltaic array model based on a single diode equivalent circuit, a wind turbine model based on the wind energy conversion principle, a valve-regulated lead-acid battery model based on the double sulfuric acid theory, an electrolyzer model based on the UI characteristic equation, and a hydrogen storage tank model based on the ideal gas law. Each subsystem is coupled to the DC bus via a DC / DC converter, and the DC bus is connected to the AC bus via a PQ-controlled grid-connected inverter. A hierarchical control strategy is configured: The upper-level energy management layer collects photovoltaic and wind power in real time and compares them with the load power. When the output of wind and solar power meets the load demand, the surplus power is allocated to the electrolyzer for hydrogen production and the battery for charging. When the output of wind and solar power is insufficient, the PEMFC first outputs power to make up for the deficiency, and the insufficient part is supplemented by the battery discharge. In the lower-level local controllers, photovoltaic power adopts the variable step size disturbance observation method MPPT control, wind power adopts the fixed step size climbing method MPPT combined with speed-current dual closed-loop control, PEMFC and electrolyzer adopt the power outer loop-current inner loop dual closed-loop control, and the battery adopts the voltage outer loop-current inner loop dual closed-loop control to maintain the DC bus voltage stability.

[0025] S03, such as Figure 3As shown, a bidirectional data link is established between the PEMFC model file and the PEMFC interface module in Simulink through COMSOL's LiveLink for Simulink interface. After setting the initial step size for co-simulation, COMSOL runs continuously throughout the entire simulation duration, participating in closed-loop data interaction at each time step. The execution flow for each time step is as follows: The upper energy management layer on the Simulink side calculates the target power of the PEMFC based on the current wind and solar power output and load demand. The PEMFC power outer loop converts this into a reference current and transmits it to COMSOL via the LiveLink interface. COMSOL adjusts the cathode bipolar plate potential V_sol with the reference current as the target and iteratively solves all physical field equations on the PEMFC multiphysics refined model until convergence. COMSOL feeds back the solved terminal voltage, output power, catalyst layer oxygen concentration field, membrane water content field, temperature field, and current density field to Simulink via the LiveLink interface. Simulink uses the feedback output power as the actual output of the PEMFC subsystem, performs bus power balance calculations with the power of photovoltaic, wind power, battery, and electrolyzer, updates the DC bus voltage and battery state of charge, and enters the next time step after completing the state update for the current time step. The co-simulation runs under various typical operating conditions, including control command step verification, wind and solar disturbances, PEMFC current mutations, and load mutations, accumulating co-simulation data for each time step. The COMSOL model runs continuously throughout the simulation duration, participating in the aforementioned closed-loop data interaction at each time step.

[0026] Example 2 like Figure 5 As shown, during the co-simulation process, the internal field gradient index is calculated at each time step using the internal physical field distribution data fed back by COMSOL. This index is a weighted combination of the maximum spatial gradients of membrane water content, temperature, and catalyst layer oxygen concentration. Upper and lower thresholds are calibrated by analyzing the internal field response data of PEMFC under typical step conditions: when the internal field gradient index exceeds the upper threshold, it is determined to be a transient process, and the simulation step size is reduced to accurately capture the change; when the internal field gradient index is below the lower threshold, it is determined to be a stabilizing process, and the simulation step size is increased to reduce computational overhead; when it is between the two, the current step size is maintained. A minimum hold time constraint is introduced to prevent frequent step size switching. Testing shows that the adaptive variable step size significantly reduces the total simulation time while ensuring transient solution accuracy.

[0027] Specifically, the internal field gradient index G is: , in , and Δt represents the maximum spatial gradient magnitudes of the membrane water content field, temperature field, and catalyst layer oxygen concentration field at the current time step, respectively, with w1, w2, and w3 being preset weighting coefficients. When G is greater than the preset upper threshold G_high, it indicates that the PEMFC is in a severe transient process, and the simulation step size of the next time step is reduced to Δt_small to improve the transient solution accuracy. When G is less than the preset lower threshold G_low, it indicates that the PEMFC is approaching a steady state, and the simulation step size of the next time step is increased to Δt_large to reduce the total simulation time. When G is between G_low and G_high, the current step size remains unchanged. The upper threshold G_high and lower threshold G_low are calibrated by statistical analysis of the internal field response data of the PEMFC under typical step conditions. To suppress frequent step size switching caused by noise, a minimum step size hold time constraint is introduced.

[0028] Example 3 like Figure 6 As shown, multiple steady-state operating points were selected from the accumulated co-simulation data using the Latin hypercube sampling method to train a deep neural network surrogate model. The surrogate model's inputs were the PEMFC's operating current, anode and cathode airflow rates, airflow humidity, and operating temperature; its outputs were terminal voltage, output power, and membrane water content profile. The training loss function was a weighted average of the data fitting mean square error and the residual loss of the physical control equations. The residual loss of the physical control equations included the sum of the residuals calculated after substituting the physical fields predicted by the surrogate model into the continuity equation, Maxwell-Stefan component conservation equation, charge conservation equation, and energy conservation equation. After training, the surrogate model replaced COMSOL in subsequent co-simulations, significantly reducing single-step computation time. After each round of co-simulation, the newly accumulated operating data was added to the training set, the shallow weights of the network were frozen, and only the top-level parameters were fine-tuned for incremental learning, allowing the surrogate model's accuracy to continuously improve with repeated use.

[0029] The loss function L, constrained by physical information, is: L = L_data + λ·L_physics, where L_data is the mean square error between the surrogate model's predicted value and the COMSOL reference value, L_physics is the weighted sum of the residuals after substituting the physical field output by the surrogate model into the PEMFC governing equations, including mass conservation residuals, Maxwell-Stefan component conservation residuals, charge conservation residuals, and energy conservation residuals, and λ is the balance coefficient. After the surrogate model is trained, it replaces the COMSOL model in Simulink co-simulation when performing new simulation tasks. This reduces the single-step solution time of the PEMFC subsystem from minutes of COMSOL iterative solution to milliseconds of forward inference by the surrogate model's neural network, so that the total simulation time is no longer constrained by the COMSOL solution speed. After each new round of joint simulation task is completed, the newly accumulated working condition data is added to the training set, and the surrogate model is incrementally fine-tuned. The shallow weights are frozen and only the top-level parameters are updated, while the physical constraint loss term is retained, so that the surrogate model can continuously improve its accuracy and working condition coverage as the number of times it is used increases.

[0030] Example 4 like Figure 7 As shown, offline optimization of the PI parameters of the PEMFC local controller in the hierarchical control strategy is performed using the spatial distribution data of the PEMFC internal physical field output by COMSOL during co-simulation. The PI parameters of the PEMFC power outer loop and current inner loop are selected as optimization variables, with the spatial uniformity of the PEMFC internal physical field as the optimization objective. The uniformity evaluation function is defined as a weighted combination of the spatial variances of membrane water content, catalyst layer oxygen concentration, and membrane temperature. Under typical dynamic conditions, co-simulations are run for different PI parameter combinations, and the time-domain integral value of the uniformity evaluation function under each parameter group is recorded. The PI parameter combination that minimizes this integral value is selected as the optimization result. The optimized control parameters, while ensuring the PEMFC output power response speed, improve the uniformity of internal membrane water content, oxygen concentration, and temperature, which helps reduce the risks of local hot spots, membrane drying, and oxygen deficiency.

[0031] This embodiment selects the spatial uniformity of the internal physical field of the PEMFC as the optimization objective, defining a uniformity evaluation function J = α·Var(λ) + β·Var(C_O2) + γ·Var(T), where Var(λ), Var(C_O2), and Var(T) are the spatial variances of membrane water content, catalyst layer oxygen concentration, and membrane temperature over the active area of ​​the PEMFC, respectively, and α, β, and γ are preset weights. Under typical dynamic conditions, multiple sets of PI parameter combinations are selected for joint simulation, and the time-domain integral value of the PEMFC internal physical field uniformity evaluation function J is recorded for each set of parameters. The PI parameter combination that minimizes the time-domain integral value of J is selected as the optimized PEMFC controller parameters. This optimization method utilizes the internal field spatial distribution information that traditional simplified PEMFC models cannot provide, and can simultaneously consider the output performance of the PEMFC and the uniformity of its internal state, the latter directly affecting the PEMFC's lifespan and reliability.

[0032] The above description is merely the basic principle and preferred embodiment of the present invention. Improvements and substitutions made by those skilled in the art based on the present invention are within the scope of protection of the present invention.

Claims

1. A method for co-simulation of a distributed energy system, the method comprising: Includes the following steps: S01. Establish a radial flow field PEMFC multiphysics coupled model in the COMSOL Multiphysics platform. This model coupledly solves momentum conservation, composition conservation, charge conservation, Butler-Volmer electrochemical kinetics, energy conservation and liquid water equations, and sets the boundary conditions of the model. S02. Build a system-level dynamic model in MATLAB / Simulink that includes photovoltaic, wind power, electrolyzer, hydrogen storage tank and battery and configure hierarchical control strategy. Reserve a PEMFC interface module in Simulink. S03. Establish a cross-software closed-loop co-simulation platform. Through the LiveLink for Simulink data interface of COMSOL Multiphysics, establish a bidirectional data link between the PEMFC multiphysics coupling model and the PEMFC interface module to form a cross-software closed-loop co-simulation platform. The operation mechanism of the co-simulation platform in each simulation time step is as follows: Simulink transmits PEMFC control variables to COMSOL. After COMSOL iteratively solves the feedback terminal voltage, output power and internal physical field distribution, Simulink completes the system power balance calculation accordingly.

2. The co-simulation method for distributed energy systems according to claim 1, characterized in that: The process of establishing the PEMFC multiphysics coupling model for radial flow field is as follows: First, a three-dimensional geometric model of PEMFC is constructed in SolidWorks, including an anode bipolar plate, an anode radial flow field, an anode gas diffusion layer, an anode catalyst layer, a proton exchange membrane, a cathode catalyst layer, a cathode gas diffusion layer, a cathode radial flow field, and a cathode bipolar plate arranged in layers. A circular air inlet is established at the center of the anode bipolar plate, and a radial diffusion flow field with trapezoidal flow regions and circular rib flow regions are staggered on the outer edge of the air inlet. Multiple air outlets are evenly distributed in a ring around the active region. A circular air inlet is established around the cathode bipolar plate, and the gas is guided by the flow channel to the outer edge of the active region and discharged at the center of the outer edge of the flow field. The completed 3D geometric model was exported to COMSOL for mesh generation, and the following physical fields were added in sequence: momentum conservation equation describing fluid flow in the channel and porous media region; Maxwell-Stefan component conservation equation describing multi-component convection and diffusion of hydrogen, oxygen, water vapor and nitrogen; charge conservation equation describing solid-phase electron conduction and membrane-phase proton conduction; Butler-Volmer equation describing the kinetics of anodic hydroxide oxidation and cathodic oxygen reduction reaction; energy conservation equation including electrochemical reaction heat, ohmic heat and phase change heat source terms; and liquid water equation describing liquid water phase change and capillary diffusion transport in the catalyst layer. Boundary conditions are set as follows: the anode potential is fixed at zero reference potential, and the cathode potential is set to the battery operating voltage V_cell. This operating voltage is dynamically specified by Simulink based on the PEMFC target power and transmitted to COMSOL in real time through the LiveLink interface during co-simulation. The gas flow rates at the anode and cathode inlets are calculated and determined based on the stoichiometry, reference current density, and active area of ​​the catalyst layer. The gauge pressure at the anode and cathode gas outlets is set to zero. No-slip boundary conditions are applied to all solid walls.

3. The co-simulation method for distributed energy systems according to claim 1, characterized in that: During the co-simulation process, at each simulation time step, the internal field gradient index G is calculated from the internal physics field distribution data of COMSOL at the current moment: ,in , and Δt represents the maximum spatial gradient magnitudes of the membrane water content field, temperature field, and catalyst layer oxygen concentration field at the current time step, respectively. w1, w2, and w3 are preset weighting coefficients. When G is greater than the preset upper threshold G_high, it indicates that the PEMFC is in a violent transient process, and the simulation step size of the next time step is reduced to Δt_small. When G is less than the preset lower threshold G_low, it indicates that the PEMFC is approaching a steady state, and the simulation step size of the next time step is increased to Δt_large. When G is between G_low and G_high, the current step size remains unchanged.

4. The co-simulation method for distributed energy systems according to claim 3, characterized in that: The simulation time step adjustment follows the minimum step size hold time constraint.

5. The co-simulation method for distributed energy systems according to claim 1, characterized in that: Using the PEMFC input-output data pairs accumulated during co-simulation, a deep neural network-based PEMFC surrogate model is trained. The input data for the PEMFC surrogate model includes: PEMFC operating current, anode inlet flow rate, cathode inlet flow rate, anode inlet humidity, cathode inlet humidity, and operating temperature; the output data includes: PEMFC terminal voltage, output power, membrane water content profile, and average oxygen concentration in the cathode catalyst layer. The PEMFC surrogate model is trained using a physically constrained training method. After training, the PEMFC surrogate model replaces the COMSOL model in Simulink co-simulation when performing new simulation tasks.

6. The co-simulation method for distributed energy systems according to claim 5, characterized in that: The loss function of the PEMFC surrogate model is: L = L_data + λ·L_physics, where L_data is the mean square error between the predicted value of the PEMFC surrogate model and the COMSOL reference value, L_physics is the weighted sum of the residuals after substituting the physical field output by the PEMFC surrogate model into the PEMFC governing equation, including mass conservation residuals, Maxwell-Stefan component conservation residuals, charge conservation residuals and energy conservation residuals, and λ is the balance coefficient.

7. The co-simulation method for distributed energy systems according to claim 5, characterized in that: Each time the PEMFC surrogate model completes a new co-simulation task, the newly accumulated working condition data of this round is added to the training set to perform incremental fine-tuning of the surrogate model. The shallow weights are frozen and only the top-level parameters are updated, while the physical constraint loss term is retained, so that the surrogate model can continuously improve its accuracy and working condition coverage as the number of times it is used increases.

8. The co-simulation method for distributed energy systems according to claim 1, characterized in that: Using the spatial distribution data of the physical field inside the PEMFC output by COMSOL during the operation of the co-simulation platform in step S03, the PI parameters of the local controller of the PEMFC in step S02 are optimized offline. The specific method is as follows: the spatial uniformity of the physical field inside the PEMFC is selected as the optimization objective, and the uniformity evaluation function is defined as J = α·Var(λ) + β·Var(C_O2) + γ·Var(T), where Var(λ), Var(C_O2) and Var(T) are the spatial variances of membrane water content, catalyst layer oxygen concentration and membrane temperature on the active area of ​​PEMFC, respectively, and α, β and γ are preset weights. Under typical dynamic conditions, multiple sets of PI parameter combinations are selected to run co-simulation, and the time domain integral value of the uniformity evaluation function J of the physical field inside the PEMFC under each set of parameters is recorded. The combination of PI parameters that minimizes the time-domain integral value of J is selected as the optimized PEMFC controller parameters.

9. The co-simulation method for distributed energy systems according to claim 1, characterized in that: The system-level dynamic model of the wind-solar-hydrogen-storage combined heat and power system includes a photovoltaic array model, a wind turbine model, an electrolyzer model, a hydrogen storage tank model, a battery model, a DC bus model, and a grid-connected inverter model. Each subsystem is coupled to the DC bus through its own DC / DC converter, and the DC bus is connected to the AC bus side via the grid-connected inverter. The hierarchical control strategy is that the upper-level energy management layer generates power allocation commands for each subsystem based on the matching relationship between the real-time output and load demand of each subsystem, and the lower-level local controllers adjust the duty cycle of the corresponding DC / DC converter according to the power commands.

10. The co-simulation method for distributed energy systems according to claim 9, characterized in that: The specific operating mechanism of the co-simulation platform within each simulation time step is as follows: The upper-level energy management layer on the Simulink side calculates the power P_FC_ref that the PEMFC should handle based on the current wind and solar power output and load demand. The power outer loop of the PEMFC local controller converts P_FC_ref into a reference current I_ref. Simulink transmits I_ref to COMSOL via the LiveLink interface. COMSOL adjusts the cathode bipolar plate potential V_sol with I_ref as the target, iteratively solving the problem on the PEMFC multiphysics refined model. All physical field control equations are converged. Then, the PEMFC output voltage V_out, output power P_out, catalyst layer oxygen concentration field, membrane water content field, temperature field, and current density field obtained from the solution are fed back to Simulink through the LiveLink interface. Simulink takes P_out as the actual output of the PEMFC subsystem and performs bus power balance calculations with photovoltaic power, wind power, battery power, and electrolyzer power. It updates system state variables such as DC bus voltage and battery state of charge, and enters the next time step after completing the state update of the current time step.