# Morbidostat setup

**URL:** <https://forum.pioreactor.com/t/morbidostat-setup/547>\
**Category:** Software\
**Created:** [November 12, 2024, 10:21am UTC](https://forum.pioreactor.com/t/morbidostat-setup/547 "2024-11-12T10:21:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![danwe1](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@danwe1](https://forum.pioreactor.com/u/danwe1)\
**Post date:** [November 12, 2024, 10:21am UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/1 "2024-11-12T10:21:20Z")

</div>

I’m trying to design an experiment in which the pioreactor will check the OD every 30 minutes, and if it reaches a certain threshold it will add media with salt. I am trying to build this as a profile but it seems that the YAML code cannot do loops or repeated functions. is there a way around it ?

thanks ahead  
Dan

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [November 12, 2024, 2:44pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/2 "2024-11-12T14:44:57Z")

</div>

Hi @danwe1,

Is this just a chemostat with salty-media instead of regular media? Or is there also a regular chemostat operating, and you want to add this additional dosing in? I’ll assume the latter:

There is the `repeat` action you can use. Here’s a sketch of what if might look like (untested)

```auto
common:
  add_alt_media:
     actions:
        type: repeat
        hours_elapsed: 0
        repeat_every_hours: 0.5
        actions:
           type: start
           if: ${{::od_reading:od1.od_reading > 0.5}}
           options:
              mL: 1.0

```

We aren’t removing waste, so be cautious about overflows. However, if a regular chemostat is running, it will remove extra waste, so it _may_ keep the volume constant. (dependent on your chemostat configuration).

Does that solve your issue?

Another approach is a custom automation, which is also a good idea.

---

<div class="post-metadata">

**Author:** ![danwe1](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@danwe1](https://forum.pioreactor.com/u/danwe1)\
**Post date:** [November 14, 2024, 1:09pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/3 "2024-11-14T13:09:58Z")

</div>

Thank you for the quick response! You assumed correctly. I want to add an additional dosing-in every few hours, or when OD reaches a certain threshold, in addition to a turbidostat.  
Yet, it seems that there is no such command as `repeat_every_hours` in the YAML code in “profiles”

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [November 14, 2024, 1:48pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/4 "2024-11-14T13:48:56Z")

</div>

> [@danwe1](#):
>
> no such command as `repeat_every_hours` in the YAML code in “profiles”

Hm, I’m not sure what you mean. Are you using a relatively recent Pioreactor software version? Can you show me what you are seeing?

---

<div class="post-metadata">

**Author:** ![danwe1](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@danwe1](https://forum.pioreactor.com/u/danwe1)\
**Post date:** [November 14, 2024, 3:04pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/5 "2024-11-14T15:04:59Z")

</div>

I now realized that there is a built-in morbidostat in the program. thank you for your help! I will let you know about any future issues.

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [November 14, 2024, 3:17pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/6 "2024-11-14T15:17:28Z")

</div>

There is! But it’s not time-based like your original message, nor is it the original “morbidostat” algorithm using thresholds, it’s a dynamic PID approach like what the eVOLVER folks did.

---

<div class="post-metadata">

**Author:** ![danwe1](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@danwe1](https://forum.pioreactor.com/u/danwe1)\
**Post date:** [November 17, 2024, 7:51am UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/7 "2024-11-17T07:51:32Z")

</div>

The PID approach is even better for my needs. The only thing is, I want to have a record of the salt concentration in the pioreactor over time. is there a way to add this to the morbidostat program?

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [November 17, 2024, 4:45pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/8 "2024-11-17T16:45:06Z")

</div>

Mmm the closest thing I can suggest is to display the fraction of alt-media, which is proportional to the salt concentration. Try something like this: [Morbidostat PID algorithm, tuning, and suggestions - #3 by CamDavidsonPilon](https://forum.pioreactor.com/t/morbidostat-pid-algorithm-tuning-and-suggestions/116/3) to display a chart in your UI.

The raw `fraction of alt-media` data is in the database, too. You can export it from the UI.

---

<div class="post-metadata">

**Author:** ![danwe1](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@danwe1](https://forum.pioreactor.com/u/danwe1)\
**Post date:** [December 17, 2024, 4:04pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/9 "2024-12-17T16:04:00Z")

</div>

Hello again. I am trying to work with the morbidostat mode, but it lets me pick two thresholds - one for the growth rate and one for the OD. I don’t understand whether it adds the alt. media at the growth-rate threshold or at the OD threshold. Also, what is the time between events? isn’t it based on readings rather than time?

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [December 18, 2024, 2:20am UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/10 "2024-12-18T02:20:24Z")

</div>

> [@danwe1](#):
>
> I don’t understand whether it adds the alt. media at the growth-rate threshold or at the OD threshold.

After looking at our code for the PID morbidostat - it’s not very clear! Here’s what I can tell you after a quick read:

1. The following occurs every 60 minutes (`time between events` parameter):
2. The automation will try to keep the nOD within a range of `0.7*target OD` to `1.25*target OD`. That is, if it’s below this threshold, it won’t dose. If it’s above, it will ~double-dose.
  - **confusion 1:** Note that `target OD` is actually comparing against _normalized_ OD - not the raw OD:
  - **confusion 2:** Why did I choose 0.7 and 1.25 as thresholds - not sure?!

3. When it does dose, it will dose `volume` amount of a mix of media _and_ alt-media. If the growth-rate is above `target growth rate`, it will add an increasing amount of alt-media (ideally this will decease the growth-rate)
  - **confusion 3:** the `volume` parameter just says “for dilution”, but it’s more clearly than that! [pioreactor/pioreactor/automations/dosing/pid\_morbidostat.py at master · Pioreactor/pioreactor · GitHub](https://github.com/Pioreactor/pioreactor/blob/master/pioreactor/automations/dosing/pid_morbidostat.py#L79-L80)

**confusion 4:** What’s up with the `time between events` anyways? You’re right that the better way to think about this is event-based.

* * *

We wrote this code a long time ago. I think it’s time be update it and the labels to make it more clear. The original morbidostat PID idea came from the eVOLVER team, and we should mimic what they did first.

---

<div class="post-metadata">

**Author:** ![domatv](https://forum.pioreactor.com/letter_avatar_proxy/v4/letter/d/e36b37/32.png) [@domatv](https://forum.pioreactor.com/u/domatv)\
**Post date:** [February 2, 2026, 1:42pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/11 "2026-02-02T13:42:01Z")

</div>

Hey!

Has there been any update on the above confusions? Currently designing a morbidostat experiment but we´d like to monitor the ratio of alt:media over time.

Thanks and best wishes,  
Dylan

---

<div class="post-metadata">

**Author:** ![CamDavidsonPilon](https://forum.pioreactor.com/user_avatar/forum.pioreactor.com/camdavidsonpilon/32/3_2.png) [@CamDavidsonPilon](https://forum.pioreactor.com/u/CamDavidsonPilon)\
**Post date:** [February 2, 2026, 2:23pm UTC](https://forum.pioreactor.com/t/morbidostat-setup/547/12 "2026-02-02T14:23:45Z")

</div>

> [@domatv](#):
>
> any update on the above confusions? Currently designing a morbidostat experiment but

Hi @domatv, you should be able to display and export the fraction of alt media using [this](https://forum.pioreactor.com/t/morbidostat-pid-algorithm-tuning-and-suggestions/116/3) (please let me know if that doesn’t work).

w.r.t. a new morbidostat automation I mentioned: I think we can do this soon, including the “event-based” model I had in mind earlier.
