Releases: kcevers/sdbuildR
Release list
sdbuildR 2.2.3
-
import_insightmaker(),url_to_insightmaker(), andinsightmaker_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 newinstall_julia_env(force = TRUE)for a deliberate clean rebuild. -
The Julia environment now installs only the four
OrdinaryDiffEqsolver
sub-packages sdbuildR actually uses, rather thanOrdinaryDiffEq. This removes
12 packages from the environment and makes loading faster. In addition,
PrecompileToolsis added as a Julia dependency for faster Julia simulations.Updating to this sdbuildR version thus requires re-runninginstall_julia_env()again.
sdbuildR v2.2.2
Merge pull request #47 from kcevers/stockflow Stockflow
sdbuildR v2.2.1
Merge pull request #46 from kcevers/stockflow Stockflow
sdbuildR v2.2.0
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_lengthinstead ofminlen. - Use
spacinginstead ofnodesep. - Use
margininstead ofpad. - Use
color_dependencyinstead ofdependency_col. - Use
font_colorinstead oflabel_col. - Use the more general
colorsargument instead ofstock_colandflow_col.
Simulation timing settings
In sim_settings(), output timing settings have new names.
- Use
save_by,save_times, andsave_lengthinstead of the oldersave_atandsave_narguments.
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
centralandspread. - Line width and transparency settings now use the richer
line_widthandalphagrammar.
Fonts and messages
Two defaults changed or are being phased out.
- The default diagram font changed from
"Times New Roman"to"stix-two-text". Setoptions(sdbuildR.font_family = "Times New Roman")to restore the previous look. ensemble(verbose = )is deprecated. Usequietfor message control, which is now handled consistently acrossensemble(),simulate(),use_julia(), andinstall_julia_env().
sdbuildR 2.0.0
Breaking changes
-
stockflow()is now the constructor for stock-and-flow models. Code that
usedxmile()or the development-onlysdbuildR()constructor should call
stockflow()instead. -
update()now replaces the oldbuild()workflow for general model edits.
For clearer model-building code, usestock(),flow(),constant(),
aux()/auxiliary(),lookup(), andcustom_func(). -
stockflowis now the primary model class. Code that checked for
sdbuildR_xmileorsdbuildRshould check forstockflowinstead. -
simulate()now returnssimulate_stockflowobjects,ensemble()returns
ensemble_stockflowobjects,verify()returnsverify_stockflowobjects,
summary()returnssummary_stockflowobjects, andcompare_models()
returnscompare_stockflowobjects. -
sim_settings()now replacessim_specs(), andmeta()now replaces
header(). -
summary()now runs model diagnostics. Code that useddebugger()should
callsummary()instead. -
dependencies()now replacesfind_dependencies(). -
export_model(format = "sdbuildR")now replacesget_build_code(). -
sim_methods()now replacessolvers(). -
custom_func()now replacesmacro()for user-defined model functions. -
import_insightmaker()now replacesinsightmaker_to_sfm(), and
url_to_insightmaker()now replacesurl_to_IM(). -
ensemble()now usesconditionsinstead ofrange. To retain individual
simulations, usesave_sims = TRUEinstead ofreturn_sims = TRUE. -
plot()methods now useshow_constantsinstead ofadd_constants. For
ensemble plots, usewhich,sim,condition, andlabel_subplotsinstead
oftype,i,j, andj_labels. -
use_julia(nthreads = )now controls Julia threading. Code that used
use_threads()should set the thread count withuse_julia()instead. -
Units are no longer supported. This means that unit-specific helpers from 1.x,
includingu(),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-insensitivetemplatename. -
stock(),flow(),constant(),aux()/auxiliary(),lookup(), and
custom_func()provide typed model-building helpers aroundupdate(). -
update()now supports bare variable names and R expressions inname,
type,eqn,to,from, andsource. Strings and programmatic injection
with!!remain supported. -
change_name(),change_type(), anddiscard()provide focused helpers for
renaming, changing, and removing model variables. -
sim_settings()gains flexible output controls withsave_at,save_n,
vars, andsave_sims. -
simulate()accepts temporary simulation-setting overrides through...,
using the same arguments assim_settings(). -
ensemble()can run ensembles in R and Julia, vary stocks and constants with
conditions, and retain individual simulations withsave_sims = TRUE. -
unit_test(),unit_tests(), andverify()add model-level unit tests for
expected simulation behavior, including tests under alternativeconditions. -
compare_models()compares model structure, equations, simulation settings,
and nonlinearity scores across twostockflowmodels. -
import_desolve()converts deSolve-style ODE models intostockflowmodels. -
import_insightmaker()imports Insight Maker models from public URLs,
.InsightMakerfiles, and ModelJSON.jsonfiles. -
export_model()exports models as sdbuildR reconstruction code, standalone
deSolve scripts, or Psychomodels JSON records.
Improvements and fixes
-
as.data.frame()methods now support thestockflow,simulate_stockflow,
ensemble_stockflow, andverify_stockflowclasses. -
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 asbase::sum()translate
correctly, and unsupported constructs fall back to the previous translator. -
simulate(), compilation, andsummary()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. -
textutilsis now a required dependency.
sdbuildR 1.0.8
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
v1.0.7 Increment version number to 1.0.7
sdbuildR 1.0.5
v1.0.5 Increment version number to 1.0.5