Fixed file load naming and added period sorting constraint.
This commit is contained in:
parent
7bbd0cfd63
commit
d19c8491f7
|
@ -37,6 +37,9 @@ class SimulationThread(threading.Thread):
|
||||||
for period in self.periods:
|
for period in self.periods:
|
||||||
period["timestart"] = datetime.time.fromisoformat(period["timestart"])
|
period["timestart"] = datetime.time.fromisoformat(period["timestart"])
|
||||||
|
|
||||||
|
# Essential - periods are assumed to be in chronological order
|
||||||
|
self.periods.sort(key=lambda x: x["timestart"])
|
||||||
|
|
||||||
def signal_stop(self):
|
def signal_stop(self):
|
||||||
self.mutex.acquire()
|
self.mutex.acquire()
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
|
@ -26,9 +26,8 @@ class TrafficlightfrontendConfig(AppConfig):
|
||||||
|
|
||||||
print("Traffic Light Frontend: initialization.")
|
print("Traffic Light Frontend: initialization.")
|
||||||
print("Current working directory: {}".format(os.getcwd()))
|
print("Current working directory: {}".format(os.getcwd()))
|
||||||
print(settings.BASE_DIR)
|
|
||||||
|
|
||||||
periods = json.load(open("states.json"))
|
periods = json.load(open("periods.json"))
|
||||||
|
|
||||||
SimulationThread.get_instance(periods, start_time=datetime.time.fromisoformat("07:59"), time_factor=4.0).start()
|
SimulationThread.get_instance(periods, start_time=datetime.time.fromisoformat("07:59"), time_factor=4.0).start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue