C# Class GSF.Units.SI

Defines constant factors for SI units of measure to handle metric conversions.
Datei anzeigen Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
ToScaledString ( double totalUnits, int decimalPlaces, string unitName, string symbolNames = null, double minimumFactor = SI.Yocto, double maximumFactor = SI.Yotta ) : string

Turns the given number of units into a textual representation with an appropriate unit scaling.

The symbolNames array needs one string entry for each defined SI item ordered from least (Yocto) to greatest (Yotta), see Names or Symbols arrays for examples.

ToScaledString ( double totalUnits, string unitName, string symbolNames = null, double minimumFactor = SI.Yocto, double maximumFactor = SI.Yotta ) : string

Turns the given number of units into a textual representation with an appropriate unit scaling.

The symbolNames array needs one string entry for each defined SI item ordered from least (Yocto) to greatest (Yotta), see Names or Symbols arrays for examples.

ToScaledString ( double totalUnits, string format, string unitName, string symbolNames, int decimalPlaces = -1, double minimumFactor = SI.Yocto, double maximumFactor = SI.Yotta ) : string

Turns the given number of units into a textual representation with an appropriate unit scaling given string array of factor names or symbols.

The symbolNames array needs one string entry for each defined SI item ordered from least (Yocto) to greatest (Yotta), see Names or Symbols arrays for examples.

Private Methods

Method Description
GetFactorIndex ( double factor ) : int

Method Details

ToScaledString() public static method

Turns the given number of units into a textual representation with an appropriate unit scaling.
The symbolNames array needs one string entry for each defined SI item ordered from least (Yocto) to greatest (Yotta), see Names or Symbols arrays for examples.
cannot be negative. or is not defined in array.
public static ToScaledString ( double totalUnits, int decimalPlaces, string unitName, string symbolNames = null, double minimumFactor = SI.Yocto, double maximumFactor = SI.Yotta ) : string
totalUnits double Total units to represent textually.
decimalPlaces int Number of decimal places to display.
unitName string Name of unit display (e.g., you could use "m/h" for meters per hour).
symbolNames string Optional SI factor symbol or name array to use during textual conversion, defaults to .
minimumFactor double Optional minimum SI factor. Defaults to .
maximumFactor double Optional maximum SI factor. Defaults to .
return string

ToScaledString() public static method

Turns the given number of units into a textual representation with an appropriate unit scaling.
The symbolNames array needs one string entry for each defined SI item ordered from least (Yocto) to greatest (Yotta), see Names or Symbols arrays for examples.
or is not defined in array.
public static ToScaledString ( double totalUnits, string unitName, string symbolNames = null, double minimumFactor = SI.Yocto, double maximumFactor = SI.Yotta ) : string
totalUnits double Total units to represent textually.
unitName string Name of unit display (e.g., you could use "m/h" for meters per hour).
symbolNames string Optional SI factor symbol or name array to use during textual conversion, defaults to .
minimumFactor double Optional minimum SI factor. Defaults to .
maximumFactor double Optional maximum SI factor. Defaults to .
return string

ToScaledString() public static method

Turns the given number of units into a textual representation with an appropriate unit scaling given string array of factor names or symbols.
The symbolNames array needs one string entry for each defined SI item ordered from least (Yocto) to greatest (Yotta), see Names or Symbols arrays for examples.
or is not defined in array.
public static ToScaledString ( double totalUnits, string format, string unitName, string symbolNames, int decimalPlaces = -1, double minimumFactor = SI.Yocto, double maximumFactor = SI.Yotta ) : string
totalUnits double Total units to represent textually.
format string A numeric string format for scaled .
unitName string Name of unit display (e.g., you could use "m/h" for meters per hour).
symbolNames string SI factor symbol or name array to use during textual conversion.
decimalPlaces int Optional number of decimal places to display.
minimumFactor double Optional minimum SI factor. Defaults to .
maximumFactor double Optional maximum SI factor. Defaults to .
return string