-
Notifications
You must be signed in to change notification settings - Fork 167
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
No propagation of fixed = false
in InitSpringConstant
#3707
Comments
I suppose this is a question of the Modelica's modelling approach, not of a particular model, right? |
I would also guess so, and I agree that there isn't any problem here. We have
and we want to determine spring.c which has fixed=false (in addition spring.spring.c, rev.a and f are unknowns of this system of equations), which is perfectly ok. I don't see that the fixed-ness of spring.c has much relevance for this (except that if spring.c were fixed we would need to remove the last equation to have same number of unknowns and equations). To me it seems clear that we can use all of these equations to solve for spring.c; and my only take-away is that viewing parameter bindings as initial equations seem to increase the level of confusion. OOPS - UPDATED |
Slight editing error in previous comment. See update on GitHub. |
The intention was to see this as a problem with this particular model, as I could see two different solutions that would involve just changing the modifications in the top level model. Now I need to think more about @HansOlsson's way of grouping the equations… |
Let me begin by answering to the conclusion before drowning in technical detail:
I don't follow; to me it looked just like you suggested a view based on solving four equations with respect to four variables? Without seeing the light in this discussion yet, my take-away so far is that there is just more evidence that initialization is complicated, and the more we can explain it in terms of basic equations rather than special declaration equation rules, the better. That said, I don't either think this is as easy as just turning everything into basic equations. I guess @gkurzbach would be interested in joining this discussion as it is right at the heart of our most recent Flat Modelica discussions in modelica/ModelicaSpecification#2748, but it seems he is not a member of the project on GitHub? |
My problem with this way of thinking is that my understanding of
However, I expect my non-final This reasoning is what gave rise to this issue, because it doesn't allow the above matching of To me, it looks like a language group issue to make sure that initialization semantics are clarified so that there is no question about how it should be done in the MSL. I don't even expect modelica/ModelicaSpecification#2748 to settle this, so I think the present issue needs to be closed one way or another given the current state of the specification. Instead of simply closing as a won't fix, we could also consider what the drawbacks would be of setting |
To me one interpretation is that
Obviously that could be formulated in other equivalent ways, but the main conclusion is that I don't see a need to change this model. The intuition is that spring.c is unknown, and spring.spring.c is given by spring.c - regardless of whether spring.c is known or unknown; and to me the important part is this separation of concern - you are trying to "tune" spring.c to find the correct solution where a=0 and that shouldn't change any else. If you find the correct value of spring.c it should just be a matter of setting spring.c to that, disabling fixed=false, and removing the initial equation for a.
The specification has a comment indicating that setting fixed=false for a parameter with a binding equation should give a warning; so that temporary change would be bad. |
Yes, it says binding equation, but does it really mean any declaration equation, or just the case of an equation given at the original component declaration? Since what we have here illustrates that declaration equations combined with Anyway, if we want to avoid the discussion about whether the warning would really be recommended or not, we can replace this approach by asking what the drawback would be of finalizing the declaration equation. |
I buy this, except that I would have like to see the declaration equation relating |
The initialization of
Modelica.Mechanics.MultiBody.Examples.Elementary.InitSpringConstant
doesn't look right, but for reasons I don't want to discuss further, we've somehow managed to get the expected initialization out of this model anyway. Now, I'd like to see how to get the same result in a proper manner.The source of the problem, as I understand it, is that the
fixed = false
set in the simulation model,doesn't get propagated down to
spring.spring.c
. This is what gets propagated inModelica.Mechanics.MultiBody.Forces.Spring
:This leaves
spring.spring.c
withfixed = true
. Hence, if we look at the two variablesspring.c
andspring.spring.c
, I think we can agree that these should be solved from the following equations (expressed using sloppy pseudo code):With
spring.spring.c
havingfixed = true
, I would not expect it to be solved from the second of these, but using its declaration equation. This means that the second equation gets overdetermined, while there is no equation to determinespring.c
.I can see two ways of making it work:
fixed = false
also onspring.spring.c
, allowing the second equation to be solved with respect to this variable, and the declaration equation to be solved in reverse.c = c
an alias relation by making it final (see below). When eliminating one of the parameter in such an alias relation, it makes sense to keep the one withfixed = false
, since we know it has a corresponding initial equation somewhere.Of the two approaches, the first corresponds to a less cryptic modification:
The text was updated successfully, but these errors were encountered: