Skip to content

Commit

Permalink
Test MSX scenarios: Add sensor reading events
Browse files Browse the repository at this point in the history
  • Loading branch information
andreArtelt committed Jan 23, 2025
1 parent f91c193 commit aec4b1f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/test_advancedquality.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""
Module provides tests to test the advanced quality analysis.
"""
from epyt_flow.simulation import ScenarioSimulator
import random
from epyt_flow.simulation import ScenarioSimulator, SENSOR_TYPE_NODE_BULK_SPECIES, \
SENSOR_TYPE_LINK_BULK_SPECIES
from epyt_flow.simulation.events import SensorFaultStuckZero
from epyt_flow.utils import to_seconds


Expand All @@ -14,6 +17,13 @@ def test_msx_net2cl2():
# Monitor "CL2" bulk species at every node
sim.set_bulk_species_node_sensors(sensor_info={"CL2": sim.sensor_config.nodes})

# Add sensor fault
node_id = random.choice(sim.sensor_config.nodes)
sim.add_sensor_fault(SensorFaultStuckZero(sensor_id=node_id,
sensor_type=SENSOR_TYPE_NODE_BULK_SPECIES,
start_time=to_seconds(days=1),
end_time=to_seconds(days=3)))

# Run entire simulation
res = sim.run_simulation(verbose=True)

Expand All @@ -31,6 +41,13 @@ def test_msx_net2cl2_place_sensors_everywhere():
sim.place_bulk_species_node_sensors_everywhere()
sim.place_bulk_species_link_sensors_everywhere()

# Place sensor faults
link_id = random.choice(sim.sensor_config.links)
sim.add_sensor_fault(SensorFaultStuckZero(sensor_id=link_id,
sensor_type=SENSOR_TYPE_LINK_BULK_SPECIES,
start_time=to_seconds(days=4),
end_time=to_seconds(days=5)))

# Run entire simulation
res = sim.run_simulation(verbose=True)

Expand Down

0 comments on commit aec4b1f

Please sign in to comment.