def BMEP(bhp, rpm, disp, power_units=default_power_units, vol_units=default_vol_units, press_units=default_press_units): """ Return brake mean effective pressure, given brake power, rpm and displacement. Rpm is revolutions per minute. """ bhp = U.power_conv(bhp, power_units, 'hp') disp = U.vol_conv(disp, vol_units, 'in**3') bmep = 2 * bhp * 33000. * 12 / (rpm * disp) return bmep
def BMEP(bhp, rpm, disp, power_units=default_power_units, vol_units=default_vol_units, press_units=default_press_units): """ Return brake mean effective pressure, given brake power, rpm and displacement. Rpm is revolutions per minute. Example: >>> BMEP(200, 2700, 360, vol_units="in**3") 162.96296296296296 """ bhp = U.power_conv(bhp, power_units, 'hp') disp = U.vol_conv(disp, vol_units, 'in**3') bmep = 2 * bhp * 33000. * 12 / (rpm * disp) return bmep
def test_08(self): Value = U.vol_conv(1, to_units='l', from_units='ImpGal') Truth = 4.54609 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_02(self): Value = U.vol_conv(1, to_units='m**3', from_units='in**3') Truth = (0.3048 / 12)**3 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_08(self): Value = U.vol_conv(1, to_units='l', from_units='ImpGal') Truth = 4.54609 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_06(self): Value = U.vol_conv(1, to_units='USG', from_units='nm**3') Truth = 7.4805195 * (1852. / 0.3048) ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_04(self): Value = U.vol_conv(1, to_units='sm**3', from_units='km**3') Truth = ((1000 / 0.3048) / 5280) ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_02(self): Value = U.vol_conv(1, to_units='m**3', from_units='in**3') Truth = (0.3048 / 12) ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_01(self): Value = U.vol_conv(1, from_units='ft**3', to_units='in**3') Truth = 12**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_09(self): Value = U.vol_conv(1, from_units='l', to_units='ft**3') Truth = (0.1 / 0.3048)**3 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_08(self): Value = U.vol_conv(1, to_units='l', from_units='ImpGal') Truth = 4.54609 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_07(self): Value = U.vol_conv(1, from_units='USG', to_units='ImpGal') Truth = 0.83267418 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_05(self): Value = U.vol_conv(1, from_units='sm**3', to_units='nm**3') Truth = (5280 / (1852. / 0.3048))**3 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_04(self): Value = U.vol_conv(1, to_units='sm**3', from_units='km**3') Truth = ((1000 / 0.3048) / 5280)**3 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_03(self): Value = U.vol_conv(1, from_units='m**3', to_units='km**3') Truth = 0.001**3 self.assertTrue(RE(Value, Truth) <= 1e-8)
def test_09(self): Value = U.vol_conv(1, from_units='l', to_units='ft**3') Truth = (0.1 / 0.3048)**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_01(self): Value = U.vol_conv(1, from_units='ft**3', to_units='in**3') Truth = 12 ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_02(self): Value = U.vol_conv(1, to_units='m**3', from_units='in**3') Truth = (0.3048 / 12)**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_03(self): Value = U.vol_conv(1, from_units='m**3', to_units='km**3') Truth = 0.001 ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_03(self): Value = U.vol_conv(1, from_units='m**3', to_units='km**3') Truth = 0.001**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_05(self): Value = U.vol_conv(1, from_units='sm**3', to_units='nm**3') Truth = (5280 / (1852. / 0.3048)) ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_04(self): Value = U.vol_conv(1, to_units='sm**3', from_units='km**3') Truth = ((1000 / 0.3048) / 5280)**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_07(self): Value = U.vol_conv(1, from_units='USG', to_units='ImpGal') Truth = 0.83267418 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_05(self): Value = U.vol_conv(1, from_units='sm**3', to_units='nm**3') Truth = (5280 / (1852. / 0.3048))**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_09(self): Value = U.vol_conv(1, from_units='l', to_units='ft**3') Truth = (0.1 / 0.3048) ** 3 self.failUnless(RE(Value, Truth) <= 1e-8)
def test_06(self): Value = U.vol_conv(1, to_units='USG', from_units='nm**3') Truth = 7.4805195 * (1852. / 0.3048)**3 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_07(self): Value = U.vol_conv(1, from_units='USG', to_units='ImpGal') Truth = 0.83267418 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_01(self): Value = U.vol_conv(1, from_units='ft**3', to_units='in**3') Truth = 12**3 self.assertTrue(RE(Value, Truth) <= 1e-8)