OSDC.UnitConversion.Conversion
3.3.12
dotnet add package OSDC.UnitConversion.Conversion --version 3.3.12
NuGet\Install-Package OSDC.UnitConversion.Conversion -Version 3.3.12
<PackageReference Include="OSDC.UnitConversion.Conversion" Version="3.3.12" />
paket add OSDC.UnitConversion.Conversion --version 3.3.12
#r "nuget: OSDC.UnitConversion.Conversion, 3.3.12"
// Install OSDC.UnitConversion.Conversion as a Cake Addin #addin nuget:?package=OSDC.UnitConversion.Conversion&version=3.3.12 // Install OSDC.UnitConversion.Conversion as a Cake Tool #tool nuget:?package=OSDC.UnitConversion.Conversion&version=3.3.12
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
Descriptive Definitions of UnitChoice Conversions
For each UnitChoice
, it is possible to define a conversion factor and a conversion bias.
These are defined in the properties ConversionFactorFromSIFormula
and ConversionBiasFromSIFormula
respectively, which
are string values. The content of these strings is the code to calculate the conversion factor and the conversion bias.
The code is in plain C#. If the code involves some mathematics operator like square root or Pi, these need to be fully
qualified, i.e., System.Math.Sqrt
or System.Math.Pi
. Otherwise, it is possible to use already defined Factors
, like Factors.Inch
.
These factors are also defined as formulas as a function of other definition. This symbolic definition of the conversion
factor and bias allows to generate a comprehensive description of the conversion factors and bias by calling the method GetConversionDescription
of UnitChoice
.
Here is the result obtained on calling GetConversionDescription
on the Fahrenheit unit choice:
[v] = a * [SI] + b
where
[v] is the value in fahrenheit
[SI] is the value in SI, i.e., in kelvin
a = 1.0/FahrenheitSlope, i.e., 1.7999999999999998
b = -FahrenheitBias, i.e., -459.67
and
FahrenheitSlope = 5.0 / 9.0 reference: https://nn.wikipedia.org/wiki/Fahrenheit
FahrenheitBias = 459.67 reference: https://nn.wikipedia.org/wiki/Fahrenheit
and here is the result obtained with the Furlong unit choice:
[v] = a * [SI]
where
[v] is the value in furlong
[SI] is the value in SI, i.e., in metre
a = 1.0/Furlong, i.e., 0.004970969537898672
and
Furlong = 660.0 * Foot reference: https://www.britannica.com/science/furlong
Foot = 12.0 * Inch
Inch = 0.0254 reference: https://www.nist.gov/pml/owm/si-units-length
For efficiency, there is a conversion that is made from the symbolic description to code when calling the program GenerateEnumerations
(see below).
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.
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.12.0-1.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 | 734 | 8/30/2024 |
3.3.11 | 92 | 8/30/2024 |
3.3.10 | 100 | 8/29/2024 |
3.3.9 | 92 | 8/29/2024 |
3.3.8 | 96 | 8/29/2024 |
3.3.7 | 94 | 8/29/2024 |
3.3.6 | 139 | 8/27/2024 |
3.3.5 | 113 | 8/27/2024 |
3.3.4 | 108 | 8/26/2024 |
3.3.3 | 107 | 8/26/2024 |
3.3.2 | 103 | 8/26/2024 |
3.3.1 | 119 | 8/23/2024 |
3.3.0 | 118 | 8/23/2024 |
3.2.10 | 117 | 8/20/2024 |
3.2.7 | 155 | 8/20/2024 |
3.2.6 | 135 | 8/19/2024 |
3.2.5 | 68 | 8/19/2024 |
3.2.0 | 217 | 8/17/2024 |
3.1.6 | 112 | 8/15/2024 |
3.1.5 | 96 | 8/13/2024 |
3.1.4 | 67 | 8/13/2024 |
3.1.3 | 114 | 8/12/2024 |
3.1.2 | 118 | 8/8/2024 |
3.1.1 | 99 | 8/8/2024 |
3.1.0 | 95 | 8/8/2024 |
3.0.8 | 107 | 8/6/2024 |
3.0.7 | 202 | 8/5/2024 |
3.0.6 | 85 | 8/5/2024 |
3.0.5 | 95 | 8/5/2024 |
3.0.4 | 124 | 7/30/2024 |
3.0.3 | 93 | 7/26/2024 |
3.0.2 | 77 | 7/25/2024 |
3.0.1 | 86 | 7/25/2024 |
3.0.0 | 71 | 7/25/2024 |
2.0.1 | 153 | 7/23/2024 |
2.0.0 | 179 | 7/18/2024 |
1.0.36 | 96 | 7/18/2024 |
1.0.35 | 222 | 7/11/2024 |
1.0.34 | 111 | 7/10/2024 |
1.0.33 | 106 | 7/10/2024 |
1.0.32 | 106 | 7/10/2024 |
1.0.31 | 104 | 7/9/2024 |
1.0.30 | 99 | 7/9/2024 |
1.0.29 | 114 | 7/9/2024 |
1.0.28 | 98 | 7/9/2024 |
1.0.27 | 103 | 7/9/2024 |
1.0.26 | 110 | 7/9/2024 |
1.0.25 | 119 | 7/5/2024 |
1.0.24 | 107 | 7/4/2024 |
1.0.23 | 115 | 7/3/2024 |
1.0.22 | 411 | 5/6/2024 |
1.0.21 | 508 | 4/18/2024 |
1.0.20 | 1,894 | 10/30/2023 |
1.0.19 | 196 | 10/29/2023 |
1.0.18 | 206 | 10/29/2023 |
1.0.17 | 232 | 10/29/2023 |
1.0.16 | 212 | 10/28/2023 |
1.0.15 | 213 | 10/27/2023 |
1.0.14 | 265 | 10/26/2023 |
1.0.13 | 286 | 8/15/2023 |
1.0.12 | 956 | 5/5/2023 |
1.0.11 | 640 | 3/26/2023 |
1.0.10 | 417 | 3/26/2023 |
1.0.9 | 394 | 3/24/2023 |
1.0.8 | 524 | 3/21/2023 |
1.0.7 | 357 | 3/17/2023 |
1.0.6 | 363 | 3/17/2023 |
1.0.5 | 231 | 3/17/2023 |
1.0.4 | 380 | 3/17/2023 |
1.0.3 | 726 | 3/16/2023 |