stability fix

This commit is contained in:
leo 2022-04-19 21:46:36 +02:00
parent 33d2e7ee26
commit afe65943aa
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
2 changed files with 8 additions and 4 deletions

10
Car.py
View File

@ -61,7 +61,7 @@ class Car():
self.nu = 0.1
self.gamma = 10
self.delta = 0
self.T = 1.3#uniform(0.9,1.6)
self.T = uniform(0.9,1.6)
self.size = 3
self.vroom = 0
@ -186,7 +186,11 @@ class Car():
if prevInd < 0:
return None
inter = self.route[edgeInd-1].getFromNode()
connection = self.route[prevInd].getConnections(self.route[edgeInd])[0]
connections = self.route[prevInd].getConnections(self.route[edgeInd])
if(len(connections)==0):
print("aaaaaaaaa")
return
connection = connections[0]
linkInd = inter.getLinkIndex(connection)
if(linkInd == -1): # Ca devrait pas arriver, mais de toute évidence ça arrive
return;
@ -335,7 +339,7 @@ class Car():
if self.distToInter > self.minSpace or (tti + leader.T + marg) < ltti:
self.v = min(vmax, self.v + self.a*dt)
else:# sinon on s'arrete net
self.v = 0
self.v = 0#max(0, self.v - self.b*dt)
self.updateGraph(self.v, vmax, 0)
return

View File

@ -5,7 +5,7 @@
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<flow id="f_0" begin="0.00" end="3600.00" vehsPerHour="1500.00">
<param key="random" value="500"/>
<param key="random" value="0"/>
<route edges="E1 E9 E8 E7 E40"/>
</flow>
<flow id="f_1" begin="0.00" end="3600.00" vehsPerHour="1500.00">