Flow Rate --> Total conversion in S7

emokar

Member
Join Date
Sep 2006
Location
turkiye
Posts
77
Dear Friends,

Is there a special function block in S7-300 which can be used to have a total counter value , from a flow rate value?

For instance,
I have many flowmeters on site , from which i gather flowrate info with 4-20mA analog inputs.
I need both flowrate and total volume of fluids.
So, i integrate flowrate to make a total volume. I have written this conversion math myself , but i think my program is not working sensitive enough. So the total flow numbers i have are not very reliable. I am looking for a way to make it better.

Regards,
 
What formula are you using to calculate total volume? Seems to me that the way you are doing it would be accurate.
 
Thank you Pandiani but this is already what i have been doing...
I was just wondering if there were any more accurate solutions, especially special blocks etc..
 
Well, OB35 is cyclic block and is supposed to be very accurat in timing. I doubt you can do it more accurate using PLC.
I'd like to be corrected, though.
 
I have often found pulse totalizers to be the easiest to setup and generally most accurate. Most of the flow meters I've used have a 4-20mA output for flow and a pulse output for quantity. Connect and setup the pulse output to a counter, and your problem is solved without too much programming.
 
Hello everyone,

I have downloaded the totalizer block from Siemens Support website and am using it now. It works quite well but i have one more question...

How can i force an offset value to the total value?
For instance i want the counter to start counting from an initial value like 2342 cubicmeters. How can i do that?

Do i have to use different FB's for each flowmeter? That would be hard to re-write? :(

Best Regards,
 
Last edited:
Here's a revised version that has a preset value added as an input.

Code:
FUNCTION_BLOCK FB 100
TITLE =
VERSION : 0.0

VAR_INPUT
  VALUE : REAL ; // Gemessener Wert innerhalb eines Zeitintervalls
  INTERVAL : TIME ; // Zeitintervall der Messung
  CYCLE : TIME ; // Abtastzeit
  COM_RST : BOOL ; // Rücksetzen auf Null
  rPresetValue : REAL ; 
END_VAR
VAR_IN_OUT
  TOTAL : REAL ; // Akkumulierter Ausgangsgesamtwert
END_VAR
VAR_TEMP
  tINTERVAL : REAL ; // Temporärer Zeitintervall im REAL-Format
  tCYCLE : REAL ; // Temporäre Zykluszeit im REAL-Format
END_VAR
BEGIN
NETWORK
TITLE =
//Rücksetzen der summierten Zwischenergebnisse in ACCUM und des Ausgangs TOTAL
	  A	 #COM_RST; 
	  JCN   nw2; 
	  L	 #rPresetValue; 
	  T	 #TOTAL; 
	  JU	Exit; 
NETWORK
TITLE =Umwandlung der Eingangswerte INTERVAL und CYCLE im REAL-Format
nw2:  L	 #INTERVAL; 
	  DTR   ; 
	  T	 #tINTERVAL; 
	  L	 #CYCLE; 
	  DTR   ; 
	  T	 #tCYCLE; 
NETWORK
TITLE =
	  L	 #VALUE; //Lade Eingangswert (Typ: REAL)
	  L	 #tCYCLE; //Multipliziere Eingangswert mit Zykluswert (Typ: REAL)
	  *R	; 
	  L	 #tINTERVAL; //Dividiere durch Intervallwert (Typ: REAL)
	  /R	; 
	  L	 #TOTAL; //Lade Wert im Zwischenspeicher
	  +R	; //Addiere Ergebnis zum Zwischenspeicher
	  T	 #TOTAL; //Transferiere neuen inkrementierten Wert zum Zwischenspeicher
NETWORK
TITLE =Bausteinende
Exit: SET   ; 
	  SAVE  ; 
END_FUNCTION_BLOCK
 
emokar said:
Do i have to use different FB's for each flowmeter? That would be hard to re-write? :(

Hello emokar;
For each flowmeter, call the same FB, with a diferent Instance DB number.
And of course with different parameters adapted to each flowmeter.

Hope this helps,
Daniel Chartier
 
dchartier said:
Hello emokar;
For each flowmeter, call the same FB, with a diferent Instance DB number.
And of course with different parameters adapted to each flowmeter.

Dear Daniel,

I already am doing it that way. I have only one FB100 and i am calling it multiple times with different DB numbers for different counters. The problem is that i can not write offset values for counted values seperately. I can change the code in FB100 to change reset value from 0.0 to whatever i want, but that is quite a long process. I temporarily changed resetting value from constant 0.0 to variable MDxx. That solved the problem but is not a proper way because there is possiblity to change wrong counters value... What i am trying to learn is if there is a better way how i can write offset values to seperate counter values easier and safer.

Regards,
 
Last edited:
Just replace your FB100 with the block provided for you in post #10 and you can specify an offset for each instance.
 

Similar Topics

I need to measure the volume of water used in during water intake phase of a CIP (washing program) in order to insure that there is a specific...
Replies
3
Views
4,319
OK then.... I've just been told the project going in has changed (no surprise, easily solved) but I've had a request to totalize the water going...
Replies
7
Views
2,781
This the problem guys I am installing flow meters at different sections of the plant to measure %loss in production. Since the flow meters are...
Replies
9
Views
5,903
Hi, The hardware is: Click Plc model # CO-O1DD1-O HMI model # S3ML-R magnetic-inductive flow meter model # FMM100-1001. I will set the flow meter...
Replies
4
Views
168
One of the engineers has asked me to add code to the PLC to calculate oil flow rate based on delta pressure, using the equation below: Flow rate...
Replies
13
Views
2,817
Back
Top Bottom