News:

  • June 09, 2026, 10:52:53 AM

Login with username, password and session length

Author Topic: Integration of flow rate  (Read 15860 times)

Northwoods

  • Newbie
  • *
  • Posts: 4
Integration of flow rate
« on: April 11, 2008, 03:32:40 PM »
Has anyone done a "Totalizer / Integrator " function of a flow rate.
this function would totalize and retain a running total.
I am thinking of loading a flow rate ( in lbs /Hr), dividing by 3600 (lbs / sec) and adding the new lbs /sec every sec.

Is there a better way? easier?

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Integration of flow rate
« Reply #1 on: April 11, 2008, 05:03:14 PM »
In what form are you receiving the lbs/hr and what is a typical value. How often is this updated?
An output is a PLC's way of getting its inputs to change.

Northwoods

  • Newbie
  • *
  • Posts: 4
Re: Integration of flow rate
« Reply #2 on: April 12, 2008, 08:37:43 AM »
Inputs are 4-20 mA typical on AI card, lets assume 10,000 lbs/hr steam flow, and i want each "count" of totalizer to equal 100 lbs.
So at full scale flow rate (10000) in 1 hr your totalizer would move 100 counts.

the update could be continuous or we could use SP5 conditional   ::)

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Integration of flow rate
« Reply #3 on: April 12, 2008, 08:50:44 AM »
What I want is an actual number which the analog input will supply while the process is running at your 10,000 lbs/hr flow. You then need to do the associated math on paper. Think about the type of math and data representation (integer versus floating point or 'real). Think about the preservation of precision when you divide by 3600.
An output is a PLC's way of getting its inputs to change.

Northwoods

  • Newbie
  • *
  • Posts: 4
Re: Integration of flow rate
« Reply #4 on: April 12, 2008, 12:23:35 PM »
I guess thats part of my problem I don't know whether to set the AI card for BCD or Bin and what would be best.
I should have decimal resolution to at least two places on the per sec. variable
I need to learn more about the PLC and how to convert the formats for numbering that are available.
If I use bcd then I can range my input in the PLC to 0-10000 then DIV by 3600 for lbs/sec and store that in a register ie. V3000
Then every second thereafter I need to add the next lbs / sec to that register (V3000) when the register equals 100 counts then I add a one to another register ie V3002, and clears the previous register V3000, and start all over.
Sound dooable?

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Integration of flow rate
« Reply #5 on: April 12, 2008, 12:55:02 PM »
You are providing so little actual information that it's hard to give any advice. If the analog card is 10 bit then you get at most 4096 steps. What does that give you if you divide by 3600. Either 0 or 1. You have lost all precision.

Instead add the total amount from the analog card to a double location. Let's say the analog input shows up at V2000. (In the following I'm assuming BCD. If using binary then use the form in parentheses)

LD V2000
ADDD V2010 - double sized number - accumulate up to 3600 readings (ADDDB)
OUTD V2010

Now this keeps in full precision the measurement accumulated in V2010,V2011. Now divide by 3600 to get the total accumulated so far.

LDDD V2010
DIVD K3600  (DIVDB KE10)
OUT V2020 - total accumulated so far

Each hour you can add the previous hour's accumulation to a double sized integration value and clear your previous values. Perform the previous 3 lines of code then...

LD V2020
ADDD V2030 - double sized accumulator made up of V2030, V2031 (ADDDB)
OUTD V2030

LD K0
OUTD V2010 - this clears you accumulation of the raw values

On some very long term timing you can move V2030,V2031 to somewhere for safekeeping then clear them with:

LD K0
OUTD V2030

« Last Edit: April 12, 2008, 12:57:16 PM by b_carlton »
An output is a PLC's way of getting its inputs to change.

Northwoods

  • Newbie
  • *
  • Posts: 4
Re: Integration of flow rate
« Reply #6 on: April 12, 2008, 02:49:00 PM »
I'm sorry, I have a 16 bit AI card in a DL06
I was figuring on bringing the value(flow rate) in and scaling it to engineering units and then performing the Math functions.

Thank you for your input.