diff --git a/.gitignore b/.gitignore index 10a3384..b822f5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ - +codegen/* *.m~ diff --git a/AnalogInput.m b/AnalogInput.m deleted file mode 100644 index ccf8596..0000000 --- a/AnalogInput.m +++ /dev/null @@ -1,91 +0,0 @@ -classdef AnalogInput < handle - properties - mux; - channel; - rawValue; - lastValue; - lastStored=0; - rawMax,rawMin,euMax,euMin; - history=zeros(1, 100, 'double'); - badReads=0; - - end - - properties(Access=private) - m,b; - histi; - end - - methods - function obj = AnalogInput(mux, channel, rawMin, rawMax, euMin, euMax) - obj.mux = mux; - obj.channel = channel; - obj.rawMin = double(rawMin); - obj.rawMax = double(rawMax); - obj.euMin = double(euMin); - obj.euMax = double(euMax); - obj.histi = 0; - - obj.m = (obj.euMax - obj.euMin) / (obj.rawMax - obj.rawMin); - obj.b = obj.euMax - obj.m * (obj.rawMax); - end - - function value = setValue(obj, inValue) - obj.histi = obj.histi + 1; - obj.rawValue = inValue; - value = obj.m * inValue + obj.b; - obj.lastValue = value; - obj.lastStored = now; - - % Store value in history array - histTemp = obj.history(1:end-1); - obj.history(2:end) = histTemp; - obj.history(1) = value; - end - - function value = read(obj) - value = obj.lastValue; - rawIn = obj.mux.readAnalogSPI(); - if (rawIn ~= -1) - obj.badReads = 0; - value = obj.setValue(double(rawIn)); - else - obj.badReads = obj.badReads + 1; - end - - if (obj.badReads > 10) - pause(0.010); - end - end - - function value = readSim(obj, simRaw) - value = obj.m * simRaw + obj.b; - obj.lastValue = value; - obj.lastStored = now; - obj.history = [value, obj.history(1:end-1)]; - end - end - - methods(Static) - function test - loops = 25; - pi = raspi('10.0.0.106', 'pi', 'HenryPump@1903'); - mux = MuxSetup(pi); - anInput1 = AnalogInput(mux, 1, 0.0, 65535.0, 0.0, 100.0); - anInput2 = AnalogInput(mux, 2, 0.0, 65535.0, 0.0, 100.0); - - ai1 = zeros(1, loops, 'double'); - ai2 = zeros(1, loops, 'double'); - - for i = 1:loops - i - ai1(i) = anInput1.read(); - ai2(i) = anInput2.read(); - end - plot(ai1,'DisplayName','ai1');hold on;plot(ai2,'DisplayName','ai2');hold off; - end - - end - - -end diff --git a/AnalogInputSim.m b/AnalogInputSim.m index 3763f7f..6671fdd 100644 --- a/AnalogInputSim.m +++ b/AnalogInputSim.m @@ -32,19 +32,19 @@ classdef AnalogInputSim < handle obj.rawValue = inValue; value = obj.m * inValue + obj.b; obj.lastValue = value; - obj.lastStored = now; +% obj.lastStored = now; obj.history = [value, obj.history(1:end-1)]; end - function value = read(obj, simRaw) - value = obj.m * simRaw + obj.b; - obj.lastValue = value; - obj.lastStored = now; - - % Store value in history array - histTemp = obj.history(1:end-1); - obj.history(2:end) = histTemp; - obj.history(1) = value; - end + function value = read(obj, value) +% value = obj.m * simRaw + obj.b; + obj.lastValue = value; +% obj.lastStored = now; + + % Store value in history array + histTemp = obj.history(1:end-1); + obj.history(2:end) = histTemp; + obj.history(1) = value; + end end end \ No newline at end of file diff --git a/Card.m b/Card.m index 4ee0736..8026c8a 100644 --- a/Card.m +++ b/Card.m @@ -9,6 +9,17 @@ classdef Card < handle downholePosition=zeros(1, 1500, 'double'); downholeLoad=zeros(1, 1500, 'double'); + + numRepSlices=200; + + repDownholePosition=zeros(1, 199, 'double'); + repDownholeLoadTop=zeros(1, 199, 'double'); + repDownholeLoadBottom=zeros(1, 199, 'double'); + repSurfacePosition=zeros(1, 199, 'double'); + repSurfaceLoadTop=zeros(1, 199, 'double'); + repSurfaceLoadBottom=zeros(1, 199, 'double'); + + surfacePositionMax=LPPair(0,0); surfacePositionMin=LPPair(0,0); surfaceLoadMax=LPPair(0,0); @@ -50,7 +61,11 @@ classdef Card < handle function obj=Card(strokeNumber) % Initialization Function obj.strokeNumber = strokeNumber; - obj.strokeStartTime = now; +% obj.strokeStartTime = now; + obj.strokeStartTime = 0; + obj.topCorner = LPPair(0, 0); + obj.bottomCorner = LPPair(0, 0); + end function push(obj, s_pos, s_load, d_pos, d_load) @@ -61,11 +76,12 @@ classdef Card < handle obj.downholeLoad(obj.numPointsUsed) = d_load; end - function calcStrokeData(obj, numSlices, fluidGradient, rodDepth, ... + function calcStrokeData(obj, fluidGradient, rodDepth, ... anchorDepth, tubingCSA, pumpArea, frictionEstimate, ... structuralRating, kFactor, waterBBLRatio, oilBBLRatio, ... gasMCFRatio) obj.calculateSPM(); + numSlices = obj.numRepSlices; obj.surfacePositionMax = obj.positionMax(obj.surfacePosition, obj.surfaceLoad, obj.numPointsUsed); obj.surfaceLoadMax = obj.loadMax(obj.surfacePosition, obj.surfaceLoad, obj.numPointsUsed); obj.surfacePositionMin = obj.positionMin(obj.surfacePosition, obj.surfaceLoad, obj.numPointsUsed); @@ -88,7 +104,7 @@ classdef Card < handle dhDistanceTop = 0.0; dhDistanceBottom = 0.0; - for i = 1:numSlices+1 + for i = 1:numSlices-1 suPosTarget = obj.surfacePositionMin.position + (double(i) * dxSurf); dhPosTarget = obj.downholePositionMin.position + (double(i) * dxDown); suLoadAtTargetTop = 0.0; @@ -101,7 +117,7 @@ classdef Card < handle dhLoadAtTargetTop = obj.lineResolve(obj.downholePosition(j), obj.downholePosition(j+1), obj.downholeLoad(j), obj.downholeLoad(j+1), dhPosTarget); end - if (obj.downholePosition(j) > dhPosTarget && obj.downholePosition(j+1) >= dhPosTarget) + if (obj.downholePosition(j) >= dhPosTarget && obj.downholePosition(j+1) < dhPosTarget) dhLoadAtTargetBottom = obj.lineResolve(obj.downholePosition(j), obj.downholePosition(j+1), obj.downholeLoad(j), obj.downholeLoad(j+1), dhPosTarget); end @@ -109,10 +125,44 @@ classdef Card < handle suLoadAtTargetTop = obj.lineResolve(obj.surfacePosition(j), obj.surfacePosition(j+1), obj.surfaceLoad(j), obj.surfaceLoad(j+1), suPosTarget); end - if (obj.surfacePosition(j) > suPosTarget && obj.surfacePosition(j+1) >= suPosTarget) + if (obj.surfacePosition(j) >= suPosTarget && obj.surfacePosition(j+1) < suPosTarget) suLoadAtTargetBottom = obj.lineResolve(obj.surfacePosition(j), obj.surfacePosition(j+1), obj.surfaceLoad(j), obj.surfaceLoad(j+1), suPosTarget); end end + + obj.repDownholePosition(i) = dhPosTarget; + if (dhLoadAtTargetTop == 0.0) && (i > 1) + obj.repDownholeLoadTop(i) = obj.repDownholeLoadTop(i-1); + elseif (dhLoadAtTargetTop == 0.0) && (i == 1) + obj.repDownholeLoadTop(i) = obj.downholePositionMin.load; + else + obj.repDownholeLoadTop(i) = dhLoadAtTargetTop; + end + + if dhLoadAtTargetBottom == 0.0 && (i > 1) + obj.repDownholeLoadBottom(i) = obj.repDownholeLoadBottom(i-1); + elseif dhLoadAtTargetBottom == 0.0 && (i == 1) + obj.repDownholeLoadBottom(i) = obj.downholePositionMin.load; + else + obj.repDownholeLoadBottom(i) = dhLoadAtTargetBottom; + end + + obj.repSurfacePosition(i) = suPosTarget; + if suLoadAtTargetTop == 0.0 && (i > 1) + obj.repSurfaceLoadTop(i) = obj.repSurfaceLoadTop(i-1); + elseif suLoadAtTargetTop == 0.0 && (i == 1) + obj.repSurfaceLoadTop(i) = obj.surfacePositionMin.load; + else + obj.repSurfaceLoadTop(i) = suLoadAtTargetTop; + end + + if suLoadAtTargetBottom == 0.0 && (i > 1) + obj.repSurfaceLoadBottom(i) = obj.repSurfaceLoadBottom(i-1); + elseif suLoadAtTargetBottom == 0.0 && (i == 1) + obj.repSurfaceLoadBottom(i) = obj.surfacePositionMin.load; + else + obj.repSurfaceLoadBottom(i) = suLoadAtTargetBottom; + end obj.polishedRodHorsepower = obj.polishedRodHorsepower + (dxSurf / 12.0) * (suLoadAtTargetTop - suLoadAtTargetBottom) * (obj.strokeSpeed / 33000.0); obj.pumpHorsepower = obj.pumpHorsepower + (dxDown / 12.0) * (dhLoadAtTargetTop - dhLoadAtTargetBottom) * (obj.strokeSpeed / 33000.0); @@ -120,12 +170,12 @@ classdef Card < handle tDistance = obj.distanceToLine(dhPosTarget, dhLoadAtTargetTop); bDistance = obj.distanceToLine(dhPosTarget, dhLoadAtTargetBottom); - if (tDistance > dhDistanceTop) + if (tDistance > dhDistanceTop) && (dhLoadAtTargetTop ~= 0.0) dhDistanceTop = tDistance; obj.topCorner = LPPair(dhPosTarget, dhLoadAtTargetTop); end - if (bDistance > dhDistanceBottom) + if (bDistance > dhDistanceBottom) && (dhLoadAtTargetBottom ~= 0.0) dhDistanceBottom = bDistance; obj.bottomCorner = LPPair(dhPosTarget, dhLoadAtTargetBottom); end @@ -166,7 +216,7 @@ classdef Card < handle end function calculateSPM(obj) - obj.strokeSpeed = 60000.0 / (now - obj.strokeStartTime); + obj.strokeSpeed = 60000.0 / (5000 - obj.strokeStartTime); end function dist = distanceToLine(obj, pos, load) @@ -191,6 +241,7 @@ classdef Card < handle linkaxes([ax1, ax2], 'x') end + end methods(Static) diff --git a/DigitalInput.m b/DigitalInput.m deleted file mode 100644 index 8ffe1de..0000000 --- a/DigitalInput.m +++ /dev/null @@ -1,45 +0,0 @@ -classdef DigitalInput < handle - properties - mux; - channel; - value; - end - - methods - function obj = DigitalInput(mux, channel) - obj.channel = channel; - obj.mux = mux; - end - - function val = read(obj) - obj.mux.set(obj.channel); - val = obj.mux.readDigital(); - end - end - - methods(Static) - function test - pi = raspi('10.0.0.104', 'pi', 'HenryPump@1903'); - mux = MuxSetup(pi); - digIn1 = DigitalInput(mux, 1); - digIn2 = DigitalInput(mux, 2); - digIn3 = DigitalInput(mux, 3); - digIn4 = DigitalInput(mux, 4); - digIn5 = DigitalInput(mux, 5); - digIn6 = DigitalInput(mux, 6); - digIn7 = DigitalInput(mux, 7); - digIn8 = DigitalInput(mux, 8); - - digIn1Val = digIn1.read() - digIn2Val = digIn2.read() - digIn3Val = digIn3.read() - digIn4Val = digIn4.read() - digIn5Val = digIn5.read() - digIn6Val = digIn6.read() - digIn7Val = digIn7.read() - digIn8Val = digIn8.read() - end - end - - -end \ No newline at end of file diff --git a/DigitalOutput.m b/DigitalOutput.m deleted file mode 100644 index 1268e3c..0000000 --- a/DigitalOutput.m +++ /dev/null @@ -1,76 +0,0 @@ -classdef DigitalOutput < handle - properties - channel; - dev; - end - methods - function writeOut(obj, value) - writeDigitalPin(obj.dev, obj.channel, value); - end - - function obj = DigitalOutput(dev, chan) - channel = 0; - switch chan - case 1 - channel = 21; - case 2 - channel = 20; - case 3 - channel = 16; - case 4 - channel = 12; - case 5 - channel = 25; - case 6 - channel = 24; - case 7 - channel = 23; - case 8 - channel = 18; - end - configurePin(dev, channel, 'DigitalOutput'); - obj.dev = dev; - obj.channel = channel; - end - end - methods(Static) - function test - pi = raspi('10.0.0.104', 'pi', 'HenryPump@1903'); - - d1 = DigitalOutput(pi, 1); - d2 = DigitalOutput(pi, 2); - d3 = DigitalOutput(pi, 3); - d4 = DigitalOutput(pi, 4); - d5 = DigitalOutput(pi, 5); - d6 = DigitalOutput(pi, 6); - - d1.writeOut(1); - pause(0.250); - d2.writeOut(1); - pause(0.250); - d3.writeOut(1); - pause(0.250); - d4.writeOut(1); - pause(0.250); - d5.writeOut(1); - pause(0.250); - d6.writeOut(1); - pause(0.250); - - d1.writeOut(0); - pause(0.250); - d2.writeOut(0); - pause(0.250); - d3.writeOut(0); - pause(0.250); - d4.writeOut(0); - pause(0.250); - d5.writeOut(0); - pause(0.250); - d6.writeOut(0); - end - end -end - - - \ No newline at end of file diff --git a/LPPair.m b/LPPair.m index dc5b8bf..775066a 100644 --- a/LPPair.m +++ b/LPPair.m @@ -1,5 +1,5 @@ -classdef LPPair < handle +classdef LPPair % Load & Position Pair Class properties load; diff --git a/Melinda252WellTest.mlx b/Melinda252WellTest.mlx new file mode 100644 index 0000000..1fd140e Binary files /dev/null and b/Melinda252WellTest.mlx differ diff --git a/Melinda254WellTest.mlx b/Melinda254WellTest.mlx new file mode 100644 index 0000000..126806a Binary files /dev/null and b/Melinda254WellTest.mlx differ diff --git a/MongoDB.m b/MongoDB.m deleted file mode 100644 index 70988f0..0000000 --- a/MongoDB.m +++ /dev/null @@ -1,87 +0,0 @@ - -classdef MongoDB < handle - properties - hostname; - username; - password; - database='poc'; - port=27017; - cardCollection, wellDataCollection, gaugeOffCollection, ... - wellTestCollection, fluidShotsCollection, ... - runStatusCollection, wellConfigCollection, setpointCollection; - end - - methods - function obj = Database(hostname, username, password) - javaaddpath 'mongo-java-driver-3.4.2.jar'; - import com.mongodb.*; - import com.mongodb.client.model.*; - import java.util.Arrays; - - obj.hostname = hostname; - obj.username = username; - obj.password = password; - credential = MongoCredential.createCredential(obj.username, obj.database, obj.password); - mongo = MongoClient(Arrays.asList(ServerAddress(obj.hostname, obj.port)), Arrays.asList(credential)); - - db = mongo.getDatabase("poc"); - obj.cardCollection = db.getCollection('cards'); -% obj.cardCollection.createIndex(Indexes.ascending("timestamp", "strokeNumber")); - - obj.wellDataCollection = db.getCollection("measurements"); -% obj.wellDataCollection.createIndex(Indexes.ascending("dateStored", "tagName")); - - obj.gaugeOffCollection = db.getCollection("gaugeOff"); -% obj.gaugeOffCollection.createIndex(Indexes.ascending("timestamp", "tagName")); - - obj.wellTestCollection = db.getCollection("wellTests"); -% obj.wellTestCollection.createIndex(Indexes.ascending("testStartTime")); - - obj.fluidShotsCollection = db.getCollection("fluidShots"); -% obj.fluidShotsCollection.createIndex(Indexes.ascending("timestamp")); - - obj.runStatusCollection = db.getCollection("runStatus"); -% obj.runStatusCollection.createIndex(Indexes.ascending("timestamp")); - - obj.wellConfigCollection = db.getCollection("wellConfiguration"); -% obj.wellConfigCollection.createIndex(Indexes.ascending("timestamp")); - - obj.setpointCollection = db.getCollection("setpoints"); -% obj.setpointCollection.createIndex(Indexes.ascending("name")); - end - - function lastStroke = getLastStrokeNum(obj) - javaaddpath 'mongo-java-driver-3.4.2.jar'; - import com.mongodb.client.model.*; - import java.util.Arrays; - import java.util.List; - - lastStroke = -1; - last = Accumulators.last("lastStroke", "$strokeNumber"); - lastList = java.util.ArrayList; - lastList.add(last); - group = Aggregates.group("strokeNumber", lastList); - groupList = java.util.ArrayList; - groupList.add(group); - groupListArray = Arrays.asList(groupList); - - cursor = obj.cardCollection.aggregate(groupListArray).iterator(); - while (cursor.hasNext()) - docStroke = cursor.next().getLong("lastStroke"); - if (docStroke > lastStroke) - lastStroke = docStroke; - end - end - cursor.close(); - end - end - - methods(Static) - function test - db = Database('localhost', 'poc_java', 'HenryPump@1903'); - lastStroke = db.getLastStrokeNum() - end - end - - -end \ No newline at end of file diff --git a/MuxSetup.m b/MuxSetup.m deleted file mode 100644 index 8729746..0000000 --- a/MuxSetup.m +++ /dev/null @@ -1,63 +0,0 @@ -classdef MuxSetup < handle - properties(Access=private) - mux1Pin=5; - mux2Pin=6; - mux3Pin=13; - digInPin=19; - anOutTriggerPin=23; - dev; - end - - properties - setup=[0 0 0; 1 0 0; 0 1 0; 1 1 0; 0 0 1; 1 0 1; 0 1 1; 1 1 1]; - spiDevice; - end - - methods - function obj = MuxSetup(dev) - obj.dev = dev; - configurePin(dev, obj.mux1Pin, 'DigitalOutput'); - configurePin(dev, obj.mux2Pin, 'DigitalOutput'); - configurePin(dev, obj.mux3Pin, 'DigitalOutput'); - configurePin(dev, obj.digInPin, 'DigitalInput'); - configurePin(dev, obj.anOutTriggerPin, 'DigitalOutput'); - obj.spiDevice = spidev(dev, 'CE0'); - end - - function set(obj, channel) - % Set the mux up for reading from a channel - if (channel > 0) && (channel <= 8) - writeDigitalPin(obj.dev, obj.mux1Pin, obj.setup(channel, 1)); - writeDigitalPin(obj.dev, obj.mux2Pin, obj.setup(channel, 2)); - writeDigitalPin(obj.dev, obj.mux3Pin, obj.setup(channel, 3)); - end - - end - - function digInVal = readDigital(obj) - % Read the value of a digital input after setting the Mux - digInVal = ~readDigitalPin(obj.dev, obj.digInPin); - end - - function analogValue = readAnalogSPI(obj) - enableSPI(obj.dev); - analogValue = -1; - analogRaw = writeRead(obj.spiDevice,[hex2dec('00') hex2dec('00') hex2dec('00')]); - if (analogRaw(3) == 13) - x = uint16(analogRaw(1)) * 256; - analogValue = x + uint16(analogRaw(2)); - end -% disableSPI(obj.dev); - end - end - methods(Static) - function test - pi = raspi('10.0.0.104', 'pi', 'HenryPump@1903'); - mux = MuxSetup(pi); - mux.set(1); - mux.readAnalogSPI() - mux.set(2); - mux.readAnalogSPI() - end - end -end \ No newline at end of file diff --git a/Well.m b/Well.m index 48c4b3a..ab7db02 100644 --- a/Well.m +++ b/Well.m @@ -1,372 +1,69 @@ classdef Well < handle properties(Constant) - % Constants (SHOULD THESE BE ELSEWHERE?) - YM_STEEL=30.5; - YM_FIBERGLASS=7.2; - + %% Constants (SHOULD THESE BE ELSEWHERE?) DIRECTION_UNKNOWN=0; DIRECTION_UP=1; DIRECTION_DOWN=2; end properties - wellName; + parameters; - % Instrumentation + + %% Instrumentation device; mux; positionSensor; loadSensor; - - % Current Values - currentSurfacePosition,currentSurfaceLoad; - currentDownholePosition,currentDownholeLoad; + + %% Current Values currentCard=Card(0); lastCard=Card(0); direction=0; lastDirection=0; - % User Inputs - dt = 1.0 / 30.0; - tubingHeadPressure = 40.0; - fluidGradient = 0.45; - stuffingBoxFriction = 100.0; - numTapers = 3; - tubingAnchorDepth = 0.0; - pumpDiameter = 2.5; - pumpArea; - tubingInnerDiameter = 1.995; - tubingOuterDiameter = 2.375; - tubingCrossSectionalArea; - structuralRating = 320000; - frictionEstimate; - - % Production Parameters + %% Production Parameters kFactor=1.0; waterBblRatio=0.90; oilBblRatio=0.10; gasMcfRatio=5.0; - - % Rod String Inputs - c; - rodLength; - rodDiameter; - rodYM; - rodWeightPerFoot; - - % Calculated Taper Parameters - a; - area; - pressure; - stretch; - force; - alpha; - xOverA; - factorArray; - lagIndex; - lengthRequired; - centerPoint; - count; - - buoyantForceTotal = 0.0; - rodDepthTotal = 0.0; - rodWeightAirTotal = 0.0; - rodWeightFluidTotal = 0.0; - end properties(Access=private) topPosArray; topLoadArray; + count; - % cross-function variables for position and load - % POSITION MUST ALWAYS BE CALLED FIRST. - loadBefore = 0.0; - loadAfter = 0.0; - loadBefore3 = 0.0; - loadAfter3 = 0.0; - tempLoadValue = 0.0; end methods - function me = Well(name, sim) - me.wellName = name; + %% Constructor Function + function me = Well(dt, rodLengths, rodDiameters, ... + rodMaterials, rodDampingFactors, tubingHeadPressure, ... + stuffingBoxFriction, fluidGradient, pumpDiameter, ... + tubingOuterDiameter, tubingInnerDiameter, tubingAnchorDepth, ... + structuralRating) + + me.parameters = wellSetup(dt, rodLengths, rodDiameters, ... + rodMaterials, rodDampingFactors, tubingHeadPressure, ... + stuffingBoxFriction, fluidGradient, pumpDiameter, tubingOuterDiameter, ... + tubingInnerDiameter, tubingAnchorDepth, structuralRating); - me.c = [0.8 0.8 0.8]; - me.rodLength = [1475.0 1525.0 2000.0]; - me.rodDiameter = [1.0 0.875 0.750]; - me.rodYM = [me.YM_STEEL me.YM_STEEL me.YM_STEEL]; - me.rodWeightPerFoot = [Well.lookupRodWeightPerFoot(me.rodYM(1), me.rodDiameter(1)) ... - Well.lookupRodWeightPerFoot(me.rodYM(2), me.rodDiameter(2)) ... - Well.lookupRodWeightPerFoot(me.rodYM(3), me.rodDiameter(3))]; + me.topPosArray = zeros(me.parameters.numTapers+1, 100); + me.topLoadArray = zeros(me.parameters.numTapers+1, 100); + me.count = zeros(1, me.parameters.numTapers); - % Initialize - me.a = zeros(1, me.numTapers, 'double'); - me.area = zeros(1, me.numTapers+1, 'double'); - me.pressure = zeros(1, me.numTapers, 'double'); - me.stretch = zeros(1, me.numTapers, 'double'); - me.force = zeros(1, me.numTapers, 'double'); - me.alpha = zeros(1, me.numTapers, 'double'); - me.xOverA = zeros(1, me.numTapers, 'double'); - me.factorArray = zeros(1, me.numTapers, 'double'); - me.lagIndex = zeros(1, me.numTapers, 'uint8'); - me.lengthRequired = zeros(1, me.numTapers, 'uint8'); - me.centerPoint = zeros(1, me.numTapers, 'uint8'); - me.count = zeros(1, me.numTapers, 'uint8'); - me.topPosArray = zeros(10, 250,'double'); - me.topLoadArray = zeros(10, 250, 'double'); + me.device = 0; + me.mux = MuxSetupSim(me.device); + me.positionSensor = AnalogInputSim(me.mux, 1, 0.0, 65535.0, 0.0, 65535.0); + me.loadSensor = AnalogInputSim(me.mux, 2, 0.0, 65535.0, 0.0, 65535.0); - if logical(sim) - me.device = 0; - me.mux = MuxSetupSim(me.device); - me.positionSensor = AnalogInputSim(me.mux, 1, 0.0, 65535.0, 0.0, 65535.0); - me.loadSensor = AnalogInputSim(me.mux, 2, 0.0, 65535.0, 0.0, 65535.0); - else - me.device = raspi('10.0.0.106', 'pi', 'HenryPump@1903'); - me.mux = MuxSetupSim(me.device); - me.positionSensor = AnalogInput(mux, 1, 0.0, 65535.0, 0.0, 140.0); - me.loadSensor = AnalogInput(mux, 2, 0.0, 65535.0, 0.0, 50000.0); - end - - me.wellSetup(); - end - - function wellSetup(me) - me.tubingCrossSectionalArea = (pi / 4) * ... - (power(me.tubingOuterDiameter, 2) - ... - power(me.tubingInnerDiameter,2)); - me.pumpArea = power(me.pumpDiameter, 2) * pi; - - for i = 1:me.numTapers - me.area(i) = pi / 4 * power(me.rodDiameter(i), 2); - end - - for i = 1:me.numTapers - me.a(i) = 1000.0 * sqrt(32.2 * me.rodYM(i) * me.area(i) / me.rodWeightPerFoot(i)); - me.rodDepthTotal = me.rodDepthTotal + me.rodLength(i); - - if i > 1 - me.pressure(i) = me.pressure(i - 1) + me.fluidGradient * me.rodLength(i); - else - me.pressure(i) = me.tubingHeadPressure + me.fluidGradient * me.rodLength(i); - end - - me.buoyantForceTotal = me.buoyantForceTotal + me.pressure(i) * (me.area(i+1) - me.area(i)); - me.rodWeightAirTotal = me.rodWeightAirTotal + me.rodWeightPerFoot(i) * me.rodLength(i); - me.rodWeightFluidTotal = me.rodWeightAirTotal + me.buoyantForceTotal; - end - - for j = 1:me.numTapers - weightData = 0.0; - annularForceData = 0.0; - - for i = j+1:me.numTapers - weightData = weightData + me.rodWeightPerFoot(i) * me.rodLength(i); - end - - for i = j:me.numTapers-1 - annularForceData = annularForceData + me.pressure(i) * (me.area(i) - me.area(i+1)); - end - - me.force(j) = (-me.area(me.numTapers) * me.pressure(me.numTapers)) + weightData - annularForceData; - me.alpha(j) = (me.force(j) + me.rodWeightPerFoot(j) * me.rodLength(j)) / (me.rodYM(j) * power(10, 6) * me.area(j)); - - if j > 1 - me.stretch(j) = me.stretch(j - 1) + me.alpha(j) * me.rodLength(j) - ... - (me.rodWeightPerFoot(j) * power(me.rodLength(j), 2.0)) / ... - (2.0 * me.rodYM(j) * power(10, 6) * me.area(j)); - else - me.stretch(j) = 0.0 + me.alpha(j) * me.rodLength(j) - ... - (me.rodWeightPerFoot(j) * power(me.rodLength(j), 2.0)) / ... - (2.0 * me.rodYM(j) * power(10, 6) * me.area(j)); - end - end - - for i = 1:me.numTapers - me.xOverA(i) = me.rodLength(i) / me.a(i); - me.lagIndex(i) = floor(me.rodLength(i) / (me.a(i) * me.dt)); - me.factorArray(i) = (me.xOverA(i) - double(me.lagIndex(i)) * me.dt) / me.dt; - me.centerPoint(i) = me.lagIndex(i) + 2; - me.lengthRequired(i) = 2 * (me.lagIndex(i) + 1) + 1; - end - - me.frictionEstimate = me.rodDepthTotal * 0.10; - end - - function pumpPosition = position(me, i) - % Position Function - ai = me.a(i); - ci = me.c(i); - factori = me.factorArray(i); - lengthi = me.rodLength(i); - lagi = double(me.lagIndex(i)); - yi = me.rodYM(i) * power(10, 6); - areai = me.area(i); - centeri = me.centerPoint(i); - iBefore = centeri - me.lagIndex(i); - iAfter = centeri + me.lagIndex(i); - - me.loadBefore = 0.0; - me.loadAfter = 0.0; - me.loadBefore3 = 0.0; - me.loadAfter3 = 0.0; - - pumpPosition = exp(ci * lengthi / (2.0 * ai)) * (me.topPosArray(i, iAfter) + ... - factori * (me.topPosArray(i, iAfter+1) - me.topPosArray(i, iAfter))); - - pumpPosition = pumpPosition + exp(-ci * lengthi / (2.0 * ai)) * ... - (me.topPosArray(i,iBefore) + factori * (me.topPosArray(i,iBefore-1) - ... - me.topPosArray(i, iBefore))); - - pumpPosition = 0.5 * pumpPosition; - insideIntegral = 0.0; - - for jj = 1:2*lagi-1 - insideIntegral = insideIntegral + me.dt / (yi * areai) * ... - (exp((-ci * (lagi - jj) *me.dt) / 2.0) * ... - me.topLoadArray(i, iBefore + jj)); - end - - insideIntegral = insideIntegral + 0.5 * me.dt /(yi * areai) * ... - (exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore) + ... - exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i, iAfter)); - - me.loadBefore = exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore) + ... - factori * (exp((-ci * (lagi + 1) * me.dt) / 2.0) * me.topLoadArray(i, iBefore-1) - ... - exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore)); - - me.loadAfter = exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i, iAfter) + ... - factori * (exp((-ci * (-lagi - 1) * me.dt) / 2.0) * me.topLoadArray(i, iAfter+1) - ... - exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i,iAfter)); - - insideIntegral = insideIntegral + 0.5 * factori * me.dt / (yi * areai) * ... - (me.loadBefore + exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore)); - - insideIntegral = insideIntegral + 0.5 * factori * me.dt / (yi * areai) * ... - (me.loadAfter + exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i, iAfter)); - - insideIntegral = 0.5 * ai * insideIntegral; - pumpPosition = pumpPosition + insideIntegral; - - insideIntegral = 0.0; - - for jj = 1:2*lagi-1 - insideIntegral = insideIntegral + me.dt * (exp((-ci * (lagi - jj) * me.dt) / 2.0) * ... - me.topPosArray(i, iBefore+jj)); - end - - insideIntegral = insideIntegral + 0.5 * me.dt * (exp((-ci * lagi * me.dt) / 2.0) * ... - me.topPosArray(i, iBefore) + exp((-ci * -lagi * me.dt) / 2.0) * ... - me.topPosArray(i, iAfter)); - - me.loadBefore3 = exp((-ci * lagi * me.dt) / 2.0) * me.topPosArray(i, iBefore) + ... - factori * (exp((-ci * (lagi+1) * me.dt) / 2.0) * me.topPosArray(i, iBefore-1) - ... - exp((-ci * lagi * me.dt) / 2.0) * me.topPosArray(i, iBefore)); - - me.loadAfter3 = exp((-ci * -lagi * me.dt) / 2.0) * me.topPosArray(i, iAfter) + ... - factori * (exp((-ci * (-lagi-1) * me.dt) / 2.0) * me.topPosArray(i, iAfter+1) - ... - exp((-ci * -lagi * me.dt) / 2.0) * me.topPosArray(i, iAfter)); - - insideIntegral = insideIntegral + 0.5 * factori * me.dt * (me.loadBefore3 + ... - exp((-ci * lagi * me.dt) / 2.0) * me.topPosArray(i, iBefore)); - - insideIntegral = insideIntegral + 0.5 * factori * me.dt * (me.loadAfter3 + ... - exp((-ci * -lagi * me.dt) / 2.0) * me.topPosArray(i, iAfter)); - - insideIntegral = -(ci * lengthi / 4) * 0.5 * (ci / (2.0 * ai)) * insideIntegral; - me.tempLoadValue = insideIntegral / lengthi; - pumpPosition = pumpPosition + insideIntegral; - end - - function pumpLoad = load(me, i) - % Load Function - ai = me.a(i); - ci = me.c(i); - lengthi = me.rodLength(i); - lagi = me.lagIndex(i); - yi = me.rodYM(i) * power(10, 6); - areai = me.area(i); - centeri = me.centerPoint(i); - iBefore = centeri - lagi; - iAfter = centeri + lagi; - - pumpLoad = 0.5 * (ai / (yi * areai)) * (1 / ai) * (me.loadBefore + me.loadAfter); - tempResult = yi * areai * pumpLoad; - pumpLoad = pumpLoad - (ci * lengthi / 4) * (0.5 * (ci / (2.0 * ai))) * (1 / ai) * ... - (me.loadBefore3 + me.loadAfter3); - - ptAfter = (me.topPosArray(i, iAfter+1) - me.topPosArray(i, iAfter-1)) / (2.0 * me.dt); - ptBefore = (me.topPosArray(i, iBefore+1) - me.topPosArray(i, iBefore-1)) / (2.0 * me.dt); - firstPart = (exp((ci * lengthi) / (2.0 * ai)) * ptAfter - exp((-ci * lengthi) / ... - (2.0 * ai)) * ptBefore) / (2.0 * ai); - - firstPart = firstPart + (ci * exp((ci * lengthi) / (2.0 * ai)) * ... - me.topPosArray(i, iAfter) - ci * exp((-ci * lengthi) / (2.0 * ai)) * ... - me.topPosArray(i, iBefore)) / (4 * ai); - - pumpLoad = yi * areai * (firstPart + pumpLoad); % + tempLoadValue ? - end - - function [pumpPosition, pumpLoad, status] = calc(me, polishedRodPosition, lastPolishedRodPosition,... - polishedRodLoad) - me.currentSurfacePosition = polishedRodPosition; - me.currentSurfaceLoad = polishedRodLoad; - pumpPosition = -1.0; - pumpLoad = -1.0; - status = -1; - loadMult = 1.0; - tapersAllowed = 1; - - for ii = 2:me.lengthRequired(1) - me.topPosArray(1, ii-1) = me.topPosArray(1, ii); - me.topLoadArray(1, ii-1) = me.topLoadArray(1, ii); - end - - me.topPosArray(1, me.lengthRequired(1)) = -1.0 * polishedRodPosition / 12.0; - - if polishedRodPosition > lastPolishedRodPosition - me.topLoadArray(1, me.lengthRequired(1)) = loadMult * ... - (polishedRodLoad - me.rodWeightFluidTotal) - me.stuffingBoxFriction; - elseif polishedRodPosition < lastPolishedRodPosition - me.topLoadArray(1, me.lengthRequired(1)) = loadMult * ... - (polishedRodLoad - me.rodWeightFluidTotal) + me.stuffingBoxFriction; - else - me.topLoadArray(1, me.lengthRequired(1)) = loadMult * ... - (polishedRodLoad - me.rodWeightFluidTotal); - end - - tap=1; - while tap <= tapersAllowed - me.count(tap) = me.count(tap) + 1; - if me.count(tap) >= me.lengthRequired(tap) - if tap+1 <= me.numTapers - % working our way down to the bottom of the well - for pti = 2:me.lengthRequired(tap+1)+1 - me.topPosArray(tap+1, pti-1) = me.topPosArray(tap+1, pti); - me.topLoadArray(tap+1, pti-1) = me.topLoadArray(tap+1, pti); - end - pumpPosition = me.position(tap); - pumpLoad = me.load(tap); - status = 0; - me.topPosArray(tap+1, me.lengthRequired(tap+1)) = pumpPosition; - me.topLoadArray(tap+1, me.lengthRequired(tap+1)) = pumpLoad; - else - pumpPosition = -12.0 * me.position(tap); % + me.stretch(me.numTapers); - me.currentDownholePosition = pumpPosition; - pumpLoad = me.load(tap) + me.force(me.numTapers); - me.currentDownholeLoad = pumpLoad; - status = 1; - end - me.count(tap) = me.count(tap) - 1; - tapersAllowed = tapersAllowed + 1; - if tapersAllowed > me.numTapers - tapersAllowed = me.numTapers; - end - end - tap = tap + 1; - end + me.currentCard = Card(0); + me.lastCard = Card(0); end + + %% Check if the stroke has ended function directionChanged = checkEndOfStroke(me, numConsecutivePoints) directionChanged = 0; tempDirection = me.DIRECTION_UNKNOWN; @@ -415,15 +112,36 @@ classdef Well < handle end end + + %% Evaluation function for simulated position and load points function evalSim(me, s_pos, s_load) me.positionSensor.read(s_pos); me.loadSensor.read(s_load); - [d_pos, d_load, d_status] = me.calc(me.positionSensor.lastValue, ... - me.positionSensor.history(2), me.loadSensor.lastValue); - if d_status == 1 + [pumpPosition, pumpLoad, status, me.topPosArray, ... + me.topLoadArray, me.count] = pocAlgorithm( ... + me.positionSensor.lastValue, ... + me.positionSensor.history(2), ... + me.loadSensor.lastValue, ... + me.count, ... + me.parameters.dt, ... + me.parameters.a, ... + me.parameters.rodDampingFactors, ... + me.parameters.factorArray, ... + me.parameters.rodLengths, ... + double(me.parameters.lagIndex), ... + me.parameters.rodYMs * 10.0^6, ... + me.parameters.area, ... + me.parameters.lengthRequired, ... + me.parameters.centerPoint, ... + me.parameters.rodWeightFluidTotal, ... + me.parameters.stuffingBoxFriction, ... + me.parameters.force, ... + me.topPosArray, ... + me.topLoadArray); + if status == 1 me.currentCard.push(me.positionSensor.lastValue, ... - me.loadSensor.lastValue, d_pos, d_load); + me.loadSensor.lastValue, pumpPosition, pumpLoad); end if me.checkEndOfStroke(5) == 1 @@ -431,91 +149,66 @@ classdef Well < handle end end + %% End of Stroke actions function endOfStroke(me) - me.currentCard.calcStrokeData(100, me.fluidGradient, me.rodDepthTotal, ... - me.tubingAnchorDepth, me.tubingCrossSectionalArea, ... - me.pumpArea, me.frictionEstimate, ... - me.structuralRating, me.kFactor, me.waterBblRatio, me.oilBblRatio, ... + me.currentCard.calcStrokeData( ... + me.parameters.fluidGradient, ... + me.parameters.rodDepthTotal, ... + me.parameters.tubingAnchorDepth, ... + me.parameters.tubingCrossSectionalArea, ... + me.parameters.pumpArea, ... + me.parameters.frictionEstimate, ... + me.parameters.structuralRating, ... + me.kFactor, ... + me.waterBblRatio, ... + me.oilBblRatio, ... me.gasMcfRatio); - me.plotCards() - me.lastCard = me.currentCard(); + me.lastCard = me.currentCard; me.currentCard = Card(me.lastCard.strokeNumber + 1); end + %% Draws Cards + % Draws current card and shows last card function plotCards(me) - ax1 = subplot(2,2,1); + figure; +% ax1 = subplot(2,2,1); + ax1 = subplot(2,1,1); + hold on; plot(me.lastCard.surfacePosition(1:me.lastCard.numPointsUsed), ... - me.lastCard.surfaceLoad(1:me.lastCard.numPointsUsed)) + me.lastCard.surfaceLoad(1:me.lastCard.numPointsUsed), 'r') + plot(me.lastCard.repSurfacePosition, me.lastCard.repSurfaceLoadTop, 'g'); + plot(me.lastCard.repSurfacePosition, me.lastCard.repSurfaceLoadBottom, 'b'); title('Last Surface Card') + hold off; - ax3 = subplot(2,2,3); +% ax3 = subplot(2,2,3); + ax3 = subplot(2,1,2); + hold on; plot(me.lastCard.downholePosition(1:me.lastCard.numPointsUsed), ... me.lastCard.downholeLoad(1:me.lastCard.numPointsUsed), 'r') + plot(me.lastCard.topCorner.position, me.lastCard.topCorner.load, ... + 'gd', 'MarkerSize', 15, 'LineWidth', 2); + plot(me.lastCard.bottomCorner.position, me.lastCard.bottomCorner.load, ... + 'bd', 'MarkerSize', 15, 'LineWidth', 2); + plot(me.lastCard.repDownholePosition, me.lastCard.repDownholeLoadTop, 'g'); + plot(me.lastCard.repDownholePosition, me.lastCard.repDownholeLoadBottom, 'b'); title('Last Downhole Card') + hold off; - ax2 = subplot(2,2,2); - plot(me.currentCard.surfacePosition(1:me.currentCard.numPointsUsed), ... - me.currentCard.surfaceLoad(1:me.currentCard.numPointsUsed)) - title('Current Surface Card') +% ax2 = subplot(2,2,2); +% plot(me.currentCard.surfacePosition(1:me.currentCard.numPointsUsed), ... +% me.currentCard.surfaceLoad(1:me.currentCard.numPointsUsed)) +% title('Current Surface Card') +% +% ax4 = subplot(2,2,4); +% plot(me.currentCard.downholePosition(1:me.currentCard.numPointsUsed), ... +% me.currentCard.downholeLoad(1:me.currentCard.numPointsUsed), 'r') +% title('Current Downhole Card') - ax4 = subplot(2,2,4); - plot(me.currentCard.downholePosition(1:me.currentCard.numPointsUsed), ... - me.currentCard.downholeLoad(1:me.currentCard.numPointsUsed), 'r') - title('Current Downhole Card') - - linkaxes([ax1, ax2, ax3, ax4], 'x') +% linkaxes([ax1, ax2, ax3, ax4], 'x') + linkaxes([ax1, ax3], 'x') end - - end - - methods(Static) - function wtPerFt = lookupRodWeightPerFoot(i_ym, i_diam) - YM_STEEL=30.5; - YM_FIBERGLASS=7.2; - wtPerFt = -1; - if (i_ym == YM_STEEL) - if (i_diam <= 2 && i_diam > 1.75) - wtPerFt = 10.7; - elseif (i_diam <= 1.75 && i_diam > 1.65) - wtPerFt = 8.2; - elseif (i_diam <= 1.65 && i_diam > 1.5) - wtPerFt = 7; - elseif (i_diam <= 1.5 && i_diam > 1.375) - wtPerFt = 6; - elseif (i_diam <= 1.375 && i_diam > 1.125) - wtPerFt = 5; - elseif (i_diam <= 1.125 && i_diam > 1) - wtPerFt = 3.676; - elseif (i_diam <= 1 && i_diam > 0.875) - wtPerFt = 2.904; - elseif (i_diam <= 0.875 && i_diam > 0.75) - wtPerFt = 2.224; - elseif (i_diam <= 0.75 && i_diam > 0.625) - wtPerFt = 1.634; - elseif (i_diam <= 0.625 && i_diam > 0.5) - wtPerFt = 1.13; - elseif (i_diam <= 0.5) - wtPerFt = 0.72; - else - wtPerFt = 0; - end - elseif (i_ym == YM_FIBERGLASS) - if (i_diam <= 1.25 && i_diam > 1.125) - wtPerFt = 1.2879; - elseif (i_diam <= 1.125 && i_diam > 1) - wtPerFt = 1.09; - elseif (i_diam <= 1 && i_diam > 0.875) - wtPerFt = 0.8188; - elseif (i_diam <= 0.875 && i_diam > 0.75) - wtPerFt = 0.6108; - elseif (i_diam <= 0.75) - wtPerFt = 0.484; - else - wtPerFt = 0; - end - end - end end end \ No newline at end of file diff --git a/WellTestGeneric.mlx b/WellTestGeneric.mlx new file mode 100644 index 0000000..5d54ed2 Binary files /dev/null and b/WellTestGeneric.mlx differ diff --git a/algorithm.m b/algorithm.m deleted file mode 100644 index 96dcf4f..0000000 --- a/algorithm.m +++ /dev/null @@ -1,319 +0,0 @@ -simWell() - -function simWell - wellName = "Mallet"; - - % Current Values - currentSurfacePosition = 0.0; - currentSurfaceLoad = 0.0; - currentDownholePosition = 0.0; - currentDownholeLoad = 0.0; - - currentCard=Card(0); - - % Constants - YM_STEEL=30.5; - YM_FIBERGLASS=7.2; - - % User Inputs - dt = 0.03333333; - tubingHeadPressure = 40.0; - fluidGradient = 0.45; - stuffingBoxFriction = 100.0; - numTapers = 3; - tubingAnchorDepth = 0.0; - pumpDiameter = 2.5; - tubingInnerDiameter = 1.995; - tubingOuterDiameter = 2.375; - structuralRating = 320000; - - % Rod String Inputs - c = [0.08 0.08 0.08]; - rodLength = [1475.0 1525.0 2000.0]; - rodDiameter = [1.0 0.875 0.750]; - rodYM = [YM_STEEL YM_STEEL YM_STEEL]; - rodWeightPerFoot = [Well.lookupRodWeightPerFoot(YM_STEEL, rodDiameter(1)) ... - Well.lookupRodWeightPerFoot(YM_STEEL, rodDiameter(2)) ... - Well.lookupRodWeightPerFoot(YM_STEEL, rodDiameter(3))]; - - % Calculated Taper Parameters - % Initialize - a = zeros(1, numTapers, 'double'); - area = zeros(1, numTapers+1, 'double'); - pressure = zeros(1, numTapers, 'double'); - stretch = zeros(1, numTapers, 'double'); - force = zeros(1, numTapers, 'double'); - alpha = zeros(1, numTapers, 'double'); - xOverA = zeros(1, numTapers, 'double'); - factorArray = zeros(1, numTapers, 'double'); - lagIndex = zeros(1, numTapers, 'uint8'); - lengthRequired = zeros(1, numTapers, 'uint8'); - centerPoint = zeros(1, numTapers, 'uint8'); - count = zeros(1, numTapers, 'uint8'); - - buoyantForceTotal = 0.0; - rodDepthTotal = 0.0; - rodWeightAirTotal = 0.0; - rodWeightFluidTotal = 0.0; - - topPosArray = zeros(10, 250,'double'); - topLoadArray = zeros(10, 250, 'double'); - - % cross-function variables for position and load - % POSITION MUST ALWAYS BE CALLED FIRST. - loadBefore = 0.0; - loadAfter = 0.0; - loadBefore3 = 0.0; - loadAfter3 = 0.0; - tempLoadValue = 0.0; - - for i = 1:numTapers - area(i) = pi / 4 * rodDiameter(i) ^ 2; - end - - for i = 1:numTapers - a(i) = 1000.0 * sqrt(32.3 * rodYM(i) / rodWeightPerFoot(i)); - - % if i > 1 - % rodDepth(i) = rodDepth(i-1) + rodLength(i); - % else - % rodDepth(i) = 0.0; - % end - rodDepthTotal = rodDepthTotal + rodLength(i); - - if i > 1 - pressure(i) = pressure(i - 1) + fluidGradient * rodLength(i); - else - pressure(i) = tubingHeadPressure + fluidGradient * rodLength(i); - end - - % buoyantForce(i) = pressure(i) * (area(i+1) - area(i)); - buoyantForceTotal = buoyantForceTotal + pressure(i) * (area(i+1) - area(i)); - - % rodWeightAir(i) = rodWeightPerFoot(i) * rodLength(i); - rodWeightAirTotal = rodWeightAirTotal + rodWeightPerFoot(i) * rodLength(i); - - % rodWeightFluid(i) = rodWeightAir(i) + buoyantForce(i); - rodWeightFluidTotal = rodWeightFluidTotal + buoyantForceTotal; - end - - for j = 1:numTapers - weightData = 0.0; - annularForceData = 0.0; - - for i = j+1:numTapers - weightData = weightData + rodWeightPerFoot(i) * rodLength(i); - end - - for i = j:numTapers-1 - annularForceData = annularForceData + pressure(i) * (area(i) - area(i+1)); - end - - force(j) = (-area(numTapers) * pressure(numTapers)) + weightData - annularForceData; - alpha(j) = (force(j) + rodWeightPerFoot(j) * rodLength(j)) / (rodYM(j) * power(10, 6) * area(j)); - - if j > 1 - stretch(j) = stretch(j - 1) + alpha(j) * rodLength(j) - ... - (rodWeightPerFoot(j) * power(rodLength(j), 2)) / ... - (2 * rodYM(j) * power(10, 6) * area(j)); - else - stretch(j) = 0.0 + alpha(j) * rodLength(j) - ... - (rodWeightPerFoot(j) * power(rodLength(j), 2)) / ... - (2 * rodYM(j) * power(10, 6) * area(j)); - end - end - - for i = 1:numTapers - xOverA(i) = rodLength(i) / a(i); - lagIndex(i) = floor(rodLength(i) / (a(i) * dt)); - factorArray(i) = (xOverA(i) - double(lagIndex(i)) * dt) / dt; - centerPoint(i) = lagIndex(i) + 2; - lengthRequired(i) = 2 * (lagIndex(i) + 1) + 1; - end - - m = csvread('Mallet No Tag.csv'); - for i = 2:size(m,1) - [dhPos, dhLoad, status] = calc(m(i,1), m(i-1,1), m(i,2)); - if status == 1 - currentCard.push(m(i,1), m(i,2), dhPos, dhLoad); - end - end -% currentCard.surfacePosition -% scatter(currentCard.surfacePosition, currentCard.surfaceLoad) - scatter(currentCard.downholePosition, currentCard.downholeLoad) - - - - - - % FUNCTION DECLARATIONS - - function pumpPosition = position(i) - % Position Function - ai = a(i); - ci = c(i); - factori = factorArray(i); - lengthi = rodLength(i); - lagi = double(lagIndex(i)); - yi = rodYM(i) * power(10, 6); - areai = area(i); - centeri = centerPoint(i); - iBefore = centeri - lagIndex(i); - iAfter = centeri + lagIndex(i); - - pumpPosition = exp(ci * lengthi / (2 * ai)) * (topPosArray(i, iAfter) + ... - factori * topPosArray(i, iAfter+1)); - - pumpPosition = pumpPosition + exp(ci * lengthi / (2 * ai)) * ... - (topPosArray(i,iBefore-1) -topPosArray(i, iBefore)); - - pumpPosition = 0.5 * pumpPosition; - insideIntegral = 0.0; - - for jj = 1:2*lagi-1 - insideIntegral = insideIntegral + dt / (yi * areai) * ... - (exp((-ci * (lagi - jj) *dt) / 2) * ... - topLoadArray(i, iBefore + jj)); - end - - insideIntegral = insideIntegral + 0.5 * dt /(yi * areai) * ... - (exp((-ci * lagi * dt) / 2) * topLoadArray(i, iBefore) + ... - exp((-ci * -lagi * dt) / 2) * topLoadArray(i, iAfter)); - - loadBefore = exp((-ci * lagi * dt) / 2) * topLoadArray(i, iBefore) + ... - factori * (exp((-ci * (lagi + 1) * dt) / 2) * topLoadArray(i, iBefore-1) - ... - exp((-ci * lagi * dt) / 2) * topLoadArray(i, iBefore)); - - loadAfter = exp((-ci * -lagi * dt) / 2) * topLoadArray(i, iAfter) + ... - factori * (exp((-ci * (-lagi - 1) * dt) / 2) * topLoadArray(i, iAfter+1) - ... - exp((-ci * -lagi * dt) / 2) * topLoadArray(i,iAfter)); - - insideIntegral = insideIntegral + 0.5 * factori * dt / (yi * areai) * ... - (loadBefore + exp((-ci * lagi * dt) / 2) * topLoadArray(i, iBefore)); - - insideIntegral = insideIntegral + 0.5 * factori * dt / (yi * areai) * ... - (loadAfter + exp((-ci * -lagi * dt) / 2) * topLoadArray(i, iAfter)); - - insideIntegral = 0.5 * ai * insideIntegral; - pumpPosition = pumpPosition + insideIntegral; - - insideIntegral = 0.0; - - for jj = 1:2*lagi-1 - insideIntegral = insideIntegral + dt * (exp((-ci * (lagi - jj) * dt) / 2) * ... - topPosArray(i, iBefore+jj)); - end - - insideIntegral = insideIntegral + 0.5 * dt * (exp((-ci * lagi * dt) / 2) * ... - topPosArray(i, iBefore) + exp((-ci * -lagi * dt) / 2) * ... - topPosArray(i, iAfter)); - - loadBefore3 = exp((-ci * lagi * dt) / 2) * topPosArray(i, iBefore) + ... - factori * (exp((-ci * (lagi+1) * dt) / 2) * topPosArray(i, iBefore-1) - ... - exp((-ci * lagi * dt) / 2) * topPosArray(i, iBefore)); - - loadAfter3 = exp((-ci * -lagi * dt) / 2) * topPosArray(i, iAfter) + ... - factori * (exp((-ci * (-lagi-1) * dt) / 2) * topPosArray(i, iAfter+1) - ... - exp((-ci * -lagi * dt) / 2) * topPosArray(i, iAfter)); - - insideIntegral = insideIntegral + 0.5 * factori * dt * (loadBefore3 + ... - exp((-ci * lagi * dt) / 2) * topPosArray(i, iBefore)); - - insideIntegral = insideIntegral + 0.5 * factori * dt * (loadAfter3 + ... - exp((-ci * -lagi * dt) / 2) * topPosArray(i, iAfter)); - - insideIntegral = -(ci * lengthi / 4) * 0.5 * (ci / (2 * ai)) * insideIntegral; - tempLoadValue = insideIntegral / lengthi; - pumpPosition = pumpPosition + insideIntegral; - end - - function pumpLoad = load(i) - % Load Function - ai = a(i); - ci = c(i); - factori = factorArray(i); - lengthi = rodLength(i); - lagi = lagIndex(i); - yi = rodYM(i) * power(10, 6); - areai = area(i); - centeri = centerPoint(i); - iBefore = centeri - lagi; - iAfter = centeri + lagi; - - pumpLoad = 0.5 * (ai / (yi * areai)) * (1 / ai) * (loadBefore + loadAfter); - tempResult = yi * areai * pumpLoad; - pumpLoad = pumpLoad - (ci * lengthi / 4) * (0.5 * (ci / (2 * ai))) * (1 / ai) * ... - (loadBefore3 + loadAfter3); - - ptAfter = (topPosArray(i, iAfter+1) - topPosArray(i, iAfter-1)) / (2 * dt); - ptBefore = (topPosArray(i, iBefore+1) - topPosArray(i, iBefore-1)) / (2 * dt); - firstPart = (exp((ci * lengthi) / (2 * ai)) * ptAfter - exp((-ci * lengthi) / ... - (2 * ai)) * ptBefore) / (2 * ai); - - firstPart = firstPart + (ci * exp((ci * lengthi) / (2 * ai)) * ... - topPosArray(i, iAfter) - ci * exp((-ci * lengthi) / (2 * ai)) * ... - topPosArray(i, iBefore)) / (4 * ai); - - pumpLoad = yi * areai * (firstPart + pumpLoad); % + tempLoadValue ? - end - - function [pumpPosition, pumpLoad, status] = calc(polishedRodPosition, lastPolishedRodPosition,... - polishedRodLoad) - pumpPosition = -1.0; - pumpLoad = -1.0; - status = -1; - loadMult = 1.0; - tapersAllowed = 1; - - for ii = 2:lengthRequired(1) - topPosArray(1, ii-1) = topPosArray(1, ii); - topLoadArray(1, ii-1) = topLoadArray(1, ii); - topPosArray(1, lengthRequired(1)) = - polishedRodPosition / 12; - - if polishedRodPosition > lastPolishedRodPosition - topLoadArray(1, lengthRequired(1)) = loadMult * ... - (polishedRodLoad - rodWeightFluidTotal) - stuffingBoxFriction; - elseif polishedRodPosition > lastPolishedRodPosition - topLoadArray(1, lengthRequired(1)) = loadMult * ... - (polishedRodLoad - rodWeightFLuidTotal) + stuffingBoxFriction; - else - topLoadArray(1, lengthRequired(1)) = loadMult * (polishedRodLoad - rodWeightFluidTotal); - end - end - - tap=1; - while tap <= tapersAllowed - count(tap) = count(tap) + 1; - if count(tap) >= lengthRequired(tap) - if tap+1 <= numTapers - % working our way down to the bottom of the well - for pti = 2:lengthRequired(tap+1) - topPosArray(tap+1, pti-1) = topPosArray(tap+1, pti); - topLoadArray(tap+1, pti-1) = topLoadArray(tap+1, pti); - end - pumpPosition = position(tap); - pumpLoad = load(tap); - status = 0; - topPosArray(tap+1, lengthRequired(tap+1)) = pumpPosition; - topLoadArray(tap+1, lengthRequired(tap+1)) = pumpLoad; - else - pumpPosition = -12 * (position(tap) + stretch(numTapers)); - pumpLoad = load(tap) + force(numTapers); - status = 1; - end - count(tap) = count(tap) - 1; - tapersAllowed = tapersAllowed + 1; - if tapersAllowed > numTapers - tapersAllowed = numTapers; - end - end - tap = tap + 1; - end - end -end - - - - - - diff --git a/algorithm.prj b/algorithm.prj new file mode 100644 index 0000000..2d8a26c --- /dev/null +++ b/algorithm.prj @@ -0,0 +1,947 @@ + + + + + + + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + + + + + + option.VerificationStatus.Inactive + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.VerificationStatus.Inactive + + + + + + + + + + + + true + + + + + + option.target.TargetType.MatlabHost + + Generic + MATLAB Host Computer + + + 8 + 16 + 32 + 64 + 64 + 32 + 64 + 64 + 64 + 64 + 64 + option.HardwareEndianness.Little + true + true + option.HardwareAtomicIntegerSize.Char + option.HardwareAtomicFloatSize.None + option.HardwareDivisionRounding.Zero + Generic + MATLAB Host Computer + + false + 8 + 16 + 32 + 64 + 64 + 32 + 64 + 64 + 64 + 64 + 64 + option.HardwareEndianness.Little + true + true + option.HardwareAtomicIntegerSize.Char + option.HardwareAtomicFloatSize.None + option.HardwareDivisionRounding.Zero + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.objective.c + inputTypes + + + + + + option.UseGlobals.No + ${PROJECT_ROOT}/codegen/lib/algorithm/algorithm.a + + true + + + + + + + + + + + true + + + false + false + + true + + + + + + + + + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/algorithm.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> + false + false + true + algorithm_mex + algorithm + option.target.artifact.lib + ${PROJECT_ROOT}/codegen/lib/algorithm/algorithm.a + + false + + option.FixedPointMode.None + + + + + + + + + + + + + + + + + + + + + + + + + _fixpt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${PROJECT_ROOT}/barneyWellTest.mlx + + + ${PROJECT_ROOT}/algorithm.m + + + /Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/codegen/lib/algorithm/algorithm.a + + + + /Applications/MATLAB_R2017a.app + + + + + + + true + + + + + true + + + + + true + true + false + false + false + false + false + false + 10.12.6 + false + true + maci64 + true + + + \ No newline at end of file diff --git a/barneyWellTest.mlx b/barneyWellTest.mlx new file mode 100644 index 0000000..537c5ac Binary files /dev/null and b/barneyWellTest.mlx differ diff --git a/buildInfo.mat b/buildInfo.mat new file mode 100644 index 0000000..c6d18de Binary files /dev/null and b/buildInfo.mat differ diff --git a/html/Well.html b/html/Well.html new file mode 100644 index 0000000..1ecacfe --- /dev/null +++ b/html/Well.html @@ -0,0 +1,1110 @@ + + + + + Well

Contents

classdef Well < handle
+    properties(Constant)
+

Constants (SHOULD THESE BE ELSEWHERE?)

        YM_STEEL=30.5;
+        YM_FIBERGLASS=7.2;
+
+        DIRECTION_UNKNOWN=0;
+        DIRECTION_UP=1;
+        DIRECTION_DOWN=2;
+
    end
+
+    properties
+

Instrumentation

        device;
+        mux;
+        positionSensor;
+        loadSensor;
+

Current Values

        currentSurfacePosition,currentSurfaceLoad;
+        currentDownholePosition,currentDownholeLoad;
+        currentCard=Card(0);
+        lastCard=Card(0);
+        direction=0;
+        lastDirection=0;
+

User Inputs

        wellName;
+        dt = 1.0 / 30.0;
+        tubingHeadPressure = 40.0;
+        fluidGradient = 0.45;
+        stuffingBoxFriction = 100.0;
+        numTapers = 3;
+        tubingAnchorDepth = 0.0;
+        pumpDiameter = 2.5;
+        pumpArea;
+        tubingInnerDiameter = 1.995;
+        tubingOuterDiameter = 2.375;
+        tubingCrossSectionalArea;
+        structuralRating = 320000;
+        frictionEstimate;
+

Production Parameters

        kFactor=1.0;
+        waterBblRatio=0.90;
+        oilBblRatio=0.10;
+        gasMcfRatio=5.0;
+

Rod String Inputs

        c;
+        rodLength;
+        rodDiameter;
+        rodYM;
+        rodWeightPerFoot;
+

Calculated Taper Parameters

        a;
+        area;
+        pressure;
+        stretch;
+        force;
+        alpha;
+        xOverA;
+        factorArray;
+        lagIndex;
+        lengthRequired;
+        centerPoint;
+        count;
+
+        buoyantForceTotal = 0.0;
+        rodDepthTotal = 0.0;
+        rodWeightAirTotal = 0.0;
+        rodWeightFluidTotal = 0.0;
+
    end
+
+    properties(Access=private)
+        topPosArray;
+        topLoadArray;
+
+        % cross-function variables for position and load
+        % POSITION MUST ALWAYS BE CALLED FIRST.
+        loadBefore = 0.0;
+        loadAfter = 0.0;
+        loadBefore3 = 0.0;
+        loadAfter3 = 0.0;
+        tempLoadValue = 0.0;
+    end
+
+    methods
+

Constructor Function

        function me = Well(name, sim)
+            me.wellName = name;
+
+            me.c = [0.8 0.8 0.8];
+            me.rodLength = [1475.0 1525.0 2000.0];
+            me.rodDiameter = [1.0 0.875 0.750];
+            me.rodYM = [me.YM_STEEL me.YM_STEEL me.YM_STEEL];
+            me.rodWeightPerFoot = [Well.lookupRodWeightPerFoot(me.rodYM(1), me.rodDiameter(1)) ...
+                Well.lookupRodWeightPerFoot(me.rodYM(2), me.rodDiameter(2)) ...
+                Well.lookupRodWeightPerFoot(me.rodYM(3), me.rodDiameter(3))];
+
+            % Initialize
+            me.a = zeros(1, me.numTapers, 'double');
+            me.area = zeros(1, me.numTapers+1, 'double');
+            me.pressure = zeros(1, me.numTapers, 'double');
+            me.stretch = zeros(1, me.numTapers, 'double');
+            me.force = zeros(1, me.numTapers, 'double');
+            me.alpha = zeros(1, me.numTapers, 'double');
+            me.xOverA = zeros(1, me.numTapers, 'double');
+            me.factorArray = zeros(1, me.numTapers, 'double');
+            me.lagIndex = zeros(1, me.numTapers, 'uint8');
+            me.lengthRequired = zeros(1, me.numTapers, 'uint8');
+            me.centerPoint = zeros(1, me.numTapers, 'uint8');
+            me.count = zeros(1, me.numTapers, 'uint8');
+            me.topPosArray = zeros(10, 250,'double');
+            me.topLoadArray = zeros(10, 250, 'double');
+
+            if logical(sim)
+                me.device = 0;
+                me.mux = MuxSetupSim(me.device);
+                me.positionSensor = AnalogInputSim(me.mux, 1, 0.0, 65535.0, 0.0, 65535.0);
+                me.loadSensor = AnalogInputSim(me.mux, 2, 0.0, 65535.0, 0.0, 65535.0);
+            else
+                me.device = raspi('10.0.0.106', 'pi', 'HenryPump@1903');
+                me.mux = MuxSetupSim(me.device);
+                me.positionSensor = AnalogInput(mux, 1, 0.0, 65535.0, 0.0, 140.0);
+                me.loadSensor = AnalogInput(mux, 2, 0.0, 65535.0, 0.0, 50000.0);
+            end
+
+            me.wellSetup();
+        end
+
Not enough input arguments.
+
+Error in Well (line 96)
+            me.wellName = name;
+

Well Setup Function

        function wellSetup(me)
+            me.tubingCrossSectionalArea = (pi / 4) * ...
+                (power(me.tubingOuterDiameter, 2) - ...
+                power(me.tubingInnerDiameter,2));
+            me.pumpArea = power(me.pumpDiameter, 2)  * pi;
+
+            for i = 1:me.numTapers
+                me.area(i) = pi / 4 * power(me.rodDiameter(i), 2);
+            end
+
+            for i = 1:me.numTapers
+                me.a(i) = 1000.0 * sqrt(32.2 * me.rodYM(i) * me.area(i) / me.rodWeightPerFoot(i));
+                me.rodDepthTotal = me.rodDepthTotal + me.rodLength(i);
+
+                if i > 1
+                    me.pressure(i) = me.pressure(i - 1) + me.fluidGradient * me.rodLength(i);
+                else
+                    me.pressure(i) = me.tubingHeadPressure + me.fluidGradient * me.rodLength(i);
+                end
+
+                me.buoyantForceTotal = me.buoyantForceTotal + me.pressure(i) * (me.area(i+1) - me.area(i));
+                me.rodWeightAirTotal = me.rodWeightAirTotal + me.rodWeightPerFoot(i) * me.rodLength(i);
+                me.rodWeightFluidTotal = me.rodWeightAirTotal + me.buoyantForceTotal;
+            end
+
+            for j = 1:me.numTapers
+                weightData = 0.0;
+                annularForceData = 0.0;
+
+                for i = j+1:me.numTapers
+                    weightData = weightData + me.rodWeightPerFoot(i) * me.rodLength(i);
+                end
+
+                for i = j:me.numTapers-1
+                    annularForceData = annularForceData + me.pressure(i) * (me.area(i) - me.area(i+1));
+                end
+
+                me.force(j) = (-me.area(me.numTapers) * me.pressure(me.numTapers)) + weightData - annularForceData;
+                me.alpha(j) = (me.force(j) + me.rodWeightPerFoot(j) * me.rodLength(j)) / (me.rodYM(j) * power(10, 6) * me.area(j));
+
+                if j > 1
+                    me.stretch(j) = me.stretch(j - 1) + me.alpha(j) * me.rodLength(j) - ...
+                        (me.rodWeightPerFoot(j) * power(me.rodLength(j), 2.0)) / ...
+                        (2.0 * me.rodYM(j) * power(10, 6) * me.area(j));
+                else
+                    me.stretch(j) = 0.0 + me.alpha(j) * me.rodLength(j) - ...
+                        (me.rodWeightPerFoot(j) * power(me.rodLength(j), 2.0)) / ...
+                        (2.0 * me.rodYM(j) * power(10, 6) * me.area(j));
+                end
+            end
+
+            for i = 1:me.numTapers
+                me.xOverA(i) = me.rodLength(i) / me.a(i);
+                me.lagIndex(i) = floor(me.rodLength(i) / (me.a(i) * me.dt));
+                me.factorArray(i) = (me.xOverA(i) - double(me.lagIndex(i)) * me.dt) / me.dt;
+                me.centerPoint(i) = me.lagIndex(i) + 2;
+                me.lengthRequired(i) = 2 * (me.lagIndex(i) + 1) + 1;
+            end
+
+            me.frictionEstimate = me.rodDepthTotal * 0.10;
+        end
+

Position Function (From Algorithm)

        function pumpPosition = position(me, i)
+            % Position Function
+            ai = me.a(i);
+            ci = me.c(i);
+            factori = me.factorArray(i);
+            lengthi = me.rodLength(i);
+            lagi = double(me.lagIndex(i));
+            yi = me.rodYM(i) * power(10, 6);
+            areai = me.area(i);
+            centeri = me.centerPoint(i);
+            iBefore = centeri - me.lagIndex(i);
+            iAfter = centeri + me.lagIndex(i);
+
+            me.loadBefore = 0.0;
+            me.loadAfter = 0.0;
+            me.loadBefore3 = 0.0;
+            me.loadAfter3 = 0.0;
+
+            pumpPosition = exp(ci * lengthi / (2.0 * ai)) * (me.topPosArray(i, iAfter) + ...
+                factori * (me.topPosArray(i, iAfter+1) - me.topPosArray(i, iAfter)));
+
+            pumpPosition = pumpPosition + exp(-ci * lengthi / (2.0 * ai)) * ...
+                (me.topPosArray(i,iBefore) + factori * (me.topPosArray(i,iBefore-1) - ...
+                me.topPosArray(i, iBefore)));
+
+            pumpPosition = 0.5 * pumpPosition;
+            insideIntegral = 0.0;
+
+            for jj = 1:2*lagi-1
+                insideIntegral = insideIntegral + me.dt / (yi * areai) * ...
+                    (exp((-ci * (lagi - jj) *me.dt) / 2.0) * ...
+                    me.topLoadArray(i, iBefore + jj));
+            end
+
+            insideIntegral = insideIntegral + 0.5 * me.dt /(yi * areai) * ...
+                (exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore) + ...
+                exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i, iAfter));
+
+            me.loadBefore = exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore) + ...
+                factori * (exp((-ci * (lagi + 1) * me.dt) / 2.0) * me.topLoadArray(i, iBefore-1) - ...
+                exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore));
+
+            me.loadAfter = exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i, iAfter) + ...
+                factori * (exp((-ci * (-lagi - 1) * me.dt) / 2.0) * me.topLoadArray(i, iAfter+1) - ...
+                exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i,iAfter));
+
+            insideIntegral = insideIntegral + 0.5 * factori * me.dt / (yi * areai) * ...
+                (me.loadBefore + exp((-ci * lagi * me.dt) / 2.0) * me.topLoadArray(i, iBefore));
+
+            insideIntegral = insideIntegral + 0.5 * factori * me.dt / (yi * areai) * ...
+                (me.loadAfter + exp((-ci * -lagi * me.dt) / 2.0) * me.topLoadArray(i, iAfter));
+
+            insideIntegral = 0.5 * ai * insideIntegral;
+            pumpPosition = pumpPosition + insideIntegral;
+
+            insideIntegral = 0.0;
+
+            for jj = 1:2*lagi-1
+                insideIntegral = insideIntegral + me.dt * (exp((-ci * (lagi - jj) * me.dt) / 2.0) * ...
+                    me.topPosArray(i, iBefore+jj));
+            end
+
+            insideIntegral = insideIntegral + 0.5 * me.dt * (exp((-ci * lagi * me.dt) / 2.0) * ...
+                me.topPosArray(i, iBefore) + exp((-ci * -lagi * me.dt) / 2.0) * ...
+                me.topPosArray(i, iAfter));
+
+            me.loadBefore3 = exp((-ci * lagi * me.dt) / 2.0) * me.topPosArray(i, iBefore) + ...
+                factori * (exp((-ci * (lagi+1) * me.dt) / 2.0) * me.topPosArray(i, iBefore-1) - ...
+                exp((-ci * lagi * me.dt) / 2.0) * me.topPosArray(i, iBefore));
+
+            me.loadAfter3 = exp((-ci * -lagi * me.dt) / 2.0) * me.topPosArray(i, iAfter) + ...
+                factori * (exp((-ci * (-lagi-1) * me.dt) / 2.0) * me.topPosArray(i, iAfter+1) - ...
+                exp((-ci * -lagi * me.dt) / 2.0) * me.topPosArray(i, iAfter));
+
+            insideIntegral = insideIntegral + 0.5 * factori * me.dt * (me.loadBefore3 + ...
+                exp((-ci * lagi * me.dt) / 2.0) * me.topPosArray(i, iBefore));
+
+            insideIntegral = insideIntegral + 0.5 * factori * me.dt * (me.loadAfter3 + ...
+                exp((-ci * -lagi * me.dt) / 2.0) * me.topPosArray(i, iAfter));
+
+            insideIntegral = -(ci * lengthi / 4) * 0.5 * (ci / (2.0 * ai)) * insideIntegral;
+            me.tempLoadValue = insideIntegral / lengthi;
+            pumpPosition = pumpPosition + insideIntegral;
+        end
+

Load Function (From Algorithm)

        function pumpLoad = load(me, i)
+            % Load Function
+            ai = me.a(i);
+            ci = me.c(i);
+            lengthi = me.rodLength(i);
+            lagi = me.lagIndex(i);
+            yi = me.rodYM(i) * power(10, 6);
+            areai = me.area(i);
+            centeri = me.centerPoint(i);
+            iBefore = centeri - lagi;
+            iAfter = centeri + lagi;
+
+            pumpLoad = 0.5 * (ai / (yi * areai)) * (1 / ai) * (me.loadBefore + me.loadAfter);
+            tempResult = yi * areai * pumpLoad;
+            pumpLoad = pumpLoad - (ci * lengthi / 4) * (0.5 * (ci / (2.0 * ai))) * (1 / ai) * ...
+                (me.loadBefore3 + me.loadAfter3);
+
+            ptAfter = (me.topPosArray(i, iAfter+1) - me.topPosArray(i, iAfter-1)) / (2.0 * me.dt);
+            ptBefore = (me.topPosArray(i, iBefore+1) - me.topPosArray(i, iBefore-1)) / (2.0 * me.dt);
+            firstPart = (exp((ci * lengthi) / (2.0 * ai)) * ptAfter - exp((-ci * lengthi) / ...
+                (2.0 * ai)) * ptBefore) / (2.0 * ai);
+
+            firstPart = firstPart + (ci * exp((ci * lengthi) / (2.0 * ai)) * ...
+                me.topPosArray(i, iAfter) - ci * exp((-ci * lengthi) / (2.0 * ai)) * ...
+                me.topPosArray(i, iBefore)) / (4 * ai);
+
+            pumpLoad = yi * areai * (firstPart + pumpLoad); % + tempLoadValue ?
+        end
+

Calc Function

Calls position and load functions

        function [pumpPosition, pumpLoad, status] = calc(me, polishedRodPosition, lastPolishedRodPosition,...
+            polishedRodLoad)
+            me.currentSurfacePosition = polishedRodPosition;
+            me.currentSurfaceLoad = polishedRodLoad;
+            pumpPosition = -1.0;
+            pumpLoad = -1.0;
+            status = -1;
+            loadMult = 1.0;
+            tapersAllowed = 1;
+
+            for ii = 2:me.lengthRequired(1)
+                me.topPosArray(1, ii-1) = me.topPosArray(1, ii);
+                me.topLoadArray(1, ii-1) = me.topLoadArray(1, ii);
+            end
+
+            me.topPosArray(1, me.lengthRequired(1)) = -1.0 * polishedRodPosition / 12.0;
+
+            if polishedRodPosition > lastPolishedRodPosition
+                me.topLoadArray(1, me.lengthRequired(1)) = loadMult * ...
+                    (polishedRodLoad - me.rodWeightFluidTotal) - me.stuffingBoxFriction;
+            elseif polishedRodPosition < lastPolishedRodPosition
+                me.topLoadArray(1, me.lengthRequired(1)) = loadMult * ...
+                    (polishedRodLoad - me.rodWeightFluidTotal) + me.stuffingBoxFriction;
+            else
+                me.topLoadArray(1, me.lengthRequired(1)) = loadMult * ...
+                    (polishedRodLoad - me.rodWeightFluidTotal);
+            end
+
+            tap=1;
+            while tap <= tapersAllowed
+                me.count(tap) = me.count(tap) + 1;
+                if me.count(tap) >= me.lengthRequired(tap)
+                    if tap+1 <= me.numTapers
+                        % working our way down to the bottom of the well
+                        for pti = 2:me.lengthRequired(tap+1)+1
+                            me.topPosArray(tap+1, pti-1) = me.topPosArray(tap+1, pti);
+                            me.topLoadArray(tap+1, pti-1) = me.topLoadArray(tap+1, pti);
+                        end
+                        pumpPosition = me.position(tap);
+                        pumpLoad = me.load(tap);
+                        status = 0;
+                        me.topPosArray(tap+1, me.lengthRequired(tap+1)) = pumpPosition;
+                        me.topLoadArray(tap+1, me.lengthRequired(tap+1)) = pumpLoad;
+                    else
+                        pumpPosition = -12.0 * me.position(tap); % + me.stretch(me.numTapers);
+                        me.currentDownholePosition = pumpPosition;
+                        pumpLoad = me.load(tap) + me.force(me.numTapers);
+                        me.currentDownholeLoad = pumpLoad;
+                        status = 1;
+                    end
+                    me.count(tap) = me.count(tap) - 1;
+                    tapersAllowed = tapersAllowed + 1;
+                    if tapersAllowed > me.numTapers
+                        tapersAllowed = me.numTapers;
+                    end
+                end
+                tap = tap + 1;
+            end
+        end
+

Check if the stroke has ended

        function directionChanged = checkEndOfStroke(me, numConsecutivePoints)
+            directionChanged = 0;
+            tempDirection = me.DIRECTION_UNKNOWN;
+            startDirection = me.DIRECTION_UNKNOWN;
+            consecutivePointsAllSameDirection = 1;
+
+            if me.positionSensor.history(1) > me.positionSensor.history(2)
+                tempDirection = me.DIRECTION_UP;
+                startDirection = me.DIRECTION_UP;
+            elseif me.positionSensor.history(1) < me.positionSensor.history(2)
+                tempDirection = me.DIRECTION_DOWN;
+                startDirection = me.DIRECTION_DOWN;
+            end
+
+            if startDirection == me.DIRECTION_UP
+
+                for i = 1:numConsecutivePoints
+                    if me.positionSensor.history(i) <= me.positionSensor.history(i+1)
+                        consecutivePointsAllSameDirection = 0;
+                    end
+                end
+
+                if consecutivePointsAllSameDirection == 1
+                    tempDirection = me.DIRECTION_UP;
+                end
+
+            elseif startDirection == me.DIRECTION_DOWN
+
+                for i = 1:numConsecutivePoints
+                    if me.positionSensor.history(i) >= me.positionSensor.history(i+1)
+                        consecutivePointsAllSameDirection = 0;
+                    end
+                end
+
+                if consecutivePointsAllSameDirection == 1
+                    tempDirection = me.DIRECTION_DOWN;
+                end
+            end
+
+            if tempDirection ~= me.lastDirection
+                if (tempDirection == me.DIRECTION_UP) && ...
+                        (me.currentCard.numPointsUsed > 1)
+                    directionChanged = 1;
+                end
+                me.lastDirection = tempDirection;
+            end
+        end
+

Evaluation function for simulated position and load points

        function evalSim(me, s_pos, s_load)
+            me.positionSensor.read(s_pos);
+            me.loadSensor.read(s_load);
+
+            [d_pos, d_load, d_status] = me.calc(me.positionSensor.lastValue, ...
+                me.positionSensor.history(2), me.loadSensor.lastValue);
+            if d_status == 1
+                me.currentCard.push(me.positionSensor.lastValue, ...
+                    me.loadSensor.lastValue, d_pos, d_load);
+            end
+
+            if me.checkEndOfStroke(5) == 1
+                me.endOfStroke()
+            end
+        end
+

End of Stroke actions

        function endOfStroke(me)
+            me.currentCard.calcStrokeData(100, me.fluidGradient, me.rodDepthTotal, ...
+                me.tubingAnchorDepth, me.tubingCrossSectionalArea, ...
+                me.pumpArea, me.frictionEstimate, ...
+                me.structuralRating, me.kFactor, me.waterBblRatio, me.oilBblRatio, ...
+                me.gasMcfRatio);
+            me.plotCards()
+
+            me.lastCard = me.currentCard();
+            me.currentCard = Card(me.lastCard.strokeNumber + 1);
+        end
+

Draws Cards

Draws current card and shows last card

        function plotCards(me)
+            ax1 = subplot(2,2,1);
+            plot(me.lastCard.surfacePosition(1:me.lastCard.numPointsUsed), ...
+                me.lastCard.surfaceLoad(1:me.lastCard.numPointsUsed))
+            title('Last Surface Card')
+
+            ax3 = subplot(2,2,3);
+            plot(me.lastCard.downholePosition(1:me.lastCard.numPointsUsed), ...
+                me.lastCard.downholeLoad(1:me.lastCard.numPointsUsed), 'r')
+            title('Last Downhole Card')
+
+            ax2 = subplot(2,2,2);
+            plot(me.currentCard.surfacePosition(1:me.currentCard.numPointsUsed), ...
+                me.currentCard.surfaceLoad(1:me.currentCard.numPointsUsed))
+            title('Current Surface Card')
+
+            ax4 = subplot(2,2,4);
+            plot(me.currentCard.downholePosition(1:me.currentCard.numPointsUsed), ...
+                me.currentCard.downholeLoad(1:me.currentCard.numPointsUsed), 'r')
+            title('Current Downhole Card')
+
+            linkaxes([ax1, ax2, ax3, ax4], 'x')
+
+        end
+
    end
+
+    methods(Static)
+

Determines Rod Weight Per Foot given Young's Modulus and Diameter

        function wtPerFt = lookupRodWeightPerFoot(i_ym, i_diam)
+            YM_STEEL=30.5;
+            YM_FIBERGLASS=7.2;
+            wtPerFt = -1;
+            if (i_ym == YM_STEEL)
+                if (i_diam <= 2 && i_diam > 1.75)
+                    wtPerFt = 10.7;
+                elseif (i_diam <= 1.75 && i_diam > 1.65)
+                    wtPerFt = 8.2;
+                elseif (i_diam <= 1.65 && i_diam > 1.5)
+                    wtPerFt = 7;
+                elseif (i_diam <= 1.5 && i_diam > 1.375)
+                    wtPerFt = 6;
+                elseif (i_diam <= 1.375 && i_diam > 1.125)
+                    wtPerFt = 5;
+                elseif (i_diam <= 1.125 && i_diam > 1)
+                    wtPerFt = 3.676;
+                elseif (i_diam <= 1 && i_diam > 0.875)
+                    wtPerFt = 2.904;
+                elseif (i_diam <= 0.875 && i_diam > 0.75)
+                    wtPerFt = 2.224;
+                elseif (i_diam <= 0.75 && i_diam > 0.625)
+                    wtPerFt = 1.634;
+                elseif (i_diam <= 0.625 && i_diam > 0.5)
+                    wtPerFt = 1.13;
+                elseif (i_diam <= 0.5)
+                    wtPerFt = 0.72;
+                else
+                    wtPerFt = 0;
+                end
+            elseif (i_ym == YM_FIBERGLASS)
+                if (i_diam <= 1.25 && i_diam > 1.125)
+                    wtPerFt = 1.2879;
+                elseif (i_diam <= 1.125 && i_diam > 1)
+                    wtPerFt = 1.09;
+                elseif (i_diam <= 1 && i_diam > 0.875)
+                    wtPerFt = 0.8188;
+                elseif (i_diam <= 0.875 && i_diam > 0.75)
+                    wtPerFt = 0.6108;
+                elseif (i_diam <= 0.75)
+                    wtPerFt = 0.484;
+                else
+                    wtPerFt = 0;
+                end
+            end
+        end
+
    end
+end
+
\ No newline at end of file diff --git a/mongo-java-driver-3.4.2.jar b/mongo-java-driver-3.4.2.jar deleted file mode 100644 index 1149adf..0000000 Binary files a/mongo-java-driver-3.4.2.jar and /dev/null differ diff --git a/pocAlgorithm.m b/pocAlgorithm.m new file mode 100644 index 0000000..6c79f6d --- /dev/null +++ b/pocAlgorithm.m @@ -0,0 +1,182 @@ +%% computeLoadPositionStatus Function +function [pumpPosition, pumpLoad, status, topPosArray, topLoadArray, ... + count] = pocAlgorithm(polishedRodPosition, lastPolishedRodPosition, ... + polishedRodLoad, count, dt, a, c, factorArray, rodLengths, lagIndex, ... + rodYMs, area, lengthRequired, centerPoint, rodWeightFluidTotal, ... + stuffingBoxFriction, force, topPosArray, topLoadArray) + + pumpPosition = -1.0; + pumpLoad = -1.0; + status = -1; + loadMult = 1.0; + tapersAllowed = 1; + + numTapers = length(rodLengths); + + for ii = 2:lengthRequired(1) + topPosArray(1, ii-1) = topPosArray(1, ii); + topLoadArray(1, ii-1) = topLoadArray(1, ii); + end + + topPosArray(1, lengthRequired(1)) = -1.0 * polishedRodPosition / 12.0; + + if polishedRodPosition > lastPolishedRodPosition + topLoadArray(1, lengthRequired(1)) = loadMult * ... + (polishedRodLoad - rodWeightFluidTotal) - stuffingBoxFriction; + elseif polishedRodPosition < lastPolishedRodPosition + topLoadArray(1, lengthRequired(1)) = loadMult * ... + (polishedRodLoad - rodWeightFluidTotal) + stuffingBoxFriction; + else + topLoadArray(1, lengthRequired(1)) = loadMult * ... + (polishedRodLoad - rodWeightFluidTotal); + end + + tap=1; + while tap <= tapersAllowed + count(tap) = count(tap) + 1; + if count(tap) >= lengthRequired(tap) + if tap+1 <= numTapers + % working our way down to the bottom of the well + for pti = 2:lengthRequired(tap+1)+1 + topPosArray(tap+1, pti-1) = topPosArray(tap+1, pti); + topLoadArray(tap+1, pti-1) = topLoadArray(tap+1, pti); + end + [pumpPosition, pumpLoad] = positionLoadI(dt, a(tap), ... + c(tap), factorArray(tap), rodLengths(tap), ... + lagIndex(tap), rodYMs(tap), area(tap), ... + centerPoint(tap), topPosArray(tap,:), topLoadArray(tap,:)); + status = 0; + topPosArray(tap+1, lengthRequired(tap+1)) = pumpPosition; + topLoadArray(tap+1, lengthRequired(tap+1)) = pumpLoad; + else + [position, load] = positionLoadI(dt, a(tap), ... + c(tap), factorArray(tap), rodLengths(tap), ... + lagIndex(tap), rodYMs(tap), area(tap), ... + centerPoint(tap), topPosArray(tap,:), topLoadArray(tap,:)); + pumpPosition = -12.0 * position; + pumpLoad = load + force(numTapers); + status = 1; + end + count(tap) = count(tap) - 1; + tapersAllowed = tapersAllowed + 1; + if tapersAllowed > numTapers + tapersAllowed = numTapers; + end + end + tap = tap + 1; + end +end + + +%% Position and Load Function +% This function calculates the position and load for a given taper +function [pumpPosition, pumpLoad] = positionLoadI(dt, ai, ci, factori, ... + lengthi, lagi, yi, areai, centeri, topPosArrayI, topLoadArrayI) + + % FUNCTION PARAMETERS + % dt [seconds] = amount of time between measurements + % ai [?] = a value for the specific taper + % ci [?] = damping factor for the taper + % factori [?] = factor value for the taper + % lengthi [feet] = length of the taper + % lagi [?] = lag index of the taper + % yi [?] = youngs modulus for the taper + % (SHOULD BE 7.2 * 10^6 or 30.6 * 10^6) + % areai [in^2] = annulus area of the taper + % centeri [?] = centerpoint of the taper + % topPosArrayI [] = array of position values + % topLoadArrayI [] = array of load values + + + iBefore = centeri - lagi; + iAfter = centeri + lagi; + + %% Position Calculation + pumpPosition = exp(ci * lengthi / (2.0 * ai)) * (topPosArrayI(iAfter) + ... + factori * (topPosArrayI(iAfter+1) - topPosArrayI(iAfter))); + + pumpPosition = pumpPosition + exp(-ci * lengthi / (2.0 * ai)) * ... + (topPosArrayI(iBefore) + factori * (topPosArrayI(iBefore-1) - ... + topPosArrayI(iBefore))); + + pumpPosition = 0.5 * pumpPosition; + insideIntegral = 0.0; + + for jj = 1:2*lagi-1 + insideIntegral = insideIntegral + dt / (yi * areai) * ... + (exp((-ci * (lagi - jj) * dt) / 2.0) * ... + topLoadArrayI(iBefore + jj)); + end + + insideIntegral = insideIntegral + 0.5 * dt /(yi * areai) * ... + (exp((-ci * lagi * dt) / 2.0) * topLoadArrayI(iBefore) + ... + exp((-ci * -lagi * dt) / 2.0) * topLoadArrayI(iAfter)); + + loadBefore = exp((-ci * lagi * dt) / 2.0) * topLoadArrayI(iBefore) + ... + factori * (exp((-ci * (lagi + 1) * dt) / 2.0) * topLoadArrayI(iBefore-1) - ... + exp((-ci * lagi * dt) / 2.0) * topLoadArrayI(iBefore)); + + loadAfter = exp((-ci * -lagi * dt) / 2.0) * topLoadArrayI(iAfter) + ... + factori * (exp((-ci * (-lagi - 1) * dt) / 2.0) * topLoadArrayI(iAfter+1) - ... + exp((-ci * -lagi * dt) / 2.0) * topLoadArrayI(iAfter)); + + insideIntegral = insideIntegral + 0.5 * factori * dt / (yi * areai) * ... + (loadBefore + exp((-ci * lagi * dt) / 2.0) * topLoadArrayI(iBefore)); + + insideIntegral = insideIntegral + 0.5 * factori * dt / (yi * areai) * ... + (loadAfter + exp((-ci * -lagi * dt) / 2.0) * topLoadArrayI(iAfter)); + + insideIntegral = 0.5 * ai * insideIntegral; + pumpPosition = pumpPosition + insideIntegral; + + insideIntegral = 0.0; + + for jj = 1:2*lagi-1 + insideIntegral = insideIntegral + dt * (exp((-ci * (lagi - jj) * dt) / 2.0) * ... + topPosArrayI(iBefore+jj)); + end + + insideIntegral = insideIntegral + 0.5 * dt * (exp((-ci * lagi * dt) / 2.0) * ... + topPosArrayI(iBefore) + exp((-ci * -lagi * dt) / 2.0) * ... + topPosArrayI(iAfter)); + + loadBefore3 = exp((-ci * lagi * dt) / 2.0) * topPosArrayI(iBefore) + ... + factori * (exp((-ci * (lagi+1) * dt) / 2.0) * topPosArrayI(iBefore-1) - ... + exp((-ci * lagi * dt) / 2.0) * topPosArrayI(iBefore)); + + loadAfter3 = exp((-ci * -lagi * dt) / 2.0) * topPosArrayI(iAfter) + ... + factori * (exp((-ci * (-lagi-1) * dt) / 2.0) * topPosArrayI(iAfter+1) - ... + exp((-ci * -lagi * dt) / 2.0) * topPosArrayI(iAfter)); + + insideIntegral = insideIntegral + 0.5 * factori * dt * (loadBefore3 + ... + exp((-ci * lagi * dt) / 2.0) * topPosArrayI(iBefore)); + + insideIntegral = insideIntegral + 0.5 * factori * dt * (loadAfter3 + ... + exp((-ci * -lagi * dt) / 2.0) * topPosArrayI(iAfter)); + + insideIntegral = -(ci * lengthi / 4) * 0.5 * (ci / (2.0 * ai)) * insideIntegral; + pumpPosition = pumpPosition + insideIntegral; + + %% Load Calculation + pumpLoad = 0.5 * (ai / (yi * areai)) * (1 / ai) * (loadBefore + loadAfter); + pumpLoad = pumpLoad - (ci * lengthi / 4) * (0.5 * (ci / (2.0 * ai))) * (1 / ai) * ... + (loadBefore3 + loadAfter3); + + ptAfter = (topPosArrayI(iAfter+1) - topPosArrayI(iAfter-1)) / (2.0 * dt); + ptBefore = (topPosArrayI(iBefore+1) - topPosArrayI(iBefore-1)) / (2.0 * dt); + firstPart = (exp((ci * lengthi) / (2.0 * ai)) * ptAfter - exp((-ci * lengthi) / ... + (2.0 * ai)) * ptBefore) / (2.0 * ai); + + firstPart = firstPart + (ci * exp((ci * lengthi) / (2.0 * ai)) * ... + topPosArrayI(iAfter) - ci * exp((-ci * lengthi) / (2.0 * ai)) * ... + topPosArrayI(iBefore)) / (4 * ai); + + pumpLoad = yi * areai * (firstPart + pumpLoad); +end + + + + + + + diff --git a/pocAlgorithm.prj b/pocAlgorithm.prj new file mode 100644 index 0000000..de17b7a --- /dev/null +++ b/pocAlgorithm.prj @@ -0,0 +1,1002 @@ + + + + false + false + option.WorkingFolder.Project + + option.BuildFolder.Project + + + true + true + true + true + option.GlobalDataSyncMethod.SyncAlways + true + option.DynamicMemoryAllocation.Threshold + 65536 + 200000 + option.FilePartitionMethod.MapMFileToCFile + true + false + + false + true + false + false + + false + option.VerificationMode.None + option.VerificationStatus.Passed + + + + + + + + + false + 40000 + 50 + true + option.PreserveVariableNames.None + option.TargetLang.C + true + 10 + 200 + 4000 + true + 64 + true + true + option.ConstantInputs.CheckValues + true + false + false + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + option.WorkingFolder.Project + + option.BuildFolder.Project + + + true + false + true + true + option.DynamicMemoryAllocation.Threshold + 65536 + 200000 + false + option.FilePartitionMethod.MapMFileToCFile + true + option.CommentStyle.Auto + false + true + option.DataTypeReplacement.CBuiltIn + false + true + true + true + option.ParenthesesLevel.Nominal + 31 + $M$N + $M$N + $M$N + $M$N + $M$N + $M$N + emxArray_$M$N + emx$M$N + + false + false + true + true + false + false + false + false + false + false + + false + false + option.VerificationMode.None + option.VerificationStatus.Inactive + + + + + + + + + C89/C90 (ANSI) + None + false + true + Automatically locate an installed toolchain + Faster Builds + + true + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ctdata><configuredHardware/></ctdata> + option.target.TargetType.Custom + + Texas Instruments + C2000 + + true + 16 + 16 + 16 + 32 + 64 + 32 + 64 + 16 + 32 + 32 + 32 + option.HardwareEndianness.Little + true + false + option.HardwareAtomicIntegerSize.Int + option.HardwareAtomicFloatSize.None + option.HardwareDivisionRounding.Zero + Texas Instruments + C2000 + + false + 16 + 16 + 16 + 32 + 64 + 32 + 64 + 16 + 32 + 32 + 32 + option.HardwareEndianness.Little + true + false + option.HardwareAtomicIntegerSize.Int + option.HardwareAtomicFloatSize.None + option.HardwareDivisionRounding.Zero + option.CastingMode.Nominal + option.IndentStyle.K&R + 2 + 40000 + 50 + true + true + option.GenerateExampleMain.GenerateCodeOnly + option.PreserveVariableNames.None + option.TargetLang.C + option.CCompilerOptimization.Off + + true + false + make_rtw + default_tmf + + 10 + 200 + 4000 + false + true + 64 + true + true + true + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.WorkingFolder.Project + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.objective.c + workflowSummary + + barneyWellTest + + config + false + false + column + option.UseGlobals.No + ${PROJECT_ROOT}/codegen/lib/pocAlgorithm/pocAlgorithm.a + R2012a + true + true + + + + + + + + true + + false + false + 1024 + 2048 + false + true + 2565199857 + + false + false + + true + + codegen/lib/pocAlgorithm + C_CODE + 1609615845 + codegen/mex/pocAlgorithm + 2604771377 + barneyWellTest + false + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><checksum><includedFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/pocAlgorithm.m</file></includedFiles><value>4064048825</value></checksum> + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/pocAlgorithm.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> + false + false + true + pocAlgorithm_mex + pocAlgorithm + option.target.artifact.lib + ${PROJECT_ROOT}/codegen/lib/pocAlgorithm/pocAlgorithm.a + true + false + + option.FixedPointMode.None + false + + + 16 + 4 + 0 + fimath('RoundingMethod', 'Floor', 'OverflowAction', 'Wrap', 'ProductMode', 'FullPrecision', 'MaxProductWordLength', 128, 'SumMode', 'FullPrecision', 'MaxSumWordLength', 128) + option.FixedPointTypeSource.SimAndDerived + + false + false + false + false + true + + + + + + + + + true + false + _fixpt + + false + false + option.DefaultFixedPointSignedness.Automatic + option.FixedPointTypeProposalMode.ProposeFractionLengths + false + option.fixedPointAction.none + + + + + + + + false + option.FixedPointAnalysisMode.Sim + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1504726901447 + + + + ${PROJECT_ROOT}/barneyWellTest.mlx + + + + + + + + + + + + + + + + + + + + + + + + + + double + 1 x 1 + + + false + false + + + double + 1 x :10 + + + true + false + + + uint16 + 1 x :10 + + + true + false + + + double + :10 x 100 + + + true + false + + + + + + + /Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/codegen/lib/pocAlgorithm/pocAlgorithm.a + + + + /Applications/MATLAB_R2017a.app + + + + + + + true + + + + + true + + + + + true + true + false + false + false + false + false + false + 10.12.6 + false + true + maci64 + true + + + \ No newline at end of file diff --git a/pocAlgorithm_mex.mexmaci64 b/pocAlgorithm_mex.mexmaci64 new file mode 100644 index 0000000..c504efd Binary files /dev/null and b/pocAlgorithm_mex.mexmaci64 differ diff --git a/pocAlgorithm_pkg.zip b/pocAlgorithm_pkg.zip new file mode 100644 index 0000000..d93bcc6 Binary files /dev/null and b/pocAlgorithm_pkg.zip differ diff --git a/test.m b/test.m deleted file mode 100644 index 116740a..0000000 --- a/test.m +++ /dev/null @@ -1,16 +0,0 @@ - -malletData = csvread('mallet.csv'); -mallet = Well("Mallet", true(1)); -figure; -for loops = 1:6 - for i = 2:size(malletData,1) - mallet.evalSim(malletData(i,1), malletData(i,2)); - end -end - -% mallet.currentCard.calcStrokeData(100, mallet.fluidGradient, mallet.rodDepthTotal, ... -% mallet.tubingAnchorDepth, mallet.tubingCrossSectionalArea, ... -% mallet.pumpArea, mallet.frictionEstimate, ... -% mallet.structuralRating, mallet.kFactor, mallet.waterBblRatio, mallet.oilBblRatio, ... -% mallet.gasMcfRatio) - diff --git a/wellSetup.m b/wellSetup.m new file mode 100644 index 0000000..db34106 --- /dev/null +++ b/wellSetup.m @@ -0,0 +1,207 @@ +%% Well Setup Function +function wellParams = wellSetup(... + dt, ... + rodLengths, ... + rodDiameters, ... + rodMaterials, ... + rodDampingFactors, ... + tubingHeadPressure, ... + stuffingBoxFriction, ... + fluidGradient, ... + pumpDiameter,... + tubingOuterDiameter, ... + tubingInnerDiameter, ... + tubingAnchorDepth, ... + structuralRating) + + % FUNCTION PARAMETERS + % dt + % rodLengths + % rodDiameters + % rodMaterials + % tubingHeadPressure + % pumpDiameter + % tubingOuterDiameter + % tubingInnerDiameter + wellParams = struct(); + wellParams.dt = dt; + wellParams.rodLengths = rodLengths; + wellParams.rodDiameters = rodDiameters; + wellParams.rodMaterials = rodMaterials; + wellParams.rodDampingFactors = rodDampingFactors; + wellParams.tubingHeadPressure = tubingHeadPressure; + wellParams.stuffingBoxFriction = stuffingBoxFriction; + wellParams.fluidGradient = fluidGradient; + wellParams.pumpDiameter = pumpDiameter; + wellParams.tubingOuterDiameter = tubingOuterDiameter; + wellParams.tubingInnerDiameter = tubingInnerDiameter; + wellParams.tubingAnchorDepth = tubingAnchorDepth; + wellParams.structuralRating = structuralRating; + + numTapers = length(rodLengths); + wellParams.numTapers = numTapers; + + + + wellParams.tubingCrossSectionalArea = (pi / 4) * ... + (power(tubingOuterDiameter, 2) - ... + power(tubingInnerDiameter,2)); + + wellParams.pumpArea = power(pumpDiameter, 2) * pi; + + % Calculated Taper Parameters + area = zeros(1, numTapers+1); + a = zeros(1, numTapers); + pressure = zeros(1, numTapers); + rodYMs = zeros(1, numTapers); + rodWeightPerFoots = zeros(1, numTapers); + force = zeros(1, numTapers); + alpha = zeros(1, numTapers); + stretch = zeros(1, numTapers); + xOverA = zeros(1, numTapers); + lagIndex = zeros(1, numTapers, 'uint16'); + factorArray = zeros(1, numTapers); + centerPoint = zeros(1, numTapers, 'uint16'); + lengthRequired = zeros(1, numTapers, 'uint16'); + + + % Calculated Rod String Totals + rodDepthTotal = 0.0; + buoyantForceTotal = 0.0; + rodWeightAirTotal = 0.0; + + + for i = 1:numTapers + area(i) = pi / 4 * power(rodDiameters(i), 2); + + if lower(rodMaterials(i)) == "fiberglass" + rodYMs(i) = 7.2; + else + rodYMs(i) = 30.5; + end + + rodWeightPerFoots(i) = lookupRodWeightPerFoot(rodYMs(i), ... + rodDiameters(i)); + end + wellParams.area = area; + wellParams.rodYMs = rodYMs; + wellParams.rodWeightPerFoots = rodWeightPerFoots; + + for i = 1:numTapers + a(i) = 1000.0 * sqrt(32.2 * rodYMs(i) * area(i) / rodWeightPerFoots(i)); + rodDepthTotal = rodDepthTotal + rodLengths(i); + + if i > 1 + pressure(i) = pressure(i - 1) + fluidGradient * rodLengths(i); + else + pressure(i) = tubingHeadPressure + fluidGradient * rodLengths(i); + end + + buoyantForceTotal = buoyantForceTotal + pressure(i) * (area(i+1) - area(i)); + rodWeightAirTotal = rodWeightAirTotal + rodWeightPerFoots(i) * rodLengths(i); + rodWeightFluidTotal = rodWeightAirTotal + buoyantForceTotal; + end + + wellParams.a = a; + wellParams.rodDepthTotal = rodDepthTotal; + wellParams.pressure = pressure; + wellParams.buoyantForceTotal = buoyantForceTotal; + wellParams.rodWeightAirTotal = rodWeightAirTotal; + wellParams.rodWeightFluidTotal = rodWeightFluidTotal; + + + for j = 1:numTapers + weightData = 0.0; + annularForceData = 0.0; + + for i = j+1:numTapers + weightData = weightData + rodWeightPerFoots(i) * rodLengths(i); + end + + for i = j:numTapers-1 + annularForceData = annularForceData + pressure(i) * (area(i) - area(i+1)); + end + + force(j) = (-area(numTapers) * pressure(numTapers)) + weightData - annularForceData; + alpha(j) = (force(j) + rodWeightPerFoots(j) * rodLengths(j)) / (rodYMs(j) * power(10, 6) * area(j)); + + if j > 1 + stretch(j) = stretch(j - 1) + alpha(j) * rodLengths(j) - ... + (rodWeightPerFoots(j) * power(rodLengths(j), 2.0)) / ... + (2.0 * rodYMs(j) * power(10, 6) * area(j)); + else + stretch(j) = 0.0 + alpha(j) * rodLengths(j) - ... + (rodWeightPerFoots(j) * power(rodLengths(j), 2.0)) / ... + (2.0 * rodYMs(j) * power(10, 6) * area(j)); + end + end + wellParams.force = force; + wellParams.alpha = alpha; + wellParams.stretch = stretch; + + for i = 1:numTapers + xOverA(i) = rodLengths(i) / a(i); + lagIndex(i) = floor(rodLengths(i) / (a(i) * dt)); + factorArray(i) = (xOverA(i) - double(lagIndex(i)) * dt) / dt; + centerPoint(i) = lagIndex(i) + 2; + lengthRequired(i) = 2 * (lagIndex(i) + 1) + 1; + end + + wellParams.xOverA = xOverA; + wellParams.lagIndex = lagIndex; + wellParams.factorArray = factorArray; + wellParams.centerPoint = centerPoint; + wellParams.lengthRequired = lengthRequired; + + frictionEstimate = rodDepthTotal * 0.10; + wellParams.frictionEstimate = frictionEstimate; +end + +%% Determines Rod Weight Per Foot given Young's Modulus and Diameter +function wtPerFt = lookupRodWeightPerFoot(i_ym, i_diam) + YM_STEEL=30.5; + YM_FIBERGLASS=7.2; + wtPerFt = -1; + if (i_ym == YM_STEEL) + if (i_diam <= 2 && i_diam > 1.75) + wtPerFt = 10.7; + elseif (i_diam <= 1.75 && i_diam > 1.65) + wtPerFt = 8.2; + elseif (i_diam <= 1.65 && i_diam > 1.5) + wtPerFt = 7; + elseif (i_diam <= 1.5 && i_diam > 1.375) + wtPerFt = 6; + elseif (i_diam <= 1.375 && i_diam > 1.125) + wtPerFt = 5; + elseif (i_diam <= 1.125 && i_diam > 1) + wtPerFt = 3.676; + elseif (i_diam <= 1 && i_diam > 0.875) + wtPerFt = 2.904; + elseif (i_diam <= 0.875 && i_diam > 0.75) + wtPerFt = 2.224; + elseif (i_diam <= 0.75 && i_diam > 0.625) + wtPerFt = 1.634; + elseif (i_diam <= 0.625 && i_diam > 0.5) + wtPerFt = 1.13; + elseif (i_diam <= 0.5) + wtPerFt = 0.72; + else + wtPerFt = 0; + end + elseif (i_ym == YM_FIBERGLASS) + if (i_diam <= 1.25 && i_diam > 1.125) + wtPerFt = 1.2879; + elseif (i_diam <= 1.125 && i_diam > 1) + wtPerFt = 1.09; + elseif (i_diam <= 1 && i_diam > 0.875) + wtPerFt = 0.8188; + elseif (i_diam <= 0.875 && i_diam > 0.75) + wtPerFt = 0.6108; + elseif (i_diam <= 0.75) + wtPerFt = 0.484; + else + wtPerFt = 0; + end + end +end + diff --git a/wellSetup.prj b/wellSetup.prj new file mode 100644 index 0000000..ee95f83 --- /dev/null +++ b/wellSetup.prj @@ -0,0 +1,947 @@ + + + + + + + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + + + + + + option.VerificationStatus.Inactive + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.VerificationStatus.Inactive + + + + + + + + + + + + true + + + + + + option.target.TargetType.MatlabHost + + Generic + MATLAB Host Computer + + + 8 + 16 + 32 + 64 + 64 + 32 + 64 + 64 + 64 + 64 + 64 + option.HardwareEndianness.Little + true + true + option.HardwareAtomicIntegerSize.Char + option.HardwareAtomicFloatSize.None + option.HardwareDivisionRounding.Zero + Generic + MATLAB Host Computer + + false + 8 + 16 + 32 + 64 + 64 + 32 + 64 + 64 + 64 + 64 + 64 + option.HardwareEndianness.Little + true + true + option.HardwareAtomicIntegerSize.Char + option.HardwareAtomicFloatSize.None + option.HardwareDivisionRounding.Zero + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.BuildFolder.Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + option.objective.c + inputTypes + + + + + + option.UseGlobals.No + ${PROJECT_ROOT}/codegen/lib/wellSetup/wellSetup.a + + true + + + + + + + + + + + true + + + false + false + + true + + + + + + + + + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/wellSetup.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> + false + false + true + wellSetup_mex + wellSetup + option.target.artifact.lib + ${PROJECT_ROOT}/codegen/lib/wellSetup/wellSetup.a + + false + + option.FixedPointMode.None + + + + + + + + + + + + + + + + + + + + + + + + + _fixpt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${PROJECT_ROOT}/barneyWellTest.mlx + + + ${PROJECT_ROOT}/wellSetup.m + + + /Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/codegen/lib/wellSetup/wellSetup.a + + + + /Applications/MATLAB_R2017a.app + + + + + + + true + + + + + true + + + + + true + true + false + false + false + false + false + false + 10.12.6 + false + true + maci64 + true + + + \ No newline at end of file diff --git a/welldata/456.csv b/welldata/456.csv new file mode 100644 index 0000000..8844a1b --- /dev/null +++ b/welldata/456.csv @@ -0,0 +1,189 @@ +0,11578.90039 +0,11784 +0.300000012,11826.90039 +0.699999988,12008.09961 +1.100000024,12065.2998 +1.600000024,12122.5 +2.200000048,12289.5 +2.900000095,12375.2998 +3.799999952,12384.7998 +4.599999905,12446.7998 +5.599999905,12613.7002 +6.599999905,12680.5 +7.599999905,12766.2998 +8.800000191,12837.90039 +10.10000038,12809.2998 +11.30000019,12785.40039 +12.60000038,12752 +14.10000038,12723.40039 +15.5,12737.7002 +17,12809.2998 +18.60000038,12981 +20.20000076,13171.7002 +21.89999962,13443.5 +23.5,13653.40039 +25.20000076,13910.90039 +26.89999962,14154.09961 +28.70000076,14292.40039 +30.39999962,14306.7002 +32.20000076,14259 +34.20000076,14168.40039 +36.09999847,14154.09961 +38,14177.90039 +39.90000153,14192.2998 +41.90000153,14230.40039 +43.90000153,14273.2998 +45.90000153,14249.5 +47.90000153,14268.59961 +49.90000153,14344.90039 +52.09999847,14464.09961 +54.20000076,14554.7002 +56.20000076,14559.5 +58.29999924,14535.59961 +60.40000153,14483.2002 +62.5,14430.7002 +64.59999847,14344.90039 +66.69999695,14325.7998 +68.90000153,14249.5 +71.09999847,14163.59961 +73.09999847,14087.2998 +73.90000153,14020.59961 +76,13915.7002 +78,13820.2998 +80,13810.7002 +82,13863.2002 +84,13834.59961 +85.90000153,13724.90039 +88,13629.5 +90,13496 +91.90000153,13252.7998 +93.80000305,13076.2998 +95.69999695,12775.90039 +97.59999847,12456.40039 +99.40000153,11936.59961 +101.1999969,11679 +102.9000015,11669.5 +104.5999985,11693.2998 +106.3000031,11669.5 +107.9000015,11598 +109.5,11140.2002 +111,10868.2998 +112.3000031,10782.5 +113.5999985,10725.2998 +115,10505.90039 +116.1999969,10281.7998 +117.4000015,10057.59961 +118.4000015,9814.400391 +119.4000015,9728.599609 +120.3000031,9609.299805 +121.0999985,9533 +121.9000015,9356.599609 +122.6999969,9161.099609 +123.4000015,9056.099609 +124,9075.200195 +124.4000015,9070.400391 +124.9000015,9103.799805 +125.1999969,9180.099609 +125.5999985,9237.400391 +125.8000031,9204 +126,9156.299805 +126.0999985,9146.799805 +126.1999969,9108.599609 +126.1999969,9118.099609 +126.1999969,9027.5 +126.1999969,8898.799805 +126.1999969,8960.799805 +126.0999985,8951.200195 +125.9000015,9037.099609 +125.6999969,9227.799805 +125.3000031,9165.799805 +125,9056.099609 +124.5,8922.599609 +124.1999969,8612.599609 +123.6999969,8417.099609 +123.1999969,8393.299805 +122.5,8345.599609 +121.9000015,8188.200195 +121.3000031,8102.399902 +120.5999985,8107.100098 +119.9000015,8140.5 +119.0999985,8193 +118.3000031,8150.100098 +117.4000015,8040.399902 +116.5999985,7830.5 +115.5999985,7673.200195 +114.6999969,7563.5 +113.6999969,7449 +112.5999985,7348.899902 +111.5999985,7158.100098 +110.4000015,7143.799805 +109.1999969,7091.399902 +108.0999985,6829.100098 +106.9000015,6743.200195 +105.5999985,6690.799805 +104.3000031,6628.799805 +103,6719.399902 +101.6999969,6776.600098 +100.4000015,6800.5 +99,6795.700195 +97.5,6781.399902 +96.09999847,6810 +94.59999847,6852.899902 +93,6767.100098 +91.40000153,6585.899902 +89.80000305,6461.899902 +88.19999695,6409.399902 +86.5,6471.399902 +84.80000305,6652.600098 +83.09999847,6728.899902 +81.30000305,6795.700195 +79.5,6829.100098 +77.80000305,6891.100098 +75.90000153,6938.799805 +74,6948.299805 +72.09999847,6953.100098 +70.19999695,6929.200195 +68.09999847,6929.200195 +66.09999847,6943.5 +64,6986.399902 +62,7034.100098 +59.79999924,7077 +57.70000076,7139 +55.59999847,7210.600098 +53.5,7239.200195 +51.20000076,7234.399902 +49,7263 +46.70000076,7320.299805 +44.5,7377.5 +42.29999924,7582.600098 +40.09999847,7735.200195 +37.90000153,7744.700195 +35.79999924,7792.399902 +33.70000076,7821 +31.60000038,7859.100098 +29.5,7868.700195 +27.5,7816.200195 +25.39999962,7816.200195 +23.39999962,7883 +21.39999962,7959.299805 +19.39999962,8264.5 +17.70000076,8460 +16,8617.400391 +14.19999981,8708 +12.60000038,8817.700195 +11.10000038,8908.299805 +9.699999809,9018 +8.399999619,9070.400391 +7.099999905,9122.900391 +5.900000095,9218.299805 +4.900000095,9423.299805 +3.900000095,9604.599609 +3,9766.700195 +2.299999952,9924.099609 +1.600000024,10095.7998 +1.100000024,10238.7998 +0.699999988,10448.7002 +0.300000012,10682.2998 +0.100000001,10806.2998 +0,10954.2002 +0,11168.7998 \ No newline at end of file diff --git a/welldata/Mallet_No_Tag.csv b/welldata/Mallet_No_Tag.csv new file mode 100644 index 0000000..89fd004 --- /dev/null +++ b/welldata/Mallet_No_Tag.csv @@ -0,0 +1,676 @@ +0,9776.026 +0.005469917,9889.581 +0.013863833,10032.636 +0.025325333,10243.539 +0.040032,10488.118 +0.058248417,10661.443 +0.07980025,10718.797 +0.104515583,10687.978 +0.132326083,10620.406 +0.16308075,10498.72 +0.195990667,10401.043 +0.232066417,10441.696 +0.271218583,10526.409 +0.313498083,10628.152 +0.359020417,10737.421 +0.407674083,10845.921 +0.4593205,10926.294 +0.51380025,11047.595 +0.571258167,11276.132 +0.63128025,11503.57 +0.693512167,11739.085 +0.758432417,11992.673 +0.826354917,12256.92 +0.89726725,12511.497 +0.9712875,12731.464 +1.048186583,12876.278 +1.127629,12925.886 +1.20959525,12924.183 +1.293956833,12923.688 +1.380850583,13030.321 +1.470691583,13306.049 +1.562806,13623.199 +1.656998333,13950.403 +1.753329083,14278.376 +1.852025333,14574.101 +1.952786833,14803.847 +2.055333167,15081.718 +2.159586667,15410.35 +2.265318833,15706.46 +2.3733975,16035.092 +2.484817583,16412.453 +2.59948025,16801.681 +2.71644175,17036.536 +2.834529167,16972.534 +2.95454075,16866.287 +3.0765375,16790.748 +3.201042417,16735.592 +3.328021917,16637.255 +3.457062,16447.942 +3.587754333,16175.73 +3.7197685,15843.802 +3.853573333,15517.477 +3.989576583,15256.582 +4.127587917,15145.994 +4.26697625,15090.343 +4.407120917,14970.086 +4.548720667,14891.362 +4.692186667,14842.962 +4.837357167,14740.34 +4.98334575,14499.057 +5.129595167,14326.721 +5.27664525,14369.901 +5.424664833,14485.104 +5.573320667,14591.681 +5.722529083,14679.086 +5.8719985,14766.051 +6.021790083,14919.434 +6.171415167,15126.162 +6.321026,15310.2 +6.470778417,15376.069 +6.62113375,15440.62 +6.771690917,15476 +6.92142425,15446.828 +7.070682583,15428.04 +7.219948833,15377.058 +7.369218333,15312.727 +7.517862583,15275.865 +7.665456333,15279.6 +7.81258175,15273.283 +7.95967025,15173.133 +8.106388583,15022.496 +8.251937833,14858.125 +8.39614225,14745.339 +8.53943,14636.839 +8.681693667,14430.496 +8.822886833,14220.802 +8.96252875,14055.937 +9.100747583,13982.486 +9.237511083,13908.102 +9.372204667,13851.627 +9.504688833,13881.018 +9.634593417,13925.517 +9.762460917,14039.895 +9.88810475,14149.439 +10.01133025,14239.756 +10.13194283,14293.484 +10.24966075,14316.173 +10.36420408,14430.991 +10.47555567,14679.855 +10.58395958,14924.489 +10.68960167,15012.168 +10.79186508,15026.451 +10.89072792,15122.316 +10.98580667,15239.826 +11.07743458,15393.979 +11.16544292,15480.175 +11.24972158,15551.648 +11.33033592,15622.736 +11.4071015,15593.4 +11.48018525,15485.943 +11.54942825,15270.646 +11.61424633,14921.577 +11.674432,14544.71 +11.72986992,14224.263 +11.78069242,13971.114 +11.82665033,13684.399 +11.86771467,13375.159 +11.90365167,13002.742 +11.93385692,12640.544 +11.95854375,12384.043 +11.97725417,12122.214 +11.99019917,11907.961 +11.99821617,11556.585 +12,10818.453 +11.99437833,10218.872 +11.98168992,9974.513 +11.96236683,9966.822 +11.93623683,10046.975 +11.90283792,10210.082 +11.86283425,10566.073 +11.81606508,10971.727 +11.76242917,11263.277 +11.70194025,11417.265 +11.635014,11506.812 +11.56213983,11355.131 +11.48255125,10783.129 +11.39636908,9951.934 +11.30301192,9180.95 +11.2028855,8568.624 +11.09612617,8027.276 +10.98281183,7570.531 +10.86439075,7120.324 +10.74053733,6429.602 +10.61033417,5731.465 +10.47414308,5262.799 +10.331585,4993.608 +10.18328317,4887.8 +10.02944475,4866.045 +9.870938667,4903.347 +9.708080667,4908.126 +9.541035917,4860.331 +9.370086833,4740.019 +9.194264167,4623.608 +9.011303833,4806.163 +8.823120833,5495.896 +8.630679917,6335.056 +8.434706083,7096.646 +8.235212917,7736.001 +8.031737583,8240.211 +7.823389583,8565.273 +7.609442167,8874.732 +7.394066333,9242.04 +7.18177575,9725.045 +6.971143917,10100.648 +6.76005725,10223.652 +6.547905917,10202.061 +6.335514583,10102.626 +6.1247145,10005.552 +5.915829583,9948.583 +5.70865225,9976.106 +5.502857083,10010.661 +5.29959525,9951.22 +5.0998445,9703.729 +4.90439275,9250.665 +4.712906583,8789.8 +4.525125833,8425.513 +4.34108925,8209.502 +4.161316917,8221.533 +3.985825667,8288.006 +3.81218425,8331.242 +3.639778833,8203.953 +3.47038125,8070.566 +3.30502375,8083.531 +3.144516,8198.954 +2.9875085,8453.806 +2.833456917,8828.805 +2.683372083,9145.351 +2.538298167,9273.079 +2.397747333,9299.449 +2.261532,9382.898 +2.128944,9634.838 +1.9997345,9987.423 +1.874468417,10264.305 +1.754004833,10515.696 +1.638998417,10693.087 +1.529095667,10687.429 +1.423291583,10592.882 +1.320598583,10505.588 +1.221731833,10531.792 +1.12771575,10595.739 +1.038479333,10568.875 +0.95374375,10443.948 +0.873229167,10212.17 +0.796579167,9881.834 +0.723449833,9552.763 +0.653880417,9342.464 +0.587873833,9236.052 +0.525776833,9193.421 +0.467945417,9160.623 +0.413685,9046.41 +0.362936583,8910.99 +0.315684333,8743.488 +0.271219,8566.646 +0.230005083,8550.44 +0.1921475,8679.871 +0.158036583,8881.379 +0.127829583,9023.831 +0.1008755,9046.739 +0.076851667,9062.177 +0.055667083,9212.429 +0.037832833,9532.985 +0.0232665,9776.026 +0.012359417,9889.581 +0.005017167,10032.636 +0.000966833,10243.539 +0,10488.118 +0.005469917,10661.443 +0.013863833,10718.797 +0.025325333,10687.978 +0.040032,10620.406 +0.058248417,10498.72 +0.07980025,10401.043 +0.104515583,10441.696 +0.132326083,10526.409 +0.16308075,10628.152 +0.195990667,10737.421 +0.232066417,10845.921 +0.271218583,10926.294 +0.313498083,11047.595 +0.359020417,11276.132 +0.407674083,11503.57 +0.4593205,11739.085 +0.51380025,11992.673 +0.571258167,12256.92 +0.63128025,12511.497 +0.693512167,12731.464 +0.758432417,12876.278 +0.826354917,12925.886 +0.89726725,12924.183 +0.9712875,12923.688 +1.048186583,13030.321 +1.127629,13306.049 +1.20959525,13623.199 +1.293956833,13950.403 +1.380850583,14278.376 +1.470691583,14574.101 +1.562806,14803.847 +1.656998333,15081.718 +1.753329083,15410.35 +1.852025333,15706.46 +1.952786833,16035.092 +2.055333167,16412.453 +2.159586667,16801.681 +2.265318833,17036.536 +2.3733975,16972.534 +2.484817583,16866.287 +2.59948025,16790.748 +2.71644175,16735.592 +2.834529167,16637.255 +2.95454075,16447.942 +3.0765375,16175.73 +3.201042417,15843.802 +3.328021917,15517.477 +3.457062,15256.582 +3.587754333,15145.994 +3.7197685,15090.343 +3.853573333,14970.086 +3.989576583,14891.362 +4.127587917,14842.962 +4.26697625,14740.34 +4.407120917,14499.057 +4.548720667,14326.721 +4.692186667,14369.901 +4.837357167,14485.104 +4.98334575,14591.681 +5.129595167,14679.086 +5.27664525,14766.051 +5.424664833,14919.434 +5.573320667,15126.162 +5.722529083,15310.2 +5.8719985,15376.069 +6.021790083,15440.62 +6.171415167,15476 +6.321026,15446.828 +6.470778417,15428.04 +6.62113375,15377.058 +6.771690917,15312.727 +6.92142425,15275.865 +7.070682583,15279.6 +7.219948833,15273.283 +7.369218333,15173.133 +7.517862583,15022.496 +7.665456333,14858.125 +7.81258175,14745.339 +7.95967025,14636.839 +8.106388583,14430.496 +8.251937833,14220.802 +8.39614225,14055.937 +8.53943,13982.486 +8.681693667,13908.102 +8.822886833,13851.627 +8.96252875,13881.018 +9.100747583,13925.517 +9.237511083,14039.895 +9.372204667,14149.439 +9.504688833,14239.756 +9.634593417,14293.484 +9.762460917,14316.173 +9.88810475,14430.991 +10.01133025,14679.855 +10.13194283,14924.489 +10.24966075,15012.168 +10.36420408,15026.451 +10.47555567,15122.316 +10.58395958,15239.826 +10.68960167,15393.979 +10.79186508,15480.175 +10.89072792,15551.648 +10.98580667,15622.736 +11.07743458,15593.4 +11.16544292,15485.943 +11.24972158,15270.646 +11.33033592,14921.577 +11.4071015,14544.71 +11.48018525,14224.263 +11.54942825,13971.114 +11.61424633,13684.399 +11.674432,13375.159 +11.72986992,13002.742 +11.78069242,12640.544 +11.82665033,12384.043 +11.86771467,12122.214 +11.90365167,11907.961 +11.93385692,11556.585 +11.95854375,10818.453 +11.97725417,10218.872 +11.99019917,9974.513 +11.99821617,9966.822 +12,10046.975 +11.99437833,10210.082 +11.98168992,10566.073 +11.96236683,10971.727 +11.93623683,11263.277 +11.90283792,11417.265 +11.86283425,11506.812 +11.81606508,11355.131 +11.76242917,10783.129 +11.70194025,9951.934 +11.635014,9180.95 +11.56213983,8568.624 +11.48255125,8027.276 +11.39636908,7570.531 +11.30301192,7120.324 +11.2028855,6429.602 +11.09612617,5731.465 +10.98281183,5262.799 +10.86439075,4993.608 +10.74053733,4887.8 +10.61033417,4866.045 +10.47414308,4903.347 +10.331585,4908.126 +10.18328317,4860.331 +10.02944475,4740.019 +9.870938667,4623.608 +9.708080667,4806.163 +9.541035917,5495.896 +9.370086833,6335.056 +9.194264167,7096.646 +9.011303833,7736.001 +8.823120833,8240.211 +8.630679917,8565.273 +8.434706083,8874.732 +8.235212917,9242.04 +8.031737583,9725.045 +7.823389583,10100.648 +7.609442167,10223.652 +7.394066333,10202.061 +7.18177575,10102.626 +6.971143917,10005.552 +6.76005725,9948.583 +6.547905917,9976.106 +6.335514583,10010.661 +6.1247145,9951.22 +5.915829583,9703.729 +5.70865225,9250.665 +5.502857083,8789.8 +5.29959525,8425.513 +5.0998445,8209.502 +4.90439275,8221.533 +4.712906583,8288.006 +4.525125833,8331.242 +4.34108925,8203.953 +4.161316917,8070.566 +3.985825667,8083.531 +3.81218425,8198.954 +3.639778833,8453.806 +3.47038125,8828.805 +3.30502375,9145.351 +3.144516,9273.079 +2.9875085,9299.449 +2.833456917,9382.898 +2.683372083,9634.838 +2.538298167,9987.423 +2.397747333,10264.305 +2.261532,10515.696 +2.128944,10693.087 +1.9997345,10687.429 +1.874468417,10592.882 +1.754004833,10505.588 +1.638998417,10531.792 +1.529095667,10595.739 +1.423291583,10568.875 +1.320598583,10443.948 +1.221731833,10212.17 +1.12771575,9881.834 +1.038479333,9552.763 +0.95374375,9342.464 +0.873229167,9236.052 +0.796579167,9193.421 +0.723449833,9160.623 +0.653880417,9046.41 +0.587873833,8910.99 +0.525776833,8743.488 +0.467945417,8566.646 +0.413685,8550.44 +0.362936583,8679.871 +0.315684333,8881.379 +0.271219,9023.831 +0.230005083,9046.739 +0.1921475,9062.177 +0.158036583,9212.429 +0.127829583,9532.985 +0.1008755,9862.826 +0.076851667,10190.689 +0.055667083,10424.885 +0.037832833,10515.421 +0.0232665,9776.026 +0.012359417,9889.581 +0.005017167,10032.636 +0.000966833,10243.539 +0,10488.118 +0.005469917,10661.443 +0.013863833,10718.797 +0.025325333,10687.978 +0.040032,10620.406 +0.058248417,10498.72 +0.07980025,10401.043 +0.104515583,10441.696 +0.132326083,10526.409 +0.16308075,10628.152 +0.195990667,10737.421 +0.232066417,10845.921 +0.271218583,10926.294 +0.313498083,11047.595 +0.359020417,11276.132 +0.407674083,11503.57 +0.4593205,11739.085 +0.51380025,11992.673 +0.571258167,12256.92 +0.63128025,12511.497 +0.693512167,12731.464 +0.758432417,12876.278 +0.826354917,12925.886 +0.89726725,12924.183 +0.9712875,12923.688 +1.048186583,13030.321 +1.127629,13306.049 +1.20959525,13623.199 +1.293956833,13950.403 +1.380850583,14278.376 +1.470691583,14574.101 +1.562806,14803.847 +1.656998333,15081.718 +1.753329083,15410.35 +1.852025333,15706.46 +1.952786833,16035.092 +2.055333167,16412.453 +2.159586667,16801.681 +2.265318833,17036.536 +2.3733975,16972.534 +2.484817583,16866.287 +2.59948025,16790.748 +2.71644175,16735.592 +2.834529167,16637.255 +2.95454075,16447.942 +3.0765375,16175.73 +3.201042417,15843.802 +3.328021917,15517.477 +3.457062,15256.582 +3.587754333,15145.994 +3.7197685,15090.343 +3.853573333,14970.086 +3.989576583,14891.362 +4.127587917,14842.962 +4.26697625,14740.34 +4.407120917,14499.057 +4.548720667,14326.721 +4.692186667,14369.901 +4.837357167,14485.104 +4.98334575,14591.681 +5.129595167,14679.086 +5.27664525,14766.051 +5.424664833,14919.434 +5.573320667,15126.162 +5.722529083,15310.2 +5.8719985,15376.069 +6.021790083,15440.62 +6.171415167,15476 +6.321026,15446.828 +6.470778417,15428.04 +6.62113375,15377.058 +6.771690917,15312.727 +6.92142425,15275.865 +7.070682583,15279.6 +7.219948833,15273.283 +7.369218333,15173.133 +7.517862583,15022.496 +7.665456333,14858.125 +7.81258175,14745.339 +7.95967025,14636.839 +8.106388583,14430.496 +8.251937833,14220.802 +8.39614225,14055.937 +8.53943,13982.486 +8.681693667,13908.102 +8.822886833,13851.627 +8.96252875,13881.018 +9.100747583,13925.517 +9.237511083,14039.895 +9.372204667,14149.439 +9.504688833,14239.756 +9.634593417,14293.484 +9.762460917,14316.173 +9.88810475,14430.991 +10.01133025,14679.855 +10.13194283,14924.489 +10.24966075,15012.168 +10.36420408,15026.451 +10.47555567,15122.316 +10.58395958,15239.826 +10.68960167,15393.979 +10.79186508,15480.175 +10.89072792,15551.648 +10.98580667,15622.736 +11.07743458,15593.4 +11.16544292,15485.943 +11.24972158,15270.646 +11.33033592,14921.577 +11.4071015,14544.71 +11.48018525,14224.263 +11.54942825,13971.114 +11.61424633,13684.399 +11.674432,13375.159 +11.72986992,13002.742 +11.78069242,12640.544 +11.82665033,12384.043 +11.86771467,12122.214 +11.90365167,11907.961 +11.93385692,11556.585 +11.95854375,10818.453 +11.97725417,10218.872 +11.99019917,9974.513 +11.99821617,9966.822 +12,10046.975 +11.99437833,10210.082 +11.98168992,10566.073 +11.96236683,10971.727 +11.93623683,11263.277 +11.90283792,11417.265 +11.86283425,11506.812 +11.81606508,11355.131 +11.76242917,10783.129 +11.70194025,9951.934 +11.635014,9180.95 +11.56213983,8568.624 +11.48255125,8027.276 +11.39636908,7570.531 +11.30301192,7120.324 +11.2028855,6429.602 +11.09612617,5731.465 +10.98281183,5262.799 +10.86439075,4993.608 +10.74053733,4887.8 +10.61033417,4866.045 +10.47414308,4903.347 +10.331585,4908.126 +10.18328317,4860.331 +10.02944475,4740.019 +9.870938667,4623.608 +9.708080667,4806.163 +9.541035917,5495.896 +9.370086833,6335.056 +9.194264167,7096.646 +9.011303833,7736.001 +8.823120833,8240.211 +8.630679917,8565.273 +8.434706083,8874.732 +8.235212917,9242.04 +8.031737583,9725.045 +7.823389583,10100.648 +7.609442167,10223.652 +7.394066333,10202.061 +7.18177575,10102.626 +6.971143917,10005.552 +6.76005725,9948.583 +6.547905917,9976.106 +6.335514583,10010.661 +6.1247145,9951.22 +5.915829583,9703.729 +5.70865225,9250.665 +5.502857083,8789.8 +5.29959525,8425.513 +5.0998445,8209.502 +4.90439275,8221.533 +4.712906583,8288.006 +4.525125833,8331.242 +4.34108925,8203.953 +4.161316917,8070.566 +3.985825667,8083.531 +3.81218425,8198.954 +3.639778833,8453.806 +3.47038125,8828.805 +3.30502375,9145.351 +3.144516,9273.079 +2.9875085,9299.449 +2.833456917,9382.898 +2.683372083,9634.838 +2.538298167,9987.423 +2.397747333,10264.305 +2.261532,10515.696 +2.128944,10693.087 +1.9997345,10687.429 +1.874468417,10592.882 +1.754004833,10505.588 +1.638998417,10531.792 +1.529095667,10595.739 +1.423291583,10568.875 +1.320598583,10443.948 +1.221731833,10212.17 +1.12771575,9881.834 +1.038479333,9552.763 +0.95374375,9342.464 +0.873229167,9236.052 +0.796579167,9193.421 +0.723449833,9160.623 +0.653880417,9046.41 +0.587873833,8910.99 +0.525776833,8743.488 +0.467945417,8566.646 +0.413685,8550.44 +0.362936583,8679.871 +0.315684333,8881.379 +0.271219,9023.831 +0.230005083,9046.739 +0.1921475,9062.177 +0.158036583,9212.429 +0.127829583,9532.985 +0.1008755,9862.826 +0.076851667,10190.689 +0.055667083,10424.885 +0.037832833,10515.421 +0.0232665,10534.1 +0.012359417,10661.443 +0.005017167,10718.797 +0.000966833,10687.978 +0,10620.406 \ No newline at end of file diff --git a/welldata/barney.csv b/welldata/barney.csv new file mode 100644 index 0000000..bc123f3 --- /dev/null +++ b/welldata/barney.csv @@ -0,0 +1,180 @@ +98.878479,19687.71875 +98.833061,19608.97656 +98.687271,19612.3457 +98.496696,19617.55859 +98.207436,19576.69141 +97.906197,19510.25391 +97.608604,19436.69141 +97.173904,19366.32422 +96.616814,19293.74609 +96.06707,19212.42578 +95.433464,19121.12695 +94.750229,18985.37695 +93.93502,18818.625 +93.058502,18631.74219 +92.094398,18416.21875 +91.115143,18170.38086 +90.038254,18007.29492 +88.876823,17900.4375 +87.800278,17741.07617 +86.602104,17562.10938 +85.338539,17415.25781 +84.031471,17233.49805 +82.621895,17034.44922 +81.234825,16871.27148 +79.743828,16691.58398 +78.161911,16506.85547 +76.624016,16325.87402 +74.942314,16161.14941 +73.294777,15983.00977 +71.784866,15803.35645 +69.821587,15646.15918 +68.057617,15501.06152 +66.191177,15320.59375 +64.338715,15120.2168 +62.373264,14918.42969 +60.399395,14698.55273 +58.512794,14469.47559 +56.390789,14288.49414 +54.341087,14071.99609 +52.511631,13792.64746 +50.630878,13525.46582 +48.341488,13301.0293 +46.053364,13113.85938 +43.820122,12951.33594 +41.556591,12804.93066 +39.372406,12658.11328 +37.154778,12548.74707 +34.933659,12547.72754 +32.695152,12614.78418 +30.451603,12721.59473 +28.177065,12871.17481 +26.004868,13069.79883 +23.809713,13288.17578 +21.60713,13527.0127 +19.421371,13794.61719 +17.294621,14039.40234 +15.197564,14301.56641 +13.184119,14633.20313 +11.266252,14979.44824 +9.394399,15288.05664 +7.674011,15624.27734 +6.022047,15980.21387 +4.538721,16348.66211 +3.267299,16731.54492 +2.119907,17103.81836 +1.141826,17435.94922 +0.418223,17803.7207 +-0.12613,18275.1875 +-0.467637,18628.31641 +-0.51326,18861.23242 +-0.364345,19057.53125 +0.018931,19199.125 +0.580402,19272.33203 +1.374856,19284.80859 +2.370766,19296.14063 +3.548366,19280.52344 +4.901436,19209.49219 +6.289977,19161.12305 +7.810155,19124.56445 +9.249138,19056.27148 +11.200404,18958.39648 +13.0338,18852.51367 +14.848969,18668.73633 +16.729538,18527.5332 +18.612474,18544.78516 +20.602987,18633.49609 +22.702454,18795.25195 +24.77833,19109.18945 +25.177294,19172.98047 +28.490406,19890.91406 +30.613531,20248.89063 +32.711479,20567.33008 +34.75729,20858.19336 +36.782173,21162.08203 +38.776138,21393.24414 +40.72184,21584.99414 +42.52161,21713.19531 +44.369289,21738.40039 +46.143349,21729.17773 +47.779621,21707.57031 +49.412922,21653.39063 +50.949528,21590.86133 +52.417835,21525.71875 +53.857075,21437.76563 +55.185429,21373.25195 +56.485561,21344.87305 +57.768398,21328.21484 +58.943233,21319.17578 +60.056538,21330.51758 +61.14143,21291.62305 +62.110706,21135.88086 +63.0681,20903.34375 +63.947544,20606.11133 +64.808846,20297.81055 +65.595825,20000.29102 +66.412445,19717.73438 +67.192184,19500.10352 +67.992744,19290.37695 +68.720482,19124.36914 +69.426147,19051.0918 +70.138245,19031.12305 +70.885918,19030.51563 +71.595657,19061.15039 +72.285698,19116.24609 +72.975212,19188.95117 +73.707901,19285.1875 +74.392151,19376.19922 +75.067535,19453.31445 +75.794853,19522.01953 +76.391739,19578.1582 +77.127335,19592.81055 +77.781105,19605.13867 +78.431618,19693.26367 +79.051086,19876.69727 +79.68145,20072.04492 +80.275848,20140.12109 +80.891983,20179.69141 +81.519623,20299.28906 +82.112488,20475.50391 +82.612625,20623.14648 +83.177994,20686.78906 +83.742981,20706.4375 +84.29689,20728.62891 +84.801743,20770.10156 +85.366142,20794.39063 +85.919426,20807.11914 +86.426506,20824.57813 +86.913559,20864.11523 +87.46875,20914.57031 +87.971497,20934.42578 +88.451851,20932.81055 +88.878235,20948.83789 +89.36071,20969.20898 +89.832573,20990.38086 +90.312851,21037.22656 +90.791679,21036.99805 +91.224022,20952.89453 +91.686485,20898.39453 +92.04731,20878.73438 +92.485863,20836.66602 +92.906303,20748.04883 +93.350357,20647.80273 +93.768356,20570.61719 +94.2202,20527.04883 +94.641785,20494.83203 +95.037338,20464.71289 +95.384933,20440.7793 +95.739662,20423.43359 +96.111412,20414.75 +96.439934,20385.69531 +96.781326,20322.00781 +97.07505,20278.27734 +97.321877,20266.07617 +97.556763,20244.46875 +97.762444,20222.60938 +98.018829,20203.42969 +98.207611,20120.64453 +98.385574,20003.58008 +98.512047,19839.70313 +98.611382,19752.30078 \ No newline at end of file diff --git a/welldata/barney.data b/welldata/barney.data new file mode 100644 index 0000000..da2c977 --- /dev/null +++ b/welldata/barney.data @@ -0,0 +1,72 @@ +[ [98.878479 98.833061 98.687271 98.496696 98.207436 ... +97.906197 97.608604 97.173904 96.616814 96.06707 ... +95.433464 94.750229 93.93502 93.058502 92.094398 ... +91.115143 90.038254 88.876823 87.800278 86.602104 ... +85.338539 84.031471 82.621895 81.234825 79.743828 ... +78.161911 76.624016 74.942314 73.294777 71.784866 ... +69.821587 68.057617 66.191177 64.338715 62.373264 ... +60.399395 58.512794 56.390789 54.341087 52.511631 ... +50.630878 48.341488 46.053364 43.820122 41.556591 ... +39.372406 37.154778 34.933659 32.695152 30.451603 ... +28.177065 26.004868 23.809713 21.60713 19.421371 ... +17.294621 15.197564 13.184119 11.266252 9.394399 ... +7.674011 6.022047 4.538721 3.267299 2.119907 ... +1.141826 0.418223 -0.12613 -0.467637 -0.51326 ... +-0.364345 0.018931 0.580402 1.374856 2.370766 ... +3.548366 4.901436 6.289977 7.810155 9.249138 ... +11.200404 13.0338 14.848969 16.729538 18.612474 ... +20.602987 22.702454 24.77833 25.177294 28.490406 ... +30.613531 32.711479 34.75729 36.782173 38.776138 ... +40.72184 42.52161 44.369289 46.143349 47.779621 ... +49.412922 50.949528 52.417835 53.857075 55.185429 ... +56.485561 57.768398 58.943233 60.056538 61.14143 ... +62.110706 63.0681 63.947544 64.808846 65.595825 ... +66.412445 67.192184 67.992744 68.720482 69.426147 ... +70.138245 70.885918 71.595657 72.285698 72.975212 ... +73.707901 74.392151 75.067535 75.794853 76.391739 ... +77.127335 77.781105 78.431618 79.051086 79.68145 ... +80.275848 80.891983 81.519623 82.112488 82.612625 ... +83.177994 83.742981 84.29689 84.801743 85.366142 ... +85.919426 86.426506 86.913559 87.46875 87.971497 ... +88.451851 88.878235 89.36071 89.832573 90.312851 ... +90.791679 91.224022 91.686485 92.04731 92.485863 ... +92.906303 93.350357 93.768356 94.2202 94.641785 ... +95.037338 95.384933 95.739662 96.111412 96.439934 ... +96.781326 97.07505 97.321877 97.556763 97.762444 ... +98.018829 98.207611 98.385574 98.512047 98.611382 ] +[19687.71875 19608.97656 19612.3457 19617.55859 19576.69141 ... +19510.25391 19436.69141 19366.32422 19293.74609 19212.42578 ... +19121.12695 18985.37695 18818.625 18631.74219 18416.21875 ... +18170.38086 18007.29492 17900.4375 17741.07617 17562.10938 ... +17415.25781 17233.49805 17034.44922 16871.27148 16691.58398 ... +16506.85547 16325.87402 16161.14941 15983.00977 15803.35645 ... +15646.15918 15501.06152 15320.59375 15120.2168 14918.42969 ... +14698.55273 14469.47559 14288.49414 14071.99609 13792.64746 ... +13525.46582 13301.0293 13113.85938 12951.33594 12804.93066 ... +12658.11328 12548.74707 12547.72754 12614.78418 12721.59473 ... +12871.17481 13069.79883 13288.17578 13527.0127 13794.61719 ... +14039.40234 14301.56641 14633.20313 14979.44824 15288.05664 ... +15624.27734 15980.21387 16348.66211 16731.54492 17103.81836 ... +17435.94922 17803.7207 18275.1875 18628.31641 18861.23242 ... +19057.53125 19199.125 19272.33203 19284.80859 19296.14063 ... +19280.52344 19209.49219 19161.12305 19124.56445 19056.27148 ... +18958.39648 18852.51367 18668.73633 18527.5332 18544.78516 ... +18633.49609 18795.25195 19109.18945 19172.98047 19890.91406 ... +20248.89063 20567.33008 20858.19336 21162.08203 21393.24414 ... +21584.99414 21713.19531 21738.40039 21729.17773 21707.57031 ... +21653.39063 21590.86133 21525.71875 21437.76563 21373.25195 ... +21344.87305 21328.21484 21319.17578 21330.51758 21291.62305 ... +21135.88086 20903.34375 20606.11133 20297.81055 20000.29102 ... +19717.73438 19500.10352 19290.37695 19124.36914 19051.0918 ... +19031.12305 19030.51563 19061.15039 19116.24609 19188.95117 ... +19285.1875 19376.19922 19453.31445 19522.01953 19578.1582 ... +19592.81055 19605.13867 19693.26367 19876.69727 20072.04492 ... +20140.12109 20179.69141 20299.28906 20475.50391 20623.14648 ... +20686.78906 20706.4375 20728.62891 20770.10156 20794.39063 ... +20807.11914 20824.57813 20864.11523 20914.57031 20934.42578 ... +20932.81055 20948.83789 20969.20898 20990.38086 21037.22656 ... +21036.99805 20952.89453 20898.39453 20878.73438 20836.66602 ... +20748.04883 20647.80273 20570.61719 20527.04883 20494.83203 ... +20464.71289 20440.7793 20423.43359 20414.75 20385.69531 ... +20322.00781 20278.27734 20266.07617 20244.46875 20222.60938 ... +20203.42969 20120.64453 20003.58008 19839.70313 19752.30078 ] ] diff --git a/welldata/csv_to_matlab.py b/welldata/csv_to_matlab.py new file mode 100644 index 0000000..d971776 --- /dev/null +++ b/welldata/csv_to_matlab.py @@ -0,0 +1,30 @@ +"""Convert a CSV file of position,load pairs to a string representative of a matlab array.""" + +import csv + +position = [] +load = [] + +with open("barney.csv", 'r') as csv_file: + csvreader = csv.reader(csv_file) + for row in csvreader: + position.append(row[0]) + load.append(row[1]) + + +def array_to_matlab_split(a, split_after=5): + """Turn a python array into a matlab array.""" + a_string = "[" + for i in range(0, len(a)): + if i > 0 and i % split_after == 0: + a_string += " ...\n" + a_string += a[i] + " " + + a_string += "]" + return a_string + + +position_string = array_to_matlab_split(position, split_after=5) +load_string = array_to_matlab_split(load, split_after=5) + +print("[ " + position_string + "\n" + load_string + " ];") diff --git a/mallet.csv b/welldata/mallet.csv similarity index 100% rename from mallet.csv rename to welldata/mallet.csv diff --git a/welldata/mallet_single.csv b/welldata/mallet_single.csv new file mode 100644 index 0000000..d912b15 --- /dev/null +++ b/welldata/mallet_single.csv @@ -0,0 +1,225 @@ +0,8484.74 +0.066215,8615.27 +0.171112,8951.1 +0.316819,9280.12 +0.498586,9613.75 +0.715024,10084.6 +0.97621,10624.4 +1.2883,10886 +1.63867,10787.3 +2.02093,10515.7 +2.43243,10317 +2.87705,10188.2 +3.36461,10107.5 +3.8875,10058.3 +4.44299,10128.3 +5.03967,10279.2 +5.67946,10368 +6.35611,10397.3 +7.05754,10422.5 +7.7809,10496.4 +8.53069,10721.6 +9.32235,11145.6 +10.1506,11569.2 +11.013,12015.8 +11.9097,12514.9 +12.842,12892 +13.8065,12964.3 +14.7986,12892.5 +15.8226,12869.7 +16.8842,12904.7 +17.9785,12974.2 +19.1005,13055.2 +20.2442,13145.5 +21.4129,13406.1 +22.6127,13789.8 +23.8375,13974.4 +25.0839,14102 +26.3506,14397.5 +27.6347,14832.5 +28.936,15269.6 +30.2719,15730.9 +31.6607,16128.3 +33.0885,16138.4 +34.5314,15870.9 +35.9861,15687 +37.4602,15666 +38.9614,15642.7 +40.4966,15570.9 +42.0607,15503.3 +43.6394,15452.3 +45.2335,15386.8 +46.8483,15105.5 +48.4878,14678 +50.152,14434.2 +51.8308,14364.4 +53.5259,14356.1 +55.2375,14236.2 +56.9713,14093.1 +58.7226,13891.4 +60.4832,13598.9 +62.2413,13513.1 +64.007,13694.1 +65.7803,13886.4 +67.5656,13987.5 +69.3593,14073.4 +71.1599,14208.2 +72.9585,14286.5 +74.7583,14322 +76.556,14312 +78.3522,14427.3 +80.1504,14687.4 +81.9521,14818.9 +83.7547,14816.3 +85.5546,14750.8 +87.3472,14682.4 +89.1313,14642.8 +90.9046,14661.6 +92.6711,14728.2 +94.4368,14709.3 +96.2018,14537.4 +97.9579,14323.4 +99.6993,14149.4 +101.428,13975.5 +103.143,13769.3 +104.844,13652.9 +106.527,13573.9 +108.191,13526.9 +109.842,13466.2 +111.478,13316.7 +113.09,13212.9 +114.669,13210.8 +116.219,13258 +117.74,13319.1 +119.238,13443.1 +120.709,13533.1 +122.148,13525.3 +123.547,13536 +124.909,13699.2 +126.234,14000.9 +127.523,14235.3 +128.772,14383.4 +129.979,14674.1 +131.149,14953.1 +132.282,14981 +133.374,14929.8 +134.416,14898.1 +135.41,14954.7 +136.359,14988.7 +137.266,14932.4 +138.126,14798 +138.939,14617.8 +139.7,14300.7 +140.403,13873.7 +141.05,13581.8 +141.639,13342 +142.175,13062.5 +142.646,12627.3 +143.058,12231.8 +143.405,11767.8 +143.683,11330.1 +143.878,10991 +143.996,10990.7 +144,11457.4 +143.95,13420 +143.839,14602.7 +143.662,15329.3 +143.407,15622.4 +143.091,15098.6 +142.687,14170.6 +142.183,13026.4 +141.6,12231.2 +140.93,11669.8 +140.172,11416.2 +139.341,11030.2 +138.434,10372.5 +137.43,9651.43 +136.346,9073.28 +135.19,8552.75 +133.945,7961.3 +132.611,7503.35 +131.196,7265.97 +129.659,7476.43 +128.044,8425.79 +126.37,8998.29 +124.599,9058.83 +122.758,8750.14 +120.876,7922.02 +119.005,6829.66 +117.1,5739.27 +115.16,4938.02 +113.195,4556.92 +111.124,4009.97 +108.956,3076.65 +106.734,2809.43 +104.501,3435.44 +102.236,4114.62 +99.8892,4774.08 +97.4932,5494.42 +95.0781,6051.92 +92.6506,6267.32 +90.2226,6215.52 +87.773,6104.6 +85.3137,6203.32 +82.8008,6609.69 +80.2456,7243.11 +77.6691,7868.18 +75.059,8409.37 +72.4444,8770.91 +69.889,9123 +67.3891,9726.37 +64.9092,10533.1 +62.449,10876.2 +60.006,10686.3 +57.606,10357 +55.2767,9938.64 +53.0145,9433.22 +50.7868,8896.33 +48.581,8634.28 +46.4189,8698.11 +44.3031,8840.73 +42.2375,8833.26 +40.2273,8726.52 +38.2721,8607.14 +36.3855,8449.8 +34.5648,8343.22 +32.8088,8334.71 +31.0978,8226.37 +29.4095,7798.63 +27.7617,7187.13 +26.1538,6973.54 +24.6108,7240.64 +23.1211,7661.24 +21.6577,8004.98 +20.237,8433.32 +18.8709,9012.46 +17.57,9429.65 +16.3306,9509.81 +15.1428,9421.25 +13.9942,9405.43 +12.8928,9478.66 +11.837,9530.74 +10.8323,9548.98 +9.88763,9552.49 +8.99399,9483.55 +8.1242,9405.81 +7.2898,9492.06 +6.51456,9765.15 +5.80287,9996.22 +5.14662,9887.11 +4.5243,9551.61 +3.93801,9254.68 +3.40371,8961.15 +2.91193,8378.6 +2.4483,7819.07 +2.01826,7649.43 +1.63363,7745.02 +1.29812,7860 +1.00485,7939.93 +0.741844,8024.7 +0.515951,8110.57 +0.329747,8151.66 +0.179453,8272.08 +0.073617,8535.67 +0.018252,8665.32 +0,8484.74 \ No newline at end of file diff --git a/welldata/melinda252.csv b/welldata/melinda252.csv new file mode 100644 index 0000000..0195608 --- /dev/null +++ b/welldata/melinda252.csv @@ -0,0 +1,87 @@ +126.5051,10223.6484 +123.9029,10230.2314 +121.0463,10189.2041 +117.5635,10083.4697 +113.8426,9917.5088 +109.5759,9707.9521 +106.2378,9516.8672 +101.8044,9289.751 +97.3519,9089.0195 +92.8,8866.0742 +88.4091,8614.7021 +84.0076,8358.5879 +79.4541,8115.3457 +73.9173,7900.021 +68.8499,7737.3984 +64.0064,7629.6919 +59.7473,7575.2832 +54.2922,7550.3623 +49.2909,7553.3936 +45.0403,7569.3081 +40.2633,7617.9331 +35.5266,7699.2344 +31.471,7834.8071 +27.2086,8026.6318 +22.9661,8260.4336 +19.2719,8528.791 +16.2453,8817.7529 +13.1741,9082.624 +10.9223,9415.6523 +8.0221,9724.8018 +5.5349,10025.0273 +3.4914,10320.8779 +2.4433,10608.1514 +1.7148,10871.1895 +0.6192,11109.6748 +1.7067,11306.8379 +2.9805,11469.5664 +4.4613,11593.3682 +6.7297,11745.6162 +9.3626,11901.7324 +11.8843,12057.29 +15.1879,12195.709 +18.4037,12295.3252 +21.3285,12352.6484 +24.8961,12380.8867 +29.3451,12399.6924 +33.9272,12436.4443 +38.6627,12508.127 +43.3936,12693.4512 +48.5832,12947.9678 +53.3561,13279.9844 +58.4396,13640.2158 +63.1561,13988.7295 +67.9264,14302.9248 +72.3098,14561.3086 +77.6417,14780.2432 +81.9482,14970.4375 +87.1089,15137.6719 +91.5611,15345.9346 +96.0731,15522.124 +100.0094,15656.2988 +103.7351,15724.6758 +108.128,15701.9902 +111.5638,15592.5537 +114.0383,15405.3252 +118.2311,15168.708 +121.0557,14897.0527 +124.7529,14637.6436 +127.9931,14284.2031 +130.6817,13907.2744 +132.779,13482.124 +135.5623,13016.0996 +137.6565,12550.0195 +139.2685,12102.9883 +140.2527,11735.0107 +141.1513,11428.2813 +141.4701,11193.6563 +141.7055,11011.8604 +142.144,10804.417 +141.2585,10480.751 +140.0993,10376.5615 +138.4791,10307.9443 +136.8406,10259.3877 +135.2337,10218.1396 +133.2669,10192.2598 +130.8739,10191.4248 +126.5051,10223.6484 diff --git a/welldata/melinda254.csv b/welldata/melinda254.csv new file mode 100644 index 0000000..8dce104 --- /dev/null +++ b/welldata/melinda254.csv @@ -0,0 +1,87 @@ +103.8524,13004.6484 +99.3235,13028.7656 +94.6525,13041.959 +90.3378,13048.8369 +85.9424,13055.4863 +81.5922,13066.1152 +77.7294,13085.7695 +72.2623,13106.7188 +67.7774,13124.3232 +62.7635,13131.6006 +58.5869,13126.2197 +55.9227,13108.9531 +51.9493,13084.5322 +47.5958,13058.8652 +43.4364,13038.957 +39.6636,13028.2158 +35.9572,13021.4463 +31.702,13015.9033 +28.2235,13006.2363 +24.4126,12991.1279 +21.145,12974.1172 +17.8644,12959.8584 +14.7241,12954.2061 +11.6427,12959.3555 +9.5707,12974.1572 +7.5519,12993.5811 +5.684,13020.9707 +4.5142,13044.9941 +3.407,13066.5684 +2.6415,13087.3486 +1.9993,13110.4453 +2.4759,13141.1279 +3.1328,13221.6377 +3.9276,13270.7041 +6.3712,13316.8613 +10.8141,13416.2461 +11.7525,13445.5029 +15.5456,13451.9746 +18.2811,13430.4287 +21.5436,13386.2188 +25.3076,13341.4785 +29.0923,13319.165 +32.6206,13328.5195 +36.0253,13362.4609 +41.5656,13420.6543 +46.1242,13465.6563 +48.9711,13490.5332 +52.8448,13495.6016 +57.4217,13492.8281 +61.6421,13494.4248 +65.6471,13508.1133 +70.5472,13537.1016 +75.5646,13576.4512 +79.8047,13611.0479 +84.1742,13634.6172 +89.215,13628.5977 +93.2983,13600.9209 +98.0339,13561.9141 +101.932,13527.0811 +106.4618,13505.1328 +110.2827,13494.4043 +114.0381,13482.3555 +117.735,13456.8242 +120.9061,13420.4795 +125.1445,13358.7002 +128.2455,13298.249 +131.6063,13238.7744 +134.2098,13190.1445 +136.7013,13156.8242 +138.0084,13133.3457 +139.6546,13112.498 +140.6283,13085.415 +141.2953,13048.1016 +141.0792,13008.6719 +140.3856,12960.6914 +139.3338,12933.0498 +138.0939,12921.9873 +136.2462,12921.4219 +134.3031,12922.918 +131.4601,12921.0811 +128.6249,12914.5273 +125.4015,12904.8623 +122.3661,12898.126 +119.0274,12898.8545 +115.1404,12912.5039 +112.1398,12936.4561 +103.8524,13004.6484