Describe the bug
If an Instance SwitchAreaAgent is created with switch_area_dict=None then the call to self.switch_area.initialize_switch_area(self.agent_area_dict) fails with the following error:
Traceback (most recent call last):
File "/home/vale/git/gridappsd-distributed-static-ybus-service/dsys/distributed_static_ybus_service.py", line 358, in
main(system_bus_config_file=systemBusConfigFile,
File "/home/vale/git/gridappsd-distributed-static-ybus-service/dsys/distributed_static_ybus_service.py", line 275, in main
switchAreaService.connect()
File "/home/vale/git/gridappsd-distributed-static-ybus-service/.venv/lib/python3.10/site-packages/gridappsd/field_interface/agents/agents.py", line 273, in connect
self.switch_area.initialize_switch_area(self.agent_area_dict)
File "/home/vale/git/gridappsd-distributed-static-ybus-service/.venv/lib/python3.10/site-packages/cimgraph/models/switch_area.py", line 52, in initialize_switch_area
for sec_area_msg in switch_msg['secondary_areas']:
To Reproduce
Steps to reproduce the behavior:
Create an instance of SwitchAreaAgent with the argument switch_area_dict=None then call the connect function of that agent.
The error is due to self.agent_area_dict returned by the context manager for this switch area somehow returned the feeder area context dictionary. The code for initialize_switch_area() in switch_area.py is expecting the switch area context dictionary.
This behavior will certainly cause a similar issue when creating an instance of SecondaryAreaAgent with secondary_area_dict=None as well.
Describe the bug If an Instance SwitchAreaAgent is created with switch_area_dict=None then the call to self.switch_area.initialize_switch_area(self.agent_area_dict) fails with the following error:
Traceback (most recent call last): File "/home/vale/git/gridappsd-distributed-static-ybus-service/dsys/distributed_static_ybus_service.py", line 358, in
main(system_bus_config_file=systemBusConfigFile,
File "/home/vale/git/gridappsd-distributed-static-ybus-service/dsys/distributed_static_ybus_service.py", line 275, in main
switchAreaService.connect()
File "/home/vale/git/gridappsd-distributed-static-ybus-service/.venv/lib/python3.10/site-packages/gridappsd/field_interface/agents/agents.py", line 273, in connect
self.switch_area.initialize_switch_area(self.agent_area_dict)
File "/home/vale/git/gridappsd-distributed-static-ybus-service/.venv/lib/python3.10/site-packages/cimgraph/models/switch_area.py", line 52, in initialize_switch_area
for sec_area_msg in switch_msg['secondary_areas']:
To Reproduce Steps to reproduce the behavior: Create an instance of SwitchAreaAgent with the argument switch_area_dict=None then call the connect function of that agent.
The error is due to self.agent_area_dict returned by the context manager for this switch area somehow returned the feeder area context dictionary. The code for initialize_switch_area() in switch_area.py is expecting the switch area context dictionary.
This behavior will certainly cause a similar issue when creating an instance of SecondaryAreaAgent with secondary_area_dict=None as well.