-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model Buildings.Templates.Plants.Controls.Utilities.Validation.TimerWithReset fails verification #3952
Comments
The component Current implementationAt
So, at On the contrary, OMC gives the following trajectory where the branch Unless there is a part in the MLS that says that event iterations can be merged if they occur "at the same time", I think Dymola and Optimica are correct here. Proposed modification in MBLThat being said, the current implementation (based on
Below is the proposed modification, that should be used for
initial equation
entryTime = time;
equation
when {u, reset} then
entryTime = time;
end when;
y = if u then time - entryTime else 0.0;
passed = u and y >= t; I will open a PR in MBL to implement this change (but most likely on 8/5 or so). To do
|
I agree with the proposed modification as well with the necessity to investigate the missed iteration by OpenModelica. My opinion about the opportunity to use a pulse train as signal in complex logic remains unchanged, a square wave is most robust and reduces a lot the risk of concurrent events. |
I've just run additional tests with the proposed change. It turns out that extracting the equation for
initial equation
entryTime = time;
passed = t <= 0;
equation
when {u, reset} then
entryTime = time;
passed = u and t <= 0;
elsewhen u and time >= pre(entryTime) + t then
entryTime = pre(entryTime);
passed = true;
elsewhen not u then
entryTime = pre(entryTime);
passed = false;
end when;
y = if u then time - entryTime else 0.0; |
Regarding the use of a square wave signal for
The clause "at the completion of every stage change" is only true at a given time instant, but always false over any period of time. It would typically be computed with the |
I still prefer your first change proposal (
The meaning of "instantaneous" in a boolean logic depends on the type of the logic. If you are designing a sampled logic (like PLC) "instantaneous" means less enough than the sampling period, if you are designing a logic that is hardware-implemented At the end of the story, if you want to build a model that matches as much as possible the real behavior of the system the right (and physical and robust) way is to use square waves with a proper duty cycle, the |
Thanks for the valuable insight into the modeling of "instantaneous" events. |
@mwetter I've tested the block TimerSimple
...
initial equation
entryTime = time;
equation
when u then
entryTime=time;
end when;
y = if u then time - entryTime else 0.0;
passed = y >= t and u; There are 2 state events logged in Timer.log, which are needed to compute the input signal from the sine signal. But the equations from the timer are solved with time events only. |
@AntoineGautier @AndreaBartolini : In view of the above tests with I don't know how to interpret "Iterating to find consistent restart conditions", perhaps that is an event iteration until no discrete variables change at the current event time. |
I think that "Iterating to find consistent restart conditions" means that Dymola are looking if some other condition are changed after the last iteration, in order to decide if another iteration is needed or not. @casella , can you contribute in this discussion? |
A square wave will trigger another event for the falling front, which will unnecessarily interrupt and slow down the continuous-time integration. The event iteration mechanism is well defined in Appendix B of the Modelica Language Specification, so I think it is OK, per se. We identified an issue with time events in OMC, namely that the fact they are not handled as such, but rather as state events, causes problems with simultaneous time-events, see #2152. This is a long-standing issue that needs to be fixed with high priority. @AndreaBartolini, do you think that could be the cause of this issue also? |
I think this case in another story, here there are two issues, one is the way in which the Maybe the fix of #2152 solves the problem but in my opinion the issue that involves OMC should be in any case investigated. |
I think this is just refers to the event iteration mechanism - the iterations are stopped when the discrete variables do not change after re-evaluating the active conditions. |
The variable
noThrRes.passed
of the modelBuildings.Templates.Plants.Controls.Utilities.Validation.TimerWithReset
fails the verification vs the Dymola reference file because Dymola and OpenModelica process in different way some concurrent events in the event iteration.The complete analysis is available in the ticket OpenModelica/OpenModelica#12746, the point that I need to understand is what is the expected behavior between the one produced by Dymola and the one produced by OpenModelica.
Please give me a feedback, thanks in advance.
The text was updated successfully, but these errors were encountered: