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
public static class InputToUnitConverter
Methods
ConvertCurrentToUnit<TUnit>(Current, double, double)
Converts a Current measurement to a specified unit type using linear transformation.
View Source
public static TUnit ConvertCurrentToUnit<TUnit>(Current current, double scale, double offset) where TUnit : struct, IUnit
Returns
<TUnit>: The converted unit value
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.Current | current | The source current measurement in milliamps |
System.Double | scale | The scaling factor to apply to the conversion |
System.Double | offset | The offset value to add after scaling |
Type Parameters
| Name | Description |
|---|---|
TUnit | The 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
public static IUnit ConvertCurrentToUnit(Current current, string unitType, double scale, double offset)
Returns
Meadow.Units.IUnit: The converted unit value as an object
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.Current | current | The source current measurement in milliamps |
System.String | unitType | The name of the target unit type (case-insensitive) |
System.Double | scale | The scaling factor to apply to the conversion |
System.Double | offset | The 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
public static object ConvertCurrentToUnit(Current current, Type unitType, double scale, double offset)
Returns
System.Object: The converted unit value as an object
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.Current | current | The source current measurement in milliamps |
System.Type | unitType | The Type of the target unit |
System.Double | scale | The scaling factor to apply to the conversion |
System.Double | offset | The offset value to add after scaling |
Exceptions
System.NotSupportedException
Thrown when the specified unit Type is not supported for conversion