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

OM Source code

OM Source code

Hello,
I have a little question about the function start and stop time or rather > and <. I want to declare several variables of Z (Z1,Z2,Z3) as local losses in different time phases. How can I write this in a source code? My equation is though correct, but only for one Z Variable. How can I declare, for instance three Z Variables with an impact in different times?

class losses
  Real H(start = 200, unit = "m");
  parameter Real J(unit = "m/s") = -0.02 "losses due to fric-tion";
  parameter Real Z(unit = "m/s") = -0.05 "losses due to fric-tion";
equation
/* Equations of motion */
  if time <=5 then der(H) = J;
  elseif time >= 10 then der(H) = J;
  else der(H) = Z+J;
end if;
end losses;

Is there anyone who could help me? Thanks ahead current/smile

Edited by: Chris - Jul-09-19 11:58:27
There are 0 guests and 0 other users also viewing this topic