PLC Benchmarking

Archie

Member
Join Date
May 2002
Location
Orangeburg, SC
Posts
1,944
This is a bit of an academic exercise and more so a curiosity, but I created a couple quick program tests to see how program processing time varied amongst different PLCs. My test was very simple. I loaded a small intensive program into the PLC, then checked the program scan time. It is a very basic test and doesn't give the whole picture of a PLC, but gives a comparison from one aspect.

The first program was a math test that multiplied 2 Real numbers, then converted to Dint. It was done for 100,000 elements. This is the code in AB format
Code:
FOR i:=0 TO 99999 DO
	DINTResult[i]:=(REAL1[i]*REAL2[i]);
END_FOR;

The second test was a worst case bubble sort of 1000 elements.
Code:
Result[0]:=2;
Result[999]:=-1;

REPEAT
	swapped:=0;
	FOR i:=1 TO 999 DO
		IF (Result[i-1]>Result[i]) THEN
			Temp:=Result[i];
			Result[i]:=Result[i-1];
			Result[i-1]:=Temp;
			swapped:=1;
		END_IF;
	END_FOR;
UNTIL (NOT swapped)
END_REPEAT;

The main reason I am posting here was to see if I could interest anyone in testing on different platforms and posting the scan time result. Since I do not have access to every PLC and platform, I would like to see if anyone would be willing to run these tests and posting their results. Just to list a few platforms I cannot test:

Siemens
Newer Omron
AutomationDirect
B&R
 
Interesting... I'm wondering how you would do this test on a controller like Beckhoff where the scan time is specified? Run the code and adjust the scan time until the processor core usage gets close to 100%?


I'd be curious to see the results of ControlLogix vs Beckhoff.
 
I can test on Siemens "classic" PLCs such as IM151-8 and 315-2PN/DP (-EH14).
And on Siemens TIA PLC such 1512SP.
These are what I have laying around for testing. These CPUs are "small" types, not the more performant types.
 
When I get back to the office I will run the tests on a Beckhoff CX8090. I should be able to get the scan time by looking at the online monitor of the Task.
 
To do this correct, I need some more info.


First code, do you have an array of reals and store the dint result in another array?
If so, what values do you have for the reals. I think it would be easier to just multiply the I value?
My PLC limits the array size to 65536 DINT entries.
I also believe the 100,000 * 100,000 would result in an overflow for the DINT.
 
I just ran an adjusted code:


FOR "I" := L#0 TO L#49999 DO
"Result" := REAL_TO_DINT((DINT_TO_REAL("I")) * (DINT_TO_REAL("I")));
END_FOR;


300 ms cycle time in a 1214C, without monitoring.
I use a DI to start/stop the sequence and capture cycle time with standard blocks and record min and max cycle time.
 
Originally posted by boneless:

I just ran an adjusted code:

I think you have a few more conversions that were intended.

The code Archie posted in the FOR loop multiplies two REALs from two different REAL arrays and stores the result in a DINT array. So you don't need the two DINT_TO_REAL conversions in the equation but the arrays need to be changed to REAL arrays.

Keith
 
Gotya, the code confused me, the DINTresult looked like a conversion to me, but it seems that the conversion is done automatically when assigning a real to a dint?


Edit:
I'll have to call it quits. My PLC cannot handle these large arrays. Maybe with a memory card, but I haven't got one handy.
 
Last edited:
One of the things that makes us AB users lazy is the fact that the PLC OS handles type conversion for us. Its one of the things that catch us when we move to other platforms. About the only exceptions are conversions to BCD or conversions to ASCII.

Keith
 
This would be the adjusted code for CodeSys based systems:
Code:
FOR i:=0 TO 99999 DO
	DINTResult[i]:=REAL_TO_DINT(Real1[i]*Real2[i]);
END_FOR

It seems AB has its own flavor of structured text. But it does the conversion automatically.

If the size of the array is too large, I imagine the result would be the if the same numbers were calculated in the loop like this:
Code:
FOR i:=0 TO 99999 DO
	DINTResult:=REAL_TO_DINT(Real1*Real2);
END_FOR
 
I tested the Beckhoff CX8090. I had to add a timer in the code to get cycle time and set the task cycle time to 1 second. And I adjusted the MathTest to use less memory:

Code:
PROGRAM MathTest
VAR
	Real1 :  REAL;
	Real2 :  REAL;
	DINTResult :ARRAY[0..99999] OF DINT;
	i : DINT;
END_VAR


FOR i:=0 TO 99999 DO
	DINTResult[i]:=REAL_TO_DINT(Real1*Real2);
END_FOR

Code:
Timer1.PT:=T#9999m;
Timer1.IN:=TRUE;
Timer1();

(*MathTest(); *)

BubbleSort();

Timer1();
ScanTime:=Timer1.ET;
Timer1.IN:=FALSE;
Timer1();

The results.....

MathTest : 255ms
Bubble Sort : 631ms
 
L16erm

I tested the CompactLogix L16ER. I had to adjust the math test to account for the limited memory, but only removing the result array:
Code:
FOR i:=0 TO 99999 DO
	DINTResult:=(Real1*Real2);
END_FOR;

The results.....

MathTest : 366ms
Bubble Sort : 1471ms
 
Omron CP1H

It seems my tests are too aggressive for the low end PLCs, so for the Omron CP1H I had to reduce my loops by a factor of 10, then extrapolate


MathTest : 203 x 10 = 2030ms
Bubble Sort : 235 x 10 = 2350ms
 

Similar Topics

Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
0
Views
1
Hello, I'm trying to delve a little into rs-485 communications for a couple projects of mine. Until now I've been using a delta vfd and a delta...
Replies
2
Views
38
Greetings All, I recently decided to start freelancing in Controls and Automation part time, most of my experience has been with Rockwell...
Replies
2
Views
85
I am having a problem communicating my PLC with Drive via Modbus connection. I start by opening the port and there is no problem, but then when I...
Replies
5
Views
51
I have worked on small projects using AB Micrologix but now we want to take a photo, process it online, and sort based on returned variables...
Replies
1
Views
87
Back
Top Bottom