8.3 Event Types & Run-to-Completion Semantics
Key Takeaways
SysML categorizes stimuli into four primary event kinds: Signal Events, Call Events, Time Events, and Change Events.
Time Events express elapsed time (after(<duration>)) or specific timestamps (at(<time>)), with relative timers resetting whenever the source state is exited.
Change Events (when(<boolean-expression>)) fire exclusively on the rising edge when an expression transitions from false to true.
Under Run-to-Completion (RTC) semantics, one event is dispatched and processed to a stable state configuration before the next event can be dequeued.
The defer keyword holds an event in the queue until the state machine transitions into a state capable of processing it.
8.3 Event Types & Run-to-Completion Semantics
Quick Reference: SysML classifies operational stimuli into four primary event kinds: Signal Events (asynchronous data packets), Call Events (synchronous operation calls), Time Events (
after(duration)orat(time)), and Change Events (when(condition)on the rising edge). Under Run-to-Completion (RTC) semantics, an event is dequeued and completely processed to a stable state configuration before the next event is handled. Events that cannot be processed in the current state are discarded unless marked with thedeferkeyword.
Events versus Triggers in SysML
Before exploring event categories, it is vital to distinguish between an Event and a Trigger in SysML:
- Event: A notable occurrence in time and space that has significance for the system (e.g., an optical sensor detecting a barcode, an internal clock tick reaching 50 milliseconds, or a user depressing a physical button). An event occurs independently of whether any state machine is currently listening for it.
- Trigger: A state machine modeling element that references an event and binds it to a transition. The trigger acts as the "listener" or receptor on a transition path that checks whether a dispatched event matches its specification.
The Four Primary Event Kinds
SysML defines four core event types capable of triggering state transitions:
| Event Kind | Formal Syntax | Generation Mechanism | Synchronization | Typical Applications |
|---|---|---|---|---|
| Signal Event | SignalName(param: Type) | Asynchronous arrival of a signal instance | Asynchronous (Sender does not wait) | Hardware interrupts, wireless packets, user inputs, bus messages |
| Call Event | OperationName(param: Type) | Synchronous request to invoke an operation | Synchronous (Caller blocks until handled) | Remote procedure calls, API method invocations, client-server requests |
| Time Event (Relative) | after(duration) | Expiration of a relative timer after state entry | Temporal (Driven by internal clock) | Watchdog timeouts, periodic sampling intervals, communication delays |
| Time Event (Absolute) | at(time) | Arrival of a specific calendar time or timestamp | Temporal (Driven by wall-clock time) | Scheduled maintenance runs, orbital burn windows, daily backups |
| Change Event | when(booleanExpression) | Rising edge transition of a condition from false to true | Continuous (Continuous attribute evaluation) | Tank overflow threshold, thermal overheat limit, low battery level |
Deep-Dive into Event Syntax and Semantics
1. Signal Events
A Signal is a classifier representing an asynchronous communication package containing data attributes. When an entity sends a signal (e.g., via a SendSignalAction in an Activity Diagram), the signal is transmitted to the target entity's event pool.
- Syntax:
SignalNameorSignalName(param1, param2) - Example:
TelemetryPacket(packetID = 104, payloadSize = 256) - Because signal communication is asynchronous, the sender immediately continues its own execution without waiting for the recipient to receive or process the signal.
2. Call Events
A Call Event represents a request to invoke an operation declared on the context Block. Unlike a signal, a call event is inherently synchronous.
- Syntax:
OperationNameorOperationName(arg1, arg2) - Example:
reboot(mode = Force) - The caller initiates the operation call and halts execution (blocks) until the receiving state machine completes the transition or executes the operation behavior and returns control.
3. Time Events: Relative (after) versus Absolute (at)
Time events model temporal triggers without requiring explicit software timer objects.
-
Relative Time Events (
after):- Measures elapsed time starting from the exact instant the source state was entered.
- Syntax:
after(<duration>)where<duration>specifies an engineering time unit (e.g.,after(50 ms),after(10 s),after(2 h)). - The Reset Invariant: If the source state is exited and subsequently re-entered, the relative timer is completely reset to zero! Time does not accumulate across separate visits.
-
Absolute Time Events (
at):- Measures against an absolute point in time.
- Syntax:
at(<point-in-time>)(e.g.,at(2026-10-01 12:00:00 UTC),at(24:00)). - Commonly utilized for mission schedules, satellite eclipse entries, or automated overnight batch jobs.
4. Change Events: when(condition)
A Change Event occurs when a boolean expression transitions from false to true.
- Syntax:
when(<boolean-expression>) - Example:
when(tankLevel > 95 [%]),when(cabinPressure < 70 [kPa])
Critical Exam Distinction: Change Event versus Guard Condition
Candidates frequently confuse a Change Event (when(...)) with a Guard Condition ([...]):
Transition A: when(temperature > 100) / activateFan()
Transition B: SensorPoll [temperature > 100] / activateFan()
- In Transition A (Change Event), the condition
when(temperature > 100)is the trigger itself. The momenttemperaturecrosses the threshold from ≤ 100 to > 100 (the rising edge), the event occurs autonomously and fires the transition. No external event is needed. - In Transition B (Guard), the condition
[temperature > 100]is NOT a trigger. It is a passive gatekeeper. The transition will only evaluate when the distinct trigger eventSensorPollarrives. Iftemperaturereaches 200 degrees but noSensorPollevent occurs, Transition B never fires! - Rising Edge Semantics: A Change Event fires only once upon transitioning from
falsetotrue. If the condition remainstruecontinuously, the change event does not repeatedly fire. The condition must return tofalseand then becometrueagain to generate a new change event.
Completion Events
A Completion Event is an implicit internal event generated automatically by the state machine when an active state finishes all internal processing:
- In a simple state, when the internal
do / <behavior>completes. - In a composite state, when all internal orthogonal regions reach their respective Final States.
Completion events enable anonymous transitions (transitions without explicit trigger labels). If multiple anonymous transitions depart a state, their guards determine which branch fires.
The Run-to-Completion (RTC) Execution Model
The fundamental semantic foundation of all SysML state machines is the Run-to-Completion (RTC) processing model. RTC ensures deterministic, race-free state transitions.
+---------------------------------------------------------------+
| Event Pool (FIFO Queue) |
| [ Event 3 ] ---> [ Event 2 ] ---> [ Event 1 (Next) ] |
+---------------------------------------------------------------+
| (Dequeue Event 1)
v
+---------------------------------------------------------------+
| Run-to-Completion Step |
| |
| 1. Match Triggers in Active State Configuration |
| 2. Evaluate Guards [guard == true] |
| 3. Abort source 'do' activity |
| 4. Execute source 'exit' behavior |
| 5. Execute transition 'effect' |
| 6. Execute target 'entry' behavior |
| 7. Reach Stable Target State Configuration |
+---------------------------------------------------------------+
| (RTC Step Complete)
v
Ready for Next Dequeued Event
The RTC Processing Lifecycle
- Event Pool Ingestion: Events arriving from external blocks, signals, timers, or operations are placed into the context Block's Event Pool (a message queue). UML leaves the dequeuing order as a semantic variation point, so first-in-first-out is a common implementation choice rather than a language rule.
- Dispatch: The state machine dequeues a single event from the pool.
- Evaluation: The state machine inspects all transitions departing the currently active state configuration to find triggers matching the dispatched event whose guards evaluate to
true. - Execution: The enabled transition fires. Source
exitbehaviors, transitioneffects, and targetentrybehaviors execute in strict order. - Stable Configuration: Execution proceeds until a stable state configuration is reached (a set of true states with no enabled triggerless transitions).
- Step Finalization: Only after the stable configuration is fully established does the current RTC step complete. The state machine is now ready to dequeue the next event from the event pool.
Invariant of the RTC Step
During an active Run-to-Completion step, no other event from the pool can be processed. The execution of transition effects, exit behaviors, and entry behaviors is strictly atomic and non-preemptive with respect to external events.
However, note the critical distinction regarding do activities: ongoing do activities execute outside the atomic RTC step. An incoming event can interrupt a do activity, initiating a new RTC step.
Deferred Events: The defer Keyword
In standard state machine execution, if an event is dispatched but the current active state has no transition matching that event (or all guards evaluate to false), the event is silently consumed and discarded.
However, in real-world systems, an event may arrive when the system is temporarily unable to handle it, but discarding the event would cause data loss or system failure (e.g., a CalibratePayloadCmd arriving while the system is still in InitializingHardware).
Semantics of defer
SysML provides the defer reserved keyword to handle this scenario. A deferred event is specified in the internal behaviors compartment of a state:
+---------------------------------------+
| InitializingHardware |
+---------------------------------------+
| entry / runSelfTests() |
| do / loadFirmware() |
| exit / enableBuses() |
+---------------------------------------+
| CalibratePayloadCmd / defer |
| DataUploadReq / defer |
+---------------------------------------+
- Holding Mechanism: When
CalibratePayloadCmdarrives while inInitializingHardware, the state machine recognizes thedeferdirective. Instead of discarding the event, the event is retained in the event pool. - Deferred Recall: When the state machine subsequently transitions into a new state (e.g.,
Operational) that does not deferCalibratePayloadCmdand has an enabled transition matching it, the deferred event is immediately dispatched and processed.
Conflict Resolution and Transition Priority
When an event is dispatched, multiple transitions might theoretically be enabled simultaneously, creating potential conflicts.
1. Hierarchical Priority (Innermost Wins)
If a composite state and one of its nested sub-states both define transitions triggered by the exact same event, the innermost (most deeply nested) transition takes precedence over the outer transition.
- Rationale: The nested sub-state represents a more specialized operational context; its local response overrides the generalized response of the parent composite state.
2. Sibling Conflicts and Non-Determinism
If two transitions originating from the exact same state specify the same trigger and both guards evaluate to true, the SysML specification defines the behavior as non-deterministic. The model does not specify which transition fires. In safety-critical systems engineering, non-deterministic guards are considered a severe design flaw that must be eliminated with mutually exclusive guard conditions (e.g., [speed < 50] vs. [speed >= 50]).
Exam Pitfalls & Misconceptions
| Concept | Correct SysML Rule | Common Exam Trap / Distractor |
|---|---|---|
| Change Event vs Guard | when(expr) is an autonomous trigger firing on the rising edge; [expr] is a passive condition evaluated only upon an event. | Confusing when(...) with [...] or treating guards as continuous monitors. |
| Relative Timer Reset | after(duration) resets to zero every time the source state is entered, even if previously visited. | Believing relative timers accumulate elapsed time across multiple separate visits to a state. |
| Unhandled Events | An event with no matching trigger or whose guards are false is silently discarded by default. | Claiming that unhandled events remain in the queue forever or cause the state machine to throw an error. |
| Deferred Event Scope | A deferred event remains queued until entering a state that does not defer it and can process it. | Believing deferred events are discarded after a fixed timeout without explicit modeling. |
| RTC Atomicity Scope | Exit behaviors, transition effects, and entry behaviors are non-preemptive; do activities are interruptible. | Claiming that the entire lifecycle of a state (including long-running do activities) is non-preemptive. |
A state machine contains a transition with the relative time event after(10 s). The system enters the source state, remains there for 7 seconds, exits to another state via an external transition, and then re-enters the source state 2 seconds later. When will the after(10 s) transition fire (assuming no other transitions fire)?
3 seconds after the re-entry, because elapsed time is accumulated across visits
1 second after the re-entry, because the time spent in the external state counts toward the total duration
10 seconds after the re-entry, because relative timers reset to zero whenever a state is entered
The transition will not fire because relative time triggers are invalidated after the first exit
What is the critical semantic distinction between a transition trigger defined with a change event when(pressure > 100) and a transition defined with a guard [pressure > 100]?
A change event requires a synchronous call event, whereas a guard requires an asynchronous signal event.
A guard continuously polls the state machine memory, whereas a change event is checked only upon state entry.
There is no semantic difference; when(condition) and [condition] are interchangeable alternative notations.
A change event is an independent trigger that fires on the rising edge when the expression transitions from false to true, whereas a guard is a boolean condition that evaluates only when a separate trigger event occurs.
Under SysML Run-to-Completion (RTC) semantics, what occurs when an event arrives that does not match any enabled transition from the current active state and is not marked with the defer keyword?
The event is silently discarded from the event pool without causing any state changes.
The event is preserved indefinitely at the front of the queue, blocking subsequent events.
The state machine raises a fatal unhandled-event fault and transitions to a terminate pseudostate.
The event triggers an automatic rollback of the current state to the initial pseudostate.
Sections you finish are checked off in the contents.