44 #define DEFAULT_VIEW "View #0" 91 : duration(_duration), duration1(_duration1), duration2(_duration2), phase(_phase) {}
101 TraCILogic(
const std::string& _subID,
int _type,
const std::map<std::string, SUMOReal>& _subParameter,
unsigned int _currentPhaseIndex,
const std::vector<TraCIPhase>& _phases)
102 : subID(_subID), type(_type), subParameter(_subParameter), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
114 TraCILink(
const std::string& _from,
const std::string& _via,
const std::string& _to)
115 : from(_from), via(_via), to(_to) {}
144 void connect(
const std::string& host,
int port);
216 std::vector<std::string> getIDList()
const;
217 unsigned int getIDCount()
const;
218 SUMOReal getAdaptedTraveltime(
const std::string& edgeID,
SUMOTime time)
const;
220 SUMOReal getCO2Emission(
const std::string& edgeID)
const;
221 SUMOReal getCOEmission(
const std::string& edgeID)
const;
222 SUMOReal getHCEmission(
const std::string& edgeID)
const;
223 SUMOReal getPMxEmission(
const std::string& edgeID)
const;
224 SUMOReal getNOxEmission(
const std::string& edgeID)
const;
225 SUMOReal getFuelConsumption(
const std::string& edgeID)
const;
226 SUMOReal getNoiseEmission(
const std::string& edgeID)
const;
227 SUMOReal getLastStepMeanSpeed(
const std::string& edgeID)
const;
228 SUMOReal getLastStepOccupancy(
const std::string& edgeID)
const;
229 SUMOReal getLastStepLength(
const std::string& edgeID)
const;
230 SUMOReal getTraveltime(
const std::string& edgeID)
const;
231 unsigned int getLastStepVehicleNumber(
const std::string& edgeID)
const;
232 SUMOReal getLastStepHaltingNumber(
const std::string& edgeID)
const;
233 std::vector<std::string> getLastStepVehicleIDs(
const std::string& edgeID)
const;
235 void adaptTraveltime(
const std::string& edgeID,
SUMOReal time)
const;
236 void setEffort(
const std::string& edgeID,
SUMOReal effort)
const;
237 void setMaxSpeed(
const std::string& edgeID,
SUMOReal speed)
const;
260 std::vector<std::string> getIDList()
const;
263 std::string getSchema(
const std::string& viewID =
DEFAULT_VIEW)
const;
265 void setZoom(
const std::string& viewID,
SUMOReal zoom)
const;
267 void setSchema(
const std::string& viewID,
const std::string& schemeName)
const;
269 void screenshot(
const std::string& viewID,
const std::string& filename)
const;
270 void trackVehicle(
const std::string& viewID,
const std::string& vehID)
const;
293 std::vector<std::string> getIDList()
const;
295 std::string getLaneID(
const std::string& loopID)
const;
296 unsigned int getLastStepVehicleNumber(
const std::string& loopID)
const;
297 SUMOReal getLastStepMeanSpeed(
const std::string& loopID)
const;
298 std::vector<std::string> getLastStepVehicleIDs(
const std::string& loopID)
const;
299 SUMOReal getLastStepOccupancy(
const std::string& loopID)
const;
300 SUMOReal getLastStepMeanLength(
const std::string& loopID)
const;
301 SUMOReal getTimeSinceDetection(
const std::string& loopID)
const;
302 unsigned int getVehicleData(
const std::string& loopID)
const;
325 std::vector<std::string> getIDList()
const;
349 std::vector<std::string> getIDList()
const;
350 SUMOReal getLength(
const std::string& laneID)
const;
351 SUMOReal getMaxSpeed(
const std::string& laneID)
const;
352 SUMOReal getWidth(
const std::string& laneID)
const;
353 std::vector<std::string> getAllowed(
const std::string& laneID)
const;
354 std::vector<std::string> getDisallowed(
const std::string& laneID)
const;
355 unsigned int getLinkNumber(
const std::string& laneID)
const;
356 TraCIPositionVector getShape(
const std::string& laneID)
const;
357 std::string getEdgeID(
const std::string& laneID)
const;
358 SUMOReal getCO2Emission(
const std::string& laneID)
const;
359 SUMOReal getCOEmission(
const std::string& laneID)
const;
360 SUMOReal getHCEmission(
const std::string& laneID)
const;
361 SUMOReal getPMxEmission(
const std::string& laneID)
const;
362 SUMOReal getNOxEmission(
const std::string& laneID)
const;
363 SUMOReal getFuelConsumption(
const std::string& laneID)
const;
364 SUMOReal getNoiseEmission(
const std::string& laneID)
const;
365 SUMOReal getLastStepMeanSpeed(
const std::string& laneID)
const;
366 SUMOReal getLastStepOccupancy(
const std::string& laneID)
const;
367 SUMOReal getLastStepLength(
const std::string& laneID)
const;
368 SUMOReal getTraveltime(
const std::string& laneID)
const;
369 unsigned int getLastStepVehicleNumber(
const std::string& laneID)
const;
370 unsigned int getLastStepHaltingNumber(
const std::string& laneID)
const;
371 std::vector<std::string> getLastStepVehicleIDs(
const std::string& laneID)
const;
373 void setAllowed(
const std::string& laneID,
const std::vector<std::string>& allowedClasses)
const;
374 void setDisallowed(
const std::string& laneID,
const std::vector<std::string>& disallowedClasses)
const;
375 void setMaxSpeed(
const std::string& laneID,
SUMOReal speed)
const;
376 void setLength(
const std::string& laneID,
SUMOReal length)
const;
396 std::vector<std::string> getIDList()
const;
397 int getJamLengthVehicle(
const std::string& laneID)
const;
398 SUMOReal getJamLengthMeters(
const std::string& laneID)
const;
418 std::vector<std::string> getIDList()
const;
419 unsigned int getLastStepVehicleNumber(
const std::string& detID)
const;
420 SUMOReal getLastStepMeanSpeed(
const std::string& detID)
const;
421 std::vector<std::string> getLastStepVehicleIDs(
const std::string& detID)
const;
422 unsigned int getLastStepHaltingNumber(
const std::string& detID)
const;
445 std::vector<std::string> getIDList()
const;
446 std::string getType(
const std::string& poiID)
const;
450 void setType(
const std::string& poiID,
const std::string& setType)
const;
452 void setColor(
const std::string& poiID,
const TraCIColor& c)
const;
454 void remove(
const std::string& poiID,
int layer = 0)
const;
477 std::vector<std::string> getIDList()
const;
478 std::string getType(
const std::string& polygonID)
const;
479 TraCIPositionVector getShape(
const std::string& polygonID)
const;
481 void setType(
const std::string& polygonID,
const std::string& setType)
const;
482 void setShape(
const std::string& polygonID,
const TraCIPositionVector& shape)
const;
483 void setColor(
const std::string& polygonID,
const TraCIColor& c)
const;
484 void add(
const std::string& polygonID,
const TraCIPositionVector& shape,
const TraCIColor& c,
bool fill,
const std::string& type,
int layer)
const;
485 void remove(
const std::string& polygonID,
int layer = 0)
const;
508 std::vector<std::string> getIDList()
const;
509 std::vector<std::string> getEdges(
const std::string& routeID)
const;
511 void add(
const std::string& routeID,
const std::vector<std::string>& edges)
const;
535 unsigned int getLoadedNumber()
const;
536 std::vector<std::string> getLoadedIDList()
const;
537 unsigned int getDepartedNumber()
const;
538 std::vector<std::string> getDepartedIDList()
const;
539 unsigned int getArrivedNumber()
const;
540 std::vector<std::string> getArrivedIDList()
const;
541 unsigned int getStartingTeleportNumber()
const;
542 std::vector<std::string> getStartingTeleportIDList()
const;
543 unsigned int getEndingTeleportNumber()
const;
544 std::vector<std::string> getEndingTeleportIDList()
const;
547 unsigned int getMinExpectedNumber()
const;
570 std::vector<std::string> getIDList()
const;
571 std::string getRedYellowGreenState(
const std::string& tlsID)
const;
572 std::vector<TraCIAPI::TraCILogic> getCompleteRedYellowGreenDefinition(
const std::string& tlsID)
const;
573 std::vector<std::string> getControlledLanes(
const std::string& tlsID)
const;
574 std::vector<TraCIAPI::TraCILink> getControlledLinks(
const std::string& tlsID)
const;
575 std::string getProgram(
const std::string& tlsID)
const;
576 unsigned int getPhase(
const std::string& tlsID)
const;
577 unsigned int getNextSwitch(
const std::string& tlsID)
const;
579 void setRedYellowGreenState(
const std::string& tlsID,
const std::string& state)
const;
580 void setPhase(
const std::string& tlsID,
unsigned int index)
const;
581 void setProgram(
const std::string& tlsID,
const std::string& programID)
const;
582 void setPhaseDuration(
const std::string& tlsID,
unsigned int phaseDuration)
const;
583 void setCompleteRedYellowGreenDefinition(
const std::string& tlsID,
const TraCIAPI::TraCILogic& logic)
const;
606 std::vector<std::string> getIDList()
const;
607 SUMOReal getLength(
const std::string& typeID)
const;
608 SUMOReal getMaxSpeed(
const std::string& typeID)
const;
609 SUMOReal getSpeedFactor(
const std::string& typeID)
const;
610 SUMOReal getSpeedDeviation(
const std::string& typeID)
const;
611 SUMOReal getAccel(
const std::string& typeID)
const;
612 SUMOReal getDecel(
const std::string& typeID)
const;
613 SUMOReal getImperfection(
const std::string& typeID)
const;
614 SUMOReal getTau(
const std::string& typeID)
const;
615 std::string getVehicleClass(
const std::string& typeID)
const;
616 std::string getEmissionClass(
const std::string& typeID)
const;
617 std::string getShapeClass(
const std::string& typeID)
const;
618 SUMOReal getMinGap(
const std::string& typeID)
const;
619 SUMOReal getWidth(
const std::string& typeID)
const;
622 void setLength(
const std::string& typeID,
SUMOReal length)
const;
623 void setMaxSpeed(
const std::string& typeID,
SUMOReal speed)
const;
624 void setVehicleClass(
const std::string& typeID,
const std::string& clazz)
const;
625 void setSpeedFactor(
const std::string& typeID,
SUMOReal factor)
const;
626 void setSpeedDeviation(
const std::string& typeID,
SUMOReal deviation)
const;
627 void setEmissionClass(
const std::string& typeID,
const std::string& clazz)
const;
628 void setWidth(
const std::string& typeID,
SUMOReal width)
const;
629 void setMinGap(
const std::string& typeID,
SUMOReal minGap)
const;
630 void setShapeClass(
const std::string& typeID,
const std::string& clazz)
const;
631 void setAccel(
const std::string& typeID,
SUMOReal accel)
const;
632 void setDecel(
const std::string& typeID,
SUMOReal decel)
const;
633 void setImperfection(
const std::string& typeID,
SUMOReal imperfection)
const;
634 void setTau(
const std::string& typeID,
SUMOReal tau)
const;
635 void setColor(
const std::string& typeID,
const TraCIColor& c)
const;
725 int domain,
SUMOReal range,
const std::vector<int>& vars)
const;
EdgeScope edge
Scope for interaction with edges.
TraCIPosition getPosition(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
LaneScope(TraCIAPI &parent)
tcpip::Socket * mySocket
The socket.
C++ TraCI client API implementation.
void close()
Closes the connection.
Scope for interaction with edges.
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
TraCILogic(const std::string &_subID, int _type, const std::map< std::string, SUMOReal > &_subParameter, unsigned int _currentPhaseIndex, const std::vector< TraCIPhase > &_phases)
MeMeScope(TraCIAPI &parent)
TraCILink(const std::string &_from, const std::string &_via, const std::string &_to)
GUIScope(TraCIAPI &parent)
SUMOReal getDouble(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
virtual ~TrafficLightScope()
void send_commandClose() const
Sends a Close command.
JunctionScope junction
Scope for interaction with junctions.
TraCIPhase(const SUMOTime _duration, const SUMOTime _duration1, const SUMOTime _duration2, const std::string &_phase)
LaneScope lane
Scope for interaction with lanes.
unsigned int currentPhaseIndex
void processGET(tcpip::Storage &inMsg, int command, int expectedType, bool ignoreCommandId=false) const
Scope for interaction with traffic lights.
void simulationStep(SUMOTime time=0)
Advances by one step (or up to the given time)
Scope for interaction with the gui.
TrafficLightScope trafficlights
Scope for interaction with traffic lights.
TraCIPositionVector getPolygon(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Scope for interaction with routes.
TraCIBoundary getBoundingBox(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
InductionLoopScope inductionloop
Scope for interaction with inductive loops.
Scope for interaction with inductive loops.
POIScope(TraCIAPI &parent)
AreaScope(TraCIAPI &parent)
Scope for interaction with POIs.
void send_commandSubscribeObjectContext(int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal range, const std::vector< int > &vars) const
Sends a SubscribeContext request.
Scope for interaction with the simulation.
Scope for interaction with multi entry/-exit detectors.
void send_commandSimulationStep(SUMOTime time) const
Sends a SimulationStep command.
InductionLoopScope(TraCIAPI &parent)
MeMeScope multientryexit
Scope for interaction with multi-entry/-exit detectors.
Scope for interaction with vehicle types.
PolygonScope(TraCIAPI &parent)
void send_commandGetVariable(int domID, int varID, const std::string &objID, tcpip::Storage *add=0) const
Sends a GetVariable request.
TraCIColor getColor(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
RouteScope route
Scope for interaction with routes.
virtual ~InductionLoopScope()
Scope for interaction with polygons.
std::vector< TraCIPhase > phases
int getInt(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
int getByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
int getUnsignedByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Scope for interaction with junctions.
TrafficLightScope(TraCIAPI &parent)
virtual ~SimulationScope()
std::vector< std::string > getStringVector(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
EdgeScope(TraCIAPI &parent)
Scope for interaction with areal detectors.
POIScope poi
Scope for interaction with POIs.
void send_commandSubscribeObjectVariable(int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, const std::vector< int > &vars) const
Sends a SubscribeVariable request.
SimulationScope simulation
Scope for interaction with the simulation.
Scope for interaction with lanes.
TraCIScopeWrapper(TraCIAPI &parent)
Constructor.
RouteScope(TraCIAPI &parent)
SUMOTime getSUMOTime(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
PolygonScope polygon
Scope for interaction with polygons.
virtual ~TraCIScopeWrapper()
Destructor.
void check_resultState(tcpip::Storage &inMsg, int command, bool ignoreCommandId=false, std::string *acknowledgement=0) const
Validates the result state of a command.
VehicleTypeScope(TraCIAPI &parent)
std::map< std::string, SUMOReal > subParameter
TraCIAPI & myParent
The parent TraCI client which offers the connection.
GUIScope gui
Scope for interaction with the gui.
void send_commandSetValue(int domID, int varID, const std::string &objID, tcpip::Storage &content) const
Sends a SetVariable request.
void check_commandGetResult(tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
std::string getString(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
SimulationScope(TraCIAPI &parent)
An abstract interface for accessing type-dependent values.
std::vector< TraCIPosition > TraCIPositionVector
virtual ~VehicleTypeScope()
SUMOReal getFloat(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
JunctionScope(TraCIAPI &parent)
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.