LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need some suggestions for creating a software based digital I/O counter

Hi All

 

I've been using LabVIEW to sucessfully create a number of fluid level monitoring applications for oil well drilling. bear in mind that I'm a geologist not a software engineer so you may have to talk/type slowly Smiley Tongue .

 

I've been using the USB 6009 & 6008 for these aplications so far, they are however limited by only having 1 counter per DAQ. What i'd like to do (if possible) is use the some of the digital I/O channels as counters. The events i'm attempting to count are simple open/closed pulse signals from a micro switch. The micro switch is attached to a slow running mud pump which is sending up to 3 pulses per second but is usually running at 10-80 pulses per min. The slow cycle rate of these big pumps means I can't use a frequency aplication as they don't seem to work below 1hz.

 

I've tried to use a case structure to create a counter but I'm afraid I can't seem to get the logic right to turn the output into a counted output. Anyone got a suggestion for things I could try?

 

Thanks

 

Kim

 

 

0 Kudos
Message 1 of 6
(1,091 Views)

Kim,

 

Tttt yyyy pppp iii nnn gggg slowly.

 

You described your situation quite clearly.

 

As you probably know the digital inputs on the USB-6008/9 are software timed, so you have some uncertainty in the time of any sample.  Depending on your OS that uncertainty will typically be on the order of a few milliseconds but occasionally may be much longer.

 

To count the pulses in software requires a combination of several things.

1. You need to have a data acquisition method which is fast enough to capture each high and low state of the pulses produced by the pump.  For software timed Digital Input a good way to do this is to have an independent, parallel loop which reads the input line rapidly and passes the data or transitions to another loop via a queue.  This is known as the Producer loop in a Producer/Consumer architecture.  Examples come with labVIEW. A 10 ms Wait in the loop is probably appropriate.

2. You need to convert the digital inputs (levels) into pulses or transitions to be counted.  Suppose you want to increase the count by one every time the logical level changes from False to True. To do this you need to know the previous level and the current level. A shift register is one of the best ways to do this in LV.  Add a shift register to the loop.  Initialize it to False. Connect the result of the Digital Read to the right terminal of the shift regsiter inside the loop.  When that Read is True and the previous value (obtained from the left terminal of the shift register) is False, increment the count value (which is also kept in a shift register) in the case structure.

3. You did not indicate what you are doing with the counts or what the pulses represent.  Do you need to measure the frequency (or the period which is the reciprocal of the frequency)?  Do you need to accumulate the number of pulses? Over what time period?

 

Lynn

 

0 Kudos
Message 2 of 6
(1,077 Views)

Hi, thanks for the reply, some good suggestions to follow up there.

 

The reason we are counting pump strokes is so that we can track the progress of drilling mud down to the drillbit and then back to the surface. As you might imagine it can take a long time to get mud from the drill bit up to the surface of an oil&gas well. When the mud reaches the surface it carries with it rock chips and sometimes gas and oil. In the 15+ miniutes it takes for the mud to reach the surface the dill bit has often drilled deeper and so the real time drill bit depth is not a good indicator of the zone from which the gas or oil has come from.

 

Because we know the diameter of our hole (from the diameter of the drill bit) and the diameters of all the steel drill pipe in the hole we can calculate the hole volume. We also know the volume of mud pumped per stroke. This lets us work out the number of strokes taken to get the mud from the drill bit to the surface where we detect the gas and oil. By back calculating the number of strokes we can calculate the depth that the drill bit was at when the the mud (which is now at the surface) came out of the drill bit (bringing with it rock chips, and possibly gas and oil).

 

Thanks again, I hope this helps give you a little perspective on what I hope to eventually achive.

 

Cheers

 

Kim

 

 

0 Kudos
Message 3 of 6
(1,069 Views)

Kim,

 

Thanks. That gves me a better idea.  So you are essentially making a flowmeter where the pulses represent a volume of mud.

 

How do you account for the compressibilitly of the gas?

 

Lynn

Message 4 of 6
(1,063 Views)

Hello Kim.  The attached VI might give you an idea about the logic to counting pulses.  The boolean on the fp simulates the low/high pulse.  I hope it helps.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 5 of 6
(1,060 Views)

Thanks MoReese

 

That's exactly what I've been trying to achive. I'll see if I can develop this further.

 

Hi Johnsold

 

Fortunately the high viscosity of the mud and the high uphole velocity means that no expansion or gas migration needs to be accounted for. Once the mud reaches the surface the mud passes through a gas trap that agitates the mud so the entrapped gas is released and can be recorded by our gas sensors.

 

Cheers

 

Kim

0 Kudos
Message 6 of 6
(1,053 Views)