Closed GarronFish closed 6 months ago
@HansOlsson I do not think that this is possible with current MoLang.
@HansOlsson I do not think that this is possible with current MoLang.
Me neither, and I think it should be moved to the ModelicaSpecification issue tracking.
Nothing that we can fix in the standard library today. Will track it elsewhere.
In the example below there are two similar conditionally declared models (i.e. contitionalModel1 and conditionalModel2 that contain similar internal variables, the user would like to get infomation of an arbitrary variable from the model that is conditionally declared.
setting y1 = if enableModel1Not2 then conditionalModel1.k else conditionalModel2.k, is not supported and the following error is generated (using Dymola 2024x Beta3 with Advanced.Modelica.CheckConditionallyEnabled = true):
Undeclared variable: conditionalModel2.k since the declaration of conditionalModel2 was conditionally removed in the definition equation y1 = (if enableModel1Not2 then conditionalModel1.k else conditionalModel2.k)
If you know that enableModel1Not2 is always true in this case then you can set: y1 = conditionalModel1.k however then this warning is generated (using Dymola 2024x Beta3 with Advanced.Modelica.CheckConditionallyEnabled = true): For path conditionalModel1.k
Using conditionally enabled variable conditionalModel1 outside of connect. In class ExtractVariableFromConditionalModelEx. Used in component y1. Modelica Text: line 7
conditionalModel1.k and conditionalModel1.k are not connectors so connect statements cannot be used.
Obviously in this case k is the output of the model y, so it would be possible to use connect statements with conditionalModel1.y and conditionalModel1.y to y1. However if the conditionalModel1 and conditionalModel2 models were encrypted and users would like to display the information about a component at the top level of the model (say using the UserInteraction library components) it is not be possible without generating warnings (?).
Is there some way that I'm not aware of to get around this issue? Should some language change be done to support this case?