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

Event Handling in OpenModelica using noEvent() function

Event Handling in OpenModelica using noEvent() function

Hi,

I am using OpenModelica to simulate a DAE system with 15 equations (5 differential and 10 algebraic). There is an equation with a square root term and so the argument should not turn negative. Therefore, I am using the noEvent() function to keep a check on the argument and accordingly change the expression if required. But, the argument turns negative as it does in the case where noEvent() function is not used. Please look below for a symbolic representation of the problem:

Left-hand expression = if noEvent(P > Pout) then sqrt(P - Pout) * (some constants) else (some expression)

Could somebody please help me out with this?

Thanks

Re: Event Handling in OpenModelica using noEvent() function

Hi,

we have a model in our testsuite that demonstrates that issue:

Code:


model CheckSqrt
Real x(start=1);
Real y(start=1);
Real u = 1 - time;
parameter Real c = 1;
equation
// this equation should cause a model error sqrt(u) and u < 0
der(x) = if (u>0) then -c*sqrt(u) else 0;
// this should be ok
der(y) = if (noEvent(u>0)) then -c*sqrt(u) else 0;
end CheckSqrt;

So in general it works well.

Can you post your model or just send it to me?

so long.
Willi

Edited by: wbraun - Apr-13-15 12:03:02

Re: Event Handling in OpenModelica using noEvent() function

Hi,

Thank you for the reply. Yeah, I have checked this model out and there is a similar model in ModelicaByExample system library. I believe that the issue in my case is with the DASSL solver and the way I am handling it. The model is a long one. So, is it fine if I send that over to your e-mail?

Regards,
Bhargav

Re: Event Handling in OpenModelica using noEvent() function

Yes, please do it so.

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