-
Notifications
You must be signed in to change notification settings - Fork 393
Add US Therm, EU Therm and UK Therm #287
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
Conversation
Thanks for the pull request. I'm trying to find more information on thermal units. I've only succeeded in finding the British Thermal Unit (BTU). Do you have any references describing the ones you have added? |
Hello there.
|
Sirs, is there something else that I could do to help you with this Pull Request? If so just let me know. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow reply. I finally had time to do a proper review (see questions in code).
I also noticed that there are some questions regarding a mix up of ISO and IT numbers in the talk page on Wikipedia. It would be good if you could cross check the numbers once more since I don't know enough to determine what's correct.
protected override double ElectronVoltsInOneJoule => 6.241509343260179e18; | ||
|
||
protected override double ErgsInOneJoule => 10000000; | ||
|
||
protected override double EuThermsInOneJoule => 9.4781339449889105832843629746176e-9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this to 9.47816988e-9 when doing 1/105505600 in Google
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, make sense, I'll change this value.
@@ -54,31 +54,43 @@ public abstract partial class EnergyTestsBase | |||
{ | |||
protected abstract double BritishThermalUnitsInOneJoule { get; } | |||
protected abstract double CaloriesInOneJoule { get; } | |||
protected abstract double DecaeuThermsInOneJoule { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anjdreas I would say that this should have a capital E since it is an abbreviation. What do you think? (Same with the others)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this doesn't look quite right. These are probably generated by powershell and the deca
prefix in JSON. Deca
+ camelcase(EuTherms)
. This works for things like Decigram
and Millinewtonmeters
, but not for DecieuTherm
. Not sure how we would fix this other than not using prefix and instead adding DecaEuTherm
manually in JSON. Probably the easiest fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, DecaEuTherm
is probably not consistent with our existing naming either. Maybe Decaeutherm
, or Decaeurotherm
as eurotherm
seems to be a wording I find when googling this.
I might prefer Eurotherm
and Decaeurotherm
after chewing on it a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anjdreas Please also note that we also have DecaimperialThermsInOneJoule
, DecausThermsInOneJoule
. So to keep things simple at the moment, I would use ReSharper to rename this properties to DecaEuThermsInOneJoule
, DecaImperialThermsInOneJoule
and DecaUsThermsInOneJoule
. What would say about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C# files get replaced when building so that would unfortunately not work. The "simplest" solution would be to add the deca units manually to the json file.
UnitsNet/UnitDefinitions/Energy.json
Outdated
@@ -89,6 +89,57 @@ | |||
"Abbreviations": [ "Wh" ] | |||
} | |||
] | |||
}, | |||
{ | |||
"SingularName": "EuTherm", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is called EC Therms in the Wikipedia article, probably because the unit is from the time when EU was called EC. Is EU Therm the most common name right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I wish I could tell. From my experience people just use therm implicitly meaning a US or EU unit, that they solely use everywhere in documentation across a project. So looks like it is up to us how to call it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go with calling it EC therm then to match Wikipedia. Then we are consistent with at least one other source. I'll leave the last word to @anjdreas
A couple of things:
https://en.wikipedia.org/wiki/Therm#Definitions *
|
As for me |
We have some sort of convention going with previous units, but it is not set in stone and probably not entirely consistent either. I'm losing a bit track of all the various units and their abbreviations. Example: Volume unit abbreviations I don't know what is the better choice here. I personally think |
I would stay with already existing format, i mean like |
Ok, that seems to be it. Sirs, could you plz review? I was in a bit rush, so maybe had missed something. |
Looks good to me (I cross checked the numbers once more), @angularsen could you check to so that we didn't misunderstand each other. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a minor discrepancy in the number.
|
||
protected override double ElectronVoltsInOneJoule => 6.241509343260179e18; | ||
|
||
protected override double ErgsInOneJoule => 10000000; | ||
|
||
protected override double EuThermsInOneJoule => 9.4781339449889105832843629746176e-9; | ||
protected override double ThermsEcInOneJoule => 9.47816988e-9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you shortened this?
Also I get a slightly different number here: 1J= 9.4781712e-9Therm(EC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eriove Mentioned this is probably more correct value. Please see the screenshot below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, okay. I have no familiarity with these units, why is there a different number in the calculator? Are there different standards for EC therms?
Second converter here:
http://www.kylesconverter.com/energy,-work,-and-heat/joules-to-therms-(e.c.)
9.478171203e-9
I think @eriove possibly found a value that was not entirely accurate.
From the last link:
1 Therm (E.C.):
Exactly 100,000 BTUIT. Approximately 1.05505585262 x 108 Joules (SI). Therm (E.C.) is based on the international table BTU, see Therm (U.S.) for Therms based on 59 °F BTU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the number from EC Therms on the Wikipedia page which links to the ISO BTU, but I have no familiarity either so @DInozemtsev have to decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I can explain how I got a previous value.
So according Wikipedia:
1 Th(E.C.) ≡ 100,000 BTU = 105,505,600 joules
To get 1 Joule in Therms (E.C.):
1/105,505,600 = 9.4781698791343777012784155532976e-9
(this is what I get at Windows 10 Calculator.)
I think we should go with this value. @angularsen what do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your value 105,505,600 is a rounded value, please read the quote from wiki:
1 Therm (E.C.):
Exactly 100,000 BTUIT. Approximately 1.05505585262 x 108 Joules (SI). Therm (E.C.) is based on the international table BTU, see Therm (U.S.) for Therms based on 59 °F BTU
1 Th EC = 1e5 BTU
exactly and approx 105,505,852.62 joules
. Then doing 1/x
gives me 9.4781712031331720001278504447561e-9
, which I believe is the correct value as it also matches the two online converters in above comments. This value should be used in the test case. Also since this is an infinite value, I think we should use the expression x/105505585.262
in the JSON for FromBaseToUnitFunc
, and x*105505585.262
for FromUnitToBaseFunc
.
Ok, I've just pushed changes. Could you sirs, @angularsen @eriove, please review them? |
Looks good to me! |
1 similar comment
Looks good to me! |
@angularsen the build does not seem to get triggered. Did I do something wrong with version stepping? |
@eriove Ah, I had to update AppVeyor to point to new github username, it's now building, but nuget push failed so I'll have to look at that in the evening. |
Nuget 3.75 is out. I had to build and push manually from my own computer. There seems to be something wrong with appveyor, I'm piggybacking on someone elses' forum post here: |
No description provided.