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;
309 std::vector<std::string> getIDList()
const;
311 std::string getLaneID(
const std::string& loopID)
const;
312 unsigned int getLastStepVehicleNumber(
const std::string& loopID)
const;
313 SUMOReal getLastStepMeanSpeed(
const std::string& loopID)
const;
314 std::vector<std::string> getLastStepVehicleIDs(
const std::string& loopID)
const;
315 SUMOReal getLastStepOccupancy(
const std::string& loopID)
const;
316 SUMOReal getLastStepMeanLength(
const std::string& loopID)
const;
317 SUMOReal getTimeSinceDetection(
const std::string& loopID)
const;
318 std::vector<VehicleData> getVehicleData(
const std::string& loopID)
const;
342 std::vector<std::string> getIDList()
const;
366 std::vector<std::string> getIDList()
const;
367 SUMOReal getLength(
const std::string& laneID)
const;
368 SUMOReal getMaxSpeed(
const std::string& laneID)
const;
369 SUMOReal getWidth(
const std::string& laneID)
const;
370 std::vector<std::string> getAllowed(
const std::string& laneID)
const;
371 std::vector<std::string> getDisallowed(
const std::string& laneID)
const;
372 unsigned int getLinkNumber(
const std::string& laneID)
const;
373 TraCIPositionVector getShape(
const std::string& laneID)
const;
374 std::string getEdgeID(
const std::string& laneID)
const;
375 SUMOReal getCO2Emission(
const std::string& laneID)
const;
376 SUMOReal getCOEmission(
const std::string& laneID)
const;
377 SUMOReal getHCEmission(
const std::string& laneID)
const;
378 SUMOReal getPMxEmission(
const std::string& laneID)
const;
379 SUMOReal getNOxEmission(
const std::string& laneID)
const;
380 SUMOReal getFuelConsumption(
const std::string& laneID)
const;
381 SUMOReal getNoiseEmission(
const std::string& laneID)
const;
382 SUMOReal getLastStepMeanSpeed(
const std::string& laneID)
const;
383 SUMOReal getLastStepOccupancy(
const std::string& laneID)
const;
384 SUMOReal getLastStepLength(
const std::string& laneID)
const;
385 SUMOReal getTraveltime(
const std::string& laneID)
const;
386 unsigned int getLastStepVehicleNumber(
const std::string& laneID)
const;
387 unsigned int getLastStepHaltingNumber(
const std::string& laneID)
const;
388 std::vector<std::string> getLastStepVehicleIDs(
const std::string& laneID)
const;
390 void setAllowed(
const std::string& laneID,
const std::vector<std::string>& allowedClasses)
const;
391 void setDisallowed(
const std::string& laneID,
const std::vector<std::string>& disallowedClasses)
const;
392 void setMaxSpeed(
const std::string& laneID,
SUMOReal speed)
const;
393 void setLength(
const std::string& laneID,
SUMOReal length)
const;
413 std::vector<std::string> getIDList()
const;
414 int getJamLengthVehicle(
const std::string& laneID)
const;
415 SUMOReal getJamLengthMeters(
const std::string& laneID)
const;
435 std::vector<std::string> getIDList()
const;
436 unsigned int getLastStepVehicleNumber(
const std::string& detID)
const;
437 SUMOReal getLastStepMeanSpeed(
const std::string& detID)
const;
438 std::vector<std::string> getLastStepVehicleIDs(
const std::string& detID)
const;
439 unsigned int getLastStepHaltingNumber(
const std::string& detID)
const;
462 std::vector<std::string> getIDList()
const;
463 std::string getType(
const std::string& poiID)
const;
467 void setType(
const std::string& poiID,
const std::string& setType)
const;
469 void setColor(
const std::string& poiID,
const TraCIColor& c)
const;
471 void remove(
const std::string& poiID,
int layer = 0)
const;
494 std::vector<std::string> getIDList()
const;
495 std::string getType(
const std::string& polygonID)
const;
496 TraCIPositionVector getShape(
const std::string& polygonID)
const;
498 void setType(
const std::string& polygonID,
const std::string& setType)
const;
499 void setShape(
const std::string& polygonID,
const TraCIPositionVector& shape)
const;
500 void setColor(
const std::string& polygonID,
const TraCIColor& c)
const;
501 void add(
const std::string& polygonID,
const TraCIPositionVector& shape,
const TraCIColor& c,
bool fill,
const std::string& type,
int layer)
const;
502 void remove(
const std::string& polygonID,
int layer = 0)
const;
525 std::vector<std::string> getIDList()
const;
526 std::vector<std::string> getEdges(
const std::string& routeID)
const;
528 void add(
const std::string& routeID,
const std::vector<std::string>& edges)
const;
552 unsigned int getLoadedNumber()
const;
553 std::vector<std::string> getLoadedIDList()
const;
554 unsigned int getDepartedNumber()
const;
555 std::vector<std::string> getDepartedIDList()
const;
556 unsigned int getArrivedNumber()
const;
557 std::vector<std::string> getArrivedIDList()
const;
558 unsigned int getStartingTeleportNumber()
const;
559 std::vector<std::string> getStartingTeleportIDList()
const;
560 unsigned int getEndingTeleportNumber()
const;
561 std::vector<std::string> getEndingTeleportIDList()
const;
564 unsigned int getMinExpectedNumber()
const;
587 std::vector<std::string> getIDList()
const;
588 std::string getRedYellowGreenState(
const std::string& tlsID)
const;
589 std::vector<TraCIAPI::TraCILogic> getCompleteRedYellowGreenDefinition(
const std::string& tlsID)
const;
590 std::vector<std::string> getControlledLanes(
const std::string& tlsID)
const;
591 std::vector<TraCIAPI::TraCILink> getControlledLinks(
const std::string& tlsID)
const;
592 std::string getProgram(
const std::string& tlsID)
const;
593 unsigned int getPhase(
const std::string& tlsID)
const;
594 unsigned int getNextSwitch(
const std::string& tlsID)
const;
596 void setRedYellowGreenState(
const std::string& tlsID,
const std::string& state)
const;
597 void setPhase(
const std::string& tlsID,
unsigned int index)
const;
598 void setProgram(
const std::string& tlsID,
const std::string& programID)
const;
599 void setPhaseDuration(
const std::string& tlsID,
unsigned int phaseDuration)
const;
600 void setCompleteRedYellowGreenDefinition(
const std::string& tlsID,
const TraCIAPI::TraCILogic& logic)
const;
623 std::vector<std::string> getIDList()
const;
624 SUMOReal getLength(
const std::string& typeID)
const;
625 SUMOReal getMaxSpeed(
const std::string& typeID)
const;
626 SUMOReal getSpeedFactor(
const std::string& typeID)
const;
627 SUMOReal getSpeedDeviation(
const std::string& typeID)
const;
628 SUMOReal getAccel(
const std::string& typeID)
const;
629 SUMOReal getDecel(
const std::string& typeID)
const;
630 SUMOReal getImperfection(
const std::string& typeID)
const;
631 SUMOReal getTau(
const std::string& typeID)
const;
632 std::string getVehicleClass(
const std::string& typeID)
const;
633 std::string getEmissionClass(
const std::string& typeID)
const;
634 std::string getShapeClass(
const std::string& typeID)
const;
635 SUMOReal getMinGap(
const std::string& typeID)
const;
636 SUMOReal getWidth(
const std::string& typeID)
const;
639 void setLength(
const std::string& typeID,
SUMOReal length)
const;
640 void setMaxSpeed(
const std::string& typeID,
SUMOReal speed)
const;
641 void setVehicleClass(
const std::string& typeID,
const std::string& clazz)
const;
642 void setSpeedFactor(
const std::string& typeID,
SUMOReal factor)
const;
643 void setSpeedDeviation(
const std::string& typeID,
SUMOReal deviation)
const;
644 void setEmissionClass(
const std::string& typeID,
const std::string& clazz)
const;
645 void setWidth(
const std::string& typeID,
SUMOReal width)
const;
646 void setMinGap(
const std::string& typeID,
SUMOReal minGap)
const;
647 void setShapeClass(
const std::string& typeID,
const std::string& clazz)
const;
648 void setAccel(
const std::string& typeID,
SUMOReal accel)
const;
649 void setDecel(
const std::string& typeID,
SUMOReal decel)
const;
650 void setImperfection(
const std::string& typeID,
SUMOReal imperfection)
const;
651 void setTau(
const std::string& typeID,
SUMOReal tau)
const;
652 void setColor(
const std::string& typeID,
const TraCIColor& c)
const;
675 std::vector<std::string> getIDList()
const;
676 unsigned int getIDCount()
const;
677 SUMOReal getSpeed(
const std::string& typeID)
const;
679 SUMOReal getAngle(
const std::string& typeID)
const;
680 std::string getRoadID(
const std::string& typeID)
const;
681 std::string getLaneID(
const std::string& typeID)
const;
682 unsigned int getLaneIndex(
const std::string& typeID)
const;
683 std::string getTypeID(
const std::string& typeID)
const;
684 std::string getRouteID(
const std::string& typeID)
const;
685 unsigned int getRouteIndex(
const std::string& typeID)
const;
686 std::vector<std::string> getEdges(
const std::string& typeID)
const;
688 SUMOReal getLanePosition(
const std::string& typeID)
const;
689 unsigned int getSignalStates(
const std::string& typeID)
const;
690 SUMOReal getCO2Emissions(
const std::string& typeID)
const;
691 SUMOReal getCOEmissions(
const std::string& typeID)
const;
692 SUMOReal getHCEmissions(
const std::string& typeID)
const;
693 SUMOReal getPMxEmissions(
const std::string& typeID)
const;
694 SUMOReal getNOxEmissions(
const std::string& typeID)
const;
695 SUMOReal getFuelConsumption(
const std::string& typeID)
const;
696 SUMOReal getNoiseEmission(
const std::string& typeID)
const;
697 unsigned int getBestLanes(
const std::string& typeID)
const;
698 unsigned int getStopState(
const std::string& typeID)
const;
699 SUMOReal getLength(
const std::string& typeID)
const;
700 SUMOReal getMaxSpeed(
const std::string& typeID)
const;
701 SUMOReal getAccel(
const std::string& typeID)
const;
702 SUMOReal getDecel(
const std::string& typeID)
const;
703 SUMOReal getTau(
const std::string& typeID)
const;
704 SUMOReal getImperfection(
const std::string& typeID)
const;
705 SUMOReal getSpeedFactor(
const std::string& typeID)
const;
706 SUMOReal getSpeedDeviation(
const std::string& typeID)
const;
707 std::string getVClass(
const std::string& typeID)
const;
708 std::string getEmissionClass(
const std::string& typeID)
const;
709 std::string getShapeClass(
const std::string& typeID)
const;
710 SUMOReal getMinGap(
const std::string& typeID)
const;
711 SUMOReal getWidth(
const std::string& typeID)
const;
712 SUMOReal getWaitingTime(
const std::string& typeID)
const;
714 void moveTo(
const std::string& typeID,
const std::string& laneID,
SUMOReal position)
const;
715 void slowDown(
const std::string& typeID,
SUMOReal speed,
int duration)
const;
716 void setSpeed(
const std::string& typeID,
SUMOReal speed)
const;
808 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)
SUMOReal entryTime
Entry-time of the vehicle in [s].
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)
std::string typeID
Type of the vehicle in.
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 vehicles.
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.
SUMOReal leaveTime
Leave-time of the vehicle in [s].
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)
SUMOReal length
Length of the vehicle.
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)
VehicleScope vehicle
Scope for interaction with vehicles.
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)
VehicleScope(TraCIAPI &parent)
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)
std::string id
The id of the vehicle.
JunctionScope(TraCIAPI &parent)
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.