Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how computations are made over MTGs #51

Merged
merged 97 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
4f5c686
Update init_mtg_models.jl
VEZY Sep 8, 2023
f6f4544
Update Status.jl
VEZY Sep 8, 2023
5ada52b
Make tests pass for mtg
VEZY Sep 8, 2023
957ec8f
Create RefVector.jl
VEZY Sep 8, 2023
7ec5a73
Update PlantSimEngine.jl
VEZY Sep 8, 2023
a2c91d7
Update Status.jl
VEZY Sep 8, 2023
10b3ccb
Update Status.jl
VEZY Sep 12, 2023
242e180
Add toy models for multiscale models
VEZY Sep 14, 2023
127c5d7
Update ModelList.jl
VEZY Sep 14, 2023
23be959
Update RefVector.jl
VEZY Sep 14, 2023
cf02b75
Create MultiScaleModel.jl
VEZY Sep 14, 2023
831e10c
import multiscale toy models in tests
VEZY Sep 14, 2023
cab5994
Create mapping.jl
VEZY Sep 14, 2023
d72e7e1
Update PlantSimEngine.jl
VEZY Sep 14, 2023
26fc0bf
Make default status from mtg model list + check if missing init
VEZY Sep 18, 2023
0112b78
Simplify the code for MTG
VEZY Sep 18, 2023
baf923c
Add doc to compute_mapping
VEZY Sep 21, 2023
703d974
Update mapping.jl
VEZY Sep 26, 2023
365965e
Update mapping.jl
VEZY Sep 27, 2023
925ba50
Update mapping.jl
VEZY Sep 27, 2023
4b9ee45
Update mapping.jl
VEZY Sep 27, 2023
404d680
Update mapping.jl
VEZY Sep 27, 2023
963bd1b
Update mapping.jl
VEZY Sep 27, 2023
0f099b7
De-reference PlantSimEngine
VEZY Sep 27, 2023
ffc6b17
Update soft_dependencies.jl
VEZY Sep 29, 2023
d68d5e2
Update mapping.jl
VEZY Sep 29, 2023
425659d
Update dependency_graph.jl
VEZY Sep 29, 2023
9ae6af1
Update RefVector.jl
VEZY Sep 29, 2023
a8d88d9
Create multi-scale_dependencies.jl
VEZY Sep 29, 2023
9f1636e
Update multi-scale_dependencies.jl
VEZY Oct 2, 2023
59407dc
Update soft_dependencies.jl
VEZY Oct 2, 2023
266ed23
Add multi-scale_dependencies.jl
VEZY Oct 2, 2023
db2e401
Add more doc
VEZY Oct 2, 2023
f0578ac
End-of-day commit (a little bit of everything)
VEZY Oct 2, 2023
3c9ccf6
Make the simulation work on an mtg
VEZY Oct 3, 2023
15bcae0
Update example models that use MTG (now simpler implementation)
VEZY Oct 3, 2023
86c56ef
Update Project.toml
VEZY Oct 3, 2023
35a78bf
Update mapping.jl
VEZY Oct 3, 2023
cf90b23
Update mapping.jl
VEZY Oct 3, 2023
cd5ddcf
Add test-mtg-multiscale.jl
VEZY Oct 3, 2023
4c52eda
Update model_initialisation.jl
VEZY Oct 4, 2023
9bb339b
Update mapping.jl
VEZY Oct 4, 2023
0784aba
Update model_initialisation.jl
VEZY Oct 4, 2023
b628f65
model() and mapping() are internals, using suffix `_` in their names
VEZY Oct 4, 2023
a88f88d
Update model_initialisation.jl
VEZY Oct 4, 2023
bb35c06
Add vars_not_propagated in ModelList
VEZY Oct 4, 2023
c618294
Update dummy.jl
VEZY Oct 4, 2023
b2732d2
Better handle initializations over several time-steps for ModelList +…
VEZY Oct 4, 2023
8bee011
Update tests accordingly
VEZY Oct 4, 2023
9a4ddda
Fix doctests
VEZY Oct 5, 2023
64be9eb
Remove `PlantSimEngine.` in the code
VEZY Oct 5, 2023
db6dce6
Update CI.yml
VEZY Oct 5, 2023
20ec2d0
Adapt tests to julia V<1.8
VEZY Oct 5, 2023
66db07e
Add get_nsteps
VEZY Oct 6, 2023
1a7046a
Update PlantSimEngine.jl
VEZY Oct 6, 2023
dc568f0
Now we can get any variable in dynamic for the MTG
VEZY Oct 6, 2023
38b05be
Update mapping.jl
VEZY Oct 6, 2023
00110e4
Update run.jl
VEZY Oct 6, 2023
0469a00
Update test-mtg-multiscale.jl
VEZY Oct 6, 2023
be2ec5d
outputs is now `nothing` by default
VEZY Oct 6, 2023
5d72770
Update Project.toml
VEZY Oct 6, 2023
ff07372
Update test-mtg-multiscale.jl
VEZY Oct 6, 2023
8a7fe24
Fix issue in doc for `pre_allocate_outputs`
VEZY Oct 6, 2023
bc54f23
Update run.jl
VEZY Oct 6, 2023
38416af
Add more tests on multiscale with several time-steps
VEZY Oct 6, 2023
6765f50
`multiscale_dep` becomes `dep`, as for the other cases
VEZY Oct 7, 2023
f7dd52b
Divide more the dep method for multiscale model mapping
VEZY Oct 7, 2023
de672c6
Update dependencies.jl
VEZY Oct 7, 2023
d103692
Add methods for mapping I/O
VEZY Oct 9, 2023
49cf25e
Fix doc
VEZY Oct 10, 2023
c9eade8
Update TimeStepTable.jl
VEZY Oct 13, 2023
8c84145
Clarify status/outputs from GraphSimulation + clean-up the code
VEZY Oct 13, 2023
e4aa5a8
Make tests pass
VEZY Oct 20, 2023
3307fd1
Add a function to import all example models for MTG
VEZY Oct 24, 2023
0f776a1
Update examples_import.jl
VEZY Nov 6, 2023
55c2699
Update mapping.jl
VEZY Nov 6, 2023
dbdcc3e
Fix all example scripts
VEZY Nov 6, 2023
5b1ed3c
Update degree_days into TT
VEZY Nov 6, 2023
e27c5d9
Update examples_import.jl
VEZY Nov 6, 2023
af0d3f1
Update doc accordingly
VEZY Nov 6, 2023
322b589
forgot readme
VEZY Nov 6, 2023
c701612
Add doc for multi-scale simulation
VEZY Nov 6, 2023
1a41dcf
Fix depreciation warning
VEZY Nov 13, 2023
4b30713
Replace include([examples]) by using PlantSimEngine.Examples
VEZY Nov 13, 2023
fbd286b
Update mtg tests
VEZY Nov 13, 2023
01f05fd
Update examples_import.jl
VEZY Nov 13, 2023
e3f71cd
Remove old MTG simulation functions
VEZY Nov 13, 2023
3bb1bdc
Update multiscale.md
VEZY Nov 13, 2023
da64154
Update make.jl
VEZY Nov 13, 2023
0c6a909
Reformat mtg initialisation
VEZY Nov 22, 2023
2b79ea5
Add more info into the GraphSimulation
VEZY Nov 23, 2023
906f0c1
Add ToyInternodeEmergence example
VEZY Nov 23, 2023
dbded6c
Remove info from copute_mapping (happens too often)
VEZY Nov 23, 2023
fa528e1
Add add_organ!
VEZY Nov 23, 2023
4288505
Add test-mtg-dynamic.jl
VEZY Nov 23, 2023
96a0277
Add compat for stdlibs
VEZY Nov 23, 2023
70477a1
Update Project.toml
VEZY Nov 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ jobs:
matrix:
version:
- "1.7"
- "1.8"
- "nightly"
- "1"
os:
- ubuntu-latest
arch:
Expand Down
5 changes: 5 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.8.2"
[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FLoops = "cc61a311-1640-44b5-9fba-1b764f453329"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Expand All @@ -18,12 +19,16 @@ Term = "22787eb5-b846-44ae-b979-8e399b8463ab"
[compat]
AbstractTrees = "0.4"
CSV = "0.10"
DataAPI = "1.15"
DataFrames = "1"
FLoops = "0.2"
Markdown = "1.7"
MultiScaleTreeGraph = "0.12"
PlantMeteo = "0.6"
Statistics = "1.7"
Tables = "1"
Term = "1, 2"
Test = "1.7"
julia = "1.7"

[extras]
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Here's a simple example of a model that simulates the growth of a plant, using a
# ] add PlantSimEngine
using PlantSimEngine

# Include the model definition from the examples folder:
include(joinpath(pkgdir(PlantSimEngine), "examples/ToyLAIModel.jl"))
# Include the model definition from the examples sub-module:
using PlantSimEngine.Examples

# Define the model:
model = ModelList(
ToyLAIModel(),
status=(degree_days_cu=1.0:2000.0,), # Pass the cumulated degree-days as input to the model
status=(TT_cu=1.0:2000.0,), # Pass the cumulated degree-days as input to the model
)

run!(model) # run the model
Expand All @@ -71,9 +71,9 @@ status(model) # extract the status, i.e. the output of the model
Which gives:

```
TimeStepTable{Status{(:degree_days_cu, :LAI...}(1300 x 2):
TimeStepTable{Status{(:TT_cu, :LAI...}(1300 x 2):
╭─────┬────────────────┬────────────╮
│ Row │ degree_days_cu │ LAI │
│ Row │ TT_cu │ LAI │
│ │ Float64 │ Float64 │
├─────┼────────────────┼────────────┤
│ 1 │ 1.0 │ 0.00560052 │
Expand All @@ -95,7 +95,7 @@ Of course you can plot the outputs quite easily:
# ] add CairoMakie
using CairoMakie

lines(model[:degree_days_cu], model[:LAI], color=:green, axis=(ylabel="LAI (m² m⁻²)", xlabel="Cumulated growing degree days since sowing (°C)"))
lines(model[:TT_cu], model[:LAI], color=:green, axis=(ylabel="LAI (m² m⁻²)", xlabel="Cumulated growing degree days since sowing (°C)"))
```

![LAI Growth](examples/LAI_growth.png)
Expand All @@ -109,8 +109,7 @@ Model coupling is done automatically by the package, and is based on the depende
using PlantSimEngine, PlantMeteo, DataFrames, CSV

# Include the model definition from the examples folder:
include(joinpath(pkgdir(PlantSimEngine), "examples/ToyLAIModel.jl"))
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
using PlantSimEngine.Examples

# Import the example meteorological data:
meteo_day = CSV.read(joinpath(pkgdir(PlantSimEngine), "examples/meteo_day.csv"), DataFrame, header=18)
Expand All @@ -119,7 +118,7 @@ meteo_day = CSV.read(joinpath(pkgdir(PlantSimEngine), "examples/meteo_day.csv"),
model = ModelList(
ToyLAIModel(),
Beer(0.6),
status=(degree_days_cu=cumsum(meteo_day[:, :degree_days]),), # Pass the cumulated degree-days as input to `ToyLAIModel`, this could also be done using another model
status=(TT_cu=cumsum(meteo_day[:, :TT]),), # Pass the cumulated degree-days as input to `ToyLAIModel`, this could also be done using another model
)
```

Expand Down Expand Up @@ -152,9 +151,9 @@ status(model)
Which returns:

```
TimeStepTable{Status{(:degree_days_cu, :LAI...}(365 x 3):
TimeStepTable{Status{(:TT_cu, :LAI...}(365 x 3):
╭─────┬────────────────┬────────────┬───────────╮
│ Row │ degree_days_cu │ LAI │ aPPFD │
│ Row │ TT_cu │ LAI │ aPPFD │
│ │ Float64 │ Float64 │ Float64 │
├─────┼────────────────┼────────────┼───────────┤
│ 1 │ 0.0 │ 0.00554988 │ 0.0476221 │
Expand All @@ -173,10 +172,10 @@ using CairoMakie

fig = Figure(resolution=(800, 600))
ax = Axis(fig[1, 1], ylabel="LAI (m² m⁻²)")
lines!(ax, model[:degree_days_cu], model[:LAI], color=:mediumseagreen)
lines!(ax, model[:TT_cu], model[:LAI], color=:mediumseagreen)

ax2 = Axis(fig[2, 1], xlabel="Cumulated growing degree days since sowing (°C)", ylabel="aPPFD (mol m⁻² d⁻¹)")
lines!(ax2, model[:degree_days_cu], model[:aPPFD], color=:firebrick1)
lines!(ax2, model[:TT_cu], model[:aPPFD], color=:firebrick1)

fig
```
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
MultiScaleTreeGraph = "dd4a991b-8a45-4075-bede-262ee62d5583"
PlantMeteo = "4630fe09-e0fb-4da5-a846-781cb73437b6"
PlantSimEngine = "9a576370-710b-4269-adf9-4f603a9c6423"
12 changes: 8 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ DocMeta.setdocmeta!(PlantSimEngine, :DocTestSetup, :(using PlantSimEngine, Plant
makedocs(;
modules=[PlantSimEngine],
authors="Rémi Vezy <[email protected]> and contributors",
repo="https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/{commit}{path}#{line}",
repo=Documenter.Remotes.GitHub("VirtualPlantLab", "PlantSimEngine.jl"),
sitename="PlantSimEngine.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://VirtualPlantLab.github.io/PlantSimEngine.jl",
edit_link="main",
assets=String[]
assets=String[],
size_threshold=250000
),
pages=[
"Home" => "index.md",
Expand All @@ -30,7 +31,10 @@ makedocs(;
"Input types" => "./extending/inputs.md",
],
"Coupling" => [
"Users" => "./model_coupling/model_coupling_user.md",
"Users" => [
"Simple case" => "./model_coupling/model_coupling_user.md",
"Multi-scale modelling" => "./model_coupling/multiscale.md",
],
"Modelers" => "./model_coupling/model_coupling_modeler.md",
],
"FAQ" => ["./FAQ/translate_a_model.md"],
Expand All @@ -39,6 +43,6 @@ makedocs(;
)

deploydocs(;
repo="github.com/VirtualPlantLab/PlantSimEngine.jl",
repo="github.com/VirtualPlantLab/PlantSimEngine.jl.git",
devbranch="main"
)
18 changes: 17 additions & 1 deletion docs/src/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,20 @@ Private functions, types or constants from `PlantSimEngine`. These are not expor
Modules = [PlantSimEngine]
Public = false
Private = true
```
```

## 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, you can simply use this sub-module:

```julia
using PlantSimEngine.Examples
```

The models are detailed below.

```@autodocs
Modules = [PlantSimEngine.Examples]
Public = true
Private = true
```
27 changes: 14 additions & 13 deletions docs/src/FAQ/translate_a_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
using PlantSimEngine
using CairoMakie
using CSV, DataFrames
include(joinpath(pkgdir(PlantSimEngine), "examples/ToyLAIModel.jl"))
# Import the example models defined in the `Examples` sub-module:
using PlantSimEngine.Examples

function lai_toymodel(degree_days_cu; max_lai=8.0, dd_incslope=500, inc_slope=70, dd_decslope=1000, dec_slope=20)
LAI = max_lai * (1 / (1 + exp((dd_incslope - degree_days_cu) / inc_slope)) - 1 / (1 + exp((dd_decslope - degree_days_cu) / dec_slope)))
function lai_toymodel(TT_cu; max_lai=8.0, dd_incslope=500, inc_slope=70, dd_decslope=1000, dec_slope=20)
LAI = max_lai * (1 / (1 + exp((dd_incslope - TT_cu) / inc_slope)) - 1 / (1 + exp((dd_decslope - TT_cu) / dec_slope)))
if LAI < 0
LAI = 0
end
Expand All @@ -33,15 +34,15 @@ Simulate leaf area index (LAI, m² m⁻²) for a crop based on the amount of deg

# Arguments

- `degree_days_cu`: degree-days since sowing
- `TT_cu`: degree-days since sowing
- `max_lai=8`: Maximum value for LAI
- `dd_incslope=500`: degree-days at which we get the maximal increase in LAI
- `inc_slope=5`: slope of the increasing part of the LAI curve
- `dd_decslope=1000`: degree-days at which we get the maximal decrease in LAI
- `dec_slope=2`: slope of the decreasing part of the LAI curve
"""
function lai_toymodel(degree_days_cu; max_lai=8.0, dd_incslope=500, inc_slope=70, dd_decslope=1000, dec_slope=20)
LAI = max_lai * (1 / (1 + exp((dd_incslope - degree_days_cu) / inc_slope)) - 1 / (1 + exp((dd_decslope - degree_days_cu) / dec_slope)))
function lai_toymodel(TT_cu; max_lai=8.0, dd_incslope=500, inc_slope=70, dd_decslope=1000, dec_slope=20)
LAI = max_lai * (1 / (1 + exp((dd_incslope - TT_cu) / inc_slope)) - 1 / (1 + exp((dd_decslope - TT_cu) / dec_slope)))
if LAI < 0
LAI = 0
end
Expand Down Expand Up @@ -96,7 +97,7 @@ This way users can create a model with default parameters just by calling `ToyLA
Then we can define the inputs and outputs of the model, and the default value at initialization:

```julia
PlantSimEngine.inputs_(::ToyLAIModel) = (degree_days_cu=-Inf,)
PlantSimEngine.inputs_(::ToyLAIModel) = (TT_cu=-Inf,)
PlantSimEngine.outputs_(::ToyLAIModel) = (LAI=-Inf,)
```

Expand All @@ -109,7 +110,7 @@ Finally, we can define the model function that will be called at each time step:

```julia
function PlantSimEngine.run!(::ToyLAIModel, models, status, meteo, constants=nothing, extra=nothing)
status.LAI = models.LAI_Dynamic.max_lai * (1 / (1 + exp((models.LAI_Dynamic.dd_incslope - status.degree_days_cu) / model.LAI_Dynamic.inc_slope)) - 1 / (1 + exp((models.LAI_Dynamic.dd_decslope - status.degree_days_cu) / models.LAI_Dynamic.dec_slope)))
status.LAI = models.LAI_Dynamic.max_lai * (1 / (1 + exp((models.LAI_Dynamic.dd_incslope - status.TT_cu) / model.LAI_Dynamic.inc_slope)) - 1 / (1 + exp((models.LAI_Dynamic.dd_decslope - status.TT_cu) / models.LAI_Dynamic.dec_slope)))

if status.LAI < 0
status.LAI = 0
Expand Down Expand Up @@ -138,21 +139,21 @@ period = [Dates.Date("2021-01-01"), Dates.Date("2021-12-31")]
meteo = get_weather(43.649777, 3.869889, period, sink = DataFrame)

# Compute the degree-days with a base temperature of 10°C:
meteo.degree_days = max.(meteo.T .- 10.0, 0.0)
meteo.TT = max.(meteo.T .- 10.0, 0.0)

# Aggregate the weather data to daily values:
meteo_day = to_daily(meteo, :degree_days => (x -> sum(x) / 24) => :degree_days)
meteo_day = to_daily(meteo, :TT => (x -> sum(x) / 24) => :TT)
```

Then we can define our list of models, passing the values for `degree_days_cu` in the status at initialization:
Then we can define our list of models, passing the values for `TT_cu` in the status at initialization:

```@example mymodel
m = ModelList(
ToyLAIModel(),
status = (degree_days_cu = cumsum(meteo_day.degree_days),),
status = (TT_cu = cumsum(meteo_day.TT),),
)

run!(m)

lines(m[:degree_days_cu], m[:LAI], color=:green, axis=(ylabel="LAI (m² m⁻²)", xlabel="Days since sowing"))
lines(m[:TT_cu], m[:LAI], color=:green, axis=(ylabel="LAI (m² m⁻²)", xlabel="Days since sowing"))
```
10 changes: 5 additions & 5 deletions docs/src/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```@setup usepkg
using PlantSimEngine, PlantMeteo
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
using PlantSimEngine.Examples
meteo = Atmosphere(T = 20.0, Wind = 1.0, Rh = 0.65, Ri_PAR_f = 500.0)
leaf = ModelList(Beer(0.5), status = (LAI = 2.0,))
run!(leaf, meteo)
Expand Down Expand Up @@ -56,10 +56,10 @@ Importing the package:
using PlantSimEngine
```

Including the script that defines `light_interception` and `Beer`:
Import the examples defined in the `Examples` sub-module (`light_interception` and `Beer`):

```julia
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
using PlantSimEngine.Examples
```

And then making a [`ModelList`](@ref) with the `Beer` model:
Expand Down Expand Up @@ -187,8 +187,8 @@ For example we can simulate the `light_interception` of a leaf like so:
```@example usepkg
using PlantSimEngine, PlantMeteo

# Including the script defining light_interception and Beer:
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
# Import the examples defined in the `Examples` sub-module
using PlantSimEngine.Examples

meteo = Atmosphere(T = 20.0, Wind = 1.0, Rh = 0.65, Ri_PAR_f = 500.0)

Expand Down
7 changes: 4 additions & 3 deletions docs/src/extending/implement_a_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ In those files, you'll see that in order to implement a new model you'll need to

If you create your own process, the function will print a short tutorial on how to do all that, adapted to the process you just created (see [Implement a new process](@ref)).

In this page, we'll just implement a model for a process that already exists: the light interception. This process is defined in `PlantBiophysics.jl`, but also in an example script in `PlantSimEngine.jl` here: [`examples/Beer.jl`](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/examples/Beer.jl).
In this page, we'll just implement a model for a process that already exists: the light interception. This process is defined in `PlantBiophysics.jl`, and also made available as an example model from the `Examples` sub-module. You can access the script from here: [`examples/Beer.jl`](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/examples/Beer.jl).

We can include this file like so:
We can import the model like so:

```julia
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
# Import the example models defined in the `Examples` sub-module:
using PlantSimEngine.Examples
```

But instead of just using it, we will review the script line by line.
Expand Down
6 changes: 4 additions & 2 deletions docs/src/fitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

```@setup usepkg
using PlantSimEngine, PlantMeteo, DataFrames, Statistics
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
using PlantSimEngine.Examples

meteo = Atmosphere(T=20.0, Wind=1.0, P=101.3, Rh=0.65, Ri_PAR_f=300.0)
m = ModelList(Beer(0.6), status=(LAI=2.0,))
run!(m, meteo)
Expand Down Expand Up @@ -42,7 +43,8 @@ Importing the script first:

```julia
using PlantSimEngine, PlantMeteo, DataFrames, Statistics
include(joinpath(pkgdir(PlantSimEngine), "examples/Beer.jl"))
# Import the examples defined in the `Examples` sub-module:
using PlantSimEngine.Examples
```

Defining the meteo data:
Expand Down
Loading
Loading