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

Clarification regarding elsewhen #3216

Closed
casella opened this issue Jul 7, 2022 · 2 comments · Fixed by #3217 or #3228
Closed

Clarification regarding elsewhen #3216

casella opened this issue Jul 7, 2022 · 2 comments · Fixed by #3217 or #3228

Comments

@casella
Copy link
Collaborator

casella commented Jul 7, 2022

The explanation of elsewhen in Section 8.3.5 is a bit confusing to me towards the end. The model DoubleWhenConflict is indeed erroneous, because it has an equation section, and the single assignment rule holds. However, the following WhenPriority model uses an algorithm section instead, which IMO is a bit confusing.

I understand the idea is that if you have an equation section, then you really need to use elsewhen, to establish a priority. So, I would put an equation section in model WhenPriority, not an algorithm section.

On the other hand, I understand that if you actually use an algorithm section, the algorithm is executed in the specified order, so there is no need to use elsewhen, because the priority is naturally enforced by the order of execution of the algorithm itself. Hence, I would add one more example showing this case, i.e. like DoubleWhenConflict but with an algorithm section instead.

Do I miss something?

@casella
Copy link
Collaborator Author

casella commented Jul 8, 2022

In fact, I now realize that the algorithm section with elsewhen and with when won't be exactly the same. Assuming both events are triggered simultaneously, the former only executes the first branch, while the latter executes both in sequence.

HansOlsson added a commit that referenced this issue Jul 12, 2022
* Clarify elsewhen
Closes #3216

* Update chapters/equations.tex
@henrikt-ma
Copy link
Collaborator

The merged PR had a typo. Reopening instead of creating a separate issue.

@henrikt-ma henrikt-ma reopened this Aug 15, 2022
@HansOlsson HansOlsson linked a pull request Sep 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants