SmartBioTech / PBRcontrol

1 stars 1 forks source link

ePBR pump usage #17

Open xtrojak opened 5 years ago

xtrojak commented 5 years ago

Compared to PSI PBR, the change of the state of pump in ePBR is more complicated. It cannot be simply switched on and off. The pump works as following:

  1. it is turned on and additional medium is added to the bioreactor (takes 20 seconds)
  2. then the pump is turned off and another pump extracts extra medium from the bioreactor

The problem with point 2. is that the extraction pump is possibly shared with other devices.

Considering the given information, we propose the following implementation of set_pump_state for ePBR (has to be verified)

OD = measure_od()
while OD > min_OD:
     setAux1(1)             # this turns on the pump
     time.sleep(40)        # sleep 40 seconds, should be enough to accomplish steps 1. and 2.
     OD = measure_od()

such that min_OD is given to ePBR during initialisation.


Question for Jan:

We are still not sure how correctly use setAux1. It takes as argument 0/1, which should turn off/on the pump. As described above it is quite clear how setAux1(1) should be used. What is not clear, however, is whether after the "40 seconds" the state is set back to 0. Also it is not clear whether setAux1(0) has any effect at all - and if it does, what does it actually mean in the context of steps described above and on the pseudo-code provided above.

JanCervenyy commented 5 years ago

The implementation needs to be slightly modified according to the initial description (https://czechglobe-doab.slack.com/archives/CLN16B9CH/p1571978282001000), i.e. I would do it following way:

OD = measure_od()
while OD > min_OD:
     setAux2(1)             # this turns on the pump (works only if the pump goes from 0 to 1)
     time.sleep(20)        # sleep 20 seconds, should be enough to accomplish steps 1. and 2.
     setAux2(0)        # reset the pump to zero state that is necessary for success of next set of the pump
     time.sleep(20)
     OD = measure_od()
xtrojak commented 5 years ago

It was just a testing close, the issue has not been resolved by implementation yet.

DanDayne commented 5 years ago

I tried to address this in this commit. I expect bugs to occur, but I do not have the resources to test it at the moment. @xtrojak could possibly try it out?

Basically, I added a pump manager which manages the pump state for ePBRs in its own thread - log messages should be consistent with other device classes.

xtrojak commented 4 years ago

The pump manager is working, but will be possibly modified to more general usage.

DanDayne commented 4 years ago

TODO: move pump manager to Phenometrics\PBR