Skip to content

Commit

Permalink
Merge branch 'master' into DrtCompanionRideGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenaxer authored Jan 20, 2024
2 parents a24b2a9 + 5b66a07 commit 25f9b8a
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 1 deletion.
1 change: 1 addition & 0 deletions contribs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<module>signals</module>
<module>simulatedannealing</module>
<module>simwrapper</module>
<module>small-scale-traffic-generation</module>
<module>socnetsim</module>
<module>sumo</module>
<module>taxi</module>
Expand Down
3 changes: 3 additions & 0 deletions contribs/small-scale-traffic-generation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/output
/target
/bin
3 changes: 3 additions & 0 deletions contribs/small-scale-traffic-generation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# small scale traffic generation

construction site; will contain small scale traffic generation code
29 changes: 29 additions & 0 deletions contribs/small-scale-traffic-generation/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.matsim.contrib</groupId>
<artifactId>small-scale-traffic-generation</artifactId>
<name>small-scale-traffic-generation</name>

<parent>
<groupId>org.matsim</groupId>
<artifactId>contrib</artifactId>
<version>16.0-SNAPSHOT</version>
</parent>

<dependencies>

<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>application</artifactId>
<version>16.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.matsim.contrib</groupId>
<artifactId>freight</artifactId>
<version>16.0-SNAPSHOT</version>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html>
<body>

Overview text (in html syntax) could be entered here.

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ public void run() {
if (event.getTime() < this.lastEventTime) {
throw new RuntimeException("Events in the queue are not ordered chronologically. " +
"This should never happen. Is the SimTimeStepParallelEventsManager registered " +
"as a MobsimAfterSimStepListener?");
"as a MobsimAfterSimStepListener? LastEventTime = " + this.lastEventTime +
" currentEvent.time = " + event.getTime() + " currentEvent.type = " + event.getEventType() +
" full event: " + event.toString());
} else {
this.lastEventTime = event.getTime();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,21 @@ public void reset(int iteration) {}
new PersonStuckEvent(1.0, Id.createPersonId(0), Id.createLinkId(0), "car"));
}

@Test
void testEventsAreChronologicallyOrdered() {
SimStepParallelEventsManagerImpl events = new SimStepParallelEventsManagerImpl(2);
EventsCollector collector = new EventsCollector();
events.addHandler(collector);
try {
events.initProcessing();
events.processEvent(new LinkEnterEvent(10.0, Id.createVehicleId(0), Id.createLinkId(0)));
events.processEvent(new LinkLeaveEvent(50.0, Id.createVehicleId(0), Id.createLinkId(0)));
events.processEvent(new LinkEnterEvent(49.0, Id.createVehicleId(0), Id.createLinkId(0)));
events.processEvent(new LinkLeaveEvent(69.0, Id.createVehicleId(0), Id.createLinkId(0)));
events.finishProcessing();
Assertions.fail("Expected exception about order of events");
} catch (Exception expected) {
}
}

}

0 comments on commit 25f9b8a

Please sign in to comment.