Adds CLI for manually gauging off

This commit is contained in:
Patrick McDonagh
2017-02-10 13:46:29 -06:00
parent 61cc02cc7f
commit 1384c40add
2 changed files with 48 additions and 73 deletions

View File

@@ -37,6 +37,11 @@ class CLScanner implements Runnable {
poc.thisWell.printTotals();
}
private void gaugeOff() {
poc.thisWell.gaugeOff();
poc.thisWell.printTotals();
}
private void help(){
System.out.println("");
System.out.println("== HELP MENU ==");
@@ -77,6 +82,9 @@ class CLScanner implements Runnable {
case "showtapers":
showTapers();
break;
case "gaugeoff":
gaugeOff();
break;
case "help":
help();
break;

View File

@@ -45,8 +45,8 @@ public class Well {
// CONSTANTS
private static double YM_STEEL = 30.5;
private static double YM_FIBERGLASS = 7.2;
public static final int BAD_STATUS = 0;
public static final int GOOD_STATUS = 1;
static final int BAD_STATUS = 0;
static final int GOOD_STATUS = 1;
/* USER INPUTS */
private double dt;
@@ -181,25 +181,7 @@ public class Well {
inclinometer = new AnalogIn(inclinometerChannel, 0, 100, 0, 100);
loadCell = new AnalogIn(loadCellChannel, 0, 50000, 0, 50000);
strokeSpeed = new Measurement("Stroke Speed", true, db, 0.5, 600);
downholeGrossStroke = new Measurement("Downhole Gross Stroke", true, db, 0.5, 600);
downholeNetStroke = new Measurement("Downhole Net Stroke", true, db, 0.5, 600);
fluidLevel = new Measurement("Fluid Level", true, db, 10, 600);
fluidLoad = new Measurement("Fluid Load", true, db, 20, 600);
inflowRate = new Measurement("Inflow Rate", true, db, 0.5, 600);
peakPolishedRodLoad = new Measurement("Peak PRL", true, db, 50, 600);
minPolishedRodLoad = new Measurement("Min PRL", true, db, 50, 600);
percentRun = new Measurement("Percent Run", true, db, 1.0, 600);
polishedRodHP = new Measurement("Polished Rod HP", true, db, 0.25, 600);
pumpHP = new Measurement("Pump HP", true, db, 0.25, 600);
fluidProduced = new Measurement("Fluid Produced", true, db, 1.0, 600);
fluidProducedAdjusted = new Measurement("Fluid Produced (adjusted)", true, db, 1.0, 600);
oilProduced = new Measurement("Oil Produced", true, db, 1.0, 600);
waterProduced = new Measurement("Water Produced", true, db, 1.0, 600);
gasProduced = new Measurement("Gas Produced", true, db, 1.0, 600);
pumpIntakePressure = new Measurement("Pump Intake Pressure", true, db, 5.0, 600);
surfaceStrokeLength = new Measurement("Surface Stroke", true, db, 0.5, 1800);
tubingMovement = new Measurement("Tubing Movement", true, db, 0.5, 600);
initializeMeasurements();
}
Well(String wellName, String simFileName, int inclinometerChannel, int loadCellChannel, int runCommandChannel){
@@ -211,6 +193,10 @@ public class Well {
inclinometer = new AnalogIn(inclinometerChannel, 0, 100, 0, 100);
loadCell = new AnalogIn(loadCellChannel, 0, 50000, 0, 50000);
initializeMeasurements();
}
private void initializeMeasurements(){
strokeSpeed = new Measurement("Stroke Speed", true, db, 0.5, 600);
downholeGrossStroke = new Measurement("Downhole Gross Stroke", true, db, 0.5, 600);
downholeNetStroke = new Measurement("Downhole Net Stroke", true, db, 0.5, 600);
@@ -490,7 +476,7 @@ public class Well {
// WELL CALCULATION FUNCTIONS
public static double lookupRodWeightPerFoot(double i_ym, double i_diam) {
private static double lookupRodWeightPerFoot(double i_ym, double i_diam) {
double wtPerFt;
if (i_ym == YM_STEEL) {
if (i_diam <= 2 && i_diam > 1.75) {
@@ -538,7 +524,7 @@ public class Well {
return wtPerFt;
};
public void parseJSONFile(String jsonFilename){
void parseJSONFile(String jsonFilename){
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader(jsonFilename));
@@ -590,18 +576,14 @@ public class Well {
if (newDampingFactor != null) setDampingFactor(currentTaperNum, (Double) newDampingFactor);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
} catch (IOException | ParseException e) {
e.printStackTrace();
}
updateTapers();
}
public void printTapers(){
void printTapers(){
System.out.println("===== " + wellName + " =====");
System.out.println("--- INPUT PARAMETERS ---");
@@ -673,7 +655,7 @@ public class Well {
};
public void updateTapers(){
private void updateTapers(){
nT1 = numTapers + 1;
// start by setting everything to 0
@@ -919,9 +901,8 @@ public class Well {
rodDepthTotal, tubingAnchorDepth,
tubingCrossSectionalArea, pumpArea,
frictionEstimate, structuralRating, kFactor, fluidWaterRatio, fluidOilRatio, fluidGasRatio);
for (int j = 98; j >= 0; j--) {
cardStorage[j + 1] = cardStorage[j];
}
System.arraycopy(cardStorage, 0, cardStorage, 1, cardStorage.length-1);
cardStorage[0] = currentCard;
currentCard.printCard("none", true);
strokesSinceStart++;
@@ -955,6 +936,30 @@ public class Well {
}
public void gaugeOff(){
strokeSpeed.endOfDay();
downholeGrossStroke.endOfDay();
downholeNetStroke.endOfDay();
fluidLevel.endOfDay();
fluidLoad.endOfDay();
inflowRate.endOfDay();
peakPolishedRodLoad.endOfDay();
minPolishedRodLoad.endOfDay();
percentRun.endOfDay();
polishedRodHP.endOfDay();
pumpHP.endOfDay();
fluidProduced.endOfDay();
fluidProducedAdjusted.endOfDay();
oilProduced.endOfDay();
waterProduced.endOfDay();
gasProduced.endOfDay();
pumpIntakePressure.endOfDay();
surfaceStrokeLength.endOfDay();
tubingMovement.endOfDay();
strokesToday = 0;
}
public void eval(){
checkSafeties();
currentSurfacePosition = inclinometer.readScaled();
@@ -985,30 +990,10 @@ public class Well {
}
if(isNewDay()){
strokeSpeed.endOfDay();
downholeGrossStroke.endOfDay();
downholeNetStroke.endOfDay();
fluidLevel.endOfDay();
fluidLoad.endOfDay();
inflowRate.endOfDay();
peakPolishedRodLoad.endOfDay();
minPolishedRodLoad.endOfDay();
percentRun.endOfDay();
polishedRodHP.endOfDay();
pumpHP.endOfDay();
fluidProduced.endOfDay();
fluidProducedAdjusted.endOfDay();
oilProduced.endOfDay();
waterProduced.endOfDay();
gasProduced.endOfDay();
pumpIntakePressure.endOfDay();
surfaceStrokeLength.endOfDay();
tubingMovement.endOfDay();
gaugeOff();
}
}
public void eval(int simPoint){
checkSafeties();
currentSurfacePosition = inclinometer.readScaledSim(sim.getPositionAtIndex(simPoint));
@@ -1040,25 +1025,7 @@ public class Well {
}
if(isNewDay()){
strokeSpeed.endOfDay();
downholeGrossStroke.endOfDay();
downholeNetStroke.endOfDay();
fluidLevel.endOfDay();
fluidLoad.endOfDay();
inflowRate.endOfDay();
peakPolishedRodLoad.endOfDay();
minPolishedRodLoad.endOfDay();
percentRun.endOfDay();
polishedRodHP.endOfDay();
pumpHP.endOfDay();
fluidProduced.endOfDay();
fluidProducedAdjusted.endOfDay();
oilProduced.endOfDay();
waterProduced.endOfDay();
gasProduced.endOfDay();
pumpIntakePressure.endOfDay();
surfaceStrokeLength.endOfDay();
tubingMovement.endOfDay();
gaugeOff();
}
}
public void printTotals(){