Drawing a Net
Editor layoutCopy link to this section
The editor is organized around a central canvas where you build your net:
- Top bar -- net management menu, optional title field, Edit / Simulate / Actual mode switcher, active-experiments indicator, recent-changes history. See Top bar.
- Canvas / Definitions -- a compact selector floating over Canvas, or beside search in the Definitions toolbar.
- Canvas (center) -- the main workspace where places and transitions are displayed and connected.
- Viewport controls (bottom right of the canvas) -- zoom, fit and viewport settings buttons. Plugins may add buttons below them; see Plugins.
- Left sidebar -- the Entities tree: every node, token type, differential equation and parameter in the net, in one hierarchy. See Left sidebar.
- Properties panel (right) -- opens when you select an entity, showing its configurable properties.
- Bottom panel -- tabs for Diagnostics (code errors), Simulation Settings, and Timeline (during simulation).
- Bottom toolbar -- editing mode buttons, simulation controls, the AI assistant toggle, and a show/hide button for the bottom panel.
The bottom toolbar sits centered on the canvas and steps aside rather than slide under anything: open a panel wide enough to reach it and it shifts to the free side, keeping clear of the left sidebar, the properties panel and the viewport controls. Where even that leaves too little room it shrinks to the cursor, the panel toggle, the diagnostics status and Play; point at it, or tab into it, and the rest comes back for as long as you stay on it. When resizing makes room again, the hidden controls return automatically. While hovered, the toolbar appears above the surrounding panels so its expanded controls stay accessible. Opening or closing the bottom panel keeps the toolbar's horizontal position stable, including while its controls are revealed on hover. The toolbar blurs the canvas behind it. Chromium browsers also show a refractive glass effect; Firefox and Safari use the blur alone.
Properties panelCopy link to this section
Select an entity to inspect its properties. Subtle lines separate section headers from their content. Places use the same Name and Description fields as transitions and types.
Place settings include an Options section for Component port, Token capacity, and Default starting place. Click a checkbox or its label to toggle the setting. Enabling Token capacity expands a compact Maximum tokens row beneath it. Point at the info icons for an explanation of each option.
Click View type or View equation to open the assigned definition. These navigation actions are available when the net is read-only.
The State and Visualizer section headers have visible expand arrows. Click a header to expand its content and drag the divider to give it more room. The Visualizer switch remains available while its section is collapsed.
Code sections always show their Fill panel action, including while collapsed. Use it to open the editor directly in the full panel; returning restores the section's previous collapsed or open state.
In the full panel, code editors meet the left, right, and bottom edges with square corners and no visible border. Their frame and spacing transition smoothly when entering or leaving this view.
The lighter parent name in the header returns to the property's sections and highlights when hovered.
Differential equations already occupy the full properties panel. Their code editor uses the same edge-to-edge layout and stays visible, read-only, during simulation.
Top barCopy link to this section
Spans the full editor width and has three sections.
Left
- Sidebar toggle -- collapses or expands the left sidebar.
- Menu (hamburger icon) -- file operations: Export (YAML or JSON, each with or without visual info, or TikZ), Layout (apply auto-layout), and Docs. Layout is not offered on a read-only net, because it moves nodes. A standalone embed of Petrinaut may additionally show New, Open, Import, and Load example.
- The host application, or its plugins, may add buttons or items before the title.
- Net title -- inline title for the current net. The host application decides whether the title is editable or read-only, and may hide it entirely.
Center
- Edit / Simulate / Actual mode switcher. See Global modes below.
Right
- Active experiments -- a flask icon with a count (e.g. "2 active") that appears only when Monte Carlo experiments are initializing or running. Clicking it opens a popover; clicking a row jumps to that experiment in Simulate mode.
- Recent changes (clock icon) -- a dropdown listing your recent undo/redo checkpoints with timestamps. Click any entry to jump to that state. This is the same history you walk via Cmd/Ctrl+Z and Cmd/Ctrl+Shift+Z.
- The host application, or its plugins, may add buttons or items here (login, share, ...).
Global modesCopy link to this section
Petrinaut global modes are switched via the centre control in the top bar.
| Mode | Workspace |
|---|---|
| Edit | Canvas or Definitions. Draw and connect nodes on Canvas, or edit the same net as expandable cells in Definitions. Canvas also provides single-run simulation controls. |
| Simulate | Replaces the workspace with the Scenarios and Experiments management views. |
| Actual | Shows a host-provided live execution source. It is disabled unless the host provides Actual-mode data. See Actual Mode. |
In Simulate mode the net structure becomes read-only -- you can still manage scenarios and experiments. You cannot change places, transitions, arcs, types, or parameters. Switch back to Edit mode to modify the net.
In Actual mode the net is also read-only. It shows the Petri net supplied by the live source, with an Actual timeline and Events tab in the bottom panel when execution data is available.
Dragging a node in Select mode or using an editing shortcut on a read-only net shows a brief notice saying why: Simulate and Actual mode point you back to Edit, and a running, paused or finished simulation asks you to reset it first. Selecting, panning and zooming stay available, and in Pan mode a drag that starts on a node pans the canvas. Undo and redo stay available in Simulate mode. On a document the host application opened read-only, the notice says so, and the host application's plugins may add an action to it, such as saving an editable copy.
Switching modes does not stop background experiments. The active-experiments indicator remains visible in the top bar from any mode.
Canvas and DefinitionsCopy link to this section
In Edit, use Canvas / Definitions to switch views. On Canvas, the selector floats below the main header, beside the Entities sidebar when it is open. Its outlined background has a light translucent tint and blurs the canvas behind it. The selected tab has a stronger fill to distinguish it from the other view. The selector follows manual sidebar resizing immediately and moves smoothly when the sidebar opens or closes, if animations are enabled. In Definitions, it shares the search and filter toolbar. The controls become fully opaque when hovered or focused. Both views work on the same net and share the selected entity. Switching between them keeps the canvas position and zoom, and the Definitions view’s scroll position, expanded cells, search, and filters.
Canvas shows the diagram, sidebars, Properties Panel, and simulation controls. Use it to add or remove nodes and arcs and to arrange the net.
Definitions lists places, transitions, types, differential equations, and parameters as expandable cells. Open a cell to edit its name, fields, arc weights, type assignments, or code. Use the search and kind filters to narrow the list, or switch its order between document and dependency order. The graph on the right shows how the selected entity connects to the rest of the net.
On the website, the URL records the selected view; Back and Forward switch views, and reloading a Definitions link opens Definitions again. Simulate and Actual keep their own workspaces.
Adding places and transitionsCopy link to this section
Use the bottom toolbar to add nodes:
- Add Place (shortcut: N) -- click the canvas to drop a place, or click and drag the button onto the canvas.
- Add Transition (shortcut: T) -- click the canvas to drop a transition, or drag the button onto the canvas.
New nodes are named automatically (Place1, Place2, Transition1, etc.). Rename them by selecting the node and editing the name in the properties panel. Places, transitions, component instances, and types can also carry an optional Description, edited in the same panel below the name.
Connecting with arcsCopy link to this section
Drag from a node's handle to connect it:
- Place to Transition creates an input arc (standard input arcs consume tokens from the place).
- Transition to Place creates an output arc (the transition produces tokens in the place).
Petri nets are bipartite: you cannot connect a place to another place or a transition to another transition. New arcs default to weight 1. Input arcs default to Standard, and can be changed to Read or Inhibitor in the arc properties panel.
Automatic arc connectionsCopy link to this section
Enable Automatic arc connections in Viewport Settings to connect nodes directly through their outlines:
- Hover over a place or transition to reveal its outgoing handle.
- Drag the handle onto the target node. A blue outline shows a valid target.
- Release to create the arc. Its endpoints follow the node outlines when you move either node.
Drag from the source: place to transition creates an input arc; transition to place creates an output arc. Release on empty space or press Escape to cancel. Dropping onto a subnet does not create an arc in this mode.
You can also focus the outgoing handle with Tab, press Enter or Space, then focus a target and press Enter or Space again. On touch devices, the outgoing handle stays visible.
Component portsCopy link to this section
Subnets can expose selected places as ports. If you don't see subnet or component controls, enable User settings → Labs → Net Components first.
Open the subnet, select a boundary place, and enable Component port in the place properties panel.
When you instantiate that subnet as a component, each port appears as a handle on the component instance:
- Drag from a transition to a component port to create an output arc into that port.
- Drag from a component port to a transition to create an input arc from that port.
Port arcs behave like ordinary transition arcs: they have weights, input arcs can be Standard, Read, or Inhibitor, and simulation treats the port as the corresponding place inside that component instance.
Arc weightCopy link to this section
Select an arc to open its properties. Set the weight to control how many tokens are required and consumed (standard input), required without being consumed (read input), blocked by (inhibitor input), or produced (output) per firing.
You can also edit an arc's weight via the properties panel for the transition it is connected to.
See also: arc weight for multi-token operations.
Token capacityCopy link to this section
Select a place to open its properties, then tick Token capacity to cap how many tokens the place can hold. Leave it off (the default) and the place is unbounded. The capacity setting is saved with the net and kept when you reopen it.
A capacity works like an arc weight on the receiving side. A transition needs enough tokens in its input places to fire; with a capacity set, it also needs enough room in its output places. If firing would take a place above its capacity, that transition simply is not enabled -- so a full place blocks the transitions feeding it, and the limit is never exceeded.
Details worth knowing:
- The check uses the net change per firing. A transition that consumes one token from a place and returns one to it leaves the count unchanged, so a place sitting exactly at capacity does not block it.
- Read and inhibitor arcs do not consume tokens, so they never free up room.
- A capacity of
0means the place can never receive tokens. - If every remaining transition is blocked by a full output place, the run ends as a deadlock -- the same as running out of input tokens.
- A scenario or initial marking that already exceeds a place's capacity is an error: capacity blocks transitions, so it cannot fix a starting state that is already over the limit.
Capacity is also how you bound a model's worst-case size. With every place capped, the largest possible marking is fixed, which makes the state space finite and the memory a run can consume predictable.
Pan and Select modesCopy link to this section
The editor has two cursor modes, toggled from the bottom toolbar dropdown:
| Mode | Shortcut | Behavior |
|---|---|---|
| Pan | H | Click and drag to pan the canvas. This is the default. |
| Select | V | Click and drag to draw a selection box around nodes. |
The canvas remembers where you left each net. Switching to another net and back, or reloading the app, brings back the same position and zoom; a net you open for the first time is fitted to the screen. Camera movement is view state: panning, zooming, and fitting the net do not create a document change or an undo/redo entry.
Hold Shift and drag to draw a selection box in either mode. Hold Cmd (Ctrl on Windows/Linux) and click a node to add it to the selection, or click a selected node to remove it. A selection box drawn with Cmd held adds the nodes inside it to the selection instead of replacing it. Both work with Shift held as well, whichever key you press first.
With a selection, you can:
- Move -- drag selected nodes to reposition them.
- Delete -- press Backspace or Delete.
- Copy -- Cmd+C (Mac) / Ctrl+C (Windows/Linux).
- Paste -- Cmd+V / Ctrl+V.
Whether a node must be fully inside or only partially inside the selection box is configurable in visual settings.
Neighbourhood highlightCopy link to this section
Selecting a node, or resting the pointer on one, rings it and colours everything one arc away from it:
| Colour | Meaning |
|---|---|
| Blue | Feeds the node -- the places it consumes from, or the transitions filling it. |
| Orange | Fed by the node -- the places it produces into, or the transitions draining it. |
| Purple | Both at once, so tokens cycle through the node. |
The arcs joining them are cased in the same colours, keeping their own colour inside the casing, so you can read which way tokens flow without tracing arrowheads. Hovering an arc rings the node at each of its ends the same way.
Each highlighted node and arc also carries a white band between its own edge and the colour, lifting it off the canvas. A place keeps its own outline visible throughout the fade, including places without a token type. The minimap rings and fades its shapes to match, so you can see where the neighbourhood sits in a net larger than the screen.
Nodes and arcs further away fade back smoothly, keeping their shape and position so the net still reads as a whole. The highlight follows the pointer once it comes to rest, not on the way past, and fades in and out rather than switching -- moving across a crowded net does not make it flicker. Dragging a node starts its highlight immediately and keeps it highlighted until you drop it, even while the pointer is moving. These fades respect the Animations setting and your system's reduced-motion preference.
A selected node stays ringed while you point at something else. If you would rather the pointer left the net alone, turn off Highlight on hover in visual settings; selecting a node still highlights it.
Left sidebarCopy link to this section
The left sidebar holds Entities, one tree of everything in the net, in these groups:
| Group | Contents |
|---|---|
| Nodes | All places and transitions. Click to select and open properties. |
| Token Types | Token types (colours). Click + to create a new type. |
| Differential Equations | ODE definitions for continuous dynamics. Click + to create. |
| Parameters | Global parameters available in all user code. Click + to create. |
A group appears only when the net's extensions allow it: Token Types needs colours, Differential Equations needs colours and dynamics, Parameters needs parameters. A net with subnets gets a Subnets panel below the tree, once Net Components is switched on in visual settings; that setting is off by default.
Toggle the sidebar with the button in the top-left corner.
The tree is a single Tab stop. Arrow keys move through the rows and select as they move, Shift+Arrow extends the selection, and Enter or Space selects the focused row. ArrowRight on a row reaches its ⋯ menu (or a group's + button), and ArrowLeft returns to the row. Group headers collapse with ArrowLeft and expand with ArrowRight.
SearchCopy link to this section
Press Cmd+F / Ctrl+F to open a search bar. Type to filter entities by name. Press Escape to close.
ArrowDown moves from the search input into the results; arrows then walk the results and select as they move, and ArrowUp from the first result returns to the input.
Browser Back and ForwardCopy link to this section
On hosts with app navigation enabled, Browser Back and Forward move through the app locations you visited. This includes switching global modes or Simulate sections, opening an existing scenario, metric or experiment, opening or closing their creation drawers, changing subnet, committing a selection, and opening or closing Viewport Settings. Creation drawers opened from Simulation Settings or the timeline are included too. A drag-selection gesture creates one location after you finish drawing the selection box, rather than one for every pointer move.
Browser history restores what you were looking at; it does not undo changes to the Petri net. Use Petrinaut's Undo / Redo commands for document changes.
Undo / RedoCopy link to this section
Use the Cmd+Z / Ctrl+Z shortcut to undo the last action. Use the Cmd+Shift+Z / Ctrl+Shift+Z shortcut to redo the last action.
The recent history is displayed in the top-right corner. Click on a history entry to go back to that state.
Keyboard shortcutsCopy link to this section
Menus, toolbar tooltips, and the command palette show shortcuts as compact outlined keys beside the action label. Modifier keys match your operating system: ⌘ on macOS and Ctrl on Windows/Linux.
| Shortcut | Action |
|---|---|
| N | Add Place mode |
| T | Add Transition mode |
| H | Pan mode |
| V | Select mode |
| Escape | Clear selection, return to cursor mode |
| Cmd+A | Select all places and transitions |
| Cmd+C | Copy selection |
| Cmd+V | Paste |
| Cmd+Z | Undo |
| Cmd+Shift+Z | Redo |
| Cmd+F | Search |
| Cmd+Shift+K | Toggle the AI assistant |
| Cmd+, | Open user settings |
| Cmd+Shift+L | Auto-layout and fit the net |
| Delete / Backspace | Delete selection |
On Windows/Linux, use Ctrl instead of Cmd.
Snap to gridCopy link to this section
When enabled, node positions snap to a grid when placing or dragging. Toggle this in visual settings.
Import and exportCopy link to this section
From the top-bar menu (hamburger icon), under Export:
- YAML -- the full SDCPN: places, transitions, arcs, types, dynamics, parameters, scenarios, metrics, and canvas positions / display colours. This is the default format, and the one other Petrinaut instances re-import faithfully. It is easier to read and hand-edit than JSON: multi-line code fields (transition kernels, metrics) appear as indented blocks rather than escaped one-line strings.
- YAML without visual info -- the same payload minus node positions and type display colours. Useful when only the logical structure matters (sharing for review, embedding in another tool, comparing two nets without layout noise). On import, the receiving editor applies auto-layout to fill in positions.
- JSON / JSON without visual info -- the same two payloads encoded as JSON, for tools that expect it.
- TikZ -- a
.texfile with a structural diagram. This is a simplified view: only the place / transition / arc structure is included. Token types, dynamics, read/inhibitor arcs, scenarios, and metrics are not encoded. Intended for papers and presentations.
Import: loads a net from a .yaml, .yml, or .json file -- the format is detected from the content, so files exported by any Petrinaut version load the same way. If node positions are missing, an automatic layout is applied on load.
Auto-layoutCopy link to this section
From the hamburger menu, select Layout, or press Cmd+Shift+L (Ctrl+Shift+L on Windows/Linux) on the canvas, to apply an automatic graph layout (ELK) that rearranges all nodes, then fit the result inside the visible canvas around open side and bottom panels. The command-palette action and assistant layout action use the same sequence. The shortcut leaves text fields and code editors alone. Importing a net without positions also lays it out and fits it after the new canvas appears.
Layout changes node positions and therefore creates an ordinary document change when positions move. The following fit changes only the saved viewport, not the document, mutation history, or provenance. This is useful after importing a net without positions or when a net has become cluttered, but it will not always be an improvement. The item is hidden on a read-only net, which cannot accept the move.