Control Logix w/Flex I/O 1794-ID2 - Flow Rate

bcronk9977

Member
Join Date
Jan 2009
Location
NC
Posts
7
I am using an oval gear meter with a pulse rate of 2050p's /L. I am trying to figure out how to program a rate counter to track flow rate at values of less than 400mL/min and more than 100mL/min. I've come up with a number of pulses per mL (2.05). At 100mL per min, thats 205 pulses per min or 3.42 pulses per sec. How can I sample this and incorporate a PID loop to maintain a setpoint? In essence, I want to create a pulse counter in rate mode.
 
I'm probably going to get lambasted for this.

(*kFactor:= 2174.0;*) (*pulses per liter*)
FlowTmrPreset:= t#30m;
NoFlowTmrPre:= t#10s;(*.000254 pulses/ms = 7ml/min. Low ml limit is 8ml/min. Trying to set the timer to the longest
time that we would need so that we can show zero flow if we don't get any pulses for time*)

(*A1 flow rate*)
If A1FlowMlMin < 50.0 Then
A1FlowArraySize:=2;
Else
A1FlowArraySize:=6;
End_if;

A1FlowSensorRE (CLK := %I0.1.44.0);

A1NoFlowTmr (IN := not A1NoFlowTmr.q & not A1FlowSensorRE.q,
PT := NoFlowTmrPre);

(*If %Q0.3.19.0 Then*)
If A1FlowSensorRE.q & (A1PulseCounter < A1FlowArraySize) Then
A1PulseCounter:= A1PulseCounter + 1;
A1pulseTmrStart:= true;
elsif A1FlowSensorRE.q Then
A1pulseTime:= TIME_TO_DINT(A1pulseArrayTimer.et);
A1pulsesPerMsec:= INT_TO_REAL(A1PulseCounter) / DINT_TO_REAL(A1pulseTime);
A1pulseTmrStart:= false;
A1PulseCounter:=0;
elsif A1NoFlowTmr.q Then
A1pulsesPerMsec:= 0.0;
A1pulseTmrStart:= false;
A1PulseCounter:=0;
end_if;
(*Else
A1pulsesPerMsec:= 0.0;
A1pulseTmrStart:= false;
A1PulseCounter:=0;
End_if;*)

A1pulseArrayTimer (IN := A1pulseTmrStart,
PT := FlowTmrPreset);

A1FlowMlMin:= A1pulsesPerMsec * 1000.0 * 60.0 / (Int_to_Real(A1Kfactor) / 1000.0);
 
There are a couple of different approaches you can take.

You can count the number of pulses in a given time and calculate the flow from there. Use a timer and a counter - when the timer is done, do your calculation and reset them both. The longer your sample time, the more accurate your flow rate will be, but the slower your updates will be. Trial and error should find you a nice middle ground, and given that you're talking almost 3.5 pulses per second at your minimum flow rate, I think you should easily be able to find a workable range.

The other option is to measure the time between pulses and use that to calculate the flow rate. A lot more "instantaneous" in getting a reading - but the flip side is that it can be TOO instantaneous, and give you a very noisy signal. If you want to go this way you may need to look at using a FIFO to sample a handful of values and average them out to give you a more stable result.

Happy to give you some more detailed info on how to run with either approach if you need!
 

Similar Topics

Hello everyone! I have a control logix plc that is set up to communicate with 6 1794-asb flex i/o racks. Everything has worked good over...
Replies
5
Views
498
Folks, Putting together a system utilizing a Control Logix Gen 8 (5580) PLC w/ the L83e CPU. I'll be connecting to 8 different FLEX-IO drops...
Replies
13
Views
4,077
Hello Experts, Can any one please tell me how to calculate CPU loading for L73 controller with flex IOs. I want to calculate the CPU loading...
Replies
4
Views
2,151
Hi; I am converting a PLC5 to Control Logix; I have a bunch of DNET Powerflex 70 drives. I have used the tool to build my data base; and I'm...
Replies
2
Views
1,715
Im trying to add a remote rack to a plc with a 1756 controller i like to use flex I/O as the remote rack for space resons but dont know how to...
Replies
7
Views
3,436
Back
Top Bottom