You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
Thread Tools Display Modes
Unread September 10th, 2019, 08:38 PM   #1
multivits
Member
Australia

multivits is offline
 
Join Date: Jan 2013
Location: Sydney
Posts: 7
Compare PLC program function

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
  Reply With Quote
Unread September 10th, 2019, 10:40 PM   #2
kallileo
Member
Greece

kallileo is offline
 
Join Date: Jun 2008
Location: Thessaloniki, Macedonia, Hellas
Posts: 215
You can compare two projects in Codesys and consequently in most Codesys based IDEs.

https://help.codesys.com/api-content...oject_compare/
__________________
automationofthings.blogspot.com
  Reply With Quote
Unread September 10th, 2019, 10:50 PM   #3
sigmadelta
Member
Canada

sigmadelta is offline
 
Join Date: Apr 2016
Location: From Canada - Living in Bulgaria
Posts: 1,238
Which PLC Software? Which PLC hardware?
__________________
Automation Programmer
PLC / HMI / SCADA / SQL
New Systems, Modifications
System Upgrades & Conversions
------------------------
Visit: contrologica.com
Email: info@contrologica.com
  Reply With Quote
Unread September 11th, 2019, 05:11 PM   #4
multivits
Member
Australia

multivits is offline
 
Join Date: Jan 2013
Location: Sydney
Posts: 7
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
  Reply With Quote
Unread September 12th, 2019, 04:03 AM   #5
mk42
Member
United States

mk42 is offline
 
Join Date: Jun 2013
Location: MI
Posts: 2,214
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".
  Reply With Quote
Unread September 12th, 2019, 04:36 AM   #6
parky
Member
United Kingdom

parky is offline
 
Join Date: Oct 2004
Location: Midlands
Posts: 1,250
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.
  Reply With Quote
Unread September 12th, 2019, 06:10 AM   #7
multivits
Member
Australia

multivits is offline
 
Join Date: Jan 2013
Location: Sydney
Posts: 7
Thanks, mk42 and Parky, both very useful info and will take on board.
  Reply With Quote
Unread September 12th, 2019, 11:59 AM   #8
Lare
Member
Finland

Lare is offline
 
Join Date: Jan 2006
Location: Finland
Posts: 1,166
Quote:
Originally Posted by parky View Post
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/
  Reply With Quote
Unread September 12th, 2019, 09:07 PM   #9
mk42
Member
United States

mk42 is offline
 
Join Date: Jun 2013
Location: MI
Posts: 2,214
Quote:
Originally Posted by Lare View Post
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.
  Reply With Quote
Unread September 15th, 2019, 11:40 AM   #10
LadderLogic
Member
United States

LadderLogic is offline
 
LadderLogic's Avatar
 
Join Date: Jun 2003
Location: Chicagolandia
Posts: 1,320
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.
__________________
Don't trust, don't fear, don't beg...
  Reply With Quote
Unread September 17th, 2019, 08:32 AM   #11
mk42
Member
United States

mk42 is offline
 
Join Date: Jun 2013
Location: MI
Posts: 2,214
Quote:
Originally Posted by LadderLogic View Post
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
IEC 61131-3 Function Blocks Highland Controls LIVE PLC Questions And Answers 21 January 20th, 2019 05:11 PM
SLC Function SLC 5/05 PLC Program Ones_Zeros LIVE PLC Questions And Answers 20 January 31st, 2017 06:25 PM
Idea: Put all of the logic for a PLC program in a function block. theColonel26 LIVE PLC Questions And Answers 24 November 10th, 2016 11:40 AM
Call PC program from PLC and return results from PC to PLC adavi231 LIVE PLC Questions And Answers 7 April 12th, 2012 04:30 PM
Plc suggestion aec LIVE PLC Questions And Answers 36 January 2nd, 2012 12:56 AM


All times are GMT -5. The time now is 04:39 PM.


.