Skip to content

Releases: kcevers/sdbuildR

sdbuildR 2.2.3

Choose a tag to compare

@kcevers kcevers released this 24 Aug 12:56
  • import_insightmaker(), url_to_insightmaker(), and insightmaker_to_json() now fail gracefully, e.g., when internet is not available.

  • install_julia_env() no longer rebuilds an environment that is already up to date.
    Use the new install_julia_env(force = TRUE) for a deliberate clean rebuild.

  • The Julia environment now installs only the four OrdinaryDiffEq solver
    sub-packages sdbuildR actually uses, rather than OrdinaryDiffEq. This removes
    12 packages from the environment and makes loading faster. In addition,
    PrecompileTools is added as a Julia dependency for faster Julia simulations.Updating to this sdbuildR version thus requires re-running install_julia_env() again.

sdbuildR v2.2.2

Choose a tag to compare

@kcevers kcevers released this 17 Jul 21:22
76a5516
Merge pull request #47 from kcevers/stockflow

Stockflow

sdbuildR v2.2.1

Choose a tag to compare

@kcevers kcevers released this 16 Jul 07:12
cb97434
Merge pull request #46 from kcevers/stockflow

Stockflow

sdbuildR v2.2.0

Choose a tag to compare

@kcevers kcevers released this 06 Jul 08:00
2f89e92

sdbuildR 2.2.0 focuses on clearer stock-and-flow diagrams, interactive plots, and more customizable visualisations. Most of the changes are meant to make models easier to inspect and use in teaching.

Highlights

Clearer stock-flow diagrams

plot.stockflow() is now more useful for reading models at a glance.

  • Equations can be shown directly in node labels and hover tooltips.
  • Equation labels now match the variable type: stocks show initial values, flows show rates, constants show values, and auxiliaries show equations.
  • Diagram layout controls are more flexible, including direction, alignment, ordering, spacing, margins, flow length, dependency arrows, fonts, and colours.

More interactive plots

Simulation, ensemble, and verification plots are easier to explore and share.

  • Time animations are now available for simulation, ensemble, and verification results.
  • Animation speed and smoothness can be tuned with control_options.
  • Ensemble and verification plots can use sliders or dropdowns to browse conditions one at a time.
  • Interactive condition controls work in exported HTML documents, including pkgdown articles and Quarto slides.

Leaner ensemble summaries

ensemble() now lets you choose which summary statistics to compute, using the same central and spread vocabulary used by the plotting methods.

  • Pick the central tendencies you want, such as mean, median, or none.
  • Pick the spread statistics you want, such as quantiles, standard deviations, ranges, or none.
  • Keep output smaller when you do not need every summary column.

A more robust Julia backend

The Julia integration should now be less fragile across package and Julia updates.

  • The sdbuildR Julia environment now lives in a persistent user data directory, so it survives reinstallations of sdbuildR.
  • sdbuildR detects when the environment was built with a different Julia version and prompts for a rebuild.
  • Julia setup messages are clearer, especially when installation is interrupted.
  • Julia simulations now respect seeds set through sim_settings().

Smoother model output workflows

Several smaller changes make model results easier to work with.

  • Data-frame methods for simulation, ensemble, and verification results can subset by variable and variable type.
  • Model print methods show saved variables more clearly.
  • The ricker() function is now available.
  • The plotting grammar for colours, line widths, and transparency is more flexible.

Breaking changes to note

Plotting argument names

Several plot.stockflow() arguments were renamed for clarity.

  • Use flow_length instead of minlen.
  • Use spacing instead of nodesep.
  • Use margin instead of pad.
  • Use color_dependency instead of dependency_col.
  • Use font_color instead of label_col.
  • Use the more general colors argument instead of stock_col and flow_col.

Simulation timing settings

In sim_settings(), output timing settings have new names.

  • Use save_by, save_times, and save_length instead of the older save_at and save_n arguments.

Ensemble plot styling

Ensemble plot styling now follows the newer central, spread, line_width, and alpha approach.

  • Older central-tendency arguments have been replaced by central and spread.
  • Line width and transparency settings now use the richer line_width and alpha grammar.

Fonts and messages

Two defaults changed or are being phased out.

  • The default diagram font changed from "Times New Roman" to "stix-two-text". Set options(sdbuildR.font_family = "Times New Roman") to restore the previous look.
  • ensemble(verbose = ) is deprecated. Use quiet for message control, which is now handled consistently across ensemble(), simulate(), use_julia(), and install_julia_env().

sdbuildR 2.0.0

Choose a tag to compare

@kcevers kcevers released this 16 Jun 21:19

Breaking changes

  • stockflow() is now the constructor for stock-and-flow models. Code that
    used xmile() or the development-only sdbuildR() constructor should call
    stockflow() instead.

  • update() now replaces the old build() workflow for general model edits.
    For clearer model-building code, use stock(), flow(), constant(),
    aux()/auxiliary(), lookup(), and custom_func().

  • stockflow is now the primary model class. Code that checked for
    sdbuildR_xmile or sdbuildR should check for stockflow instead.

  • simulate() now returns simulate_stockflow objects, ensemble() returns
    ensemble_stockflow objects, verify() returns verify_stockflow objects,
    summary() returns summary_stockflow objects, and compare_models()
    returns compare_stockflow objects.

  • sim_settings() now replaces sim_specs(), and meta() now replaces
    header().

  • summary() now runs model diagnostics. Code that used debugger() should
    call summary() instead.

  • dependencies() now replaces find_dependencies().

  • export_model(format = "sdbuildR") now replaces get_build_code().

  • sim_methods() now replaces solvers().

  • custom_func() now replaces macro() for user-defined model functions.

  • import_insightmaker() now replaces insightmaker_to_sfm(), and
    url_to_insightmaker() now replaces url_to_IM().

  • ensemble() now uses conditions instead of range. To retain individual
    simulations, use save_sims = TRUE instead of return_sims = TRUE.

  • plot() methods now use show_constants instead of add_constants. For
    ensemble plots, use which, sim, condition, and label_subplots instead
    of type, i, j, and j_labels.

  • use_julia(nthreads = ) now controls Julia threading. Code that used
    use_threads() should set the thread count with use_julia() instead.

  • Units are no longer supported. This means that unit-specific helpers from 1.x,
    including u(), convert_u(), drop_u(),
    model_units(), unit_prefixes(), get_units(), get_regex_units(), and
    get_regex_time_units(), are no longer available.

New features

  • stockflow() creates an empty model or loads a built-in template using a
    case-insensitive template name.

  • stock(), flow(), constant(), aux()/auxiliary(), lookup(), and
    custom_func() provide typed model-building helpers around update().

  • update() now supports bare variable names and R expressions in name,
    type, eqn, to, from, and source. Strings and programmatic injection
    with !! remain supported.

  • change_name(), change_type(), and discard() provide focused helpers for
    renaming, changing, and removing model variables.

  • sim_settings() gains flexible output controls with save_at, save_n,
    vars, and save_sims.

  • simulate() accepts temporary simulation-setting overrides through ...,
    using the same arguments as sim_settings().

  • ensemble() can run ensembles in R and Julia, vary stocks and constants with
    conditions, and retain individual simulations with save_sims = TRUE.

  • unit_test(), unit_tests(), and verify() add model-level unit tests for
    expected simulation behavior, including tests under alternative conditions.

  • compare_models() compares model structure, equations, simulation settings,
    and nonlinearity scores across two stockflow models.

  • import_desolve() converts deSolve-style ODE models into stockflow models.

  • import_insightmaker() imports Insight Maker models from public URLs,
    .InsightMaker files, and ModelJSON .json files.

  • export_model() exports models as sdbuildR reconstruction code, standalone
    deSolve scripts, or Psychomodels JSON records.

Improvements and fixes

  • as.data.frame() methods now support the stockflow, simulate_stockflow,
    ensemble_stockflow, and verify_stockflow classes.

  • dependencies() can now filter dependencies by variable name and type.

  • export_plot() now supports the current plot classes and additional graph
    export options.

  • simulate() and Julia code generation now use a faster AST-based R-to-Julia
    equation translator. Namespaced calls such as base::sum() translate
    correctly, and unsupported constructs fall back to the previous translator.

  • simulate(), compilation, and summary() now use a content-hashed assembly
    cache. Repeated calls on unchanged models can skip reassembly, and editing one
    equation only retranslates that equation.

  • simulate() now keeps Julia stock derivative positions aligned with the state
    vector when stocks are added, removed, renamed, or created by changing a
    variable's type.

  • summary() and code generation now use an internal structural validator to
    catch inconsistent model layouts before simulation.

  • simulate() now removes temporary CSV files created by single Julia
    simulations.

  • textutils is now a required dependency.

sdbuildR 1.0.8

Choose a tag to compare

@kcevers kcevers released this 22 Nov 10:56

Minor improvements and bug fixes

  • Fixed bug in replacing scientifically formatted numbers
  • Fixed bug in comparing Julia versions
  • Added alias "sigmoid" for logistic function
  • Created constructor and validator for class sdbuildR_sim to improve consistency in output

sdbuildR 1.0.7

Choose a tag to compare

@kcevers kcevers released this 04 Nov 21:43
v1.0.7

Increment version number to 1.0.7

sdbuildR 1.0.5

Choose a tag to compare

@kcevers kcevers released this 30 Oct 08:47
v1.0.5

Increment version number to 1.0.5