Compare commits

..

4 Commits

Author SHA1 Message Date
9b137c2873 Fix in Calculator::GetPriceForTimeStep():
Allow some tolerance (of 3 minutes) when looking up the
	current time-step value in the duration-array.
	Otherwise, when corossing a minute-boundary, it can happen to
	not find the match and returning a price of 0 (which is almost
	always wrong).
2025-04-03 11:53:47 +02:00
dd249a87d5 Set cnt-limit to 20. This allows a bigger time-range for tariff, which
have in principle no time-limit.
2025-04-02 15:28:46 +02:00
575885c19e Merge branch 'master' into kleipeda-experimental 2025-04-02 09:44:20 +02:00
ae985d25ce Merge branch 'kleipeda-experimental' 2025-02-04 14:58:58 +01:00

View File

@@ -458,7 +458,7 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
arg(cost).arg(nettoParktimeForCost);
int cnt = 0;
while (++cnt < 10 && netto_parking_time_in_minutes < nettoParktimeForCost) {
while (++cnt < 20 && netto_parking_time_in_minutes < nettoParktimeForCost) {
// qCritical() << __func__ << ":" << __LINE__ << "cnt [" << cnt;
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
@@ -3584,7 +3584,9 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
}
if (timeStep == pun_duration) {
// allow some tolerance when searching for [timeStep == pun_duration]:
// this might happen when crossing minute boundaries
if (std::abs(timeStep - pun_duration) < 4) {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
return price;
}