コード例 #1
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_checkPumpsNoOverlap():
    """
    Test that recipe and stages has to match
    """
    sa = {"1s": {"hotWaterPump": {"active": True, "targetValue": 1}}}
    a = checker.equipment(mediumCtrl(), sa)
    assert a.check()

    sb = {"1s": {"wortPump": {"active": True, "targetValue": 1}}}
    b = checker.equipment(mediumCtrl(), sb)
    assert b.check()

    sc = {"1s": {"circulationPump": {"active": True, "targetValue": 1}}}
    c = checker.equipment(mediumCtrl(), sc)
    assert c.check()

    sd = {"1s": {"hotWaterPump": {"active": True, "targetValue": 1}, "wortPump": {"active": True, "targetValue": 1}}}
    d = checker.equipment(mediumCtrl(), sd)
    assert not d.check()

    se = {
        "1s": {
            "hotWaterPump": {"active": True, "targetValue": 1},
            "circulationPump": {"active": True, "targetValue": 1},
        }
    }
    e = checker.equipment(mediumCtrl(), se)
    assert not e.check()

    printMyname()
コード例 #2
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_instantiate():
    """
    Slightly silly test but a minimum to start with
    """
    a = checker.equipment()
    assert a is not None
    b = checker.equipment(simpleCtrl(), simpleDict())
    assert b is not None
    printMyname()
コード例 #3
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_check_checkRecipeVsController():
    """
    Test that recipe and stages has to match
    """
    a = checker.equipment(simpleCtrl(), {})
    assert a.check()
    b = checker.equipment(simpleCtrl(), simpleDict())
    assert b.check()
    c = checker.equipment(simpleCtrl(), simpleBadDict())
    assert not c.check()
    printMyname()
コード例 #4
0
ファイル: threadscan.py プロジェクト: cloudymike/hopitty
def updateRecipes(rl, bsmxfile):
    """
    Update Recipe list by removing all recipes that does not work.
    This is checked by doing a check against recipe and equipment
    """
    rl.readBeerSmith(bsmxfile)
    iterlist = rl.getlist()
    deleteList = []
    for recipeName in iterlist:
        recipeObjBsmx = rl.getRecipe(recipeName)
        recipeBSMX = recipeObjBsmx.getBSMXstring()
        recipeObjParsed = recipeReader.bsmxStages(recipeBSMX, controllers)
        if not recipeObjParsed.isValid():
            deleteList.append(recipeName)
            logging.info("**********Fail on parseBSMX:" + recipeName)
        else:
            ce = checker.equipment(controllers, recipeObjParsed.getStages())
            if not ce.check():
                deleteList.append(recipeName)
                logging.info("**********Fail on equipment check:" + recipeName)
    for deleteName in deleteList:
        logging.info("deleting" + deleteName)
        rl.deleteRecipe(deleteName)

    #rl.nameListToMemcache()
    return(rl)
コード例 #5
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_template():
    """
    Test template
    """
    sa = {"1s": {"waterHeater": {"active": True, "targetValue": 165}}}
    a = checker.equipment(mediumCtrl(), sa)
    assert a._equipment__checkBoilerAndWaterHeater()
    printMyname()
コード例 #6
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_checkBoilerAndWaterHeater():
    """
    Test that boiler and water heater is not on at the same time
    For initial equipment that would use too much electrical power
    """
    sa = {"1s": {"waterHeater": {"active": True, "targetValue": 165}}}
    a = checker.equipment(mediumCtrl(), sa)
    assert a.check()

    sb = {"1s": {"boiler": {"active": True, "targetValue": 165}}}
    b = checker.equipment(mediumCtrl(), sb)
    assert b.check()

    sc = {"1s": {"waterHeater": {"active": True, "targetValue": 165}, "boiler": {"active": True, "targetValue": 165}}}
    c = checker.equipment(mediumCtrl(), sc)
    assert not c.check()

    printMyname()
コード例 #7
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_checkBoilVolume():
    a = checker.equipment(simpleCtrl(), simpleDict())
    assert a.check()

    s1 = {"1s": {"wortPump": {"active": True, "targetValue": 1.0}}}
    b = checker.equipment(mediumCtrl(), s1)
    assert b.check()

    c = checker.equipment(mediumCtrl(), s1)
    c.updateEquipmentItem("boilerVolumeMax", 0.5)
    assert not c.check()

    s2 = {
        "1": {"wortPump": {"active": True, "targetValue": 1.0}},
        "2": {"wortPump": {"active": True, "targetValue": 1.0}},
    }
    d = checker.equipment(mediumCtrl(), s2)
    assert d.check()

    e = checker.equipment(mediumCtrl(), s2)
    e.updateEquipmentItem("boilerVolumeMax", 1.5)
    assert not e.check()
    printMyname()
コード例 #8
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_checkHotwaterHeaterVolume():
    a = checker.equipment(simpleCtrl(), simpleDict())
    assert a.check()

    s = {"1s": {"hotWaterPump": {"active": True, "targetValue": 1.0}}}
    b = checker.equipment(mediumCtrl(), s)
    assert b.check()

    c = checker.equipment(mediumCtrl(), s)
    c.updateEquipmentItem("maxInfusionVol", 0.5)
    assert c.check()

    s2 = {
        "1hw": {
            "hotWaterPump": {"active": True, "targetValue": 1.0},
            "waterHeater": {"active": True, "targetValue": 165},
        }
    }
    c2 = checker.equipment(mediumCtrl(), s2)
    c2.updateEquipmentItem("maxInfusionVol", 0.5)
    assert not c2.check()

    printMyname()
コード例 #9
0
ファイル: test_eqchk.py プロジェクト: cloudymike/hopitty
def test_checkHotwaterVolume():
    a = checker.equipment(simpleCtrl(), simpleDict())
    assert a.check()

    s = {"1s": {"hotWaterPump": {"active": True, "targetValue": 1.0}}}
    b = checker.equipment(mediumCtrl(), s)
    assert b.check()

    c = checker.equipment(mediumCtrl(), s)
    c.updateEquipmentItem("maxTotalInVol", 0.5)
    assert not c.check()

    t = {
        "1": {"hotWaterPump": {"active": True, "targetValue": 1.0}},
        "2": {"hotWaterPump": {"active": True, "targetValue": 1.0}},
    }
    d = checker.equipment(mediumCtrl(), t)
    assert d.check()

    e = checker.equipment(mediumCtrl(), t)
    e.updateEquipmentItem("maxTotalInVol", 1.5)
    assert not e.check()
    printMyname()