-
Notifications
You must be signed in to change notification settings - Fork 42
Add rule for allowing fixed parameters to be unbound during translation #3075
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
Changes from 2 commits
6ca3f77
7a1fdb2
326a194
46cb560
b17cf77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -753,11 +753,17 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali | |||
In case of iterative solver failure, it is recommended to specially report those variables for which the solver needs an initial guess, but which only have the default value of the \lstinline!start!-attribute as defined in \cref{predefined-types-and-classes}, since the lack of appropriate initial guesses is a likely cause of the solver failure. | ||||
\end{nonnormative} | ||||
|
||||
If a parameter has a modifier for the \lstinline!start!-attribute, does not have \lstinline!fixed = false!, and neither has a binding equation nor is part of a record having a binding equation, the modifier for the \lstinline!start!-attribute can be used to add a parameter binding equation assigning the parameter to that \lstinline!start! value. | ||||
In this case a diagnostic message is recommended in a simulation model. | ||||
A parameter not having \lstinline!fixed = false! and neither having a binding equation nor being part of a record having a binding equation, is handled in different ways depending on the presence of a modifier for the \lstinline!start!-attribute. | ||||
If there is no modifier for the \lstinline!start!-attribute, it is an error unless a parameter value is explicitly provided before solving the initialization problem. | ||||
In this case, a tool may give a diagnostic message when translating a simulation model to inform the user that additional parameter values must be provided later. | ||||
If there is a modifier for the \lstinline!start!-attribute, the modifier can be used to add a parameter binding equation assigning the parameter to that \lstinline!start! value. | ||||
In this case, a diagnostic message is recommended in a simulation model. | ||||
|
||||
\begin{nonnormative} | ||||
This is used in libraries to give non-zero defaults so that users can quickly combine models and simulate without setting parameters; but still easily find the parameters that need to be set. | ||||
The case of no \lstinline!start!-attribute is useful when no good default value for the parameter is known at the time of translation, or when the modeler wants to force the user of the translated model to make an active choice of parameter value. | ||||
henrikt-ma marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
Note that the requirement must not be fulfilled by defaulting to something like the default value for the parameter's type, as this would bypass the intention that all parameters should be determined either by the model itself or by the user of the translated model. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just remove this line, as it seems like such an odd idea to guard against.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is an important point, which is actually not clear in the specification right now. What is meant by "providing start-attribute"? Consider the following example:
I tried it in MapleSim, Dymola and OpenModelica. It simulates, giving a warning that the default values is used. But is it correct to consider that the start value is given? I scanned through units in MSL. There is only ThermodynamicTemperature that has start value specified on type. But then there is a bunch of types that extend from it. So, if somebody has a parameter of ThermodynamicTemperature type and does not specify the start attribute when that instance is defined (and no modification given at any point later), do we consider that the start-attribute is provided or not? With the sentence that Henrik added, it should not be considered as provided. But it is treated as such right now but at least 3 tools. If that sentence is not correct then it should be stated that it is enough to specify the start on the type, but start values of builtin types should not be considered as "provided". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me, this line is at the heart of the proposal. I don't want this proposal to end up removing the current rule that all parameters must be given a value – either directly or using the In @eshmoylova's example above, the intention is to consider
There should be no special rule about being considered "provided". Provide There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of discussing "modifier for start-attribute" I believe we should:
We also have to consider the following odd cases for start-attributes (assuming MCP0009 is accepted):
Both of them arguably has a modifier for the start-attribute, but neither has a value for the start-attribute. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I was hoping for some feedback on removing this. Additionally I realized that apart from being an odd idea, I don't understand what it means. How do we determine the default value for the parameter's type? The obvious idea would be to use the start-value of the type, but in that case the parameter has a start-value and the sentence does not apply. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I believe this would need to be discussed in a separate issue to avoid scope creep. Some things to keep in mind when working out such a proposal:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I gave feedback above: #3075 (comment) The purpose is to not break a big hole in the current safety net for ensuring that all parameters must have a value when a model is simulated. |
||||
|
||||
The case of providing a \lstinline!start!-attribute is used in libraries to give non-zero defaults so that users can quickly combine models and simulate without setting parameters; but still easily find the parameters that need to be set. | ||||
henrikt-ma marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
\end{nonnormative} | ||||
|
||||
All variables declared as \lstinline!parameter! having \lstinline!fixed = false! are treated as unknowns during the initialization phase, i.e.\ there must be additional equations for them -- and the \lstinline!start!-value can be used as a guess-value during initialization. | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the point, wouldn't it be too much scope creep to try to switch terminology as part of this PR?