Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicPCU-updated-matsim #6

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2188fca
completed all tasks
shivam-a Apr 16, 2022
a9a6c56
code improvements for traffic char
shivam-a Apr 21, 2022
bf05389
signals
shivam-a Apr 25, 2022
e34776b
Signals with dynamic PCU
shivam-a Apr 28, 2022
9f1e7f8
delay and signal times are generated now
shivam-a May 3, 2022
d9c6db7
delay green times per cycle
shivam-a May 5, 2022
cec235b
improved flow, greentime, delay calculation
shivam-a May 7, 2022
e74c33a
Changes by amit2
shivam-a May 9, 2022
600273f
improved flow, greentime, delay calculation
shivam-a May 13, 2022
c80e6f7
corrections in calculating flow
shivam-a May 26, 2022
7b1fe33
flow calculation
shivam-a May 30, 2022
09955f1
completed all tasks
shivam-a Apr 16, 2022
af3adcf
code improvements for traffic char
shivam-a Apr 21, 2022
ec4595a
signals
shivam-a Apr 25, 2022
1461aa5
Signals with dynamic PCU
shivam-a Apr 28, 2022
dc0ff50
delay and signal times are generated now
shivam-a May 3, 2022
e2b3d00
delay green times per cycle
shivam-a May 5, 2022
eadf8cc
improved flow, greentime, delay calculation
shivam-a May 7, 2022
9994b3c
Changes by amit2
shivam-a May 9, 2022
7c9d940
improved flow, greentime, delay calculation
shivam-a May 13, 2022
0374ccf
corrections in calculating flow
shivam-a May 26, 2022
b8c5b1e
flow calculation
shivam-a May 30, 2022
7d41da3
verifying if all jobs succesful
shivam-a Sep 26, 2022
7e14564
Merge remote-tracking branch 'origin/playground' into playground
shivam-a Sep 26, 2022
5224cea
corrected log4j vulnerability https://logging.apache.org/log4j/2.x/se…
shivam-a Sep 26, 2022
8f6f7a1
corrected evac codes
shivam-a Feb 17, 2023
0a505db
corrected evac codes
shivam-a Feb 24, 2023
c774917
Merge branch 'master' of https://github.com/teg-iitr/matsim-iitr into…
shivam-a Feb 25, 2023
43ef6c6
Merge branch 'evac' of https://github.com/teg-iitr/matsim-iitr into p…
shivam-a Feb 25, 2023
9e83d23
mixed traffic signal correction
shivam-a Feb 25, 2023
be46003
signals example with lanes
shivam-a Feb 27, 2023
8b958e3
fixed time signal example with lanes and holes
shivam-a Feb 28, 2023
2ea35ad
straight lanes added, now it's working
shivam-a Feb 28, 2023
6642688
OTfvis testing without signal otfvis
shivam-a Mar 1, 2023
0470b58
Realistic Scenario
shivam-a Mar 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
straight lanes added, now it's working
  • Loading branch information
shivam-a committed Feb 28, 2023
commit 2ea35ade66c06401c73948b3e9919bc9fcab72af
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,16 @@ private void createSystemControl(SignalControlData control, Id<SignalSystem> sig
private void createPopulation(Scenario scenario) {
Population population = scenario.getPopulation();

String[] odRelations = {"2_3-3_7", "2_3-3_4", "2_3-3_8", "7_3-3_4", "7_3-3_8", "7_3-3_2",
"4_3-3_8", "4_3-3_2", "4_3-3_7", "8_3-3_2", "8_3-3_7", "8_3-3_4", };
// String[] odRelations = {"2_3-3_7", "2_3-3_4", "2_3-3_8", "7_3-3_4", "7_3-3_8", "7_3-3_2",
// "4_3-3_8", "4_3-3_2", "4_3-3_7", "8_3-3_2", "8_3-3_7", "8_3-3_4", };
String[] odRelations = {"1_2-7_6", "1_2-4_5", "1_2-8_9", "6_7-4_5", "6_7-8_9", "6_7-2_1",
"5_4-8_9", "5_4-2_1", "5_4-7_6", "9_8-2_1", "9_8-7_6", "9_8-4_5", };

for (String od : odRelations) {
String fromLinkId = od.split("-")[0];
String toLinkId = od.split("-")[1];

for (int i = 0; i < 1800; i++) {
for (int i = 0; i < 1500; i++) {
// create a person
Person person = population.getFactory().createPerson(Id.createPersonId(od + "-" + i));

Expand Down Expand Up @@ -221,7 +223,7 @@ private void createPopulation(Scenario scenario) {
new PopulationWriter(population).write(outputDirectory + "population.xml.gz");
}
private static String getTravelMode(int number) {
if (number < 60) return "car";
if (number <= 60) return "car";
else return "truck";
}

Expand All @@ -234,10 +236,10 @@ private Config defineConfig() throws IOException {
config.controler().setOutputDirectory(outputDirectory);
config.controler().setLastIteration(50);

config.travelTimeCalculator().setMaxTime(18000);
config.travelTimeCalculator().setMaxTime(5 * 60 * 60);

config.qsim().setStartTime(0.0D);
config.qsim().setEndTime(18000.0D);
config.qsim().setStartTime(0);
config.qsim().setEndTime(5 * 60 * 60);
config.qsim().setSnapshotStyle(QSimConfigGroup.SnapshotStyle.withHoles);
config.qsim().setTrafficDynamics(QSimConfigGroup.TrafficDynamics.withHoles);
config.qsim().setNodeOffset(20.0);
Expand Down Expand Up @@ -276,8 +278,8 @@ private Config defineConfig() throws IOException {
changeTripMode.setModes(new String[]{"car", "truck"});
config.plansCalcRoute().setNetworkModes(mainModes);

OTFVisConfigGroup otfvisConfig = ConfigUtils.addOrGetModule(config, OTFVisConfigGroup.class);
otfvisConfig.setDrawTime(true);
// OTFVisConfigGroup otfvisConfig = ConfigUtils.addOrGetModule(config, OTFVisConfigGroup.class);
// otfvisConfig.setDrawTime(true);

config.controler().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles);
config.controler().setWriteEventsInterval(config.controler().getLastIteration());
Expand All @@ -286,9 +288,6 @@ private Config defineConfig() throws IOException {
config.vspExperimental().setWritingOutputEvents(true);
config.planCalcScore().setWriteExperiencedPlans(true);

// // set output filenames
// config.network().setLaneDefinitionsFile(outputDirectory + "lane_definitions_v2.0.xml");

//write config to file
String configFile = outputDirectory + "config.xml";
ConfigWriter configWriter = new ConfigWriter(config);
Expand All @@ -306,28 +305,28 @@ private void createGroupsAndSystem(SignalSystemsData signalSystemsData, SignalGr
SignalUtils.createAndAddSignal(sys, factory, Id.create("1", Signal.class), Id.createLinkId("2_3"),
Arrays.asList(Id.create("2_3.l", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("2", Signal.class), Id.createLinkId("2_3"),
Arrays.asList(Id.create("2_3.ol", Lane.class)));
Arrays.asList(Id.create("2_3.s", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("3", Signal.class), Id.createLinkId("2_3"),
Arrays.asList(Id.create("2_3.r", Lane.class)));

SignalUtils.createAndAddSignal(sys, factory, Id.create("4", Signal.class), Id.createLinkId("7_3"),
Arrays.asList(Id.create("7_3.l", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("5", Signal.class), Id.createLinkId("7_3"),
Arrays.asList(Id.create("7_3.ol", Lane.class)));
Arrays.asList(Id.create("7_3.s", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("6", Signal.class), Id.createLinkId("7_3"),
Arrays.asList(Id.create("7_3.r", Lane.class)));

SignalUtils.createAndAddSignal(sys, factory, Id.create("7", Signal.class), Id.createLinkId("4_3"),
Arrays.asList(Id.create("4_3.l", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("8", Signal.class), Id.createLinkId("4_3"),
Arrays.asList(Id.create("4_3.ol", Lane.class)));
Arrays.asList(Id.create("4_3.s", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("9", Signal.class), Id.createLinkId("4_3"),
Arrays.asList(Id.create("4_3.r", Lane.class)));

SignalUtils.createAndAddSignal(sys, factory, Id.create("10", Signal.class), Id.createLinkId("8_3"),
Arrays.asList(Id.create("8_3.l", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("11", Signal.class), Id.createLinkId("8_3"),
Arrays.asList(Id.create("8_3.ol", Lane.class)));
Arrays.asList(Id.create("8_3.s", Lane.class)));
SignalUtils.createAndAddSignal(sys, factory, Id.create("12", Signal.class), Id.createLinkId("8_3"),
Arrays.asList(Id.create("8_3.r", Lane.class)));

Expand All @@ -346,13 +345,18 @@ private void createLanes(Scenario scenario) {
// original lane, i.e. lane that starts at the link from node and leads to all other lanes of the link
LanesUtils.createAndAddLane(lanesForLink23, factory,
Id.create("2_3.ol", Lane.class), LANE_CAPACITY, LINK_LENGTH, 0, NO_LANES,
null, Arrays.asList(Id.create("2_3.l", Lane.class), Id.create("2_3.r", Lane.class)));
null, Arrays.asList(Id.create("2_3.l", Lane.class), Id.create("2_3.s", Lane.class), Id.create("2_3.r", Lane.class)));

// left turning lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink23, factory,
Id.create("2_3.l", Lane.class), LANE_CAPACITY, LANE_LENGTH, 1, NO_LANES,
Collections.singletonList(Id.create("3_7", Link.class)), null);

// straight lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink23, factory,
Id.create("2_3.s", Lane.class), LANE_CAPACITY, LANE_LENGTH, 0, NO_LANES,
Collections.singletonList(Id.create("3_4", Link.class)), null);

// right turning lane (alignment -1)
LanesUtils.createAndAddLane(lanesForLink23, factory,
Id.create("2_3.r", Lane.class), LANE_CAPACITY, LANE_LENGTH, -1, NO_LANES,
Expand All @@ -367,13 +371,18 @@ private void createLanes(Scenario scenario) {
// original lane, i.e. lane that starts at the link from node and leads to all other lanes of the link
LanesUtils.createAndAddLane(lanesForLink73, factory,
Id.create("7_3.ol", Lane.class), LANE_CAPACITY, LINK_LENGTH, 0, NO_LANES,
null, Arrays.asList(Id.create("7_3.l", Lane.class), Id.create("7_3.r", Lane.class)));
null, Arrays.asList(Id.create("7_3.l", Lane.class), Id.create("7_3.s", Lane.class), Id.create("7_3.r", Lane.class)));

// left turning lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink73, factory,
Id.create("7_3.l", Lane.class), LANE_CAPACITY, LANE_LENGTH, 1, NO_LANES,
Collections.singletonList(Id.create("3_4", Link.class)), null);

// straight lane (alignment 0)
LanesUtils.createAndAddLane(lanesForLink73, factory,
Id.create("7_3.s", Lane.class), LANE_CAPACITY, LANE_LENGTH, 0, NO_LANES,
Collections.singletonList(Id.create("3_8", Link.class)), null);

// right turning lane (alignment -1)
LanesUtils.createAndAddLane(lanesForLink73, factory,
Id.create("7_3.r", Lane.class), LANE_CAPACITY, LANE_LENGTH, -1, NO_LANES,
Expand All @@ -388,13 +397,18 @@ private void createLanes(Scenario scenario) {
// original lane, i.e. lane that starts at the link from node and leads to all other lanes of the link
LanesUtils.createAndAddLane(lanesForLink43, factory,
Id.create("4_3.ol", Lane.class), LANE_CAPACITY, LINK_LENGTH, 0, NO_LANES,
null, Arrays.asList(Id.create("4_3.l", Lane.class), Id.create("4_3.r", Lane.class)));
null, Arrays.asList(Id.create("4_3.l", Lane.class), Id.create("4_3.s", Lane.class), Id.create("4_3.r", Lane.class)));

// left turning lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink43, factory,
Id.create("4_3.l", Lane.class), LANE_CAPACITY, LANE_LENGTH, 1, NO_LANES,
Collections.singletonList(Id.create("3_8", Link.class)), null);

// straight lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink43, factory,
Id.create("4_3.s", Lane.class), LANE_CAPACITY, LANE_LENGTH, 0, NO_LANES,
Collections.singletonList(Id.create("3_2", Link.class)), null);

// right turning lane (alignment -1)
LanesUtils.createAndAddLane(lanesForLink43, factory,
Id.create("4_3.r", Lane.class), LANE_CAPACITY, LANE_LENGTH, -1, NO_LANES,
Expand All @@ -409,13 +423,18 @@ private void createLanes(Scenario scenario) {
// original lane, i.e. lane that starts at the link from node and leads to all other lanes of the link
LanesUtils.createAndAddLane(lanesForLink83, factory,
Id.create("8_3.ol", Lane.class), LANE_CAPACITY, LINK_LENGTH, 0, NO_LANES,
null, Arrays.asList(Id.create("8_3.l", Lane.class), Id.create("8_3.r", Lane.class)));
null, Arrays.asList(Id.create("8_3.l", Lane.class), Id.create("8_3.s", Lane.class), Id.create("8_3.r", Lane.class)));

// left turning lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink83, factory,
Id.create("8_3.l", Lane.class), LANE_CAPACITY, LANE_LENGTH, 1, NO_LANES,
Collections.singletonList(Id.create("3_2", Link.class)), null);

// straight lane (alignment 1)
LanesUtils.createAndAddLane(lanesForLink83, factory,
Id.create("8_3.s", Lane.class), LANE_CAPACITY, LANE_LENGTH, 0, NO_LANES,
Collections.singletonList(Id.create("3_7", Link.class)), null);

// right turning lane (alignment -1)
LanesUtils.createAndAddLane(lanesForLink83, factory,
Id.create("8_3.r", Lane.class), LANE_CAPACITY, LANE_LENGTH, -1, NO_LANES,
Expand Down