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).
This commit is contained in:
parent
dd249a87d5
commit
9b137c2873
@ -3584,7 +3584,9 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
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;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user