Skip to content

Commit

Permalink
Merge pull request #237 from dos-group/finalize-actors
Browse files Browse the repository at this point in the history
Finalize Actos when Microgrid Finalizes
  • Loading branch information
marvin-steinke committed Sep 23, 2024
2 parents e6f8696 + 50dc2f7 commit 7eee494
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vessim/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def state(self, now: datetime) -> dict:
"p": self.p(now),
}

def finalize(self) -> None:
self.signal.finalize()


class ComputingSystem(ActorBase):
"""Model of the computing system.
Expand Down Expand Up @@ -89,6 +92,10 @@ def state(self, now: datetime) -> dict:
"nodes": {signal.name: -signal.now(at=now) for signal in self.nodes},
}

def finalize(self) -> None:
for node in self.nodes:
node.finalize()


class _ActorSim(mosaik_api_v3.Simulator):
META = {
Expand Down
2 changes: 2 additions & 0 deletions vessim/cosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def finalize(self):
"""
for controller in self.controllers:
controller.finalize()
for actor in self.actors:
actor.finalize()


class Environment:
Expand Down

0 comments on commit 7eee494

Please sign in to comment.