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
PlantSimEngine.Examples
PlantSimEngine.Examples.AbstractCarbon_AllocationModel
PlantSimEngine.Examples.AbstractCarbon_AssimilationModel
PlantSimEngine.Examples.AbstractCarbon_BiomassModel
PlantSimEngine.Examples.AbstractCarbon_DemandModel
PlantSimEngine.Examples.AbstractDegreedaysModel
PlantSimEngine.Examples.AbstractGrowthModel
PlantSimEngine.Examples.AbstractLai_DynamicModel
PlantSimEngine.Examples.AbstractLeaf_SurfaceModel
PlantSimEngine.Examples.AbstractLight_InterceptionModel
PlantSimEngine.Examples.AbstractLight_PartitioningModel
PlantSimEngine.Examples.AbstractMaintenance_RespirationModel
PlantSimEngine.Examples.AbstractOrgan_EmergenceModel
PlantSimEngine.Examples.AbstractProcess1Model
PlantSimEngine.Examples.AbstractProcess2Model
PlantSimEngine.Examples.AbstractProcess3Model
PlantSimEngine.Examples.AbstractProcess4Model
PlantSimEngine.Examples.AbstractProcess5Model
PlantSimEngine.Examples.AbstractProcess6Model
PlantSimEngine.Examples.AbstractProcess7Model
PlantSimEngine.Examples.AbstractSoil_WaterModel
PlantSimEngine.Examples.Beer
PlantSimEngine.Examples.Process1Model
PlantSimEngine.Examples.Process2Model
PlantSimEngine.Examples.Process3Model
PlantSimEngine.Examples.Process4Model
PlantSimEngine.Examples.Process5Model
PlantSimEngine.Examples.Process6Model
PlantSimEngine.Examples.Process7Model
PlantSimEngine.Examples.ToyAssimGrowthModel
PlantSimEngine.Examples.ToyAssimModel
PlantSimEngine.Examples.ToyCAllocationModel
PlantSimEngine.Examples.ToyCBiomassModel
PlantSimEngine.Examples.ToyCDemandModel
PlantSimEngine.Examples.ToyDegreeDaysCumulModel
PlantSimEngine.Examples.ToyInternodeEmergence
PlantSimEngine.Examples.ToyLAIModel
PlantSimEngine.Examples.ToyLAIfromLeafAreaModel
PlantSimEngine.Examples.ToyLeafSurfaceModel
PlantSimEngine.Examples.ToyLightPartitioningModel
PlantSimEngine.Examples.ToyMaintenanceRespirationModel
PlantSimEngine.Examples.ToyPlantLeafSurfaceModel
PlantSimEngine.Examples.ToyPlantRmModel
PlantSimEngine.Examples.ToyRUEGrowthModel
PlantSimEngine.Examples.ToySoilWaterModel
PlantSimEngine.Examples.import_mtg_example
PlantSimEngine.fit
PlantSimEngine.run!
Details
PlantSimEngine.Examples
— ModuleA 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()
PlantSimEngine.Examples.AbstractCarbon_AllocationModel
— Typecarbon_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)
PlantSimEngine.Examples.AbstractCarbon_AssimilationModel
— Typecarbon_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)
PlantSimEngine.Examples.AbstractCarbon_BiomassModel
— Typecarbon_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)
PlantSimEngine.Examples.AbstractCarbon_DemandModel
— Typecarbon_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)
PlantSimEngine.Examples.AbstractDegreedaysModel
— TypeDegreedays
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)
PlantSimEngine.Examples.AbstractGrowthModel
— Typegrowth
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)
PlantSimEngine.Examples.AbstractLai_DynamicModel
— TypeLAI_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)
PlantSimEngine.Examples.AbstractLeaf_SurfaceModel
— Typeleaf_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)
PlantSimEngine.Examples.AbstractLight_InterceptionModel
— Typelight_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)
PlantSimEngine.Examples.AbstractLight_PartitioningModel
— Typelight_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)
PlantSimEngine.Examples.AbstractMaintenance_RespirationModel
— Typemaintenance_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)
PlantSimEngine.Examples.AbstractOrgan_EmergenceModel
— Typeorgan_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)
PlantSimEngine.Examples.AbstractProcess1Model
— Typeprocess1
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)
PlantSimEngine.Examples.AbstractProcess2Model
— Typeprocess2
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)
PlantSimEngine.Examples.AbstractProcess3Model
— Typeprocess3
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)
PlantSimEngine.Examples.AbstractProcess4Model
— Typeprocess4
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)
PlantSimEngine.Examples.AbstractProcess5Model
— Typeprocess5
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)
PlantSimEngine.Examples.AbstractProcess6Model
— Typeprocess6
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)
PlantSimEngine.Examples.AbstractProcess7Model
— Typeprocess7
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)
PlantSimEngine.Examples.AbstractSoil_WaterModel
— Typesoil_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)
PlantSimEngine.Examples.Beer
— TypeBeer(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⁻¹.
PlantSimEngine.Examples.Process1Model
— TypeProcess1Model(a)
A dummy model implementing a "process1" process for testing purposes.
PlantSimEngine.Examples.Process2Model
— TypeProcess2Model()
A dummy model implementing a "process2" process for testing purposes.
PlantSimEngine.Examples.Process3Model
— TypeProcess3Model()
A dummy model implementing a "process3" process for testing purposes.
PlantSimEngine.Examples.Process4Model
— TypeProcess4Model()
A dummy model implementing a "process4" process for testing purposes. It computes the inputs needed for the coupled processes 1-2-3.
PlantSimEngine.Examples.Process5Model
— TypeProcess5Model()
A dummy model implementing a "process5" process for testing purposes. It needs the outputs from the coupled processes 1-2-3.
PlantSimEngine.Examples.Process6Model
— TypeProcess6Model()
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.
PlantSimEngine.Examples.Process7Model
— TypeProcess7Model()
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.
PlantSimEngine.Examples.ToyAssimGrowthModel
— TypeToyAssimGrowthModel(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 respirationRg_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⁻¹
PlantSimEngine.Examples.ToyAssimModel
— TypeToyAssimModel(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 denotedA
, 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⁻¹.
PlantSimEngine.Examples.ToyCAllocationModel
— TypeToyCAllocationModel()
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⁻¹.
PlantSimEngine.Examples.ToyCBiomassModel
— TypeToyCBiomassModel(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 gCgrowth_respiration
: the growth respiration, usually in gC time-step⁻¹
PlantSimEngine.Examples.ToyCDemandModel
— TypeToyCDemandModel(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 gCdevelopment_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
PlantSimEngine.Examples.ToyDegreeDaysCumulModel
— TypeToyDegreeDaysCumulModel(;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.
PlantSimEngine.Examples.ToyInternodeEmergence
— TypeToyInternodeEmergence(;init_TT=0.0, TT_emergence = 300)
Computes the organ emergence based on cumulated thermal time since last event.
PlantSimEngine.Examples.ToyLAIModel
— TypeToyLAIModel(;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 valuedd_incslope
: the thermal time at which the LAI starts to increaseinc_slope
: the slope of the increasedd_decslope
: the thermal time at which the LAI starts to decreasedec_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⁻²
PlantSimEngine.Examples.ToyLAIfromLeafAreaModel
— TypeToyLAIfromLeafAreaModel()
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²
PlantSimEngine.Examples.ToyLeafSurfaceModel
— TypeToyLeafSurfaceModel(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²
PlantSimEngine.Examples.ToyLightPartitioningModel
— TypeToyLightPartitioningModel()
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 denotedA
, in gC time-step⁻¹
Details
PlantSimEngine.Examples.ToyMaintenanceRespirationModel
— TypeRmQ10FixedN(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 organnitrogen_content
: nitrogen content of the organ (gN gC⁻¹)
Inputs
carbon_biomass
: the carbon biomass of the organ in gC
PlantSimEngine.Examples.ToyPlantLeafSurfaceModel
— TypeToyPlantLeafSurfaceModel()
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²
PlantSimEngine.Examples.ToyPlantRmModel
— TypeToyPlantRmModel()
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⁻¹
PlantSimEngine.Examples.ToyRUEGrowthModel
— TypeToyRUEGrowthModel(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⁻¹
PlantSimEngine.Examples.ToySoilWaterModel
— TypeToySoilWaterModel(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 ofsoil_water_content
values to sample from. Can be a vector of values[0.5,0.6]
or a range0.1:0.1:1.0
. Default is[0.5]
.
PlantSimEngine.Examples.import_mtg_example
— Methodimport_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
PlantSimEngine.fit
— Methodfit(::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 typedf
: aDataFrame
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)
PlantSimEngine.run!
— Functionrun!(::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
: AModelList
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, seeAtmosphere
constants = PlantMeteo.Constants()
: physical constants. SeePlantMeteo.Constants
for more detailsextra = 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]