This commit is contained in:
leo 2022-05-07 11:18:39 +02:00
parent 8a6368c50a
commit 4239c23495
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
3 changed files with 9 additions and 1 deletions

View File

@ -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])

View File

@ -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

View File

@ -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 <vitesse/vitesse max>T : {speedPercentage:.2f}")
newline = '\n'
widget.setText(f"temps d'arrêt : {averageTimeStopped:.2f}s/voiture \n<vitesse/vitesse max>T : {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):