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

I have a machine which is undergoing upgradation. As part of the process two SEW drives are being replaced., existing Gen B with new Gen C. The...
Replies
2
Views
98
I want to set user security level based on the value of a tag in my PLC called "ActiveUser". That tag will contain the A-P code which we use for...
Replies
6
Views
200
Hi All, Can anyone advise me on how to determine the AN of a genie instance I writing to. I have created a genie to display a valve and some text...
Replies
0
Views
85
Hi I have been knocking my head against the wall trying to figure out why these two plcs won't talk with Produced and Consumed Tags data. The...
Replies
14
Views
454
Hello Everyone. Looking to see if any of you have encountered an issue with these drives. We have a major installation with around 30 of these...
Replies
0
Views
79
Back
Top Bottom