Open Tools · Seqchart
Seqchart user guide
The Seqchart user guide: steps, transitions and qualifiers, the Structured Text subset, standard timer and counter blocks, the I/O panel, timing chart, files, limits and how it is verified. To use the tool itself, open Seqchart.
Professional use. Results are for education and preliminary design. They must be checked by a qualified professional, and they are not a substitute for code-compliant design or licensed engineering judgement.
Getting started: a first chart in two minutes
Not for controlling real machinery. Seqchart is for education and preliminary design. It is NOT for controlling real machinery: it simulates control logic on a virtual scan cycle and has no real-time guarantees, no safety function, no certification and no connection to hardware. Results must be checked by a qualified professional and are not a substitute for code-compliant design, a safety assessment or licensed engineering judgement.
- Press Examples and choose Traffic light. The chart opens in the Chart tab.
- Press Space (or Run). The green step lights up, the lamps in the I/O panel follow the chart, and the timing chart at the bottom draws every signal.
- Click the Pedestrian button in the I/O panel (or press the digit key shown next to it). The request latches and the green phase ends once it has lasted 5 s.
- Press . (full stop) to run exactly one scan, then read the Scan log: it lists the inputs applied, the transitions that fired and the actions that ran.
- Select a step in the chart, press Enter, and change an action's qualifier. The change takes effect when you next run; the simulator reloads from the edited chart.
- File > Save downloads a
.seqchart.jsonfile. Your work is also kept in this browser automatically.
Start from Blank project to build your own: add steps and transitions in the Chart tab, declare variables in the Structured Text tab, and map the variables you want on the panel in the I/O map tab.
The workspace
| Area | What it does |
|---|---|
| Top bar | Project name, Examples, Open, Save, Export, undo and redo, the run controls (Run/Pause, Step, Step x10, Reset, speed), the simulated time and scan counter, the gate status, and links to the Guide and Verify pages. |
| Chart tab | The diagram of steps and transitions, with an inspector for the selected item. Active steps are outlined green while the simulation runs. |
| Structured Text tab | The program source with highlighting, line numbers and the diagnostics list. |
| Actions tab | Named action bodies written in Structured Text; steps refer to them by name. |
| I/O map tab | Which variables appear on the panel, as switches, buttons, sliders, lamps, valves, motors, gauges and indicators. |
| I/O panel | Live controls and indicators. Click or tap a switch, hold a button, drag a slider. |
| Watch table | Any variable by path (Count, Mix.ET, Fill.T, Tank[3]), with its type and value. You can write a value once or force it. |
| Timing chart | One lane per recorded signal, with a cursor, zoom and a downloadable SVG or CSV. |
| Scan log | The events of the most recent single-step scan. |
On a phone the panels become tabs along the bottom edge; everything is reachable by touch and nothing needs hover.
The scan cycle
Seqchart simulates a programmable controller's repeating scan on a virtual clock. Scan number k happens at the time t = k x scan period. There is no real-time behaviour: a run can go faster or slower than real time, and time stops when you pause.
Every scan does these six things in this fixed order:
- Inputs. Scripted input events due at or before t, then panel changes, then forced values, are written to the variables.
- Flags. The step flags are refreshed:
Step.X(TRUE while the step is active) andStep.T(time since the step became active, as TIME). - Evolution. The chart evolves (see Charts). Every transition that can fire does so together, judged from the situation at the start of the scan. A token therefore moves at most one transition per scan.
- Actions. Qualifiers decide which actions are on this scan. Boolean targets are written; action bodies run.
- Program. The PROGRAM body runs: plant models, interlocks, timers, counters.
- Outputs. Forces are applied again and the trace records every changed signal.
Because inputs are applied first and the program runs last, an output computed by the program is seen by the chart one scan later. The scan period (1 to 1000 ms) is a setting of the project.
Charts: steps, transitions and branching
Step. A named box that is either active or not. The double-bordered step is initial: it is active at the start (a chart may have several initial steps, one token each). A step name must be a valid name (letters, digits, underscore), unique, and different from the program's variables.
Transition. A bar between steps, with a Boolean Structured Text condition. It lists the steps before it (from) and after it (to).
Evolution rules. These are the rules Seqchart implements (written for this tool, see Sources):
- At the start, exactly the initial steps are active.
- A transition is enabled when every step in its from list is active.
- An enabled transition fires when its condition is TRUE.
- Firing deactivates all its from steps and activates all its to steps at the same moment.
- All transitions that can fire in a scan fire together, judged from the situation at the start of that scan. A step that is deactivated and activated by the same evolution simply stays active and its
Step.Tkeeps running. - If two TRUE enabled transitions share a source step, they conflict: the one earlier in the transition list (its priority) fires and the other does not. This is how alternative branches are resolved when more than one condition is TRUE.
Branching, all expressed by the lists of one transition or by several transitions:
| Shape | How to build it |
|---|---|
| Alternative divergence (choose one branch) | Several transitions leave the same step, each with its own condition. List order is the priority. |
| Alternative convergence | Several transitions end at the same step. |
| Simultaneous divergence (parallel branches start together) | One transition with several to steps. Drawn with a double bar below the transition. |
| Simultaneous convergence (wait for all branches) | One transition with several from steps. It is enabled only when all are active. Drawn with a double bar above the transition. |
| Loop back | A transition to an earlier step. Drawn as a dashed line along the left edge. |
The diagnostics list warns about steps that can never become active and about steps with no way out. If more than one token reaches a step, the Scan log reports that the chart is not safe (a step was already active).
Action qualifiers
Each step has a list of actions: a qualifier, a target, and for timed qualifiers a time. The target is either a BOOL variable (which the chart then drives) or the name of an action body from the Actions tab (which runs while the qualifier is on). Several actions on one target are combined with OR.
Definitions used by Seqchart (our own written definitions; other tools differ in details such as the exact meaning of the pulse qualifiers):
| Qualifier | The target is on... |
|---|---|
| N | while the step is active. |
| S | from the scan the step is entered, and stays on until an R resets it. |
| R | never; when its step is entered it resets every stored action of the same target. In one scan all sets are applied before all resets, so reset wins. |
| L t | while the step is active, for at most t after entry. |
| D t | once the step has been active for t, and while it remains active. |
| SD t | stored t after entry, even if the step has been left meanwhile. |
| DS t | stored t after entry, but only if the step is still active then; cancelled if it is left first. |
| SL t | stored from entry, then cleared t later, whether or not the step is still active. |
| P1 | for one scan, the scan in which the step is entered. |
| P0 | for one scan, the scan in which the step is left. |
| P | for one scan on entry and for one scan on exit. |
Elapsed time is measured in whole scans: a delay of 30 ms at a 10 ms scan period is satisfied in the third scan after entry (elapsed 30 ms), a delay that is not a multiple of the period is satisfied on the first scan at or after it.
Structured Text subset
A documented subset of PLC-style languages (sequential function charts and structured text), written from openly available general descriptions. It is not a conforming implementation of any standard, and no standard text is reproduced.
Source layout. Optional TYPE blocks (enumerations), then any number of FUNCTION_BLOCK and FUNCTION definitions (each may use only blocks and functions defined before it), then exactly one PROGRAM. Names are not case sensitive. Comments are (* ... *) (not nested) and // ... to the end of the line.
Variables. VAR, VAR_INPUT and VAR_OUTPUT blocks, optionally CONSTANT, with initial values: Count : INT := 3;, Table : ARRAY[0..9] OF INT := [1, 2, 3];.
| Type | Meaning |
|---|---|
BOOL | TRUE or FALSE. |
INT | 16-bit signed integer (-32768 to 32767), wraps around on overflow. |
DINT | 32-bit signed integer, wraps around on overflow. |
REAL | Single-precision floating point; overflow or an invalid operation is a fault. |
TIME | Duration in whole milliseconds. Literals: T#1h2m3s4ms, TIME#1.5s, T#250ms. |
| enumeration | TYPE Mode : (Idle, Run, Fault := 9); END_TYPE; members count up unless given a value. |
ARRAY[lo..hi] OF type | One-dimensional, at most 4096 elements, bounds checked at run time. |
| function block | An instance of a standard or user block. |
Number literals: decimal (1_000), 2#1010, 8#17, 16#FF, real (1.5, 2.5e-3).
Operators, from tightest to loosest: **; unary - + NOT; * / MOD; + -; < > <= >=; = <>; AND &; XOR; OR. AND and OR stop evaluating as soon as the result is known (left to right). Integer division truncates toward zero. MOD has the sign of the dividend. ** always gives REAL. Mixing INT, DINT and REAL converts operands to the larger type before comparison or arithmetic. Selection functions convert their selected value too; every REAL assignment rounds to binary32. Powers associate right to left: 2 ** 3 ** 2 is 512; -2 ** 2 is -4; 2 ** -2 is 0.25. Narrowing needs a conversion function.
Statements: assignment; IF / ELSIF / ELSE; CASE with values, comma lists, ranges (1..5) and ELSE; FOR i := a TO b BY c DO (bounds evaluated once; after normal completion the counter holds the first value outside the range); WHILE; REPEAT ... UNTIL; EXIT (Seqchart requires an enclosing FOR, WHILE or REPEAT loop); RETURN; function block calls blk(IN := x, PT := T#2s);.
Functions. ABS, MIN, MAX, LIMIT(min, value, max), SEL(g, in0, in1), SQRT, TRUNC, REAL_TO_INT (rounds half away from zero), REAL_TO_DINT, INT_TO_REAL, DINT_TO_REAL, INT_TO_DINT, DINT_TO_INT, BOOL_TO_INT, INT_TO_BOOL, TIME_TO_DINT, DINT_TO_TIME, and your own FUNCTIONs (positional or named arguments; the function name is the result variable).
Predefined. SCAN_MS (DINT, the scan period) and, for every step, Step.X and Step.T.
Faults. Division by zero, an array index out of range, a numeric overflow of REAL, an out-of-range conversion and exceeding the step budget (200,000 operation units in one scan: each statement, function/block invocation, loop pass and copied array entry costs one unit) stop the simulation and are reported with the unit and line. Reset clears a fault.
Not in the subset: bit operations on integers, strings, structures, pointers, global variable lists, LREAL/LINT and other widths, dates, recursion, and the object-oriented extensions.
Standard blocks
Behaviour as implemented, written from our own definitions. Time comes from the scan clock, so a timer sees time advance by exactly one scan period per scan. Edges are detected between consecutive calls; before the first call the previous input value is FALSE.
| Block | Inputs | Outputs | Behaviour |
|---|---|---|---|
TON | IN, PT | Q, ET | On-delay. While IN is TRUE, ET = min(PT, time since the input rose) and Q = (that time >= PT). When IN is FALSE, Q is FALSE and ET is 0. |
TOF | IN, PT | Q, ET | Off-delay. Q is TRUE while IN is TRUE and for PT after it falls; then ET holds PT until IN rises again. |
TP | IN, PT | Q, ET | Pulse. A rising edge starts a pulse of exactly PT; the input is ignored during the pulse. ET holds PT while IN stays TRUE afterwards. |
CTU | CU, R, PV | Q, CV | Counts up on each rising edge of CU (stopping at 32767); R sets CV to 0; Q = CV >= PV. |
CTD | CD, LD, PV | Q, CV | LD loads PV; counts down on each rising edge of CD; Q = CV <= 0. |
CTUD | CU, CD, R, LD, PV | QU, QD, CV | Up and down edges together cancel. R has priority over LD, and both over counting. |
R_TRIG | CLK | Q | TRUE for one scan after CLK rises. |
F_TRIG | CLK | Q | TRUE for one scan after CLK falls. |
SR | S1, R | Q1 | Set-dominant latch: Q1 = S1 OR (NOT R AND Q1). |
RS | S, R1 | Q1 | Reset-dominant latch: Q1 = NOT R1 AND (S OR Q1). |
Declare an instance, then call it every scan: Delay : TON; and Delay(IN := Start, PT := T#2s); Ready := Delay.Q;. Inputs you leave out keep their last value. Instance outputs are read-only; you can also set an input by assignment (Delay.PT := T#5s;) and call Delay();.
Because the timers are scan-quantised, the first scan with Q TRUE after an input rises in scan r is scan r + ceil(PT / dt) (see the timing identities on the Verify page).
The I/O panel, watch table and forcing
Mapping. In the I/O map tab each row names a variable of the program, whether it is an input (you drive it), an output (the program drives it), or a sensor (a value the program computes, shown read-only), and how it looks: switch, button (held while pressed), slider, lamp, valve, motor, gauge or indicator. A name that is not a variable is reported in the diagnostics.
Driving inputs. Click a switch to toggle it; hold a button; drag a slider. With the panel focused, the digit keys 1 to 9 toggle the first nine inputs. A panel change takes effect at the start of the next scan.
Scripted inputs. A project can carry a list of timed input events (time in ms, variable, value) so that a run is repeatable. The examples use them to press buttons at fixed times. Scripted events are applied before panel changes.
Watch table. Type a variable path and press Enter. Paths address variables (Count), block members (Delay.ET), array elements (Table[3]) and step flags (Fill.T). The Set box writes a value once; the Force box holds a value at the start and end of every scan until you clear it. Only writable variables can be set or forced. Forces are a debugging aid for the simulation; they are not saved in the file.
Timing chart and stepping
The timing chart records every change of the selected signals (by default the I/O points and the step flags). BOOL signals are drawn as digital lanes, numbers as scaled lanes with their minimum and maximum. Keys with the chart focused: Left/Right move the cursor by one scan, + and - zoom, 0 shows everything. The cursor reading lists every value at that time.
A trace is limited to 200,000 recorded changes and 64 signals. When it is full, the older half of the time span is dropped and the chart says so.
Stepping. Step (.) runs one scan and fills the Scan log with the inputs applied, the transitions fired, the steps activated and deactivated, and the actions run. Step x10 (Shift + .) runs ten. Run runs at the chosen speed (1x, 10x, 100x or as fast as the browser allows). Pause and Cancel stop the worker at the next slice; a run that does not stop can be ended with Stop worker.
Files, exports and formats
| Output | Format | Notes |
|---|---|---|
| Project | .seqchart.json | The tool's own documented JSON format: name, scan period, Structured Text source, chart, I/O map, watch list, scripted inputs. It carries a copyright and terms notice. Opening validates every field and refuses damaged files with a message. |
| Source | .st text | The Structured Text source with a header comment. |
| Chart | SVG | The diagram, with the footer. |
| Timing chart | SVG and CSV | CSV has one row for every time any signal changed. |
| Report | Markdown and printable HTML | Chart tables, source, I/O and the state at the end of the run; use the browser's print to make a PDF. |
Every export carries the footer "Made with Seqchart · simulations4all.com" and the notice that the tool is not for controlling real machinery.
Formats not implemented. An XML exchange format for controller programs is published by an industry association. Its schema's licence could not be confirmed as open when this tool was written (checked 2026-10-17), so it is deferred rather than guessed; no proprietary or binary project formats are read or written.
Your work autosaves to this browser's local storage (small projects only). Nothing else leaves your browser except the domain-gate token exchange; there are no accounts and no analytics.
Keyboard shortcuts
| Keys | Action |
|---|---|
| Space | Run / pause (when focus is not on a button; on a button it presses that button) |
| . or F10 | Step one scan |
| Shift + . | Step ten scans |
| R | Reset the simulation |
| 1 to 9 | Toggle input 1 to 9 on the panel |
| Ctrl/Cmd + K | Command palette |
| Ctrl/Cmd + S / O | Save / open a project file |
| Ctrl/Cmd + Z / Shift + Z | Undo / redo (chart edits) |
| Alt + 1 to 4 | Chart, Structured Text, Actions, I/O map |
| ? | Show the shortcut list |
| Chart: arrow keys | Select the neighbouring step or transition |
| Chart: N / T | New step after the selection / new transition from the selected step |
| Chart: I | Toggle the selected step as initial |
| Chart: Enter | Edit the selection in the inspector |
| Chart: Delete | Delete the selection |
| Timing chart: Left/Right, +/-, 0 | Cursor, zoom, show all |
Limitations, limits and budgets
The simulator runs in a background worker, never on the page's main thread, and keeps inside what a phone browser allows.
| Limit | Value |
|---|---|
| Structured Text source | 100,000 characters |
| Steps / transitions / actions | 300 / 600 / 200 |
| I/O points / scripted events / watch rows | 128 / 5,000 / 128 |
| Scan period | 1 to 1000 ms |
| Operation units per scan (step budget) | 200,000 |
| Scans in one run request | 2,000,000, and at most one hour of simulated time |
| Trace | 64 signals, 200,000 changes (about 3.2 MB) |
A larger project or run is refused with a message that names the limit. A run is cancellable at any time; the worker checks its slice time after every scan and honours Cancel when it yields. A running scan is synchronous and bounded by the operation budget; Stop worker ends the worker at once.
Compared with other tools
Seqchart is a teaching and prototyping environment for sequential function charts and Structured Text in the browser. Desktop programming environments for industrial controllers are far larger: they target real hardware, include ladder and function-block diagram editors, instruction-list, motion and safety libraries, online debugging, and certified toolchains. Seqchart does none of those things.
What you get in return: nothing to install, deterministic and repeatable runs (a virtual clock, scripted inputs, a step budget), a single-scan stepper with an event log, a full recorded timing chart, and a documented, tested language subset whose behaviour is checked in your own browser.
Gaps to know about: no ladder, function-block or instruction-list editors; no import or export of controller-vendor project formats; no real-time or hardware connection; a subset of the data types and library; one program per project.
Sources and openness
The language is a documented subset written from openly available general descriptions; no standard's text, tables or figures are reproduced, and the tool makes no claim of conformance or certification. The semantics of every construct are defined in this Guide and checked on the Verify page.
Consulted: a general public encyclopedia article on sequential function charts (https://en.wikipedia.org/wiki/Sequential_function_chart, consulted 2026-10-17) for the vocabulary of steps and transitions and for the rule that a firing transition deactivates all steps before it and activates all steps after it. Everything else, including the qualifier definitions, the scan order and the standard-block behaviour, is our own written definition. Where other tools differ (for example in the pulse qualifiers), this tool follows the definition above.
How we verify Seqchart
Every behaviour in this Guide is covered by a case in one data module, used both by the automated test suite and by the Verify page, so what you can run is exactly what is tested. Today there are 168 cases, grouped as:
- Structured Text semantics: operator precedence, wrap-around, integer division and MOD signs, loops, CASE, arrays, enumerations, functions and blocks, with hand-derived expected values.
- Rejections: programs that must be refused, each with the exact diagnostic.
- Standard blocks: hand-traced scan sequences for every timer, counter, edge and latch block.
- Timing identities: closed-form checks such as "the first scan with Q TRUE is r + ceil(PT/dt)", across many scan periods and delays.
- Chart evolution and qualifiers: the rules above on small documented charts, with the active steps and the target values at chosen scans.
- Python reference: a separate interpreter written in Python 3 for the integer, loop and array subset; its results are recorded as literals and compared with this tool's.
- Validation against published examples: none are recorded yet. The two placeholders on the Verify page are marked pending source and carry no numbers.
Press Run all checks on the Verify page to run them in your browser; the summary badge shows how many pass, and Print report produces a verification report. These checks verify that the tool does what this Guide says; they do not make a design safe or compliant.
Troubleshooting
| Message or symptom | Meaning and fix |
|---|---|
| This tool runs only on simulations4all.com | The domain gate could not confirm the site. Editing and the Guide still work; reconnect to run. |
| Step budget exceeded | A scan ran more than 200,000 operation units, often a large array copy, many function calls or a WHILE that never ends. Check the loop condition. |
| type-mismatch | Assigning or comparing incompatible types. Use a conversion function, or T#0ms rather than 0 for a TIME. |
| unknown-variable | A name is not declared in the PROGRAM's VAR blocks. Step names and SCAN_MS are predefined. |
| Nothing happens on Run | No initial step is marked, or no transition condition is TRUE. Select a step and press I to toggle it as initial; read the Scan log. |
| An output stays TRUE | Another action on the same target (S, SD, DS, SL) still holds it; add an R action in a later step. |
| A transition fires one scan late | Inputs computed by the program are visible to the chart on the next scan. |
| Division by zero / index-out-of-range | Runtime faults stop the simulation; Reset clears them. |