This commit is contained in:
leo 2022-03-22 13:49:41 +01:00
parent da76142ac2
commit 9b30eb36c0
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
6 changed files with 216 additions and 8 deletions

14
Car.py
View File

@ -54,7 +54,7 @@ class Car():
self.gamma = 5
self.delta = 0
self.T = 0.3
self.T = 1.3
self.size = 3
self.vroom = 0
@ -124,7 +124,7 @@ class Car():
edgeInd+=1
carComing = self.getLeaderAtIntersection(prevInd,edgeInd)
if(carComing is not None):
self.leaderDist = l+carComing[0]
self.leaderDist = l + 0.3*carComing[0]
return carComing[1]
if(not self.route[edgeInd].isSpecial()):
prevInd = edgeInd
@ -228,10 +228,10 @@ class Car():
#painter.drawEllipse(pt,100,100)
def conduite(self,vmax,leader,dt):
#if self.id == "f_00" and self.controller.t%10>5:
#
# self.v = 0
# return
if self.id == "f_00" and self.controller.t%10>5:
self.v = 0
return
if(leader is None):
self.v = self.vmax
@ -250,7 +250,7 @@ class Car():
# S = vleader * 3.6 * 0.6
Si=self.leaderDist-vleader*1.3
Si=self.leaderDist-vleader*self.T
#S=vf**2 / self.b + vleader**2 / bleader + self.gamma * vf + self.delta
T=self.T
vsec=vleader+(Si-vmax*T)/(vbar/bbar+T)

View File

@ -88,7 +88,7 @@ class mainLoop(QObject):
def quickLoad(self):
self.map.fromPath("test7.net.xml")
self.painter.generateTransform()
self.controller.fromPath("test12.rou.xml")
self.controller.fromPath("test13.rou.xml")
self.controller.prepareRoute()
def updateFps(self):

17
test13.rou.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on 2022-03-22 08:41:11 by Eclipse SUMO netedit Version 1.12.0
-->
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vehicle id="v_0" depart="0.00">
<route edges="E3 E7 E6 E9 E60"/>
</vehicle>
<vehicle id="v_1" depart="0.00">
<route edges="-E6 E8 E7 E6 E50"/>
</vehicle>
<vehicle id="v_2" depart="0.50">
<route edges="-E6 E8 E7 E6 E50"/>
</vehicle>
</routes>

16
test14.rou.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on 2022-03-22 13:42:27 by Eclipse SUMO netedit Version 1.12.0
-->
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vehicle id="v_0" depart="0.00">
<route edges="E1 E9 E8 E7 E40"/>
</vehicle>
<vehicle id="v_1" depart="0.00">
<route edges="-E4 E10 E9 E8 E7 E40"/>
</vehicle>
<vehicle id="v_2" depart="0.50">
<route edges="-E4 E10 E9 E8 E7 E40"/>
</vehicle>
</routes>

19
test15.rou.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on 2022-03-22 13:44:20 by Eclipse SUMO netedit Version 1.12.0
-->
<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="1800.00">
<route edges="E1 E9 E8 E7 E40"/>
</flow>
<flow id="f_1" begin="0.00" end="3600.00" vehsPerHour="1800.00">
<route edges="-E4 E10 E9 E8 E20"/>
</flow>
<flow id="f_2" begin="0.00" end="3600.00" vehsPerHour="1800.00">
<route edges="E3 E8 E7 E10 -E10"/>
</flow>
<flow id="f_3" begin="0.00" end="3600.00" vehsPerHour="1800.00">
<route edges="-E2 E7 E10 E9 -E30"/>
</flow>
</routes>

156
test8.net.xml Normal file
View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on 2022-03-22 13:42:14 by Eclipse SUMO netedit Version 1.12.0
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd">
<output>
<output-file value="/home/leo/Sketchbook/python/Traffic/test8.net.xml"/>
</output>
<processing>
<offset.disable-normalization value="true"/>
</processing>
<junctions>
<no-turnarounds value="true"/>
</junctions>
<report>
<aggregate-warnings value="5"/>
</report>
</configuration>
-->
<net version="1.9" junctionCornerDetail="5" limitTurnSpeed="5.50" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">
<location netOffset="0.00,0.00" convBoundary="-32.74,6.62,118.09,97.16" origBoundary="10000000000.00,10000000000.00,-10000000000.00,-10000000000.00" projParameter="!"/>
<edge id=":J10_0" function="internal">
<lane id=":J10_0_0" index="0" speed="7.24" length="7.98" shape="37.36,81.28 37.06,79.51 36.15,77.96 34.64,76.63 32.54,75.52"/>
</edge>
<edge id=":J10_1" function="internal">
<lane id=":J10_1_0" index="0" speed="7.24" length="7.99" shape="45.36,75.48 43.26,76.60 41.76,77.94 40.86,79.49 40.56,81.27"/>
</edge>
<edge id=":J10_2" function="internal">
<lane id=":J10_2_0" index="0" speed="11.90" length="13.16" shape="45.36,75.48 42.15,76.50 38.95,76.84 35.74,76.51 32.54,75.52"/>
</edge>
<edge id=":J11_0" function="internal">
<lane id=":J11_0_0" index="0" speed="7.23" length="7.97" shape="65.21,56.29 63.44,56.61 61.90,57.52 60.58,59.04 59.50,61.15"/>
</edge>
<edge id=":J11_1" function="internal">
<lane id=":J11_1_0" index="0" speed="7.28" length="7.94" shape="59.38,48.34 60.55,50.43 61.90,51.92 63.44,52.80 65.18,53.09"/>
</edge>
<edge id=":J11_2" function="internal">
<lane id=":J11_2_0" index="0" speed="11.76" length="13.16" shape="59.38,48.34 60.43,51.47 60.80,54.65 60.49,57.87 59.50,61.15"/>
</edge>
<edge id=":J12_0" function="internal">
<lane id=":J12_0_0" index="0" speed="7.25" length="7.90" shape="38.63,28.64 39.05,30.34 40.05,31.80 41.64,33.02 43.81,34.00"/>
</edge>
<edge id=":J12_1" function="internal">
<lane id=":J12_1_0" index="0" speed="7.36" length="7.79" shape="31.05,34.82 33.05,33.46 34.46,32.01 35.25,30.48 35.43,28.87"/>
</edge>
<edge id=":J12_2" function="internal">
<lane id=":J12_2_0" index="0" speed="11.26" length="13.19" shape="31.05,34.82 34.00,33.54 37.11,32.98 40.38,33.13 43.81,34.00"/>
</edge>
<edge id=":J13_0" function="internal">
<lane id=":J13_0_0" index="0" speed="7.24" length="7.98" shape="18.30,61.24 17.20,59.13 15.88,57.61 14.33,56.70 12.56,56.39"/>
</edge>
<edge id=":J13_1" function="internal">
<lane id=":J13_1_0" index="0" speed="11.37" length="13.23" shape="18.30,61.24 17.23,57.81 16.87,54.53 17.22,51.39 18.30,48.40"/>
</edge>
<edge id=":J13_2" function="internal">
<lane id=":J13_2_0" index="0" speed="7.39" length="7.85" shape="12.58,53.19 14.20,52.90 15.69,52.00 17.06,50.50 18.30,48.40"/>
</edge>
<edge id="-E10" from="J13" to="J2" priority="-1">
<lane id="-E10_0" index="0" speed="13.89" length="45.32" shape="12.56,56.39 -32.75,56.09"/>
</edge>
<edge id="-E2" from="J4" to="J11" priority="-1">
<lane id="-E2_0" index="0" speed="13.89" length="52.90" shape="118.10,55.74 65.21,56.29"/>
</edge>
<edge id="-E30" from="J12" to="J5" priority="-1">
<lane id="-E30_0" index="0" speed="13.89" length="22.19" shape="35.43,28.87 33.87,6.73"/>
</edge>
<edge id="-E4" from="J6" to="J10" priority="-1">
<lane id="-E4_0" index="0" speed="13.89" length="15.89" shape="37.41,97.17 37.36,81.28"/>
</edge>
<edge id="E1" from="J2" to="J13" priority="-1">
<lane id="E1_0" index="0" speed="13.89" length="45.32" shape="-32.73,52.89 12.58,53.19"/>
</edge>
<edge id="E10" from="J10" to="J13" priority="-1" shape="38.95,74.96 33.74,74.29 28.88,72.28 24.72,69.08 21.53,64.90 19.54,60.04 18.89,54.83">
<lane id="E10_0" index="0" speed="13.89" length="21.01" shape="32.54,75.52 28.07,73.68 23.58,70.22 20.13,65.70 18.30,61.24"/>
</edge>
<edge id="E20" from="J11" to="J4" priority="-1">
<lane id="E20_0" index="0" speed="13.89" length="52.90" shape="65.18,53.09 118.07,52.54"/>
</edge>
<edge id="E3" from="J5" to="J12" priority="-1">
<lane id="E3_0" index="0" speed="13.89" length="22.19" shape="37.06,6.51 38.63,28.64"/>
</edge>
<edge id="E40" from="J10" to="J6" priority="-1">
<lane id="E40_0" index="0" speed="13.89" length="15.89" shape="40.56,81.27 40.61,97.16"/>
</edge>
<edge id="E7" from="J11" to="J10" priority="-1" shape="58.89,54.75 58.25,59.96 56.29,64.83 53.13,69.01 48.98,72.23 44.14,74.26 38.95,74.96">
<lane id="E7_0" index="0" speed="13.89" length="20.98" shape="59.50,61.15 57.69,65.62 54.28,70.14 49.79,73.62 45.36,75.48"/>
</edge>
<edge id="E8" from="J12" to="J11" priority="-1" shape="37.47,35.01 42.88,35.37 48.00,37.16 52.44,40.26 55.89,44.44 58.10,49.39 58.89,54.75">
<lane id="E8_0" index="0" speed="13.89" length="22.13" shape="43.81,34.00 48.74,35.72 53.53,39.07 57.26,43.59 59.38,48.34"/>
</edge>
<edge id="E9" from="J13" to="J12" priority="-1" shape="18.89,54.83 19.81,48.95 22.43,43.60 26.50,39.26 31.67,36.31 37.47,35.01">
<lane id="E9_0" index="0" speed="13.89" length="19.19" shape="18.30,48.40 21.10,42.68 25.50,37.99 31.05,34.82"/>
</edge>
<junction id="J10" type="priority" x="38.95" y="74.96" incLanes="-E4_0 E7_0" intLanes=":J10_0_0 :J10_1_0 :J10_2_0" shape="35.76,81.28 42.16,81.27 42.54,79.60 43.01,78.88 43.68,78.22 44.54,77.64 45.59,77.12 45.13,73.85 43.07,74.57 41.00,75.00 38.94,75.15 36.88,75.02 34.82,74.59 32.75,73.88 32.32,77.16 34.23,78.25 34.90,78.91 35.38,79.63 35.67,80.42">
<request index="0" response="100" foes="100" cont="0"/>
<request index="1" response="000" foes="000" cont="0"/>
<request index="2" response="000" foes="001" cont="0"/>
</junction>
<junction id="J11" type="priority" x="58.89" y="54.75" incLanes="-E2_0 E8_0" intLanes=":J11_0_0 :J11_1_0 :J11_2_0" shape="65.23,57.89 65.16,51.49 63.54,51.12 62.82,50.65 62.16,49.99 61.56,49.14 61.02,48.09 57.74,48.59 58.49,50.60 58.94,52.62 59.11,54.67 58.98,56.74 58.56,58.83 57.86,60.94 61.14,61.36 62.21,59.44 62.85,58.77 63.57,58.28 64.36,57.99">
<request index="0" response="100" foes="100" cont="0"/>
<request index="1" response="000" foes="000" cont="0"/>
<request index="2" response="000" foes="001" cont="0"/>
</junction>
<junction id="J12" type="priority" x="37.47" y="35.01" incLanes="E3_0 E9_0" intLanes=":J12_0_0 :J12_1_0 :J12_2_0" shape="43.69,35.65 43.92,32.35 41.95,31.37 41.24,30.78 40.72,30.10 40.38,29.35 40.22,28.53 33.84,28.98 33.60,31.01 33.18,31.80 32.55,32.44 31.72,32.92 30.69,33.25 31.42,36.45 33.30,35.55 35.24,34.96 37.25,34.68 39.33,34.69 41.48,35.02">
<request index="0" response="100" foes="100" cont="0"/>
<request index="1" response="000" foes="000" cont="0"/>
<request index="2" response="000" foes="001" cont="0"/>
</junction>
<junction id="J13" type="priority" x="18.89" y="54.83" incLanes="E10_0 E1_0" intLanes=":J13_0_0 :J13_1_0 :J13_2_0" shape="16.66,61.45 19.94,61.03 19.18,58.81 18.72,56.66 18.57,54.57 18.72,52.54 19.18,50.58 19.95,48.67 16.70,48.14 16.00,50.07 15.40,50.74 14.63,51.22 13.70,51.50 12.60,51.59 12.55,57.99 14.21,58.38 14.93,58.86 15.58,59.53 16.15,60.40">
<request index="0" response="000" foes="000" cont="0"/>
<request index="1" response="000" foes="100" cont="0"/>
<request index="2" response="010" foes="010" cont="0"/>
</junction>
<junction id="J2" type="dead_end" x="-32.74" y="54.49" incLanes="-E10_0" intLanes="" shape="-32.74,54.49 -32.76,57.69 -32.74,54.49"/>
<junction id="J4" type="dead_end" x="118.09" y="54.14" incLanes="E20_0" intLanes="" shape="118.09,54.14 118.05,50.94 118.09,54.14"/>
<junction id="J5" type="dead_end" x="35.46" y="6.62" incLanes="-E30_0" intLanes="" shape="35.46,6.62 32.27,6.85 35.46,6.62"/>
<junction id="J6" type="dead_end" x="39.01" y="97.16" incLanes="E40_0" intLanes="" shape="39.01,97.16 42.21,97.15 39.01,97.16"/>
<connection from="-E2" to="E7" fromLane="0" toLane="0" via=":J11_0_0" dir="r" state="m" visibility="9.00"/>
<connection from="-E4" to="E10" fromLane="0" toLane="0" via=":J10_0_0" dir="r" state="m" visibility="9.00"/>
<connection from="E1" to="E9" fromLane="0" toLane="0" via=":J13_2_0" dir="r" state="m" visibility="9.00"/>
<connection from="E10" to="-E10" fromLane="0" toLane="0" via=":J13_0_0" dir="r" state="M"/>
<connection from="E10" to="E9" fromLane="0" toLane="0" via=":J13_1_0" dir="s" state="M"/>
<connection from="E3" to="E8" fromLane="0" toLane="0" via=":J12_0_0" dir="r" state="m" visibility="9.00"/>
<connection from="E7" to="E40" fromLane="0" toLane="0" via=":J10_1_0" dir="r" state="M"/>
<connection from="E7" to="E10" fromLane="0" toLane="0" via=":J10_2_0" dir="s" state="M"/>
<connection from="E8" to="E20" fromLane="0" toLane="0" via=":J11_1_0" dir="r" state="M"/>
<connection from="E8" to="E7" fromLane="0" toLane="0" via=":J11_2_0" dir="s" state="M"/>
<connection from="E9" to="-E30" fromLane="0" toLane="0" via=":J12_1_0" dir="r" state="M"/>
<connection from="E9" to="E8" fromLane="0" toLane="0" via=":J12_2_0" dir="s" state="M"/>
<connection from=":J10_0" to="E10" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J10_1" to="E40" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J10_2" to="E10" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":J11_0" to="E7" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J11_1" to="E20" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J11_2" to="E7" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":J12_0" to="E8" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J12_1" to="-E30" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J12_2" to="E8" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":J13_0" to="-E10" fromLane="0" toLane="0" dir="r" state="M"/>
<connection from=":J13_1" to="E9" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from=":J13_2" to="E9" fromLane="0" toLane="0" dir="r" state="M"/>
<roundabout nodes="J10 J11 J12 J13" edges="E10 E7 E8 E9"/>
</net>