arbrandt / OPGEE

Oil Production Greenhouse Gas Emissions Estimator
18 stars 3 forks source link

Some compressor sheets break when work of compression negative #237

Closed qlangfitt closed 3 years ago

qlangfitt commented 4 years ago

On the Gas Flooding Compressor sheet there is a failsafe for prime move fuel use that checks whether the brake horsepower is >0 before attempting an HLOOKUP for the fuel consumption of the prime mover. I was running a field with sour gas reinjection, but the conditions were such that a negative adiabatic work of compression was being calculated (compression ratio <1). This was causing the model to break when it tried to use HLOOKUP to find the prime mover fuel use (M74:M75). Please adjust to check for non-negativity before attempting to lookup. I'm not sure how this is dealt with for other compressors, but perhaps this need to be implemented on more compressor sheets as well.

qlangfitt commented 4 years ago

Something similar can happen when using -1 fraction of natural gas reinjection where the natural gas reinjection compressor breaks the VBA if there is an inflow, but no outflow prior to the point where the VBA code starts adjusting the natural gas reinjection fraction. It seems this can be solved by adding an IFERROR to the output horsepower from compressor (M54):

=IFERROR(IF(M40="NA",0,M53*INDEX(FlowTable,TOTMMSCF,46)),0)

arbrandt commented 3 years ago

Fixed