S7 scaling and counting

vbcwijlre

Member
Join Date
Jul 2005
Location
the stad
Posts
3
hello people

im after some help with s7.

I have a filter where fluid goes through with 0–200 kg/s at 0-20mA.

The signal comes in to PIW256.

I have used the scale function:



CALL"SCALE" (
IN := PIW256,
HI_LIM := 2.000000e+002,
LO_LIM := 0.000000e+000,
BIPOLAR := FALSE,
RET_VAL := #wFC105Return,
OUT := PQD512;



Now my problem, I have to count up my output (PQD512) every second, till it reaches 10000kg. If it has reached 10000 I have to pulse output Q10.0 high en reset the counting so it starts again with counting from 0 till 10000.
 
Note that FC105 produces a floating point output. You are (unusually)writing the floating point value to PQD512. What is connected to PQD512 ? or did you mean to store the instantaneous flow value in an MD location for later processing ?
 
There is nothing connected to PQD512 so I can also put a MD on the output that's no problem. The only thing I have to do with the output is count it up till 10000kg and lit a light for second when it has past 10000kg and then I have to start counting again from zero and do the same
 
So PIW256 is also a 'dummy'-input?! Why do you need this PIW, because according to your desciption of the problem, it has nothing to do with you 'counting'-problem.
---------------------------------------------------------------

A fast guide for a possible solution;

a) In the hardware-configuration, you can create a puls that becomes high every second (properties: cycle/clock memory).

b) A normal counter only counts to 999, it's easier to use a variable to count;

L 1
L var1
+I
T var1

c) You have to make this counting conditional (once every second), so or you use 'jumps' or you use a conditional call to an FC/FB.

d) because the puls stays high a long time you need to use an edge-detection to create a puls for your counting condition.

e) make a comparison with var1 and 10000. If they are equal you must transfer '0' to var1 so you can count again from 0.

f) make Q10.0 high is the comparison is true but this will be only a short time untill the reset of var1. Look if this does what you need it to do...
 
Assume the output from FC105 is rMassFlowInKgpersec.
Setup OB35 to run every 10ms.
Assume mass flow doesn't change much during 10ms so simple integration will be applicable.
bTimerStartCondition can be used for starting your 1 second timer.

The pseudo-code for OB35 will be as follows:

rMassKgThisSample:=rMassFlowInKgperSec * 0.01;
rMassKg:= rMassKg + rMassKgThisSample;
If rMassKg >= 10000.0 then
rMassKg:= rMassKg - 10000.0;
bTimerStartCondition:=True;
Else
bTimerStartCondition:=False;
EndIf


(NB: how do you force white space at the start of a line with this editor?)
 
Last edited:
u have scaled the analogue input and now u have a value of the current flow rate in kg/s in a memory location say "MD 0"


now u want to integrate this value to change from rate to qty

u can use this code

a t1
=m2.0
an t1
l s5t#1s
sd t1

this will generate a pulse every one second

now if u want to totalize

use the following

a m2.0
jcn x1
l md4
l md o
+r
T md4


x1:nop 0

this means add to the totalizer the value of the flow rate every 1 sec

now u can use a cmpare function to set the output

l md 4
l 1000.0
>=R
=q0.0
 

Similar Topics

I want to measure the tank level and get the sensor output to the PLC. Below are the details : Tank Height =0 - 3m, the sensor is stalled 0,2m...
Replies
14
Views
504
Hi, I have a ControlLogix system with 1756-IF16 analogue inputs. I can't scale the inputs at the card as there is a requirement to facilitate...
Replies
10
Views
217
I know nothing about simaticnet OPC server. I do know Kepware. I would only ever scale raw to engineering in the PLC, but it is possible to scale...
Replies
5
Views
216
Hi all. I'm working on a rehab and I'm trying to figure stuff out. See screenshot at the bottom. Local:5:I.Data[6] in BTD instruction is a...
Replies
6
Views
707
Hello all, First post here. Hitting a wall with finding info on this topic online, and none of my coworkers have a clue. I have a PanelView...
Replies
10
Views
1,340
Back
Top Bottom