52 #ifdef CHECK_MEMORY_LEAKS
54 #endif // CHECK_MEMORY_LEAKS
69 const std::string& aXMLFilename,
70 const std::string& outputFilename,
73 const bool addLaneMeanData) :
76 myEdge(edge), myPos(pos), myProbe(probe),
77 myEdgeMeanData(0, length, false),
78 myOutput(0), myFrequency(freq), myRemoved(0),
79 myInserted(0), myClearedInJam(0),
80 mySpeedIsDefault(true), myDidSpeedAdaption(false), myDidInit(false),
81 myDefaultSpeed(myEdge->getSpeedLimit()),
82 myHaveWarnedAboutClearingJam(false),
84 if (outputFilename !=
"") {
88 if (aXMLFilename !=
"") {
94 if (addLaneMeanData) {
154 if (state.
begin < lastEnd) {
155 WRITE_ERROR(
"Overlapping or unsorted intervals in calibrator '" +
myID +
"'.");
173 WRITE_ERROR(
"Mandatory attribute missing in definition of calibrator '" +
myID +
"'.");
175 WRITE_ERROR(
"Non-numeric value for numeric attribute in definition of calibrator '" +
myID +
"'.");
177 if (state.
q < 0 && state.
v < 0) {
178 WRITE_ERROR(
"Either 'vehsPerHour' or 'speed' has to be given in flow definition of calibrator '" +
myID +
"'.");
209 assert(discrepancy >= 0);
210 const std::string ds = (discrepancy > 0 ?
"\" vaporizedOnNextEdge=\"" +
toString(discrepancy) :
"");
214 "\" id=\"" <<
myID <<
215 "\" nVehContrib=\"" << p <<
219 "\" flow=\"" << p * 3600.0 / durationSeconds <<
317 #ifdef MSCalibrator_DEBUG
320 <<
" totalWished=" << totalWishedNum
321 <<
" adapted=" << adaptedNum
331 if (calibrateFlow && adaptedNum < totalWishedNum && !hadRemovals) {
339 const int insertionSlack =
MAX2(0, adaptedNum + relaxedInsertion - totalWishedNum);
341 #ifdef MSCalibrator_DEBUG
343 <<
" wished:" << wishedNum
344 <<
" slack:" << insertionSlack
345 <<
" before:" << adaptedNum
348 while (wishedNum > adaptedNum + insertionSlack) {
362 const unsigned int routeIndex = (
unsigned int)std::distance(route->
begin(),
365 assert(route != 0 && vtype != 0);
369 newPars->
depart = currentTime;
372 newPars, route, vtype));
373 #ifdef MSCalibrator_DEBUG
374 std::cout <<
" resetting route pos: " << routeIndex <<
"\n";
380 throw ProcessError(
"Emission of vehicle '" + vehicle->
getID() +
"' in calibrator '" +
getID() +
"'failed!");
384 #ifdef MSCalibrator_DEBUG
389 #ifdef MSCalibrator_DEBUG
416 for (
int i = 0; i < numLanes; ++i) {
425 if (lane->getVehicleNumber() < 4) {
440 for (
int i = 0; i < numLanes; ++i) {
447 MSVehicle* last = lane->getLastVehicle();
477 for (std::vector<MSMeanData_Net::MSLaneMeanDataValues*>::iterator it =
myLaneMeanData.begin();
493 if (calibrateFlow && adaptedNum > totalWishedNum) {
494 #ifdef MSCalibrator_DEBUG
496 <<
" vaporizing " << vehicle->
getID() <<
" to reduce flow\n";
502 #ifdef MSCalibrator_DEBUG
504 <<
" vaporizing " << vehicle->
getID() <<
" to clear jam\n";