Question about PLC Timers


#1

Hi all,

I’ve been asked to look at a programming problem with a Siemens PLC, and don’t have a great deal of experience with them.

The problem is as follows:

You have four toggle switches (normally open) that control four pieces of separate machinery.
The PLC is to be used to introduce a delay between the switch being switched on, and the equipment receiving the signal from the PLC to start.
The tricky part is that the delay needs to ensure there is a 10 second spacing between each piece of equipment starting to prevent a sudden load on the electrical system.

For example:

Switch #2 is switched on, 10 second delay before motor #1 turns on.
Switch #4 is switched on after Switch #2, so it needs a 10 second delay after the timer for switch #2 finishes.
Switch #3 is switched on after Switch #4, so it needs a 10 second delay after the timer for switch #4 finishes.
Finally, Switch #1 is switched on after Switch #3, so it needs a 10 second delay after the timer for switch #3 finishes.

In terms of a sequence diagram:

Switch #2 ON — 10 sec —> Motor #2 ON
Switch #4 ON —> Motor #2 ON — 10 sec —> Motor #4 ON
Switch #3 ON —> Motor #2 ON --> Motor #4 ON — 10 sec —> Motor #3 ON
Switch #1 ON —> Motor #2 ON --> Motor #4 ON —> Motor #3 ON — 10 sec —> Motor #1 ON -> DONE

So the design problem include:

  1. Switches going on in an arbitrary order
  2. Operator may switch off an arbitrary switch while operating the device.

To me, this looks like a basic queue, where each “pop” from the queue takes 10 seconds. Also, switching off a switch deletes the device it corresponds to from the queue, and switching it on adds the device it corresponds to the back of the queue.

The Question: is this possible to implement with the device we’re looking at? I am attaching a picture of it.

I don’t expect anyone to code this for me, but if it’s a common pattern I’d appreciate a gentle nudge in the right direction.

Cheers!!


#2

Hi @Andrew_Hendriks,

I haven’t used Siemens PLCs, but done similar for Mitsubishi & Allen Bradley.

Steps:
(1) Use the Development Environment (equivalent of Mitsubishi GX Works IDE); let’s say you are using the Graphical Programming Languages (Ladder Logic OR IEC 630…) and Create a project.
(2) Let’s say the push button or self resetting switches correspond to Digital Inputs, DI1…DI3 (you may choose to Latch or Set the inputs).
(3) Use Monostable Timers blocks in the Ladder after the corresponding Digital Inputs and enter the time delay in the block properties (or inputs) and write the ladder diagram order of switching.
(4) After the corresponding motor turn on action, Reset the Latched Inputs.

Since this program is not more than a “page length”, this should have sufficient memory.

Best,
RK


#3

Don’t forget to download the program to the PLC and hit “Run” on the PLC!


#4

(1) Also if a switch is ON, the ladder diagram will have “branches” that correspond to different if-then-else" conditions.
(2) If you turn a switch OFF, that “Ladder Branch” does not get executed by the PLC.


#5

Doing things sequentially like that with a parallel system will be more difficult than you think. Certainly possible though.

I’m don’t know that particular model, but it if it has more than a couple dozen memory bytes, you’ll be fine.

My strategy would be to completely decouple the timing and the sequencing portions.
You’ll want to create a separate timer function block that handles your delay for whenever you need it.
I use the On-Delay Timer (TON) block in TIA Portal.

Allow the system to turn a motor on whenever one hasn’t previously turned on in the last ten seconds (assuming I’m reading your problem statement correctly).

In the sequencing portion, there are a few ways you could do a queue. I haven’t done something similar so I don’t have a recommended method, but lemme know if you get stuck and we can spitball it.