Fluid Shots can be entered and stored in the database
This commit is contained in:
@@ -54,6 +54,12 @@ class CLScanner implements Runnable {
|
||||
System.out.println("showtotals -- Gets the current totals and averages");
|
||||
System.out.println("exit -- Quits the program");
|
||||
System.out.println("");
|
||||
System.out.println("TO ADD A NEW WELL TEST:");
|
||||
System.out.println("welltest <timestamp> <test hours> <total fluid BBL> <oil BBL> <water BBL> <gas MCF>");
|
||||
System.out.println("");
|
||||
System.out.println("TO ADD A NEW FLUID SHOT:");
|
||||
System.out.println("fluidshot <fluidlevel>");
|
||||
System.out.println("");
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +105,13 @@ class CLScanner implements Runnable {
|
||||
);
|
||||
poc.thisWell.db.newWellTest(poc.thisWell.wellTest);
|
||||
poc.thisWell.wellTest.print();
|
||||
} else if(input.startsWith("fluidshot")){
|
||||
String[] shotParams = input.split(" ");
|
||||
FluidShot fs = new FluidShot(Double.parseDouble(shotParams[1]), poc.thisWell.getFluidGradient(),
|
||||
poc.thisWell.cardStorage[0].getDownholeLoadSpan(), poc.thisWell.getRodDepthTotal(),
|
||||
poc.thisWell.getPumpArea());
|
||||
poc.thisWell.db.newFluidShot(fs);
|
||||
poc.thisWell.setFrictionEstimate(fs.getFrictionEstimate());
|
||||
} else {
|
||||
help();
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class Database {
|
||||
|
||||
public long newDailyTotal(Measurement inpMeasurement){
|
||||
String df = ZonedDateTime.now().toString();
|
||||
MongoCollection<Document> collection = database.getCollection("gaugeOffData");
|
||||
MongoCollection<Document> collection = database.getCollection("gaugeOff");
|
||||
Document doc = new Document("tagname", inpMeasurement.getTagName())
|
||||
.append("currentValue", inpMeasurement.getCurrentValue())
|
||||
.append("maxDailyValue", inpMeasurement.getDailyMax())
|
||||
@@ -125,7 +125,7 @@ public class Database {
|
||||
|
||||
public double getPreviousDailyTotal(ZonedDateTime inpDateTime){
|
||||
String isoInpDateTime = inpDateTime.toString();
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("gaugeOffData");
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("gaugeOff");
|
||||
MongoCursor<Document> cursor = wellTestCollection.find(and(eq("tagname", "Fluid Produced"), lte("timestamp", isoInpDateTime)))
|
||||
.sort(Sorts.descending("timestamp")).limit(1).iterator();
|
||||
double lastTotal = -1.0;
|
||||
@@ -141,7 +141,7 @@ public class Database {
|
||||
|
||||
public long newWellTest(WellTest inp){
|
||||
String df = ZonedDateTime.now().toString();
|
||||
MongoCollection<Document> collection = database.getCollection("wellTestData");
|
||||
MongoCollection<Document> collection = database.getCollection("wellTests");
|
||||
Document doc = new Document("testStartTime", df)
|
||||
.append("testHours", inp.getTestHours())
|
||||
.append("testTotalBBL", inp.getTotalFluidBBL())
|
||||
@@ -158,7 +158,7 @@ public class Database {
|
||||
|
||||
public Document getPreviousWellTest(ZonedDateTime inpDateTime){
|
||||
String isoInpDateTime = inpDateTime.toString();
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("wellTestData");
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("wellTests");
|
||||
MongoCursor<Document> cursor = wellTestCollection.find(lte("testStartTime", isoInpDateTime))
|
||||
.sort(Sorts.descending("testStartTime")).limit(1).iterator();
|
||||
Document lastTest = new Document("kFactor", (Double) 1.0);
|
||||
@@ -173,7 +173,7 @@ public class Database {
|
||||
};
|
||||
|
||||
public double getLatestKFactor(){
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("wellTestData");
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("wellTests");
|
||||
MongoCursor<Document> cursor = wellTestCollection.find().sort(Sorts.descending("testStartTime")).limit(1).iterator();
|
||||
double kFactor = 1.0;
|
||||
try {
|
||||
@@ -186,4 +186,28 @@ public class Database {
|
||||
return kFactor;
|
||||
}
|
||||
|
||||
public long newFluidShot(FluidShot inp){
|
||||
String df = ZonedDateTime.now().toString();
|
||||
MongoCollection<Document> collection = database.getCollection("fluidShots");
|
||||
Document doc = new Document("timestamp", df)
|
||||
.append("fluidLevel", inp.getFluidLevel())
|
||||
.append("pumpIntakePressure", inp.getPumpIntakePressure())
|
||||
.append("frictionEstimate", inp.getFrictionEstimate());
|
||||
collection.insertOne(doc);
|
||||
return collection.count();
|
||||
}
|
||||
|
||||
public double getLatestFrictionEstimate(){
|
||||
MongoCollection<Document> wellTestCollection = database.getCollection("fluidShots");
|
||||
MongoCursor<Document> cursor = wellTestCollection.find().sort(Sorts.descending("timestamp")).limit(1).iterator();
|
||||
double frictionEstimate = -1;
|
||||
try {
|
||||
while (cursor.hasNext()) {
|
||||
frictionEstimate = cursor.next().getDouble("frictionEstimate");
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
return frictionEstimate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,30 @@ public class FluidShot {
|
||||
private double fluidLevel;
|
||||
private double frictionEstimate;
|
||||
private double pumpIntakePressure;
|
||||
private double fluidGradient = 0.45; // Default value
|
||||
|
||||
public double getFrictionEstimate(){
|
||||
return frictionEstimate;
|
||||
}
|
||||
|
||||
public double getFluidLevel() {
|
||||
return fluidLevel;
|
||||
}
|
||||
|
||||
public double getPumpIntakePressure() {
|
||||
return pumpIntakePressure;
|
||||
}
|
||||
|
||||
FluidShot(double fluidLevel, double fluidGradient, double downholeLoadSpan, double totalDepth, double pumpArea){
|
||||
this.fluidLevel = fluidLevel;
|
||||
pumpIntakePressure = fluidLevel / fluidGradient;
|
||||
|
||||
frictionEstimate = downholeLoadSpan - (fluidGradient * totalDepth - pumpIntakePressure) * pumpArea;
|
||||
|
||||
FluidShot(double fluidLevel){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Well {
|
||||
|
||||
/* CARDS */
|
||||
private Card currentCard;
|
||||
private Card[] cardStorage = new Card[100];
|
||||
public Card[] cardStorage = new Card[100];
|
||||
|
||||
// CONSTANTS
|
||||
private static double YM_STEEL = 30.5;
|
||||
@@ -333,6 +333,10 @@ public class Well {
|
||||
return frictionEstimate;
|
||||
}
|
||||
|
||||
public void setFrictionEstimate(double frictionEstimate) {
|
||||
this.frictionEstimate = frictionEstimate;
|
||||
}
|
||||
|
||||
public double getRodDepthTotal() {
|
||||
return rodDepthTotal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user