| debugger | R Documentation |
Check for common formulation problems in a stock-and-flow model.
debugger(sfm, quietly = FALSE)
sfm |
Stock-and-flow model, object of class |
quietly |
If TRUE, don't print problems. Defaults to FALSE. |
The following problems are detected:
An absence of stocks
Flows without a source (from) or target (to)
Flows connected to a stock that does not exist
Undefined variable references in equations
Circularity in equations
Connected stocks and flows without both having units or no units
Missing unit definitions
The following potential problems are detected:
Absence of flows
Stocks without inflows or outflows
Equations with a value of 0
If quietly = FALSE, list with problems and potential problems.
# No issues
sfm <- xmile("SIR")
debugger(sfm)
# Detect absence of stocks or flows
sfm <- xmile()
debugger(sfm)
# Detect stocks without inflows or outflows
sfm <- xmile() |> build("Prey", "stock")
debugger(sfm)
# Detect circularity in equation definitions
sfm <- xmile() |>
build("Prey", "stock", eqn = "Predator") |>
build("Predator", "stock", eqn = "Prey")
debugger(sfm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.