1111from gridappsd import GridAPPSD , topics as t
1212from gridappsd .simulation import Simulation , PowerSystemConfig , SimulationArgs , SimulationConfig
1313
14+ simulation_is_complete = False
15+
1416@pytest .fixture
1517def createGadObject ():
1618 gad_user = os .environ .get ('GRIDAPPSD_USER' )
@@ -21,7 +23,6 @@ def createGadObject():
2123 os .environ ['GRIDAPPSD_PASSWORD' ] = 'manager'
2224 return GridAPPSD ()
2325
24-
2526def test_createSimulations (createGadObject ):
2627 gadObj = createGadObject
2728 response = gadObj .query_model_info ()
@@ -32,7 +33,13 @@ def test_createSimulations(createGadObject):
3233 run_realtime = True ,
3334 pause_after_measurements = False )
3435 sim_config = SimulationConfig (simulation_config = simulationArgs )
36+ modelsToRun = [
37+ "49AD8E07-3BF9-A4E2-CB8F-C3722F837B62" , # IEEE 13 Node Test Feeder
38+ "C1C3E687-6FFD-C753-582B-632A27E28507" # IEEE 123 Node Test Feeder
39+ ]
3540 for m in models :
41+ if m .get ("modelId" ) not in modelsToRun :
42+ continue
3643 line_name = m .get ("modelId" )
3744 subregion_name = m .get ("subRegionId" )
3845 region_name = m .get ("regionId" )
@@ -41,5 +48,12 @@ def test_createSimulations(createGadObject):
4148 GeographicalRegion_name = region_name )
4249 sim_config .power_system_configs .append (psc )
4350 sim_obj = Simulation (gapps = gadObj , run_config = sim_config )
44- rvStr = json .dumps (sim_obj ._run_config , indent = 4 , sort_keys = True )
45- pass
51+ def on_simulation_complete (sim ):
52+ global simulation_is_complete
53+ simulation_is_complete = True
54+ sim_obj .add_oncomplete_callback (on_simulation_complete )
55+ sim_obj .start_simulation ()
56+ while not simulation_is_complete :
57+ time .sleep (1 )
58+ print ("Simulation completed successfully." )
59+ gadObj .disconnect ()
0 commit comments