Exemple #1
0
 def getDisplayUnit(self):
     """get unit tuple (displUnit, displayString)
     """
     displUnit = None
     displayString = None
     if self.inptype == u"cnt":
         if self.displUnitVelocity is not None:
             displUnit = convertUnit(self.displUnitVelocity)
             displayString = str(self.displUnitVelocity)
     elif self.inptype == u"gauge":
         if self.displUnitAbs is not None:
             displUnit = convertUnit(self.displUnitAbs)
             displayString = str(self.displUnitAbs)
     else:
         if self.displUnitVelocity is not None:
             displUnit = convertUnit(self.displUnitVelocity)
             displayString = str(self.displUnitVelocity)
     return (displUnit, displayString)
Exemple #2
0
 def ensureC3(obj_snmp):
     """The input quantity and the display unit must
     have the same dimension
     """
     convPQinpQuantity = convertQuantity(obj_snmp.inpQuantity)
     convPUdisplUnitAbs = convertUnit(obj_snmp.displUnitAbs)
     physFactor = convPUdisplUnitAbs / convPQinpQuantity
     if not physFactor.dimensionless():
         raise Invalid("The input quantity '%s' and the "\
                       "display unit '%s'"\
                       " must have the same dimension" \
                       % (convPQinpQuantity, convPUdisplUnitAbs))
Exemple #3
0
 def ensureC4(obj_snmp):
     """The input quantity and the display unit (velocity) * s
     must have the same dimension
     """
     if obj_snmp.displUnitVelocity:
         convPQinpQuantity = convertQuantity(obj_snmp.inpQuantity)
         convPUdisplUnitVelocity = convertUnit(obj_snmp.displUnitVelocity)
         physFactor = convPUdisplUnitVelocity \
                    / convPQinpQuantity \
                    * physq(1.0, "s")
         if not physFactor.dimensionless():
             raise Invalid("The input quantity '%s' and the "\
                           "display unit (velocity) '%s' * s"\
                           " must have the same dimension" \
                           % (convPQinpQuantity, convPUdisplUnitVelocity))
Exemple #4
0
 def ensureC5(obj_snmp):
     """The input quantity and the display unit (acceleration) * s * s
     must have the same dimension
     """
     if obj_snmp.displUnitAcceleration:
         convPQinpQuantity = convertQuantity(obj_snmp.inpQuantity)
         convPUdisplUnitAcceleration = convertUnit(\
             obj_snmp.displUnitAcceleration)
         physFactor = convPUdisplUnitAcceleration \
                    / convPQinpQuantity \
                    * physq(1.0, "s2")
         if not physFactor.dimensionless():
             raise Invalid("The input quantity '%s' and the "\
                           "display unit (acceleration) '%s' * s * s"\
                           " must have the same dimension" \
                           % (convPQinpQuantity,
                              convPUdisplUnitAcceleration))
Exemple #5
0
 def getPUdisplUnitAcceleration(self):
     return convertUnit(self.displUnitAcceleration)
Exemple #6
0
 def getPUdisplUnitVelocity(self):
     return convertUnit(self.displUnitVelocity)
Exemple #7
0
 def getPUdisplUnitAbs(self):
     return convertUnit(self.displUnitAbs)