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
Rowtimesteptimeapplication_idobject_idvariablevalue
Int64Float64SymbolSymbolSymbolFloat64
111.0energy_balanceleafA32.0107
211.0energy_balanceleafCᵢ312.092
311.0energy_balanceleafCₛ350.01
411.0energy_balanceleafDₗ0.877814
511.0energy_balanceleafGbc0.640345
611.0energy_balanceleafGbₕ0.0204703
711.0energy_balanceleafGₛ1.34598
811.0energy_balanceleafH-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.