Running motors for 10 seconds

icemaker

Member
Join Date
May 2022
Location
Texas
Posts
3
I am a newbie trying to write code to run a motor for 10 seconds and then run a second motor for another 10 seconds. The two motors should never be on at the same time, and the cycle should repeat until power turned off.



Any help would be greatly appreciated.


Iceman.
 
Welcome to the forum.

what plc are you using?
this is what you have stated.
1. start motor1 and run it for 10 seconds.
2. turn off motor1
3. start motor2 for 10 seconds.
4. turn off motor2
5. goto step 1
depending on what you have available, i would also add a cycle start and stop pushbutton.
this is a good start for your work.
please post your work (zip it first, forum rules) if its the entire program and we will help. no one will do your home work for you.
james
 
please post your work (zip it first, forum rules) if it's the entire program and we will help. no one will do your home work for you.

+1

Post an image or a PDF as well, as not everyone here will have the same brand PLC and software as you, so they will not be able to look at your code using the manufacturer's IDE, but if they can review an image or PDF, then they may be able to help.

Also, a good place to start is @Ron Beaufort's PLC bootcamp videos here, then the Patterns of PLC Programming pages here.

The bootcamp video series is especially useful: they take less than 2h to watch the first time, but provide a solid foundation for understanding how PLCs work i.e. the scan cycle, even if you do not use ladder logic. Watching repeatedly until you can think Ron's words before he says them is also not a waste of time.

The Patterns of PLC Programming shows patterns the PLC programmers use over and over again in various forms, especially the Seal-In, Start/Stop, and State/Fault patterns.

Programming PLCs, and for that matter any programming of digital computers, involves "telling" the PLC what you want it to do. The trick to remember is that while the PLC cares not a whit what you want it to do, if it is not broken it will very faithfully, precisely, and inexorably do exactly what you tell it to do. So the only hard part is making sure you do not tell it to do something other than what you want it to do. And the only diagnostic tools you will have are

  1. Interpreting how the PLC will behave when running the instructions you give it (see @Ron Beaufort's videos above);
    1. if you want to succeed, then you must always be ready to consider that your skill in doing this is less than perfect!
  2. Seeing the PLC do what you told it to do, and noting the difference between that and what you wanted it to do;
    1. this tool will almost always be far more reliable than the first, and if you want to succeed, will almost always be your standard for truth when there is disagreement between the two tools.
      1. The only times it will not give you truth are
        1. when you misinterpret what you are seeing, which will happen less frequently as you gain experience, or
        2. the PLC is broken, which will happen very infrequently.
  3. This forum, when you cannot reconcile 1 and 2.
To put it more succinctly, the quickest way to solve a problem in 99%+ of all cases is to start with the assumption that the PLC's behavior, however strange and unexpected, is exactly what you told it to do, no matter what you thought you told it to do.

Abandon hope, all ye who think otherwise and enter here ...
+
 
Last edited:
Side issue:
Hopefully someone has properly considered the duty cycle for the motors. 10 starts per hour might require de-rating depending on the HP size involved.
 
Here is what I have so far.


Ah, similar to Siemens LOGO! apparently. Very nice.

Could you please explain how you thought the blocks and connections in that diagram are going to interact with each other to accomplish your desired behavior?

Cf. here; we are the rubber duck.
_
 
Last edited:
@icemaker - that is more than twice as many blocks as are needed to implement that behavior. Look at the Asynchronous Pulse Generator block; I implemented the target behavior with that as one of five blocks total, and three of those five blocks were the input and the two outputs.

Not that the minimum number of blocks (a.k.a. "code golf") is always best, but sometimes concise will be synonymous with clear.
 
I would use 4 timers:

T1 = Motor 1 On timer
T2 = Motor 1 Dwell timer
T3 = Motor 2 On timer
T4 = Motor 2 Dwell timer

If you really want to make sure they are not both running at the same time, the dwell in between will allow your program time to switch over. In a real world situation you may need to wait for one motor to ramp down before switching the other on. And even if you don't, you just set the dwell timers to something really short like 25 mS so you have the option.
 
HOW about single 10 sec timer and use "ON" for motor 1 and "OFF" for motor 2?
Then add a start timer on each motor for dwell.
 
Why not a single timer for timing both run and dwell, for both motors?

Seven blocks: four instructions; one input; two outputs.

I find the more timers are involved, the harder it is to read the logic.
_
 
Last edited:
However many blocks we end up with, it does not make sense to use unnecessary block that only obfuscate what the code is supposed to be doing:
icemaker_simplifications.png

Here is is simplified:
icemaker_simplifications_fixed.png
 

Similar Topics

Good Morning , I am working on a new project and I am using 3 Inverter Duty motors. 2 - 5 HP motors and 1 - 3 HP motor. I am using PowerFlex...
Replies
10
Views
3,362
I have a 2HP drive but the mechanical designed it with a 1HP motor and a 2HP motor. Normally if they are the same HP, we would just put a...
Replies
12
Views
3,194
Hy, We are using the below mentioned Siemens motor, micromaster drive, and the following accessories in order to run an unwind: Filter emc...
Replies
7
Views
5,604
A new point I/O rack is to be hooked up with the running PLC. In point I/O, it is supposed to be the OA4 card to be installed as per the...
Replies
1
Views
74
Hi, I received this SIMATIC S7-300 training kit for maintenance. When I power it up, the PLC doesn't go to RUN mode and the STOP mode led is...
Replies
7
Views
252
Back
Top Bottom