POC class is working and threadable
This commit is contained in:
@@ -3,6 +3,78 @@ package com.henrypump.poc;
|
||||
/**
|
||||
* Created by patrickjmcd on 2/1/17.
|
||||
*/
|
||||
public class POC {
|
||||
public class POC implements Runnable{
|
||||
private Well thisWell;
|
||||
private Simulation sim;
|
||||
private int simLoops;
|
||||
private double tubingMovement;
|
||||
private double pumpIntakePressure;
|
||||
private double fluidLoad;
|
||||
private double fluidLevel;
|
||||
private Thread t;
|
||||
|
||||
|
||||
|
||||
POC(String wellName, String wellSetupJsonFile, String simFileName, int simLoops){
|
||||
thisWell = new Well(wellName);
|
||||
thisWell.parseJSONFile(wellSetupJsonFile);
|
||||
thisWell.printTapers();
|
||||
sim = new Simulation(simFileName);
|
||||
this.simLoops = simLoops;
|
||||
}
|
||||
|
||||
public void run(){
|
||||
|
||||
int loopCounter = 0, loopLimit = simLoops;
|
||||
long sleepMilliseconds = (long) (thisWell.getDt() * 1000);
|
||||
|
||||
LPStatus downholePoint;
|
||||
while (loopCounter < loopLimit) {
|
||||
Card thisCard = new Card(loopCounter);
|
||||
for (int i = 0; i <= sim.getLastFilledIndex(); i++) {
|
||||
thisCard.setSurfacePosition(i, sim.getPositionAtIndex(i));
|
||||
thisCard.setSurfaceLoad(i, sim.getLoadAtIndex(i));
|
||||
downholePoint = thisWell.calc(sim.getPositionAtIndex(i), sim.getLoadAtIndex(i));
|
||||
if (downholePoint.getStatus() == Well.GOOD_STATUS) {
|
||||
thisCard.setDownholePosition(i, downholePoint.getPosition());
|
||||
thisCard.setDownholeLoad(i, downholePoint.getLoad());
|
||||
}
|
||||
try {
|
||||
Thread.sleep(sleepMilliseconds);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
thisCard.setNumPointsUsed(sim.getLastFilledIndex());
|
||||
thisCard.calcStrokeData(150, thisWell.getFluidGradient(),
|
||||
thisWell.getRodDepthTotal(), thisWell.getTubingAnchorDepth(),
|
||||
thisWell.getTubingCrossSectionalArea(), thisWell.getPumpArea(),
|
||||
thisWell.getFrictionEstimate(), thisWell.getStructuralRating());
|
||||
thisCard.printCard("none", true);
|
||||
loopCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
public void start () {
|
||||
System.out.println("Starting POC");
|
||||
if (t == null) {
|
||||
t = new Thread (this, "POC-Thread");
|
||||
t.start ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
POC thisPOC = new POC("Barney", args[0], args[1], 3);
|
||||
thisPOC.start();
|
||||
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
POC otherPOC = new POC("NotBarney", args[0], args[1], 4);
|
||||
otherPOC.start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user