backlog
This commit is contained in:
parent
8a6368c50a
commit
4239c23495
@ -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])
|
||||
|
4
Flow.py
4
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
|
||||
|
3
main.py
3
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 <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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user