# Nutrient dosing control strategy

Canonical HTML: https://flavorotor.com/research/dosing-control
Machine-readable index: https://flavorotor.com/research/data/chapters/index.json



Supervisory mass balance, pH/EC feedback, mixing delays, anti-windup and safety constraints.

In brief

Supervisory mass balance, pH/EC feedback, mixing delays, anti-windup and safety constraints.

## Control hierarchy

 Recipe targets → Stock mass balance → Calibrated pump commands → Mixing → pH/EC/level observation

## Variables suitable for direct feedback

- reservoir level or working volume;
- bulk EC, with temperature compensation;
- pH, with calibrated electrode and mixing delay;
- solution temperature;
- dissolved oxygen if a validated sensor is installed.

Sweetness, acidity of harvested tissue and aroma are not direct loop variables because they are not measured continuously in the reservoir.

## Discrete PI form

 CTL-1 e ( k ) = y t a r g e t − y m e a s u r e d ( k ) e(k)=y_{\mathrm{target}}-y_{\mathrm{measured}}(k) e ( k ) = y target ​ − y measured ​ ( k ) Error for a directly measured variable y, such as E C \mathrm{EC} EC or p H \mathrm{pH} pH .

**Explanation**Control error is simply the target value minus the measured value.

 CTL-2 u ( k ) = K p e ( k ) + K i ∑ j e ( j ) Δ t u(k)=K_pe(k)+K_i\sum_j e(j)\Delta t u ( k ) = K p ​ e ( k ) + K i ​ j ∑ ​ e ( j ) Δ t Candidate PI output before safety and chemical constraints.

**Explanation**The controller reacts to the present error and to accumulated error over time.

 CTL-3 u s a f e = clip ⁡ ( u , u min ⁡ , u max ⁡ ) u_{\mathrm{safe}}=\operatorname{clip}\left(u,u_{\min},u_{\max}\right) u safe ​ = clip ( u , u m i n ​ , u m a x ​ ) Dose request limited by recipe, chemistry and hardware constraints.

**Explanation**The requested action is kept between declared minimum and maximum limits.

## Dose sequence

- Validate sensor state and reservoir volume.
- Calculate a bounded stock-volume request.
- Verify channel calibration and stock identity.
- Deliver dose and log actuator command.
- Wait the measured mixing time.
- Acquire stable pH/EC readings.
- Apply another correction only if all limits remain valid.

## pH control note

Because pH is logarithmic and buffering varies with solution composition, the controller uses small empirical dose increments and measured response rather than converting pH error directly into a fixed acid/base volume. Open-source pH-stat work supports this calibration and logging approach. [R20]

## References

- [R20] Milanovic, Jovana Z.; Milanovic, Predrag; Kragic, Rastislav; Kostic, Mirjana (2018). "Do-It-Yourself" reliable pH-stat device by using open-source software, inexpensive hardware and available laboratory equipment. *PLOS ONE*. https://doi.org/10.1371/journal.pone.0193744
