PLC Benchmarking

Kunbus RevPi Connect

My final test was with CodeSys 3.5 on a Kunbus RevPi

MathTest : 2.5ms
Bubble Sort : 30ms

If anyone is interested in any of these programs I used for testing, let me know and I can send them to anyone.
 
Tested it on Codesys RasPi 3 model B+.
It runs executes the code really fast but after one minute overheats and the internal protection overheat kick in and disables the CPU or something like that. Then it needs to be restarted.

FOR i:=0 TO 99999 DO
DintResult:=REAL_TO_DINT((REAL1*REAL2));
END_FOR;

RasPi Bench 1.png
 
I set up my Kunbus RevPi which is based on the Rasberry Pi compute Module and let it run for longer. So far it has been running for 15 minutes with no issue. I will let it run all day to see if it over heats.


I also set my task to Free Wheeling to put a bit more load on the CPU.


After 1 hour the CPU temperature is holding steady at 50.5degC and the CodeSys process is using 50.5% CPU

RevPiScan.png
 
Last edited:
My mistake.
I checked the CPU temp and it stays around 60 degC. Core load is under 80%.
It doesn't overheat but for some reason I lose connection with Runtime from Codesys IDE.

Since RevPi has a Real time patch there seems to be a huge difference in jitter.
 
Last edited:
I think that a less memory intensive test is required for small computers.
Also, there need to be 3 different tests. One for bit twiddling, one for integers and one for floats. Some smaller computers may not have a FPU and must handle the floats in software but their bit twiddling and integer math may be just as good as CPU with FPUs.
A lot of the early or cheap ARM CPUs did not have FPUs but they for many applications that don't require floating point because they are low power.

Measuring the temperature is good. It reflects on the quality of the design.

I would use two prime number tests. I would use one that uses the sieve method but I would make each element a bit. This would reduce the amount of memory by using bits instead of whole registers. That one test may be good enough for testing bits twiddling and integers. For floats I would NOT use a simple multiply. Many CPUs may have the ability to do multiplies, adds and subtracts but not divisions.
Divisions are a killer.
Some CPUs have divisions but few can do neat things like pow(x,y).

The other thing that hasn't been mentioned is the quality of the compiler and whether the code gets compiled down to machine code or some sort of pseudo code that gets interpreted later.
 
Since RevPi has a Real time patch there seems to be a huge difference in jitter.
I also changed to CodeSys service to run at a NICE value of -20 so it would have the highest priority. I also found that by setting the task's CPU core to floating, it keeps a lower jitter.
 
I am traveling until next week. I can try this on a recent Wago PLC when I get back if anyone is interested, CoDeSys programming.
 
The other thing that hasn't been mentioned is the quality of the compiler and whether the code gets compiled down to machine code or some sort of pseudo code that gets interpreted later.
This is why I think the CodeSys based system are so much faster than the AB and Omron's that have been tested.

I am traveling until next week. I can try this on a recent Wago PLC when I get back if anyone is interested, CoDeSys programming.
I'm definitely interested in any platform being tested to compile a larger array of hardware comparisons.
 
Maybe some compilers will remove the array multplication and replace the result with a constant value generated by the compiler at compile-time. It all depends of the memory area you get the values from.
If you want to compare the CPU performances, you need to make sure that the memory areas which are accessed are "volatile", thus the compiler is forced to generate the code which does the multiplication. For bubble sort it's not as ease to optimize, but I think if you program a bubble sort on a PC with a C compiler where the compiler knows at compile time the values which are to be sorted, it will remove the sorting code completely.
 
I've created the following SCL using Siemens S7 Classic.
The size of the data arrays is limited to the data block size.



Code:
FUNCTION fc1:VOID
VAR_TEMP
    i:INT;
END_VAR

FOR i:=1 TO 16383 DO
 "dbdata3".diData[i]:=REAL_TO_DINT("dbData1".rData[i] * "dbData2".rData[i]);    
END_FOR;

end_function
 
The compiler produces the following code, of which there are 2 floating point intructions, the rest are for the for loop, array indexing and data access. (I've not checked the option where array bounds are verified either).



Code:
A7d0: L     #i
      L     16383
      <=I   
      JCN   A7d1
      L     #i
      ITD   
      L     L#-1
      +D    
      L     L#32
      *D    
      L     L#0
      +D    
      L     #i
      ITD   
      TAK   
      T     LD     4
      TAK   
      L     L#-1
      +D    
      L     L#32
      *D    
      L     L#0
      +D    
      L     #i
      ITD   
      TAK   
      T     LD     8
      TAK   
      L     L#-1
      +D    
      L     L#32
      *D    
      L     L#0
      +D    
      LAR1  LD     8
      OPN   "dbData1"
      L     DBD [AR1,P#0.0]
      TAK   
      LAR1  
      TAK   
      OPN   DI     2
      L     DID [AR1,P#0.0]
 [B]     *R    [/B]
     [B] RND  [/B] 
      LAR1  LD     4
      OPN   "dbData3"
      T     DBD [AR1,P#0.0]
      L     #i
      L     1
      +I    
      T     #i
      JU    A7d0
A7d1: CLR
 
Archie-

This is from your website:
Test Code in RSLogix Format

MathTest


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

This version of code isn't doing the indexing into the arrays. Is this the way this was written or was it actually written with the arrays?

Keith
 
Archie-

This is from your website:


This version of code isn't doing the indexing into the arrays. Is this the way this was written or was it actually written with the arrays?

Keith
I had to alter the original test code because many of the controllers did not have the memory for 300,000 array elements.
 

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
1
Views
33
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
49
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
95
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
64
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
94
Back
Top Bottom