A few fixes for keeping things private

This commit is contained in:
Patrick McDonagh
2017-02-10 13:46:49 -06:00
parent 1384c40add
commit 0c6e09a6a4
3 changed files with 28 additions and 17 deletions

View File

@@ -40,47 +40,43 @@ public class AnalogIn {
this.euMin = euMin; this.euMin = euMin;
} }
public double getHistory(int pointIndex) { double getHistory(int pointIndex) {
return history[pointIndex]; return history[pointIndex];
} }
public long readRaw(){ private long readRaw(){
return gpioPin.read(); return gpioPin.read();
} }
public double readScaled(){ double readScaled(){
double pv = ((euMax - euMin)/(rawMax - rawMin)) * gpioPin.read() + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax); double pv = ((euMax - euMin)/(rawMax - rawMin)) * readRaw() + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax);
lastValue = pv; lastValue = pv;
for(int i = 98; i >= 0; i--){ System.arraycopy(history, 0, history,1, history.length - 1);
history[i+1] = history[i];
}
history[0] = lastValue; history[0] = lastValue;
return pv; return pv;
} }
public double readScaledSim(double simRaw){ double readScaledSim(double simRaw){
double pv = ((euMax - euMin)/(rawMax - rawMin)) * simRaw + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax); double pv = ((euMax - euMin)/(rawMax - rawMin)) * simRaw + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax);
lastValue = pv; lastValue = pv;
for(int i = 98; i >= 0; i--){ System.arraycopy(history, 0, history,1, history.length - 1);
history[i+1] = history[i];
}
history[0] = lastValue; history[0] = lastValue;
return pv; return pv;
} }
public static void main(String[] args){ public static void main(String[] args){
System.out.println("Testing Analog Inputs Inputs..."); System.out.println("Testing Analog Inputs Inputs...");
boolean forceEnd = false;
AnalogIn testIn0 = new AnalogIn(0, 0, 1020, 0, 4.6); AnalogIn testIn0 = new AnalogIn(0, 0, 1020, 0, 4.6);
int loops = 0;
do { while(loops < 60) {
try{ try {
System.out.println("Raw = " + testIn0.readRaw()); System.out.println("Raw = " + testIn0.readRaw());
System.out.println("Scaled = " + testIn0.readScaled()); System.out.println("Scaled = " + testIn0.readScaled());
sleep(500); sleep(500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} while (!forceEnd); loops++;
}
} }
} }

View File

@@ -0,0 +1,15 @@
package com.henrypump.poc;
/**
* Created by patrickjmcd on 2/10/17.
*/
public class FluidShot {
private double fluidLevel;
private double frictionEstimate;
private double pumpIntakePressure;
FluidShot(double fluidLevel){
}
}

View File

@@ -16,7 +16,7 @@ public class WellTest {
private double kFactor, oilRatio, waterRatio, gasMCFRatio; private double kFactor, oilRatio, waterRatio, gasMCFRatio;
public WellTest(ZonedDateTime testStart, double testHours, double totalFluidBBL, double testOilBBL, double testWaterBBL, double testGasMCF, double prevDailyTotal) { WellTest(ZonedDateTime testStart, double testHours, double totalFluidBBL, double testOilBBL, double testWaterBBL, double testGasMCF, double prevDailyTotal) {
this.testStart = testStart; this.testStart = testStart;
this.testHours = testHours; this.testHours = testHours;
this.totalFluidBBL = totalFluidBBL; this.totalFluidBBL = totalFluidBBL;