PQ Class
A dimensioned quantity expressing the result of measuring

Inheritance Hierarchy

OnlineSystem Object
  MARC.Everest.DataTypes HXIT
    MARC.Everest.DataTypes ANY
      MARC.Everest.DataTypes PDV <OnlineNullable <OnlineDecimal > >
        MARC.Everest.DataTypes QTY <OnlineNullable <OnlineDecimal > >
          MARC.Everest.DataTypes PQ

Namespace: MARC.Everest.DataTypes
Assembly: MARC.Everest.Phone (in MARC.Everest.Phone.dll) Version: (1.5.0)



public class PQ : QTY<Nullable<decimal>>, 
	IEquatable<PQ>, IComparable<PQ>, IPqTranslatable<PQ>, 
	IPqScalar<PQ>, IDistanceable<PQ>, IImplicitInterval<PQ>


A physical quantity is used primarily for the storage of decimal values with UCUM (Onlinehttp://unitsofmeasure.org/) units describing their unit of measure.

Conversion of Units

The PQ type only contains builtin support for the conversion of time units (min, mo, s, hr, etc...). However the PQ type can utilize unit converters via IUnitConverter instances attached to the UnitConverters array. A default implementation exists for SI units called SimpleSiUnitConverter.



PQ.UnitConverters.Add(new SimpleSiUnitConverter());
PQ length = new PQ(1, "km");
length -= new PQ(1, "m");
// results in  
// length = 0.999 km

PQ with Time

The physical quantity class contained within the Everest Framework contains several useful functions for the handling of date values and the addition of time spans with time stamps (TS + PQ). The calculation these provisioned quantities is derived from the OnlineTimeSpan class. To calculate these Quantites, the PQ datatype will take the system ticks (100 nanosecond units) and convert them using the following unit conversion table (where S is 1 second or 0x989680 ticks)

UCUM MeasureTicks / Notes
us (Microseconds)0xA = S / 1,000,000
ms (Milliseconds)0x2710 = S / 1,000
s (Seconds)0x989680 = S
ks (Killoseconds)0x2540be400 = S * 1,000 : used when attempting to reduce extremely large second values from cast operators (approx 3 hr)
Ms (Megaseconds)0x9184e72a000 = S * 1,000,000 : used when attempting to reduce extremely large killosecond values from cast operators (approx 2 mo)
Gs (Gigaseconds)0x2386f26fc1000 = S * 1,000,000,000 : used when attempting to reduce extremely large megasecond values from cast operators (approx 31 a)
min (Minutes)0x23c34600 = S * 60
hr (Hours)0x861c46800 = S * 3,600
d (Days)0xc92a69c000 = S * 3,600 * 24
wk (Weeks)0x58028e44000 = S * 3,600 * 24 * 7
mo (Months)0x17e6ca109000 = S * 3,600 * 24 * 30.416 : since month duration vaires, and since given just a timespan it is impossible to calculate which months were used to get the PQ, we take 365 / 12 to be the length of a month
a (Annum)0x11ed178C6C000 = S * 3,600 * 24 * 365

Version Information

Everest Compact Framework

Supported in: 1.2 Compact

Everest Framework

Supported in: 1.2, 1.0

See Also