Skip to content

Commit

Permalink
add evaluation scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Frost, Emilie committed Sep 29, 2024
1 parent f6830e6 commit 9af1b5d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cosima_core/mango_direct_connection/mango_communication_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import h5py
import numpy as np
from mango.container.mosaik import MosaikContainer
from mango.container.external_coupling import ExternalSchedulingContainer

import scenario_config
from cosima_core.messages.message_pb2 import InfoMessage, InitialMessage, SynchronisationMessage
Expand All @@ -25,13 +25,13 @@ class MangoCommunicationNetwork:
and interacts with an OMNeT++ simulation.
Args:
client_container_mapping (Dict[str, MosaikContainer]): A mapping of client names (in OMNeT++) to
MosaikContainer instances (mango).
client_container_mapping (Dict[str, ExternalSchedulingContainer]): A mapping of client names (in OMNeT++) to
ExternalSchedulingContainer instances (mango).
port (int): The port to establish socket communication with OMNeT++.
Attributes:
_client_container_mapping (Dict[str, MosaikContainer]): A mapping of client names (in OMNeT++) to
MosaikContainer instances (mango).
_client_container_mapping (Dict[str, ExternalSchedulingContainer]): A mapping of client names (in OMNeT++) to
ExternalSchedulingContainer instances (mango).
_next_activities (list): List of next activity timestamps from agents in mango containers.
_current_time (int): Current simulation time in milliseconds.
_loop (asyncio.AbstractEventLoop): The asyncio event loop.
Expand All @@ -45,15 +45,15 @@ class MangoCommunicationNetwork:
_number_of_messages_received (int): Count of received messages.
"""

def __init__(self, client_container_mapping: Dict[str, MosaikContainer], port: int, codec=None):
def __init__(self, client_container_mapping: Dict[str, ExternalSchedulingContainer], port: int, codec=None):
"""
Initialize the MangoCommunicationNetwork instance.
This method sets up the necessary attributes.
Args:
client_container_mapping (Dict[str, MosaikContainer]): A mapping of client names (in OMNeT++) to
MosaikContainer instances (mango).
client_container_mapping (Dict[str, ExternalSchedulingContainer]): A mapping of client names (in OMNeT++) to
ExternalSchedulingContainer instances (mango).
port (int): The port to establish socket communication with OMNeT++.
"""
self._client_container_mapping = client_container_mapping
Expand Down Expand Up @@ -180,12 +180,12 @@ def process_mango_outputs(self, container_name, output):
"""
Process the mango outputs from a container.
This method processes the output from a MosaikContainer, generates message
This method processes the output from a ExternalSchedulingContainer, generates message
dictionaries, and adds them to the message buffer.
Args:
container_name (str): Name of the container.
output: Output received from the MosaikContainer's step.
output: Output received from the ExternalSchedulingContainer's step.
"""
if output.next_activity is None:
next_activity = UNTIL
Expand Down

0 comments on commit 9af1b5d

Please sign in to comment.