How to run Simscape PEM Fuel Cell model with fixed-step solver

9 次查看(过去 30 天)
Hey MathWorks community!
I am trying to run this PEM Fuel Cell Model with a fixed-step solver.
I tried to use ode3 and ode14x but it didn't work.
  • For the ode14x solver, this is the error message: An error occurred while running the simulation and the simulation was terminated Caused by: Derivative of state 'PEMFC_system.SM_Circuit.Anode_Exhaust.Pipe_MA.T_I' in block 'PEMFC_system/SM_Circuit/Anode Exhaust/Pipe (MA)' at time 0.0033333333333333335 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
  • For the ode3 solver, the error message is: Not enough input derivatives were provided for one or more Simulink-PS Converter blocks for the solver chosen. Implicit solvers (ode23t, ode15s, and ode14x) typically require fewer input derivatives than explicit solvers, and local solvers never require any. The following Simulink-PS Converter blocks have continuous inputs. To provide the derivatives required, you can either turn input filtering on or provide the input derivatives explicitly by selecting the corresponding options on the Input Handling tab
I tried to select the options on Simulink-PS Converter blocks but it didn't work. This is the error message: Transient initialization at time 0.001, solving for consistent states with the modes of the model fixed, failed to converge.
Nonlinear solver: failed to converge, residual norm too large.
Only ode1be solver works but with very slow dynamic responses.
Has anyone any idea how to solve this?
Thanks in advance!
Naima,

回答(1 个)

Sanchari
Sanchari 2024-2-7
Hello Naima,
Running a PEM Fuel Cell Model with a fixed-step solver in Simulink can be challenging, especially if the model is stiff or has fast dynamics. Here are some steps you can take to address the issues you're encountering:
For the `ode14x` solver error:
This error indicates that the solver encountered a non-finite derivative, which could be due to a singularity or a discontinuity in the model. To address this:
  • Reduce the fixed step size: A smaller step size will prevent the solver from taking too large a step into an unstable region.
  • Check for discontinuities: Ensure that all components in your model are initialized properly and that there are no abrupt changes causing infinite or very large derivatives.
  • Check parameter values: Validate that all physical parameters in the model are realistic and within a valid range.
For the `ode3` solver error:
This error is due to the Simulink-PS Converter blocks not receiving enough input derivatives for the chosen solver.
  • Enable input filtering: On the Simulink-PS Converter block, under the "Input Handling" tab, you can enable input filtering. This will resolve the derivatives issue.
  • Provide input derivatives explicitly: If you know the derivatives of the inputs, you can provide them to the Simulink-PS Converter blocks.
For the transient initialization error:
This error suggests that the solver is having trouble finding a consistent set of initial conditions.
  • Review initial conditions: Check that the initial conditions for all states are physically meaningful and do not cause an immediate numerical issue.
  • Use a consistent initialization: Ensure that the model is set up to find consistent initial conditions. This can sometimes be done by running the model in a simpler configuration or with relaxed constraints to find a good starting point.
For the `ode1be` solver:
While `ode1be` (backward Euler) is working, it is a first-order method and can be very slow for stiff systems or systems with fast dynamics.
  • Fine-tune the solver settings: Experiment with the solver step size to find a balance between speed and accuracy.
  • Profile the model: Use Simulink's performance tools to identify which parts of the model are taking the longest to compute and see if they can be optimized.
Fixed-step solvers are less flexible and can be more sensitive to model dynamics and discontinuities. Please refer to the following ML Answers as well for further information:
  1. Simscape PEM Fuel Cell model with discrete fixed-step solver: https://www.mathworks.com/matlabcentral/answers/1751000-how-to-run-simscape-pem-fuel-cell-model-with-discrete-fixed-step-solver?s_tid=answers_rc1-3_p3_Topic
  2. Solver configuration error and Simulink PS-Converter: https://www.mathworks.com/matlabcentral/answers/279755-solver-configuration-error-and-simulink-ps-converter?s_tid=answers_rc1-2_p2_MLT
  3. Error ‘Not enough input derivatives’ for Simulink PS-Converter blocks: https://www.mathworks.com/matlabcentral/answers/1614785-not-enough-input-derivatives-were-provided-for-one-or-more-simulink-ps-converter-blocks-for-the-solv
Hope this helps!
  1 个评论
Naima
Naima 2024-2-7
Dear Sanchari ,
Thank you for your promt response.
In fact does a smaller step size have an impact on the response of the model when the simulation time reaches 1000 seconds ?
Thank you,
Naima

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Variable Initialization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by