nomos-specs/mixnet/v2/sim/simulation.py

16 lines
368 B
Python
Raw Normal View History

2024-05-09 05:29:10 +00:00
import simpy
2024-05-09 10:37:39 +00:00
from mixnet.v2.sim.node import Node
from mixnet.v2.sim.p2p import P2p
2024-05-09 05:29:10 +00:00
class Simulation:
def __init__(self):
self.env = simpy.Environment()
2024-05-09 10:37:39 +00:00
self.p2p = P2p(self.env)
self.nodes = [Node(i, self.env, self.p2p) for i in range(2)]
2024-05-09 10:37:39 +00:00
self.p2p.add_node(self.nodes)
2024-05-09 05:29:10 +00:00
def run(self, until):
self.env.run(until=until)