Fix bug in runOptimize1_

This commit is contained in:
Tor Harald Sandve 2021-11-03 15:52:21 +01:00
parent 869de90b56
commit 23225d24e5

View File

@ -843,15 +843,15 @@ GasLiftSingleWellGeneric::
runOptimize1_() runOptimize1_()
{ {
std::unique_ptr<GasLiftWellState> state; std::unique_ptr<GasLiftWellState> state;
auto inc_count = this->well_state_.gliftGetAlqIncreaseCount(this->well_name_); int inc_count = this->well_state_.gliftGetAlqIncreaseCount(this->well_name_);
auto dec_count = this->well_state_.gliftGetAlqDecreaseCount(this->well_name_); int dec_count = this->well_state_.gliftGetAlqDecreaseCount(this->well_name_);
if (dec_count == 0 && inc_count == 0) { if (dec_count == 0 && inc_count == 0) {
state = tryIncreaseLiftGas_(); state = tryIncreaseLiftGas_();
if (!state && !state->alqChanged()) { if (!state || !(state->alqChanged())) {
state = tryDecreaseLiftGas_(); state = tryDecreaseLiftGas_();
} }
} }
else if (dec_count == 0) { else if (dec_count == 0) {
assert(inc_count > 0); assert(inc_count > 0);
state = tryIncreaseLiftGas_(); state = tryIncreaseLiftGas_();
} }