diff --git a/CHANGELOG.md b/CHANGELOG.md index 66c90485e5..71926d7f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed grid within GridSpec test [#806](https://github.com/ie3-institute/simona/issues/806) - Fixed log entry after power flow calculation [#814](https://github.com/ie3-institute/simona/issues/814) - Delete "Indices and tables" on the index page [#375](https://github.com/ie3-institute/simona/issues/375) +- Fixed provision of controllingEms within buildParticipantToActorRef [#841](https://github.com/ie3-institute/simona/issues/841) ## [3.0.0] - 2023-08-07 diff --git a/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala b/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala index 7ba4abef77..43c111a47f 100644 --- a/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala +++ b/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala @@ -201,6 +201,18 @@ class GridAgentController( .map { participant => val node = participant.getNode + val controllingEm = + participant.getControllingEm.toScala + .map(_.getUuid) + .map(uuid => + allEms.getOrElse( + uuid, + throw new CriticalFailureException( + s"EM actor with UUID $uuid not found." + ), + ) + ) + val actorRef = buildParticipantActor( participantsConfig.requestVoltageDeviationThreshold, participantConfigUtil, @@ -208,7 +220,7 @@ class GridAgentController( participant, thermalIslandGridsByBusId, environmentRefs, - allEms.get(participant.getUuid), + controllingEm, ) introduceAgentToEnvironment(actorRef) // return uuid to actorRef