Pioreactor / pioreactor

Hardware and software for accessible, extensible, and scalable bioreactors. Built on Raspberry Pi.
https://pioreactor.com
MIT License
101 stars 9 forks source link

A conditional directive in profiles #450

Closed CamDavidsonPilon closed 10 months ago

CamDavidsonPilon commented 1 year ago

I don't want these to be a reimplementation of existing automations. That would confuse users, make debugging harder, and add complexity. I think the way to think about a conditional directive is "why did the user {change a setting, start/stop/pause a job} in the UI?"

Some use cases (ignoring technical limitations):

CamDavidsonPilon commented 10 months ago

I like the github actions style:

common:
  stirring:
    actions:
      - type: start
        hours_elapsed: 0.0
        options:
          target_rpm: 400.0
      - type: update
        hours_elapsed: 0.025
        if: <some conditional as a string>
        options:
          target_rpm: 800.0

The conditionals can be like <job_name.published_setting> {==,<=,<,>,>=} <some value>. This is becoming really complex as now I need to parse it!

CamDavidsonPilon commented 10 months ago

if the turbidostat is running too frequently and not able to keep up with a high growth-rate culture, we should increase the volume removed.

type: update
if: p:growth_rate_calculating:growth_rate.growth_rate > 1.5
hours_elapsed: 24
options:
  volume: 2.0

if running a chemostat, and the OD drops below some threshold, we risk washing out the culture. We should reduce the volume / increase the duration.

type: update
if: p:od_reading:od1.od <= 1.0
hours_elapsed: 6
options:
  duration: 60

If OD exceeds some threshold, then start chemostat.

dosing_control:
  type: start
  if: p:od_reading:od1.od >= 5
  hours_elapsed: 12
  options:
    automation_name: chemostat
    duration: 20.0
    volume: 1.0

In a phage set up, start feeding / chemostat when the source bioreactor (full of bacteria) exceeds some OD target.


pioreactors:
  phage:
    jobs:
      dosing_control:
        type: start
        if: source:od_reading:od1.od >= 5
        hours_elapsed: 12
        options:
          automation_name: chemostat
          duration: 20.0
          volume: 1.0
  source:
    jobs:
      dosing_control:
        type: start
        hours_elapsed: 0
        options:
          automation_name: chemostat
          duration: 20.0
          volume: 1.0