Running Simulations#
An ERAD simulation is essentially an interaction between the AssetSystem (a collection of distribution system assets e.g. lines, poles etc.) and HazardSystem (a collection of hazard model that may or may not be propagating over time). A simulation is run using an instance of HazardSimulator, which uses AssetSystem as input
from erad.models.asset import Asset
from erad.runner import HazardSimulator
from erad.systems.asset_system import AssetSystem
asset = Asset.example()
asset.asset_state = []
asset.pprint()
asset_system = AssetSystem(auto_add_composed_components=True)
asset_system.add_component(asset)
hazard_scenario = HazardSimulator(asset_system=asset_system)
Asset( name='Asset 1', distribution_asset=UUID('123e4567-e89b-12d3-a456-426614174000'), connections=[], devices=[], asset_type=<AssetTypes.distribution_poles: 6>, height=<Quantity(100, 'meter')>, latitude=37.7749, longitude=-122.4194, asset_state=[], elevation=<Quantity(28.0, 'meter')> )
Once an instance of HazardSimulator has been created, the run method is used to run the actual simulation for a given HazardSystem.
from erad.systems import HazardSystem
from erad.models.hazard import WindModel
hazard_system = HazardSystem(auto_add_composed_components=True)
wind_model = WindModel.example()
wind_model.pprint()
hazard_system.add_component(wind_model)
hazard_scenario.run(hazard_system=hazard_system)
WindModel( name='hurricane 1', timestamp=datetime.datetime(2025, 10, 28, 17, 35, 39, 818204), center=<POINT (-121.93 36.601)>, max_wind_speed=<Quantity(50, 'mile / hour')>, radius_of_max_wind=<Quantity(50, 'mile')>, radius_of_closest_isobar=<Quantity(300, 'mile')>, air_pressure=<Quantity(1013.25, 'hectopascal')> )
2025-10-28 17:35:39.822 | WARNING  | erad.runner:run:52 - No HazardFragilityCurves definitions found in the passed HazardSystem, using default curve definitions
2025-10-28 17:35:39.823 | INFO     | erad.runner:run:60 - Simulating hazard at 2025-10-28 17:35:39.818204
Once the simulation is complete, asset states can be retrieved by iterating over assets in the AssetSystem
for asset in asset_system.get_components(Asset):
    asset.pprint()
    break
Asset( name='Asset 1', distribution_asset=UUID('123e4567-e89b-12d3-a456-426614174000'), connections=[], devices=[], asset_type=<AssetTypes.distribution_poles: 6>, height=<Quantity(100, 'meter')>, latitude=37.7749, longitude=-122.4194, asset_state=[ AssetState( name='', timestamp=datetime.datetime(2025, 10, 28, 17, 35, 39, 818204), wind_speed=SpeedProbability( name='', survival_probability=1.0, speed=<Quantity(36.1212988, 'mile / hour')> ), flood_velocity=None, flood_depth=None, fire_boundary_dist=None, peak_ground_velocity=None, peak_ground_acceleration=None, survival_probability=1.0 ) ], elevation=<Quantity(28.0, 'meter')> )
