Ascold
Ascold

Reputation: 45

How to find a single event in Modelica?

Please help me with a simple task.

I have the function delta=f(time). See the picture.

enter image description here

I need to find value of "time" when "delta" became zero and assign the time's value to some parameter. For example-I can see on the picture that the time which match with delta=0 is approximately 9.3. I can assign to Real variable X=9.3. But can I do it automatically? I mean can Modelica can asign 9.3 to X?

P.S. I use when/while/if statement, but they works until duration, but I need to find a single event (when delta=0).

Upvotes: 1

Views: 76

Answers (1)

Michael Tiller
Michael Tiller

Reputation: 9421

I don't understand your PS. A when clause is the way to do this, and it is simple:

Real X;
equation
when delta<=0 then
  X := time;
end when;

What's the problem with that?

Upvotes: 3

Related Questions