Skip to content

Commit

Permalink
Merge a494150 into 0b518f6
Browse files Browse the repository at this point in the history
  • Loading branch information
temetski committed Oct 23, 2019
2 parents 0b518f6 + a494150 commit 2503bdf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion flow/core/kernel/network/aimsun.py
Expand Up @@ -120,7 +120,7 @@ def generate_network(self, network):
f.write(template_path)

# start the aimsun process
aimsun_call = [aimsun_path, "-script", script_path]
aimsun_call = [aimsun_path, "-script", script_path, str(self.sim_params.port)]
self.aimsun_proc = subprocess.Popen(aimsun_call)

# merge types into edges
Expand Down
3 changes: 0 additions & 3 deletions flow/core/kernel/simulation/aimsun.py
Expand Up @@ -61,9 +61,6 @@ def start_simulation(self, network, sim_params):
a simulation, and creates a class to communicate with the simulation
via an TCP connection.
"""
# FIXME: hack
sim_params.port = 9999

# save the simulation step size (for later use)
self.sim_step = sim_params.sim_step

Expand Down
3 changes: 3 additions & 0 deletions flow/utils/aimsun/generate.py
Expand Up @@ -29,6 +29,9 @@
"EPSG:32601")
model = gui.getActiveModel()

# HACK: Store port in author
port_string = sys.argv[1]
model.setAuthor(port_string)

def generate_net(nodes,
edges,
Expand Down
5 changes: 5 additions & 0 deletions flow/utils/aimsun/load.py
Expand Up @@ -5,6 +5,7 @@

import flow.config as config
from flow.utils.aimsun.scripting_api import AimsunTemplate
import sys


def load_network():
Expand Down Expand Up @@ -134,6 +135,10 @@ def get_dict_from_objects(sections, nodes, turnings, cen_connections):
model = AimsunTemplate(GKSystem, GKGUISystem)
model.load(template_path)

# HACK: Store port in author
port_string = sys.argv[1]
model.setAuthor(port_string)

# collect the simulation parameters
params_file = 'flow/core/kernel/network/data.json'
params_path = os.path.join(config.PROJECT_PATH, params_file)
Expand Down
3 changes: 2 additions & 1 deletion flow/utils/aimsun/run.py
Expand Up @@ -16,7 +16,8 @@
from thread import start_new_thread
import numpy as np

PORT = 9999
model = GKSystem.getSystem().getActiveModel()
PORT = int(model.getAuthor())
entered_vehicles = []
exited_vehicles = []

Expand Down

0 comments on commit 2503bdf

Please sign in to comment.