Skip to content

Commit 7e352d4

Browse files
authored
Merge pull request #128 from VirtualPlantLab/Outputs-filtering2
Outputs filtering ; see comments for detailed summary of most changes
2 parents 04963d9 + e869589 commit 7e352d4

105 files changed

Lines changed: 9764 additions & 2334 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/Integration.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
arch:
3333
- x64
3434
package:
35-
#- {user: PalmStudio, repo: XPalm.jl}
36-
- {user: VEZY, repo: PlantBioPhysics.jl}
35+
- {user: PalmStudio, repo: XPalm.jl, branch: PSE-API-changes}
36+
- {user: VEZY, repo: PlantBioPhysics.jl, branch: ModelList-outputs-filtering-changes}
3737
steps:
3838
- uses: actions/checkout@v4
3939
- uses: julia-actions/setup-julia@v2
@@ -45,6 +45,7 @@ jobs:
4545
uses: actions/checkout@v4
4646
with:
4747
repository: ${{ matrix.package.user }}/${{ matrix.package.repo }}
48+
ref: ${{matrix.package.branch}}
4849
path: downstream
4950
- name: Load this and run the downstream tests
5051
shell: julia --threads 4 --color=yes --project=downstream --depwarn=yes {0}

README.md

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,54 @@
99
[![DOI](https://zenodo.org/badge/571659510.svg)](https://zenodo.org/badge/latestdoi/571659510)
1010
[![JOSS](https://joss.theoj.org/papers/137e3e6c2ddc349bec39e06bb04e4e09/status.svg)](https://joss.theoj.org/papers/137e3e6c2ddc349bec39e06bb04e4e09)
1111

12+
- [PlantSimEngine](#plantsimengine)
13+
- [Overview](#overview)
14+
- [Unique Features](#unique-features)
15+
- [Automatic Model Coupling](#automatic-model-coupling)
16+
- [Flexibility with Precision Control](#flexibility-with-precision-control)
17+
- [Batteries included](#batteries-included)
18+
- [Ask Questions](#ask-questions)
19+
- [Installation](#installation)
20+
- [Example usage](#example-usage)
21+
- [Simple example](#simple-example)
22+
- [Model coupling](#model-coupling)
23+
- [Multiscale modelling](#multiscale-modelling)
24+
- [Projects that use PlantSimEngine](#projects-that-use-plantsimengine)
25+
- [Performance](#performance)
26+
- [Make it yours](#make-it-yours)
1227

1328
## Overview
1429

15-
`PlantSimEngine` is a modelling framework for simulating and modelling plants, soil and atmosphere. It provides tools to **prototype, evaluate, test, and deploy** plant/crop models at any scale, with a strong emphasis on performance and efficiency.
30+
`PlantSimEngine` is a comprehensive framework for building models of the soil-plant-atmosphere continuum. It includes everything you need to **prototype, evaluate, test, and deploy** plant/crop models at any scale, with a strong emphasis on performance and efficiency, so you can focus on building and refining your models.
1631

17-
**Key Features:**
32+
**Why choose PlantSimEngine?**
1833

19-
- Process Definition: Easily define new processes such as light interception, photosynthesis, growth, soil water transfer, and more.
20-
- Interactive Prototyping: Fast and interactive prototyping of models with built-in constraints to avoid errors and sensible defaults to streamline the model writing process.
21-
- Control Degrees of Freedom: Fix variables, pass measurements, or use simpler models for specific processes to reduce complexity.
22-
- Automatic Management: The package automatically manages input and output variables, time-steps, objects, and the coupling of models using a dependency graph.
23-
- Flexible Model Switching: Switch between models without changing any code, using a simple syntax to specify the model for a given process.
24-
- Integrated Data Use: Force variables to take measured values instead of model predictions, reducing degrees of freedom during model development and increasing accuracy during production mode.
25-
- High-Performance Computation: Achieve high-speed computations, with benchmarks showing operations in the 100th of nanoseconds range for complex models (see this [benchmark script](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/examples/benchmark.jl)).
26-
- Parallel and Distributed Computing: Out-of-the-box support for sequential, multi-threaded, or distributed computations over objects, time-steps, and independent processes, thanks to [Floops.jl](https://juliafolds.github.io/FLoops.jl/stable/).
27-
- Scalability: Scale easily with methods for computing over objects, time-steps, and [Multi-Scale Tree Graphs](https://github.com/VEZY/MultiScaleTreeGraph.jl).
28-
- Composability: Use any types as inputs, including [Unitful](https://github.com/PainterQubits/Unitful.jl) for unit propagation and [MonteCarloMeasurements.jl](https://github.com/baggepinnen/MonteCarloMeasurements.jl) for propagating measurement error.
34+
- **Simplicity**: Write less code, focus on your model's logic, and let the framework handle the rest.
35+
- **Modularity**: Each model component can be developed, tested, and improved independently. Assemble complex simulations by reusing pre-built, high-quality modules.
36+
- **Standardisation**: Clear, enforceable guidelines ensure that all models adhere to best practices. This built-in consistency means that once you implement a model, it works seamlessly with others in the ecosystem.
37+
- **Optimised Performance**: Don't re-invent the wheel. Delegating low-level tasks to PlantSimEngine guarantees that your model will benefit from every improvement in the framework. Enjoy faster prototyping, robust simulations, and efficient execution using Julia's high-performance capabilities.
2938

30-
**Benefits:**
39+
## Unique Features
3140

32-
Improved Accuracy and Reliability:
41+
### Automatic Model Coupling
3342

34-
- Enhance the accuracy of plant growth and yield predictions by integrating detailed physiological processes and environmental interactions.
35-
- Reduced Modeling Time: Streamline the modeling process with automated management and fast prototyping capabilities.
36-
- Collaborative Research: Facilitate collaborative research efforts with flexible and composable modeling tools.
43+
**Seamless Integration:** PlantSimEngine leverages Julia's multiple-dispatch capabilities to automatically compute the dependency graph between models. This allows researchers to effortlessly couple models without writing complex connection code or manually managing dependencies.
44+
45+
**Intuitive Multi-Scale Support:** The framework naturally handles models operating at different scales—from organelle to ecosystem—connecting them with minimal effort and maintaining consistency across scales.
46+
47+
### Flexibility with Precision Control
48+
49+
**Effortless Model Switching:** Researchers can switch between different component models using a simple syntax without rewriting the underlying model code. This enables rapid comparison between different hypotheses and model versions, accelerating the scientific discovery process.
50+
51+
## Batteries included
52+
53+
- **Automated Management**: Seamlessly handle inputs, outputs, time-steps, objects, and dependency resolution.
54+
- **Iterative Development**: Fast and interactive prototyping of models with built-in constraints to avoid errors and sensible defaults to streamline the model writing process.
55+
- **Control Your Degrees of Freedom**: Fix variables to constant values or force to observations, use simpler models for specific processes to reduce complexity.
56+
- **High-Speed Computations**: Achieve impressive performance with benchmarks showing operations in the 100th of nanoseconds range for complex models (see this [benchmark script](https://github.com/VirtualPlantLab/PlantSimEngine.jl/blob/main/examples/benchmark.jl)).
57+
- **Parallelize and Distribute Computing**: Out-of-the-box support for sequential, multi-threaded, or distributed computations over objects, time-steps, and independent processes, thanks to [Floops.jl](https://juliafolds.github.io/FLoops.jl/stable/).
58+
- **Scale Effortlessly**: Methods for computing over objects, time-steps, and [Multi-Scale Tree Graphs](https://github.com/VEZY/MultiScaleTreeGraph.jl).
59+
- **Compose Freely**: Use any types as inputs, including [Unitful](https://github.com/PainterQubits/Unitful.jl) for unit propagation and [MonteCarloMeasurements.jl](https://github.com/baggepinnen/MonteCarloMeasurements.jl) for measurement error propagation.
3760

3861
## Ask Questions
3962

@@ -57,7 +80,7 @@ using PlantSimEngine
5780

5881
The package is designed to be easy to use, and to help users avoid errors when implementing, coupling and simulating models.
5982

60-
### Simple example
83+
### Simple example
6184

6285
Here's a simple example of a model that simulates the growth of a plant, using a simple exponential growth model:
6386

@@ -193,55 +216,55 @@ fig
193216

194217
![LAI Growth and light interception](examples/LAI_growth2.png)
195218

196-
### Multiscale modelling
219+
### Multiscale modelling
197220

198-
> See the [Multi-scale modeling](#multi-scale-modeling) section for more details.
221+
> See the Multi-scale modeling section of the docs for more details.
199222
200223
The package is designed to be easily scalable, and can be used to simulate models at different scales. For example, you can simulate a model at the leaf scale, and then couple it with models at any other scale, *e.g.* internode, plant, soil, scene scales. Here's an example of a simple model that simulates plant growth using sub-models operating at different scales:
201224

202-
```@example readme
225+
```julia
203226
mapping = Dict(
204227
"Scene" => ToyDegreeDaysCumulModel(),
205228
"Plant" => (
206229
MultiScaleModel(
207230
model=ToyLAIModel(),
208-
mapping=[
231+
mapped_variables=[
209232
:TT_cu => "Scene",
210233
],
211234
),
212235
Beer(0.6),
213236
MultiScaleModel(
214237
model=ToyAssimModel(),
215-
mapping=[:soil_water_content => "Soil"],
238+
mapped_variables=[:soil_water_content => "Soil"],
216239
),
217240
MultiScaleModel(
218241
model=ToyCAllocationModel(),
219-
mapping=[
242+
mapped_variables=[
220243
:carbon_demand => ["Leaf", "Internode"],
221244
:carbon_allocation => ["Leaf", "Internode"]
222245
],
223246
),
224247
MultiScaleModel(
225248
model=ToyPlantRmModel(),
226-
mapping=[:Rm_organs => ["Leaf" => :Rm, "Internode" => :Rm],],
249+
mapped_variables=[:Rm_organs => ["Leaf" => :Rm, "Internode" => :Rm],],
227250
),
228251
),
229252
"Internode" => (
230253
MultiScaleModel(
231254
model=ToyCDemandModel(optimal_biomass=10.0, development_duration=200.0),
232-
mapping=[:TT => "Scene",],
255+
mapped_variables=[:TT => "Scene",],
233256
),
234257
MultiScaleModel(
235258
model=ToyInternodeEmergence(TT_emergence=20.0),
236-
mapping=[:TT_cu => "Scene"],
259+
mapped_variables=[:TT_cu => "Scene"],
237260
),
238261
ToyMaintenanceRespirationModel(1.5, 0.06, 25.0, 0.6, 0.004),
239262
Status(carbon_biomass=1.0)
240263
),
241264
"Leaf" => (
242265
MultiScaleModel(
243266
model=ToyCDemandModel(optimal_biomass=10.0, development_duration=200.0),
244-
mapping=[:TT => "Scene",],
267+
mapped_variables=[:TT => "Scene",],
245268
),
246269
ToyMaintenanceRespirationModel(2.1, 0.06, 25.0, 1.0, 0.025),
247270
Status(carbon_biomass=1.0)
@@ -254,13 +277,13 @@ mapping = Dict(
254277

255278
We can import an example plant from the package:
256279

257-
```@example readme
280+
```julia
258281
mtg = import_mtg_example()
259282
```
260283

261284
Make a fake meteorological data:
262285

263-
```@example readme
286+
```julia
264287
meteo = Weather(
265288
[
266289
Atmosphere(T=20.0, Wind=1.0, Rh=0.65, Ri_PAR_f=300.0),
@@ -271,7 +294,7 @@ meteo = Weather(
271294

272295
And run the simulation:
273296

274-
```@example readme
297+
```julia
275298
out_vars = Dict(
276299
"Scene" => (:TT_cu,),
277300
"Plant" => (:carbon_allocation, :carbon_assimilation, :soil_water_content, :aPPFD, :TT_cu, :LAI),
@@ -285,9 +308,9 @@ out = run!(mtg, mapping, meteo, outputs=out_vars, executor=SequentialEx());
285308

286309
We can then extract the outputs in a `DataFrame` and sort them:
287310

288-
```@example readme
311+
```julia
289312
using DataFrames
290-
df_out = outputs(out, DataFrame)
313+
df_out = convert_outputs(out, DataFrame)
291314
sort!(df_out, [:timestep, :node])
292315
```
293316

@@ -310,7 +333,6 @@ sort!(df_out, [:timestep, :node])
310333
| 2 | Internode | 8 | 0.0627036 | | | | | | 0.75 |
311334
| 2 | Leaf | 9 | 0.0627036 | | | | | | 0.75 |
312335

313-
314336
An example output of a multiscale simulation is shown in the documentation of PlantBiophysics.jl:
315337

316338
![Plant growth simulation](docs/src/www/image.png)
@@ -319,11 +341,17 @@ An example output of a multiscale simulation is shown in the documentation of Pl
319341

320342
Take a look at these projects that use PlantSimEngine:
321343

322-
- [PlantBiophysics.jl](https://github.com/VEZY/PlantBiophysics.jl)
323-
- [XPalm](https://github.com/PalmStudio/XPalm.jl)
344+
- [PlantBiophysics.jl](https://github.com/VEZY/PlantBiophysics.jl) - For the simulation of biophysical processes for plants such as photosynthesis, conductance, energy fluxes, and temperature
345+
- [XPalm](https://github.com/PalmStudio/XPalm.jl) - An experimental crop model for oil palm
346+
347+
## Performance
348+
349+
PlantSimEngine delivers impressive performance for plant modeling tasks. On an M1 MacBook Pro, a toy model for leaf area over a year at daily time-scale took only 260 μs to perform (about 688 ns per day), and 275 μs (756 ns per day) when coupled to a light interception model. These benchmarks demonstrate performance on par with compiled languages like Fortran or C, far outpacing typical interpreted language implementations.
350+
351+
For example, PlantBiophysics.jl, which implements ecophysiological models using PlantSimEngine, has been measured to run up to 38,000 times faster than equivalent implementations in other scientific computing languages.
324352

325-
## Make it yours
353+
## Make it yours
326354

327-
The package is developed so anyone can easily implement plant/crop models, use it freely and as you want thanks to its MIT license.
355+
The package is developed so anyone can easily implement plant/crop models, use it freely and as you want thanks to its MIT license.
328356

329357
If you develop such tools and it is not on the list yet, please make a PR or contact me so we can add it! 😃 Make sure to read the community guidelines before in case you're not familiar with such things.

docs/make.jl

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#using Pkg
2+
#Pkg.develop("PlantSimEngine")
13
using PlantSimEngine
24
using PlantMeteo
35
using DataFrames, CSV
@@ -16,34 +18,66 @@ makedocs(;
1618
canonical="https://VirtualPlantLab.github.io/PlantSimEngine.jl",
1719
edit_link="main",
1820
assets=String[],
19-
size_threshold=300000
20-
),
21-
pages=[
21+
size_threshold=500000
22+
), pages=[
2223
"Home" => "index.md",
23-
"Design" => "design.md",
24-
"Model Switching" => "model_switching.md",
25-
"Reducing DoF" => "reducing_dof.md",
24+
"Introduction" => [
25+
"Why PlantSimEngine ?" => "./introduction/why_plantsimengine.md",
26+
"Why Julia ?" => "./introduction/why_julia.md",
27+
],
28+
"Prerequisites" => [
29+
"Installing and running PlantSimEngine" => "./prerequisites/installing_plantsimengine.md",
30+
"Key Concepts" => "./prerequisites/key_concepts.md",
31+
"Julia language basics" => "./prerequisites/julia_basics.md",
32+
],
33+
"Step by step - Single-scale simulations" => [
34+
"Detailed first simulation" => "./step_by_step/detailed_first_example.md",
35+
"Coupling" => "./step_by_step/simple_model_coupling.md",
36+
"Model Switching" => "./step_by_step/model_switching.md",
37+
"Quick examples" => "./step_by_step/quick_and_dirty_examples.md",
38+
"Implementing a process" => "./step_by_step/implement_a_process.md",
39+
"Implementing a model" => "./step_by_step/implement_a_model.md",
40+
"Parallelization" => "./step_by_step/parallelization.md",
41+
"Advanced coupling and hard dependencies" => "./step_by_step/advanced_coupling.md",
42+
"Implementing a model : additional notes" => "./step_by_step/implement_a_model_additional.md",
43+
],
2644
"Execution" => "model_execution.md",
27-
"Fitting" => "fitting.md",
28-
"Extending" => [
29-
"Processes" => "./extending/implement_a_process.md",
30-
"Models" => "./extending/implement_a_model.md",
31-
"Input types" => "./extending/inputs.md",
45+
"Working with data" => [
46+
"Reducing DoF" => "./working_with_data/reducing_dof.md",
47+
"Fitting" => "./working_with_data/fitting.md",
48+
"Input types" => "./working_with_data/inputs.md",
49+
"Visualizing outputs and data" => "./working_with_data/visualising_outputs.md",
50+
"Floating-point considerations" => "./working_with_data/floating_point_accumulation_error.md",
3251
],
33-
"Coupling" => [
34-
"Users" => [
35-
"Simple case" => "./model_coupling/model_coupling_user.md",
36-
"Multi-scale modelling" => "./model_coupling/multiscale.md",
52+
"Moving to multiscale" => [
53+
"Multiscale considerations" => "./multiscale/multiscale_considerations.md",
54+
"Converting a simulation to multi-scale" => "./multiscale/single_to_multiscale.md",
55+
"More variable mapping examples" => "./multiscale/multiscale.md",
56+
"Handling cyclic dependencies" => "./multiscale/multiscale_cyclic.md",
57+
"Multiscale coupling considerations" => "./multiscale/multiscale_coupling.md",
58+
"Building a simple plant" => [
59+
"A rudimentary plant simulation" => "./multiscale/multiscale_example_1.md",
60+
"Expanding the plant simulation" => "./multiscale/multiscale_example_2.md",
61+
"Fixing bugs in the plant simulation"=> "./multiscale/multiscale_example_3.md",
3762
],
38-
"Modelers" => "./model_coupling/model_coupling_modeler.md",
39-
"Tips and Workarounds" => "./model_coupling/tips_and_workarounds.md",
40-
],
41-
"FAQ" => ["./FAQ/translate_a_model.md"],
42-
"API" => "API.md",
63+
"Visualizing our toy plant with PlantGeom"=> "./multiscale/multiscale_example_4.md",
64+
], "Troubleshooting and testing" => [
65+
"Troubleshooting" => "./troubleshooting_and_testing/plantsimengine_and_julia_troubleshooting.md",
66+
"Automated testing" => "./troubleshooting_and_testing/downstream_tests.md",
67+
"Tips and Workarounds" => "./troubleshooting_and_testing/tips_and_workarounds.md",
68+
"Implicit contracts" => "./troubleshooting_and_testing/implicit_contracts.md",
69+
], "API" => [
70+
"Public API" => "./API/API_public.md",
71+
"Example models" => "./API/API_examples.md",
72+
"Internal API" => "./API/API_private.md",],
73+
"Improving our documentation" => "documentation_improvement.md",
74+
"Developer guidelines" => "developers.md",
75+
"Planned features" => "planned_features.md",
4376
]
4477
)
4578

4679
deploydocs(;
4780
repo="github.com/VirtualPlantLab/PlantSimEngine.jl.git",
48-
devbranch="main"
81+
devbranch="main",
82+
push_preview=true, # Visit https://VirtualPlantLab.github.io/PlantSimEngine.jl/previews/PR128 to visualize the preview of the PR #128
4983
)

docs/src/API.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)