Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: plcnut on January 21, 2013, 08:49:32 AM

Title: Differences in Disk and PLC programs message.
Post by: plcnut on January 21, 2013, 08:49:32 AM
Whenever I disconnect from my plc with Designer at the end of work, I always save the program to disk and to plc. But almost every morning when I re-connect I get a pop-up message that tells me there are differences between the Disk and the PLC project. When I click on the button to view the differences I get the message that the projects match. I'm not sure if this happens EVERY time, but I know it happens most of the time. Why?
Title: Re: Differences in Disk and PLC programs message.
Post by: BobO on January 21, 2013, 09:32:38 AM
Not sure, could be a bug. What is the exact order than you do things?
Title: Re: Differences in Disk and PLC programs message.
Post by: PLCGuy on January 21, 2013, 12:35:42 PM
plcnut you talking about the large box that gives you both options, not specially there is a difference. It asks if you want to use the disk or plc. I have to connect to see exactly the two choices are. yea, I save my programs too, but it seems the box pops up for me too.
Title: Re: Differences in Disk and PLC programs message.
Post by: Controls Guy on January 21, 2013, 01:35:43 PM
plcnut you talking about the large box that gives you both options, not specially there is a difference. It asks if you want to use the disk or plc. I have to connect to see exactly the two choices are. yea, I save my programs too, but it seems the box pops up for me too.

In DirectSoft, that box doesn't pop up UNLESS it thinks there's a difference.  It just goes directly to online mode otherwise.  Don't remember in DMD.
Title: Re: Differences in Disk and PLC programs message.
Post by: BobO on January 21, 2013, 02:31:46 PM
plcnut you talking about the large box that gives you both options, not specially there is a difference. It asks if you want to use the disk or plc. I have to connect to see exactly the two choices are. yea, I save my programs too, but it seems the box pops up for me too.

In DirectSoft, that box doesn't pop up UNLESS it thinks there's a difference.  It just goes directly to online mode otherwise.  Don't remember in DMD.

It should work the same in DmD. If there are no differences it will connect without prompting. Part of the issue is that there are more things in the project file now and in the PLC. If there is one particular pathway where a difference flag is getting bumped or some part of the comparison that is wrong, we need to figure it out. We know that there is an occasion where we can get an extra NOP appended to the disk project that causes some of the comparisons to bust, but I don't think we have successfully duplicated it. We also felt that the priority for fixing it was lower than, say, shipping the product. ;)
Title: Re: Differences in Disk and PLC programs message.
Post by: ATU on January 21, 2013, 04:31:55 PM
Any chance the project path could be different one day to the next?
Title: Re: Differences in Disk and PLC programs message.
Post by: Controls Guy on January 21, 2013, 07:36:15 PM
It should work the same in DmD. If there are no differences it will connect without prompting. Part of the issue is that there are more things in the project file now and in the PLC. If there is one particular pathway where a difference flag is getting bumped or some part of the comparison that is wrong, we need to figure it out.

Exactly.  I was saying that if the dialog comes up it implies that the software thinks, correctly or not, that there are differences between disk and PLC.
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 22, 2013, 06:01:21 AM
I will monitor more carefully the exact steps that I take when shutting down and starting up...
This morning when I opened DMD and double-clicked my project it opened without issue.
I normally have my project open all day and edit the program throughout the day, and depending on what I was doing I may have saved to disk , or I may have saved to PLC for testing. So when I am ready to shut down, if one or both of the save boxes is highlighted, then I will click it to make sure that everything is up to date, and then close DMD and power down the PLC (after the PC is shut down).
Also I occasionally (once or twice a week, or before a major program change) will back-up my project.
Title: Re: Differences in Disk and PLC programs message.
Post by: franji1 on January 22, 2013, 09:42:57 AM
This is a known issue and is relatively easy to replicate.  One issue deals with trailing NOPs in various code-blocks.  The initial comparison checks for length first, and if they are different, then it flags the two as "being different".  It does not bother doing any comparison if the lengths are different and just flags the two sets of control-logic as being "different" (note that if the lengths match, then it goes on and compares the two programs to see if they are different).  So the control logic is labeled different.  But then when you use the Program Compare tool, it ignores trailing NOPs, hence the two sets of control-logic "match".  Doh!  ::)

We need to initially eliminate the length comparison because of it reporting false differences.

There could be other issues that I won't go into, but it's related to trailing NOPs and rung handles (for rung comments) that are also stored as part of the program, and could be flagged as being different, but not really.  Doh**2!

EDIT - the first case was eliminated a while ago, so it must be the second case (or the Doh-squared case, or something else).  Apologies   :-[
Title: Re: Differences in Disk and PLC programs message.
Post by: Controls Guy on January 22, 2013, 11:40:30 AM
Any chance the project path could be different one day to the next?

DMD calls moving the project to a different PC directory and trying to go online a difference??!!  If so, I don't like that at all.   :(
Title: Re: Differences in Disk and PLC programs message.
Post by: BobO on January 22, 2013, 06:09:05 PM
DMD calls moving the project to a different PC directory and trying to go online a difference??!!  If so, I don't like that at all.   :(

I'm confused by this: Are you seeing this to be true, or are you asking if it is?

We store the project path to the PLC when we write to it, in an effort to help restore the connection to the project that was last used when connecting to the PLC without a project open. If we are using the source project path as a basis for comparison of online and offline projects, I am unaware of it and it is unintentional. If that is the case I am happy to change it.
Title: Re: Differences in Disk and PLC programs message.
Post by: Controls Guy on January 22, 2013, 07:02:33 PM
I'm confused by this: Are you seeing this to be true, or are you asking if it is?

I don't know whether it's true or not -- I posted that in response to ATU's troubleshooting post about the project directory, and that in turn I don't know is based on first-hand knowledge or not.

I can see if you just went online with the PLC first, having DMD select by default the online file from the last known location (better to store that in DMD in case the same PLC is programmed with multiple PC's?), but if you open the file first and then go online with the PLC, I don't think DMD should flag a difference based on the directory location.  It runs the risk of obscuring an actual code or config difference, plus desensitizing people to the dialog.

Actually, I guess what you'd need to do is store the program name but not the path in the PLC.  Then when DMD opens it and tries to match it with a disk file, it says "OK, the most recently edited file I have on disk with a matching name is in the path c:\blah\blah" or else look at ALL matching name projects and see if there are any with no differences.
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 22, 2013, 09:03:09 PM
That link seems to be broken
Title: Re: Differences in Disk and PLC programs message.
Post by: franji1 on January 22, 2013, 09:20:42 PM
That link seems to be broken
That was a private link, hence why it appeared "broken".  I removed it.
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 23, 2013, 05:16:57 AM
OK, this morning when I tried to connect I got the "Resolve online/offline differences" dialog.

Rundown:
Yesterday, at shut down time with an open program that had been edited, I clicked Save to disk, then Write to PLC, then I clicked X to close the program, and clicked Close with forces active in the popup dialog. I then shut down PC and PLC.

This morning, I power up PC and PLC and connect my network cable, I open DMD and double click my project in the Launchpad, and the system proceeds to connect and download the program and do the compares and the attached message pops up.

After  pressing the Compare programs button the second attached message appears.
Title: Re: Differences in Disk and PLC programs message.
Post by: franji1 on January 23, 2013, 08:06:37 AM
Yes, that's the symptom I have seen.  It's a strange bug because it doesn't happen all the time, but it does happen frequently.  We will look at it for 1.1.  :-[
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 23, 2013, 08:20:51 AM
I will continue to monitor the order in which I do things to see if I can find a common denominator.

Side note that may help: I use NOP's frequently in my program to help break things up and for use as reminders of ttd. I also have a couple places where I have code beyond END's to store some code that I may or may not need.
Title: Re: Differences in Disk and PLC programs message.
Post by: ATU on January 23, 2013, 12:07:39 PM
The only time I've seen it is when I switched computers. If it makes any difference, I only use the USB link for programming.
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 23, 2013, 12:28:00 PM
The only time I've seen it is when I switched computers. If it makes any difference, I only use the USB link for programming.

I am only using one computer, and all my programming is over ethernet (hardwired). The PLC is on a static IP, but my computer is assigned by DHCP.
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 24, 2013, 06:05:46 AM
Yesterday I clicked Save to PLC, and then save to disk and shut down the system as before, but this morning I didn't get the warning when I connected to the system. The only thing I did different is I saved to PLC before saving to disk.

ATU got me thinking about IP's, so I am going to record the IP that I was assigned so I can see if it makes a difference if the server gives me a different one.
Title: Re: Differences in Disk and PLC programs message.
Post by: plcnut on January 25, 2013, 05:28:01 AM
Computer IP makes no difference.
Title: Re: Differences in Disk and PLC programs message.
Post by: franji1 on January 25, 2013, 04:11:14 PM
We figured it out.  When creating certain instructions offline, these special instructions require an arbitrary unique resource.  For device instructions (e.g. STREAMOUT, EMAIL, CTRIO...), it is a unique "instruction id" so that a device can be tied to a specific instruction whenever it becomes "busy".  Similarly, edge triggered instructions are allocated an "edge bit" to maintain the previous-scan's power flow (in order to detect any leading edge conditions).

Anyway, these various IDs are assigned at DOWNLOAD time, but are maintained ON DISK.  However, if you Save To Disk, THEN Write To PLC (and assign these IDs THEN), the Disk version will not have these "new" IDs.  Not only that, but the "Write to Disk" toolbar button was never being re-enabled because of the tweaking of the program at download time.

Note that once an instruction's edge bit or instruction id is assigned and saved to disk, it stays with it FOREVER (until the instruction is deleted or modified).  This helps for proper runtime edit behavior.

So, the problem occurs because the disk has UNASSIGNED Instruction/Edge IDs, but the PLC has ASSIGNED Instruction/Edge IDs.  Even though these parameters are "invisible" to the user, they get flagged as being different, but when you do the user-level comparison, they match.  Doh!

Here's how we fixed it:

1. If ANY Instruction IDs or Edge IDs are assigned at download time, we flag the PROGRAM as being MODIFIED, so that the Write to Disk button will be enabled (if it wasn't already)

2. If BEFORE you started your download, the CURRENT PROJECT MATCHED what was on disk (i.e. the Write to Disk button was DISABLED), but then AFTER DOWNLOADING, one of these ID's got assigned, then we will log an event to the Output Window that
Program modified - new Edge/Instruction IDs assigned at download

I know this is clear as mud, but it's some of the special handling that is done by Designer that wasn't properly propogated back to the user level.  This special ID handling will ONLY occur if a NEW EDGE/DEVICE instruction was added or if you MODIFIED AN EXISTING EDGE/DEVICE instruction (this is technically a "new instance" of that operation).  Any other instruction will not cause this to occur (e.g. non-edge contacts, coils, MATH), basically anything without an edge or without a device.
Title: Re: Differences in Disk and PLC programs message.
Post by: Controls Guy on January 25, 2013, 05:40:48 PM
Good sleuthing!