Greet 2014
Documentation for the GREET 2014 API
 All Classes Namespaces Functions Variables Enumerations Properties Events
Greet.UnitLib2.Dimension Class Reference

Builds on DimensionUtils and IQuantity. It allows to store dimension as a single integer or as a quantity. Along with quantity it stores the index of the preferred unit from the Units list of IQUanitty. There are multiple states the class can be. Here Q = quantity is NOT null E = expression is NOT null P = preffered_unit is NOT -1 D = dim is NOT null More...

Public Member Functions

 Dimension (uint dim_, string expression_=null)
 
 Dimension (string q_name, int?preferred_unit_index=null)
 
Dimension Clone ()
 
double InPreferredUnitsD (double si_val)
 Performs unit conversion to the preferred units, if defined. More...
 
void InPreferredUnitsS (double val, out double display_val, out string display_expression)
 Performs conversion to preferred units (if defined) and returns a string. For example for quantity energy, if preferred units are Btu and val = 1500, then the function will return "1.42172568 Btu". If preferred units are not defined, it just returns "1500 J" More...
 
double InSIUnitsD (double val)
 Performs unit conversion to the SI units More...
 
string InSIUnitsS (double val)
 Performs conversion to SI units and returns a string. For example for quantity energy, if preferred units are Btu and val = 1.42172568 , then the function will return "1500 J". If preferred units are not defined, it just returns "1.42172568 J" More...
 
string PreferredUnit ()
 
String ToAttributeValue ()
 

Static Public Member Functions

static Dimension FromAttributeValue (string p)
 
static Dimension operator* (Dimension a, Dimension b)
 
static Dimension operator+ (Dimension a, Dimension b)
 
static Dimension operator- (Dimension a, Dimension b)
 
static Dimension operator/ (Dimension a, Dimension b)
 

Properties

uint Dim [get, set]
 Returns the dimensions of the Quantity. If quantity is not defined, returns value of dim attribute of the object, throws DimensionStateException otherwise More...
 
string PreferedExpression [get]
 Formula that represents the dimensions of the value, i.e. "lb/gal" for mass density More...
 
int Preffered_unit_id [get, set]
 Stores index of the Unit object from Quantity.Units list. Makes sense only if Quantity is not null. If preferred unit is not defined for this object, returns preferred unit of associated Quantity When quantity is not defined, returns -1 More...
 
string pu_expression [get, set]
 
string QuantityName [get]
 Quantity associated with the value. Can be null! More...
 

Detailed Description

Builds on DimensionUtils and IQuantity. It allows to store dimension as a single integer or as a quantity. Along with quantity it stores the index of the preferred unit from the Units list of IQUanitty. There are multiple states the class can be. Here Q = quantity is NOT null E = expression is NOT null P = preffered_unit is NOT -1 D = dim is NOT null

Q&D = 0; E&P = 0; D&P = 0 Here are passable states When Q=1, user can convert the value between SI units and those defined for the quantity When E=1, user can convert the value between SI units and those defined by expression, provided that units in expression are defined in database, i.e. for expression "Btu/lb" both Btu and lb must be associated with a quantity. When P=1, the user can specify preferred units to be used in GUI/Reports When D=1, the quantity is defined by base base SI dimensions as in DimensionUtils. To be used when the quantity is not defined in the database, or looking up in database has performance implications.

| Q | E | P | D |

| 1 | 0 | 1 | 0 | | 1 | 0 | 0 | 0 | | 1 | 1 | 0 | 0 | | 0 | 0 | 0 | 1 | | 0 | 1 | 0 | 1 |

Constructor & Destructor Documentation

Greet.UnitLib2.Dimension.Dimension ( string  q_name,
int?  preferred_unit_index = null 
)

Parameters
q_nameCannot be null nor empty, ArgumentException will be thrown otherwise
preferred_unit_indexHas to be null or less then the length of Quantity.Units, DimensionStateException will be thrown otherwise

Member Function Documentation

double Greet.UnitLib2.Dimension.InPreferredUnitsD ( double  si_val)

Performs unit conversion to the preferred units, if defined.

Parameters
si_valThe value in SI units
Returns
The value in preferred units
void Greet.UnitLib2.Dimension.InPreferredUnitsS ( double  val,
out double  display_val,
out string  display_expression 
)

Performs conversion to preferred units (if defined) and returns a string. For example for quantity energy, if preferred units are Btu and val = 1500, then the function will return "1.42172568 Btu". If preferred units are not defined, it just returns "1500 J"

Parameters
valThe value in SI units
Returns
The value in preferred units and unit expression in a single string
double Greet.UnitLib2.Dimension.InSIUnitsD ( double  val)

Performs unit conversion to the SI units

Parameters
valThe value in prefered units units
Returns
The value in SI units
string Greet.UnitLib2.Dimension.InSIUnitsS ( double  val)

Performs conversion to SI units and returns a string. For example for quantity energy, if preferred units are Btu and val = 1.42172568 , then the function will return "1500 J". If preferred units are not defined, it just returns "1.42172568 J"

Parameters
valThe value in SI units
Returns
The value in preferred units and unit expression in a single string

Property Documentation

uint Greet.UnitLib2.Dimension.Dim
getset

Returns the dimensions of the Quantity. If quantity is not defined, returns value of dim attribute of the object, throws DimensionStateException otherwise

string Greet.UnitLib2.Dimension.PreferedExpression
get

Formula that represents the dimensions of the value, i.e. "lb/gal" for mass density

int Greet.UnitLib2.Dimension.Preffered_unit_id
getset

Stores index of the Unit object from Quantity.Units list. Makes sense only if Quantity is not null. If preferred unit is not defined for this object, returns preferred unit of associated Quantity When quantity is not defined, returns -1

string Greet.UnitLib2.Dimension.QuantityName
get

Quantity associated with the value. Can be null!


The documentation for this class was generated from the following file: