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

Additional clarification on initial() #1852

Closed
modelica-trac-importer opened this issue Nov 4, 2018 · 7 comments
Closed

Additional clarification on initial() #1852

modelica-trac-importer opened this issue Nov 4, 2018 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@modelica-trac-importer
Copy link
Collaborator

Reported by stefanv on 8 Dec 2015 16:28 UTC
Ticket #481 (also submitted by me), called for some clarification of how initial() could be used in when-clauses. Some changes were made in 3.2 revision 1, but there are still some outstanding issues.

Section 8.6 (of Modelica spec 3.3 rev 1) specifies that,

The equations of a when-clause are active during initialization, if and only if they are explicitly enabled with the initial() operator; and only in one of the two forms when initial() then or when {…,initial(),…} then.

What is not clear is what happens if they are used in some other way. Does nothing happen, or is it an error to use them in some other way? Appendix E.4.1 suggests that it is an error,

Clarified that initial() can only be used in a restricted form as condition in a when-clause.

but the wording in 8.6 suggests that nothing happening is also acceptable (i.e. the body of the when is simply not active).

There is another comment, in the table in section 3.7.3, that states that initial():

Returns true during the initialization phase and false otherwise [thereby triggering a time event at the beginning of a simulation].

This suggests that when not initial() then could be used to trigger an operation at the beginning of simulation.

Furthermore, when {initial(), not initial()} then would be active both during initialization, and at the very beginning of simulation.


Migrated-From: https://trac.modelica.org/Modelica/ticket/1852

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 9 Dec 2015 09:36 UTC
The wording in Appendix E.4.1 is unfortunate, and I believe it should have been something along the lines of:
Clarified that only when-clauses with restricted form of initial() as condition will be active during initialization.

Or in other words - I only recall that we wanted to simplify which 'when'-clauses to consider during initialization (as specified in 8.6), and I specifically don't recall that we tried to prohibit any use of 'initial()'.

There are also a number of other change-log entries that can be misinterpreted, and in my opinion appendix E (including the change-log entries) was not intended as normative text.
I believe the style of newer change-log entries reduces the risk of confusion by saying 'Clarified/Added/Corrected ... in section ... Ticket ...'. (So it could have been 'Clarified when-clauses with initial in section 8.6 ticket 481'.)

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 15 Dec 2015 15:37 UTC
Proposed:

Appendix E
This appendix is just present for historic reasons and is not normative.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 15 Dec 2015 16:09 UTC
Replying to [comment:2 hansolsson]:

Proposed:

Appendix E
This appendix is just present for historic reasons and is not normative.

Agreement; and revise appendix E to say:
Clarified that only when-clauses with restricted form of initial() as condition will be active during initialization.

And also need something to allow 'initial()' in other forms in 8.6.
The function initial() can be used to make when-clauses active during initialization, but only in one of the forms ...; [Example: when not initial() then print("simulation started");end when;]

Favor: 8
Against: 0
Abstain: 8

@modelica-trac-importer
Copy link
Collaborator Author

Comment by dietmarw on 8 Jan 2016 19:07 UTC
Ticket retargeted after milestone closed

@modelica-trac-importer modelica-trac-importer removed this from the Design88 milestone Nov 4, 2018
@modelica-trac-importer
Copy link
Collaborator Author

Modified by hansolsson on 8 Mar 2016 17:03 UTC

@modelica-trac-importer modelica-trac-importer added this to the ModelicaSpec3.4 milestone Nov 4, 2018
@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 23 Mar 2016 15:08 UTC
Resolved in r9232

@modelica-trac-importer
Copy link
Collaborator Author

Modified by hansolsson on 23 Mar 2016 15:51 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests