Adds ability to view configuration

This commit is contained in:
Patrick McDonagh
2017-02-27 16:27:05 -06:00
parent ab2bec692d
commit 1124d3b10e
12 changed files with 951 additions and 201 deletions

View File

@@ -11,24 +11,22 @@ import java.time.ZonedDateTime;
public class POC implements Runnable{
protected Well thisWell;
private Thread t;
private boolean ioEnabled;
POC(String wellSetupJsonFile, String dbHostname){
POC(String dbHostname){
ioEnabled = true;
thisWell = new Well(dbHostname, 99, 99, 7);
thisWell.parseJSONFile(wellSetupJsonFile);
thisWell.getWellSetup();
}
POC(String wellSetupJsonFile, String simFileName, boolean ioEnabled, String dbHostname){
POC(String simFileName, boolean ioEnabled, String dbHostname){
this.ioEnabled = ioEnabled;
if (this.ioEnabled) {
thisWell = new Well(dbHostname, simFileName,99, 99, 7);
} else {
thisWell = new Well(dbHostname, simFileName,99, 99, 99);
}
thisWell.parseJSONFile(wellSetupJsonFile);
thisWell.getWellSetup();
}
@@ -41,18 +39,15 @@ public class POC implements Runnable{
thisWell.setupFluidRatio(0.50, 0.50, 1.12);
thisWell.checkSafeties();
while (true) {
// while (thisWell.getRunStatus() == Well.RUNSTATUS_RUNNING || thisWell.getRunStatus() == Well.RUNSTATUS_STARTING) {
for (int i = 0; i <= thisWell.sim.getLastFilledIndex(); i++) {
for (int i = 0; i <= thisWell.sim.getLastFilledIndex(); i++) {
thisWell.eval(i);
thisWell.eval(i);
try {
Thread.sleep(sleepMilliseconds);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
Thread.sleep(sleepMilliseconds);
} catch (InterruptedException e) {
e.printStackTrace();
}
// }
}
}
}
@@ -67,12 +62,41 @@ public class POC implements Runnable{
public static void main(String[] args) {
if (args[0].equals("help")){
System.out.println("Pass command line parameters...");
System.out.println("=============");
System.out.println("");
System.out.println("Simulation Mode:");
System.out.println("-------------");
System.out.println("<String: simulation filename> <boolean: use IO> <String: database hostname/address (optional)>");
System.out.println("");
System.out.println("IO Mode:");
System.out.println("-------------");
System.out.println("<String: database hostname/address (optional)>");
System.out.println("");
System.out.println("If updating config via json file, place a config file named 'wellSetup.json' in the project directory.");
System.exit(2);
}
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();
if (args.length == 1){
dbHostname = args[1];
}
if (args.length < 2){
final POC realPOC = new POC(dbHostname);
realPOC.start();
} else {
final POC simPOC = new POC(args[0], args[1].equals("true"), dbHostname);
simPOC.start();
}
}
}