OSDC.UnitConversion.Conversion
3.1.4
See the version list below for details.
dotnet add package OSDC.UnitConversion.Conversion --version 3.1.4
NuGet\Install-Package OSDC.UnitConversion.Conversion -Version 3.1.4
<PackageReference Include="OSDC.UnitConversion.Conversion" Version="3.1.4" />
paket add OSDC.UnitConversion.Conversion --version 3.1.4
#r "nuget: OSDC.UnitConversion.Conversion, 3.1.4"
// Install OSDC.UnitConversion.Conversion as a Cake Addin #addin nuget:?package=OSDC.UnitConversion.Conversion&version=3.1.4 // Install OSDC.UnitConversion.Conversion as a Cake Tool #tool nuget:?package=OSDC.UnitConversion.Conversion&version=3.1.4
Model for unit conversion of BasePhysicalQuantity
This nuget package hosts the C# model for converting units of a BasePhysicalQuantity.
Classes and methods are scoped within the namespace: UnitConversion.Conversion
More info on:
https://github.com/Open-Source-Drilling-Community/UnitConversion
Default UnitChoices for the Base Unit Systems
There are four base unit systems: SI
, Metric
, Imperial
and US
.
It is mandatory to define the unit choice for every physical quantities for
each of these based unit systems. This is done by adding a line for each
of the BaseUnitSystem
in the file BaseUnitSystem.cs
. This line looks like that:
Choices.Add(AccelerationQuantity.Instance.ID.ToString(), AccelerationQuantity.Instance.GetUnitChoice(AccelerationQuantity.UnitChoicesEnum.MetrePerSecondSquared).ID.ToString());
Generation of Enumerations
This project has one file that is automaticaly generated EnumerationQuantities.cs
.
This file contains partial classes for each of the physical quantities.
Each partial class definition defines an enumeration for each of the
unit choices that are defined for this physical quantity and a
lookup table that defines the association between the enumeration
and the GUID
of the unit choice.
To generate the file EnumerationQuantities.cs
, one must run the program
GenerateEnumerations
. The generation of the file is necessary each
time a modification is made in the list of unit choices of a physical
quantity or when a new physical quantity is added or removed. However,
there is a potential bootstrap problem with the definitions of the
unit choices for the BaseUnitSystem
. As each BaseUnitSystem
has
a list of unit choices and these choices are usually defined using
the unit choice enumeration, if the enumeration does not yet exist
or its name is changed, then the project does not compile and it is not
possible to generate the enumerations using the program GenerateEnumerations
.
So it is advised to define the unit choice for the particular physical
quantity using its name or its GUID
, then generate the enumerations by running
the program GenerateEnumeration
and finally replace the name of the unit
choice with its equivalent enumeration.
Choices.Add(AccelerationQuantity.Instance.ID.ToString(), AccelerationQuantity.Instance.GetUnitChoice("metre per second squared").ID.ToString());
GenerateEnumerations
Choices.Add(AccelerationQuantity.Instance.ID.ToString(), AccelerationQuantity.Instance.GetUnitChoice(AccelerationQuantity.UnitChoicesEnum.MetrePerSecondSquared).ID.ToString());
Contributors
Eric Cayeux, NORCE Energy Modelling and Automation
Gilles Pelfrene, NORCE Energy Modelling and Automation
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.11.0-3.final)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OSDC.UnitConversion.Conversion:
Package | Downloads |
---|---|
OSDC.UnitConversion.Conversion.DrillingEngineering
A package for unit conversion that accounts for Drilling Engineering meaningful precisions |
|
OSDC.UnitConversion.Conversion.UnitSystem
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.3.12 | 872 | 8/30/2024 |
3.3.11 | 104 | 8/30/2024 |
3.3.10 | 110 | 8/29/2024 |
3.3.9 | 104 | 8/29/2024 |
3.3.8 | 105 | 8/29/2024 |
3.3.7 | 105 | 8/29/2024 |
3.3.6 | 150 | 8/27/2024 |
3.3.5 | 125 | 8/27/2024 |
3.3.4 | 118 | 8/26/2024 |
3.3.3 | 119 | 8/26/2024 |
3.3.2 | 115 | 8/26/2024 |
3.3.1 | 131 | 8/23/2024 |
3.3.0 | 126 | 8/23/2024 |
3.2.10 | 127 | 8/20/2024 |
3.2.7 | 165 | 8/20/2024 |
3.2.6 | 145 | 8/19/2024 |
3.2.5 | 76 | 8/19/2024 |
3.2.0 | 227 | 8/17/2024 |
3.1.6 | 122 | 8/15/2024 |
3.1.5 | 109 | 8/13/2024 |
3.1.4 | 75 | 8/13/2024 |
3.1.3 | 126 | 8/12/2024 |
3.1.2 | 128 | 8/8/2024 |
3.1.1 | 107 | 8/8/2024 |
3.1.0 | 103 | 8/8/2024 |
3.0.8 | 118 | 8/6/2024 |
3.0.7 | 215 | 8/5/2024 |
3.0.6 | 92 | 8/5/2024 |
3.0.5 | 105 | 8/5/2024 |
3.0.4 | 134 | 7/30/2024 |
3.0.3 | 103 | 7/26/2024 |
3.0.2 | 90 | 7/25/2024 |
3.0.1 | 96 | 7/25/2024 |
3.0.0 | 81 | 7/25/2024 |
2.0.1 | 165 | 7/23/2024 |
2.0.0 | 193 | 7/18/2024 |
1.0.36 | 109 | 7/18/2024 |
1.0.35 | 236 | 7/11/2024 |
1.0.34 | 119 | 7/10/2024 |
1.0.33 | 118 | 7/10/2024 |
1.0.32 | 117 | 7/10/2024 |
1.0.31 | 114 | 7/9/2024 |
1.0.30 | 109 | 7/9/2024 |
1.0.29 | 122 | 7/9/2024 |
1.0.28 | 108 | 7/9/2024 |
1.0.27 | 113 | 7/9/2024 |
1.0.26 | 122 | 7/9/2024 |
1.0.25 | 129 | 7/5/2024 |
1.0.24 | 117 | 7/4/2024 |
1.0.23 | 126 | 7/3/2024 |
1.0.22 | 419 | 5/6/2024 |
1.0.21 | 517 | 4/18/2024 |
1.0.20 | 1,909 | 10/30/2023 |
1.0.19 | 204 | 10/29/2023 |
1.0.18 | 215 | 10/29/2023 |
1.0.17 | 241 | 10/29/2023 |
1.0.16 | 219 | 10/28/2023 |
1.0.15 | 221 | 10/27/2023 |
1.0.14 | 271 | 10/26/2023 |
1.0.13 | 291 | 8/15/2023 |
1.0.12 | 962 | 5/5/2023 |
1.0.11 | 648 | 3/26/2023 |
1.0.10 | 424 | 3/26/2023 |
1.0.9 | 402 | 3/24/2023 |
1.0.8 | 536 | 3/21/2023 |
1.0.7 | 364 | 3/17/2023 |
1.0.6 | 370 | 3/17/2023 |
1.0.5 | 237 | 3/17/2023 |
1.0.4 | 387 | 3/17/2023 |
1.0.3 | 733 | 3/16/2023 |