Skip to main content

Class InputToUnitConverter

Provides methods to convert electrical current measurements to various physical units using linear transformation (scale and offset).

Assembly: Meadow.Units.dll​
View Source​
Declaration
public static class InputToUnitConverter

Methods​

ConvertCurrentToUnit<TUnit>(Current, double, double)​

Converts a Current measurement to a specified unit type using linear transformation.

View Source​
Declaration
public static TUnit ConvertCurrentToUnit<TUnit>(Current current, double scale, double offset) where TUnit : struct, IUnit
Returns​

<TUnit>: The converted unit value

Parameters​
TypeNameDescription
Meadow.Units.CurrentcurrentThe source current measurement in milliamps
System.DoublescaleThe scaling factor to apply to the conversion
System.DoubleoffsetThe offset value to add after scaling
Type Parameters​
NameDescription
TUnitThe target unit type to convert to. Must implement IUnit.
Exceptions​

System.NotSupportedException
Thrown when the target unit type is not supported for conversion

ConvertCurrentToUnit(Current, string, double, double)​

Converts a Current measurement to a unit specified by string name using linear transformation.

View Source​
Declaration
public static IUnit ConvertCurrentToUnit(Current current, string unitType, double scale, double offset)
Returns​

Meadow.Units.IUnit: The converted unit value as an object

Parameters​
TypeNameDescription
Meadow.Units.CurrentcurrentThe source current measurement in milliamps
System.StringunitTypeThe name of the target unit type (case-insensitive)
System.DoublescaleThe scaling factor to apply to the conversion
System.DoubleoffsetThe offset value to add after scaling
Exceptions​

System.NotSupportedException
Thrown when the specified unit type name is not supported for conversion

ConvertCurrentToUnit(Current, Type, double, double)​

Converts a Current measurement to a unit specified by Type using linear transformation.

View Source​
Declaration
public static object ConvertCurrentToUnit(Current current, Type unitType, double scale, double offset)
Returns​

System.Object: The converted unit value as an object

Parameters​
TypeNameDescription
Meadow.Units.CurrentcurrentThe source current measurement in milliamps
System.TypeunitTypeThe Type of the target unit
System.DoublescaleThe scaling factor to apply to the conversion
System.DoubleoffsetThe offset value to add after scaling
Exceptions​

System.NotSupportedException
Thrown when the specified unit Type is not supported for conversion