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

hybrid system

hybrid system

In the simple model shown, the accelleration should be zero when V_MAX is reached. But in the simulation it doesn't happen. Using 'when' instead, the system becomes overdetermined.

model Attitude_manover
  parameter Real D_F = 1000, V_MAX = 100, G = 9.81;
  //Real N(start = 0);
  //Real E(start = 0);
  Real D(start = 0);
  //Real VN = 0;
  //Real VE = 100;
  Real VD(start = 0);
  Real AD;
equation
//  der(N) = VN;
//  der(E) = VE;
  der(D) = VD;
  der(VD) = AD;

  AD = G * sign(D_F); 
  if abs(VD) >= V_MAX then
    AD = 0;
  end if;
/*  when abs(D) > abs(D_F) then
    D = D_F;
  end when;
*/ 
end Attitude_manover;

Re: hybrid system

The solution is, use 'when' and 'reinit':

replace
if abs(VD) >= V_MAX then
    AD = 0;
  end if;

with:
when abs(VD) >= V_MAX then
    reinit(AD, 0);
  end when;

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