Code performarnce comparsion - Mitsu´s PLC

sczot

Member
Join Date
Nov 2017
Location
cz
Posts
80
Hello all,
this time is my question somehow theoretical, but with high practical impact.
Let asume we have simple program and we have to choose way of controling which step will be performed at time.
Another asumption would be, that steps are not as simple as those in attached pictures, and that there are actualy few dozens of them.


IMO deco version is much cleaner, easier to debug, and from what i have tried, it has lower step count when builded...

my question and point of debate I´ve with my colleague is: Is jump version faster (taking scan time into account) in actual real world PLC?

thank you for your insights



(It´s about Mitsu´s PLCs)


jumps.PNG.d061b1ec5722986abae9e091e4fe3be0.PNG

deco.PNG.13873e58defbbccb066655deb218defe.PNG
 
I'm not versed in Mitsubishi PLC's... but from what it seems to be your logic, I would think that the jump version would be faster because some instructions would be skipped. The problem is that instructions can take really really small amount of time, so it would take millions of them to see the difference... or some nifty logging software.
 
...I would think that the jump version would be faster because some instructions would be skipped...


yeah, the real question is how are the jumps processed by the CPU, does it really jump over the part of the code, or just scan the rung after the rung until the right rung label is found?

Because if the second is true, then imo there would not be much difference in searching for the rung label or checking the state of the virtual relay ... And then it would be nobrainer to use DECO method
 
Does that PLC have a while or a for instruction? You could add an instruction that would block the CPU for a certain length of time and measure that way.

I do not have proof, but when you say scan the rung, what do you mean? Your code clearly stated that the CPU is to jump that section. So what would you expect the processor to do? Load the instructions and data and skip assigning the results to the end variables?
What would be gained by this and worst of all, how much would it cost to implement on a processor level? Also, it seems like a useless feature (I may be wrong), that would inevitably lead to bugs and no real benefit.

I would say I'm 99% sure it jumps over (and if it has a compiler of sorts, in your case it would just delete some of the instructions straightaway). But I'm not the expert in Mitsubishi.
 
yeah, the real question is how are the jumps processed by the CPU, does it really jump over the part of the code, or just scan the rung after the rung until the right rung label is found?
It's highly unlikely that the compiler is so inefficient that the compiled program would have to examine every rung to find the matching label for the jump.
 
It's highly unlikely that the compiler is so inefficient that the compiled program would have to examine every rung to find the matching label for the jump.




well, after some testing is clear that compiler knows how to handle jumps...


I've encapsuled example codes into for/next loop with thousand repetitions.


Jumps get it done in 31ms
Deco in 99ms


(FX3GE)
 

Similar Topics

Hi! I want to understand this code, who does is word. IF #"Sample timer".Q =1 THEN FOR #Ic := 1 TO 16 DO IF ((#Ic + 1) < 17) THEN //<...
Replies
7
Views
188
I'm working on learning OOP coding for TwinCat 3. I'd like to transfer and optimize the code my company has from AB Studio 5000 to ST TwinCat 3...
Replies
1
Views
101
in allen bradley kinetix 300 drive first E31 error shows after resting drive E11 error occurs need solution to reset E11 fault code
Replies
4
Views
174
Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
111
Hi there, I'm new to plc programming and was wondering why I get this error code when I run my simulation for these temperature sensors? What I'm...
Replies
2
Views
107
Back
Top Bottom