PLUS+1 User Forum

PLUS+1™ Software => Sub System Applications => Topic started by: Fitzsimmons Hydraulics on October 09, 2014, 08:50:44 PM

Title: Flow Meter Integration
Post by: Fitzsimmons Hydraulics on October 09, 2014, 08:50:44 PM
I am trying to interpret a flow meter signal with a micro controller. The pulse rate/gallon is known.

I have written some code for this application, but its not picking up the signal. I have wired one side of the flowmeter to the micro input. The other wire is grounded.

Can anyone share their experiences with incorporating flow meters into the Plus+1 environment?

I have included a snapshot of what I am doing with the frequency signals. pinconfig0=0, pinconfig1=0 for both inputs. The service tool can't seem to pick up the frequency. Any suggestions?
Title: Re: Flow Meter Integration
Post by: BRIan on October 09, 2014, 11:15:37 PM
I assume you are not getting a Freq when you check with the service tool. This may be due to NPN output rather than PNP. Just change the PinConfig on the input and recheck.
Title: Re: Flow Meter Integration
Post by: Jakob on October 10, 2014, 08:16:16 AM
Good point BRIan.

If you do see the frequency on the input pin, but nothing comes out to you CAN-data.
I suspect the value is lost due to being multiplied with 0,00112485, and then multiplied with 60 rather than just dividing the input with around 14.
Title: Re: Flow Meter Integration
Post by: Fitzsimmons Hydraulics on October 10, 2014, 04:19:21 PM
BRIan, I will have to try it out today. Just wanted to make sure my wiring logic was correct. There doesn't seem to be a specific polarity to either pin.

Jakob, I have run into this before with a SDT sensor and temperature output. Assuming I can get the input fixed and the signal reaches the mathematical logic, and my code creates trouble, would it be better to just use a scale function?
Title: Re: Flow Meter Integration
Post by: oiltronic on October 10, 2014, 04:54:13 PM
Left side of the oil flowmeter code shows 1 divided by 216.  Plus+1 is all integer math, so the result is zero, which will result in zero gallons coming out of the next multiplication.

Left side of the glycol flowmeter code shows 889005 divided by 1000, which is just 889, no decimal point due to integer math.  If you want high accuracy you'll need to make it u32 and work with milli-gallons (i.e. gallonsx1000, fixed-point integer math), then save that division for later, like before it's shown on a screen (when you create two separate numbers for the values for before & after the decimal).

For math like a gpm flow rate you might want to switch all the math to u32, multiply by 60 and by your conversion rate first, and divide by 1000 or whatever scaling factor last, before changing back to desired data size.  Otherwise your gpm will always be some multiple of 60 (0, 60, 120, etc).

What is your expected frequency?  I see you're using the IO bus, meaning the signal is coming from a remote I/O unit, correct?  Which one?  Check the hardware spec for the frequency and period limitations for that particular pin.  I had a particularly slow pulse where I ended up using the period input instead, and really slow ones used my own direct period measurement.

To test just the signal I have forced some speed sensors and paddle wheels to the on-state and looked for the signal with the service tool.  At least one has required a goofy external pull-up resistor (internal microcontroller one was too weak).
Title: Re: Flow Meter Integration
Post by: Fitzsimmons Hydraulics on October 10, 2014, 09:51:56 PM
Oiltronic, I am using an IX024-010. Thanks for the suggestion - I try not to mess with scale blocks if I don't have to. I have enclosed a new image of the logic. The oil flowmeter pulse is 216 per gallon, which corresponds to the meter currently installed. The note tells the pulse count of our new meter (which will be installed as soon as I can get a signal from the old one), so just disregard the pulse count of 329.

Problem is that I still can't get the service tool to read a frequency. I have tried changing pinconfig0 to all options - nothing for any of them. I tested AC voltage across the 2 wires and it read about .075. This proportionally increased/decreased with the flow, and even the microcontroller picks up a small voltage value of 5 on C2p04. In light of that, I have changed pinconfig1 from 0 to 1 for low voltage. I will have to test the rest of the combinations Monday - still kind of stumped. At least now I think the signal will be interpreted and transmitted when it does register.

Looks like the controller can handle up to 32000hz so I don't think that's the issue. I'm beginning to think its my wiring. I've been using alligator clips to flip which meter pin goes to the input, doing so for each new configuration just to be sure. One signal to micro input and the other to 5v sensor ground (on a terminal coming from the MC024-010 that the IX is used with). I think this could be an issue (despite CAN) - I will try again with the 5v coming from the IX. Thank you all for the tips.
Title: Re: Flow Meter Integration
Post by: BRIan on October 12, 2014, 11:00:58 PM
I don't recall any controller being able to handle anything like 32kHz. The datasheet says 10kHz max.
Title: Re: Flow Meter Integration
Post by: Jakob on October 13, 2014, 10:17:51 AM
For the IX module it does actually does say, range 0 – 35300 Hz.
Is this really correct ?
I'm finding it hard to believe, because the Controllers only range 0-10000 Hz.
Title: Re: Flow Meter Integration
Post by: Thomas on October 13, 2014, 10:58:28 AM
Hi Jakob!

I was also surprised so I had to check myself. Attached is the data sheet from our website.
http://www.plus1forum.danfoss.com/index.php?action=profile;u=342 (http://www.plus1forum.danfoss.com/index.php?action=profile;u=342)

I am not sure if you did find it in an older version of the data sheet.

Hope this helps // Thomas
Title: Re: Flow Meter Integration
Post by: Jakob on October 13, 2014, 11:49:26 AM
Hi Thomas

I was looking in the PLUS+1 Compliant IX024-010 Function Block User Manual from 2009, so in the datasheet (http://files.danfoss.com/documents/520l0711.pdf (http://files.danfoss.com/documents/520l0711.pdf)) it does say 0-10 kHz.
Title: Re: Flow Meter Integration
Post by: Fitzsimmons Hydraulics on October 13, 2014, 08:40:23 PM
I'm seeing on my data sheet 10kHz as well. I've since been able to get the flowmeter working. It was a grounding issue. Now I've grounded the flowmeter to the IX and it's seeing a frequency and outputting a flow value to the display.

We hooked up a 90 series pump and the display was showing max flow. (35gpm, I believe 55cc) The service took freq signal value reads about 120-130 and flutters around 31-36 gpm as a result. I assume this means 120-130Hz. Problem now is, when we destroke the pump the flow value reads 0. Service tool reads 0 for freq as well, so I don't think there's an error in calculations. The pump is not in neutral when this happens - it is still flowing, the signal is simply zeroed out once the frequency signal crosses some lower threshold. I have tried some different pin configurations and the only one that accepts the signal is pinconfig0=2 pinconfig1=1 for pull down and low range voltage.

If I had to guess, this must be what oiltronic was talking about. Frequencies which would be lower than 60hz don't appear to be registering. I will try to use the period input instead. Thanks all for the input, back to the test bench for now!
Title: Re: Flow Meter Integration
Post by: BRIan on October 14, 2014, 01:41:46 AM
It will measure lower frequencies than 60 Hz (provided the sensor output doesn't also drop too low).
The problem is the FREQ signal is an Integer and therefore is limited in it's resolution.
As a norm when the pulses per rev or the rpm are low, I use the PER signal and as long as you are careful with maths you can get perfectly adequate accuracy.
Title: Re: Flow Meter Integration
Post by: Neil on October 20, 2014, 10:13:20 PM
Hi Guys,

I'm coming in late on this one, have you checked the voltage at the pin and change .PinConfig1: to suit the voltage range?

regards Neil
Title: Re: Flow Meter Integration
Post by: Fitzsimmons Hydraulics on October 20, 2014, 10:21:28 PM
Yes, its a low voltage signal. It's picking up the signal now. I changed my program from using the freq to using per, and it works just like freq did. High flow pumps are ok, and are pretty accurate, but for some reason low flow just doesn't register. I'm going to do more testing and come back to this at a later date. I think it's possible now that the internal calculations are going out of range, even with a U32. What happens when a value goes out of range, anyways? Does it drop out to zero, or does it stick at the max bit value?
Title: Re: Flow Meter Integration
Post by: oiltronic on October 21, 2014, 12:20:40 AM
"Out of range" integer calculations typically overflow and wrap around again, or in other words the result of the calculation is clipped to the number of bits at the output.  It helps to understand binary, or how microprocessors do arithmetic.

If there's ever a risk of overflow, despite what the "normal" operating conditions should be,  always use the "capped" version of the arithmetic operator which limits the output to the highest value of the data type.
Title: Re: Flow Meter Integration
Post by: Fitzsimmons Hydraulics on November 05, 2014, 11:06:05 PM
Still working on this circuit. I've been waiting to test if this low flow error exists in our glycol loop as well, considering the oil meter I've been working with so far is very old and perhaps unreliable. Turns out the glycol loop behaves in the same way.

The period signal grows larger as the pump flows less, until around 17-18 GPM. Here is where I see the signal drop off. I've logged this data by tenths of a second and found that as the flow approaches 17-18 gallons, the signal begins reading very large, intermittent values. As the flow reaches these values, the period signal seems to latch to 10,000,000. I believe this is the same as 1Hz, or the lowest frequency that the controller can register. To me it seems that the turbine blades are being "missed" by the pulse pickup, since the absence of a signal would generate a period value of infinity.

Due to this, I went and looked at the specs for our meters. Our Blancett 1100 series model B111-115 for glycol is rated for 15-180 GPM, so I think the easy answer here is that we need a smaller meter. However, this is not conclusive to me because the oil flowmeter is a Flow Tech LT750 rated for 5-172 GPM, yet behaves in the same way.

I have attached a screenshot of the flowmeter page as well as some test data from a logfile generated with the oil flowmeter. Any thoughts, suggestions, or speculations are very welcome - it almost works but I'm a bit stumped! Sorry for so much data - the strange readings begin around time stamp #46000. The data out represents GPM times 10.
Title: Re: Flow Meter Integration
Post by: oiltronic on November 21, 2014, 04:32:02 AM
Executive summary:
Long-Winded version:
I believe the 10,000,000 value is a limit within the IX024 module for a .Per input which I've ran into before (on an MC050).  So I just used the period measurement component instead.  I've considered using multiple measurement methods before (.Freq input, .Per input, period components, etc.) , each with a different span, then selecting the appropriate one according to the current rate.   Thankfully I never had to go that far.

Considering the inertia of hydraulic fluid and glycol, the numeric jumps & hiccups in your spreadsheet data really seem like missed pulses.  But if those are analog-output mag-pickup sensors, then the peak-to-peak voltage of the sensor might decrease with flow.

Try an oscilloscope on the meter output, both when connected to the input and when disconnected, so you can see what the pin is seeing and maybe adjust the input pull-up, voltage span, and threshold voltages on that pin.  Maybe there is a digital output option for those meters.

I would also try to hook up any high-speed inputs like that to the main controller, and leave the IX module for slow analog or digital inputs.  This would also let you try using the period component.