50 #ifdef CHECK_MEMORY_LEAKS
52 #endif // CHECK_MEMORY_LEAKS
67 const std::string& aXMLFilename,
68 const std::string& outputFilename,
72 myEdge(edge), myPos(pos),
73 myEdgeMeanData(0, myEdge->getLength(), false),
74 myOutput(0), myFrequency(freq), myRemoved(0),
75 myInserted(0), myClearedInJam(0),
76 mySpeedIsDefault(true), myDidSpeedAdaption(false), myDidInit(false),
77 myDefaultSpeed(myEdge->getSpeedLimit()),
78 myHaveWarnedAboutClearingJam(false),
80 if (outputFilename !=
"") {
84 if (aXMLFilename !=
"") {
148 if (state.
begin < lastEnd) {
149 WRITE_ERROR(
"Overlapping or unsorted intervals in calibrator '" +
myID +
"'.");
166 WRITE_ERROR(
"Mandatory attribute missing in definition of calibrator '" +
myID +
"'.");
168 WRITE_ERROR(
"Non-numeric value for numeric attribute in definition of calibrator '" +
myID +
"'.");
170 if (state.
q < 0 && state.
v < 0) {
171 WRITE_ERROR(
"Either 'vehsPerHour' or 'speed' has to be given in flow definition of calibrator '" +
myID +
"'.");
202 assert(discrepancy >= 0);
203 const std::string ds = (discrepancy > 0 ?
"\" vaporizedOnNextEdge=\"" +
toString(discrepancy) :
"");
207 "\" id=\"" <<
myID <<
208 "\" nVehContrib=\"" << p <<
212 "\" flow=\"" << p * 3600.0 / durationSeconds <<
286 #ifdef MSCalibrator_DEBUG
289 <<
" totalWished=" << totalWishedNum
290 <<
" adapted=" << adaptedNum
310 }
else if (calibrateFlow && adaptedNum < totalWishedNum) {
318 const int insertionSlack =
MAX2(0, adaptedNum + relaxedInsertion - totalWishedNum);
320 #ifdef MSCalibrator_DEBUG
322 <<
" wished:" << wishedNum
323 <<
" slack:" << insertionSlack
324 <<
" before:" << adaptedNum
327 while (wishedNum > adaptedNum + insertionSlack) {
331 while (route == 0 && st.
hasNext()) {
342 const unsigned int routeIndex = (
unsigned int)std::distance(route->
begin(),
345 assert(route != 0 && vtype != 0);
349 newPars->
depart = currentTime;
352 newPars, route, vtype));
353 #ifdef MSCalibrator_DEBUG
354 std::cout <<
" resetting route pos: " << routeIndex <<
"\n";
360 throw ProcessError(
"Emission of vehicle '" + vehicle->
getID() +
"' in calibrator '" +
getID() +
"'failed!");
364 #ifdef MSCalibrator_DEBUG
369 #ifdef MSCalibrator_DEBUG
396 for (
int i = 0; i < numLanes; ++i) {
405 if (lane->getVehicleNumber() < 4) {
420 for (
int i = 0; i < numLanes; ++i) {
427 MSVehicle* last = lane->getLastVehicle();
457 for (std::vector<MSMeanData_Net::MSLaneMeanDataValues*>::iterator it =
myLaneMeanData.begin();
472 if (calibrateFlow && adaptedNum > totalWishedNum) {
473 #ifdef MSCalibrator_DEBUG
475 <<
" vaporizing " << vehicle->
getID() <<
" to reduce flow\n";
481 #ifdef MSCalibrator_DEBUG
483 <<
" vaporizing " << vehicle->
getID() <<
" to clear jam\n";