Example models

PlantSimEngine provides example processes and models to users. They are available from a sub-module called Examples. To get access to these models in a working environment with PlantSimEngine, you can simply use this sub-module:

using PlantSimEngine.Examples

List

Details

PlantSimEngine.ExamplesModule

A sub-module with example models.

Examples used in the documentation for a set of multiscale models. The models can be found in the examples folder of the package, and are stored in the following files:

  • ToyAssimModel.jl
  • ToyCDemandModel.jl
  • ToyCAllocationModel.jl
  • ToySoilModel.jl

Examples

using PlantSimEngine
using PlantSimEngine.Examples
ToyAssimModel()
source
PlantSimEngine.Examples.AbstractCarbon_AllocationModelType

carbon_allocation process abstract model.

All models implemented to simulate the carbon_allocation process must be a subtype of this type, e.g. struct MyCarbon_AllocationModel <: AbstractCarbon_AllocationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_AllocationModel)
source
PlantSimEngine.Examples.AbstractCarbon_AssimilationModelType

carbon_assimilation process abstract model.

All models implemented to simulate the carbon_assimilation process must be a subtype of this type, e.g. struct MyCarbon_AssimilationModel <: AbstractCarbon_AssimilationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_AssimilationModel)
source
PlantSimEngine.Examples.AbstractCarbon_BiomassModelType

carbon_biomass process abstract model.

All models implemented to simulate the carbon_biomass process must be a subtype of this type, e.g. struct MyCarbon_BiomassModel <: AbstractCarbon_BiomassModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_BiomassModel)
source
PlantSimEngine.Examples.AbstractCarbon_DemandModelType

carbon_demand process abstract model.

All models implemented to simulate the carbon_demand process must be a subtype of this type, e.g. struct MyCarbon_DemandModel <: AbstractCarbon_DemandModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_DemandModel)
source
PlantSimEngine.Examples.AbstractDegreedaysModelType

Degreedays process abstract model.

All models implemented to simulate the Degreedays process must be a subtype of this type, e.g. struct MyDegreedaysModel <: AbstractDegreedaysModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractDegreedaysModel)
source
PlantSimEngine.Examples.AbstractGrowthModelType

growth process abstract model.

All models implemented to simulate the growth process must be a subtype of this type, e.g. struct MyGrowthModel <: AbstractGrowthModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractGrowthModel)
source
PlantSimEngine.Examples.AbstractLai_DynamicModelType

LAI_Dynamic process abstract model.

All models implemented to simulate the LAI_Dynamic process must be a subtype of this type, e.g. struct MyLai_DynamicModel <: AbstractLai_DynamicModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLai_DynamicModel)
source
PlantSimEngine.Examples.AbstractLeaf_SurfaceModelType

leaf_surface process abstract model.

All models implemented to simulate the leaf_surface process must be a subtype of this type, e.g. struct MyLeaf_SurfaceModel <: AbstractLeaf_SurfaceModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLeaf_SurfaceModel)
source
PlantSimEngine.Examples.AbstractLight_InterceptionModelType

light_interception process abstract model.

All models implemented to simulate the light_interception process must be a subtype of this type, e.g. struct MyLight_InterceptionModel <: AbstractLight_InterceptionModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLight_InterceptionModel)
source
PlantSimEngine.Examples.AbstractLight_PartitioningModelType

light_partitioning process abstract model.

All models implemented to simulate the light_partitioning process must be a subtype of this type, e.g. struct MyLight_PartitioningModel <: AbstractLight_PartitioningModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLight_PartitioningModel)
source
PlantSimEngine.Examples.AbstractMaintenance_RespirationModelType

maintenance_respiration process abstract model.

All models implemented to simulate the maintenance_respiration process must be a subtype of this type, e.g. struct MyMaintenance_RespirationModel <: AbstractMaintenance_RespirationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractMaintenance_RespirationModel)
source
PlantSimEngine.Examples.AbstractOrgan_EmergenceModelType

organ_emergence process abstract model.

All models implemented to simulate the organ_emergence process must be a subtype of this type, e.g. struct MyOrgan_EmergenceModel <: AbstractOrgan_EmergenceModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractOrgan_EmergenceModel)
source
PlantSimEngine.Examples.AbstractProcess1ModelType

process1 process abstract model.

All models implemented to simulate the process1 process must be a subtype of this type, e.g. struct MyProcess1Model <: AbstractProcess1Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess1Model)
source
PlantSimEngine.Examples.AbstractProcess2ModelType

process2 process abstract model.

All models implemented to simulate the process2 process must be a subtype of this type, e.g. struct MyProcess2Model <: AbstractProcess2Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess2Model)
source
PlantSimEngine.Examples.AbstractProcess3ModelType

process3 process abstract model.

All models implemented to simulate the process3 process must be a subtype of this type, e.g. struct MyProcess3Model <: AbstractProcess3Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess3Model)
source
PlantSimEngine.Examples.AbstractProcess4ModelType

process4 process abstract model.

All models implemented to simulate the process4 process must be a subtype of this type, e.g. struct MyProcess4Model <: AbstractProcess4Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess4Model)
source
PlantSimEngine.Examples.AbstractProcess5ModelType

process5 process abstract model.

All models implemented to simulate the process5 process must be a subtype of this type, e.g. struct MyProcess5Model <: AbstractProcess5Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess5Model)
source
PlantSimEngine.Examples.AbstractProcess6ModelType

process6 process abstract model.

All models implemented to simulate the process6 process must be a subtype of this type, e.g. struct MyProcess6Model <: AbstractProcess6Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess6Model)
source
PlantSimEngine.Examples.AbstractProcess7ModelType

process7 process abstract model.

All models implemented to simulate the process7 process must be a subtype of this type, e.g. struct MyProcess7Model <: AbstractProcess7Model end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractProcess7Model)
source
PlantSimEngine.Examples.AbstractSoil_WaterModelType

soil_water process abstract model.

All models implemented to simulate the soil_water process must be a subtype of this type, e.g. struct MySoil_WaterModel <: AbstractSoil_WaterModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractSoil_WaterModel)
source
PlantSimEngine.Examples.BeerType
Beer(k)

Beer-Lambert law for light interception.

Required inputs: LAI in m² m⁻². Required meteorology data: Ri_PAR_f, the incident flux of atmospheric radiation in the PAR, in W m[soil]⁻² (== J m[soil]⁻² s⁻¹).

Output: aPPFD, the absorbed Photosynthetic Photon Flux Density in μmol[PAR] m[leaf]⁻² s⁻¹.

source
PlantSimEngine.Examples.Process6ModelType
Process6Model()

A dummy model implementing a "process6" process for testing purposes. It needs the outputs from the coupled processes 1-2-3, but also from process 7 that is itself independant.

source
PlantSimEngine.Examples.Process7ModelType
Process7Model()

A dummy model implementing a "process7" process for testing purposes. It is independent (needs :var0 only as for Process4Model), but its outputs are used by Process6Model, so it is a soft-coupling.

source
PlantSimEngine.Examples.ToyAssimGrowthModelType
ToyAssimGrowthModel(Rm_factor, Rg_cost)
ToyAssimGrowthModel(; LUE=0.2, Rm_factor = 0.5, Rg_cost = 1.2)

Computes the biomass growth of a plant.

Arguments

  • LUE=0.2: the light use efficiency, in gC mol[PAR]⁻¹
  • Rm_factor=0.5: the fraction of assimilation that goes into maintenance respiration
  • Rg_cost=1.2: the cost of growth maintenance, in gram of carbon biomass per gram of assimilate

Inputs

  • aPPFD: the absorbed photosynthetic photon flux density, in mol[PAR] m⁻² time-step⁻¹

Outputs

  • carbon_assimilation: the assimilation, in gC m⁻² time-step⁻¹
  • Rm: the maintenance respiration, in gC m⁻² time-step⁻¹
  • Rg: the growth respiration, in gC m⁻² time-step⁻¹
  • biomass_increment: the daily biomass increment, in gC m⁻² time-step⁻¹
  • biomass: the plant biomass, in gC m⁻² time-step⁻¹
source
PlantSimEngine.Examples.ToyAssimModelType
ToyAssimModel(LUE)

Computes the assimilation of a plant (= photosynthesis).

Arguments

  • LUE=0.2: the light use efficiency, in gC mol[PAR]⁻¹

Inputs

  • aPPFD: the absorbed photosynthetic photon flux density, in mol[PAR] m⁻² time-step⁻¹
  • soil_water_content: the soil water content, in %

Outputs

  • carbon_assimilation: the assimilation or photosynthesis, also sometimes denoted A, in gC m⁻² time-step⁻¹

Details

The assimilation is computed as the product of the absorbed photosynthetic photon flux density (aPPFD) and the light use efficiency (LUE), so the units of the assimilation usually are in gC m⁻² time-step⁻¹, but they could be in another spatial or temporal unit depending on the unit of aPPFD, e.g. if aPPFD is in mol[PAR] plant⁻¹ time-step⁻¹, the assimilation will be in gC plant⁻¹ time-step⁻¹.

source
PlantSimEngine.Examples.ToyCAllocationModelType
ToyCAllocationModel()

Computes the carbon allocation to each organ of a plant based on the plant total carbon offer and individual organ demand. This model should be used at the plant scale, because it first computes the carbon availaible for allocation as the minimum between the total demand (sum of organs' demand) and total carbon offer (sum of organs' assimilation - total maintenance respiration), and then allocates the carbon relative to each organ's demand.

Inputs

  • carbon_assimilation: a vector of the assimilation of all photosynthetic organs, usually in gC m⁻² time-step⁻¹
  • Rm: the maintenance respiration of the plant, usually in gC m⁻² time-step⁻¹
  • carbon_demand: a vector of the carbon demand of the organs, usually in gC m⁻² time-step⁻¹

Outputs

  • carbon_assimilation: the carbon assimilation, usually in gC m⁻² time-step⁻¹

Details

The units usually are in gC m⁻² time-step⁻¹, but they could be in another spatial or temporal unit depending on the unit of the inputs, e.g. in gC plant⁻¹ time-step⁻¹.

source
PlantSimEngine.Examples.ToyCBiomassModelType
ToyCBiomassModel(construction_cost)

Computes the carbon biomass of an organ based on the carbon allocation and construction cost.

Arguments

  • construction_cost: the construction cost of the organ, usually in gC gC⁻¹. Should be understood as the amount of carbon needed to build 1g of carbon biomass.

Inputs

  • carbon_allocation: the carbon allocation to the organ for the time-step, usually in gC m⁻² time-step⁻¹

Outputs

  • carbon_biomass_increment: the increment of carbon biomass, usually in gC time-step⁻¹
  • carbon_biomass: the carbon biomass, usually in gC
  • growth_respiration: the growth respiration, usually in gC time-step⁻¹
source
PlantSimEngine.Examples.ToyCDemandModelType
ToyCDemandModel(optimal_biomass, development_duration)
ToyCDemandModel(; optimal_biomass, development_duration)

Computes the carbon demand of an organ depending on its biomass under optimal conditions and the duration of its development in degree days. The model assumes that the carbon demand is linear througout the duration of the development.

Arguments

  • optimal_biomass: the biomass of the organ under optimal conditions, in gC
  • development_duration: the duration of the development of the organ, in degree days

Inputs

  • TT: the thermal time, in degree days

Outputs

  • carbon_demand: the carbon demand, in gC
source
PlantSimEngine.Examples.ToyDegreeDaysCumulModelType
ToyDegreeDaysCumulModel(;init_TT=0.0, T_base=10.0, T_max=43.0)

Computes the thermal time in degree days and cumulated degree-days based on the average daily temperature (T), the initial cumulated degree days, the base temperature below which there is no growth, and the maximum temperature for growh.

source
PlantSimEngine.Examples.ToyLAIModelType
ToyLAIModel(;max_lai=8.0, dd_incslope=800, inc_slope=110, dd_decslope=1500, dec_slope=20)

Computes the Leaf Area Index (LAI) based on a sigmoid function of thermal time.

Arguments

  • max_lai: the maximum LAI value
  • dd_incslope: the thermal time at which the LAI starts to increase
  • inc_slope: the slope of the increase
  • dd_decslope: the thermal time at which the LAI starts to decrease
  • dec_slope: the slope of the decrease

Inputs

  • TT_cu: the cumulated thermal time since the beginning of the simulation, usually in °C days

Outputs

  • LAI: the Leaf Area Index, usually in m² m⁻²
source
PlantSimEngine.Examples.ToyLAIfromLeafAreaModelType
ToyLAIfromLeafAreaModel()

Computes the Leaf Area Index (LAI) of the scene based on the plants leaf area.

Arguments

  • scene_area: the area of the scene, usually in m²

Inputs

  • surface: a vector of plant leaf surfaces, usually in m²

Outputs

  • LAI: the Leaf Area Index of the scene, usually in m² m⁻²
  • total_surface: the total surface of the plants, usually in m²
source
PlantSimEngine.Examples.ToyLeafSurfaceModelType
ToyLeafSurfaceModel(SLA)

Computes the individual leaf surface from its biomass using the SLA.

Arguments

  • SLA: the specific leaf area, usually in m² gC⁻¹. Should be understood as the surface area of a leaf per unit of carbon biomass.

Values typically range from 0.002 to 0.027 m² gC⁻¹.

Inputs

  • carbon_biomass: the carbon biomass of the leaf, usually in gC

Outputs

  • surface: the leaf surface, usually in m²
source
PlantSimEngine.Examples.ToyLightPartitioningModelType
ToyLightPartitioningModel()

Computes the light partitioning based on relative surface.

Inputs

  • aPPFD: the absorbed photosynthetic photon flux density at the larger scale (e.g. scene), in mol[PAR] m⁻² time-step⁻¹

Outputs

  • aPPFD: the assimilation or photosynthesis, also sometimes denoted A, in gC time-step⁻¹

Details

source
PlantSimEngine.Examples.ToyMaintenanceRespirationModelType
RmQ10FixedN(Q10, Rm_base, T_ref, P_alive, nitrogen_content)

Maintenance respiration based on a Q10 computation with fixed nitrogen values and proportion of living cells in the organs.

Arguments

  • Q10: Q10 factor (values should usually range between: 1.5 - 2.5, with 2.1 being the most common value)
  • Rm_base: Base maintenance respiration (gC gDM⁻¹ time-step⁻¹). Should be around 0.06.
  • T_ref: Reference temperature at which Q10 was measured (usually around 25.0°C)
  • P_alive: proportion of living cells in the organ
  • nitrogen_content: nitrogen content of the organ (gN gC⁻¹)

Inputs

  • carbon_biomass: the carbon biomass of the organ in gC
source
PlantSimEngine.Examples.ToyPlantLeafSurfaceModelType
ToyPlantLeafSurfaceModel()

Computes the leaf surface at plant scale by summing the individual leaf surfaces.

Inputs

  • leaf_surfaces: a vector of leaf surfaces, usually in m²

Outputs

  • surface: the leaf surface at plant scale, usually in m²
source
PlantSimEngine.Examples.ToyPlantRmModelType
ToyPlantRmModel()

Total plant maintenance respiration based on the sum of Rm_organs, the maintenance respiration of the organs.

Intputs

  • Rm_organs: a vector of maintenance respiration from all organs in the plant in gC time-step⁻¹

Outputs

  • Rm: the total plant maintenance respiration in gC time-step⁻¹
source
PlantSimEngine.Examples.ToyRUEGrowthModelType
ToyRUEGrowthModel(efficiency)

Computes the carbon biomass increment of a plant based on the radiation use efficiency principle.

Arguments

  • efficiency: the radiation use efficiency, in gC[biomass] mol[PAR]⁻¹

Inputs

  • aPPFD: the absorbed photosynthetic photon flux density, in mol[PAR] m⁻² time-step⁻¹

Outputs

  • biomass_increment: the daily biomass increment, in gC[biomass] m⁻² time-step⁻¹
  • biomass: the plant biomass, in gC[biomass] m⁻² time-step⁻¹
source
PlantSimEngine.Examples.ToySoilWaterModelType
ToySoilWaterModel(values=[0.5])

A toy model to compute the soil water content. The model simply take a random value in the values range using rand.

Outputs

  • soil_water_content: the soil water content (%).

Arguments

  • values: a range of soil_water_content values to sample from. Can be a vector of values [0.5,0.6] or a range 0.1:0.1:1.0. Default is [0.5].
source
PlantSimEngine.Examples.import_mtg_exampleMethod
import_mtg_example()

Returns an example multiscale tree graph (MTG) with a scene, a soil, and a plant with two internodes and two leaves.

Examples

julia> using PlantSimEngine.Examples
julia> import_mtg_example()
/ 1: Scene
├─ / 2: Soil
└─ + 3: Plant
   └─ / 4: Internode
      ├─ + 5: Leaf
      └─ < 6: Internode
         └─ + 7: Leaf
source
PlantSimEngine.fitMethod
fit(::Type{Beer}, df; J_to_umol=PlantMeteo.Constants().J_to_umol)

Compute the k parameter of the Beer-Lambert law from measurements.

Arguments

  • ::Type{Beer}: the model type
  • df: a DataFrame with the following columns:
    • aPPFD: the measured absorbed Photosynthetic Photon Flux Density in μmol[PAR] m[leaf]⁻² s⁻¹
    • LAI: the measured leaf area index in m² m⁻²
    • Ri_PAR_f: the measured incident flux of atmospheric radiation in the PAR, in W m[soil]⁻² (== J m[soil]⁻² s⁻¹)

Examples

Import the example models defined in the Examples sub-module:

using PlantSimEngine
using PlantSimEngine.Examples

Create a model list with a Beer model, and fit it to the data:

m = ModelList(Beer(0.6), status=(LAI=2.0,))
meteo = Atmosphere(T=20.0, Wind=1.0, P=101.3, Rh=0.65, Ri_PAR_f=300.0)
run!(m, meteo)
df = DataFrame(aPPFD=m[:aPPFD][1], LAI=m.status.LAI[1], Ri_PAR_f=meteo.Ri_PAR_f[1])
fit(Beer, df)
source
PlantSimEngine.run!Function
run!(::Beer, object, meteo, constants=Constants(), extra=nothing)

Computes the photosynthetic photon flux density (aPPFD, µmol m⁻² s⁻¹) absorbed by an object using the incoming PAR radiation flux (Ri_PAR_f, W m⁻²) and the Beer-Lambert law of light extinction.

Arguments

  • ::Beer: a Beer model, from the model list (i.e. m.light_interception)
  • models: A ModelList struct holding the parameters for the model with

initialisations for LAI (m² m⁻²): the leaf area index.

  • status: the status of the model, usually the model list status (i.e. m.status)
  • meteo: meteorology structure, see Atmosphere
  • constants = PlantMeteo.Constants(): physical constants. See PlantMeteo.Constants for more details
  • extra = nothing: extra arguments, not used here.

Examples

m = ModelList(Beer(0.5), status=(LAI=2.0,))

meteo = Atmosphere(T=20.0, Wind=1.0, P=101.3, Rh=0.65, Ri_PAR_q=300.0)

run!(m, meteo)

m[:aPPFD]
source