Contents — find the section you need
Change parameters and verify
Open the panel, then press Run to load Python. You can stop execution and reset parameters. Results are computed on this device. No Python installation is required.
Local execution steps below are optional for reproducing the source results; they are not required for the browser experiment.
Three browser experiments
The panel above runs the heat balance. Change LED load, cooling heat-removal capacity, mean outside temperature, ventilation and cooling setpoint. Moisture and CO₂ run as separate models in the panels below. No Python installation is required; local instructions later in the article are optional.
All three retain the original synthetic inputs and 60-second explicit steps over 24 hours from midnight. Lights remain on from 08:00 to 24:00. Upper plots connect initial and hourly samples, not the full switching or extreme-value history; minimum/maximum metrics use every minute. The thermal model's hourly outside samples retain the original code's value one minute before each displayed hour. Lower bars show daily integrated terms. Positive ventilation means net outward transfer; negative means inward. Use A/B comparison, the table and shared conditions to inspect results.
Thermal constants: 12 MJ/K heat capacity, 450 W/K envelope UA, 800 W other heat, initial 22°C, outside amplitude 6°C peaking at 15:00. Cooling switches at setpoint ±0.5°C. All LED power becomes heat. Cooling thermal kWh is not electrical consumption.
Moisture constants: 300 m³ at 24°C, initial RH65%, dehumidifier on at 75% and off at 65%. Excess water above saturation is counted separately as condensation. Transpiration is prescribed rather than predicted from RH. Latent load is not electrical consumption. Outside air is also assumed to be at 24°C.
CO₂ constants: 300 m³, 24°C, 101325 Pa, initial 600 ppm, injection on at 700 and off at 900 ppm. The original simplification uses uptake only while lit and respiration only while dark. Browser limits of ventilation ≥0.03 m³/s and uptake ≤0.08 kg/h keep CO₂ nonnegative within the exposed ranges. These are teaching limits, not crop, ventilation or safety standards.
These models are not coupled: moisture/CO₂ temperature does not come from the heat model. They do not predict equipment suitability, real facility performance or crop yield. Original ZIPs and expected results are unchanged. Save each browser entrypoint, kernel and config together to reproduce defaults locally.
thermal: experiment.py · thermal_kernel.py · config.json
moisture: experiment.py · moisture_kernel.py · config.json
co2: experiment.py · co2_kernel.py · config.json
Grow-Room Heat Balance Lab — separate LEDs, ventilation, envelope and cooling
Start with the result
Over the synthetic 24 hours, room temperature spans 18.884–24.547°C. LEDs add 192.0 kWh of heat to the room boundary and cooling removes 184.333 kWh of thermal energy. These are not measurements or identified parameters from a real indoor farm. They are teaching inputs for checking whether heat entering, leaving and accumulating uses one consistent energy ledger.
| Change | Expected effect | Held constant |
|---|---|---|
| Halve LED power | Half the lighting heat; less cooling load | Weather and envelope |
| Double capacitance | Slower temperature change | Steady-state balance |
| Increase ventilation | More exchange according to indoor–outdoor difference | Envelope UA |
| Set cooling capacity to zero | No equipment suppression of the rise | LED heat |
The CEA overview defined the plant–environment–equipment boundary, and the VPD/DLI Lab derived quantities from observations. This next step builds the smallest dynamic model connecting equipment to room temperature.
Diagram: Duskcoil. A schematic computation boundary for a lumped one-zone model. Plants, humidity, CO₂, latent heat and spatial temperature gradients are excluded.
Add heat rates before updating temperature
Assume one perfectly mixed zone with effective thermal capacitance C [J/K] and room temperature T [°C]. Express every heat rate in watts (J/s):
Use K=UA+\rho c_p\dot V [W/K]. The envelope is aggregated into UA, while \rho c_p\dot V represents sensible exchange from outdoor ventilation. When outdoors is warmer, T-T_{out} is negative and this term adds heat indoors. Its direction follows the temperature difference; it is not always a loss.
Oklahoma State University Extension's greenhouse guide likewise connects heating capacity to exposed area, insulation and the indoor–outdoor temperature difference, and explains ventilation's role in temperature and humidity control. The U.S. DOE overview of building energy modeling describes physics-based combinations of envelope, lighting, HVAC, schedules and weather, including their interactions.
Fix the teaching boundary
| Quantity | Synthetic value | Meaning in this model |
|---|---|---|
| Capacitance C | 12 MJ/K | Fictitious aggregate of air and indoor mass |
| Envelope UA | 450 W/K | Walls and ceiling collapsed into one value |
| Ventilation \dot V | 0.08 m³/s | Sensible exchange with outdoor-temperature air |
| LED power | 12 kW, 08:00–24:00 | Eventually becomes heat inside this boundary |
| Other gains | 0.8 kW | Constant aggregate of pumps, fans and equipment |
| Cooling capacity | 14 kW | Heat removed while ON, not electric demand |
| Outdoor temperature | 21±6°C | Sinusoid peaking at 15:00 |
Light first reaches leaves and surfaces before degrading to heat. Because this model does not separate radiation, convection or plant mass, the baseline assigns a heat fraction of 1.0 to electrical lighting inside the room boundary. DOE lighting guidance also treats lighting as an indoor heat gain affecting cooling load. A real boundary must reconsider radiation leaving the room, remote drivers and latent heat used for evaporation.
The 14 kW cooling value is thermal removal, not compressor electricity. No COP is assumed, so this result cannot be converted directly into an electricity bill.
Integrate at one-minute steps
Explicit Euler advances the state from n to n+1:
Cooling uses a 24°C setpoint and 0.5°C hysteresis: ON at or above 24.5°C and OFF at or below 23.5°C. This is a minimal switching rule, not PID or MPC. A larger time step changes switching times and temperature excursions, so compare step sizes before trusting the numerical result.
Run the code and input
Extract the experiment ZIP and run inside that directory. It needs Python 3.10+ and only the standard library; no network access is used.
python3 experiment.py config.json > result.json
python3 -m unittest -v
See config.json, expected.json, and the complete experiment.py. manifest.json records the input contract and SHA-256 hashes.
conductance = envelope_ua + air_density * air_cp * ventilation
net_heat = led_heat + other_heat - conductance * (indoor - outside) - cooling
indoor_next = indoor + net_heat * dt / thermal_capacitance
Change, break and verify
- Set
led_power_wto 6000. LED heat becomes 96 kWh and cooling removal should decrease. - Double
thermal_capacitance_j_per_k. Short-term temperature change slows, while source energy in kWh is unchanged. - Set indoors and outdoors to 20°C and all gains, cooling, ventilation and UA to zero. The room must remain at 20°C after one hour.
- Increase
time_step_secondsand compare extrema. Do not claim control performance when results depend strongly on the numerical step. - Delete a key, add an unknown key, or enter NaN or a negative capacity. The program should reject rather than guess.
The ten tests cover the baseline, zero-flux conservation, a first-order analytic solution, proportional LED heating, energy residual and malformed inputs. Passing them does not validate a facility.
What this model cannot answer
- Leaf temperature, transpiration, dehumidification latent heat, humidity or VPD
- CO₂ concentration and ventilation mass balance
- Rack-to-rack gradients, airflow short-circuiting or sensor placement
- HVAC part-load efficiency, defrost, fan or pump electricity
- Crop growth, quality, yield or optimum temperature
A later moisture extension should add water-vapor conservation and latent heat while retaining the thermal energy-residual check. Before comparing controllers, specify which coefficients are measured and which outputs are used for identification.
References
- About Building Energy Modeling (U.S. Department of Energy)
- Chapter 5: Lighting, HVAC, and Plumbing (U.S. Department of Energy)
- The Hobby Greenhouse (Oklahoma State University Extension)
Grow-Room Humidity Balance Lab — conserve vapour mass, not RH
Start with the result
For a synthetic 300 m³ room fixed at 24°C, the 24-hour calculation gives 64.817–75.269% RH, 34.8 kg prescribed plant vapour, 12.793 kg net ventilation removal and 21.542 kg dehumidifier removal. Water-balance residual stays below 10^{-12} kg. These are teaching inputs, not measured crop transpiration or facility performance.
Diagram: Duskcoil. Synthetic, well-mixed and fixed-temperature; RH itself is not integrated as a conserved state.
Do not add percentages
Relative humidity is a ratio to saturation at the current temperature. The same vapour mass can therefore produce a different RH when temperature changes. Store vapour mass m_v [kg] instead:
Use \rho_v=e/(R_vT_K) and e=RH\,e_s(T)/100, with the FAO-56 equation 11 saturation relation. Vapour above saturation is transferred explicitly to condensate rather than silently clipping RH.
Synthetic boundary
| Input | Value | Scope |
|---|---|---|
| Indoor/outdoor temperature | fixed 24°C | No dynamic thermal coupling |
| Initial/outdoor RH | 65% / 60% | Converted to density at 24°C |
| Ventilation | 0.08 m³/s | Well-mixed net exchange |
| Vapour source | lit 2.0, dark 0.35 kg/h | Prescribed, not a crop model |
| Dehumidification | 2.5 kg/h | Water removal, not electricity |
| ON/OFF thresholds | 75% / 65% | Simple hysteresis |
Penn State Extension treats condensation, humidity, ventilation and air circulation as connected greenhouse-management concerns. This Lab does not predict disease.
Read latent load from water mass
Using the FAO approximation \lambda=2.45 MJ/kg near 20°C, the synthetic 34.8 kg source corresponds to 23.683 kWh of phase-change energy. This latent load is distinct from LED heat and sensible cooling. Latent load derived from removed water is not compressor electricity; COP and dehumidifier heat rejection are excluded.
Run and verify
Extract the ZIP and run with Python 3.10+:
python3 experiment.py config.json > result.json
python3 -m unittest -v
The package exposes config.json, expected.json, and experiment.py. Ten tests cover RH-density round trips, closed-room conservation, a known source, latent conversion and rejected inputs.
Change ventilation, dehumidification and transpiration one at a time. Also change temperature while holding vapour mass fixed and observe RH change. The model cannot answer leaf condensation, local airflow, responsive transpiration, disease, growth or CO₂. Sensor placement and independent measurements of transpiration and collected condensate are prerequisites for real identification.
References
Grow-Room CO₂ Balance Lab — track ventilation, uptake, respiration and supply
Start with the result
For a synthetic 300 m³ room fixed at 24°C and 101325 Pa, CO₂ spans 600–906.209 ppm over 24 hours. Prescribed uptake is 1.28 kg, respiration adds 0.16 kg, supply adds 2.967 kg, and ventilation removes 1.756 kg net. Mole-balance residual stays below 10^{-10} mol. These are not crop or equipment performance measurements.
Diagram: Duskcoil. A well-mixed ideal-gas model at fixed temperature and pressure.
Conserve amount, not ppm
Let total room air be n_{air}=PV/(RT) mol and stored CO₂ be n mol, with ppm=10^6n/n_{air}:
Ventilation follows indoor–outdoor concentration difference and molar airflow. Changing temperature, pressure or volume changes the ppm corresponding to the same CO₂ amount.
Oklahoma State University Extension connects daytime photosynthetic use, nighttime respiration, ventilation and supplementation. A USDA ARS calculation likewise uses greenhouse volume and assumed uptake to estimate depletion. This Lab's fluxes are synthetic and do not reproduce yield effects or recommended settings.
Run and verify
Extract the ZIP, then use Python 3.10+:
python3 experiment.py config.json > result.json
python3 -m unittest -v
The package includes config.json, expected.json, and experiment.py. Supply turns on at 700 ppm and off at 900 ppm. Eight tests cover closed-room conservation, a known one-mole source, balance residual and invalid inputs.
Set ventilation, uptake and supply to zero one at a time. Real identification requires canopy gas exchange, leakage, sensor placement/calibration and supply-flow measurements. This model cannot determine safety limits, crop response, combustion contaminants, CO₂ cost or coupled temperature/humidity control.

Comments
Please log in to post a comment
No comments yet.