 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
52 const MSEdge*
const edge,
const double pos,
53 const std::string& aXMLFilename,
54 const std::string& outputFilename,
55 const SUMOTime freq,
const double length,
57 const std::string& vTypes) :
58 MSCalibrator(id, edge, (
MSLane*)nullptr, pos, aXMLFilename, outputFilename, freq, length, probe, vTypes, false),
59 mySegment(
MSGlobals::gMesoNet->getSegmentForEdge(*edge, pos)) {
80 throw ProcessError(
"Emission of vehicle '" + vehicle->
getID() +
"' in calibrator '" +
getID() +
"'failed!");
104 while (first !=
nullptr) {
120 while (first !=
nullptr) {
128 bool hadInvalidJam =
false;
130 hadInvalidJam =
true;
153 if (!hadInvalidJam) {
161 const int insertionSlack =
MAX2(0, adaptedNum + relaxedInsertion - totalWishedNum);
167 if (route ==
nullptr) {
170 if (route ==
nullptr) {
179 assert(route != 0 && vtype != 0);
188 vehicle = static_cast<MEVehicle*>(
MSNet::getInstance()->getVehicleControl().buildVehicle(
189 newPars, route, vtype,
false,
false));
204 while (vehicle->
getEdge() != myedge) {
221 while (totalWishedNum < adaptedNum) {
int myRemoved
The number of vehicles that were removed in the current interval.
int myClearedInJam
The number of vehicles that were removed when clearin a jam.
The car-following model and parameter.
A vehicle from the mesoscopic point of view.
int remainingVehicleCapacity(const double vehLength) const
return the remaining physical space on this segment
const std::string & getID() const
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
bool myHaveWarnedAboutClearingJam
The default (maximum) speed on the segment.
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
double getMeanSpeed(bool useCache) const
Returns the average speed of vehicles on the segment in meters per second. If there is no vehicle on ...
#define WRITE_WARNING(msg)
bool tryEmit(MESegment *s, MEVehicle *vehicle)
SUMOTime execute(SUMOTime currentTime)
Representation of a lane in the micro simulation.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named distribution.
A single mesoscopic segment (cell)
int myInserted
The number of vehicles that were inserted in the current interval.
SUMOTime myFrequency
The frequeny with which to check for calibration.
Writes routes of vehicles passing a certain edge.
void addDetector(MSMoveReminder *data)
Adds a data collector for a detector to this segment.
std::string vtypeid
The vehicle's type id.
std::vector< AspiredState >::const_iterator myCurrentStateInterval
Iterator pointing to the current interval.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
bool initialise(MEVehicle *veh, SUMOTime time)
Inserts (emits) vehicle into the segment.
static OptionsCont & getOptions()
Retrieves the options.
int remainingVehicleCapacity() const
returns the number of vehicles (of the current type) that still fit onto the segment
bool mySpeedIsDefault
The information whether the speed adaption has been reset.
Structure representing possible vehicle parameter.
void setEventTime(SUMOTime t, bool hasDelay=true)
Sets the (planned) time at which the vehicle leaves his current cell.
void removeDetector(MSMoveReminder *data)
Removes a data collector for a detector from this segment.
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
double myDefaultSpeed
The default (maximum) speed on the segment.
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MESegment * mySegment
mesoscopic edge segment the calibrator lies on
virtual ~METriggeredCalibrator()
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
void reset()
reset collected vehicle data
void prepareDetectorForWriting(MSMoveReminder &data)
Updates data of a detector for all vehicle queues.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
bool myDidSpeedAdaption
The information whether speed was adapted in the current interval.
std::string id
The vehicle's id.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
std::string time2string(SUMOTime t)
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
A road/street connecting two junctions.
MSMeanData_Net::MSLaneMeanDataValues myEdgeMeanData
accumlated data for the whole edge
const MSRoute * getRoute() const
const MSRouteProbe *const myProbe
the route probe to retrieve routes from
std::string routeid
The vehicle's route id.
bool vaporizeAnyCar(SUMOTime currentTime)
tries to remove any car from this segment
bool invalidJam() const
returns whether the segment is jammed although it should not be
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double getBruttoOccupancy() const
Returns the occupany of the segment (the sum of the vehicle lengths + minGaps)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static MELoop * gMesoNet
mesoscopic simulation infrastructure
int maximumInflow() const
returns the maximum number of vehicles that could enter from upstream until the calibrator is activat...
void setMaxSpeed(double val) const
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
std::string getNewVehicleID()
determine id of new vehicle from calibrator state
bool isCurrentStateActive(SUMOTime time)
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
void setDescription(const std::string &description)
SUMOTime getNextInsertionTime(SUMOTime earliestEntry) const
return a time after earliestEntry at which a vehicle may be inserted at full speed
const std::string & getID() const
Returns the name of the vehicle.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
void setSpeed(double newSpeed, SUMOTime currentTime, double jamThresh=DO_NOT_PATCH_JAM_THRESHOLD)
reset mySpeed and patch the speed of all vehicles in it. Also set/recompute myJamThreshold
Calibrates the flow on a segment to a specified one.
std::vector< AspiredState > myIntervals
List of adaptation intervals.
bool contains(const MSEdge *const edge) const
METriggeredCalibrator(const std::string &id, const MSEdge *const edge, const double pos, const std::string &aXMLFilename, const std::string &outputFilename, const SUMOTime freq, const double length, const MSRouteProbe *probe, const std::string &vTypes)
const MSEdge *const myEdge
the edge on which this calibrator lies
const std::string & getID() const
Returns the id.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.