SUM of Persist value


PRAJASEKAR

Recommended Posts

I have created program to read analog channel (x) continuesly and create sequence to average the value at 60 sec cycle

then using sum() function adding them all,this works fine but i have to do this for 8 hrs then history length should be 28800

can it be possible to sum()value by keeping history and persist at 1

regularly adding the value using loop - sample

1 st value - 9000,9010,9015,9020 ....

Since i have history & persist = 1 only recent value getting changed but not getting added to previous value

Link to comment
Share on other sites

We have indistrial computer ( Siemens -Simatic IPC -670) with partion size of 1GB (C:Drive) and OS - windows 2000 professional

Operator interface of OEM and OS has consumed about 700MB of space thats why we want to try out,Pl suggest any better way store pl be advised

Link to comment
Share on other sites

OK, that is a good reason :)  Yes, you can do it.  Use an event on the input channel, then create another channel (or variable) to hold the running sum.  So, if the X is your input channel, create a Test D to A channel called Y (or whatever you want), and in the Event for X, put:

Y = InsertTime(Y[0] + X[0], X.time[0], 0)

The InsertTime() is required so the correct timestamp is used.  You don't want it to use the timestamp from Y[0], since that would then never change.

You'll need to initialize Y for it to work:

Y = 0

and you can reinitialize it, say at the end of each 8 hour period, with the same line.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.