-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add units to outputs of quasi static electrical sensors #2492
Comments
Any comments on the units of electrical sensors and blocks (see also #2488, which addresses a similar issue). |
Which one of the following two possibilities should be used: |
I guess we should go with the first possibility, as a real signal unit may be modified by |
Agreed. |
The units of the Analog sensors use (for example): RealOutput y(unit = "V") The sensors of the machines use the RealOutput V(final quantity="ElectricPotential", final unit="V") My preferences actually are:
In this case I would also change the @beutlich Any objections? |
@beutlich and @HansOlsson - could give us some hints please: |
Do we have to expect problems if the signal is fed to a block input? |
Primarily unit. Note that when doing operations - like multiplying signals - we can only check the units. When directly connecting we also check quantities for connected variables, in general the reasons is that there can be different quantities that don't mix - and in addition we use the quantity to check
The only minor issue I can see with using final for unit is that there might be an existing identical modifier, but that seems really minor. |
To me the solution is to not specify unit in these cases, i.e. remove unit="1". |
To me this sounds like that RealOutput y(final unit = "V") is be solution to go:
Are there objections? |
OK for me, except that removing the final breaks backwards-compatibility. Thus, I propose to not remove the final qualifier from signals where it is currently set. |
So for compatibility reasons you prefer to keep |
Yes, keep it where it alreadyis set. But do not add new quantityattributes or new final qualifiers. |
So use |
Actually, I have no strong opinion. Previously, in https://github.com/modelica/ModelicaStandardLibrary/pull/2197/files#diff-42a3cb78f53b2034a06e53baf19cae1a I added the final qualifier only for signals where it is not in SI unit, e.g., for degC or bar. |
OK, I will then go for |
Which is exactly the other way round as I did previously. 😕 |
Hmmm... But why are non SI units |
My thought was that signals are always in SI units. For that reason you can change the unit afterwards (i.e., non final). On the other side, that signal that are uses as non-SI unit in calculations must not be changed in unit (i.e., final). Not sure if this is right at all. |
I am now a little undecided on how to proceed... @HansOlsson How would you do it? |
As far as I understand changing the unit in this declaration doesn't change the sensor value - and thus I don't see the benefit of allowing changes (even if non-SI), and would thus always make the unit final. If we add some complex logic to allowing switching unit - and compute values in that unit, then that unit-expression will be complicated - but still final. |
@HansOlsson Right, changing the unit does not change the sensor value. Your suggestion sounds reasonable to me and making every output quantity final is close to the physical nature of a sensor: The output of a voltage sensor is a voltage (in the SI unit Volt) and nothing but that. So I suggest to go for this proposal and make every SI unit final and omit the quantity. I actually do not see any sensors which have non SI units, except the temperature sensors (and the temperature conversion blocks) of |
Units are added to the real output signals of the Analog.Sensors. Even though some tools are able to deduce the correct units from the equations, this may not be implemented in all tools yes. There is, however, no discrepancy in adding units to the outputs of sensors, as long as they are correct.
For the quasi static power and multi sensors, the complex output power has units which may be more difficult to be determined automatically:
From a formal point of view both units are equal to "VA" (Volt*Amps), but typically, electrical engineers distinguish the units "W" and "var".
Therefore, it makes sense to add units to the complex outputs of quasi static sensors including the power sensors. This allows:
This ticket is related with #2488.
The text was updated successfully, but these errors were encountered: