First Simulation
PlantBiophysics models are ordinary PlantSimEngine model kernels. The leaf_scene helper assembles a one-leaf scene and resolves their hard calls.
using PlantBiophysics, PlantSimEngine, PlantMeteo, Dates, DataFrames
meteo = Atmosphere(
T=22.0,
Wind=0.8333,
P=101.325,
Rh=0.45,
duration=Hour(1),
)
scene = leaf_scene(
Monteith(),
Fvcb(),
Medlyn(0.03, 12.0);
status=Status(
Ra_SW_f=13.747,
sky_fraction=1.0,
aPPFD=1500.0,
d=0.03,
),
environment=meteo,
)
simulation = run!(scene; outputs=:all)
leaf = only(model_objects(scene; scale=:Leaf))
(Tₗ=leaf.status.Tₗ, A=leaf.status.A, Gₛ=leaf.status.Gₛ)(Tₗ = 18.003618476920586, A = 32.010730315098684, Gₛ = 1.3459773860136361)The latest values remain on the leaf status. Because output retention is explicit, the same run can also be collected as a long table:
rows = DataFrame(collect_outputs(simulation; sink=nothing))
first(rows, 8)8×6 DataFrame
| Row | timestep | time | application_id | object_id | variable | value |
|---|---|---|---|---|---|---|
| Int64 | Float64 | Symbol | Symbol | Symbol | Float64 | |
| 1 | 1 | 1.0 | energy_balance | leaf | A | 32.0107 |
| 2 | 1 | 1.0 | energy_balance | leaf | Cᵢ | 312.092 |
| 3 | 1 | 1.0 | energy_balance | leaf | Cₛ | 350.01 |
| 4 | 1 | 1.0 | energy_balance | leaf | Dₗ | 0.877814 |
| 5 | 1 | 1.0 | energy_balance | leaf | Gbc | 0.640345 |
| 6 | 1 | 1.0 | energy_balance | leaf | Gbₕ | 0.0204703 |
| 7 | 1 | 1.0 | energy_balance | leaf | Gₛ | 1.34598 |
| 8 | 1 | 1.0 | energy_balance | leaf | H | -198.158 |
Each row identifies its publishing application, object, timestep, variable, and value. Continue with Simulation over several time steps to advance a Weather series and match retained results to their input rows.