ST4A SD Simulator User Guide

Welcome to the complete user guide for ST4A System Dynamics Simulator. This guide covers every feature available in the plugin, from basic model building to advanced analysis tools and AI-powered model generation.

What is System Dynamics?

System Dynamics is a methodology for studying and managing complex feedback systems. It uses stocks (accumulations), flows (rates of change), and feedback loops to model how systems behave over time.

Getting Started

Accessing the Frontend Builder

The Frontend Builder is accessed via the {sd_model_builder} shortcode. Add this shortcode to any WordPress page to display the model builder interface.

{sd_model_builder}

// With options:
{sd_model_builder width="100%" height="700px" allow_create="true" allow_save="true"}

Requirements

  • Login Required: Users must be logged in to create and save models
  • Permissions: Model limits may apply based on user role
  • Browser: Modern browser with JavaScript enabled

Frontend Builder Overview

The Frontend Builder is a visual interface for creating System Dynamics models. It consists of several key areas:

1

Header Bar

Contains the model title input, status indicator, and action buttons (My Models, New, Save).

2

Toolbar

Provides buttons for adding elements, connecting them, and accessing analysis tools.

3

Canvas

The main workspace where you build your model by placing and connecting elements.

4

Simulation Controls

Run, pause, reset simulation and configure time parameters.

5

Results Panel

Displays simulation results as interactive time-series charts.

Toolbar Functions

Add Elements Group

Button Function Description
Stock Add Stock Creates a new stock (accumulation) element on the canvas. Stocks represent quantities that accumulate over time.
Flow Add Flow Creates a new flow (rate) element. Flows represent rates of change that fill or drain stocks.
Variable Add Variable Creates a new auxiliary variable. Variables hold constants, parameters, or calculated values.

Connect Group

Button Function Description
Relationship Add Relationship Creates a causal link (information flow) between two elements with polarity (+/-).
Flow Link Connect Flow to Stock Connects a flow to its source or destination stock.

Selection Group

Button Function Description
Select Selection Mode Switch to selection mode to select and move elements.
Delete Delete Selected Deletes the currently selected element(s). Only active when something is selected.

Analysis Group

Button Function Description
Sensitivity Sensitivity Analysis Opens the sensitivity analysis tool to test how parameter changes affect outputs.
Scenarios Scenario Manager Save, load, and compare different parameter configurations.
Sliders Parameter Sliders Opens interactive sliders for adjusting parameters in real-time.
Dashboard Dashboard Builder Create custom dashboards with widgets for presenting your model.
Templates Template Library Browse and load pre-built model templates.

Import/Export Group

Button Function Description
Import Import JSON Import a model from SD-JSON format.
Export Export JSON Export the current model to SD-JSON format.

Canvas Operations

Navigation

  • Pan: Click and drag on empty canvas space to pan the view
  • Zoom: Use mouse scroll wheel to zoom in/out
  • Fit to View: Double-click empty space to fit all elements in view

Element Manipulation

  • Select: Click on an element to select it (highlighted in orange)
  • Move: Drag selected element to reposition
  • Edit: Double-click an element to open the properties panel
  • Delete: Select element and press Delete key or click Delete button

Creating Connections

  1. 1Click the “Relationship” or “Flow Link” button
  2. 2Click on the source element
  3. 3Click on the target element
  4. 4For relationships, select polarity (+ or -)

Model Elements

Stocks (Blue Rectangles)

Stocks represent accumulations – quantities that build up or deplete over time. Examples include Population, Inventory, Bank Balance, or Water in a Tank.

Property Description
Name Unique identifier used in equations
Initial Value Starting value at simulation time 0 (equation field)
Units Optional unit specification (e.g., “people”, “dollars”)
Inflows Flows that add to this stock
Outflows Flows that subtract from this stock
Stock Equation

Stock values are calculated as: Stock(t) = Stock(t-dt) + (Inflows - Outflows) * dt

Flows (Red Triangles)

Flows represent rates of change – how fast stocks increase or decrease. Examples include Birth Rate, Sales Rate, Interest Payments, or Water Flow.

Property Description
Name Unique identifier used in equations
Equation Formula calculating the flow rate (can reference other variables)
Units Rate units (e.g., “people/year”, “dollars/month”)
From Stock Stock this flow drains from (optional)
To Stock Stock this flow fills (optional)

Variables (Green Circles)

Variables (also called auxiliaries or converters) hold constants, parameters, or intermediate calculations. Examples include Birth Rate, Interest Rate, Price, or Demand.

Property Description
Name Unique identifier used in equations
Equation Constant value or formula (can reference other variables)
Units Optional unit specification

Relationships (Arrows)

Relationships show causal connections between elements. They indicate that one variable influences another, with polarity showing the direction of influence.

Polarity Meaning Example
+ (Positive) When A increases, B increases (and vice versa) Population → Births (+)
– (Negative) When A increases, B decreases (and vice versa) Price → Demand (-)

Properties Panel

The Properties Panel appears when you double-click an element. It allows you to edit all properties of the selected element.

Common Fields

  • Name: The variable name (must be unique, no spaces)
  • Equation: The mathematical formula or constant value
  • Units: Optional documentation of the variable’s units
  • Description: Optional notes about the variable

Writing Equations

Equations can include:

  • Numbers: 100, 0.05, -10
  • Other variables: Population * Birth Rate
  • Operators: +, -, *, /, ^
  • Functions: MAX(a, b), IF(condition, true, false)
  • Special variables: TIME, DT
// Example equations:
Birth Rate = 0.03
Births = Population * Birth Rate
Deaths = Population * Death Rate
Net Growth = IF(Population > 1000000, 0, Births - Deaths)
Seasonal Factor = 1 + 0.2 * SIN(TIME * 2 * 3.14159 / 12)

Simulation Controls

Control Buttons

Button Function
Run Start the simulation. Calculates values for each time step and displays animated results.
Pause Pause the simulation animation. Values continue to be calculated in background.
Reset Reset the simulation to initial state. Clears all results.
Export CSV Download simulation results as a CSV file for analysis in Excel/Sheets.

Time Parameters

Parameter Description Default
Start Time Initial simulation time 0
Stop Time Final simulation time 100
dt (Time Step) Size of each simulation step 1
Method Integration method (Euler or RK4) Euler

Speed Slider

Controls animation speed from 0.2x (slow) to 10x (fast). This only affects the visual animation, not the simulation calculation.

Integration Methods

Euler Method

The simplest numerical integration method. Fast but less accurate for stiff systems or when dt is large.

Stock(t+dt) = Stock(t) + derivative * dt

Use when: Simple models, learning, or when speed is more important than precision.

Runge-Kutta 4 (RK4)

Fourth-order method that evaluates derivatives at four points per step. More accurate than Euler, especially for oscillating or stiff systems.

k1 = f(t, y)
k2 = f(t + dt/2, y + dt*k1/2)
k3 = f(t + dt/2, y + dt*k2/2)
k4 = f(t + dt, y + dt*k3)
Stock(t+dt) = Stock(t) + (dt/6) * (k1 + 2*k2 + 2*k3 + k4)

Use when: Accuracy is important, oscillating systems, or when using larger dt values.

Functions Reference

Mathematical Functions

Function Syntax Description
MIN MIN(a, b) Returns the smaller of two values
MAX MAX(a, b) Returns the larger of two values
ABS ABS(x) Absolute value
SQRT SQRT(x) Square root
POW POW(x, y) x raised to power y
EXP EXP(x) e raised to power x
LOG LOG(x) Natural logarithm
LOG10 LOG10(x) Base-10 logarithm
SIN SIN(x) Sine (x in radians)
COS COS(x) Cosine (x in radians)
TAN TAN(x) Tangent (x in radians)
FLOOR FLOOR(x) Round down to integer
CEIL CEIL(x) Round up to integer
ROUND ROUND(x) Round to nearest integer

Conditional Functions

Function Syntax Description
IF IF(condition, true_value, false_value) Returns true_value if condition is true, otherwise false_value
// IF examples:
Tax = IF(Income > 50000, Income * 0.3, Income * 0.2)
Growth = IF(Population < Capacity, Births - Deaths, 0)
Status = IF(Inventory > 0, 1, 0)

Time Functions

Function Syntax Description
PULSE PULSE(time, height) Returns height at specified time, 0 otherwise
PULSE PULSE(time, height, interval) Repeating pulse every interval starting at time
STEP STEP(time, height) Returns 0 before time, height after
RAMP RAMP(slope, start_time) Linear increase from start_time
RAMP RAMP(slope, start_time, end_time) Linear increase between start and end times
// Time function examples:
Investment = PULSE(10, 1000)           // $1000 investment at time 10
Policy = STEP(50, 0.1)                 // Policy change at time 50
Demand Growth = RAMP(10, 5, 20)        // Demand grows from time 5 to 20

Delay Functions

Function Syntax Description
DELAY DELAY(input, delay_time, initial) Material delay – returns input from delay_time ago
DELAY1/SMOOTH DELAY1(input, delay_time, initial) First-order exponential smoothing
DELAY3 DELAY3(input, delay_time, initial) Third-order cascaded delay (S-curve response)
// Delay examples:
Shipments = DELAY(Orders, 5, 100)      // Orders arrive after 5 time units
Perceived Demand = SMOOTH(Demand, 3, Demand)  // Smoothed perception
Delivery = DELAY3(Production, 10, 0)   // Production with S-curve delay

Random Functions

Function Syntax Description
RANDOM RANDOM() Random number between 0 and 1
RANDOM RANDOM(min, max) Random number between min and max
NORMAL NORMAL(mean, stddev) Random from normal distribution

Lookup Tables

Lookup tables allow you to define non-linear relationships using data points. Values between points are linearly interpolated.

// Define a lookup table in a variable's equation:
Effect of Temperature = LOOKUP(Temperature Effect Table, Temperature)

// The table is defined separately with input-output pairs
// Example: Temperature Effect Table
// Input: 0, 10, 20, 30, 40
// Output: 0.5, 0.8, 1.0, 0.9, 0.6

Special Variables

Variable Description
TIME Current simulation time
DT Current time step size

Sensitivity Analysis

Sensitivity Analysis helps you understand how changes in a parameter affect your model’s outputs.

How to Use

  1. 1Click the “Sensitivity” button in the toolbar
  2. 2Select the parameter to vary
  3. 3Set minimum and maximum values
  4. 4Choose number of steps (2-50)
  5. 5Optionally select a specific output variable to track
  6. 6Click “Run Analysis”

Results

  • Table: Shows parameter values and corresponding final output values
  • Chart: Visual representation of how outputs change with parameter
  • Statistics: Min, max, range, and sensitivity percentage

Scenario Manager

The Scenario Manager lets you save different parameter configurations and compare them.

Saving a Scenario

  1. 1Set up your model with desired parameter values
  2. 2Click “Scenarios” in the toolbar
  3. 3Enter a scenario name and description
  4. 4Click “Save”

Loading a Scenario

  1. 1Open the Scenarios panel
  2. 2Find the scenario in the list
  3. 3Click “Load” to apply those parameter values

Comparing Scenarios

  1. 1Select two or more scenarios using checkboxes
  2. 2Click “Compare Selected”
  3. 3View side-by-side simulation results

Parameter Sliders

Parameter Sliders provide interactive controls for adjusting variable values in real-time.

Using Sliders

  1. 1Click “Sliders” in the toolbar
  2. 2A panel shows sliders for all adjustable parameters
  3. 3Drag sliders to change values
  4. 4Run simulation to see effects
Tip

Combine parameter sliders with the real-time simulation animation to immediately see how changes affect your model’s behavior.

Dashboard Builder

The Dashboard Builder lets you create custom interactive interfaces for your models, perfect for sharing with non-technical users or creating presentations.

Accessing Dashboard Builder

  1. 1Click “Dashboard” in the toolbar
  2. 2Check “Enable Dashboard” to activate
  3. 3Configure layout settings (grid, columns)
  4. 4Add widgets
  5. 5Click “Save Dashboard”

Dashboard Settings

Setting Description
Enable Dashboard Toggle dashboard on/off
Layout Grid or Flow layout
Columns Number of columns (1-4)
Title Dashboard title displayed at top
Description Optional description text

Widget Types

Slider Widget

Allows users to adjust a parameter value within a range.

Option Description
Variable The parameter to control
Min Value Minimum slider value
Max Value Maximum slider value
Step Increment size
Label Display label (optional)

Value Display Widget

Shows the current or final value of a variable.

Option Description
Variable The variable to display
Format Number, percentage, or currency
Decimals Number of decimal places
Label Display label

Gauge Widget

Circular gauge showing a variable’s value within a range.

Option Description
Variable The variable to display
Min Value Minimum gauge value
Max Value Maximum gauge value
Label Display label

Chart Widget

Time-series line chart showing one or more variables over time.

Option Description
Variables Select which variables to chart
Height Chart height in pixels
Title Chart title

Text Widget

Static text content for instructions or explanations.

Option Description
Content HTML/text content to display

Run Button Widget

Simulation control buttons.

Option Description
Button Text Label for run button
Show Pause Include pause button
Show Reset Include reset button

Dashboard Preview

Click “Preview Live” in the Dashboard Builder to see a fully functional preview of your dashboard without leaving the builder.

  • Sliders work and update parameter values
  • Run button executes actual simulation
  • Gauges and charts animate with results
  • Values update in real-time

Embedding Dashboards

Use the shortcode to embed your dashboard on any page:

{sd_dashboard id="123"}

// With options:
{sd_dashboard id="123" width="800px" height="600px"}

AI Chatbot

The AI Chatbot is a unique feature that lets you create and modify models using natural language. Simply describe what you want, and the AI will generate the model.

Creating a Model with AI

  1. 1Open the AI chat panel (appears on the side)
  2. 2Describe the model you want to create
  3. 3AI will generate the complete model structure
  4. 4Review and refine with follow-up messages

Example Prompts

// Creating a new model:
"Create a population model with births, deaths, and migration"

// Modifying existing model:
"Add a carrying capacity that limits population growth"

// Asking questions:
"What would happen if birth rate doubled?"
Usage Limits

AI generation has usage limits based on your user role. Administrators have unlimited access, while other roles have daily, weekly, and monthly limits.

AI Providers

ST4A supports multiple AI providers:

Provider Model Notes
Claude Claude Sonnet Anthropic’s AI (recommended)
OpenAI GPT-4o Mini OpenAI’s efficient model
GLM GLM-4 Plus Zhipu AI
MiniMax MiniMax-Text-01 MiniMax AI

AI Settings

Users can configure their own API keys for unlimited AI access.

Adding Your API Key

  1. 1Click the settings icon in the AI panel
  2. 2Enter your API key for the desired provider
  3. 3Click “Test” to verify the key works
  4. 4Click “Save” to store (encrypted)
Benefits of Using Your Own Key

When you use your own API key, you bypass the built-in usage limits and have unlimited access to AI model generation.

Template Library

The Template Library provides pre-built models to help you get started quickly.

Available Templates

Template Category Description
Population Growth Ecology Exponential growth with births and deaths
SIR Epidemic Epidemiology Disease spread: Susceptible-Infected-Recovered
Inventory Management Business Orders, shipments, and sales
Predator-Prey Ecology Lotka-Volterra population dynamics
Project Management Business Work completion with rework cycles
Savings Account Finance Compound interest model
Resource Depletion Environment Non-renewable resource extraction
Workforce Hiring Business Employee hiring and turnover

Loading a Template

  1. 1Click “Templates” in the toolbar
  2. 2Browse by category or view all
  3. 3Click “Load Template” on desired template
  4. 4Confirm to replace current model

Import/Export

Exporting Models

  1. 1Click the Export button (download icon) in toolbar
  2. 2Copy the JSON from the modal
  3. 3Save to a file or share directly

Importing Models

  1. 1Click the Import button (upload icon) in toolbar
  2. 2Paste the SD-JSON content
  3. 3Click “Import”

SD-JSON Format

The SD-JSON format is compatible with the SD-AI project:

{
  "title": "Model Name",
  "explanation": "Model description",
  "variables": [
    {
      "name": "Population",
      "type": "stock",
      "equation": "1000",
      "units": "people"
    },
    {
      "name": "Birth Rate",
      "type": "variable",
      "equation": "0.03"
    }
  ],
  "relationships": [
    {
      "from": "Population",
      "to": "Births",
      "polarity": "+"
    }
  ],
  "specs": {
    "startTime": 0,
    "stopTime": 100,
    "dt": 1,
    "timeUnits": "years"
  }
}

Shortcode Reference

{sd_model_builder}

Displays the full model builder interface.

Attribute Default Description
width 100% Container width
height 600px Canvas height
model_id 0 Load specific model ID
allow_create true Allow creating new models
allow_save true Allow saving models
{sd_model_builder}
{sd_model_builder model_id="123"}
{sd_model_builder width="100%" height="800px" allow_create="false"}

{sd_simulator}

Displays a simulation viewer (read-only, no editing).

Attribute Default Description
id (required) Model ID to display
width 100% Container width
height 500px Container height
{sd_simulator id="123"}
{sd_simulator id="123" width="800px" height="600px"}

{sd_dashboard}

Displays a custom dashboard for a model.

Attribute Default Description
id (required) Model ID with dashboard
width 100% Container width
height auto Container height
{sd_dashboard id="123"}
{sd_dashboard id="123" width="900px"}
Need Help?

For additional support, visit the plugin repository on GitHub or contact the development team.