Data persistance as Static or IN_OUT ?

LucSnijers

Member
Join Date
Mar 2019
Location
Antwerp
Posts
3
Hi all,

( i use Siemens S7)

I'm writing code to calculate a totalizer: a trigger adds a value to a counter, the counter is written to a DB, where it is read by the HMI. The counter cycles at 1000000. The value is historised and used for shift reports.

My question is where you prefer to persist the total value?


A. As a Static variable in the FB
>> The FB writes the value as an OUT parameter.
>> The DB/HMI value is always overwritten by the FB.
>> When you update the FB, the totalizer is reset.

B. In the DB / HMI tag
>> The FB reads and writes the values as an IN_OUT parameter.
>> When the FB is updated, it uses the DB value to continue the count.
>> When the DB is updated, the totalizer value is lost.

thanks, Luc
 
If the data is used only inside the FB, then part of the instance (STAT).
If the data is also used elsewhere outside the FB, including HMI, then in a shared DB, possibly defined via a UDT (via IN_OUT).

So you may very well have a combination of STAT and IN_OUT data in an FB.
 
If the data is used only inside the FB, then part of the instance (STAT).
If the data is also used elsewhere outside the FB, including HMI, then in a shared DB, possibly defined via a UDT (via IN_OUT).

So you may very well have a combination of STAT and IN_OUT data in an FB.

So your idea is never to use OUTPUT parameters on an FB ?
 
No, I replied to your question regarding persistence of data.
OUTPUTs are usually used for what must be controlled.
They do not have persistance. It is very important that outputs are always assigned in the FB. They must not be bypassed or read before assigning.
 

Similar Topics

Has anyone migrated Proficy Historian data to a new server? I followed the guide to move all the data over, but when I run the utility, it stops...
Replies
0
Views
18
I cannot add SLC500 analog input tag (I: 8.3) to EZSeries Touch Panel Editor (V 5.3). I used all the listed tag datatype but it all says "Invalid...
Replies
3
Views
66
Hi, Wy we log data in PLC using DLG instruction, when we have option to log data in HMI
Replies
1
Views
59
Hi, I cannot find the DLCA1764.EXE utilty software for data retrieving. Can someone share the link to download this software. Thanks!
Replies
1
Views
27
I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
361
Back
Top Bottom