Click or drag to resize

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

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.

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

Parameters

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

Return Value

Type: 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