diff --git a/CarController.py b/CarController.py index 4b07812..e0a3f96 100644 --- a/CarController.py +++ b/CarController.py @@ -205,3 +205,6 @@ class CarController: return for car in self.cars: car.__dict__[name] = val + + def getFlowBacklog(self): + return sum([f.backlog(self.t) for f in self.flows]) diff --git a/Flow.py b/Flow.py index 55ce6fb..c7adf6c 100644 --- a/Flow.py +++ b/Flow.py @@ -33,3 +33,7 @@ class Flow: def addCar2Counter(self): self.carsSpawned += 1 + + def backlog(self, t): + carSpawnedTh = self.adjVPH * (t/3600) + return carSpawnedTh - self.carsSpawned diff --git a/main.py b/main.py index fee918b..3deaf08 100644 --- a/main.py +++ b/main.py @@ -84,7 +84,8 @@ class MainWindow(QMainWindow): return averageTimeStopped = controller.totalStopped / controller.carsDestroyed speedPercentage = controller.speedPercentageTotal / controller.carsDestroyed - widget.setText(f"temps d'arrĂȘt : {averageTimeStopped:.2f}s/voiture \n nombre de voitures qui n'ont pas pu apparaitre : {controller.spawnFailed} \n T : {speedPercentage:.2f}") + newline = '\n' + widget.setText(f"temps d'arrĂȘt : {averageTimeStopped:.2f}s/voiture \nT : {speedPercentage:.2f} \nbacklog total : {controller.getFlowBacklog():.2f} \n{newline.join(f'{f.id} : {f.backlog(controller.t):.2f}' for f in controller.flows)}") @Slot(int) def updatePhysicsFps(self,t):