Daily Totals storing, with max min average total
This commit is contained in:
@@ -2,34 +2,80 @@ package com.henrypump.poc;
|
||||
|
||||
/**
|
||||
* Created by patrickjmcd on 2/1/17.
|
||||
* POC Class
|
||||
*
|
||||
*/
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class POC implements Runnable{
|
||||
private Well thisWell;
|
||||
protected Well thisWell;
|
||||
private int simLoops;
|
||||
private double tubingMovement;
|
||||
private double pumpIntakePressure;
|
||||
private double fluidLoad;
|
||||
private double fluidLevel;
|
||||
private Thread t;
|
||||
private DigitalIn startBtn = new DigitalIn(8);
|
||||
private DigitalIn stopBtn = new DigitalIn(9);
|
||||
private DigitalOut led2 = new DigitalOut(2, 0);
|
||||
private DigitalOut led3 = new DigitalOut(3, 0);
|
||||
private DigitalOut led4 = new DigitalOut(4, 0);
|
||||
private DigitalOut led5 = new DigitalOut(5, 0);
|
||||
private DigitalOut runIndicator = new DigitalOut(6,0);
|
||||
private DigitalIn startBtn, stopBtn;
|
||||
private DigitalOut led2, led3, led4, led5;
|
||||
private DigitalOut runIndicator;
|
||||
|
||||
private boolean ioEnabled;
|
||||
private boolean guiEnabled;
|
||||
|
||||
|
||||
|
||||
POC(String wellName, String wellSetupJsonFile, int simLoops){
|
||||
thisWell = new Well(wellName);
|
||||
ioEnabled = true;
|
||||
guiEnabled = false;
|
||||
thisWell = new Well(wellName, 99, 99, 7);
|
||||
thisWell.parseJSONFile(wellSetupJsonFile);
|
||||
thisWell.printTapers();
|
||||
this.simLoops = simLoops;
|
||||
|
||||
// IO
|
||||
startBtn = new DigitalIn(8);
|
||||
stopBtn = new DigitalIn(9);
|
||||
led2 = new DigitalOut(2, 0);
|
||||
led3 = new DigitalOut(3, 0);
|
||||
led4 = new DigitalOut(4, 0);
|
||||
led5 = new DigitalOut(5, 0);
|
||||
runIndicator = new DigitalOut(6,0);
|
||||
|
||||
|
||||
String headlessProp = !guiEnabled ? "true" : "false";
|
||||
System.setProperty("java.awt.headless", headlessProp);
|
||||
System.out.println(java.awt.GraphicsEnvironment.isHeadless());
|
||||
}
|
||||
|
||||
POC(String wellName, String wellSetupJsonFile, String simFileName, int simLoops){
|
||||
thisWell = new Well(wellName, simFileName);
|
||||
POC(String wellName, String wellSetupJsonFile, String simFileName, boolean ioEnabled, int simLoops){
|
||||
this.ioEnabled = ioEnabled;
|
||||
if (this.ioEnabled) {
|
||||
guiEnabled = false;
|
||||
thisWell = new Well(wellName, simFileName,99, 99, 7);
|
||||
|
||||
// IO
|
||||
startBtn = new DigitalIn(8);
|
||||
stopBtn = new DigitalIn(9);
|
||||
led2 = new DigitalOut(2, 0);
|
||||
led3 = new DigitalOut(3, 0);
|
||||
led4 = new DigitalOut(4, 0);
|
||||
led5 = new DigitalOut(5, 0);
|
||||
runIndicator = new DigitalOut(6,0);
|
||||
|
||||
} else {
|
||||
thisWell = new Well(wellName, simFileName,99, 99, 99);
|
||||
guiEnabled = true;
|
||||
// IO
|
||||
startBtn = new DigitalIn(99);
|
||||
stopBtn = new DigitalIn(99);
|
||||
led2 = new DigitalOut(99, 0);
|
||||
led3 = new DigitalOut(99, 0);
|
||||
led4 = new DigitalOut(99, 0);
|
||||
led5 = new DigitalOut(99, 0);
|
||||
runIndicator = new DigitalOut(99,0);
|
||||
}
|
||||
|
||||
String headlessProp = !guiEnabled ? "true" : "false";
|
||||
System.setProperty("java.awt.headless", headlessProp);
|
||||
System.out.println(java.awt.GraphicsEnvironment.isHeadless());
|
||||
|
||||
thisWell.parseJSONFile(wellSetupJsonFile);
|
||||
thisWell.printTapers();
|
||||
this.simLoops = simLoops;
|
||||
@@ -46,7 +92,7 @@ public class POC implements Runnable{
|
||||
int loopCounter = 0, loopLimit = simLoops, led2out, led3out, led4out,led5out;
|
||||
double pos;
|
||||
long sleepMilliseconds = (long) (thisWell.getDt() * 1000);
|
||||
|
||||
thisWell.setupFluidRatio(0.25, 0.75, 1.12);
|
||||
thisWell.checkSafeties();
|
||||
while (true) {
|
||||
while (loopCounter < loopLimit && (thisWell.getRunStatus() == Well.RUNSTATUS_RUNNING || thisWell.getRunStatus() == Well.RUNSTATUS_STARTING)) {
|
||||
@@ -60,8 +106,7 @@ public class POC implements Runnable{
|
||||
|
||||
thisWell.eval(i);
|
||||
|
||||
pos = thisWell.getCurrentPosition();
|
||||
|
||||
pos = thisWell.getCurrentSurfacePosition();
|
||||
led2.write(pos > 20.0 ? 1 : 0);
|
||||
led3.write(pos > 40.0 ? 1 : 0);
|
||||
led4.write(pos > 60.0 ? 1 : 0);
|
||||
@@ -77,7 +122,8 @@ public class POC implements Runnable{
|
||||
}
|
||||
loopCounter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (startBtn.read() == 1) thisWell.start("startbutton");
|
||||
if (stopBtn.read() == 1) thisWell.stop("stopbutton");
|
||||
if (startBtn.read() == 1 && stopBtn.read() == 1) {
|
||||
@@ -101,9 +147,11 @@ public class POC implements Runnable{
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
final POC thisPOC = new POC("Barney", args[0], args[1], 100);
|
||||
final POC thisPOC = new POC("Barney", args[0], args[1], true, 100);
|
||||
thisPOC.start();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user