Click or drag to resize
UtilConvertUnits Method
Convert from one set of speed / temperature / pressure rain rate units to another

Namespace: ASCOM.Utilities
Assembly: ASCOM.Utilities (in ASCOM.Utilities.dll) Version: 6.0.0.0 (6.3.0.2839)
Syntax
public double ConvertUnits(
	double InputValue,
	Units FromUnits,
	Units ToUnits
)

Parameters

InputValue
Type: SystemDouble
Value to convert
FromUnits
Type: ASCOM.UtilitiesUnits
Integer value from the Units enum indicating the value's current units
ToUnits
Type: ASCOM.UtilitiesUnits
Integer value from the Units enum indicating the units to which the input value should be converted

Return Value

Type: Double
Input value expressed in the new units
Exceptions
ExceptionCondition
InvalidValueExceptionWhen the specified from and to units can not refer to the same value. e.g. attempting to convert miles per hour to degrees Celsius
Remarks

Conversions available:

  • metres per second <==> miles per hour <==> knots
  • Celsius <==> Farenheit <==> Kelvin
  • hecto Pascals (hPa) <==> milli bar(mbar) <==> mm of mercury <==> inches of mercury
  • mm per hour <==> inches per hour

Knots conversions use the international nautical mile definition (1 nautical mile = 1852m) rather than the orginal UK or US Admiralty definitions.

For convenience, milli bar and hecto Pascals are shown as separate units even though they have numerically identical values and there is a 1:1 conversion between them.

See Also