Tia portal Siemens - Flow

I don't think your segundos/seconds counter will work as it will only count when your flow pulse is active, unless you're doing something different to what I've assumed.

Looks like you're also zeroing both counts every minute?

To get to m³/h you'd need to do ((3600/segundos)*totalizer)
 
good , how do i calculate the instantaneous flow according to the flow totalizer in the tia portal ?
1 pulse = 1m3/h [?]

Unless each pulses indicates a unit of flow (rate, i.e. volume per time), and not only a unit volume passed since the previous pulse, I suspect the bold red italicized statement above is a typographical error.

The PLC is a discrete device, not a continuous device such as an orifice flowmeter with a manometer, so there is no such thing as an "instantaneous" measurement in a PLC, there are only "the most recent measurements." Also, the volume pulse, assuming that is what this is, is a discrete event, which is another reason there is no such thing as an "instantaneous" flowrate.

The most recent flow rate would be calculated as

  • the most recent volume increment (pulse count) measured,
  • divided by
  • the most recent time increment measured for that volume increment.
and then converted to the desired units via multiplication by unity (i.e. multiplying by one).

But the devil is in the details i.e. when in time those incremental measurements are made.

Because PLC programming is primarily about time, and typically the scan cycle is the clock; in this case there is also the possibility of using an interrupt OB as the clock, triggered by the flowmeter incremental volume pulse. These represent the two primary approaches:

  • measure the incremental pulse count over a pre-determined chosen incremental time interval;
  • measure the incremental time over a pre-determined chosen incremental pulse count.
Both approaches have problems at low flowrates: the former approach yields noisy results; the latter approach may not update over long periods.

So the questions are

  • What does OP mean by "instantaneous" i.e. what non-instantaneous, discrete time increment is short enough to be acceptably called "instantaneous?"
  • How often should the value be updated (with the caveat that it cannot be updated more frequently than once per incremental volume pulse)?
  • What is the error budget for this so-called "instantaneous" flow rate calculation?
    • There are error bars around the volume represented by one pulse; what is their magnitude?
    • There are error bars around any time calculations made by the PLC. To wit ...
      • The scan cycle time is part of the error budget if this is done under OB1
      • The clock resolution and accuracy is part of error budget if this is done in an interrupt routine
  • What is the noise budget for the calculated?
    • Will some form of filtering be required?
    • Will some form of "no measurement has been available for the past N seconds" warning message be required?
 
[Update: fixed image to increment Segundos only on rising edge of 1Hz Clock bit]


[Update II: Unless 1 flow pulse represents 3600m3, the Totalizer value should be multiplied by 60, not divided, or we could simply add 60 to the Totalizer value for each pulse; see new attached image below]



Thanks ,yes I'm zeroing the counts. What changes do I have to make to the code for it to work?

Puddle said:
Looks like you're also zeroing both counts every minute?

@Puddle identified the problem.

Your code is actively changing the value of Totalizer that is being used to calculated the flowrate; you only need to calculate the flowrate every time Segundos reaches 60s, and you need to do it before the value of Totalizer is zeroed out; also, the incrementing of Segundos should happen independently of and asynchronously to what is happening with the totalizer pulse.:

Untitled.png
 
Last edited:
Another approach (not that there is anything wrong with OP's code that constructs CTU-equivalent functionality from atomic instructions):

Untitled.png
 
[update: correct image this time]


[update II: fix errors in image]


And the code golf version, if instead of 60 "instantaneous" updates per hour, 56+ updates per hour is acceptable:

Untitled.png
 
Last edited:
Thanks ,how do i do this to know the instantaneous flow through the pulses/totalizer ?


Set a self reloading timer of 1 second. When the timer completes take the number of pulses since the timer last completed and that will be pulses per second... if 1 pulse is 1 m3, then it's m3/s. Multiply by 60 and it's m3/min...
 
1 pulse = 1 m3 you have to convert to m3/h ?
the final value is already m3/h

thanks , why is the value 64 on the counter ?

Because then I can use bit 6 of the CTU object's CV output to reset the counter every 64 seconds.

The increment on Totalizer, at each single pulse, which pulse represents 1m3 passing through the flowmeter, is 56.25 = 3600 ÷ 64 i.e.
Code:
     [strike]s[/strike]    1 m[sup]3[/sup]         m[sup]3[/sup]
3600 - × -- -- = 56.25 --
     h   64 [strike]s[/strike]           h
Why does your original code divide by 60?
 
Last edited:

Similar Topics

I am currently am in a PLC class and need urgent help on how the ladder logic would be laid out. I understand how to get the traffic lights to...
Replies
19
Views
447
Hello, If the date on the license manager of tia Portal has expired, can I still work with it? or is this just to keep the program up to date...
Replies
7
Views
212
Hi everyone I've created an FC that includes the blocks TCON, TDISCON, TSEND and TRCV. This block has to be as generic as possible across...
Replies
15
Views
1,526
Hello, i can find the CPU when searching for it. But when I go Online i just get the icon for "Not compatible" everywhere. I get no additional...
Replies
4
Views
1,184
Hi, I want to initialise some tags on first scan only. As they are related to wall-clock time, I want to do the initialisation when the PLC first...
Replies
4
Views
1,176
Back
Top Bottom