Convert from one set of speed / temperature / pressure rain rate units to another
Namespace:
ASCOM.Utilities
Assembly:
ASCOM.Utilities (in ASCOM.Utilities.dll) Version: 3351c4f3fa64146a7efd5b51ed4591e32a0a5484
Syntaxpublic double ConvertUnits(
double InputValue,
Units FromUnits,
Units ToUnits
)
Public Function ConvertUnits (
InputValue As Double,
FromUnits As Units,
ToUnits As Units
) As Double
public:
virtual double ConvertUnits(
double InputValue,
Units FromUnits,
Units ToUnits
) sealed
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:
DoubleInput value expressed in the new units
Exceptions| Exception | Condition |
|---|
| InvalidValueException | When the specified from and to units can not refer to the same value. e.g. attempting to convert miles per hour to degrees Celsius |
RemarksConversions available:
- metres per second <==> miles per hour <==> knots
- Celsius <==> Fahrenheit <==> 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