53 #ifdef CHECK_MEMORY_LEAKS
55 #endif // CHECK_MEMORY_LEAKS
70 const std::string& aXMLFilename,
71 const std::string& outputFilename,
74 const bool addLaneMeanData) :
77 myEdge(edge), myPos(pos), myProbe(probe),
78 myEdgeMeanData(0, length, false),
79 myOutput(0), myFrequency(freq), myRemoved(0),
80 myInserted(0), myClearedInJam(0),
81 mySpeedIsDefault(true), myDidSpeedAdaption(false), myDidInit(false),
82 myDefaultSpeed(myEdge->getSpeedLimit()),
83 myHaveWarnedAboutClearingJam(false),
85 if (outputFilename !=
"") {
89 if (aXMLFilename !=
"") {
95 if (addLaneMeanData) {
155 if (state.
begin < lastEnd) {
156 WRITE_ERROR(
"Overlapping or unsorted intervals in calibrator '" +
myID +
"'.");
174 WRITE_ERROR(
"Mandatory attribute missing in definition of calibrator '" +
myID +
"'.");
176 WRITE_ERROR(
"Non-numeric value for numeric attribute in definition of calibrator '" +
myID +
"'.");
178 if (state.
q < 0 && state.
v < 0) {
179 WRITE_ERROR(
"Either 'vehsPerHour' or 'speed' has to be given in flow definition of calibrator '" +
myID +
"'.");
210 assert(discrepancy >= 0);
211 const std::string ds = (discrepancy > 0 ?
"\" vaporizedOnNextEdge=\"" +
toString(discrepancy) :
"");
215 "\" id=\"" <<
myID <<
216 "\" nVehContrib=\"" << p <<
220 "\" flow=\"" << p * 3600.0 / durationSeconds <<
318 #ifdef MSCalibrator_DEBUG
321 <<
" totalWished=" << totalWishedNum
322 <<
" adapted=" << adaptedNum
332 if (calibrateFlow && adaptedNum < totalWishedNum && !hadRemovals) {
340 const int insertionSlack =
MAX2(0, adaptedNum + relaxedInsertion - totalWishedNum);
342 #ifdef MSCalibrator_DEBUG
344 <<
" wished:" << wishedNum
345 <<
" slack:" << insertionSlack
346 <<
" before:" << adaptedNum
349 while (wishedNum > adaptedNum + insertionSlack) {
363 const unsigned int routeIndex = (
unsigned int)std::distance(route->
begin(),
366 assert(route != 0 && vtype != 0);
370 newPars->
depart = currentTime;
373 newPars, route, vtype));
374 #ifdef MSCalibrator_DEBUG
375 std::cout <<
" resetting route pos: " << routeIndex <<
"\n";
381 throw ProcessError(
"Emission of vehicle '" + vehicle->
getID() +
"' in calibrator '" +
getID() +
"'failed!");
385 #ifdef MSCalibrator_DEBUG
390 #ifdef MSCalibrator_DEBUG
417 for (
int i = 0; i < numLanes; ++i) {
426 if (lane->getVehicleNumber() < 4) {
441 for (
int i = 0; i < numLanes; ++i) {
448 MSVehicle* last = lane->getLastVehicle();
478 for (std::vector<MSMeanData_Net::MSLaneMeanDataValues*>::iterator it =
myLaneMeanData.begin();
494 if (calibrateFlow && adaptedNum > totalWishedNum) {
495 #ifdef MSCalibrator_DEBUG
497 <<
" vaporizing " << vehicle->
getID() <<
" to reduce flow\n";
503 #ifdef MSCalibrator_DEBUG
505 <<
" vaporizing " << vehicle->
getID() <<
" to clear jam\n";