I am thinking of ways to implement a morbidostat-like mode; essentially there are two inputs to a vial, one regular media, and one regular media + drug. To avoid the efflux line sucking up the drug before it gets a chance of mixing up well I was thinking it might be a good idea to pump media in, wait a few seconds and then pump media out. Is there a way to do that without adding a time.sleep(2)
in the custom script, which might mess up things? @cmancuso suggested doing the influx at once and then divide the efflux into repeated small chunks using the times_to_repeat
parameter. Any other ideas?
Another idea is adding more functionality to the Arduino code. You can add a morbidostat specific program, similar to the way we have a mode for turbidostat and a mode for chemostat. The way you send commands could be very similar to what typically happens, but instead it might get sent to a queue with a timer tagged on it.
See the Arduino code on Github, for adding extra “fluid mode”:
// Update all the pumps
for (int i = 0; i < numPumps; i++) {
if (fluid_mode == "o") {
pumps[i].turnOff();
}
else {
pumps[i].update();
}
}
It really depends on how much more functionalities you might need. For example, if you plan on utilizing some millifluidic devices, might make more sense to start creating your own morbidostat Arduino code. What Chris suggested is great for a simple fix to try out, with the only fear that if it somehow misses an efflux command the media levels aren’t what you expect it to be. Just be extra careful with being a bit more redundant about the efflux commands that get sent later.
Overall, I would recommend what Chris suggested, since its the simplest.
I am indeed thinking of using a millifluidic device to handle the second influx, but I’ll stick to Chris’ suggestion for these initial tests. Thanks for the heads up!
One more comment, if you were to implement changes to the DPU. What I would recommend is changing the custom_script.py:
Adding some script similar to this chunk, where it looks at the last pump event and it will trigger it with a given amount of time after the event.
save_path = os.path.dirname(os.path.realpath(__file__))
file_name = "vial{0}_pump_log.txt".format(x)
file_path = os.path.join(save_path,exp_name,'pump_log',file_name)
data = np.genfromtxt(file_path, delimiter=',')
last_pump = data[len(data)-1][0];
if (last_pump - current_time > target_delay):
## ADD EFFLUX PUMP EVENT HERE
Note: Dont take this code directly, just quickly threw something together as an example.
This would work too, yes! Only worry is that the delay might be greater than a handful of seconds, so maybe the “repeated” efflux events seem more attractive. I’ll experiment a bit and report back