Commit 628250eb authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Update shed example

parent 58089657
......@@ -9,7 +9,7 @@ from multiprocessing import Pool
from pydtn import Network, RandomTraffic, Node, EpidemicNode
from pydtn.community import BubbleNode, HCBFNode, LouvainCommunity
import pydtn.shed as shed
from pydtn.shed import ShedTrace
Simulation = namedtuple('Simulation', ['trace', 'node_type', 'seed'])
......@@ -19,8 +19,7 @@ def run_simulation(simulation):
"""Run a simulation."""
seed = simulation.seed
trace_metadata = shed.read_meta_file(simulation.trace)
trace = shed.shed_trace(simulation.trace)
trace = ShedTrace(simulation.trace)
epoch = 7*24*60*60 # 7 days
......@@ -31,13 +30,13 @@ def run_simulation(simulation):
}
nodes = {
node_id: simulation.node_type(**node_options)
for node_id in range(trace_metadata['nodes'])
for node_id in range(trace.nodes)
}
traffic_options = {
'seed': seed,
'start': epoch,
'speed': 30 * 60, # 1 packet every 30 mins
'step': 30 * 60, # 1 packet every 30 mins
}
traffic = RandomTraffic(nodes, **traffic_options)
......@@ -45,7 +44,7 @@ def run_simulation(simulation):
network.run()
stats = {
'trace': simulation.trace,
'trace': trace.path,
'node_type': node_type.__name__,
'seed': seed,
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment