You get this error message when the model equations are such that a simple structural analysis of the equations reveals that the system cannot be solved. This is a more fine grained condition than merely checking that a model has the same number of variables and equations (checking that the model is globally balanced). For example, the model
model StructurallySingular
Real x(start = 0);
Real y;
equation
der(x) = 1 - x;
x*x = 1;
end StructurallySingular;
is globally balanced, but there is no way to compute a solution for the variable y
. The SystemModeler compiler will detect that the variable y
would need to be solved somehow using the two equations given in the model, but as this is not possible you get the message:
Model is structurally singular, the equations
x ^ 2.0 = 1.0;
der(x) = 1.0 - x;
do not allow to solve for required variables.
Note that this can be detected without looking at the details of the equations. Compare with the following model which is not structurally singular, but having a singularity that shows up during numeric integration:
model IllConditioned
Real x(start = 1);
Real y;
Real z;
equation
when time > 0.5 then
x = 0;
end when;
x * y + x * z = 1;
x * y - x * z = 2;
end IllConditioned;
At time 0.5, the linear system of equations defining y
and z
given x
becomes singular, and you get the message:
Failed to solve linear system
Simulation terminated at time 0.5