Closed afisher1 closed 1 year ago
I have this code in my local after_test branch and can commit it if you would like.
@afisher1 @craig8 Looks like the solution for this is merged in develop? Should I close this issue?
Yes Craig and I went ahead and made a PR while we were testing his splitting of field_bus and gridappsd-python core stuff. This issue can be closed.
Describe the bug This is an issue in FeederAgent, SwitchAreaAgent, and SecondaryAreaAgent classes in agents.py. I will use the FeederAgent class to illustrate. self.feeder_area is only defined in the FeederAgent.init() function if self.agent_area_dict is not None. self.agent_area_dict is None if the FeederAgent instance was created with the argument, feeder_dict = None. This is allowed by design as you can call the parent class DistributedAgent.connect() and that will query the proper area context manager to populate self.agent_area_dict. However, feeder_dict is an designed as an attribute of the child class and thus never gets created in this scenario. So an error gets thrown if you try to use it.
To solve this I defined the feeder_dict as None by default in the init function and then created a connect function that calls the parent class's connect function and then proceeds to properly assign feeder_dict.
here is the code example of my proposed solution:
To Reproduce Steps to reproduce the behavior:
Expected behavior after connect is called feeder_area should be properly defined.