def get_hot_start(): """ @return: Recipe for hot start @rtype: Recipe """ new = Recipe() new.buffer = tpid_hot_start.buffer.copy() return new
def get_cool_start(): """ @return: long recipe's buffer list @rtype: list[str] """ new = Recipe() new.buffer = tpid_cool_start.buffer.copy() return new
def test_print_steps(self): r = Recipe() self.make_recipe1(r) buf = StringIO() r.print_steps(buf) result1 = buf.getvalue() r2 = LongRecipe() self.make_recipe1(r2) del buf buf = StringIO() r2.print_steps(buf) result2 = buf.getvalue() expected = """ Set "foo" to 5 Wait 45 seconds Set "temppv" to 16 Wait until "barbaz" != bazbar """ self.assertEqual(expected, result1) self.assertEqual(expected, result2)
def full_test_with_pumps(pgain, itime, dtime=0, sp=37, start_temp=FULL_TEST_START_TEMP): """ Make the body of a recipe for a single off-to-auto-to-auto temp PID test, using addition pump A connected to the sample line to pump warm water out of the reactor, and media pump to pump water into the reactor. These pump steps occur at the end of an otherwise standard Temp PID test recipe to cool the liquid far faster than otherwise possible. @param pgain: pgain @type pgain: float | int @param itime: itime @type itime: float | int @param dtime: dtime @type dtime: float | int @param sp: temp setpoint @type sp: float | int @return: Recipe @rtype: Recipe """ recipe = Recipe() # set max level high (with pumps off!) to ensure # that level max interlock doesn't randomly shut heater off. recipe.set("LevelMax(L)", 5) recipe.set("TempHeatDutyControl.PGain(min)", pgain) recipe.set("TempHeatDutyControl.ITime(min)", itime) recipe.set("TempHeatDutyControl.DTime(min)", dtime) # Off to Auto Start recipe.set("TempSP(C)", sp) recipe.wait(5) recipe.set("TempModeUser", "Auto") recipe.waituntil('TempPV(C)', ">=", sp) recipe.wait(3600) # Auto to Auto Start recipe.set("TempSP(C)", sp + 2) recipe.waituntil("TempPV(C)", ">=", sp + 2) recipe.wait(3600) # Full test end' recipe.set("TempModeUser", "Off") # Max level will interlock pumps if level gets high # Otherwise, drain and fill simultaneously until # temp reaches target, then fill until full, then # turn final pump off. recipe.set("LevelMax(L)", 3) recipe.set("Pumps&ValvesPumpUser1", "100%") recipe.wait_until("LevelPV(L)", "<=", 2.5) recipe.set("Pumps&ValvesFillSpeed(RPM)", 500) recipe.wait_until("TempPV(C)", "<=", start_temp) recipe.set("Pumps&ValvesPumpUser1", "Off") recipe.wait_until("LevelPV(L)", ">=", 2.95) recipe.set("Pumps&ValvesFillSpeed(RPM)", 0) return recipe
def make_full_test_body(pgain, itime, dtime=0, sp=37, start_temp=FULL_TEST_START_TEMP): """ @param pgain: pgain @type pgain: float | int @param itime: itime @type itime: float | int @param dtime: dtime @type dtime: float | int @param sp: temp setpoint @type sp: float | int @return: Recipe @rtype: Recipe """ recipe = Recipe() recipe.set("TempHeatDutyControl.PGain(min)", pgain) recipe.set("TempHeatDutyControl.ITime(min)", itime) recipe.set("TempHeatDutyControl.DTime(min)", dtime) recipe.set("TempSP(C)", sp) recipe.wait(5) recipe.set("TempModeUser", "Auto") recipe.waituntil('TempPV(C)', ">=", sp) recipe.wait(3600) recipe.set("TempSP(C)", sp + 2) recipe.wait(5) recipe.waituntil("TempPV(C)", ">=", sp + 2) recipe.wait(3600) recipe.set("TempModeUser", "Off") recipe.wait(5) recipe.waituntil("TempPV(C)", "<=", start_temp) return recipe
def make_auto2auto(pgain, itime, dtime): recipe = Recipe() recipe.set("TempHeatDutyControl.PGain(min)", pgain) recipe.set("TempHeatDutyControl.ITime(min)", itime) recipe.set("TempHeatDutyControl.DTime(min)", dtime) recipe.set("TempSP(C)", 39) recipe.waituntil('TempPV(C)', ">=", 39) recipe.wait(1200) recipe.set("TempSP(C)", 37) recipe.waituntil("TempPV(C)", "<=", 37) recipe.wait(1200) return recipe
""" Created by: Nathan Starkweather Created on: 02/13/2014 Created in: PyCharm Community Edition """ from pbslib.recipemaker import Recipe, LongRecipe, save_recipe FULL_TEST_START_TEMP = 28 tpid_cool_start = Recipe() tpid_cool_start.set("TempModeUser", "Off") tpid_cool_start.wait(5) tpid_cool_start.set("TempSP(C)", FULL_TEST_START_TEMP + 2) tpid_cool_start.wait(5) tpid_cool_start.set("TempModeUser", "Auto") tpid_cool_start.wait(5) tpid_cool_start.waituntil("TempPV(C)", ">", FULL_TEST_START_TEMP) tpid_cool_start.set("TempModeUser", "Off") tpid_cool_start.wait(60) tpid_cool_start.waituntil("TempPV(C)", "<=", FULL_TEST_START_TEMP) COOL_START_STEPS = len(tpid_cool_start) tpid_hot_start = Recipe() tpid_hot_start.set("TempModeUser", "Off") tpid_hot_start.set("LevelMax(L)", 3) tpid_hot_start.set("Pumps&ValvesPumpUser1", "100%")