All of lore.kernel.org
 help / color / mirror / Atom feed
* Git with Lader logic
@ 2015-03-17 23:33 Bharat Suvarna
  2015-03-18 11:29 ` Kevin D
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Bharat Suvarna @ 2015-03-17 23:33 UTC (permalink / raw)
  To: git

Hi 

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.

Could you please give me an idea if it will work with Plc programs. Which are basically Ladder logic.

Sent from my iPad

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-17 23:33 Git with Lader logic Bharat Suvarna
@ 2015-03-18 11:29 ` Kevin D
  2015-03-18 19:53 ` Randall S. Becker
  2015-03-27 15:09 ` Martin Pettersson
  2 siblings, 0 replies; 10+ messages in thread
From: Kevin D @ 2015-03-18 11:29 UTC (permalink / raw)
  To: Bharat Suvarna; +Cc: git

On Tue, Mar 17, 2015 at 11:33:54PM +0000, Bharat Suvarna wrote:
> Hi 
> 
> 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.
> 
> Could you please give me an idea if it will work with Plc programs. Which are basically Ladder logic.
> 

I'm not familiar with these programs, so I can't give you specific
advice about this.

Although git is not very picky about the contents, it is optimized to
track text files. Things like showing diffs and merging files only works
on text files.

Git can track binary files, but there are some disadvantages:

- Diff / merge doesn't work well
- Compression is often difficult, so the repository size may grow
  depending on the size of the things stored

These disadvantages are not limited to only git, other SCM systems also
have to deal with these problems.

So if the Ladder logic is represented as text source, there is no
problem with it. If it'sbinary, there might be other sollutions better
suited.

Kevin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Git with Lader logic
  2015-03-17 23:33 Git with Lader logic Bharat Suvarna
  2015-03-18 11:29 ` Kevin D
@ 2015-03-18 19:53 ` Randall S. Becker
  2015-03-18 22:28   ` Doug Kelly
  2015-03-27 15:09 ` Martin Pettersson
  2 siblings, 1 reply; 10+ messages in thread
From: Randall S. Becker @ 2015-03-18 19:53 UTC (permalink / raw)
  To: 'Bharat Suvarna', git

On March 17, 2015 7:34 PM, Bharat Suvarna wrote:
> 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.
> 
> Could you please give me an idea if it will work with Plc programs. Which
are
> basically Ladder logic.

Many PLC programs either store their project code in XML, L5K or L5X (for
example), TXT, CSV, or some other text format or can import and export to
text forms. If you have a directory structure that represents your project,
and the file formats have reasonable line separators so that diffs can be
done easily, git very likely would work out for you. You do not have to have
the local .git repository in the same directory as your working area if your
tool has issues with that or .gitignore. You may want to use a GUI client to
manage your local repository and handle the commit/push/pull/merge/rebase
functions as I expect whatever PLC system you are using does not have git
built-in.

To store binary PLC data natively, which some tools use, I expect that those
who are better at git-conjuring than I, could provide guidance on how to
automate binary diffs for your tool's particular file format.

Cheers,
Randall
-- Brief whoami: NonStop&UNIX developer since approximately
UNIX(421664400)/NonStop(211288444200000000)
-- In my real life, I talk too much.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-18 19:53 ` Randall S. Becker
@ 2015-03-18 22:28   ` Doug Kelly
  2015-03-18 22:38     ` Randall S. Becker
  2015-03-19  7:14     ` Bharat Suvarna
  0 siblings, 2 replies; 10+ messages in thread
From: Doug Kelly @ 2015-03-18 22:28 UTC (permalink / raw)
  To: Randall S. Becker; +Cc: Bharat Suvarna, Git List

On Wed, Mar 18, 2015 at 2:53 PM, Randall S. Becker
<rsbecker@nexbridge.com> wrote:
> On March 17, 2015 7:34 PM, Bharat Suvarna wrote:
>> 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.
>>
>> Could you please give me an idea if it will work with Plc programs. Which
> are
>> basically Ladder logic.
>
> Many PLC programs either store their project code in XML, L5K or L5X (for
> example), TXT, CSV, or some other text format or can import and export to
> text forms. If you have a directory structure that represents your project,
> and the file formats have reasonable line separators so that diffs can be
> done easily, git very likely would work out for you. You do not have to have
> the local .git repository in the same directory as your working area if your
> tool has issues with that or .gitignore. You may want to use a GUI client to
> manage your local repository and handle the commit/push/pull/merge/rebase
> functions as I expect whatever PLC system you are using does not have git
> built-in.
>
> To store binary PLC data natively, which some tools use, I expect that those
> who are better at git-conjuring than I, could provide guidance on how to
> automate binary diffs for your tool's particular file format.

The one thing I find interesting about RSLogix in general (caveat: I
only have very limited experience with RSLogix 500 / 5000; if I do
anything nowadays, it's in the micro series using RSLogix Micro
Starter Lite)... they do have some limited notion of version control
inside the application itself, though it seems rudimentary to me.
This could prove to be helpful or extremely annoying, since even when
I connect to a PLC and go online, just to reset the RTC, it still
prompts me to save again (even though nothing changed, other than the
processor state).

You may also find this link on stackexchange helpful:
http://programmers.stackexchange.com/questions/102487/are-there-realistic-useful-solutions-for-source-control-for-ladder-logic-program

As Randall noted, L5K is just text, and RSLogix 5000 uses it,
according to this post.  It may work okay.

--Doug

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Git with Lader logic
  2015-03-18 22:28   ` Doug Kelly
@ 2015-03-18 22:38     ` Randall S. Becker
  2015-03-19  7:14     ` Bharat Suvarna
  1 sibling, 0 replies; 10+ messages in thread
From: Randall S. Becker @ 2015-03-18 22:38 UTC (permalink / raw)
  To: 'Doug Kelly'; +Cc: 'Bharat Suvarna', 'Git List'

On March 18, 2015 6:29 PM Doug Kelly wrote:
> On Wed, Mar 18, 2015 at 2:53 PM, Randall S. Becker
> <rsbecker@nexbridge.com> wrote:
> > On March 17, 2015 7:34 PM, Bharat Suvarna wrote:
> >> 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.
> >>
> >> Could you please give me an idea if it will work with Plc programs.
> >> Which
> > are
> >> basically Ladder logic.
> >
> > Many PLC programs either store their project code in XML, L5K or L5X
> > (for example), TXT, CSV, or some other text format or can import and
> > export to text forms. If you have a directory structure that
> > represents your project, and the file formats have reasonable line
> > separators so that diffs can be done easily, git very likely would
> > work out for you. You do not have to have the local .git repository in
> > the same directory as your working area if your tool has issues with
> > that or .gitignore. You may want to use a GUI client to manage your
> > local repository and handle the commit/push/pull/merge/rebase
> > functions as I expect whatever PLC system you are using does not have git
> built-in.
> >
> > To store binary PLC data natively, which some tools use, I expect that
> > those who are better at git-conjuring than I, could provide guidance
> > on how to automate binary diffs for your tool's particular file format.
> 
> The one thing I find interesting about RSLogix in general (caveat: I only have
> very limited experience with RSLogix 500 / 5000; if I do anything nowadays, it's
> in the micro series using RSLogix Micro Starter Lite)... they do have some
> limited notion of version control inside the application itself, though it seems
> rudimentary to me.
> This could prove to be helpful or extremely annoying, since even when I
> connect to a PLC and go online, just to reset the RTC, it still prompts me to save
> again (even though nothing changed, other than the processor state).
> 
> You may also find this link on stackexchange helpful:
> http://programmers.stackexchange.com/questions/102487/are-there-
> realistic-useful-solutions-for-source-control-for-ladder-logic-program
> 
> As Randall noted, L5K is just text, and RSLogix 5000 uses it, according to this
> post.  It may work okay.

A 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-18 22:28   ` Doug Kelly
  2015-03-18 22:38     ` Randall S. Becker
@ 2015-03-19  7:14     ` Bharat Suvarna
  2015-03-19 21:17       ` Kevin D
  1 sibling, 1 reply; 10+ messages in thread
From: Bharat Suvarna @ 2015-03-19  7:14 UTC (permalink / raw)
  To: Doug Kelly; +Cc: Randall S. Becker, Git List

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

Sent from my iPhone

> On 18 Mar 2015, at 22:28, Doug Kelly <dougk.ff7@gmail.com> wrote:
> 
> On Wed, Mar 18, 2015 at 2:53 PM, Randall S. Becker
> <rsbecker@nexbridge.com> wrote:
>> On March 17, 2015 7:34 PM, Bharat Suvarna wrote:
>>> 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.
>>> 
>>> Could you please give me an idea if it will work with Plc programs. Which
>> are
>>> basically Ladder logic.
>> 
>> Many PLC programs either store their project code in XML, L5K or L5X (for
>> example), TXT, CSV, or some other text format or can import and export to
>> text forms. If you have a directory structure that represents your project,
>> and the file formats have reasonable line separators so that diffs can be
>> done easily, git very likely would work out for you. You do not have to have
>> the local .git repository in the same directory as your working area if your
>> tool has issues with that or .gitignore. You may want to use a GUI client to
>> manage your local repository and handle the commit/push/pull/merge/rebase
>> functions as I expect whatever PLC system you are using does not have git
>> built-in.
>> 
>> To store binary PLC data natively, which some tools use, I expect that those
>> who are better at git-conjuring than I, could provide guidance on how to
>> automate binary diffs for your tool's particular file format.
> 
> The one thing I find interesting about RSLogix in general (caveat: I
> only have very limited experience with RSLogix 500 / 5000; if I do
> anything nowadays, it's in the micro series using RSLogix Micro
> Starter Lite)... they do have some limited notion of version control
> inside the application itself, though it seems rudimentary to me.
> This could prove to be helpful or extremely annoying, since even when
> I connect to a PLC and go online, just to reset the RTC, it still
> prompts me to save again (even though nothing changed, other than the
> processor state).
> 
> You may also find this link on stackexchange helpful:
> http://programmers.stackexchange.com/questions/102487/are-there-realistic-useful-solutions-for-source-control-for-ladder-logic-program
> 
> As Randall noted, L5K is just text, and RSLogix 5000 uses it,
> according to this post.  It may work okay.
> 
> --Doug

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-19  7:14     ` Bharat Suvarna
@ 2015-03-19 21:17       ` Kevin D
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin D @ 2015-03-19 21:17 UTC (permalink / raw)
  To: Bharat Suvarna; +Cc: Doug Kelly, Randall S. Becker, Git List

On Thu, Mar 19, 2015 at 07:14:52AM +0000, Bharat Suvarna wrote:
> 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
> 

Sure, that's no problem. Git happily runs just locally on your own
machine and does not depend on a server.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-17 23:33 Git with Lader logic Bharat Suvarna
  2015-03-18 11:29 ` Kevin D
  2015-03-18 19:53 ` Randall S. Becker
@ 2015-03-27 15:09 ` Martin Pettersson
  2015-03-27 15:39   ` Junio C Hamano
  2 siblings, 1 reply; 10+ messages in thread
From: Martin Pettersson @ 2015-03-27 15:09 UTC (permalink / raw)
  To: git

Bharat Suvarna <bharat.bs84 <at> icloud.com> writes:

> 
> Hi 
> 
> 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.
> 
> Could you please give me an idea if it will work with 
Plc programs. Which are basically Ladder 
logic.
> 
> Sent from my iPad--
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

I use Git for versioning PLC program written for Beckhoff TwinCAT v2 that 
saves the files in binary format.  
You can probably do the same for most other systems as well.   
  
My way of doing it is... 
I have a batch file that starts TwinCAT including a file that tell Twincat to
open my PLC program and export it into a text based format. 
After that the script opens git gui and gitk.  
  
I have one script like this for each plc program. 
It is quite effcient, the whole procedure only takes a double click and 
less than 10 seconds and you have git gui up and you can see your 
changes in pure text, commit and push.   
I commit both the exported text files and the binary  because the binary
is the one I edit.   
This has been working very well for many years....
  
Take care   
Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-27 15:09 ` Martin Pettersson
@ 2015-03-27 15:39   ` Junio C Hamano
  2015-03-27 16:32     ` Martin Pettersson
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2015-03-27 15:39 UTC (permalink / raw)
  To: Martin Pettersson; +Cc: git

Martin Pettersson <martin@siamect.com> writes:

> I use Git for versioning PLC program written for Beckhoff TwinCAT v2 that 
> saves the files in binary format.  
> You can probably do the same for most other systems as well.   
>   
> My way of doing it is... 
> I have a batch file that starts TwinCAT including a file that tell Twincat to
> open my PLC program and export it into a text based format. 
> After that the script opens git gui and gitk.  
>   
> I have one script like this for each plc program. 
> It is quite effcient, the whole procedure only takes a double click and 
> less than 10 seconds and you have git gui up and you can see your 
> changes in pure text, commit and push.   
> I commit both the exported text files and the binary  because the binary
> is the one I edit.   
> This has been working very well for many years....

Let me check if I got your scheme correctly.

 - You need to track PLC program files, whose native format is
   binary and is not very amenable to textual processing like diff
   and merge

 - But you can tell TwinCat to export that binary file to text (and
   presumably you can tell TwinCat to read that exported text file),
   and the text format is human-readable.

 - You use a script that calls TwinCat to export the binary into
   text as a clean filter, and what is checked into Git is the
   exported text representation.

 - You use another script that calls TwinCat to convert the exported
   text back to the binary as a smudge filter, and what is checked
   out to the working tree is the native binary format file.

Is that what is going on?  I can imagine how that arrangement would
work (after all, that is how clean/smudge filters are designed to be
used).

Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Git with Lader logic
  2015-03-27 15:39   ` Junio C Hamano
@ 2015-03-27 16:32     ` Martin Pettersson
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Pettersson @ 2015-03-27 16:32 UTC (permalink / raw)
  To: git

Junio C Hamano <gitster <at> pobox.com> writes:

> 
> Martin Pettersson <martin <at> siamect.com> writes:
> 
> > I use Git for versioning PLC program written for Beckhoff TwinCAT v2 that 
> > saves the files in binary format.  
> > You can probably do the same for most other systems as well.   
> >   
> > My way of doing it is... 
> > I have a batch file that starts TwinCAT including a file that tell Twincat to
> > open my PLC program and export it into a text based format. 
> > After that the script opens git gui and gitk.  
> >   
> > I have one script like this for each plc program. 
> > It is quite effcient, the whole procedure only takes a double click and 
> > less than 10 seconds and you have git gui up and you can see your 
> > changes in pure text, commit and push.   
> > I commit both the exported text files and the binary  because the binary
> > is the one I edit.   
> > This has been working very well for many years....
> 
> Let me check if I got your scheme correctly.
> 
>  - You need to track PLC program files, whose native format is
>    binary and is not very amenable to textual processing like diff
>    and merge
> 
>  - But you can tell TwinCat to export that binary file to text (and
>    presumably you can tell TwinCat to read that exported text file),
>    and the text format is human-readable.
> 
>  - You use a script that calls TwinCat to export the binary into
>    text as a clean filter, and what is checked into Git is the
>    exported text representation.
> 
>  - You use another script that calls TwinCat to convert the exported
>    text back to the binary as a smudge filter, and what is checked
>    out to the working tree is the native binary format file.
> 
> Is that what is going on?  I can imagine how that arrangement would
> work (after all, that is how clean/smudge filters are designed to be
> used).
> 
> Thanks.
> 
> 

Well  you got it right, but I "almost" never convert the 
exported textfiles back into TwinCat.  

The exported textfiles is not really suitable
for merging as they have a proprietary format, 
but they are human readable and it helps a lot 
to be able to see what changes I made at a certain commit.  
  
I do commit both the exported text files and the original binary files.
Recreating the binary by imprting the textfiles can be done.
I just don't do it because it is easier to commit the binary at 
the same time when I commit the exported text files. 
That way I can just checkout any version and rebuild the project 
and  reload it in the machine. 

My script is just a batch file that I double click on. It is not using 
any of the hooks that git comes with. 

Here is an example, I hope it keeps the formatting  (windows batch file):

Set WorkingFolder="C:\Documents and Settings\Me\projectname\Beckhoff"
Set CommandFile="do_.cmd"
Set TwinCatFile="plc_program_name.prx"
Set ExportFile="exports\intermediate_plate.exp"
Set ExportFolder="exports\modules"

cd %WorkingFolder%

echo project expmul %ExportFolder% > %CommandFile%
echo project export %ExportFile% >> %CommandFile%
echo file quit  >> %CommandFile%

del /f /q %ExportFile%
del /f /q %ExportFolder%\*.*
C:\TwinCAT\Plc\TCatPlcCtrl.exe %TwinCatFile% /cmd %CommandFile%
del /f %CommandFile%

call git gui &
call gitk --all &

Take care
Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-03-27 16:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 23:33 Git with Lader logic Bharat Suvarna
2015-03-18 11:29 ` Kevin D
2015-03-18 19:53 ` Randall S. Becker
2015-03-18 22:28   ` Doug Kelly
2015-03-18 22:38     ` Randall S. Becker
2015-03-19  7:14     ` Bharat Suvarna
2015-03-19 21:17       ` Kevin D
2015-03-27 15:09 ` Martin Pettersson
2015-03-27 15:39   ` Junio C Hamano
2015-03-27 16:32     ` Martin Pettersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.