Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions sumo/README
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions sumo/src/libsumo/libsumo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <microsim/MSNet.h>
#include <microsim/MSRoute.h>
#include <microsim/MSVehicleControl.h>
#include <microsim/MSInsertionControl.h>
#include <microsim/MSLane.h>
#include <netload/NLBuilder.h>
#include <netload/NLHandler.h>
Expand All @@ -27,6 +28,7 @@
#include <microsim/output/MSDetectorControl.h>
#include <utils/iodevices/OutputDevice.h>
#include <mesosim/MEVehicleControl.h>
#include <microsim/devices/MSDevice_Tripinfo.h>

//#define HAVE_INTERNAL_LANES
//#define NO_TRACI
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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<std::string>
libsumo_meme_vehicleids(const char* id);
LIBSUMO_DLL_EXPORTED double
libsumo_inductionloop_meanspeed(const char* id);
LIBSUMO_DLL_EXPORTED int
Expand Down
24 changes: 24 additions & 0 deletions sumo/src/libsumo/meme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MSE3Collector*>(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<std::string>
libsumo_meme_vehicleids(const char* id)
{
MSE3Collector* e3 =
static_cast<MSE3Collector*>(libsumo_net->getDetectorControl()
.getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).get(id));
if (e3 == 0) {
throw ProcessError("Unknown meme detector");
}
return e3->getCurrentVehicleIDs();
}
12 changes: 12 additions & 0 deletions sumo/src/libsumo/simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
15 changes: 15 additions & 0 deletions sumo/src/libsumo/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MSVehicle*>(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)
{
Expand Down