Multiple subroutines in Logix 5000

pauly

Member
Join Date
May 2002
Location
South Wales,U.k
Posts
244
We have an application where we need to indicate a piece of machinery needs maintenance. I have created a routine which resets a value of "days left" when maintenance has been performed and starts counting down the days until the next is due. The maintenance interval, days left etc are part of a UDT, which is passed as a parameter to the subroutine. There is a separate UDT for each bit of machinery.
The problem is, the customer has specified 600 ish pieces of machinery with separate maintenance intervals. This would mean 600 ish subroutine calls which is a bit(?) overwhelming.
Can anybody think of a cleaner way of accomplishing this? The customer didn't want to use AOI's
 
Your customer is probably not going to like my answer but with that many items all probably having their own variables that is not a task for a plc. That is a task for a asset management software that runs on a pc.
 
#1 _DOCK_ is correct: spend every effort to convince the customer to do the the right way.


#2 if they remain unconvinced, charge them through the nose, then do this:



  • make a file, or several files, of these UDTs
  • maintain an index, which may be include a file number as well as a numerical index
  • on each scan
    • call the subroutine once in the scan
      • the subroutine checks UDT[index] only
    • increment the index; roll over from 599 to 0
I am sure I got the syntax wrong, but some form of that approach should be possible.
 
First - they have a single PLC for 600-ish machines? How many HMI screens would be needed to display upcoming maintenance needs - that could be hundreds weekly.

I think each machine would have its own PLC and if so a single routine can be copied onto each of the machines and run locally. Then have the PLC's message _DOCK_'s system, or better have _DOCK_'s system message reads from all the PLC's.
 
I agree with drbitboy/dock, but to add I would seriously consider bring an economic argument to the customer's aversion to AOIs. Do they have a maintenance team that is unfamiliar with AOI? Let the customer know you can train them in (at a cost, of course). Even with this training time, the ability to use AOIs for this will still result in fewer work hours for this project alone.
 
Thanks for the replies

DRBITBOY

make a file, or several files, of these UDTs
maintain an index, which may be include a file number as well as a numerical index
on each scan
call the subroutine once in the scan
the subroutine checks UDT[index] only
increment the index; roll over from 599 to 0

What do you mean by a file? I was using an array of UDT's is that what you mean?
 
I agree with dock and drbit - not what a plc is best suited for.
JLand brings up a great point that's often overlooked - long term and end user ownership.

Implementing a dedicated system to do what the customer wants will be way less costly over time to set up, install, modify, etc. Sure they have to buy some extra hardware/software now, but the cost of development time will be cut significantly.
 
DRBITBOY

make a file, or several files, of these UDTs
maintain an index, which may be include a file number as well as a numerical index
on each scan
call the subroutine once in the scan
the subroutine checks UDT[index] only
increment the index; roll over from 599 to 0

What do you mean by a file? I was using an array of UDT's is that what you mean?




Yes, "file" = array, so you are already there. The point is that the code does not need to check every UDT on every scan cycle; if the code checks one UDT per scan cycle, a typical PLC would run through all 600 UDT in a few seconds, and several times per minute, which I expect would be enough for this application.



Re: "file." Sorry, my experience is mostly A-B, so I have started using the A-B jargon and assuming I was normative*, used word "file" instead of array or memory.



* one of humankind's biggest mistakes, and one that i keep repeating; d'Oh!
 
Thanks for the reply. Have a good weekend, as good as you can anyway



I agree with above not the ideal job for a pure PLC (aka rockwell) , what about coding this on a codesys PLC like beckhoff which can handle file management far better and still run down at the sub 10mS time frame in Realtime
 
He's counting 'Days Left' - I hardly think getting a scan time to 10ms is going to help much.

Displaying days left until maintenance for 600 machines, is just a daft job for a plc.
 
To answer the question.

I think you just need a pulse once per day and a couple of arrays. One to count down the time for each machine and perhaps another one to signal that Maintenance is required.

Something like...

if PulseOncePerDay Then
For X := 0 TO 599 Do
if MachineTimeToMaintenance[x] > 0 then
MachineTimeToMaintenance[x] := MachinesTimeToMaintenance[x] - 1;
if MachineTimeToMaintenance[x] = 0 then
MaintenanceRequired[X] := 1;
end_if;
end_if;
end_for;
end_if;

or the ladder equivalent.

“ MachineTimeToMaintenance” is an array of 600 double integers
“MaintenanceRequired “ is an array of 600 Booleans


The whole for – next loop is executed in one scan (once per day). If this was a problem then don’t use a loop, just increment x every scan.

I suspect you would have an array of UDT’s with the maintenance period of each machine. On the HMI you could have an edit box linked to a DINT register in the PLC for the machine you wanted to say you had serviced. And a button to say reset the service time. These could be called “MachineToReset” and “ButonPressResetService”




In the PLC
If ButonPressResetService and MachineToReset >= 0 and MachineToReset < 600 then
MachineTimeToMaintenance[MachineToReset] := UdtMachineDayaArray[MachineToReset]
MaintenanceRequired[MachineToReset] := 0;
End_if;
Or ladder equivalent
 
Last edited:
I agree with drbitboy/dock, but to add I would seriously consider bring an economic argument to the customer's aversion to AOIs. Do they have a maintenance team that is unfamiliar with AOI? Let the customer know you can train them in (at a cost, of course). Even with this training time, the ability to use AOIs for this will still result in fewer work hours for this project alone.


I think they have a process that can't be stopped and don't want trash that isn't being used left behind in the PLC program. I totally understand their point of view and aversion to use of AOI's.
 

Similar Topics

It seems very bad to have one OTE address being used in more than one place, seems that only the last entry scanned is used? But what about the...
Replies
25
Views
8,212
This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
106
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
10
Views
479
I have 9 field devices, three METSEPM5110 power meters and six ACE949-2 rs285 interface modules. I want to read this Modbus rtu data through rs485...
Replies
8
Views
300
I'm trying to use DTM browser to make make modbus poll from RTAC. I'm able to get the points in first poll object. But not able to get anything in...
Replies
1
Views
117
Back
Top Bottom