Hi Peter, I just have a quick minute at my desk and happened to see your question. Is it possible for you to setup your 1440 array as a circular queue and use a pointer to point at the most recent value. That is, when it comes time to update your latest value you increment your pointer and just write the one new value to this location overwriting the oldest value. You always know that the pointer points at the newest value, the next newest is one offset below, etc. around to the oldest value in the next position after the pointer. =20 For example Pointer =3D 100 - Newest value is in ARHR[100] - 2nd Newest is in ARHR[99] - 3rd Newest is in ARHR[98] | | - 3rd Oldest is in ARHR[103] - 2nd Oldest is in ARHR[102] - Oldest is in AHRH[101] On next update you increment the pointer to 101 and write the new value into AHRH[101] Now Pointer =3D 101 - Newest value is in ARHR[101] - 2nd Newest is in ARHR[100] - 3rd Newest is in ARHR[99] | | - 3rd Oldest is in ARHR[104] - 2nd Oldest is in ARHR[103] - Oldest is in AHRH[102] Of course you have to wrap the pointer back to 1 when it reaches 1440 IF pointer < 1440 THEN Pointer :=3D Pointer + 1; ELSE Pointer :=3D 1; ENDIF; =20 Although not in HLBL I we have used this scheme in many similar applications. Hope this helps. Tom Badura=20 Plastics Engineering Company -----Original Message----- From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On Behalf Of Bruley, Peter T Sent: Thursday, May 15, 2008 1:46 PM To: 'Foxboro DCS Mail List' ('Foxboro DCS Mail List') Subject: [foxboro] HLBL Array Question Gentlemen (and Ladies) I have a large array size is 1440 (holds 24 hours worth of 1 min sa=3D mples) Every minute I want to update the 1 of the sample value and throw o=3D ut the oldest value. Problem 1) Currently I am shuffling each value 1 at a time using this loop: ---------------------------- x :=3D3D 1; SN01 :=3D3D "Preparing Array for new value ...."; WHILE (x < 1440) DO ARHR[x] :=3D3D ARHR[x+1]; {* throw out arry position 1 and = shuffle *} x :=3D3D x + 1; ENDWHILE; ARHR[1440] :=3D3D RI01; {* Load newest value into array = position 14=3D 40 *} ------------------------------ This works however just to shuffle the values takes almost 30 secon=3D ds. Is there a quicker way to do this ? Is there a way to copy array position [2] through [1440] to another a=3D rray using a single command ? Problem 2) During the next step of my sequence I have to find the average for =3D the last 24 hours so I need to find the sum of the array then divide by 144=3D 0. I use the following loop to find the sum: ---------------------------- y :=3D3D 1; SUM :=3D3D 0; WHILE ( y < 1441 ) DO SUM :=3D3D SUM + ARHR[ y ]; y :=3D3D y + 1; ENDWHILE; RO01 :=3D3D SUM/1440; {* 24 Hour rolling average *} ---------------------------- Again it takes about 30 seconds just to find the sum of the array. Is there a quicker way to find the sum of an array? Thank You, Peter Bruley =20 =20 _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html =20 foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: = mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin to unsubscribe: = mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave =20 _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave