Skip to contents

Start Julia session and activate Julia environment to simulate stock-and-flow models. To do so, Julia needs to be installed and findable from within R. See this vignette for guidance. In addition, the Julia environment specifically for sdbuildR needs to have been instantiated. This can be set up with install_julia_env().

Usage

use_julia(stop = FALSE, force = FALSE)

Arguments

stop

If TRUE, stop active Julia session. Defaults to FALSE.

force

If TRUE, force Julia setup to execute again.

Value

Returns NULL invisibly, used for side effects

Details

Julia supports running stock-and-flow models with units as well as ensemble simulations (see ensemble()).

In every R session, use_julia() needs to be run once (which is done automatically in simulate()), which can take around 30-60 seconds.

Examples

# Start a Julia session and activate the Julia environment for sdbuildR
use_julia()
#> Starting Julia ...
#> Connecting to Julia TCP server at localhost:11980 ...
#> Setting up Julia environment for sdbuildR...

# Stop Julia session
use_julia(stop = TRUE)
#> Julia session closed.