-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
99 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
This script tests ResultGUIViewer. | ||
This is for local test only. I don't know how to test it in Github Actions properly. | ||
""" | ||
|
||
import pytest | ||
|
||
def test_result_gui_viewer(): | ||
import uxsim as UX | ||
from uxsim.ResultGUIViewer import ResultGUIViewer | ||
|
||
#simple network | ||
W = UX.World( | ||
name="", # Scenario name | ||
deltan=5, # Simulation aggregation unit delta n | ||
tmax=1200, # Total simulation time (s) | ||
print_mode=0, save_mode=0, show_mode=0, # Various options | ||
random_seed=None # Set the random seed | ||
) | ||
|
||
# Define the scenario | ||
W.addNode("orig1", 0, 0) # Create a node | ||
W.addNode("orig2", 0, 2) | ||
W.addNode("merge", 0.5, 1) | ||
W.addNode("dest", 1, 1) | ||
W.addLink("link1", "orig1", "merge", length=1000, free_flow_speed=20, jam_density=0.2, merge_priority=0.5) # Create a link | ||
W.addLink("link2", "orig2", "merge", length=1000, free_flow_speed=20, jam_density=0.2, merge_priority=2) | ||
W.addLink("link3", "merge", "dest", length=1000, free_flow_speed=20, jam_density=0.2) | ||
W.adddemand("orig1", "dest", 0, 1000, 0.4) # Create OD traffic demand | ||
W.adddemand("orig2", "dest", 500, 1000, 0.6) | ||
|
||
|
||
# Run the simulation to the end | ||
W.exec_simulation() | ||
|
||
# Print summary of simulation result | ||
W.analyzer.print_simple_stats() | ||
|
||
app, window = ResultGUIViewer.launch_World_viewer(W, return_app_window=True) | ||
|
||
# Shut down 5 sec later | ||
from PyQt5.QtCore import QTimer | ||
import sys | ||
timer = QTimer() | ||
timer.timeout.connect(window.close) | ||
timer.start(1000*5) | ||
assert True | ||
with pytest.raises(SystemExit): | ||
sys.exit(app.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .OSMImporter import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .ResultGUIViewer import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from .uxsim import * | ||
from .utils import * | ||
|
||
__version__ = "1.0.8" | ||
__version__ = "1.0.9" | ||
__author__ = "Toru Seo" | ||
__copyright__ = "Copyright (c) 2023 Toru Seo" | ||
__license__ = "MIT License" |