Skip to content

Templates

Compose models into plant topologies using .miravo.yaml templates. Define ISA-95 hierarchies, parameter overrides, variation, and simulation settings.

A template (.miravo.yaml) composes twin models into a plant topology.

kind: MiravoTemplate
version: "1"
name: "Smart Factory Production Line"
description: "Discrete manufacturing line with conveyors, motor, coolant, compressed air"
namespace:
enterprise: MiravoWorks
site: smart-factory
areas:
- name: production
lines:
- name: line-1
twins:
- model: belt-conveyor
count: 2
variation: 0.04
- model: ac-induction-motor
count: 1
variation: 0.03
- model: centrifugal-pump
count: 1
variation: 0.05
parameters:
rated_flow: 35
rated_head: 24
- name: utilities
lines:
- name: compressed-air
twins:
- model: air-compressor
count: 1
settings:
tick_interval_ms: 1000
time_multiplier: 20
FieldRequiredDescription
kindYesMust be MiravoTemplate
versionYesSchema version. Currently "1"
nameYesHuman-readable name
descriptionNoTemplate description
namespaceYesUNS namespace with enterprise and site
areasYesList of plant areas
settingsNoSimulation settings

The namespace sets the top two levels of the UNS topic hierarchy:

namespace:
enterprise: AcmeCorp
site: detroit-plant

Produces topics like: AcmeCorp/detroit-plant/production/line-1/pump-001/pressure

Areas contain lines. Lines contain twin assignments. This maps to ISA-95 structure:

`{enterprise}/{site}/{area}/{line}/{instance}/{member}`

Each twin entry specifies:

FieldRequiredDefaultDescription
modelYesModel name (must exist in content catalog)
countNo1Number of instances to spawn
variationNo0Random spread (0-1) applied to numeric parameters
parametersNoParameter overrides (numeric values only)

Instance IDs are auto-generated: centrifugal-pump-001, centrifugal-pump-002, etc.

FieldDefaultDescription
tick_interval_ms1000Milliseconds between ticks
time_multiplier1Simulation speed multiplier. 20 means 20x faster than real time.
seedRandomRNG seed for deterministic output
overrun_threshold_multiplier1.5When a tick takes longer than interval * multiplier, it is flagged as an overrun

The variation field applies random spread to numeric parameters when spawning instances. With variation: 0.05, a parameter with default 1750 could range from 1662.5 to 1837.5 (plus or minus 5%).

Each instance gets a different variation from the seeded RNG, producing realistic fleet diversity.

Templates reference models by name. Miravo resolves models through three layers in priority order:

  1. Current directory.twin.yaml files in the working directory
  2. Local registry~/.miravo/registry/local/models/
  3. Built-in — Shipped with Miravo via the @miravo/content package

This means you can override a built-in model by placing a file with the same name in your working directory or local registry.

Built-in template by name:

Terminal window
miravo start --template smart-factory

Local template by path:

Terminal window
miravo start --template ./my-plant.miravo.yaml

Validate without running:

Terminal window
miravo start --template smart-factory --dry-run