diff --git a/sumo/README b/sumo/README index 0eb564382d..2c07577ede 100644 --- a/sumo/README +++ b/sumo/README @@ -37,8 +37,8 @@ Mailing List. ============= To stay informed, we have a mailing list for SUMO. To subscribe, send mail to -sumo-user-request@lists.sourceforge.net with the word subscribe in the message body. -Messages to the list can be sent to sumo-user@lists.sourceforge.net. +sumo-users-request@lists.sourceforge.net with the word subscribe in the message body. +Messages to the list can be sent to sumo-users@lists.sourceforge.net. SUMO announcements will be made through the sumo-announce@lists.sourceforge.net list; you can subscribe to this list by sending a message "subscribe" to the list server at sumo-announce-request@lists.sourceforge.net. @@ -91,4 +91,4 @@ License. SUMO is licensed under GPL, see the file COPYING for details. For the licenses of the different libraries and supplementary code, see - http://sumo.dlr.de/wiki/License + http://sumo.dlr.de/wiki/License \ No newline at end of file diff --git a/sumo/src/libsumo/libsumo.h b/sumo/src/libsumo/libsumo.h index 824191b53f..676ecb0d2d 100755 --- a/sumo/src/libsumo/libsumo.h +++ b/sumo/src/libsumo/libsumo.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include //#define HAVE_INTERNAL_LANES //#define NO_TRACI @@ -57,6 +59,10 @@ LIBSUMO_DLL_EXPORTED void libsumo_simulation_stop(); LIBSUMO_DLL_EXPORTED void libsumo_simulation_step(); +LIBSUMO_DLL_EXPORTED int + libsumo_simulation_minexpectednumber(); +LIBSUMO_DLL_EXPORTED std::string + libsumo_simulation_tripstatistics(); LIBSUMO_DLL_EXPORTED const char* libsumo_tls_getstate(const char* id); LIBSUMO_DLL_EXPORTED void @@ -69,6 +75,8 @@ LIBSUMO_DLL_EXPORTED void libsumo_vehicle_position(const char* id, double* pos); LIBSUMO_DLL_EXPORTED double libsumo_vehicle_speed(const char* id); +LIBSUMO_DLL_EXPORTED double + libsumo_vehicle_waitingtime(const char* id); LIBSUMO_DLL_EXPORTED void libsumo_vehicle_positions(double* positions); LIBSUMO_DLL_EXPORTED double @@ -79,6 +87,10 @@ LIBSUMO_DLL_EXPORTED double libsumo_meme_meanspeed(const char* id); LIBSUMO_DLL_EXPORTED int libsumo_meme_vehiclenumber(const char* id); +LIBSUMO_DLL_EXPORTED int + libsumo_meme_vehiclehaltingnumber(const char* id); +LIBSUMO_DLL_EXPORTED std::vector + libsumo_meme_vehicleids(const char* id); LIBSUMO_DLL_EXPORTED double libsumo_inductionloop_meanspeed(const char* id); LIBSUMO_DLL_EXPORTED int diff --git a/sumo/src/libsumo/meme.cpp b/sumo/src/libsumo/meme.cpp index abe09b559e..5fb63cb92e 100755 --- a/sumo/src/libsumo/meme.cpp +++ b/sumo/src/libsumo/meme.cpp @@ -25,3 +25,27 @@ libsumo_meme_vehiclenumber(const char* id) } return e3->getVehiclesWithin(); } + +LIBSUMO_DLL_EXPORTED int +libsumo_meme_vehiclehaltingnumber(const char* id) +{ + MSE3Collector* e3 = + static_cast(libsumo_net->getDetectorControl() + .getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).get(id)); + if (e3 == 0) { + throw ProcessError("Unknown meme detector"); + } + return e3->getCurrentHaltingNumber(); +} + +LIBSUMO_DLL_EXPORTED std::vector +libsumo_meme_vehicleids(const char* id) +{ + MSE3Collector* e3 = + static_cast(libsumo_net->getDetectorControl() + .getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).get(id)); + if (e3 == 0) { + throw ProcessError("Unknown meme detector"); + } + return e3->getCurrentVehicleIDs(); +} diff --git a/sumo/src/libsumo/simulation.cpp b/sumo/src/libsumo/simulation.cpp index 2c1ec13e1e..47da55a26e 100755 --- a/sumo/src/libsumo/simulation.cpp +++ b/sumo/src/libsumo/simulation.cpp @@ -68,3 +68,15 @@ libsumo_simulation_step() { libsumo_net->simulationStep(); } + +LIBSUMO_DLL_EXPORTED int +libsumo_simulation_minexpectednumber() +{ + return libsumo_net->getVehicleControl().getActiveVehicleCount() +libsumo_net->getInsertionControl().getPendingFlowCount(); +} + +LIBSUMO_DLL_EXPORTED std::string +libsumo_simulation_tripstatistics() +{ + return MSDevice_Tripinfo::printStatistics(); +} diff --git a/sumo/src/libsumo/vehicle.cpp b/sumo/src/libsumo/vehicle.cpp index 64d503b606..3cbc43ea02 100755 --- a/sumo/src/libsumo/vehicle.cpp +++ b/sumo/src/libsumo/vehicle.cpp @@ -82,6 +82,21 @@ libsumo_vehicle_speed(const char* id) return visible ? v->getSpeed() : INVALID_DOUBLE_VALUE; } +LIBSUMO_DLL_EXPORTED double +libsumo_vehicle_waitingtime(const char* id) +{ + SUMOVehicle* sumoVehicle = libsumo_net->getVehicleControl().getVehicle(id); + if (sumoVehicle == 0) { + throw ProcessError("Unknown vehicle"); + } + MSVehicle* v = dynamic_cast(sumoVehicle); + if (v == 0) { + throw ProcessError( "Vehicle is not a micro-simulation vehicle"); + } + + return v->getWaitingSeconds(); +} + LIBSUMO_DLL_EXPORTED void libsumo_vehicle_positions(double* positions) {