-
Notifications
You must be signed in to change notification settings - Fork 40
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
unit assignment for unassigned parameters #3552
Comments
@GarronFish, in general there is no reason why a gain should be dimensionless by default. In some case it is, but in many others it isn't, and it makes lots of sense to infer it if you know the units of the input and output, which come from some physical models. Currently unit inference is not part of the Modelica Specification. There are proposals to introduce stricter unit semantics in the language, see e.g. #2127, but there is still no wide consensus on how to do it. Unfortunately the issue is complicated and we should probably avoid partial solutions and try to achieve a comprehensive one, which is hard. |
Thanks for the reply, I understand now that the situation is more complicated than I originally thought. From a users point of view it would be good if there was a simple way to set the unit of the output of a Math block. For example, could there be an Advanced tab where the unit string could be provided, and this used. Unfortunately, only Literal values can be used for setting Units so this is not possible. I think this is covered in #2127 so I think this ticket can be closed. |
Will close then. |
In 1290058 the unit for k in Modelica.Blocks.Math.Gain was changed from "1" to "" meaning that the unit for k will be inferred.
This unfortunately results in the unit for y no longer being inferred from the unit of u unless the user manually sets the unit of k to "1" (which is a cumbersome task that most users will not do). Here is a simulation of the model mentioned above:
for
The result of this is that unit checking is no longer being performed (and probes will die :)).
I propose that by default parameters with unit="" will infer that they have unit="1" unless the parameter is assigned to another parameter with a given unit.
Here are some examples:
I think the behavior in C is correct as it can be unexpected that the unit of k is set to "s".
The handling of non-parameters would be as is.
I'm not happy with the different behavior for parameters and non-parameters however I've not been able to think of a better solution.
The text was updated successfully, but these errors were encountered: