Crimson Instruction Speed------ Fill vs Loop

UKB

Member
Join Date
Aug 2014
Location
UK
Posts
56
Hello,
Ive got a program where I frequently have to write 0's into every element of an array,
at the moment Im using loops to do this;


for
( d=0 ; d<=1200 ; d++)
{
Array.corrected[d] = 0.0;
}



Would there be any advantage to using the Fill command to the same result?

Fill (Array.corrected[0],0.0,1200);


many thanks,
UKB
 
It would depend on how they code the fill routine, It could just be a function you call where they have coded the function with a for next loop so would probably be not much difference, however, if the function was written in assembler then it would probably be faster.
For example, the for loop in logix 5000 takes longer than their FLL function according to the instruction execution times.
for example the for instruction in CLX is 0.268 + (x * 1.05) X being the length of the loop. 0.087 + (x * 0.04) for the FLL function.
 
Hi parky, thanks for the info, is that in micro seconds? it looks like a significant difference, 25 x faster ?

FOR LOOP
x = 1000
x * 1.05 = 1050
+0.268 = 1050.268

FILL
x = 1000
x*0.04 = 40
+0.087 = 40.087
 
There is a system variable DispUpdates that returns the number of screen updates per second as an integer. I am assuming that screen updates are related to program speed. So you could try both ways and see which is quicker.
 
I was curious about this question also as I've done it both ways in the past. I have a Red Lion CR3000 set up on a new machine so I went ahead and did a quick test. First I used your looping logic but I used an array size of 16000 (the largest Crimson will allow). I put it into a background 'while' loop that executes forever and increments a tag every time the 'For' loop finishes. That tag is displayed on the screen so I could get an idea of how fast it was running.

With the 'For' loop, the tag was incrementing about 10 times per second.

I then replaced the 'For' loop with a 'Fill' statement to put 0.0 into all 16000 elements. This caused the counting tag to increment about 20 times per second.

So the result is that using the 'Fill' command is roughly twice as fast as an equivalent loop.
 
I was curious about this question also as I've done it both ways in the past. I have a Red Lion CR3000 set up on a new machine so I went ahead and did a quick test. First I used your looping logic but I used an array size of 16000 (the largest Crimson will allow). I put it into a background 'while' loop that executes forever and increments a tag every time the 'For' loop finishes. That tag is displayed on the screen so I could get an idea of how fast it was running.

With the 'For' loop, the tag was incrementing about 10 times per second.

I then replaced the 'For' loop with a 'Fill' statement to put 0.0 into all 16000 elements. This caused the counting tag to increment about 20 times per second.

So the result is that using the 'Fill' command is roughly twice as fast as an equivalent loop.

Great test, I had ideas of doing something like this, you saved me alot of time, thanks
 

Similar Topics

Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
1
Views
75
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
97
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
86
Has anyone setup communications with Red Lion 3.0 MODBUS to Baker Hughes Centrilift GCS VFD? Thanks
Replies
0
Views
81
Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
150
Back
Top Bottom