avoid oscilation between ORAT and LRAT when they are equal

This commit is contained in:
Tor Harald Sandve
2022-09-28 15:18:23 +02:00
parent eb0a516ff0
commit d21921073b
2 changed files with 21 additions and 2 deletions

View File

@@ -118,7 +118,16 @@ activeProductionConstraint(const SingleWellState& ws,
if (controls.hasControl(Well::ProducerCMode::LRAT) && currentControl != Well::ProducerCMode::LRAT) {
double current_rate = -ws.surface_rates[pu.phase_pos[BlackoilPhases::Liquid]];
current_rate -= ws.surface_rates[pu.phase_pos[BlackoilPhases::Aqua]];
if (controls.liquid_rate < current_rate)
bool skip = false;
if (controls.liquid_rate == controls.oil_rate) {
const double current_water_rate = ws.surface_rates[pu.phase_pos[BlackoilPhases::Aqua]];
if (std::abs(current_water_rate) < 1e-12) {
skip = true;
deferred_logger.debug("LRAT_ORAT_WELL", "Well " + this->name() + " The LRAT target is equal the ORAT target and the water rate is zero, skip checking LRAT");
}
}
if (!skip && controls.liquid_rate < current_rate)
return Well::ProducerCMode::LRAT;
}