-
Notifications
You must be signed in to change notification settings - Fork 168
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
Wrong definition of units involving "eV" #4062
Comments
Does this mean that eV should be moved to nonSI, and that conversion functions (to_eV, from_eV) should be added to "Conversions"? |
Also, remember that |
Yes, and when we look at actual uses of it, e.g., Especially not as There's a reason that eV, Dalton and au are listed under "Non-SI units that are accepted for use with the SI". |
I guess that would be the clean way forward. |
This seems like a modification I could do myself (volunteering), provided it's the right direction for the library. I do not understand the remark of HansOlsson above though. Is he suggesting complete removal of eV as a unit? |
@paultjevdh Since this is a change that requires a conversion script, it needs to wait until the MAP-LIB project has decided to release a new major version. And this is still a long way off based on the current development pace. So This ticket needs revisiting once the decision on working on MSL 5.0.0 has been made. |
No, I was merely stating that changing that will be a high-risk task, that will require special care to ensure that nothing changes and since the value for the electrical charge was incorrect it becomes trickier still. |
As I remember it, in the old days the idea was to mix SI and non-SI units in models, e.g. for parameters. Then, at some point, a consensus emerged in the community that this would have led to chaos and confusion, and that it would have been best to stick as much as possible to SI units, and use other unit only for display purposes, exploiting the displayUnit attribute. However, As a consequence, the MSL mostly avoids using non-SI units even when it would have been convenient, e.g. for temperatures HVAC systems, and relies on displayUnit to show the temperatures in degress Celsius (or Fahrenheit) instead of Kelvin. On the other hand, we kept (some) non-SI units in the library. BTW, I understand the number of non-SI units mentioned in the SI brochure is constantly shrinking, e.g. ,the last brochure doesn't even mention "bar", that we still use as a display unit. Anyway, this happened long before the upgrade to MSL 4.0.0, possibly when we switched to 3.0.0, though I'm not sure. I guess when this former transition happened, nobody looked a the details of the Spice library, so there were some leftovers like the eV unit. Though I believe keeping FermiEnergy with unit="eV" in SI was a mistake (it should at least have been moved to NonSI, where it belongs), I agree with @dietmarw that changing the type definition for FermiEnergy from unit="eV" to unit="J" is definitely non-backwards compatible, so it would need to be done in the next major release. There is no decision about that yet, but my recommendation would be to avoid such a thing at least until 2030, because it is so much of a pain from a management point of view. Even when conversion scripts are available. If that is the current status, I guess tools will have to adapt to it. |
This fits probably to #3158 |
Even if somewhat similar, it's different from #3158 where angles are something that users want to provide and propagate. I understand that if someone wants to add up the EnergyGaps to add to the total energy in Joules there is a need to convert, but I find that somewhat esoteric. |
I agree, but then I think we should make it more explicit in the specification what are the allowed units to be used in unit strings. At the moment we are referring to ISO standards (which are not publicly available, you need to pay a fee to read them), and furthermore I understand that the non-SI allowed units in there change over time. |
The specification allows the use of custom user-defined units, and I think the freedom to work with different unit symbols is too deeply established in the ecosystem to remove this possibility now. I can also understand if some modelers have a strong preference for expressing energies in The most basic feature needed to cope in a setting with mixed units is a safe way to convert between units, modelica/ModelicaSpecification#3300. (The tools in our community have been able to handle |
Does it? In Section 19 I read
This seems to me to rule out custom-defined units (not Are there other places in the specification where exceptions to this rule are stated? |
Right below the synax block where
|
The Modelica.Units.SI package contains several types involving the electronvolt unit
As I understand, the electronvolte is an accepted unit, like minute, hour, or degree, but it's not an SI unit. The SI unit for energy is "J". We should use "eV" as a displayUnit.
Hence, these declarations should be changed to
The text was updated successfully, but these errors were encountered: