OSDC.UnitConversion.Conversion
3.3.28
See the version list below for details.
dotnet add package OSDC.UnitConversion.Conversion --version 3.3.28
NuGet\Install-Package OSDC.UnitConversion.Conversion -Version 3.3.28
<PackageReference Include="OSDC.UnitConversion.Conversion" Version="3.3.28" />
<PackageVersion Include="OSDC.UnitConversion.Conversion" Version="3.3.28" />
<PackageReference Include="OSDC.UnitConversion.Conversion" />
paket add OSDC.UnitConversion.Conversion --version 3.3.28
#r "nuget: OSDC.UnitConversion.Conversion, 3.3.28"
#:package OSDC.UnitConversion.Conversion@3.3.28
#addin nuget:?package=OSDC.UnitConversion.Conversion&version=3.3.28
#tool nuget:?package=OSDC.UnitConversion.Conversion&version=3.3.28
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
Gravity potential
GravityPotentialQuantity describes gravity potential with dimensions L² T⁻² and no application-specific meaningful precision. EarthGravityPotentialQuantity inherits its units and defines MeaningfulPrecisionInSI = 0.01 m²/s² for terrestrial presentation. This is approximately a millimetre of height difference near Earth's surface, not a claim of model accuracy or a rounding of stored values.
Both expose explanatory DescriptionMD text covering the geodetic convention W = V + Phi, g = grad W, reference-potential considerations, and the distinction from energy density. Supported units are m²/s², J/kg, ft²/s² and ft·lbf/lbm. Factors are formulas built from existing base factors: 1.0/(Factors.Foot*Factors.Foot) and Factors.Pound/(Factors.Foot*Factors.PoundForce) convert from SI. One ft·lbf/lbm is 2.98906692 J/kg; pound-force uses standard gravity, not local gravity.
When adding quantities, follow the generator workflow. It writes Constructors.cs, Factors.cs and the enumeration files; regenerate before adding enum-based defaults to unit systems.
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.12.0-1.final)
NuGet packages (3)
Showing the top 3 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 |
|
|
NORCE.Drilling.DrillingFluid.WebPages
Reusable Razor class library containing the DrillingFluid web pages and related components. See the package README for setup, dependencies, and usage. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.4.5 | 814 | 9/28/2026 |
| 3.4.3 | 168 | 9/27/2026 |
| 3.4.2 | 229 | 9/25/2026 |
| 3.4.1 | 900 | 8/31/2026 |
| 3.4.0 | 153 | 8/31/2026 |
| 3.3.28 | 66 | 9/25/2026 |
| 3.3.25 | 6,594 | 1/15/2026 |
| 3.3.24 | 532 | 10/13/2025 |
| 3.3.23 | 204 | 10/13/2025 |
| 3.3.22 | 202 | 10/13/2025 |
| 3.3.21 | 1,366 | 8/22/2025 |
| 3.3.20 | 285 | 8/21/2025 |
| 3.3.19 | 579 | 6/3/2025 |
| 3.3.18 | 242 | 6/3/2025 |
| 3.3.17 | 1,376 | 5/31/2025 |
| 3.3.16 | 270 | 5/30/2025 |
| 3.3.15 | 1,553 | 2/10/2025 |
| 3.3.14 | 233 | 2/9/2025 |
| 3.3.13 | 179 | 2/8/2025 |
| 3.3.12 | 3,382 | 8/30/2024 |