# Recipe and control algorithm

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



A safe hierarchy separating user targets, recipe parameters, measured feedback, actuator calibration and learned sensory models.

In brief

A safe hierarchy separating user targets, recipe parameters, measured feedback, actuator calibration and learned sensory models.

## Control hierarchy

 User target → Validated recipe ID → Setpoints and schedules → Calibrated actuators → Measured environment → Outcome model

## Direct feedback loops

Closed-loop control is appropriate for directly measured variables such as pH, reservoir level, solution temperature, rotation speed and bulk EC. Individual-ion control requires ion-specific measurement or a constrained mass-balance model validated by chemical analysis. [R17] [R34] [R35] [R36]

 RCP-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 controlled variable.

**Explanation**The feedback error is the target value minus the measured value.

 RCP-2 u ( k ) = clip ⁡ [ K p e ( k ) + K i ∑ j e ( j ) Δ t ,   u min ⁡ ,   u max ⁡ ] u(k)=\operatorname{clip}\left[K_pe(k)+K_i\sum_j e(j)\Delta t,\ u_{\min},\ u_{\max}\right] u ( k ) = clip [ K p ​ e ( k ) + K i ​ j ∑ ​ e ( j ) Δ t ,   u m i n ​ ,   u m a x ​ ] Bounded PI action with explicit actuator and safety limits.

**Explanation**The requested correction combines present and accumulated error, then remains inside declared actuator and safety limits.

## Learned sensory mapping

The sensory predictor is trained from completed FlavoRotor experiments. Its input data include genotype, developmental stage, measured environmental history, solution composition and harvest handling. Cross-validation is separated by cultivation cycle to prevent samples from the same run appearing in training and test sets.

## Safety constraints

- no automatic dose with an expired channel calibration;
- no correction while the mixing delay is active;
- bounded dose and runtime per event;
- sensor plausibility and redundancy checks;
- fault-safe state after communication loss;
- full event logging with recipe and firmware versions.

## State-conditioned treatment

A recipe contains time limits and plant-state conditions. For example, a light phase can begin when a validated imaging model detects the required developmental stage, provided plant-health checks pass and the minimum and maximum calendar limits are respected.

 RCP-3 x t + 1 = f  ⁣ ( x t , u t , d t , g , θ ) + w t \mathbf{x}_{t+1}=f\!\left(\mathbf{x}_t,\mathbf{u}_t,\mathbf{d}_t,g,\boldsymbol{\theta}\right)+\mathbf{w}_t x t + 1 ​ = f ( x t ​ , u t ​ , d t ​ , g , θ ) + w t ​ x(t) is plant state; u(t) contains controlled inputs; d(t) contains measured disturbances; g identifies genotype; θ contains model parameters; and w(t) represents process variation.

**Explanation**The next plant state depends on the current state, controlled inputs, measured disturbances, genotype and model parameters, plus biological variation.

 RCP-4 y t = h  ⁣ ( x t ) + v t \mathbf{y}_t=h\!\left(\mathbf{x}_t\right)+\mathbf{v}_t y t ​ = h ( x t ​ ) + v t ​ The camera, sensors and laboratory measurements observe only part of the plant state; v(t) represents measurement error.

**Explanation**Sensors, images and laboratory analyses observe only part of the underlying plant state and include measurement error.

## References

- [R17] Vought, Kelsey; Bayabil, Haimanote K.; Pompeo, Jean; Crawford, Daniel; Zhang, Ying; Correll, Melanie; Martin-Ryals, Ana (2024). Dynamics of micro and macronutrients in a hydroponic nutrient film technique system under lettuce cultivation. *Heliyon*. https://doi.org/10.1016/j.heliyon.2024.e32316
- [R34] Cho, Woo-Jae; Gang, Min-Seok; Kim, Dong-Wook; Kim, JooShin; Jung, Dae-Hyun; Kim, Hak-Jin (2023). Decision-tree-based ion-specific dosing algorithm for enhancing closed hydroponic efficiency and reducing carbon emissions. *Frontiers in Plant Science, 14, 1301490*. https://doi.org/10.3389/fpls.2023.1301490
- [R35] Bamsey, Matthew; Graham, Thomas; Thompson, Cody; Berinstain, Alain; Scott, Alan; Dixon, Michael (2012). Ion-Specific Nutrient Management in Closed Systems: The Necessity for Ion-Selective Sensors in Terrestrial and Space-Based Agriculture and Water Management Systems. *Sensors, 12, 13349–13392*. https://doi.org/10.3390/s121013349
- [R36] Miller, Alexander; Adhikari, Ranjeeta; Nemali, Krishna (2020). Recycling Nutrient Solution Can Reduce Growth Due to Nutrient Deficiencies in Hydroponic Production. *Frontiers in Plant Science, 11, 607643*. https://doi.org/10.3389/fpls.2020.607643
