diff --git a/pydtn/communities/kclique.py b/pydtn/communities/kclique.py index 52d5dbd13715c4dd0919be291b273ff29a24925e..cf731fee9638fe756ad40145cd9f91e7e9c89b80 100644 --- a/pydtn/communities/kclique.py +++ b/pydtn/communities/kclique.py @@ -10,7 +10,8 @@ class KCliqueCommunity(EpochCommunity): self.k = k self.threshold = threshold - def process(self, network): + def process(self, **kwargs): + network = kwargs['network'] while True: yield self.tick() g = self.next_epoch(self.env.now) diff --git a/pydtn/communities/louvain.py b/pydtn/communities/louvain.py index c94f478aa67de83f4a5dd5d094e59072443bff8e..7399943eac7429c2c6c6822fbc11f683c7a08870 100644 --- a/pydtn/communities/louvain.py +++ b/pydtn/communities/louvain.py @@ -10,7 +10,8 @@ class LouvainCommunity(EpochCommunity): def __init__(self, epoch=604800, **kwargs): super().__init__(epoch, **kwargs) - def process(self, network): + def process(self, **kwargs): + network = kwargs['network'] while True: yield self.tick() g = self.next_epoch(self.env.now) diff --git a/pydtn/core.py b/pydtn/core.py index 035179b5f7b1fed724052ca9f009472e60dc7a73..2410ff1606925c05663fa981a7d4a50fae542cb3 100644 --- a/pydtn/core.py +++ b/pydtn/core.py @@ -7,9 +7,9 @@ class Process: self.env = env self.__process = env.process(self.process(*args)) - def process(self, *args): + def process(self, **kwargs): + yield self.env.timeout(0) raise NotImplementedError - yield None class TickProcess(Process): diff --git a/pydtn/network.py b/pydtn/network.py index 7841e7a064a491a69d18dd49a27a88485042b14f..a5c658028aad533c93010c605f0f36604ec17077 100644 --- a/pydtn/network.py +++ b/pydtn/network.py @@ -135,7 +135,7 @@ class Node(TickProcess): for packet in packets_to_delete: self.buffer.remove(packet) - def process(self): + def process(self, **kwargs): '''''' while True: self.buffer.clean() @@ -232,7 +232,8 @@ class PacketGenerator(TickProcess): self.time_to_live = time_to_live self.packets = [] - def process(self, network): + def process(self, **kwargs): + network = kwargs['network'] packet_id = 0 def create(packet_id): source, dest = random.choice(network.links) diff --git a/pydtn/traces/csvtrace.py b/pydtn/traces/csvtrace.py index d5da1921daf9750c5b9e88db26a2b0b5afb1b755..373b7dddb8cb1fbe0fe0f4289efd497ef9246da4 100644 --- a/pydtn/traces/csvtrace.py +++ b/pydtn/traces/csvtrace.py @@ -15,9 +15,10 @@ class CSVTrace(Trace): duration, _, _, nodes = map(int, next(self.reader)) super().__init__(duration, nodes) - def process(self, network): + def process(self, **kwargs): '''''' env = self.env + network = kwargs['network'] for row in self.reader: time, a, b, state = map(int, row) diff --git a/pydtn/traces/randomtrace.py b/pydtn/traces/randomtrace.py index 942e5f9917ad4297f98f3684c093a12d8dc74f90..536f64597213acb3c45d77c7541e2af7b818e352 100644 --- a/pydtn/traces/randomtrace.py +++ b/pydtn/traces/randomtrace.py @@ -20,10 +20,10 @@ class RandomTrace(TickTrace): self.min_toggles = min_toggles self.max_toggles = max_toggles - def process(self, network): + def process(self, **kwargs): '''''' env = self.env - links = network.links + links = kwargs['network'].links while env.now < self.duration: to_toggle = randint(self.min_toggles, self.max_toggles)