UtilUnitConversionFactors(eumQuantity, eumQuantity, Double, Double, Boolean, Boolean) Method

Calculate scale factor and offset for converting between eum units.

In case of success, the factor and offset contains the conversion values, that will convert from source to target using target = source*factor + offset

The method will fail 1) if one of the units are undefined and undefinedAsSI is not set, or 2) if the units are not equivalent and unitsMustBeEquivalent is set. On failure, default values are used (scale is 1 and offset is 0). and false is returned

It can handle units that are not equivalent, i.e. if the target is kg/m3 and the source is g/s, and there is some processing (in proper units) between the target and the source, the conversion will take care of the factor 1000 here.

Definition

Namespace: DHI.Mike1D.Generic
Assembly: DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public static bool UnitConversionFactors(
	eumQuantity target,
	eumQuantity source,
	out double factor,
	out double offset,
	bool unitsMustBeEquivalent,
	bool undefinedAsSI
)

Parameters

target  eumQuantity
Target unit
source  eumQuantity
Source unit
factor  Double
Factor in conversion
offset  Double
Offset in conversion
unitsMustBeEquivalent  Boolean
Flag specifying whether to calculate scale and offset even though units are not equivalent
undefinedAsSI  Boolean
Treat undefined value as SI.

Return Value

Boolean

[Missing <returns> documentation for "M:DHI.Mike1D.Generic.Util.UnitConversionFactors(DHI.Generic.MikeZero.eumQuantity,DHI.Generic.MikeZero.eumQuantity,System.Double@,System.Double@,System.Boolean,System.Boolean)"]

See Also