diff --git a/CHANGELOG.md b/CHANGELOG.md index d4527f7a3b..c298ef6604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - 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) +- Simulation stopping at unhandled messages in `DBFSAlgorithm` [#821](https://github.com/ie3-institute/simona/issues/821) ## [3.0.0] - 2023-08-07 diff --git a/src/main/scala/edu/ie3/simona/agent/grid/DBFSAlgorithm.scala b/src/main/scala/edu/ie3/simona/agent/grid/DBFSAlgorithm.scala index 24236f43d3..7999c226f0 100644 --- a/src/main/scala/edu/ie3/simona/agent/grid/DBFSAlgorithm.scala +++ b/src/main/scala/edu/ie3/simona/agent/grid/DBFSAlgorithm.scala @@ -490,9 +490,13 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport { // return to Idle idle(cleanedGridAgentBaseData) - case _ => - // preventing "match may not be exhaustive" - Behaviors.unhandled + // handles power request that arrive to early + case (requestGridPower: RequestGridPower, _) => + ctx.log.debug( + s"Received the message $requestGridPower too early. Stash away!" + ) + buffer.stash(requestGridPower) + Behaviors.same } } @@ -783,7 +787,7 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport { // happens only when we received slack data and power values before we received a request to provide grid data // (only possible when first simulation triggered and this agent is faster in this state as the request // by a superior grid arrives) - case (powerResponse: PowerResponse, _: GridAgentBaseData) => + case (powerResponse: PowerResponse, _) => ctx.log.debug( "Received Request for Grid Power too early. Stashing away" ) @@ -791,20 +795,12 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport { buffer.stash(powerResponse) Behaviors.same - // happens only when we received slack data and power values before we received a request to provide grid - // (only possible when first simulation triggered and this agent is faster - // with its power flow calculation in this state as the request by a superior grid arrives) - case (powerResponse: PowerResponse, _: PowerFlowDoneData) => + case (requestGridPower: RequestGridPower, _) => ctx.log.debug( - "Received Request for Grid Power too early. Stashing away" + s"Received the message $requestGridPower too early. Stashing away!" ) - - buffer.stash(powerResponse) + buffer.stash(requestGridPower) Behaviors.same - - case _ => - // preventing "match may not be exhaustive" - Behaviors.unhandled } }