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:
- 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
- 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
- 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!