Skip to content
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

Undetermined execution order in Annex60.Controls.Discrete.Examples.BooleanDelay #641

Closed
agnesramle opened this issue Jan 3, 2017 · 2 comments · Fixed by #642
Closed
Assignees

Comments

@agnesramle
Copy link

In the following del.sampleTrigger triggers at t=0, 0.1, 0.2, ... and
sample(booleanPulse.startTime, booleanPulse.period) triggers at t=0,0.25, 0.5, ... .

when {del.sampleTrigger, initial()} then
  del.y := del.ySample;
  del.ySample := del.u;
 end when;
equation
 del.sampleTrigger = sample(del.startTime, del.samplePeriod);
 when del.sampleTrigger then
  del.firstTrigger = time <= del.startTime + del.samplePeriod / 2;
 end when;
 when sample(booleanPulse.startTime, booleanPulse.period) then
  booleanPulse.pulsStart = time;
 end when;
 booleanPulse.y = time >= booleanPulse.pulsStart and time < booleanPulse.pulsStart + booleanPulse.Twidth;
 booleanPulse.y = del.u;

This means that at time t=0.5 both triggers at the same time.
According to the Modelica specification 8.5 the order of time events should be explicitly defined in the models:

There is no guarantee that two different events occur at the same time instant.
[As a consequence, synchronization of events has to be explicitly programmed in the model, e.g. via count

In this case the execution order differs between JModelica and Dymola and we do not get the same trajectory for del.y (due to del.u not updated in same order).

Could you update the model so that the execution order will be explicitly defined?

@mwetter mwetter self-assigned this Jan 3, 2017
@mwetter
Copy link
Contributor

mwetter commented Jan 3, 2017

@agnesramle : I corrected the model.
@tsnouidui : Can you please update Annex60_Controls_Discrete_Examples_BooleanDelay.txt on the verification branch.

@tsnouidui
Copy link

I just did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants