- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Event Handling in OpenModelica using...
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
- wbraun
- 75 Posts
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.
- wbraun
- 75 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Event Handling in OpenModelica using...