Skip to content

Commit

Permalink
Merge pull request #58 from agentsoz/fix-multi-day-messaging
Browse files Browse the repository at this point in the history
Modified calculation of message injection point minutes to be able to…
  • Loading branch information
dhixsingh authored Feb 11, 2024
2 parents fdf479d + d3be82e commit d3b1911
Show file tree
Hide file tree
Showing 12 changed files with 1,008 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"effectiveSpeed" : "0",
"effectiveSpeedUnit" : "KMPH",
"impactedLinks" : ["75276-75274-75272-75270", "75269-75271-75273-75275"]
},
{
"description" : "Road blocked again at -37.077504, 144.203915 due to car accident",
"startHHMM" : "2410",
"endHHMM" : "2450",
"effectiveSpeed" : "0",
"effectiveSpeedUnit" : "KMPH",
"impactedLinks" : ["75276-75274-75272-75270", "75269-75271-75273-75275"]
}
]
}
3 changes: 3 additions & 0 deletions ees/scenarios/mount-alexander-shire/campbells-creek-1/ees.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<opt id="crs">EPSG:28355</opt>
<!-- simulation start time in HH:MM format -->
<opt id="startHHMM">00:01</opt>
<!-- Output file for trips written in DeckGL format -->
<opt id="deckGlOutFile">test/output/io/github/agentsoz/ees/BlockageCampbellsCreek01Test/test/matsim/trips.deckgl.json</opt>

</global>

<!-- model specific configuration -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<attribute name="FinalResponseThreshold" class="java.lang.Double" >0.0</attribute>
</attributes>
<plan selected="yes">
<activity type="home" x="251571.1921738536" y="5891005.042528489" end_time="00:10:00" >
<activity type="home" x="251571.1921738536" y="5891005.042528489" end_time="24:50:00" >
</activity>
<leg mode="car">
</leg>
Expand All @@ -24,6 +24,22 @@

</person>

<person id="1">
<attributes>
<attribute name="BDIAgentType" class="java.lang.String" >io.github.agentsoz.ees.agents.bushfire.Resident</attribute>
<attribute name="InitialResponseThreshold" class="java.lang.Double" >0.1</attribute>
<attribute name="FinalResponseThreshold" class="java.lang.Double" >0.1</attribute>
</attributes>
<plan selected="yes">
<activity type="home" x="255731.5323264746" y="5886085.46646427" end_time="24:50:00" >
</activity>
<leg mode="car">
</leg>
<activity type="home" x="255731.5323264746" y="5886085.46646427" >
</activity>
</plan>

</person>
<!-- ====================================================================== -->

</population>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@
"20202102724" : null,
"20202102725" : null,
"20202102726" : null,
"20202102727" : null,
"20202102727" : null
}
},
{
"type" : "EVACUATE_NOW",
"content" : "Castlemaine,252145,5894310,Evacuate now if safe to do so",
"broadcastHHMM" : "2410",
"broadcastZones" : {
"20202102801" : null,
"20202102802" : null,
"20202102803" : null,
Expand Down Expand Up @@ -70,6 +77,6 @@
"20202102825" : null,
"20202102826" : null
}
},
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void loadJson(String file) throws IOException, ParseException, java.text.ParseEx
Date date = format.parse(disruption.getStartHHMM());
Calendar cal = Calendar.getInstance();
cal.setTime(date);
double minutes = 60 * cal.get(Calendar.HOUR_OF_DAY) + cal.get(Calendar.MINUTE);
double minutes = 60 * 24 * (cal.get(Calendar.DAY_OF_YEAR) - 1) + 60 * cal.get(Calendar.HOUR_OF_DAY) + cal.get(Calendar.MINUTE);
if (disruptions.containsKey(minutes)) {
throw new RuntimeException("\n\nCONFIGURATION ERROR:" +
"\nFound multiple disruption blocks in " + file + " for time " + disruption.getStartHHMM() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void loadJsonMessagesForZones(String msgFile, String zonesFile) throws IOExcepti
Date date = format.parse(message.getBroadcastHHMM());
Calendar cal = Calendar.getInstance();
cal.setTime(date);
double minutes = 60 * cal.get(Calendar.HOUR_OF_DAY) + cal.get(Calendar.MINUTE);
double minutes = 60 * 24 * (cal.get(Calendar.DAY_OF_YEAR) - 1) + 60 * cal.get(Calendar.HOUR_OF_DAY) + cal.get(Calendar.MINUTE);
// get the enclosing polygon for each zone
TreeMap<String,Double[][]> map = message.getBroadcastZones();
for (String zoneId : map.keySet()) {
Expand Down
2 changes: 1 addition & 1 deletion ees/src/main/java/io/github/agentsoz/ees/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void start(Config cfg, Map<Integer, List<String[]>> bdiMap) {
DeckglTripsData deckglTripsData = null;
String deckglCfg = cfg.getGlobalConfig(Config.eGlobalDeckGlOutFile);
if (deckglCfg != null) {
deckglTripsData = new DeckglTripsData(cfg.getGlobalConfig(Config.eGlobalCoordinateSystem));
deckglTripsData = new DeckglTripsData(matsimEvacModel.getScenario().getConfig().global().getCoordinateSystem());
}

// --- initialize and start MATSim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public void test() {
TestUtils.comparingDepartures(primaryExpectedEventsFilename,actualEventsFilename,1.);
TestUtils.comparingArrivals(primaryExpectedEventsFilename,actualEventsFilename,1.);
TestUtils.comparingActivityStarts(primaryExpectedEventsFilename,actualEventsFilename, 1.);

// Compare the DeckGL file
final String actualDeckglFilename = utils.getOutputDirectory() + "/trips.deckgl.json";
final String expectedDeckglFilename = utils.getInputDirectory() + "/trips.deckgl.json";
TestUtils.compareFiles(expectedDeckglFilename,actualDeckglFilename);

}

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit d3b1911

Please sign in to comment.