Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

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)
/opt/homebrew/Caskroom/miniconda/base/envs/erad/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:502: UserWarning: Ellipsis is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`.
  warn(
Loading...

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)
Loading...
2025-05-08 20:44:12.006 | WARNING  | erad.runner:run:37 - No HazardFragilityCurves definations found in the passed HazardSystem using default curve definations

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
Loading...