Calculator::GetDurationFromCost():

Minor: debug output.
This commit is contained in:
Gerhard Hoffmann 2024-08-19 12:18:05 +02:00
parent ceb78772dd
commit 84e2530767

View File

@ -178,6 +178,9 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
int const pra_price = itr->second.pra_price;
// qCritical() << DBG_HEADER << "pra_price" << pra_price;
int const durationId = itr->second.pra_payment_unit_id;
if (pop_accumulate_prices) {
price += pra_price;
@ -2854,7 +2857,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
++it) {
it->second.pun_duration = it->second.pun_duration_saved;
// if (++cnt > 4) continue;
// if (++cnt > 2) continue;
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << it->second.pun_id;
@ -2864,11 +2867,15 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
if (it->second.pun_netto) {
if (it->second.pun_round_to_next_24h_boundary == false) {
//int weekDay = start.date().dayOfWeek();
casePrepay = false;
if (m_timeSteps[paymentOptionIndex].isEmpty()) {
// handle possible prepay-condition, which applies only
// for the very first step
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") prepay start" << prepayStart.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") prepay end" << prepayEnd.toString(Qt::ISODate);
}
if (prepayStart <= start && start <= prepayEnd) {
it->second.pun_duration = prepayDurationInMinutes;
it->second.pun_duration += it->second.pun_duration_saved ;
@ -2884,15 +2891,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
if (!casePrepay) {
// handle possible carryover-condition
int durationInSecs = it->second.pun_duration_saved * 60;
if (DBG_LEVEL >= DBG_DEBUG) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << durationInSecs;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") start" << start.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") current" << current.toString(Qt::ISODate);
qCritical() << "(" << __func__ << ":" << __LINE__ << ") current next" << current.addSecs(durationInSecs).toString(Qt::ISODate);
}
int const durationInSecs = it->second.pun_duration_saved * 60;
it->second.pun_duration = it->second.pun_duration_saved;
if (current >= carryOverStart) {
it->second.pun_duration += current.secsTo(carryOverEnd) / 60;
@ -2994,6 +2993,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
} else { // if (it->second.pun_netto) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
qCritical() << "(" << __func__ << ":" << __LINE__ << ")\n" << it->second;
}
} else { // mutable == false
if (it->second.pun_brutto) { // no handling for prepay and carry-over
@ -3010,6 +3010,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
} else {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
qCritical() << "(" << __func__ << ":" << __LINE__ << ")\n" << it->second;
}
}
}
@ -3064,7 +3065,7 @@ 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__ << ") paymentOptionIndex" << paymentOptionIndex;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;