MATLAB: Solver Configuration for Pneumatic in Simulink

pneumaticsSimscape

I am constructing a pneumatic model but I encounter a problem for configuring the Solver. The error massage was showed below:
"Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix."
Also I atteched the file for your information: http://jumbofiles.com/n2467rhgjjdh
How can modify the model to make it right? Thanks!

Best Answer

First, you are not using an appropriate solver. In the MATLAB command window, you should see something like:
Warning: The solver chosen is not recommended if the model is stiff, which is typical for models containing Simscape components. These solvers are typically preferred for Simscape models: ode23t, ode15s or ode14x (fixed-step). To disable this diagnostic, change the explicit solver diagnostic setting on the Simscape panel of the model Configuration Parameters.
So the first thing is to change the solver from ode45 to say ode23t. For more details, see Setting Up Solvers for Physical Models and Customizing Solvers for Physical Models in the Simscape documentation. I would also recommend setting the absolute tolerance to say 1e-4 rather than leaving it to auto.
However, that doesn't fix the problem, which is to do with initilazing all the states in the network. It looks like the initial values of the states in the network are not consistent. When that's the case, I often find that adding a resistive element (in whatever domain you're using) to "take the slack" helps. Here, adding a Pneumatic Resistive Tube between the Flow Rate Source and the Sensor blocks allows the model to run. You can reduce the length to something small. The section of the documentation on Modeling Pneumatic Systems can also provide some useful suggestions.
HTH,
Arnaud
Related Question