[foxboro] HLBL Array Question
- From: "Bruley, Peter T" <Peter.T.Bruley@xxxxxxxxxxxxxx>
- To: "'Foxboro DCS Mail List' ('Foxboro DCS Mail List')" <Foxboro@xxxxxxxxxxxxx>
- Date: Thu, 15 May 2008 12:45:41 -0600
Gentlemen (and Ladies)
I have a large array size is 1440 (holds 24 hours worth of 1 min sa=
mples)
Every minute I want to update the 1 of the sample value and throw o=
ut the oldest value.
Problem 1)
Currently I am shuffling each value 1 at a time using this loop:
----------------------------
x :=3D 1;
SN01 :=3D "Preparing Array for new value ....";
WHILE (x < 1440) DO
ARHR[x] :=3D ARHR[x+1]; {* throw out arry position 1 and shuffle *}
x :=3D x + 1;
ENDWHILE;
ARHR[1440] :=3D RI01; {* Load newest value into array position 14=
40 *}
------------------------------
This works however just to shuffle the values takes almost 30 secon=
ds.
Is there a quicker way to do this ?
Is there a way to copy array position [2] through [1440] to another a=
rray using a single command ?
Problem 2)
During the next step of my sequence I have to find the average for =
the last 24 hours so I need to find the sum of the array then divide by 144=
0. I use the following loop to find the sum:
----------------------------
y :=3D 1;
SUM :=3D 0;
WHILE ( y < 1441 ) DO
SUM :=3D SUM + ARHR[ y ];
y :=3D y + 1;
ENDWHILE;
RO01 :=3D 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
_______________________________________________________________________
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: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
- Follow-Ups:
- Re: [foxboro] HLBL Array Question
- From: Bruley, Peter T
- Re: [foxboro] HLBL Array Question
- From: Johnson, Alex P \(IPS\)
- Re: [foxboro] HLBL Array Question
- From: Badura, Tom
- Re: [foxboro] HLBL Array Question
- From: Doucet, Terrence
- Re: [foxboro] HLBL Array Question
- From: Mike . Spigel
Other related posts:
- » [foxboro] HLBL Array Question
- Re: [foxboro] HLBL Array Question
- From: Bruley, Peter T
- Re: [foxboro] HLBL Array Question
- From: Johnson, Alex P \(IPS\)
- Re: [foxboro] HLBL Array Question
- From: Badura, Tom
- Re: [foxboro] HLBL Array Question
- From: Doucet, Terrence
- Re: [foxboro] HLBL Array Question
- From: Mike . Spigel