/******************************************************************/ public double SubUnitFactor(SiAcceleration_SubUnits SubUnit) { double factor = 1.0; switch (SubUnit) { case SiAcceleration_SubUnits.Meter_per_SecondSquare: factor = 1.0; break; case SiAcceleration_SubUnits.Eearth_G_Constant: factor = 100.0 / 981.0; break; } return(factor); }
/****************************************************************/ /******************************************************************/ public string SubUnitString(SiAcceleration_SubUnits SubUnit) { string sub_unit_name = ""; switch (SubUnit) { case SiAcceleration_SubUnits.Meter_per_SecondSquare: sub_unit_name = "m/s²"; break; case SiAcceleration_SubUnits.Eearth_G_Constant: sub_unit_name = "g"; break; } return(sub_unit_name); }
/****************** constructors ******************************/ /**@brief A constructor where the value unit's is specified. */ /**@param "x" The internal value is assigned to it. It is assumed x is accelerations */ /**@param "SubUnit" The units in wich 'x' is expressed. */ public SiAcceleration(double x, SiAcceleration_SubUnits SubUnit) { this.the_value = 0.0; this.the_value = x / SubUnitFactor(SubUnit); }
/**@brief Returns the value converted to the selected units. */ public double ToSubUnits(SiAcceleration_SubUnits SubUnit) { return(this.Value * SubUnitFactor(SubUnit)); }