States of a resource
An asset can carry states: a barbecue is Off or On, a pool cover Open or Closed, a person Normal, Wet or On fire. Each state says how it is observed on the field and how it looks on the maps. Functions ask for a state, sensors establish it, and the supervision compares the two.
Properties of the asset
| Property | Content |
|---|---|
states | One row per state: name, observed effect (2L, $source is the asset), 3D model url, 2D shape (SAME, POLYGON, POINT), 2D area, 2D fill color, 2D fill pattern (SOLID, HATCHED, NONE), 2D icon. |
default state | The state before anything is observed. |
current state | Written by the engine. An update coming from an application keeps the stored value (keepFieldState): an editor holding an older copy cannot change it. |
state transitions | from, to and an optional 2L condition. Transitions draw the diagram; a condition is only used when no observed effect is true. |
asset 3D model url | Hidden: the own GLB of the asset, shown again by a state without a 3D model. |
How the state is established
The state machine is registered with the 2L rules and replayed by their fixpoint wave, whenever a node read by an effect or a transition changes.
- The states are read in order: the first state whose observed effect is true is the state of the asset. The order therefore expresses a priority (Dead before Bradycardia, before Normal).
- When no effect is true, a transition with a condition may fire; otherwise the state does not change.
- The interceptor
StateMachineModelsPopulateInterceptorregisters the machine when the node is created, updated or reloaded and starts a wave.FixedOntoStateMachineInterceptorreplays it when a sensor is fixed onto the asset or removed from it: an effect may read it throughFixed_Onto. - The rules read the result with
asset.isInState("On").
States of a concept
A concept of the metamodel can declare states as defaults: Barbecue (Off, On) and Swimming_Pool (Open, Closed) in the Furniture extension. Each instance inherits them: a state removed comes back, its own row may change the 3D model, the 2D shape or the effect, an empty effect is filled by the one of the concept, and it may add states of its own after them. Transitions of the concept are added unless the instance defines the same pair. Effects written on a concept use a sensor nature rather than a name: {nature: "THERMAL"}.
What a function asks
A row of the consumes table of a function can name an expected effect on the resource. A “From Concept” row (any Barbecue) becomes a “From Instance” row at deduction, on the instance the problem impacts (ConceptResources); a function with no impacted instance is set aside.
| Field | Meaning | Example |
|---|---|---|
expectedState | The state the resource must be left in. | Extinguish a barbecue → Off |
expectedValue | A change of the value of a sensor of a nature: INCREASE_BY or DECREASE_BY an amount. | Perform a cardiac massage → heart rate +30 |
expectedPosition | OUTSIDE: the resource must be out of the zone. | Rescue a child from drowning → outside the pool |
Three readers use these fields: the Expected states supervision strategy (states only), the knowledge consolidation, and r-iosemit, whose simulated tasks send the sensor value that produces the effect and then hold it, as they would on the field (TaskEffects). A task that brings a value does so gradually during its field duration, a point every 10 s.
Editing the states
The category Diagram States of the edit box, shared by r-ioda, r-ioplay and r-iose, lists the states with the rule of their effect and a preview: the GLB of the state turning on itself, moved with the mouse, and its 2D view.
- The diagram editor draws the states and transitions.
- The assistant writes and reads back the 2L effect: the asset itself, what is fixed onto it at any depth, or a sensor nature; an operator and a value for a sensor; “is inside / is not inside” a zone for a resource. Edit as 2L gives the text; the assistant shows raw 2L for what it cannot read (
distanceTo,isInState). - The 2D area of a state is drawn on a map in a dedicated dialog.
On the maps, the 2D style of the current state is applied to the marker; in the 3D view only the object whose URL changes is reloaded, and the animations of its GLB play. A rio_front_yaw glTF extra on a GLB tells the cameras where its front is.
Example: Barbecue
| Asset | States in order | Observed from |
|---|---|---|
| Martinez barbecue | Off, On | Its thermal sensor: On above 0, Off at 0. |
| Martinez swimming pool | Open, Closed | Its “Pool cover open” sensor. |
| Henri Martinez | Dead, Bradycardia, Wet, On fire, Normal | His cardiac sensor, his position inside the pool, his distance to the lit barbecue. |
See the Henri walkthrough.
Watch points
TaskEffectsreads effects written on the sensor of the asset. It sends no value for an effect written withfindNodeInstanceorisInside, such as those of Henri.- A real probe never reads exactly 0: the Off threshold of the Barbecue effect suits the simulated sensor and would need raising for a real one.
- A project already loaded keeps its former rows until it is loaded again.
