def air_cleaning(self): for valve in self.valves_in_use_feeding: Context.control_box.open_valve(valve) Context.run_pump(Context.water_out1, duration=10) Context.control_box.close_valve(valve) lprint("Air_cleaning_done")
def general_priming(self): for valve in self.valves_in_use_feeding: Context.control_box.open_valve(valve) Context.run_pump(Context.water_in, duration=0.5) Context.run_pump(Context.water_out1, duration=4) Context.control_box.close_valve(valve) lprint("General_priming_done")
def priming(self, valves_in_use_feeding): # Open all valves for valve in valves_in_use_feeding: Context.control_box.open_valve(valve) # prime water In for _ in range(1): Context.check_water_sensor() Context.run_pump(Context.water_in, duration=0.5) # prime water Out for _ in range(1): Context.check_water_sensor() Context.run_pump(Context.water_out1, duration=3) Context.control_box.close_valve(valve) # # Close all valves # for valve in valves_in_use: # Context.control_box.close_valve(valve) lprint("pumps primed")
def stream(self): # stream water to fish tanks for i in range(2): Context.check_water_sensor() Context.run_pump(Context.water_out1, duration=1) # bring water and stream fishfeeder for _ in range(1): Context.check_water_sensor() Context.control_box.set_pwm(Context.water_in, 255) Context.control_box.set_pwm(Context.water_out1, 255) sleep(0.5) Context.control_box.set_pwm(Context.water_in, 0) Context.control_box.set_pwm(Context.water_out1, 0) Context.run_pump(Context.water_out1, duration=1) #for _ in range(1): #Context.check_water_sensor() #Context.run_pump(Context.water_in, duration=1) #for _ in range(1): #Context.check_water_sensor() #Context.run_pump(Context.water_out1, duration=2) lprint("food water mix streamed")
def clean(self): for _ in range(1): # bring clean water to fishfeeder Context.check_water_sensor() Context.run_pump(Context.water_in, duration=0.25) # thrash water from fishfeeder Context.check_water_sensor() Context.run_pump(Context.water_out1, duration=2) for _ in range(1): for _ in range(1): # bring clean water to fishfeeder Context.check_water_sensor() Context.run_pump(Context.water_in, duration=0.25) for _ in range(1): # thrash water from fishfeeder Context.check_water_sensor() Context.run_pump(Context.water_out1, duration=1) for _ in range(1): # bring clean water to fishfeeder Context.check_water_sensor() Context.run_pump(Context.water_in, duration=2) for _ in range(1): # thrash water from fishfeeder Context.check_water_sensor() Context.run_pump(Context.water_out1, duration=20) Context.STATUS = "Cleaned" lprint("tanks cleaned")
def demo_pumps(pumps, duration=0.5): ctx = Context() Context.initialize() ctx.run_pump(pumps, duration=duration)