summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
40b4277)
E.g. when a data message comes faster than its corresponding ctrl
message.
Check that it is not negative when computing balance.
else
excess_load = real_load;
else
excess_load = real_load;
- double balance = nb.get_debt() - nb.get_credit();
+ double balance;
+ if (nb.get_credit() > 0.0)
+ balance = nb.get_debt() - nb.get_credit();
+ else
+ balance = nb.get_debt();
load_to_send = std::min(excess_load,
std::max(0.0, balance));
load_to_send = std::min(excess_load,
std::max(0.0, balance));