Skip to content

Commit 230a059

Browse files
authored
Add MolarFlow, other molar units and heat transfer (#1196)
- Add `MolarFlow` quantity with several units - Obsolete `HeatTransferCoefficient.BtuPerSquareFootDegreeFahrenheit` (bad name) - Add `HeatTransferCoefficient.BtuPerHourSquareFootDegreeFahrenheit` - Add `HeatTransferCoefficient.CaloriePerHourSquareMeterDegreeCelsius` - Add `Molarity.PoundMolePerCubicFoot` - Add `Molarity.KilomolePerCubicMeter` - Add `MolarMass.KilogramPerKilomole`
1 parent 4e1cd95 commit 230a059

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3602
-73
lines changed

CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public class NumberTo{_quantityName}ExtensionsTests
3838
Writer.WL(2, $@"
3939
[Fact]");
4040

41-
Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit.ObsoleteText));
42-
4341
Writer.WL(2, $@"public void NumberTo{unit.PluralName}Test() =>
4442
Assert.Equal({_quantityName}.From{unit.PluralName}(2), 2.{unit.PluralName}());
4543
");
@@ -49,10 +47,5 @@ public class NumberTo{_quantityName}ExtensionsTests
4947
}");
5048
return Writer.ToString();
5149
}
52-
53-
private static string? GetObsoleteAttributeOrNull(string? obsoleteText) =>
54-
string.IsNullOrWhiteSpace(obsoleteText) ?
55-
null :
56-
$"[Obsolete(\"{obsoleteText}\")]";
5750
}
5851
}

Common/UnitDefinitions/HeatTransferCoefficient.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,38 @@
3535
{
3636
"SingularName": "BtuPerSquareFootDegreeFahrenheit",
3737
"PluralName": "BtusPerSquareFootDegreeFahrenheit",
38+
"ObsoleteText": "The name of this definition incorrectly omitted time as divisor, please use BtuPerHourSquareFootDegreeFahrenheit instead",
3839
"FromUnitToBaseFunc": "{x} * 5.6782633411134878",
3940
"FromBaseToUnitFunc": "{x} / 5.6782633411134878",
4041
"Localization": [
4142
{
4243
"Culture": "en-US",
43-
"Abbreviations": [ "Btu/ft²·hr·°F" ]
44+
"Abbreviations": [ "Btu/ft²·°F" ]
45+
}
46+
]
47+
},
48+
{
49+
"SingularName": "BtuPerHourSquareFootDegreeFahrenheit",
50+
"PluralName": "BtusPerHourSquareFootDegreeFahrenheit",
51+
"FromUnitToBaseFunc": "{x} * 5.6782633411134878",
52+
"FromBaseToUnitFunc": "{x} / 5.6782633411134878",
53+
"Localization": [
54+
{
55+
"Culture": "en-US",
56+
"Abbreviations": [ "Btu/h·ft²·°F", "Btu/ft²·h·°F", "Btu/hr·ft²·°F", "Btu/ft²·hr·°F" ]
57+
}
58+
]
59+
},
60+
{
61+
"SingularName": "CaloriePerHourSquareMeterDegreeCelsius",
62+
"PluralName": "CaloriesPerHourSquareMeterDegreeCelsius",
63+
"Prefixes": [ "Kilo" ],
64+
"FromUnitToBaseFunc": "({x} * 4.1868) / 3600",
65+
"FromBaseToUnitFunc": "({x} / 4.1868) * 3600",
66+
"Localization": [
67+
{
68+
"Culture": "en-US",
69+
"Abbreviations": [ "kcal/h·m²·°C", "kcal/m²·h·°C", "kcal/hr·m²·°C", "kcal/m²·hr·°C" ]
4470
}
4571
]
4672
}

Common/UnitDefinitions/MolarFlow.json

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"Name": "MolarFlow",
3+
"BaseUnit": "MolePerSecond",
4+
"XmlDocSummary": "Molar flow is the ratio of the amount of substance change to the time during which the change occurred (value of amount of substance changes per unit time).",
5+
"BaseDimensions": {
6+
"N": 1,
7+
"T": -1
8+
},
9+
"Units": [
10+
{
11+
"SingularName": "MolePerSecond",
12+
"PluralName": "MolesPerSecond",
13+
"BaseUnits": {
14+
"N": "Mole",
15+
"T": "Second"
16+
},
17+
"Prefixes": [ "Kilo" ],
18+
"FromUnitToBaseFunc": "{x}",
19+
"FromBaseToUnitFunc": "{x}",
20+
"Localization": [
21+
{
22+
"Culture": "en-US",
23+
"Abbreviations": [ "mol/s" ]
24+
}
25+
]
26+
},
27+
{
28+
"SingularName": "MolePerMinute",
29+
"PluralName": "MolesPerMinute",
30+
"BaseUnits": {
31+
"N": "Mole",
32+
"T": "Minute"
33+
},
34+
"Prefixes": [ "Kilo" ],
35+
"FromUnitToBaseFunc": "{x} / 60",
36+
"FromBaseToUnitFunc": "{x} * 60",
37+
"Localization": [
38+
{
39+
"Culture": "en-US",
40+
"Abbreviations": [ "mol/min" ]
41+
}
42+
]
43+
},
44+
{
45+
"SingularName": "MolePerHour",
46+
"PluralName": "MolesPerHour",
47+
"BaseUnits": {
48+
"N": "Mole",
49+
"T": "Hour"
50+
},
51+
"Prefixes": [ "Kilo" ],
52+
"FromUnitToBaseFunc": "{x} / 3600",
53+
"FromBaseToUnitFunc": "{x} * 3600",
54+
"Localization": [
55+
{
56+
"Culture": "en-US",
57+
"Abbreviations": [ "kmol/h" ]
58+
}
59+
]
60+
},
61+
{
62+
"SingularName": "PoundMolePerSecond",
63+
"PluralName": "PoundMolesPerSecond",
64+
"BaseUnits": {
65+
"N": "PoundMole",
66+
"T": "Second"
67+
},
68+
"FromUnitToBaseFunc": "{x} * 453.59237",
69+
"FromBaseToUnitFunc": "{x} / 453.59237",
70+
"Localization": [
71+
{
72+
"Culture": "en-US",
73+
"Abbreviations": [ "lbmol/s" ]
74+
}
75+
]
76+
},
77+
{
78+
"SingularName": "PoundMolePerMinute",
79+
"PluralName": "PoundMolesPerMinute",
80+
"BaseUnits": {
81+
"N": "PoundMole",
82+
"T": "Minute"
83+
},
84+
"FromUnitToBaseFunc": "({x} * 453.59237) / 60",
85+
"FromBaseToUnitFunc": "({x} / 453.59237) * 60",
86+
"Localization": [
87+
{
88+
"Culture": "en-US",
89+
"Abbreviations": [ "lbmol/min" ]
90+
}
91+
]
92+
},
93+
{
94+
"SingularName": "PoundMolePerHour",
95+
"PluralName": "PoundMolesPerHour",
96+
"BaseUnits": {
97+
"N": "PoundMole",
98+
"T": "Hour"
99+
},
100+
"FromUnitToBaseFunc": "({x} * 453.59237) / 3600",
101+
"FromBaseToUnitFunc": "({x} / 453.59237) * 3600",
102+
"Localization": [
103+
{
104+
"Culture": "en-US",
105+
"Abbreviations": [ "lbmol/h" ]
106+
}
107+
]
108+
}
109+
]
110+
}

Common/UnitDefinitions/MolarMass.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
}
2525
]
2626
},
27+
{
28+
"SingularName": "KilogramPerKilomole",
29+
"PluralName": "KilogramsPerKilomole",
30+
"FromUnitToBaseFunc": "{x} / 1e3",
31+
"FromBaseToUnitFunc": "{x} * 1e3",
32+
"Localization": [
33+
{
34+
"Culture": "en-US",
35+
"Abbreviations": [ "kg/kmol" ]
36+
}
37+
]
38+
},
2739
{
2840
"SingularName": "PoundPerMole",
2941
"PluralName": "PoundsPerMole",

Common/UnitDefinitions/Molarity.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"FromUnitToBaseFunc": "{x}",
1919
"FromBaseToUnitFunc": "{x}",
20-
"Prefixes": [],
20+
"Prefixes": [ "Kilo" ],
2121
"Localization": [
2222
{
2323
"Culture": "en-US",
@@ -41,6 +41,22 @@
4141
"Abbreviations": [ "mol/L", "M" ]
4242
}
4343
]
44+
},
45+
{
46+
"SingularName": "PoundMolePerCubicFoot",
47+
"PluralName": "PoundMolesPerCubicFoot",
48+
"BaseUnits": {
49+
"L": "Foot",
50+
"N": "PoundMole"
51+
},
52+
"FromUnitToBaseFunc": "{x} / 6.2427960576144611956325455827221e-5",
53+
"FromBaseToUnitFunc": "{x} * 6.2427960576144611956325455827221e-5",
54+
"Localization": [
55+
{
56+
"Culture": "en-US",
57+
"Abbreviations": [ "lbmol/ft³" ]
58+
}
59+
]
4460
}
4561
]
4662
}

Common/UnitEnumValues.g.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,10 @@
538538
"HeatTransferCoefficient": {
539539
"BtuPerSquareFootDegreeFahrenheit": 1,
540540
"WattPerSquareMeterCelsius": 2,
541-
"WattPerSquareMeterKelvin": 3
541+
"WattPerSquareMeterKelvin": 3,
542+
"BtuPerHourSquareFootDegreeFahrenheit": 11,
543+
"KilocaloriePerHourSquareMeterDegreeCelsius": 8,
544+
"CaloriePerHourSquareMeterDegreeCelsius": 5
542545
},
543546
"Illuminance": {
544547
"Kilolux": 1,
@@ -957,7 +960,10 @@
957960
"NanomolePerLiter": 14,
958961
"NanomolesPerLiter": 15,
959962
"PicomolePerLiter": 16,
960-
"PicomolesPerLiter": 17
963+
"PicomolesPerLiter": 17,
964+
"KilomolePerCubicMeter": 25,
965+
"KilopoundMolePerCubicFoot": 23,
966+
"PoundMolePerCubicFoot": 18
961967
},
962968
"MolarMass": {
963969
"CentigramPerMole": 1,
@@ -971,7 +977,9 @@
971977
"MicrogramPerMole": 9,
972978
"MilligramPerMole": 10,
973979
"NanogramPerMole": 11,
974-
"PoundPerMole": 12
980+
"PoundPerMole": 12,
981+
"KiloGramPerKiloMole": 20,
982+
"KilogramPerKilomole": 15
975983
},
976984
"Permeability": {
977985
"HenryPerMeter": 1
@@ -1691,5 +1699,19 @@
16911699
"PoundFootPerSecond": 16,
16921700
"SlugFootPerSecond": 11,
16931701
"PoundForceSecond": 18
1702+
},
1703+
"MolarFlow": {
1704+
"KiloMolePerHour": 10,
1705+
"KiloMolePerMinute": 1,
1706+
"KiloMolePerSecond": 5,
1707+
"PoundMolePerHour": 6,
1708+
"PoundMolePerMinute": 7,
1709+
"PoundMolePerSecond": 4,
1710+
"KilomolePerHour": 2,
1711+
"KilomolePerMinute": 15,
1712+
"KilomolePerSecond": 12,
1713+
"MolePerHour": 8,
1714+
"MolePerMinute": 18,
1715+
"MolePerSecond": 3
16941716
}
16951717
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
5+
</PropertyGroup>
6+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
7+
<PropertyGroup>
8+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
9+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
10+
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
11+
<ProjectGuid>{49cc942b-d836-a48b-0429-25bf95247759}</ProjectGuid>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<FileAlignment>512</FileAlignment>
15+
<RootNamespace>UnitsNet</RootNamespace>
16+
<AssemblyName>UnitsNet.MolarFlow</AssemblyName>
17+
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
18+
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
19+
</PropertyGroup>
20+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
21+
<ItemGroup>
22+
<Compile Include="..\Quantities\MolarFlow.g.cs" />
23+
<Compile Include="..\Units\MolarFlowUnit.g.cs" />
24+
<Compile Include="..\Properties\AssemblyInfo.cs" />
25+
</ItemGroup>
26+
<ItemGroup>
27+
<Reference Include="mscorlib, Version=1.14.3.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
28+
<HintPath>..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll</HintPath>
29+
<Private>True</Private>
30+
<SpecificVersion>True</SpecificVersion>
31+
</Reference>
32+
</ItemGroup>
33+
<ItemGroup>
34+
<None Include="packages.config" />
35+
</ItemGroup>
36+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
37+
<ProjectExtensions>
38+
<ProjectCapabilities>
39+
<ProjectConfigurationsDeclaredAsItems />
40+
</ProjectCapabilities>
41+
</ProjectExtensions>
42+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>UnitsNet.nanoFramework.MolarFlow</id>
5+
<version>5.1.0</version>
6+
<title>Units.NET MolarFlow - nanoFramework</title>
7+
<authors>Andreas Gullberg Larsen,nanoFramework project contributors</authors>
8+
<owners>UnitsNet</owners>
9+
<license type="expression">MIT</license>
10+
<projectUrl>https://github.com/angularsen/UnitsNet</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>Adds MolarFlow units for Units.NET on .NET nanoFramework. For .NET or .NET Core, use UnitsNet instead.</description>
13+
<iconUrl>https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</iconUrl>
14+
<releaseNotes>
15+
</releaseNotes>
16+
<copyright>Copyright 2013 Andreas Gullberg Larsen ([email protected]).</copyright>
17+
<language>en-US</language>
18+
<tags>nanoframework molarflow unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable</tags>
19+
<dependencies>
20+
<dependency id="nanoFramework.CoreLibrary" version="1.14.2" />
21+
</dependencies>
22+
</metadata>
23+
<files>
24+
<file src="..\..\..\Artifacts\UnitsNet.NanoFramework\MolarFlow\UnitsNet.*" target="lib" />
25+
</files>
26+
</package>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="nanoFramework.CoreLibrary" version="1.14.2" targetFramework="netnanoframework10" />
4+
</packages>

0 commit comments

Comments
 (0)