mkgrier5 Posted March 18, 2011 Share Posted March 18, 2011 I am trying to write a sequence that will calculate my lag depth as I'm drilling. I have 4 variables, Depth, DrillStrokes, LagStrokes and LagDepth, and 1 V.Channel called DStrokes. As I drill deeper when my Depth increases it equals the DrillStrokes. When the LagStrokes equals the Drillstrokes, the LagDepth then equals the corresponding Depth. For Example: Depth = 1, DrillStrokes = 100, LagStrokes = 0, LagDepth = 0 When the LagStrokes = 100, I need the LagDepth to change to 1. This will keep on repeating itself, so I figured I would need a V.Channel to save the history, but am at a lost as to how to write the sequence. Thank you for your help. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 21, 2011 Share Posted March 21, 2011 Yup, and its more complicated by the fact that you may skip over a depth, so you can't simply search. OK, well, we have at least 4 other people that I can think of off the top of my head that are doing the same thing as you. Hopefully one of them can offer a suggestion? Link to comment Share on other sites More sharing options...
BeeHay Posted March 21, 2011 Share Posted March 21, 2011 Hello mkgrier5! Fellow logging unit! I have thought of ways to calculate LaggedDepth using volume and strokes, I'm sure there is a proper way of doing it, but I have yet to find the "magical" formula... As of now, we use our "LagTime" to look back through the Depth variable, and use the Depths "time" to find the Depth "at that time"... There are a couple rudimentary LagTime formulas I'm pretty sure you already know... Annular Volume Gallons / Gallons Per Min Bottom Up Strokes / Stroke Per Min I would just say make sure your volumes, casing sizes, drill pipe sizes, displacement, collars, everything is dialed in, or the numbers wont come out right... I also have made a "ManualLag" option in our .ctl file...It gives the user the ability to "fine tune" the LagTime to their liking, and that directly affects the LaggedDepth... Most of our loggers use that option due to the fact they are at times "lazy" and don't wish to rig up a stroke counter. Here is a sample code from our LagDepth sequence - if(LagSelect == 1) LaggedDepth = Depth[ManualLagTime[0] - 0.01, ManualLagTime[0] + 0.01] endif When you say this - When the LagStrokes = 100, I need the LagDepth to change to 1. Do you mean you need the LagDepth to increment 1? There are a couple drilling math books around, with-out those, I would be lost... (and ofc AzeoTech's pro help!) Hope this helps. Link to comment Share on other sites More sharing options...
mkgrier5 Posted March 23, 2011 Author Share Posted March 23, 2011 Thank you for your replies, but I need it to work off of the strokes primarily and time as a backup. Here's what I'm thinking: Let's say Depth increases from 99 to 100, in the event I have V.Drillstrokes[0] == Var.DrillStrokes V.LagDepth[0] == Var.Depth Then I have a sequence running: Var.i = 0 Var.Array_Length = NumRows(V.DrillStrokes) While Var.i > Var.Array_Length If Var.LagStrokes >= V.DrillStrokes[Var.Array_Length] && Var.LagStrokes >= V.DrillStrokes [Var.Array_Length - 1] Var.LagDepth = V.LagDepth[Var.Array_Length] // Here I need to delete the V.Channel for both the DrillStrokes and the LagDepth EndIf EndWhile It's a rough idea, but I think I'm heading in the right direction. Any ideas? Link to comment Share on other sites More sharing options...
BeeHay Posted April 9, 2011 Share Posted April 9, 2011 Sorry for the delayed response mkgrier5, Southern California is my second home. About the stroke lag...I would think it has something to do with BottomsUpStrokes, TotalAccumulatedStrokes, and I've been messing with a variable I call StrokesPerFoot... Not sure if StkPerFt is worth anything, but it's kinda nice to see how many strokes happened last foot. (Just a goofy variable I threw in there ) I would like to think that for every foot NOT made and strokes keep stroking, BottomsUpStk would get smaller and LagDepth would rise to the surface...Now getting that into DF is a different story. When you say LagStrokes, are you referring to BottomsUpStks? Also, to clear history in a value, use ClearHistory()....V.DrillStrokes.ClearHistory() My boss tells me it's similar to calcing a washout... I'll attach a washout depth calculator I made some time ago, it only deals with one pump and the drill pipe...(no casing/collars/ect) Let me know if it helps things click!! Carbide.ctl Link to comment Share on other sites More sharing options...
BeeHay Posted April 19, 2011 Share Posted April 19, 2011 Hello again mkgrier5! Just here brainstorming, and I think I've found a way to compensate a "timed" LaggedDepth. By not counting physical "counted strokes", but by counting the time the pumps aren't stroking. While counting the pumps down time and adding it to the LagTime, you force the LagTime to increase. We actually calc LagTime by AnnularVelocity...By calc'ing Depth / AnnularVelocity, you gat a time based off of AnnularCapacity and PumpOutput... So if you counted the pumps down time and tacked it onto the LagTime, the numbers come out real close! Also, if you run a LaggedDepth sequence on a time based loop, and if you make no new hole while time passes or just cirulating, the LaggedDepth will eventually catch up to the HoleDepth! Hope I'm making sense here! Link to comment Share on other sites More sharing options...
JohnyQuick Posted May 21, 2011 Share Posted May 21, 2011 You can't log virtual channels, so why are you even trying this? Don't you want to mlog your "lagdepth"? Link to comment Share on other sites More sharing options...
AzeoTech Posted May 22, 2011 Share Posted May 22, 2011 (You can't log V channels using a logging set, you can log them with an export set, or using File. or DB. functions and script...) Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 2, 2011 Share Posted June 2, 2011 That makes things easier. Channels that don't actualy have a sensor, but need to be mudlogged, like lag depth, lag gas, depth, rop, and even total strokes( for a virtual counter), can be put into an export set. That will organize what gets imported into a mudlog drawing software very neatly. Thanks Azeotech. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 13, 2011 Share Posted June 13, 2011 Thanks Azeotech. I am now logging lag depth, using DF. What an amazing product!! Not easy by any means. Quite a "learning experience" Depth, ROP, and all the other Mudlogging BS has fit together quite nicely. Thanks again. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 13, 2011 Share Posted June 13, 2011 Excellent. Just so you know, calculating lag depth is not easy, no matter what tool you use. You tackled a serious challenge early on and we're glad DAQFactory was able to help you. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 14, 2011 Share Posted June 14, 2011 Well, I spoke to soon. I had it on the screen, like a trapped anti-Helium atom, and poof, today it was gone. So I have some more questions, I have several, about 5, sequences, that are handling the Lag problem. They are all one dimensional arrays. I subtract, or add, to an array , or subtract , or add one array to another. Then, I use the filter array function, and after that, I do a search of the final array. The search was working yesterday,but not today. So , now I'm guessing I need to use the align function, to get my sequences to work again. It appears to me that my sequences, are out of sinc. As , I watch the arrays propagate, some are slower than others. I spent most of the day, playing with delay, and changing the time of the delay(). And then trying the wait(), and that didn;t work for me either, I have one variable close to the end, called x. It goes like so. delay(15) while(1) x=(search(LagDepth)) //returns the first nonzero lag volume PUTS X AS 1 IF TRUE ///if(x<0) // x=0 // wait(1) // endif // if (x>0) // x=1 // wait(1) // endif a[0]=lagdepth[x] // A is the current lag depths annular volume DELAY(1) endwhile x, returns as (-1). I tried doing x+=(search(lagdepth)) and then x, just counts -1,-2,-3 etc, as the array propagates. Also, I got hung up on the way DF, only displays the first 20 rows of an array, and I thought that the sequence(s), had stalled/hung, but that wasn't the case. I've tried making x a channel, and that didn't work. I changed it back to a global, and still can't get it to work. So, thanks for your patience, I'm guessing that I have an alignment problem with my lag arrays. I see in the DF HELP that it mentions align, but could you provide an example of how to use the align function to get my 5 sequences, back into sinq?? Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 14, 2011 Share Posted June 14, 2011 Align doesn't sync of sequences, it aligns array elements based on time. So if you have arrays X and Y, and Y has data taken once every second and X is taken twice a second after 10 seconds, Y would have 10 points and X 20. The most recent points might have the same time stamp, but [9] of Y would be 10 seconds ago, where [9] of X would be only 4.5 seconds ago. If you did: X = align(X, Y, 0.5) X would then have 10 data points with time stamps that are within 0.5 seconds of Y's, with the rest of the data tossed. If you did: Y = align(Y, X, 0.25) then Y would have 20 data points instead of 10, but every other data point would have NaN() because there was no data in Y for the half second point. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 14, 2011 Share Posted June 14, 2011 Thanks again, but the problem seems to be that when I SEARCH on the array, the first nonzero value found ends up being minus 1(-1), where what I need is the first integer, after a long list of zeros. I must have subtracted wrong somewhere, to end up with negative one, instead of zero. in one of my arrays, although DF does,'t display any -1 in any of my arrays, as I watch them propagate, MMM,mmm, Any ideas of what could be wrong? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 14, 2011 Share Posted June 14, 2011 Not without more detail. I don't know how you are searching, nor how you are creating the array you are searching through. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 15, 2011 Share Posted June 15, 2011 Hmmm, Well, I got Lag Depth back on the screen today, but, excuse the expression, it is !@%$- backwards!!. So, It seems my array that I am doing a search on is front to back, when, what I want is a search from back to front. In other words, the first oldest value that meets the condition of the search function is the Lag depth, volume, time , however you are lagging. Myself, I lag by accumulated barrels, but anyway. Most mudlogging students never bother to even learn how to calculate annular volume in the first place. I see in the DF HELP, a mention of the function, APPEND VALUE. used on arrays. Could you please provide an example of the APPEND VALUE? Tomorrow, it seems that I need to re-create my lag arrays, using the APPEND VALUE function, instead of the normal front to back way of things. The x=-1, was just a value not found thing, that caused much "learning". Thanks again for all your help. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 15, 2011 Share Posted June 15, 2011 Append() is basically the same as AddValue() except where the new data point is put. So if you had: global x = {1,2,3} and you did: x.addValue(0) you'd get: {0,1,2,3} and then if you did: x.append(4) you'd get: {0,1,2,3,4} Link to comment Share on other sites More sharing options...
mkgrier5 Posted June 15, 2011 Author Share Posted June 15, 2011 Here's what I ended up with for my lag depth. It throws an error when you get bottom's up but it works. While(1) If (DrillStrokes >= V.DepthStrokes[NumRows(V.DepthStrokes) - 1]) Lag_Depth = V.LaggedDepth[NumRows(V.DepthStrokes) - 1] Var.FileHandle = File.Open("C:\Users\Mikey\Documents\myfile.csv",0,1,1,1) File.Write(Var.FileHandle,DoubleToStr(V.LaggedDepth[NumRows(V.DepthStrokes) - 1]) + "," + DoubleToStr(V.ROP[NumRows(V.DepthStrokes) - 1]) + "," + DoubleToStr(Gas)) File.Close(Var.FileHandle) V.DepthStrokes.ClearHistory(NumRows(V.DepthStrokes) - 1) V.LaggedDepth.ClearHistory(Array_Length - 1) V.ROP.ClearHistory(Array_Length-1) EndIf Delay(1) Endwhile Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 16, 2011 Share Posted June 16, 2011 Thanks, The append value works fine. But , once again the !%$# gets deeper! I need to delete an index value in my lag array, that comes from a search when a depth is lagged up, and count untill the next index in my lag array comes up, but it can' start counting, if I can't delete the index that has already been lagged-up! Can you please provide an example of the DELETE VALUE function? I don't quite get just how to delete an index from an array, from the DF HELP's explanation. Thanks again for the Help. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 16, 2011 Share Posted June 16, 2011 Wouldn't be MC by anychance are you?? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 16, 2011 Share Posted June 16, 2011 The User's Guide shows a good example of RemoveAt(): global x = {1,4,2,3} x.RemoveAt(1,2) x now contains {1,3} because we removed 2 elements starting at the 2nd element (remember we always number from 0, so "1" is the second element. Not sure what you mean by MC. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 17, 2011 Share Posted June 17, 2011 I taught MC how to catch samples. His First name is also MIKE. His father was a ML also. And I logged with him as well, also the son, MC. What page# in DF HELP is the remove at example.? Too much trouble to write another example? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 17, 2011 Share Posted June 17, 2011 RemoveAt is in section 5.10 of the user's guide. I'm not sure what another example is going to do as the one I provided is perfectly clear. The best way to learn this simple functions is to try them at the command alert window. Declare some global variable, assign some values, manipulate it with the function you are investigating, and use ? to print the contents. Link to comment Share on other sites More sharing options...
JohnyQuick Posted June 27, 2011 Share Posted June 27, 2011 Thanks, the remove at is working great. Just when, or "wait for" the remove at, happens, has not yet been resolved yet. In other words, the logic for when the remove at happens is still up for grabs. But otherwise, the volume lag is "working" Link to comment Share on other sites More sharing options...
SteveMyres Posted February 27, 2013 Share Posted February 27, 2013 Haven't had time to digest all the information here, but my current idea for calculating lag with pump stroke feedback and depth from the rig is this: There will be a two-dimensional array, where each entry represents one slug of mud. Associated with that slug will be two values, the origin depth and the remaining volume to surface (or actually, to tap point). Each time you see a pump stroke, subtract the stroke volume from the remaining volume fields in all the slug records. If one of the volumes decreases below zero, that is the slug emerging right now, so you always have the origin depth for the current sample, and you can interpolate based on trended pump speed if you really want. There's no point in entering a slug record more often than once per pump stroke. You'd also subtract the differential collar volume (constant cf or bbl vs same length of pipe) each time the depth passes a multiple of the pipe length. I assume this is probably overly simplified as I'm just getting started, but I think it's the right approach to build on. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.