This event simulator generates realistic manufacturing events for each asset in your assets.csv file and sends them to an Azure Event Hub to be ingested into the RTI workspace in Fabric.
If you are the owner of the Azure Event Hub deployed with the solution, you already have required access to run this event simulator. If not, you will to be added as the Azure Event Hubs Data Sender role by the owner of the Event Hub or your Azure Admin.
NOTE: If the executing environment deployed the resources via AZD following the deployment guide in this solution, the required environment variables for the event simulator will be set automatically and this step can be skipped.
If using Powershell, use this syntax for setting environment variables.
Visit the Azure Portal to get the Event Hub name and connection string of the environment.
export EVENT_HUB_CONNECTION_STRING="Endpoint=sb://..."
export EVENT_HUB_NAME="<event-hub-name>"export SIMULATION_INTERVAL="5" # Seconds between events per asset (default: 5)
export MAX_RUNTIME_SECONDS="300" # Max runtime in seconds (default: unlimited)cd src/simulator# Basic usage (runs until Ctrl+C, quit, or q)
python event_simulator.py
# With custom interval (2 seconds between events)
python event_simulator.py --interval 2
# Run for specific duration (5 minutes)
python event_simulator.py --max-runtime 300
# Use custom data files
python event_simulator.py --assets-csv /path/to/assets.csv --products-csv /path/to/products.csv| Option | Description | Default |
|---|---|---|
--interval |
Seconds between events per asset | 5.0 |
--max-runtime |
Maximum runtime in seconds | Unlimited |
--assets-csv |
Path to assets.csv file | infra/data/assets.csv |
--products-csv |
Path to products.csv file | infra/data/products.csv |
While the simulator is running, you can control it using these commands:
| Command | Aliases | Description |
|---|---|---|
anomaly [#] |
a [#] |
Switch to anomaly mode (all assets or specific asset #) |
normal [#] |
n [#] |
Switch to normal mode (all assets or specific asset #) |
status |
s |
Show current mode and statistics |
stats |
Show detailed per-asset breakdown | |
help |
h, ? |
Show available commands |
stop |
q |
Stop the simulation |
# Start the simulator
python event_simulator.py --interval 2
# During runtime, type commands:
anomaly # Switch ALL assets to anomaly mode
anomaly 2 # Switch only asset #2 to anomaly mode
normal 1 # Switch asset #1 back to normal mode
status # Check current statistics (shows which assets are in which mode)
stats # View per-asset breakdown with modes
normal # Switch ALL assets back to normal mode
stop # Stop simulation- Realistic operational sensor readings
- Low defect probability (typically < 2%)
- Values within normal operating ranges
- Extreme sensor readings indicating equipment issues
- High defect probability (typically > 50%)
- Simulates equipment failures and maintenance needs
Each asset from assets.csv gets its own simulator thread that:
- Generates Random Event: Creates realistic readings based on asset type
- Calculates Defects: Uses sensor conditions to estimate defect probability
- Sends Events: Transmits events to Event Hub which will then stream to Eventstream in Fabric
- Responds to Mode Changes: Switches between normal and anomaly events
- Start simulation
- Use
anomaly 2to simulate equipment failure on asset #2 only - Monitor your data pipeline's response to anomalous data from one asset
- Other assets continue generating normal events for comparison
- Use
normal 2to simulate repair completion
- Start simulation
- Use
anomalycommand to simulate widespread equipment issues - Monitor system response to multiple failing assets
- Use
normalto simulate all equipment returning to normal
- Use
statscommand to monitor defect rates per asset in real-time - Test alerting thresholds with targeted anomaly mode on specific assets
- Validate quality control system responses