GetDurationFromCost():

Minor: changed some debug output.
This commit is contained in:
Gerhard Hoffmann 2024-08-12 09:22:55 +02:00
parent eafbfd60c3
commit 6d6615b81e

View File

@ -339,8 +339,6 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
#if DEBUG_GET_DURATION_FROM_COST==1
qCritical() << DBG_HEADER << "(ADAPTED) INPUT-DATE" << inputDate.toString(Qt::ISODate);
#endif
//qCritical() << __func__ << __LINE__;
// inputDate is now located in a valid operational-working-range
// find this working-time-range
int pwd_period_day_in_week_id = inputDate.date().dayOfWeek();
@ -354,8 +352,6 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
return "";
}
//qCritical() << __func__ << __LINE__;
QTime current_working_time_from;
QTime current_working_time_to;
@ -1013,12 +1009,14 @@ uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
int paymentOptionIndex) const {
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
//qCritical() << __func__ << __LINE__ << "paymentOptionIndex" << paymentOptionIndex;
// qCritical() << __func__ << __LINE__ << "paymentOptionIndex" << paymentOptionIndex;
if (paymentMethodId == PaymentMethod::Steps ||
paymentMethodId == PaymentMethod::Degressive) {
int const timeStepInMinutes = start.secsTo(end) / 60;
QList<int> tlist = Calculator::GetInstance().GetTimeSteps(cfg, paymentOptionIndex, start);
qCritical() << DBG_HEADER << " start" << start.toString(Qt::ISODate);
qCritical() << DBG_HEADER << " end" << end.toString(Qt::ISODate);
qCritical() << DBG_HEADER << "timeStepList" << timeStepInMinutes << tlist;
qCritical() << DBG_HEADER << "timeStepInMinutes" << timeStepInMinutes << start.toString(Qt::ISODate);
@ -2527,10 +2525,10 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
}
}
} else { // if (carryOverTimeRangeFrom == QTime(0, 0, 0)) {
//if (DBG_LEVEL >= DBG_DEBUG) {
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") carry over time range from:" << carryOverTimeRangeFrom.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") carry over time range to:" << carryOverTimeRangeTo.toString(Qt::ISODate);
//}
}
m_timeSteps[paymentOptionIndex].clear();
@ -2554,7 +2552,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
qCritical() << "(" << __func__ << ":" << __LINE__ << ") interpolation end:" << interpolationEnd.toString(Qt::ISODate);
}
} else {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
}
// int const start_time = start.time().hour() * 60 + start.time().minute();
@ -2582,7 +2580,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
int const durationId = itr->second.pra_payment_unit_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationId" << durationId;
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationId" << durationId;
// int const price = itr->second.pra_price;
auto search = cfg->Duration.find(durationId);
@ -2606,7 +2604,8 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
ATBInterpolation interpolation = ipolCheck.value();
if (duration.pun_interpolation_id == (int)ATBInterpolation::DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_PRICE) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") HIER NICHT";
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") payment option id:" << pop_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_intnerpolation_id:" << duration.pun_interpolation_id;
interpolation.dynamic_start = start.time();
interpolation.dynamic_start.setHMS(start.time().hour(), start.time().minute(), 0);
@ -2661,6 +2660,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
if (duration.pun_interpolation_id == (int)ATBInterpolation::NO_INTERPOLATION) {
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex:" << paymentOptionIndex;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun duration:" << duration.pun_duration;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") next time step:" << nextTimeStep.toString(Qt::ISODate);
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (2):" << runtimeInMinutes;
@ -2673,6 +2673,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
search->second = duration;
cfg->getPaymentOptions(paymentOptionIndex).pop_min_time = runtimeInMinutes;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_min_time" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
continue;
}
}
@ -2749,7 +2750,6 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
search->second = duration;
} else {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") HIER NICHT";
cfg->Duration.erase(search);
}
}
@ -2783,7 +2783,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
}
}
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
@ -2816,9 +2816,13 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
uint32_t price = 0;
int pun_duration = 0;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex" << paymentOptionIndex;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex" << paymentOptionIndex;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_accumulate_prices" << pop_accumulate_prices;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_accumulate_durations" << pop_accumulate_durations;
}
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr)
{
@ -2843,6 +2847,7 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
}
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ")";
qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;