Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Can someone explain when exactly can pre() be used?

Can someone explain when exactly can pre() be used?

I have a load attached to a battery model. I am trying to count the number of charging/discharging cycles the battery is going through. PNet is the power flowing through the battery (positive for discharging and negative for charging).
I write the following and I always get the following errors.
1. It is not allowed to use pre for a continuous time variable outside a when clause
2. The when-condition must be a discrete expression:

I am completely new to programming and Modelica. So, can someone explain when pre() can be used?

For example if PNet is changing continuously with time, can I ever get a value of pre(PNet)?
And if I can somehow get this, can I use this to build "if" or "when" expressions?

There are 0 guests and 0 other users also viewing this topic
You are here: