I am beginning with Modelica and i have a problem. I hope that you can help me.
I want to resolve a differential equation (first order for the moment) during an interval of time.
I want to create two models: the first model resolves an equation when a condition is true.. if the condition is false the first model had to stop resolving (simulating) the différential equation.and the second model is activated..
An example:
model state1
Real x(start = 0.2);
connector1 dout1;
equation
der(x) = 2 * x; //equation i want to resolve it..
when x > 0.8 then// the condition to stop resolving the Diff equation.. here i can create an event but i can't stop the resolution of the equation
dout1.s = x; // put the x variable in the connector to use it with another module..
dout1.state = true;
end when;
end state1;
connector connector1
Real s;
Boolean state;
end connector1;
.
.
.
some aother code of the second model...
As you have seen i had used when.. but the model continue resolving the Equation and i can detect when x is superior than 0.8.. I had tried to use while condition in algorithm.. but the simulation crashes..
To resume: I want to resolve a differential equation until a condition occurs..after this condition i want stop the resolution but not the simulation (because others modules will continue to do something..).
Would you please excuse my bad english..
Thank you!
