Adds well name to config file. Option to startup with external DB

This commit is contained in:
Patrick McDonagh
2017-02-15 16:26:44 -06:00
parent aa8acff90d
commit 0b5cdf1f8e
8 changed files with 45 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
{
"wellName": "Barney",
"deltaT": 0.06,
"pumpDiameter": 1.5,
"fluidGradient": 0.45,

View File

@@ -39,6 +39,11 @@ remotes {
user = 'root'
identity = file('henryPumpDev')
}
edisonOP {
host = '10.20.155.218'
user = 'root'
identity = file('henryPumpDev')
}
}
//create a single Jar with all dependencies
@@ -53,7 +58,7 @@ task fatJar(type: Jar) {
with jar
}
task deploy << {
task deployUSB << {
ssh.run {
session(remotes.edison) {
put from: 'build/libs/poc-java-all-1.0-SNAPSHOT.jar', into: '/home/root'
@@ -61,6 +66,14 @@ task deploy << {
}
}
task deployOP << {
ssh.run {
session(remotes.edisonOP) {
put from: 'build/libs/poc-java-all-1.0-SNAPSHOT.jar', into: '/home/root'
}
}
}
task runRemote << {
ssh.run {
session(remotes.edison) {

View File

@@ -1,4 +1,5 @@
{
"wellName": "Kiesha 7265",
"deltaT": 0.1,
"pumpDiameter": 2.0,
"fluidGradient": 0.45,

View File

@@ -35,6 +35,11 @@ public class Database {
database = mongoClient.getDatabase(pocDatabase);
}
Database(String dbHostname){
mongoClient = new MongoClient(dbHostname);
database = mongoClient.getDatabase(pocDatabase);
}
public long getLastStrokeNum(){
long lastStroke = 0;

View File

@@ -35,7 +35,7 @@ public class IOControl implements Runnable {
private void exitPOC(){
allOutputsOff();
System.exit(99);
System.exit(0);
}
public void allOutputsOff(){

View File

@@ -10,36 +10,25 @@ import java.time.ZonedDateTime;
public class POC implements Runnable{
protected Well thisWell;
private int simLoops;
private Thread t;
private boolean ioEnabled;
POC(String wellName, String wellSetupJsonFile, int simLoops){
POC(String wellSetupJsonFile, String dbHostname){
ioEnabled = true;
thisWell = new Well(wellName, 99, 99, 7);
thisWell = new Well(dbHostname, 99, 99, 7);
thisWell.parseJSONFile(wellSetupJsonFile);
// thisWell.printTapers();
this.simLoops = simLoops;
}
POC(String wellName, String wellSetupJsonFile, String simFileName, boolean ioEnabled, int simLoops){
POC(String wellSetupJsonFile, String simFileName, boolean ioEnabled, String dbHostname){
this.ioEnabled = ioEnabled;
if (this.ioEnabled) {
thisWell = new Well(wellName, simFileName,99, 99, 7);
thisWell = new Well(dbHostname, simFileName,99, 99, 7);
} else {
thisWell = new Well(wellName, simFileName,99, 99, 99);
// IO
thisWell = new Well(dbHostname, simFileName,99, 99, 99);
}
thisWell.parseJSONFile(wellSetupJsonFile);
// thisWell.printTapers();
this.simLoops = simLoops;
}
@@ -78,7 +67,11 @@ public class POC implements Runnable{
public static void main(String[] args) {
final POC thisPOC = new POC("Barney", args[0], args[1], args[2].equals("true"), 100);
String dbHostname = "localhost";
if (args.length > 3){
dbHostname = args[3];
}
final POC thisPOC = new POC(args[0], args[1], args[2].equals("true"), dbHostname);
thisPOC.start();
}
}

View File

@@ -173,9 +173,9 @@ public class Well {
private Measurement surfaceStrokeLength;
private Measurement tubingMovement;
Well(String wellName, int inclinometerChannel, int loadCellChannel, int runCommandChannel){
Well(String dbHostname, int inclinometerChannel, int loadCellChannel, int runCommandChannel){
this.wellName = wellName;
db = new Database();
db = new Database(dbHostname);
strokesLifetime = db.getLastStrokeNum() + 1;
currentCard = new Card(strokesLifetime);
inclinometer = new AnalogIn(inclinometerChannel, 0, 100, 0, 100);
@@ -184,10 +184,10 @@ public class Well {
initializeMeasurements();
}
Well(String wellName, String simFileName, int inclinometerChannel, int loadCellChannel, int runCommandChannel){
Well(String dbHostname, String simFileName, int inclinometerChannel, int loadCellChannel, int runCommandChannel){
this.wellName = wellName;
sim = new Simulation(simFileName);
db = new Database();
db = new Database(dbHostname);
strokesLifetime = db.getLastStrokeNum() + 1;
currentCard = new Card(strokesLifetime);
inclinometer = new AnalogIn(inclinometerChannel, 0, 100, 0, 100);
@@ -357,6 +357,10 @@ public class Well {
this.structuralRating = structuralRating;
}
public void setWellName(String wellName) {
this.wellName = wellName;
}
public String getWellName() {
return wellName;
}
@@ -534,6 +538,9 @@ public class Well {
Object obj = parser.parse(new FileReader(jsonFilename));
JSONObject well = (JSONObject) obj;
Object newWellName = well.get("wellName");
if (newWellName != null) wellName = (String) newWellName;
Object newDeltaT = well.get("deltaT");
if (newDeltaT != null) dt = (Double) newDeltaT;
@@ -1069,7 +1076,7 @@ public class Well {
public static void main( String[] args ){
Well thisWell = new Well("Barney", args[1], 99, 99, 99);
Well thisWell = new Well(args[1], 99, 99, 99);
thisWell.parseJSONFile(args[0]);
thisWell.printTapers();
}

View File

@@ -1,4 +1,5 @@
{
"wellName": "Viceroy Test Trailer",
"deltaT": 0.1,
"pumpDiameter": 1.5,
"fluidGradient": 0.45,