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