Skip to content

Commit 33f6517

Browse files
Add Molality (#1341)
Closes #1340 Added conversion for Molality covering the following units: - MolePerKilogram - MolePerGram
1 parent a95e33f commit 33f6517

File tree

17 files changed

+2103
-0
lines changed

17 files changed

+2103
-0
lines changed

Common/UnitDefinitions/Molality.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"Name": "Molality",
3+
"BaseUnit": "MolePerKilogram",
4+
"XmlDocSummary": "Molality is a measure of the amount of solute in a solution relative to a given mass of solvent.",
5+
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Molality",
6+
"BaseDimensions": {
7+
"N": 1,
8+
"M": -1
9+
},
10+
"Units": [
11+
{
12+
"SingularName": "MolePerKilogram",
13+
"PluralName": "MolesPerKilogram",
14+
"BaseUnits": {
15+
"N": "Mole",
16+
"M": "Kilogram"
17+
},
18+
"FromUnitToBaseFunc": "{x}",
19+
"FromBaseToUnitFunc": "{x}",
20+
"Localization": [
21+
{
22+
"Culture": "en-US",
23+
"Abbreviations": [ "mol/kg" ]
24+
}
25+
]
26+
},
27+
{
28+
"SingularName": "MolePerGram",
29+
"PluralName": "MolesPerGram",
30+
"BaseUnits": {
31+
"N": "Mole",
32+
"M": "Gram"
33+
},
34+
"FromUnitToBaseFunc": "{x} / 1e-3",
35+
"FromBaseToUnitFunc": "{x} * 1e-3",
36+
"Localization": [
37+
{
38+
"Culture": "en-US",
39+
"Abbreviations": [ "mol/g" ]
40+
}
41+
]
42+
}
43+
]
44+
}

Common/UnitEnumValues.g.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,5 +1790,9 @@
17901790
"Picogray": 11,
17911791
"Rad": 17,
17921792
"Teragray": 14
1793+
},
1794+
"Molality": {
1795+
"MolePerGram": 4,
1796+
"MolePerKilogram": 1
17931797
}
17941798
}
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>{589b202c-e638-5c93-fefe-e1e3bab4a493}</ProjectGuid>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<FileAlignment>512</FileAlignment>
15+
<RootNamespace>UnitsNet</RootNamespace>
16+
<AssemblyName>UnitsNet.Molality</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\Molality.g.cs" />
23+
<Compile Include="..\Units\MolalityUnit.g.cs" />
24+
<Compile Include="..\Properties\AssemblyInfo.cs" />
25+
</ItemGroup>
26+
<ItemGroup>
27+
<Reference Include="mscorlib, Version=1.15.6.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
28+
<HintPath>..\packages\nanoFramework.CoreLibrary.1.15.5\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.Molality</id>
5+
<version>5.39.0</version>
6+
<title>Units.NET Molality - nanoFramework</title>
7+
<authors>Andreas Gullberg Larsen,nanoframework</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 Molality 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 molality unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable</tags>
19+
<dependencies>
20+
<dependency id="nanoFramework.CoreLibrary" version="1.15.5" />
21+
</dependencies>
22+
</metadata>
23+
<files>
24+
<file src="..\..\..\Artifacts\UnitsNet.NanoFramework\Molality\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.15.5" targetFramework="netnanoframework10" />
4+
</packages>

UnitsNet.NanoFramework/GeneratedCode/Quantities/Molality.g.cs

Lines changed: 175 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.NanoFramework/GeneratedCode/Units/MolalityUnit.g.cs

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "MassFraction", "MassFractio
142142
EndProject
143143
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "MassMomentOfInertia", "MassMomentOfInertia\MassMomentOfInertia.nfproj", "{6218c061-3905-79b2-d3bc-bb7b8fc77a69}"
144144
EndProject
145+
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "Molality", "Molality\Molality.nfproj", "{589b202c-e638-5c93-fefe-e1e3bab4a493}"
146+
EndProject
145147
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "MolarEnergy", "MolarEnergy\MolarEnergy.nfproj", "{9b77d4e0-863d-4a74-c30a-56f7b2bb7cb7}"
146148
EndProject
147149
Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "MolarEntropy", "MolarEntropy\MolarEntropy.nfproj", "{2053731b-90f5-5141-d15e-8d7be8c2662f}"
@@ -668,6 +670,12 @@ Global
668670
{6218c061-3905-79b2-d3bc-bb7b8fc77a69}.Release|Any CPU.ActiveCfg = Release|Any CPU
669671
{6218c061-3905-79b2-d3bc-bb7b8fc77a69}.Release|Any CPU.Build.0 = Release|Any CPU
670672
{6218c061-3905-79b2-d3bc-bb7b8fc77a69}.Release|Any CPU.Deploy.0 = Release|Any CPU
673+
{589b202c-e638-5c93-fefe-e1e3bab4a493}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
674+
{589b202c-e638-5c93-fefe-e1e3bab4a493}.Debug|Any CPU.Build.0 = Debug|Any CPU
675+
{589b202c-e638-5c93-fefe-e1e3bab4a493}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
676+
{589b202c-e638-5c93-fefe-e1e3bab4a493}.Release|Any CPU.ActiveCfg = Release|Any CPU
677+
{589b202c-e638-5c93-fefe-e1e3bab4a493}.Release|Any CPU.Build.0 = Release|Any CPU
678+
{589b202c-e638-5c93-fefe-e1e3bab4a493}.Release|Any CPU.Deploy.0 = Release|Any CPU
671679
{9b77d4e0-863d-4a74-c30a-56f7b2bb7cb7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
672680
{9b77d4e0-863d-4a74-c30a-56f7b2bb7cb7}.Debug|Any CPU.Build.0 = Debug|Any CPU
673681
{9b77d4e0-863d-4a74-c30a-56f7b2bb7cb7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU

UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToMolalityExtensionsTest.g.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)