Skip to content
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

Added support for molar flow units #1196

Merged
merged 9 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public class NumberTo{_quantityName}ExtensionsTests
Writer.WL(2, $@"
[Fact]");

Writer.WLIfText(2, GetObsoleteAttributeOrNull(unit.ObsoleteText));

Writer.WL(2, $@"public void NumberTo{unit.PluralName}Test() =>
Assert.Equal({_quantityName}.From{unit.PluralName}(2), 2.{unit.PluralName}());
");
Expand All @@ -49,10 +47,5 @@ public class NumberTo{_quantityName}ExtensionsTests
}");
return Writer.ToString();
}

private static string? GetObsoleteAttributeOrNull(string? obsoleteText) =>
string.IsNullOrWhiteSpace(obsoleteText) ?
null :
$"[Obsolete(\"{obsoleteText}\")]";
}
}
28 changes: 27 additions & 1 deletion Common/UnitDefinitions/HeatTransferCoefficient.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,38 @@
{
"SingularName": "BtuPerSquareFootDegreeFahrenheit",
"PluralName": "BtusPerSquareFootDegreeFahrenheit",
"ObsoleteText": "The name of this definition incorrectly omitted time as divisor, please use BtuPerHourSquareFootDegreeFahrenheit instead",
"FromUnitToBaseFunc": "{x} * 5.6782633411134878",
"FromBaseToUnitFunc": "{x} / 5.6782633411134878",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "Btu/ft²·hr·°F" ]
"Abbreviations": [ "Btu/ft²·°F" ]
}
]
},
{
"SingularName": "BtuPerHourSquareFootDegreeFahrenheit",
"PluralName": "BtusPerHourSquareFootDegreeFahrenheit",
"FromUnitToBaseFunc": "{x} * 5.6782633411134878",
"FromBaseToUnitFunc": "{x} / 5.6782633411134878",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "Btu/h·ft²·°F", "Btu/ft²·h·°F", "Btu/hr·ft²·°F", "Btu/ft²·hr·°F" ]
angularsen marked this conversation as resolved.
Show resolved Hide resolved
}
]
},
{
"SingularName": "CaloriePerHourSquareMeterDegreeCelsius",
"PluralName": "CaloriesPerHourSquareMeterDegreeCelsius",
"Prefixes": [ "Kilo" ],
"FromUnitToBaseFunc": "({x} * 4.1868) / 3600",
"FromBaseToUnitFunc": "({x} / 4.1868) * 3600",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kcal/h·m²·°C", "kcal/m²·h·°C", "kcal/hr·m²·°C", "kcal/m²·hr·°C" ]
}
]
}
Expand Down
110 changes: 110 additions & 0 deletions Common/UnitDefinitions/MolarFlow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"Name": "MolarFlow",
"BaseUnit": "MolePerSecond",
"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).",
"BaseDimensions": {
"N": 1,
"T": -1
},
"Units": [
{
"SingularName": "MolePerSecond",
"PluralName": "MolesPerSecond",
"BaseUnits": {
"N": "Mole",
"T": "Second"
},
"Prefixes": [ "Kilo" ],
"FromUnitToBaseFunc": "{x}",
"FromBaseToUnitFunc": "{x}",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "mol/s" ]
}
]
},
{
"SingularName": "MolePerMinute",
"PluralName": "MolesPerMinute",
"BaseUnits": {
"N": "Mole",
"T": "Minute"
},
"Prefixes": [ "Kilo" ],
"FromUnitToBaseFunc": "{x} / 60",
"FromBaseToUnitFunc": "{x} * 60",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "mol/min" ]
}
]
},
{
"SingularName": "MolePerHour",
"PluralName": "MolesPerHour",
"BaseUnits": {
"N": "Mole",
"T": "Hour"
},
"Prefixes": [ "Kilo" ],
"FromUnitToBaseFunc": "{x} / 3600",
"FromBaseToUnitFunc": "{x} * 3600",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kmol/h" ]
}
]
},
{
"SingularName": "PoundMolePerSecond",
angularsen marked this conversation as resolved.
Show resolved Hide resolved
"PluralName": "PoundMolesPerSecond",
"BaseUnits": {
"N": "PoundMole",
"T": "Second"
},
"FromUnitToBaseFunc": "{x} * 453.59237",
"FromBaseToUnitFunc": "{x} / 453.59237",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "lbmol/s" ]
}
]
},
{
"SingularName": "PoundMolePerMinute",
"PluralName": "PoundMolesPerMinute",
"BaseUnits": {
"N": "PoundMole",
"T": "Minute"
},
"FromUnitToBaseFunc": "({x} * 453.59237) / 60",
"FromBaseToUnitFunc": "({x} / 453.59237) * 60",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "lbmol/min" ]
}
]
},
{
"SingularName": "PoundMolePerHour",
"PluralName": "PoundMolesPerHour",
"BaseUnits": {
"N": "PoundMole",
"T": "Hour"
},
"FromUnitToBaseFunc": "({x} * 453.59237) / 3600",
"FromBaseToUnitFunc": "({x} / 453.59237) * 3600",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "lbmol/h" ]
}
]
}
]
}
12 changes: 12 additions & 0 deletions Common/UnitDefinitions/MolarMass.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
}
]
},
{
"SingularName": "KilogramPerKilomole",
"PluralName": "KilogramsPerKilomole",
"FromUnitToBaseFunc": "{x} / 1e3",
"FromBaseToUnitFunc": "{x} * 1e3",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "kg/kmol" ]
}
]
},
{
"SingularName": "PoundPerMole",
"PluralName": "PoundsPerMole",
Expand Down
18 changes: 17 additions & 1 deletion Common/UnitDefinitions/Molarity.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"FromUnitToBaseFunc": "{x}",
"FromBaseToUnitFunc": "{x}",
"Prefixes": [],
"Prefixes": [ "Kilo" ],
"Localization": [
{
"Culture": "en-US",
Expand All @@ -41,6 +41,22 @@
"Abbreviations": [ "mol/L", "M" ]
}
]
},
{
"SingularName": "PoundMolePerCubicFoot",
"PluralName": "PoundMolesPerCubicFoot",
"BaseUnits": {
"L": "Foot",
"N": "PoundMole"
},
"FromUnitToBaseFunc": "{x} / 6.2427960576144611956325455827221e-5",
"FromBaseToUnitFunc": "{x} * 6.2427960576144611956325455827221e-5",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "lbmol/ft³" ]
}
]
}
]
}
28 changes: 25 additions & 3 deletions Common/UnitEnumValues.g.json
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,10 @@
"HeatTransferCoefficient": {
"BtuPerSquareFootDegreeFahrenheit": 1,
"WattPerSquareMeterCelsius": 2,
"WattPerSquareMeterKelvin": 3
"WattPerSquareMeterKelvin": 3,
"BtuPerHourSquareFootDegreeFahrenheit": 11,
"KilocaloriePerHourSquareMeterDegreeCelsius": 8,
"CaloriePerHourSquareMeterDegreeCelsius": 5
},
"Illuminance": {
"Kilolux": 1,
Expand Down Expand Up @@ -956,7 +959,10 @@
"NanomolePerLiter": 14,
"NanomolesPerLiter": 15,
"PicomolePerLiter": 16,
"PicomolesPerLiter": 17
"PicomolesPerLiter": 17,
"KilomolePerCubicMeter": 25,
"KilopoundMolePerCubicFoot": 23,
"PoundMolePerCubicFoot": 18
},
"MolarMass": {
"CentigramPerMole": 1,
Expand All @@ -970,7 +976,9 @@
"MicrogramPerMole": 9,
"MilligramPerMole": 10,
"NanogramPerMole": 11,
"PoundPerMole": 12
"PoundPerMole": 12,
"KiloGramPerKiloMole": 20,
"KilogramPerKilomole": 15
},
"Permeability": {
"HenryPerMeter": 1
Expand Down Expand Up @@ -1690,5 +1698,19 @@
"PoundFootPerSecond": 16,
"SlugFootPerSecond": 11,
"PoundForceSecond": 18
},
"MolarFlow": {
"KiloMolePerHour": 10,
"KiloMolePerMinute": 1,
"KiloMolePerSecond": 5,
"PoundMolePerHour": 6,
"PoundMolePerMinute": 7,
"PoundMolePerSecond": 4,
"KilomolePerHour": 2,
"KilomolePerMinute": 15,
"KilomolePerSecond": 12,
"MolePerHour": 8,
"MolePerMinute": 18,
"MolePerSecond": 3
}
}
42 changes: 42 additions & 0 deletions UnitsNet.NanoFramework/GeneratedCode/MolarFlow/MolarFlow.nfproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{49cc942b-d836-a48b-0429-25bf95247759}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<RootNamespace>UnitsNet</RootNamespace>
<AssemblyName>UnitsNet.MolarFlow</AssemblyName>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
<ItemGroup>
<Compile Include="..\Quantities\MolarFlow.g.cs" />
<Compile Include="..\Units\MolarFlowUnit.g.cs" />
<Compile Include="..\Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib, Version=1.14.3.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>..\packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
<ProjectExtensions>
<ProjectCapabilities>
<ProjectConfigurationsDeclaredAsItems />
</ProjectCapabilities>
</ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>UnitsNet.nanoFramework.MolarFlow</id>
<version>5.1.0</version>
<title>Units.NET MolarFlow - nanoFramework</title>
<authors>Andreas Gullberg Larsen,nanoFramework project contributors</authors>
<owners>UnitsNet</owners>
<license type="expression">MIT</license>
<projectUrl>https://github.com/angularsen/UnitsNet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds MolarFlow units for Units.NET on .NET nanoFramework. For .NET or .NET Core, use UnitsNet instead.</description>
<iconUrl>https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</iconUrl>
<releaseNotes>
</releaseNotes>
<copyright>Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).</copyright>
<language>en-US</language>
<tags>nanoframework molarflow unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable</tags>
<dependencies>
<dependency id="nanoFramework.CoreLibrary" version="1.14.2" />
</dependencies>
</metadata>
<files>
<file src="..\..\..\Artifacts\UnitsNet.NanoFramework\MolarFlow\UnitsNet.*" target="lib" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nanoFramework.CoreLibrary" version="1.14.2" targetFramework="netnanoframework10" />
</packages>
Loading