Best way of using same code multiple times

Scarra

Member
Join Date
Oct 2016
Location
Tilburg
Posts
7
Good day all you knowledgeable people.
The scenario:
We have 1 main PLC communicating to and controlling multiple PLCs (up to 20). These multiple PLCs all contain exactly the same code - each performing exactly the same function. The main PLC will orchestrate the individual PLC depending on data received from them.
The Hardware:
Main PLC is a GaurdLogix 1756-L83S
"Child" PLCs are Compact gaurdLogix L30ERMS

The problem is not the child PLCs, the problem lies on the main PLC where each child is monitored and addressed individually. The code per child is complex and long, so copy-paste multiple times is out of the question. Ideally, we want to do the code once as a "template", then use the template multiple times. We are considering using indirect tagging/arrays, but then cross-referencing and maintaining the code will become difficult for the maintenance team later in the life of the product.

The Question:
Is there an elegant and more productive way of doing this?
Please assist
 
Good day all you knowledgeable people.
We are considering using indirect tagging/arrays, but then cross-referencing and maintaining the code will become difficult for the maintenance team later in the life of the product.

don't do that it's like a time bomb.

My opinion
ok by making it easier for you... you then make it hard for everyone who follows. if its manufacturing this equates to lost time or lost production. do it right the first time and the dividend will repay your client many times. no sense it making it really clever when it does not need to be.... think about the guy on night shift who has to fix it !!
 
Last edited:
CompactLogix/ControlLogix have the AOI which is a way to program code for reuasability.
Downside is, as far as I know AOI cannot be used with online editing.

Definitely would not recommend going by indirect addressing for this purpose.
 
... AOI which is a way to program code for reuasability.
Downside is, as far as I know AOI cannot be used with online editing...

That was a consideration, but sorry, that is definitely not going to work. As I said, the code is complicated and long, consisting of numerous routines.
And no, online edits of AOIs is not possible.
 
I did something similar though might not be as complex as yours where I used Produced / Consumed tags to convey the status and control tags (status and control in separate UDT's ) from individual child PLC's to/from the master. Then the master evaluates and acts on them. Depending on the speed of your process this may or may not be an option.

I do use an indexed process, but the indexing process copies the entire status UDT into a working area, Master does the evaluation and writes required changes to the indexed command UDT. Then the P/C tags simply do their thing.

The advantage to copying into a working area first is the ease that an electrician can see the values in the UDT and doesn't have to try to find a value using the index number.
 
I did something similar though might not be as complex as yours where I used Produced / Consumed tags to convey the status and control tags (status and control in separate UDT's ) from individual child PLC's to/from the master. Then the master evaluates and acts on them. Depending on the speed of your process this may or may not be an option.

I do use an indexed process, but the indexing process copies the entire status UDT into a working area, Master does the evaluation and writes required changes to the indexed command UDT. Then the P/C tags simply do their thing.

The advantage to copying into a working area first is the ease that an electrician can see the values in the UDT and doesn't have to try to find a value using the index number.

Thank you! (y)
This is good advice. We also use produce/consume, but copying into a staging/working area will do the trick.
 
As an OEM im generally surprised the quality of a maintenance man dictates how you write your code.

In the 12 years i've been in my current role, the discussion has never arisen. (Aside facility A uses Siemens and Facility B uses Rockwell)
 
As an OEM im generally surprised the quality of a maintenance man dictates how you write your code.

In the 12 years i've been in my current role, the discussion has never arisen. (Aside facility A uses Siemens and Facility B uses Rockwell)

Bit off-topic here, but hey, then you are fortunate. Not all clients are English, and not all technicians are literate with PLC code.
 
My comment to avoid making reusable code by indirect addressing is aimed at the main programmer, not a 3rd party. Think about having to return after a couple of years after you wrote the "master piece" and try to pinpoint a sneaky error.

If AOIs are not an option, copy-paste with a lot of search-and-replace may be the only way to go. The search-and-replace may be much easier if you cleverly name the symbols used so you dont have to change the entire symbol but only the part that identifies each instance. That is actually not so hard to do.
The problem is that every time you make a change, you have to re-do it in every program instance, in your case 20 times.
The above is how I did it with PLC5 way back, and then there were more than 20 instances.
 
On the Master you will need a program to read every slave(one after the other by only one program). and put the result in one or more array.
Never copy and paste your program better is to use a function to do a task. In the beginning it is more complex, however after a good lookthrough it will get simpler. You will have to find a balance between operation and maintenance.
I am very close to you so a visit is no problem. Not used AB however IEC61131 is no problem.
 

Similar Topics

Hi All, I'm working on an AOI that needs a ONS incorporated into the logic. Every time I run the instruction the ONS gets stuck on even when the...
Replies
5
Views
3,070
The PC I have has RSLinx v2.52 installed with VisualBasic 6. I saw a few examples with POKE's but they were using PLC 5. Am I supposed to add a...
Replies
0
Views
1,856
I would like to ask a basic and simple question. What can i use to vary a single-ph induction motor using PLC? as far as i know is using VFD but...
Replies
1
Views
1,657
Compactlogix controller, program has 28 conveyors that use TON's to start the conveyors. The TT sounds a warning horn during start and the DN...
Replies
7
Views
154
I have S7 1512C controler for controlling 48 PID temperature loop, the output is PWM. Please I need the best, most efficient way to write the...
Replies
9
Views
259
Back
Top Bottom