[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [sumo-user] Simulation is not using the specified Wiedemann Model
|
Hi Jakob,
I have done so and my simulation works as expected, but in terms of changing constant parameters within the Wiedemann model I am not seeing any changes.
For example, I changed D_MAX from 150 to 500 and then looked at the resulting speed profile. Even when the condition dv > sdv && dx < D_MAX is met, the speed does not reduce until dx is less than 150.
#start sumo
sumoBinary = "C:/Users/Quinton/Desktop/sumo-src-git/sumo-git/build/msvc10/sumo-gui/sumo-gui"
sumoCmd = [sumoBinary, "-c", "C:/Users/Quinton/Desktop/Research Simulation/sim.sumocfg"]
#importing libraries
import traci
import traci.constants as tc
traci.start(sumoCmd)
#subscribing to variables that we want to be printed once the code has run
traci.vehicle.subscribe("BMWC10", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("ditiExpeon6", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("F150C12", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("Ford1", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("llacCadi3", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("NeonC4", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("owT8Yell", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("peC9Esca", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("rC11RoveLand", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("StarT7", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("tarCWins13", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("VanC5", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("WhiteC2", (tc.VAR_SPEED, tc.VAR_ACCEL, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribe("EXT", (tc.VAR_SPEED, tc.VAR_ROAD_ID, tc.VAR_LANE_ID, tc.VAR_POSITION))
traci.vehicle.subscribeLeader(vehID="EXT", dist=0)
#using traci.movetoXY to position the ADO's in the network
traci.vehicle.moveToXY(vehID="BMWC10", edgeID="1[1][0]", lane=1, x=5693.869048, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="ditiExpeon6", edgeID="1[0]", lane=0, x=1734.723622, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="F150C12", edgeID="3[0]", lane=0, x=5855.833041, y=249, keepRoute=0)
traci.vehicle.moveToXY(vehID="Ford1", edgeID="1[0]", lane=1, x=1477.345025, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="llacCadi3", edgeID="1[0]", lane=0, x=1192.858873, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="NeonC4", edgeID="1[0]", lane=0, x=1325.476639, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="owT8Yell", edgeID="1[1][0]", lane=1, x=3201.641488, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="peC9Esca", edgeID="1[1][0]", lane=0, x=5641.541675, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="rC11RoveLand", edgeID="1[1][0]", lane=1, x=5864.937751, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="StarT7", edgeID="1[1][0]", lane=0, x=3177.508114, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="tarCWins13", edgeID="1[1][0]", lane=0, x=5874.051985, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="VanC5", edgeID="1[0]", lane=1, x=1599.987139, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="WhiteC2", edgeID="1[0]", lane=0, x=1006.770734, y=456, keepRoute=0)
traci.vehicle.moveToXY(vehID="EXT", edgeID="2[0]", lane=0, x=1273.0, y=289.74, keepRoute=0)
#disallows ADO's from changing lanes during simulation
traci.vehicle.setLaneChangeMode(vehID="BMWC10", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="ditiExpeon6", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="F150C12", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="Ford1", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="llacCadi3", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="NeonC4", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="owT8Yell", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="peC9Esca", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="rC11RoveLand", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="StarT7", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="tarCWins13", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="VanC5", lcm=512)
traci.vehicle.setLaneChangeMode(vehID="WhiteC2", lcm=512)
#traci.vehicle.setLaneChangeMode(vehID="EXT", lcm=512)
#importing python modules
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
#creating speed data
df = pd.read_csv('Research/ado_cars_35_speed.csv')
dframe = DataFrame(df)
dframe = dframe.sort_values('time_step')
#print(dframe)
step = 0
#Creating an empty list before the loop
list_of_dicts = []
dicts_EXT = []
#running traci
#for ado in dframe.groupby('ADO_name'):
while step <= 200 :
traci.simulationStep()
for ado in dframe["ADO_name"].unique():
traci.vehicle.setSpeed(ado, dframe[(dframe.time_step == step) & (dframe.ADO_name == ado)]['speed.mps'])
#New Code
d = traci.vehicle.getSubscriptionResults(ado)
d['ADO_name'] = ado
d['time_step'] = step
list_of_dicts.append(d)
d1 = traci.vehicle.getSubscriptionResults("EXT")
#d['ADO_name'] = ado
d1['time_step'] = step
dicts_EXT.append(d1)
#print(dicts_EXT)
#print(type(d1))
step += 1
#print(dicts_EXT)
result = pd.DataFrame(list_of_dicts).rename(columns={64: 'Speed.mps.ado',
70: 'Accel',
80: 'RoadID',
81: 'LaneID',
66: 'Pos_x_y'})
result1 = pd.DataFrame(dicts_EXT).rename(columns={64: 'Speed.mps.ED',
70: 'Accel',
80: 'RoadID',
81: 'LaneID',
66: 'Pos_x_y',
104: 'Leader'})
result = result.sort_values('time_step')
result1 = result1.sort_values('time_step')
#print(result)
result.to_csv("Data/result.csv")
result1.to_csv("Data/result1.csv")
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on 16/03/2018 8:52:08 AM by Netedit Version 0.31.0
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd">
<input>
<sumo-net-file value="C:\Users\Quinton\Desktop\Research%20Simulation\sim.net.xml"/>
</input>
<output>
<output-file value="C:\Users\Quinton\Desktop\Research%20Simulation\sim.net.xml"/>
</output>
<processing>
<no-internal-links value="true"/>
<no-turnarounds value="true"/>
<offset.disable-normalization value="true"/>
<lefthand value="false"/>
<junctions.corner-detail value="0"/>
<rectangular-lane-cut value="false"/>
<walkingareas value="false"/>
</processing>
</configuration>
-->
<net version="0.27" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">
<location netOffset="32341.75,8175.98" convBoundary="0.00,-946.92,13617.44,456.59" origBoundary="-32341.75,-8175.98,-18724.31,-7719.39" projParameter="!"/>
<edge id="1[0]" from="1-begin" to="1" priority="-1" type="3" spreadType="center" shape="0.00,456.59 1887.30,456.36 1909.69,456.36">
<lane id="1[0]_0" index="0" speed="30.00" length="1909.69" shape="-0.00,454.94 1887.30,454.71 1893.29,454.71"/>
<lane id="1[0]_1" index="1" speed="30.00" length="1909.69" shape="0.00,458.24 1887.30,458.01 1893.29,458.01"/>
</edge>
<edge id="1[1][0]" from="1" to="2" priority="-1" type="3" spreadType="center">
<lane id="1[1][0]_0" index="0" speed="30.00" length="4642.42" shape="1925.84,454.71 6544.24,454.16"/>
<lane id="1[1][0]_1" index="1" speed="30.00" length="4642.42" shape="1925.84,458.01 6544.15,457.46"/>
</edge>
<edge id="1[1][1][0]" from="2" to="3" priority="-1" type="3" spreadType="center">
<lane id="1[1][1][0]_0" index="0" speed="30.00" length="2931.01" shape="6555.90,454.16 9470.21,453.82"/>
<lane id="1[1][1][0]_1" index="1" speed="30.00" length="2931.01" shape="6555.90,457.46 9470.21,457.12"/>
</edge>
<edge id="1[1][1][1]" from="3" to="1-end" priority="-1" type="3" spreadType="center">
<lane id="1[1][1][1]_0" index="0" speed="30.00" length="4135.25" shape="9524.85,453.81 13617.44,453.33"/>
<lane id="1[1][1][1]_1" index="1" speed="30.00" length="4135.25" shape="9524.85,457.11 13617.44,456.63"/>
</edge>
<edge id="2.992" from="1" to="2-DestinationNode" priority="-1" type="3" spreadType="center">
<lane id="2.992_0" index="0" speed="13.89" length="17.09" shape="1925.25,451.11 1925.88,450.90"/>
</edge>
<edge id="2[0]" from="2-begin" to="1" priority="-1" type="3" shape="1141.67,25.00 1146.30,63.22 1152.10,106.08 1168.31,159.36 1192.64,205.70 1230.86,248.56 1273.72,289.10 1321.21,331.96 1367.55,378.29 1421.99,415.36 1476.43,433.89 1523.92,442.00 1844.96,452.54 1893.39,452.86 1909.69,456.36">
<lane id="2[0]_0" index="0" speed="30.00" length="993.56" shape="1143.31,24.80 1147.94,63.01 1153.72,105.73 1169.84,158.73 1194.01,204.75 1232.04,247.41 1274.84,287.89 1322.35,330.76 1368.61,377.01 1422.73,413.87 1476.84,432.29 1524.09,440.35 1844.99,450.89 1893.66,451.23"/>
</edge>
<edge id="3.1003" from="2" to="3-DestinationNode" priority="-1" type="3" spreadType="center">
<lane id="3.1003_0" index="0" speed="13.89" length="5.06" shape="6555.18,450.51 6555.66,450.31"/>
</edge>
<edge id="3[0]" from="3-begin" to="2" priority="-1" type="3" shape="5761.98,26.58 5767.40,47.19 5769.57,77.56 5778.24,116.60 5783.67,149.14 5799.94,179.50 5820.54,209.87 5840.06,234.82 5870.43,261.93 5898.63,291.21 5932.25,322.66 5969.12,357.37 5997.32,385.57 6024.44,404.00 6052.63,419.19 6077.58,427.86 6111.20,437.62 6156.75,445.22 6542.32,455.81">
<lane id="3[0]_0" index="0" speed="30.00" length="1013.42" shape="5763.58,26.16 5769.03,46.92 5771.21,77.32 5779.86,116.29 5785.25,148.60 5801.35,178.64 5821.87,208.90 5841.27,233.69 5871.58,260.74 5899.79,290.03 5933.38,321.46 5970.27,356.19 5998.38,384.29 6025.30,402.59 6053.30,417.67 6078.08,426.29 6111.57,436.01 6156.91,443.57 6544.23,454.21"/>
</edge>
<edge id="4.0" from="4-SourceNode" to="3" priority="-1" type="3" spreadType="center">
<lane id="4.0_0" index="0" speed="13.89" length="13.07" shape="9470.40,449.82 9471.05,450.13"/>
</edge>
<edge id="4[1]" from="3" to="4-end" priority="-1" type="3" spreadType="center" shape="9482.19,455.47 9529.98,449.82 9584.02,445.19 9643.72,441.60 9710.87,435.51 9787.42,428.63 9874.06,395.27 9933.65,342.40 10005.82,267.71 10060.37,208.96 10098.13,151.90 10114.91,99.87 10123.31,41.96 10124.01,-5.31 10123.60,-946.92">
<lane id="4[1]_0" index="0" speed="30.00" length="1833.48" shape="9524.65,450.45 9529.98,449.82 9584.02,445.19 9643.72,441.60 9710.87,435.51 9787.42,428.63 9874.06,395.27 9933.65,342.40 10005.82,267.71 10060.37,208.96 10098.13,151.90 10114.91,99.87 10123.31,41.96 10124.01,-5.31 10123.60,-946.92"/>
</edge>
<junction id="1" type="priority" x="1909.69" y="456.36" incLanes="2[0]_0 1[0]_0 1[0]_1" intLanes="" shape="1925.84,459.61 1925.84,453.11 1925.76,452.63 1924.74,449.60 1894.00,449.67 1893.32,452.81 1893.29,453.11 1893.29,459.61">
<request index="0" response="00100" foes="00100"/>
<request index="1" response="11100" foes="11100"/>
<request index="2" response="00000" foes="00011"/>
<request index="3" response="00000" foes="00010"/>
<request index="4" response="00000" foes="00010"/>
</junction>
<junction id="1-begin" type="dead_end" x="0.00" y="456.59" incLanes="" intLanes="" shape="0.00,459.84 -0.00,453.34"/>
<junction id="1-end" type="dead_end" x="13617.44" y="454.98" incLanes="1[1][1][1]_0 1[1][1][1]_1" intLanes="" shape="13617.44,451.73 13617.44,458.23"/>
<junction id="2" type="priority" x="6542.32" y="455.81" incLanes="3[0]_0 1[1][0]_0 1[1][0]_1" intLanes="" shape="6555.90,459.06 6555.90,452.56 6555.79,451.99 6554.57,449.03 6544.28,452.61 6544.19,455.81">
<request index="0" response="00100" foes="00100"/>
<request index="1" response="11100" foes="11100"/>
<request index="2" response="00000" foes="00011"/>
<request index="3" response="00000" foes="00010"/>
<request index="4" response="00000" foes="00010"/>
</junction>
<junction id="2-DestinationNode" type="dead_end" x="1925.88" y="450.90" incLanes="2.992_0" intLanes="" shape="1925.37,449.38 1926.39,452.42"/>
<junction id="2-begin" type="dead_end" x="1141.67" y="25.00" incLanes="" intLanes="" shape="1141.72,24.99 1144.90,24.61"/>
<junction id="3" type="priority" x="9482.19" y="455.47" incLanes="4.0_0 1[1][1][0]_0 1[1][1][0]_1" intLanes="" shape="9524.85,458.71 9524.85,452.21 9524.84,452.04 9524.46,448.86 9471.74,448.69 9470.36,451.57 9470.21,452.22 9470.21,458.72">
<request index="0" response="00100" foes="00100"/>
<request index="1" response="11100" foes="11100"/>
<request index="2" response="00000" foes="00011"/>
<request index="3" response="00000" foes="00010"/>
<request index="4" response="00000" foes="00010"/>
</junction>
<junction id="3-DestinationNode" type="dead_end" x="6555.66" y="450.31" incLanes="3.1003_0" intLanes="" shape="6555.05,448.83 6556.27,451.79"/>
<junction id="3-begin" type="dead_end" x="5761.98" y="26.58" incLanes="" intLanes="" shape="5762.03,26.57 5765.12,25.75"/>
<junction id="4-SourceNode" type="dead_end" x="9470.40" y="449.82" incLanes="" intLanes="" shape="9469.71,451.26 9471.09,448.38"/>
<junction id="4-end" type="dead_end" x="10123.60" y="-946.92" incLanes="4[1]_0" intLanes="" shape="10122.00,-946.92 10125.20,-946.92"/>
<connection from="1[0]" to="2.992" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from="1[0]" to="1[1][0]" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from="1[0]" to="1[1][0]" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from="1[1][0]" to="3.1003" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from="1[1][0]" to="1[1][1][0]" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from="1[1][0]" to="1[1][1][0]" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from="1[1][1][0]" to="4[1]" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from="1[1][1][0]" to="1[1][1][1]" fromLane="0" toLane="0" dir="s" state="M"/>
<connection from="1[1][1][0]" to="1[1][1][1]" fromLane="1" toLane="1" dir="s" state="M"/>
<connection from="2[0]" to="2.992" fromLane="0" toLane="0" dir="s" state="m"/>
<connection from="2[0]" to="1[1][0]" fromLane="0" toLane="0" dir="s" state="m"/>
<connection from="3[0]" to="3.1003" fromLane="0" toLane="0" dir="s" state="m"/>
<connection from="3[0]" to="1[1][1][0]" fromLane="0" toLane="0" dir="s" state="m"/>
<connection from="4.0" to="4[1]" fromLane="0" toLane="0" dir="s" state="m"/>
<connection from="4.0" to="1[1][1][1]" fromLane="0" toLane="0" dir="s" state="m"/>
</net>
<routes>
<vType id="car" vClass="passenger" accel="35" decel="35" length="5.07" color="1,0,0">
</vType>
<vType id="car1" vClass="passenger" accel="1.4" decel="1.8" length="4.64" maxSpeed="33" color="1,1,1" carFollowModel="Wiedemann" tau="1.0" security="1.0" estimation="1.0" emergencyDecel="5.5" apparentDecel="5.0">
</vType>
<route id="route1" edges="1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="BMWC10" type="car" route="route1" depart="0">
</vehicle>
<route id="route2" edges="1[0] 1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="ditiExpeon6" type="car" route="route2" depart="0">
</vehicle>
<route id="route3" edges="3[0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="F150C12" type="car" route="route3" depart="0">
</vehicle>
<route id="route4" edges="1[0] 1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="Ford1" type="car" route="route4" depart="0">
</vehicle>
<route id="route5" edges="1[0] 1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="llacCadi3" type="car" route="route5" depart="0">
</vehicle>
<route id="route6" edges="1[0] 1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="NeonC4" type="car" route="route6" depart="0">
</vehicle>
<route id="route7" edges="1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="owT8Yell" type="car" route="route7" depart="0">
</vehicle>
<route id="route8" edges="1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="peC9Esca" type="car" route="route8" depart="0">
</vehicle>
<route id="route9" edges="1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="rC11RoveLand" type="car" route="route9" depart="0">
</vehicle>
<route id="route10" edges="1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="StarT7" type="car" route="route10" depart="0">
</vehicle>
<route id="route11" edges="1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="tarCWins13" type="car" route="route11" depart="0">
</vehicle>
<route id="route12" edges="1[0] 1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="VanC5" type="car" route="route12" depart="0">
</vehicle>
<route id="route13" edges="1[0] 1[1][0] 1[1][1][0] 1[1][1][1]">
</route>
<vehicle id="WhiteC2" type="car" route="route13" depart="0">
</vehicle>
<route id="route14" edges="2[0] 1[1][0] 1[1][1][0] 4[1]">
</route>
<vehicle id="EXT" type="car1" route="route14" depart="0">
</vehicle>
</routes>
Attachment:
sim.sumocfg
Description: application/sumo
Attachment:
ado_cars_35_speed.csv
Description: MS-Excel spreadsheet