Compare PLC program function

multivits

Member
Join Date
Jan 2013
Location
Sydney
Posts
7
Hi Forum,
I was wondering if there are PLC IDEs which have a function which allows 2 PLC programs (in either ladder code or compiled) to be compared to each other?

We are making some minor changes to a PLC ladder logic and want to do a compare as a regression test, i.e. to check that we haven't inadvertently altered other parts of the PLC code which are intended to remain the same.

TIA

Multivits
 
Thanks for the replies,

It was a general question since we have various makes of PLC onsite and this compare utility will need to be used as part of regression testing for compliance and Good Engineering Practices when introducing changes
 
TIA Portal (Siemens) has built in functions to allow for comparison between either the online and offline versions of the PLC project, or two different offline projects.


Two third party companies, MDT and VersionDog, provide version control software that could be useful, and support many brands. One of the relevant features is that it compares the active code in the PLC to whatever was most recently checked in, which allows the detection of unauthorized changes or code that hasn't been properly archived and therefore could be "lost".
 
Most of the well known makes of IDE have very good compare functions, some better than others, however if you have two PLC's with same code & modify 1 in some PLC's the comparison can be difficult because a ladder program that has an added instruction say in the first few lines will show that from that point to the end will show differences. A structured one could compare blocks so only show the blocks that have changed.
An example is say An FX2N PLC, The compiled code is one long list of instructions so adding one in say rung 10 of a 200 rung program would show as all different from line 10 to the end (with the exception of lines although different may contain the same instructions).
Example in STL
1: LD M8000
2: CMP < K1 D0
3: SET M2
4: LD M2
5: AND M3
6: AND NOT M4
7: OUT M5
8: END
If you add one instruction i.e. M20
1: LD M8000
2: AND M20 //Here, then all the code below will show as different
3: CMP < K1 D0 ///
4: SET M2
5: LD M2
6: AND M3
7: AND NOT M4
8: OUT M5
9: END
i.e. all steps from 2 do not match the original code.
This is because in normal ladder (not structured programs) the comparison is done by comparing the binary code at each address.
In Siemens the blocks are compared as separate entities so only shows differences in each block.
 
Most of the well known makes of IDE have very good compare functions, some better than others, however if you have two PLC's with same code & modify 1 in some PLC's the comparison can be difficult because a ladder program that has an added instruction say in the first few lines will show that from that point to the end will show differences. A structured one could compare blocks so only show the blocks that have changed.
An example is say An FX2N PLC, The compiled code is one long list of instructions so adding one in say rung 10 of a 200 rung program would show as all different from line 10 to the end (with the exception of lines although different may contain the same instructions).
Example in STL
1: LD M8000
2: CMP < K1 D0
3: SET M2
4: LD M2
5: AND M3
6: AND NOT M4
7: OUT M5
8: END
If you add one instruction i.e. M20
1: LD M8000
2: AND M20 //Here, then all the code below will show as different
3: CMP < K1 D0 ///
4: SET M2
5: LD M2
6: AND M3
7: AND NOT M4
8: OUT M5
9: END
i.e. all steps from 2 do not match the original code.
This is because in normal ladder (not structured programs) the comparison is done by comparing the binary code at each address.
In Siemens the blocks are compared as separate entities so only shows differences in each block.



If you have STL codes of 2 different versions, you can use also use other programs for comparing.

Winmerge for example can show differs from 2 txt files, even that if there is added lines. Have used sometimes for ST.


https://winmerge.org/
 
Winmerge for example can show differs from 2 txt files, even that if there is added lines. Have used sometimes for ST.


Love WinMerge. I don't need it often, but when i need it I NEED IT.
 
I am wondering if there is a PLC system that automatically provides a checksum for the program in it.

I know all safety PLCs do that but am not aware of a regular one.
 
I am wondering if there is a PLC system that automatically provides a checksum for the program in it.

I know all safety PLCs do that but am not aware of a regular one.


The S7-1200 & S7-1500 from Siemens both support this, although it is a relatively recent feature. Safety checksums have been possibly for years, but recently, you can view the standard code checksum in either the CPU properties or via an instruction (Get_Checksum). If you use the built in compare tool, it will also show you detailed checksums for the block code, comments, etc, as part of the comparison.
 

Similar Topics

quick question: Where is the "compare online / offline" located at? the help file just says click on it. not very helpful. Thanks
Replies
2
Views
2,672
Please be patient I just started learning this. In a compare, I have data A: as DF2. data B: I want (DF10 /6.25)+6...
Replies
6
Views
2,289
is there a way to open a compact logix plc program and then compare that to the program that is actually running in the plc Thanks
Replies
1
Views
1,055
Hi all you clever people. I have a program line that does not make sense %MW401 < %MW402------> (%M2) - [%M2 = ON] Which does not make sense (20...
Replies
10
Views
2,798
Hello, I have access to GX Developer, GX Works 2 and 3. I'm wondering if there is a decent ladder compare that I can print to PDF. I tried...
Replies
2
Views
2,575
Back
Top Bottom