{"thread":{"id":"38837","subject":"Git with Lader logic","startedAt":"2015-03-17T23:33:54Z","lastAt":"2015-03-27T16:32:30Z","messageCount":10,"participants":["Bharat Suvarna","Kevin D","Randall S. Becker","Doug Kelly","Martin Pettersson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"257903","messageId":"5F9B9EBF-CD4D-42A8-8A0C-9806702231A1@icloud.com","threadId":"38837","inReplyTo":null,"subject":"Git with Lader logic","fromName":"Bharat Suvarna","fromEmail":"bharat.bs84@icloud.com","sentAt":"2015-03-17T23:33:54Z","receivedAt":"2015-03-17T23:33:54Z","isPatch":false,"sender":{"key":"bharat.bs84@icloud.com","avatar":null},"body":"Hi \n\nI am trying to find a way of using version control on PLC programmers like Allen Bradley PLC. I can't find a way of this.\n\nCould you please give me an idea if it will work with Plc programs. Which are basically Ladder logic.\n\nSent from my iPad"},{"id":"257942","messageId":"20150318112936.GC11832@vps892.directvps.nl","threadId":"38837","inReplyTo":"5F9B9EBF-CD4D-42A8-8A0C-9806702231A1@icloud.com","subject":"Re: Git with Lader logic","fromName":"Kevin D","fromEmail":"me@ikke.info","sentAt":"2015-03-18T11:29:36Z","receivedAt":"2015-03-18T11:29:36Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Tue, Mar 17, 2015 at 11:33:54PM +0000, Bharat Suvarna wrote:\n> Hi \n> \n> I am trying to find a way of using version control on PLC programmers like Allen Bradley PLC. I can't find a way of this.\n> \n> Could you please give me an idea if it will work with Plc programs. Which are basically Ladder logic.\n> \n\nI'm not familiar with these programs, so I can't give you specific\nadvice about this.\n\nAlthough git is not very picky about the contents, it is optimized to\ntrack text files. Things like showing diffs and merging files only works\non text files.\n\nGit can track binary files, but there are some disadvantages:\n\n- Diff / merge doesn't work well\n- Compression is often difficult, so the repository size may grow\n  depending on the size of the things stored\n\nThese disadvantages are not limited to only git, other SCM systems also\nhave to deal with these problems.\n\nSo if the Ladder logic is represented as text source, there is no\nproblem with it. If it'sbinary, there might be other sollutions better\nsuited.\n\nKevin\n"},{"id":"257976","messageId":"00bd01d061b5$331874c0$99495e40$@nexbridge.com","threadId":"38837","inReplyTo":"5F9B9EBF-CD4D-42A8-8A0C-9806702231A1@icloud.com","subject":"RE: Git with Lader logic","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2015-03-18T19:53:25Z","receivedAt":"2015-03-18T19:53:25Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On March 17, 2015 7:34 PM, Bharat Suvarna wrote:\n> I am trying to find a way of using version control on PLC programmers like\nAllen\n> Bradley PLC. I can't find a way of this.\n> \n> Could you please give me an idea if it will work with Plc programs. Which\nare\n> basically Ladder logic.\n\nMany PLC programs either store their project code in XML, L5K or L5X (for\nexample), TXT, CSV, or some other text format or can import and export to\ntext forms. If you have a directory structure that represents your project,\nand the file formats have reasonable line separators so that diffs can be\ndone easily, git very likely would work out for you. You do not have to have\nthe local .git repository in the same directory as your working area if your\ntool has issues with that or .gitignore. You may want to use a GUI client to\nmanage your local repository and handle the commit/push/pull/merge/rebase\nfunctions as I expect whatever PLC system you are using does not have git\nbuilt-in.\n\nTo store binary PLC data natively, which some tools use, I expect that those\nwho are better at git-conjuring than I, could provide guidance on how to\nautomate binary diffs for your tool's particular file format.\n\nCheers,\nRandall\n-- Brief whoami: NonStop&UNIX developer since approximately\nUNIX(421664400)/NonStop(211288444200000000)\n-- In my real life, I talk too much.\n"},{"id":"257991","messageId":"CAEtYS8R6xz3vMD72h_j0R6W=FRfY7SjMi-q9z+qfKhqoq5ExCg@mail.gmail.com","threadId":"38837","inReplyTo":"00bd01d061b5$331874c0$99495e40$@nexbridge.com","subject":"Re: Git with Lader logic","fromName":"Doug Kelly","fromEmail":"dougk.ff7@gmail.com","sentAt":"2015-03-18T22:28:45Z","receivedAt":"2015-03-18T22:28:45Z","isPatch":false,"sender":{"key":"dougk.ff7@gmail.com","avatar":"https://avatars.githubusercontent.com/u/93357?v=4"},"body":"On Wed, Mar 18, 2015 at 2:53 PM, Randall S. Becker\n<rsbecker@nexbridge.com> wrote:\n> On March 17, 2015 7:34 PM, Bharat Suvarna wrote:\n>> I am trying to find a way of using version control on PLC programmers like\n> Allen\n>> Bradley PLC. I can't find a way of this.\n>>\n>> Could you please give me an idea if it will work with Plc programs. Which\n> are\n>> basically Ladder logic.\n>\n> Many PLC programs either store their project code in XML, L5K or L5X (for\n> example), TXT, CSV, or some other text format or can import and export to\n> text forms. If you have a directory structure that represents your project,\n> and the file formats have reasonable line separators so that diffs can be\n> done easily, git very likely would work out for you. You do not have to have\n> the local .git repository in the same directory as your working area if your\n> tool has issues with that or .gitignore. You may want to use a GUI client to\n> manage your local repository and handle the commit/push/pull/merge/rebase\n> functions as I expect whatever PLC system you are using does not have git\n> built-in.\n>\n> To store binary PLC data natively, which some tools use, I expect that those\n> who are better at git-conjuring than I, could provide guidance on how to\n> automate binary diffs for your tool's particular file format.\n\nThe one thing I find interesting about RSLogix in general (caveat: I\nonly have very limited experience with RSLogix 500 / 5000; if I do\nanything nowadays, it's in the micro series using RSLogix Micro\nStarter Lite)... they do have some limited notion of version control\ninside the application itself, though it seems rudimentary to me.\nThis could prove to be helpful or extremely annoying, since even when\nI connect to a PLC and go online, just to reset the RTC, it still\nprompts me to save again (even though nothing changed, other than the\nprocessor state).\n\nYou may also find this link on stackexchange helpful:\nhttp://programmers.stackexchange.com/questions/102487/are-there-realistic-useful-solutions-for-source-control-for-ladder-logic-program\n\nAs Randall noted, L5K is just text, and RSLogix 5000 uses it,\naccording to this post.  It may work okay.\n\n--Doug\n"},{"id":"257992","messageId":"00dd01d061cc$33427380$99c75a80$@nexbridge.com","threadId":"38837","inReplyTo":"CAEtYS8R6xz3vMD72h_j0R6W=FRfY7SjMi-q9z+qfKhqoq5ExCg@mail.gmail.com","subject":"RE: Git with Lader logic","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2015-03-18T22:38:04Z","receivedAt":"2015-03-18T22:38:04Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On March 18, 2015 6:29 PM Doug Kelly wrote:\n> On Wed, Mar 18, 2015 at 2:53 PM, Randall S. Becker\n> <rsbecker@nexbridge.com> wrote:\n> > On March 17, 2015 7:34 PM, Bharat Suvarna wrote:\n> >> I am trying to find a way of using version control on PLC programmers\n> >> like\n> > Allen\n> >> Bradley PLC. I can't find a way of this.\n> >>\n> >> Could you please give me an idea if it will work with Plc programs.\n> >> Which\n> > are\n> >> basically Ladder logic.\n> >\n> > Many PLC programs either store their project code in XML, L5K or L5X\n> > (for example), TXT, CSV, or some other text format or can import and\n> > export to text forms. If you have a directory structure that\n> > represents your project, and the file formats have reasonable line\n> > separators so that diffs can be done easily, git very likely would\n> > work out for you. You do not have to have the local .git repository in\n> > the same directory as your working area if your tool has issues with\n> > that or .gitignore. You may want to use a GUI client to manage your\n> > local repository and handle the commit/push/pull/merge/rebase\n> > functions as I expect whatever PLC system you are using does not have git\n> built-in.\n> >\n> > To store binary PLC data natively, which some tools use, I expect that\n> > those who are better at git-conjuring than I, could provide guidance\n> > on how to automate binary diffs for your tool's particular file format.\n> \n> The one thing I find interesting about RSLogix in general (caveat: I only have\n> very limited experience with RSLogix 500 / 5000; if I do anything nowadays, it's\n> in the micro series using RSLogix Micro Starter Lite)... they do have some\n> limited notion of version control inside the application itself, though it seems\n> rudimentary to me.\n> This could prove to be helpful or extremely annoying, since even when I\n> connect to a PLC and go online, just to reset the RTC, it still prompts me to save\n> again (even though nothing changed, other than the processor state).\n> \n> You may also find this link on stackexchange helpful:\n> http://programmers.stackexchange.com/questions/102487/are-there-\n> realistic-useful-solutions-for-source-control-for-ladder-logic-program\n> \n> As Randall noted, L5K is just text, and RSLogix 5000 uses it, according to this\n> post.  It may work okay.\n\nA really good reason to use git instead of some other systems is that new versions of files are determined by SHA signatures (real differences) rather than straight timestamps. So saving a file that has not changed will not force a new version - unlike some systems that shall remain nameless.\n"},{"id":"258016","messageId":"E914A3D7-1BF0-4962-8B4E-F0E19477926B@icloud.com","threadId":"38837","inReplyTo":"CAEtYS8R6xz3vMD72h_j0R6W=FRfY7SjMi-q9z+qfKhqoq5ExCg@mail.gmail.com","subject":"Re: Git with Lader logic","fromName":"Bharat Suvarna","fromEmail":"bharat.bs84@icloud.com","sentAt":"2015-03-19T07:14:52Z","receivedAt":"2015-03-19T07:14:52Z","isPatch":false,"sender":{"key":"bharat.bs84@icloud.com","avatar":null},"body":"Thanks all .. I will have a look. But could I just set this up on my laptop and checking this works on system first before installing one of Git on server\n\nSent from my iPhone\n\n> On 18 Mar 2015, at 22:28, Doug Kelly <dougk.ff7@gmail.com> wrote:\n> \n> On Wed, Mar 18, 2015 at 2:53 PM, Randall S. Becker\n> <rsbecker@nexbridge.com> wrote:\n>> On March 17, 2015 7:34 PM, Bharat Suvarna wrote:\n>>> I am trying to find a way of using version control on PLC programmers like\n>> Allen\n>>> Bradley PLC. I can't find a way of this.\n>>> \n>>> Could you please give me an idea if it will work with Plc programs. Which\n>> are\n>>> basically Ladder logic.\n>> \n>> Many PLC programs either store their project code in XML, L5K or L5X (for\n>> example), TXT, CSV, or some other text format or can import and export to\n>> text forms. If you have a directory structure that represents your project,\n>> and the file formats have reasonable line separators so that diffs can be\n>> done easily, git very likely would work out for you. You do not have to have\n>> the local .git repository in the same directory as your working area if your\n>> tool has issues with that or .gitignore. You may want to use a GUI client to\n>> manage your local repository and handle the commit/push/pull/merge/rebase\n>> functions as I expect whatever PLC system you are using does not have git\n>> built-in.\n>> \n>> To store binary PLC data natively, which some tools use, I expect that those\n>> who are better at git-conjuring than I, could provide guidance on how to\n>> automate binary diffs for your tool's particular file format.\n> \n> The one thing I find interesting about RSLogix in general (caveat: I\n> only have very limited experience with RSLogix 500 / 5000; if I do\n> anything nowadays, it's in the micro series using RSLogix Micro\n> Starter Lite)... they do have some limited notion of version control\n> inside the application itself, though it seems rudimentary to me.\n> This could prove to be helpful or extremely annoying, since even when\n> I connect to a PLC and go online, just to reset the RTC, it still\n> prompts me to save again (even though nothing changed, other than the\n> processor state).\n> \n> You may also find this link on stackexchange helpful:\n> http://programmers.stackexchange.com/questions/102487/are-there-realistic-useful-solutions-for-source-control-for-ladder-logic-program\n> \n> As Randall noted, L5K is just text, and RSLogix 5000 uses it,\n> according to this post.  It may work okay.\n> \n> --Doug\n"},{"id":"258058","messageId":"20150319211744.GD11832@vps892.directvps.nl","threadId":"38837","inReplyTo":"E914A3D7-1BF0-4962-8B4E-F0E19477926B@icloud.com","subject":"Re: Git with Lader logic","fromName":"Kevin D","fromEmail":"me@ikke.info","sentAt":"2015-03-19T21:17:44Z","receivedAt":"2015-03-19T21:17:44Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Thu, Mar 19, 2015 at 07:14:52AM +0000, Bharat Suvarna wrote:\n> Thanks all .. I will have a look. But could I just set this up on my laptop and checking this works on system first before installing one of Git on server\n> \n\nSure, that's no problem. Git happily runs just locally on your own\nmachine and does not depend on a server.\n"},{"id":"258592","messageId":"loom.20150327T160645-181@post.gmane.org","threadId":"38837","inReplyTo":"5F9B9EBF-CD4D-42A8-8A0C-9806702231A1@icloud.com","subject":"Re: Git with Lader logic","fromName":"Martin Pettersson","fromEmail":"martin@siamect.com","sentAt":"2015-03-27T15:09:15Z","receivedAt":"2015-03-27T15:09:15Z","isPatch":false,"sender":{"key":"martin@siamect.com","avatar":"https://gravatar.com/avatar/97ed731b9c70a7342247447388d2d3581a1316ad8b69979ab88efd37b9de5f1a?d=mp&s=160"},"body":"Bharat Suvarna <bharat.bs84 <at> icloud.com> writes:\n\n> \n> Hi \n> \n> I am trying to find a way of using version control on \nPLC programmers like Allen Bradley PLC. I \ncan't find a way\n> of this.\n> \n> Could you please give me an idea if it will work with \nPlc programs. Which are basically Ladder \nlogic.\n> \n> Sent from my iPad--\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo <at> vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n> \n\nI use Git for versioning PLC program written for Beckhoff TwinCAT v2 that \nsaves the files in binary format.  \nYou can probably do the same for most other systems as well.   \n  \nMy way of doing it is... \nI have a batch file that starts TwinCAT including a file that tell Twincat to\nopen my PLC program and export it into a text based format. \nAfter that the script opens git gui and gitk.  \n  \nI have one script like this for each plc program. \nIt is quite effcient, the whole procedure only takes a double click and \nless than 10 seconds and you have git gui up and you can see your \nchanges in pure text, commit and push.   \nI commit both the exported text files and the binary  because the binary\nis the one I edit.   \nThis has been working very well for many years....\n  \nTake care   \nMartin\n"},{"id":"258593","messageId":"xmqqegoawiu0.fsf@gitster.dls.corp.google.com","threadId":"38837","inReplyTo":"loom.20150327T160645-181@post.gmane.org","subject":"Re: Git with Lader logic","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-27T15:39:19Z","receivedAt":"2015-03-27T15:39:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Pettersson <martin@siamect.com> writes:\n\n> I use Git for versioning PLC program written for Beckhoff TwinCAT v2 that \n> saves the files in binary format.  \n> You can probably do the same for most other systems as well.   \n>   \n> My way of doing it is... \n> I have a batch file that starts TwinCAT including a file that tell Twincat to\n> open my PLC program and export it into a text based format. \n> After that the script opens git gui and gitk.  \n>   \n> I have one script like this for each plc program. \n> It is quite effcient, the whole procedure only takes a double click and \n> less than 10 seconds and you have git gui up and you can see your \n> changes in pure text, commit and push.   \n> I commit both the exported text files and the binary  because the binary\n> is the one I edit.   \n> This has been working very well for many years....\n\nLet me check if I got your scheme correctly.\n\n - You need to track PLC program files, whose native format is\n   binary and is not very amenable to textual processing like diff\n   and merge\n\n - But you can tell TwinCat to export that binary file to text (and\n   presumably you can tell TwinCat to read that exported text file),\n   and the text format is human-readable.\n\n - You use a script that calls TwinCat to export the binary into\n   text as a clean filter, and what is checked into Git is the\n   exported text representation.\n\n - You use another script that calls TwinCat to convert the exported\n   text back to the binary as a smudge filter, and what is checked\n   out to the working tree is the native binary format file.\n\nIs that what is going on?  I can imagine how that arrangement would\nwork (after all, that is how clean/smudge filters are designed to be\nused).\n\nThanks.\n"},{"id":"258594","messageId":"loom.20150327T170836-560@post.gmane.org","threadId":"38837","inReplyTo":"xmqqegoawiu0.fsf@gitster.dls.corp.google.com","subject":"Re: Git with Lader logic","fromName":"Martin Pettersson","fromEmail":"martin@siamect.com","sentAt":"2015-03-27T16:32:30Z","receivedAt":"2015-03-27T16:32:30Z","isPatch":false,"sender":{"key":"martin@siamect.com","avatar":"https://gravatar.com/avatar/97ed731b9c70a7342247447388d2d3581a1316ad8b69979ab88efd37b9de5f1a?d=mp&s=160"},"body":"Junio C Hamano <gitster <at> pobox.com> writes:\n\n> \n> Martin Pettersson <martin <at> siamect.com> writes:\n> \n> > I use Git for versioning PLC program written for Beckhoff TwinCAT v2 that \n> > saves the files in binary format.  \n> > You can probably do the same for most other systems as well.   \n> >   \n> > My way of doing it is... \n> > I have a batch file that starts TwinCAT including a file that tell Twincat to\n> > open my PLC program and export it into a text based format. \n> > After that the script opens git gui and gitk.  \n> >   \n> > I have one script like this for each plc program. \n> > It is quite effcient, the whole procedure only takes a double click and \n> > less than 10 seconds and you have git gui up and you can see your \n> > changes in pure text, commit and push.   \n> > I commit both the exported text files and the binary  because the binary\n> > is the one I edit.   \n> > This has been working very well for many years....\n> \n> Let me check if I got your scheme correctly.\n> \n>  - You need to track PLC program files, whose native format is\n>    binary and is not very amenable to textual processing like diff\n>    and merge\n> \n>  - But you can tell TwinCat to export that binary file to text (and\n>    presumably you can tell TwinCat to read that exported text file),\n>    and the text format is human-readable.\n> \n>  - You use a script that calls TwinCat to export the binary into\n>    text as a clean filter, and what is checked into Git is the\n>    exported text representation.\n> \n>  - You use another script that calls TwinCat to convert the exported\n>    text back to the binary as a smudge filter, and what is checked\n>    out to the working tree is the native binary format file.\n> \n> Is that what is going on?  I can imagine how that arrangement would\n> work (after all, that is how clean/smudge filters are designed to be\n> used).\n> \n> Thanks.\n> \n> \n\nWell  you got it right, but I \"almost\" never convert the \nexported textfiles back into TwinCat.  \n\nThe exported textfiles is not really suitable\nfor merging as they have a proprietary format, \nbut they are human readable and it helps a lot \nto be able to see what changes I made at a certain commit.  \n  \nI do commit both the exported text files and the original binary files.\nRecreating the binary by imprting the textfiles can be done.\nI just don't do it because it is easier to commit the binary at \nthe same time when I commit the exported text files. \nThat way I can just checkout any version and rebuild the project \nand  reload it in the machine. \n\nMy script is just a batch file that I double click on. It is not using \nany of the hooks that git comes with. \n\nHere is an example, I hope it keeps the formatting  (windows batch file):\n\nSet WorkingFolder=\"C:\\Documents and Settings\\Me\\projectname\\Beckhoff\"\nSet CommandFile=\"do_.cmd\"\nSet TwinCatFile=\"plc_program_name.prx\"\nSet ExportFile=\"exports\\intermediate_plate.exp\"\nSet ExportFolder=\"exports\\modules\"\n\ncd %WorkingFolder%\n\necho project expmul %ExportFolder% > %CommandFile%\necho project export %ExportFile% >> %CommandFile%\necho file quit  >> %CommandFile%\n\ndel /f /q %ExportFile%\ndel /f /q %ExportFolder%\\*.*\nC:\\TwinCAT\\Plc\\TCatPlcCtrl.exe %TwinCatFile% /cmd %CommandFile%\ndel /f %CommandFile%\n\ncall git gui &\ncall gitk --all &\n\nTake care\nMartin\n"}]}