Holarch

Behavior

Simulation

Run an Action flow as a Discrete Event simulation or a Monte Carlo study, read time, cost, resource and utilization results, script decisions, and record a verification result against a requirement.

How to use it →

On this page
  1. Overview
  2. Concepts
    1. What the Simulator reads
  3. How to use it
    1. When and why
    2. Run a Discrete Event simulation
    3. Run a Monte Carlo study
    4. Check a requirement and record the result
    5. Saved runs
    6. Worked example: the CubeSat EO-1 imaging pass
    7. Tips and good practice
    8. Common mistakes
    9. How it connects
  4. Simulation rules
    1. Durations and distributions
    2. Control constructs
    3. Resources
    4. Assets and utilization
    5. Costs
    6. Random numbers and seeds
  5. The Simulator page
    1. Page header and run bar
    2. Settings
    3. Discrete Event controls
    4. Monte Carlo controls
    5. Notes above the panels
  6. Panels
    1. Panel menu
    2. Discrete Event tabs
    3. Monte Carlo tabs
  7. Scripts
    1. Hooks
    2. Prompt builder
    3. Available in scripts
    4. Example: decide a branch from battery charge
    5. Sandbox and trust
  8. Keyboard and mouse
  9. Messages
  10. Limits
  11. Related

Overview

The Simulator runs the flow of an Action over simulated time, exactly as its Action Diagram draws it. It has two modes:

  • Discrete Event: one timed run that you can watch, step through and answer decisions in. It shows which actions run when, what they wait for, how resources rise and fall, which assets are busy and what the run costs.
  • Monte Carlo: many independent runs with sampled durations and decisions. It shows the spread of total time and cost, percentiles, a cumulative probability curve, the decision paths taken, and the probability of meeting a threshold.

The Simulator reads the model and never changes it while running. It writes to the project in three ways: the settings of a root action (saved as you change them), a run record for each finished run, and Record Result….

Concepts

What the Simulator reads

The Simulator takes everything it needs from the model. Set these up in the Action Diagram and the entities' attributes before you run.

Model elementWhere it comes fromWhat the simulation does with it
FlowThe root Action's Action Diagram: sequence, Parallel, SYNC, OR, LOOP and EXITExecutes the elements in order. Branches run in parallel, or one is chosen.
DurationThe Duration attribute of each Action (a number or a distribution, with a unit)Time the action takes. A decomposed action takes as long as its child flow.
DecompositionChild Actions with their own flowRuns the child flow in place of the parent's own duration
TriggersInput/Outputs an action receives (relationship attribute Trigger, on unless set to false)The action waits until each trigger I/O has been generated
I/O generationInput/Outputs an action generatesMade available when the action ends, after any Conduit delay
Conduit delayThe Conduit that transfers the I/O: Latency plus Size ÷ CapacityDelays delivery of the I/O
Resourcesconsumes, seizes and produces relationships to Resources, with an Amount (default 1)Consumed and seized at the start. Seized amounts are released at the end. Produced at the end.
Asset capacityperformed by with an Amount, and the asset's Multiplicity under its parentThe action waits until the asset has free capacity
Asset busy timeEvery Asset that performs an action (performed by)Busy (%) and utilization charts
CostsCost entities incurred by an Action or by a performing AssetAdded to the running total cost
CalendarThe Start attribute of the root and of each ActionUsed only in Calendar Dates
ScriptsThe action's or construct's simulation scriptHooks that set durations, decide branches, prompt you and track values

Times are kept in seconds and shown in the most readable unit (ms, sec, min, hr, days, months or years).

The detailed rules for durations, decisions, resources, assets, costs and seeds are in Simulation rules below.

How to use it

When and why

Simulate once the functional flow exists and its actions have durations, performers and resources. That is typically after functional analysis, during allocation and architecture trades.

A simulation answers:

  • How long does the operation take, and how much does the time vary?
  • Which actions are on the critical path? Where do they wait, for data, resources or asset capacity?
  • Do resources such as battery charge or data storage stay within limits?
  • Which assets are overloaded?
  • What is the probability that a performance requirement (time, cost, a resource level) is met? This becomes a verification-by-analysis result linked to the requirement.

Run a Discrete Event simulation

  1. Open the Action Diagram of the operation.
  2. Choose ▶ Simulate ▾ → Discrete Event.

    The Simulator opens with that Action as the Root Action.

    Other ways in: Behavior → Simulator in the navigation rail (it opens on an Action whose Simulator settings are saved, otherwise on the first Action with a flow; choose another Root Action as needed), or an Action's Open in ▾ → Simulator. Choosing another Root Action with the mouse opens it at once; from the keyboard, choose it and press Enter (or click Open).

  3. Check the settings: click Settings in the bar at the top (its tooltip lists the current ones). The main settings are Decisions, Speed, Vary fixed durations with ± %, Random seed and Calendar Dates (see Settings).
  4. Press ▶ Play.

    The clock runs and Actions over time (Timeline tab) grows. Action Diagram as it runs colors each action green while it runs, orange while it waits, and grey when finished.

  5. Press ⏸ Pause to stop and inspect.
  6. Press ⏭ Step to advance to the next event, or ⏩ Run to End to finish without animation.
  7. When a dialog titled Input for … appears, choose the path or enter the value.
  8. Click OK.

    The run continues as before: playing, stepping or running to the end.

  9. Read the results when the run ends:
    • Status: 100% Complete, Deadlock or Stopped. After a deadlock it says when the run stopped and what each waiting action waits for, for example Stopped at 0 ms: F1 Separate and Detumble waits for ADCS Sensor Data, which no earlier action produces. Click an action's name to inspect it;
    • Total Time and Total Cost;
    • the resource and utilization panels;
    • the Console, for warnings.
  10. Click any bar or chart element for details.

    The entity opens in the inspector, with how often and how long it ran in this run. Open in ▾ → Item View opens its page.

  11. Press ⟲ Reset to clear the run and start again.

Run a Monte Carlo study

  1. Switch the header to Monte Carlo. From the Action Diagram, choose ▶ Simulate ▾ → Monte Carlo instead.
  2. Set Runs (1 to 20,000; default 100).
  3. Set the Vary fixed durations if you want spread on fixed durations.
  4. Enter a Random seed if the study must be repeatable.
  5. Press ▶ Run Monte Carlo.

    If some ORs or LOOPs have no probability or count, the Unspecified Decisions dialog lists them.

  6. In that dialog, click Use Equal Probabilities to continue. Or click Cancel and set them in the Action Diagram.

    You see a progress bar and the running text k / n · mean … · mean cost …. Click Cancel to stop; the toast reads "Monte Carlo run stopped".

    When the study is done, the text shows the number of simulations and the elapsed time.

  7. Read Runs completed, then the Distribution tab (Statistics, Duration distribution, Cumulative probability (S-curve)) and Branch combinations in the Drivers tab.

    If any runs deadlocked or failed, a red box gives the count and P(failure) with its 95% confidence interval.

  8. To see why a run failed, open Failed runs and click View Run.

    The run replays in Discrete Event mode with its own seed.

  9. Click Back to Monte Carlo results to return.

Check a requirement and record the result

Use this after a Monte Carlo study to turn the results into a verification result.

  1. Click Check Against Requirement….
  2. Choose the Output: Total time, Total cost, the minimum or final amount of each Resource, or a numeric script global (Global: …).
  3. Set the threshold in one of two ways:
    • From a Measure: choose a Measure and a Use (Threshold or Objective). The fields fill in from the Measure (see below).
    • By hand: set Criterion (≤ at most or ≥ at least), Value and Units, and choose the Requirement.
  4. Set Required probability (%) (default 90).

    You see the result table:

    • Criterion and Runs;
    • Mean (95% CI) and P5 / P50 / P95;
    • P(meet), with its 95% confidence interval;
    • Margin (mean vs. threshold);
    • Result: Pass or Fail.
  5. Click Record Result….

    The Record Result preview lists the changes it will make:

    • The Measure's Projected Value (or Value) is set to the mean.
    • A Test Case verifies the requirement. It is a new one named "Simulation check: <output> <criterion>", or an existing one you choose. Its Status becomes Passed or Failed, and its Actual Result is set to the result text.
  6. Untick any row you want to skip.
  7. Click Apply.

    A single Undo takes it all back.

When you choose a Measure in step 3, it fills the fields as follows:

  • Its value fills Value and Units.
  • Its Improvement Direction picks the criterion: Negative gives ≤, Positive gives ≥.
  • The Requirement it specifies fills Requirement.

Saved runs

Every finished run is saved for you; there is no save step.

  • A Discrete Event run is saved when it ends (completed, deadlocked or stopped). A Monte Carlo study is saved when all its runs have finished; a cancelled study is not saved.
  • The record is an Artifact labelled Simulation Run, with a .sim file. Its name is "<root> run <date> seed <n>", for example "Perform Delivery Mission run 2026-10-14 09.30 seed 48213", or "<root> Monte Carlo <date> seed <n>" for a study. Its description summarizes the result.
  • A run without a Random seed gets one, so the name tells you how to repeat it: enter that seed and run again.
  • The toast "Saved as <name>." links to the record.
  • Replays of a Monte Carlo run and opened records are not saved again. Viewers cannot save records.
  • Delete records you do not need in the Database (filter by the label Simulation Run).

Older projects use the label name Simulation Output; it becomes Simulation Run when the project opens, and imports accept either name.

To reopen saved results:

  1. Open Saved Results ▾ in the page header.
  2. Choose the result.

    A banner reads "Viewing saved results: …". Its Run again on the current model link runs the current model in the same mode.

Worked example: the CubeSat EO-1 imaging pass

The demo project contains the operation OPS Run Nominal Imaging Pass. It also contains requirement 6.5 Planning Cycle Time: "The mission shall complete each planning cycle, from target list uplink to product delivery, within 100 minutes." Create the demo with Manage Projects → Project Files ▾ → New Demo Project.

The flow of OPS:

  1. Three steps in sequence:
    • OPS.1 Transmit Imaging Plan (triangular 4 to 9 minutes, peak 6; Ground Station);
    • OPS.2 Receive Imaging Plan (1 minute);
    • OPS.3 Load Command Schedule (2 minutes).
  2. A Parallel: OPS.4 Rotate to Target (normal, 3 ± 0.5 minutes) and OPS.5 Prepare Camera (5 minutes). Both are triggered by the Command Schedule I/O that OPS.3 generates.
  3. A LOOP Each target, 4 iterations: OPS.6 Capture Image Strip (normal, 40 ± 6 seconds), then OPS.7 Encode and Store Image (uniform 20 to 40 seconds).
  4. An OR Contact in view?:
    • Yes (75%) runs OPS.8 Transmit Image Data (normal, 8 ± 1.5 minutes);
    • No (25%) runs OPS.9 Hold Data Onboard.
  5. A Parallel: OPS.10 Recharge Battery in Sunlight (35 minutes) on one branch. On the other, OPS.11 Receive Downlink (9 minutes) followed by OPS.12 Process Image Products (normal, 45 ± 10 minutes).

The resources:

  • Battery Charge (62 Wh initial, 23 minimum, 77 maximum). OPS.4 to OPS.8 consume it. OPS.10 produces it (+30 Wh).
  • Data Storage (1.5 GB initial). It gains 2.5 GB per OPS.7 and loses 8 GB in OPS.8.

The demo has saved settings for OPS: seed 42, and 200 Monte Carlo iterations with ±10% uniform variation on fixed durations.

Run it:

  1. Open Behavior → Simulator.
  2. Choose OPS Run Nominal Imaging Pass as the Root Action and keep Discrete Event.
  3. Press ⏩ Run to End.

    You see:

    • Actions over time shows OPS.4 and OPS.5 side by side, and four numbered iterations of OPS.6 and OPS.7 (#2, #3, #4).
    • The long OPS.11 → OPS.12 branch sets the end time.
    • On the Resources tab, Resource levels over time shows Battery Charge stepping down through imaging and recovering during OPS.10.
    • Total Cost reads "No costs", because the demo has no Cost entities.
  4. Switch to Monte Carlo.
  5. Press ▶ Run Monte Carlo (200 runs).

    Branch combinations (Drivers tab) shows about three quarters of the runs on Yes.

  6. Click Check Against Requirement… and keep Total time.
  7. Choose Measure MOE-7 Planning Cycle Time and Use Threshold.

    Value becomes 100, Units Minutes, Criterion ≤, and Requirement 6.5 Planning Cycle Time.

  8. Keep 90% and read P(meet) and the verdict.
  9. Click Record Result…, then Apply.

    MOE-7's Projected Value gets the mean. A Test Case verifying 6.5 gets Status Passed or Failed. The RVTM now lists that Test Case against 6.5.

Tips and good practice

  • Give every leaf action a Duration. An action with no Duration takes no time and hides on the time axis.
  • Use distributions for durations you are unsure of. Use Vary fixed durations only as a quick sensitivity check.
  • Before Monte Carlo, set probabilities on every OR and iterations on every LOOP. Otherwise each run picks at random, and the results say so.
  • Set a Random seed before recording a verification result, so the result can be reproduced. The seed is included in the recorded text.
  • Run enough iterations. When the required probability lies inside the confidence interval, the check says "Run more iterations for a firmer verdict."
  • Settings are saved with the root action as you change them, so they travel with the project.

Common mistakes

SymptomCauseFix
Status shows Deadlock; the Console says "waiting for I/O … (never generated)"An action receives an I/O as a trigger that nothing generates on the path taken (for example after an OR)Generate the I/O on every path, or set Trigger to false on the receives relationship
Deadlock "waiting for … (never available)"A Resource never gets back above the amount an action needs, or an asset's capacity is smaller than one action's AmountRaise the Initial Amount, add a producing action, or check the Amounts and Multiplicity
Every run has the same total timeAll durations are fixed and variation is NoneUse distributions, or set Vary fixed durations
"Simulation aborted: too many steps (check LOOP counts or recursive decomposition)."A LOOP runs far too often, or an action is inside its own decompositionLower the LOOP count or fix the decomposition
The Console shows "Script error in …"A script threw an exceptionOpen the action's script (Edit Script… in the Action Diagram inspector) and fix the line shown
Asset Utilization is emptyNo action is performed by an AssetRelate actions to their performing Assets

How it connects

  • Fed by: the Action Diagram flow, and the attributes and relationships of its actions, I/Os, resources, conduits, assets and costs. The flow built in Functional Analysis is the same flow.
  • Feeds:
    • Measures (Projected Value or Value);
    • Test Cases that verify requirements, and so the RVTM and Test Center;
    • Artifacts with saved results;
    • MS Project XML schedules and CSV reports.

Simulation rules

This section explains exactly how the Simulator treats durations, decisions, resources, assets, costs and random numbers.

Durations and distributions

  • A Duration is a value and a unit: Milliseconds, Seconds, Minutes, Hours, Days, Weeks, Months or Years. A value with no unit is read as hours.
  • The value is a fixed number or a distribution, such as =norm.dist(40, 6) or =triang.dist(4, 9, 6).
  • Distributions are sampled on every execution.
  • Sampled negative durations are drawn again. A normal distribution therefore behaves as if truncated at 0.
  • Ten distributions are available: beta, binomial, exponential, gamma, log normal, normal, Poisson, triangular, uniform and Weibull. See Attribute Types and Distributions.
  • A Duration of =script() calls the action's duration() hook on every execution. Type =script() in the Duration value; the hook returns the duration in the Duration's unit (no number counts as 0).

Vary fixed durations is a setting that adds spread to fixed numbers only. Distributions are never varied further.

  • Uniform ±% samples evenly within ± the percentage.
  • Triangular ±% samples a triangle that peaks at the fixed value.

Control constructs

ConstructSimulation behavior
Parallel (no entity)Starts every branch at once. Continues when all branches finish.
SYNCSame as Parallel. Its Duration is a timeout. When it expires, the unfinished branches are stopped (their Gantt bars turn red, "stopped by SYNC timed out") and the flow continues.
ORTakes exactly one branch, chosen by the Decision type (below)
LOOPChecks its Repeat while before each pass, and runs the body again while it holds
EXITEnds the enclosing LOOP. At the top level it ends the flow.

OR decision types:

  • Probability: each branch has a probability (%). Branches left blank share what remains of 100% equally. If every probability is 0, each branch is equally likely.
  • Resource amount: each branch compares the current amount of the chosen Resource (==, !=, >, <, >=, <=). The first branch whose condition holds is taken, else the branch marked else.
  • Script: the construct's onEnd() returns the name of the branch to take (or its index). An unknown name logs a warning, and a random branch is taken.
  • None (ask during the run, or random): with Decisions set to Ask (when no script), a dialog asks which path to take. Otherwise a branch is picked at random.

LOOP continue conditions:

  • Iterations: a fixed number of passes (at least 1).
  • Probability: before each pass, continue with this probability (%).
  • Resource amount: continue while the Resource amount meets the comparison.
  • Script: onEnd() is called before each pass. true runs the body again, false stops, and a number sets how many more passes to run.
  • None (ask during the run, or random): in prompt mode, a dialog asks for the How many iterations? (default 3). Otherwise it runs 0, 1 or 2 passes at random.

Resources

A Resource has Initial Amount, Minimum Amount, Maximum Amount and Units. The initial amount is clamped to the minimum and maximum.

  • consumes: the amount is taken when the action starts and not returned.
  • seizes: the amount is taken when the action starts and released when it ends.
  • produces: the amount is added when the action ends. Amounts above the maximum are capped.

An action waits when it needs more than is available. "Not available" means the amount would fall below the Minimum Amount, or below 0 when no minimum is set. The action waits until other actions release or produce enough. Its Gantt bar shows a purple hatched wait.

Assets and utilization

  • Every Asset that performs an action (performed by) is busy while the action runs.
  • Busy (%) is the share of the simulated time in which at least one of its actions ran.

To model capacity, set an Amount on the performed by relationship.

  • The asset's capacity is the upper bound of the Multiplicity on its parent's decomposed by relationship. For example, 0..2 gives 2.
  • An action waits while the asset has no free capacity (orange hatched wait).
  • With no Multiplicity, capacity is unlimited.

Costs

  • A Cost entity has Amount, Rate and Units.
  • With Rate Per Hour, the amount is multiplied by the action's duration in hours. Otherwise it is charged once, when the action ends.
  • A Cost incurred by a performing Asset is charged for each action the Asset performs. It is multiplied by the performed by Amount (1 when unset).
  • The units of the first Cost found label every cost figure.

Random numbers and seeds

  • Random seed makes a run repeatable. Leave it blank for a new random sequence each time.
  • In Monte Carlo, each run draws its own seed from the study's seed. You can therefore replay any single run in Discrete Event mode with Replay in the Runs tab (or View Run for a failed run).
  • Math.random() in scripts uses the same seeded generator.

The Simulator page

Page header and run bar

The bar under the page header holds, from left to right, the Root Action, the run controls of the mode (below), Settings and the mode switch. Before the first run the page shows one line of explanation and the Action Diagram; the summary cards (Status, Total time, Total cost, or the Monte Carlo ones) appear with the first run.

  • Root Action: the action whose flow runs. The list shows every Action with an action flow. An action without one appears as "(no flow)". Choosing another root reopens the page for it.
  • Discrete Event / Monte Carlo: the mode. Switching keeps the settings of each mode.
  • Page header: Saved Results ▾ (the saved runs, or "No saved runs yet. Each finished run is saved here.") and Open Action Diagram.

Settings

Settings shows or hides the run settings under the bar (hidden at first; the choice is remembered in this browser). Its tooltip lists the current settings, for example "automatic decisions, 100× speed, fixed durations, seed 42".

SettingModeValuesDefault
RunsMonte Carlo1 to 20,000100
DecisionsDiscrete EventAutomatic (when no script), Ask (when no script)Automatic (when no script)
SpeedDiscrete Event1×, 10×, 100×, 1,000×, 10,000×, 100,000× (simulated seconds per real second)100×
Vary fixed durationsBoth (kept separately per mode)None, Uniform ±%, Triangular ±%None
± %Both0 to 10010
Random seedBothA number, or blank for randomblank
Calendar DatesDiscrete EventStart the clock at the root Action's Start date; Actions with a Start wait for itoff
Start paused (step through)Discrete EventCreates the run when the page opens, ready for ⏭ Stepoff
  • Settings are saved with the root action in the project as you change them, and apply for everyone who opens it. Each change can be undone with a single Undo. They are also remembered in this browser for other root actions.
  • Reset to defaults (after "Settings are saved with this Action.") restores the defaults and clears the entity choices of the charts.
  • Viewers can change settings for their own runs; they are not saved in the project.

Discrete Event controls

  • ▶ Play / ⏸ Pause: animate the run at the chosen speed. Long stretches with no events are skipped at once.
  • ⏭ Step: advance to the next event.
  • ⏩ Run to End: run to the end without animation. It still stops for prompts.
  • ⟲ Reset: discard the run.
  • Clock: the current simulated time (a date and time in Calendar Dates).

Monte Carlo controls

  • ▶ Run Monte Carlo, Cancel, the progress bar and progress text.
  • Check Against Requirement… (enabled after a study with completed runs).
  • Any run can be replayed or downloaded as an MS Project schedule from the Runs tab.

Notes above the panels

Notices that need attention, such as viewing saved results, stay visible with the settings hidden.

  • "±n% uniform variation added to fixed durations." (or triangular) when variation is on.
  • "Equal probabilities used for n unspecified constructs: …" after Use Equal Probabilities.
  • The failed-runs box (Monte Carlo) and the replay banner "Replaying Monte Carlo run n (deadlock or error) with seed s and the study's settings."

Panels

The results sit in a fixed layout: a summary strip at the top and tabs below it. Each tab holds two columns of panels; wide panels (the diagram, the Gantt, the event log, Statistics and Runs) span both. Before a run, each panel shows its description. The open tab is remembered in this browser.

Panel menu

Each panel has a title and one ⋯ menu:

  • Download data… opens the Export dialog with the panel's data: CSV files with every column, and for Actions over time also Schedule (MS Project XML). The file name is "<root> <panel title>".
  • Download image… opens the Export dialog with <panel title> (PNG) (with Transparent background and Scale) and <panel title> (SVG). Images use light-theme colors.
  • Choose entities… (cost, resource and asset charts) opens Choose Entities: filter the list by name or number, tick entities (All, None) and click Apply. With none ticked the chart shows every entity. Cost charts add Show the total. Colors follow the chart palette in list order. The choice is saved with the root action.

Click an entity in a chart, the Status list or the Event log to open it in the inspector, with how often it ran and for how long.

Discrete Event tabs

Summary strip: Status, Total time and Total cost.

TabPanelShowsData
—StatusThe actions running now with progress. Yellow: waiting for an Input/Output; purple: a Resource; orange: Asset capacity. At the end: 100% Complete, Deadlock or Stopped, with the number of action executions and the total time—
—Total timeThe simulation clock (a date in Calendar Dates, with the elapsed time)—
—Total costThe running total cost and the number of costed entities—
TimelineAction Diagram as it runsThe root Action Diagram, read-only, with actions colored as they run (green), wait (orange) and finish (grey)—
TimelineActions over timeA Gantt of executed actions; hatched parts are waits; decomposed actions are brackets you click to collapse (▸/▾); repeated executions are numbered #2, #3; red bars were stopped by a SYNC timed out; a red dashed line marks the clock. Tools: +, − (zoom), Reset, Hide Line Arrows / Show Line Arrows, Hide Line Colors / Show Line ColorsTimeline (CSV), Schedule (MS Project XML)
CostCost over timeCumulative cost per chosen entity, plus the totalCost over time (CSV)
CostCost by entityTotal cost per chosen entity (bar chart)Cost by item (CSV)
ResourcesResource levels over timeAmounts of the chosen Resources over timeResource levels over time (CSV)
ResourcesResource amountsInitial, Minimum, Maximum, Final, Consumed and Produced per ResourceResource changes (CSV)
ResourcesAsset busy timeBusy (%) per performing Asset, and units in use (or actions running) over timeAsset use (CSV)
LogConsoleprint() output, script errors (with line numbers), warnings and deadlocksConsole (CSV)
LogEvent logEvery engine event: start, end, wait, resume, io, transfer, resource, decision, loop, exit, sync, killed, cost, deadlock, errorEvent log (CSV)
LogScript variablesScript globals (globals.put) with their current value; expand a value for its historyGlobal values (CSV)

While a run plays, only the summary strip and the open tab are redrawn; the other tabs catch up when you open them or the run ends.

Monte Carlo tabs

Summary strip: Runs completed.

TabPanelShowsData
—Runs completedCompleted simulations; mean and standard deviation of duration and cost. Deadlocked or errored runs are counted apart and excludedMonte Carlo summary (CSV)
DistributionStatisticsMean, 95% CI of mean, Std. deviation, Minimum, P5, Median (P50), P95 and Maximum of duration, cost and each numeric script global (completed runs only)—
DistributionDuration distributionHistogram of total duration per runRun durations (CSV)
DistributionCost distributionHistogram of total cost per run ("No run had costs." without costs)Run costs (CSV)
DistributionCumulative probability (S-curve)The cumulative distribution of a chosen output, with an x field and the readout P(X ≤ x)—
DriversTime by ActionCombined action durations across all runsAction durations (CSV)
DriversCost by ActionCombined cost per action or asset across all runsAction costs (CSV)
DriversBranch combinationsEach combination of OR branches, with Runs and ShareBranch combinations (CSV)
ResourcesResource levelsMean minimum, maximum and final amount per ResourceResources across runs (CSV)
ResourcesAsset busy timeMean Busy (%) per performing Asset (a bar chart with fewer than three assets)Asset use across runs (CSV)
RunsRunsEvery run with Run, Seed, Outcome (Completed, Deadlock, Error), Duration and Cost. Click a column header to sort (again to reverse). P10, P50 and P90 pick the run at that point of the duration distribution and highlight it. Replay runs one again in Discrete Event mode with its seed; MS Project downloads it as an MS Project XML schedule, "<root> run <n>.xml". The first 500 runs are listedRuns (CSV) (every run: seed, outcome, duration, cost, path, globals)

Per-run console messages are not kept in a study; Replay a run to see them.

Scripts

Scripts are JavaScript hooks on Actions, ORs, SYNCs and LOOPs. Use them when the diagram alone cannot express a behavior, such as a decision based on a resource level.

To write a script:

  1. In the Action Diagram, select the element.
  2. In the inspector, click Edit Script… (for an action), or Edit Script… / Add Script… in the OR, SYNC and LOOP panels.

    The editor dialog opens, for example Script: Capture Image Strip or OR Script: ….

  3. Click Add onStart(), Add prompt(), Add onEnd() or Add duration() to insert an empty hook.
  4. Write the code. Tab inserts two spaces.
  5. Click Save (or Cancel).

Hooks

HookCalledReturn value
onStart()When the action or construct starts—
prompt(p)After onStart, to build an input dialog— (fill p)
onEnd(response)When an action ends; for an OR when it decides; for a LOOP before each passOR: the branch name or index. LOOP: true to continue, false to stop, or a number of further passes
duration()When the action's Duration is =script()The duration in the Duration's unit

response holds the answers of the prompt dialog, keyed by input name.

With Automatic (when no script), and in Monte Carlo, the prompt is not shown. The default values are used instead: a number's value or 0, a checkbox's value, or the first choice.

Prompt builder

  • p.setTitle(text): the dialog title (default "Input for <name>").
  • p.addEnumInput(title, name, choices, default): a choice list.
  • p.addTextInput(title, name, default), p.addBigtitleTextInput(title, name, default) (multi-line), p.addNumberInput(title, name, default), p.addBooleanInput(title, name, default) (checkbox).

The dialog reads "Simulation paused at <time>." and closes with OK.

Available in scripts

  • print(x, …): writes to the Console. Objects print as JSON.
  • globals.put(key, value), globals.get(key): values tracked over time in the Script Variables. Numeric globals become Monte Carlo outputs (Global: key) in Statistics, the S-Curve and Check Against Requirement….
  • Sim.getEntityById(id), Sim.getEntityByGlobalId(id), Sim.getEntityByName(name), Sim.getEntityByNumber(number), Sim.getEntitiesByName(name), Sim.getEntitiesByNumber(number): return entity wrappers.
    • Properties: id, name, number, description, className.
    • Methods: getId(), getGlobalId(), getName(), getNumber(), getDescription(), getAttribute(name) (by attribute name, any case) and attributes().get(name).
  • Sim.getIOValueById(id), Sim.getIOValueByGlobalId(id), Sim.getIOValueByName(name), Sim.getIOValueByNumber(number): the Value attribute of an Input/Output.
  • Sim.getAmount(name), Sim.getAmountById(id), Sim.getAmountByGlobalId(id): a Resource's current amount. Sim.getResourceByName(name) returns {id, name, amount, units}.
  • Sim.setResourceById(id, value), Sim.setResourceByGlobalId(id, value), Sim.setResourceByName(name, value): set a Resource's amount (logged as a Script change).
  • Sim.getCurrentTime() (milliseconds since the start) and Sim.getCurrentCost().

Each script is compiled once per run, so top-level variables keep their values across passes of a loop. The model is read-only to scripts except for resource amounts.

Example: decide a branch from battery charge

function onEnd() {
  const wh = Sim.getAmount('Battery Charge');
  globals.put('Battery at decision', wh);
  return wh > 40 ? 'Yes' : 'No';
}

Put this on the OR Contact in view? with Decision type Script. The branch names must be Yes and No.

Sandbox and trust

  • Every run executes in a separate sandbox with a read-only copy of the model. Scripts have no access to the page, other projects, files, browser storage or the network.
  • A script call that runs longer than 8 seconds stops the run: "The script of <name> ran longer than 8 s and was stopped. Check it for an endless loop."
  • Scripts you write or approve in this browser are trusted.

A run can include scripts from somewhere else, such as an imported file or another member's edits. Before such a run, Holarch asks you to approve them. The question appears before ▶ Play, ⏭ Step, ⏩ Run to End and ▶ Run Monte Carlo.

  1. Start the run.

    The dialog Run Scripts From Another Author? lists how many scripts there are. It says that scripts run in a sandbox without access to your projects, files or the network.

  2. Open Show the scripts to review them.
  3. Click Run Scripts to run them, or Cancel.

Once you click Run Scripts, those scripts are trusted from then on in this browser.

Keyboard and mouse

ActionEffect
Click a Gantt bar, chart point, tree-map cell or status rowOpens the entity in the inspector
Click a decomposed Gantt row labelCollapses or expands its children
Tab in the script editorInserts two spaces

Messages

MessageMeaning and fix
"No Action to simulate" / "Give an Action child Actions and draw their flow in its Action Diagram."The project has no Action with a flow
"Simulation error" with detailsThe run could not start or the sandbox failed; read the details
"The root Action no longer exists. Choose another root Action."The root was deleted
"Script error in <name> (<hook>): <message>"A script threw; the run stops. The Console shows the line number
"<name>: script returned "x", which matches no branch; picked at random."An OR script returned an unknown branch name
"<name>: more than 10000 iterations — check the LOOP condition."A LOOP never stops
Loops That Never End (before a run)No EXIT can end a loop that repeats at 100 % (Action.19). Fix it, or Run Anyway.
"An infinite hierarchy exists (A → B → A). Remove one of these decomposition links in the diagram."An action is decomposed into itself
"Simulation aborted: too many steps (check LOOP counts or recursive decomposition)."More than 20,000 action executions in one run
"Simulation aborted: event limit reached."More than 500,000 events in one run
"Deadlock: <action> waiting for I/O <name> (never generated)"A trigger I/O was never generated
"Deadlock: <action> waiting for <amount> <resource> (never available)" / "waiting for Asset capacity: …"A resource or capacity never became available
"Asset <name> has more than one parent; using the first for its capacity."The asset's capacity comes from the first parent's Multiplicity
"<I/O> is carried by several Conduits; the simulator used <conduit>."Only the first Conduit's delay applies
"Simulation scripts have no network access (Sim.httpGet, httpPost and httpPut are not available)."Scripts cannot call the network
"No entity was found with name: <name>" / "No resource was found with id: <id>"A Sim lookup found nothing
"Simulation scripts cannot compile code at run time." / "Simulation scripts cannot use import()."A script tried to create or load code
"The script of <name> ran longer than 8 s and was stopped. Check it for an endless loop."Script watchdog
"The simulation stopped responding and was stopped."The sandbox stopped responding outside a script
"Monte Carlo run stopped"You clicked Cancel
"n of N runs failed (d deadlocked, e errored). P(failure) = …"Failed runs are excluded from the statistics; use View Run
"No completed runs. Run Monte Carlo first."Check Against Requirement… needs completed runs
"Enter a threshold value, or choose a Measure." / "Enter a threshold value first."The check has no value
"<Measure> has no numeric Threshold Value. Enter the threshold."The Measure's threshold or objective is not a number
"Choose a Measure or a Requirement to record the result."Record Result… needs a target
"Select at least one change."Every row of Record Result is unticked
"Result recorded"The Measure and Test Case were updated
"The required probability lies inside the confidence interval. Run more iterations for a firmer verdict."The verdict could change with more runs
"Could not read the saved results: <reason>. Run the simulation again."The saved .sim file is missing or invalid; click Run again
"This panel is for the other simulation mode."A panel of the other mode
"View only: ask an owner for edit access."Viewers can run simulations but cannot save settings, results or recorded checks

Limits

  • Monte Carlo: 1 to 20,000 iterations per study.
  • One run: at most 20,000 action executions, 500,000 events, and 10,000 passes of one LOOP.
  • Script calls: 8 seconds each.
  • Failed-runs table: the first 50 failed runs are listed. Runs ⋯ → Download data… → Runs (CSV) lists every run.
  • Runs tab: the first 500 runs are listed; Runs (CSV) has them all.
  • Monte Carlo statistics use completed runs only.
  • Only the first Conduit that transfers an I/O sets its delay; only the first parent sets an asset's capacity.