run_biocro {BioCro} | R Documentation |
Simulate Crop Growth with BioCro
Description
Runs a full crop growth simulation using the BioCro framework
Usage
run_biocro(
initial_values = list(),
parameters = list(),
drivers,
direct_module_names = list(),
differential_module_names = list(),
ode_solver = BioCro::default_ode_solvers$homemade_euler,
verbose = FALSE
)
Arguments
initial_values |
A list of named quantities representing the initial values of the differential quantities, i.e., the quantities whose derivatives are calculated by differential modules |
parameters |
A list of named quantities that don't change with time; must include a 'timestep' parameter (see 'drivers' for more info) |
drivers |
A data frame of quantities defined at equally spaced time intervals. The time interval should be specified in the 'parameters' as a quantity called 'timestep' having units of hours. The drivers must include columns for either (1) 'time' (in units of days) or (2) 'doy' and 'hour'. |
direct_module_names |
A character vector or list of the fully-qualified names of the direct
modules to use in the system; lists of available modules can be obtained via
the |
differential_module_names |
A character vector or list of the fully-qualified names of the differential
modules to use in the system; lists of available modules can be obtained via
the |
ode_solver |
A list specifying details about the numerical ODE solver. The required elements are:
|
verbose |
A logical variable indicating whether or not to print dynamical system
validation information. (More detailed startup information can be obtained
with the |
Details
run_biocro
is the most important function in the BioCro package. The
input arguments to this function are used to define a dynamical system and
solve for its time evolution during a desired time period. For more details
about how this function operates, see Lochocki et al. (2022)
[doi:10.1093/insilicoplants/diac003].
When using one of the pre-defined crop growth models, it may be helpful to
use the with
command to pass arguments to run_biocro
; see the
documentation for crop_model_definitions
for more information.
Value
A data frame where each column represents one of the quantities included in the simulation (with the exception of the parameters, since their values are guaranteed to not change with time) and each row represents a time point
See Also
Examples
# Example: running a miscanthus simulation using weather data from 2005
result <- run_biocro(
miscanthus_x_giganteus$initial_values,
miscanthus_x_giganteus$parameters,
get_growing_season_climate(weather$'2005'),
miscanthus_x_giganteus$direct_modules,
miscanthus_x_giganteus$differential_modules,
miscanthus_x_giganteus$ode_solver
)
lattice::xyplot(
Leaf + Stem + Root + Grain ~ TTc,
data=result,
type='l',
auto=TRUE
)