Feature

Scenarios & Fault Validation

Script, replay, and debug realistic scenarios against running digital twins before physical systems are ready.

Recreate an event. Observe the response.

Some conditions are difficult to reproduce on physical equipment. SPX scenarios apply predefined changes to a running model, so you can observe its response and repeat the same test when your software changes.

Example: a grid disturbance

An energy-monitoring application needs to handle abnormal readings as well as steady operation. In this example, a three-phase Modbus meter runs a short overload scenario. The model changes its load; its simulated voltage and frequency respond, then return when the scenario ends.

Overload scenarioEnergy meter modelModbus TCPYour application
SPX UI showing the three-phase energy meter's Scenarios tab and a recorded overload event: voltage L1 and frequency decrease and then return to their starting values.
A recorded SPX run: voltage L1 and frequency use separate vertical scales; time is in seconds.

Screenshot preview

A recorded SPX run: voltage L1 and frequency use separate vertical scales; time is in seconds. Open original image

The screenshot shows the actual frequency_dip_under_overload scenario in the Energy.EnergyMeter3Ph.Modbus model. This is a simplified, scripted load response: it does not simulate an inverter losing synchronism or reproduce a whole-grid blackout.

Try it in SPX

  1. In Instances, open a running Energy.EnergyMeter3Ph.Modbus instance, or create and start one.
  2. In Attributes, clear Select All, then select voltage_l1 and frequency_hz. Switch the frequency to the second axis.
  3. Open Scenarios and start frequency_dip_under_overload. Watch both signals drop and return as the scenario finishes.
  4. To test an external client, connect it over Modbus. The model maps voltage L1 to holding registers 0–1 and frequency to 12–13 as floats; confirm the mapping and address convention in the instance's Communication tab.

The chart uses separate scales for volts and hertz. Automatic scaling can make the two curves overlap, so use the legend and axis labels to distinguish them. For a complete before-and-after view, open the chart before starting the scenario; if it has already finished, run it again.

The example demonstrates the simulated readings. Any alert, protective action or recovery logic belongs to the system you connect and test.

Try it with your AI agent

With SPX running and your local agent connected through the prepared workspace, copy this request into your agent:

Prompt for your AI agent

Use SPX to create and start a new Energy.EnergyMeter3Ph.Modbus instance. Run its frequency_dip_under_overload scenario and compare voltage_l1 and frequency_hz before, during, and after the event. Report the model, instance name, observed readings, scenario result, and how to view the instance in SPX UI. If the model, protocol settings, or a required service is unavailable, explain what is missing before making changes.

Tested with GPT-6 Luna · Medium

The agent can inspect the model, start the scenario and read the values through SPX tools. Open the instance in SPX UI to plot the two attributes; use separate axes for voltage and frequency. The readings depend on the model and timing, so ask the agent to report what it actually observes.

In our local test, the agent was given the SPX workspace location, created the meter and ran the scenario. It reported voltage changing from 396.08 V to 384.8 V and frequency from 50.0 Hz to approximately 49.97 Hz, with both returning to their initial values. We then opened that instance in SPX UI and ran the scenario again to verify the chart. Your readings may differ.

More ways to use scenarios

  • Exercise alarms and recovery when a measurement goes outside its normal range.
  • Reproduce an intermittent condition while debugging a client.
  • Repeat a known event after a software change and compare the response.

Related protocol examples

Related quickstarts