示例#1
0
def testPoscBytes(unit_database_posc):
    """
    Bytes, kBytes, MBytes, ....
    """
    q = ObtainQuantity("Byte")
    assert q.ConvertScalarValue(1024, "kByte") == 1
    assert q.ConvertScalarValue(1024 * 1024, "MByte") == 1
    assert q.ConvertScalarValue(1024 * 1024 * 1024, "GByte") == 1
    assert q.ConvertScalarValue(1024 * 1024 * 1024 * 1024, "TByte") == 1
示例#2
0
def testFluidGasConcentration(unit_database_posc):
    """
    Total Gas Unit requested for PWDA as concentration
    """
    q = ObtainQuantity("tgu")

    assert "dimensionless" == q.GetQuantityType()

    assert approx(abs(q.ConvertScalarValue(1, "ppm") - 333.33), 7) == 0
    assert approx(abs(q.ConvertScalarValue(1, "%") - 0.033333), 7) == 0
    assert approx(abs(q.ConvertScalarValue(1, "Euc") - 0.00033333), 7) == 0
示例#3
0
def testSpringDashpotUnits(unit_database_posc):
    """
    Units used to define Spring-Dashpot movements
    """

    q = ObtainQuantity("Ns/m")
    assert "force per velocity" == q.GetQuantityType()
    assert approx(abs(q.ConvertScalarValue(1, "lbf.s/ft") - 14.5939029372), 7) == 0

    q = ObtainQuantity("Nm/rad")
    assert "moment per angle" == q.GetQuantityType()
    assert approx(abs(q.ConvertScalarValue(1, "lbf.ft/dega") - 836.169044926), 7) == 0

    q = ObtainQuantity("Nms/rad")
    assert "moment per angular velocity" == q.GetQuantityType()
    assert approx(abs(q.ConvertScalarValue(1, "lbf.ft.s/dega") - 0.017453292519943), 7) == 0
示例#4
0
def testOhmUnits(unit_database_posc):
    q = ObtainQuantity("ohm/m")
    assert q.ConvertScalarValue(1, "ohm/km") == 1000
示例#5
0
def testPoscKVmm(unit_database_posc):
    """
    V/m to KV/mm (multiply by 1e6)
    """
    q = ObtainQuantity("V/m")
    assert q.ConvertScalarValue(1, "KV/mm") == 1e6