You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old May 21st, 2022, 09:39 AM   #1
icemaker
Member
United States

icemaker is offline
 
Join Date: May 2022
Location: Texas
Posts: 3
Running motors for 10 seconds

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.
  Reply With Quote
Old May 21st, 2022, 10:18 AM   #2
James Mcquade
Member
United States

James Mcquade is offline
 
Join Date: Oct 2007
Location: Nashville, Tennessee area
Posts: 3,340
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
  Reply With Quote
Old May 21st, 2022, 11:09 AM   #3
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,150
Quote:
Originally Posted by James Mcquade View Post
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 ...
+
__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good

Last edited by drbitboy; May 21st, 2022 at 11:15 AM.
  Reply With Quote
Old May 21st, 2022, 02:46 PM   #4
icemaker
Member
United States

icemaker is offline
 
Join Date: May 2022
Location: Texas
Posts: 3
Thanks James. Yes, that is the logic I am looking to build. I am using an IDEC B12RCC SmartRelay
  Reply With Quote
Old May 21st, 2022, 03:23 PM   #5
icemaker
Member
United States

icemaker is offline
 
Join Date: May 2022
Location: Texas
Posts: 3
Motor Sequence start stop

Here is what I have so far.
Attached Files
File Type: pdf IDEC Motor Sequence.pdf (186.3 KB, 59 views)
  Reply With Quote
Old May 21st, 2022, 04:20 PM   #6
jraef
Member
United States

jraef is offline
 
jraef's Avatar
 
Join Date: May 2006
Location: Northern California
Posts: 2,109
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.
  Reply With Quote
Old May 21st, 2022, 04:36 PM   #7
roxusa
Lifetime Supporting Member
United States

roxusa is offline
 
Join Date: Nov 2008
Location: NJ
Posts: 921
OP said every ten seconds, is that a typo
__________________
B.Pedersen
if you are going to assume, assume you're wrong.
  Reply With Quote
Old May 21st, 2022, 06:59 PM   #8
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,150
Quote:
Originally Posted by icemaker View Post
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.
_
__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good

Last edited by drbitboy; May 21st, 2022 at 07:38 PM.
  Reply With Quote
Old May 21st, 2022, 11:55 PM   #9
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,150
@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.
__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good
  Reply With Quote
Old May 22nd, 2022, 10:57 AM   #10
Rson
Member
United States

Rson is offline
 
Join Date: Jun 2017
Location: Michigan
Posts: 493
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.
  Reply With Quote
Old May 22nd, 2022, 12:22 PM   #11
Jlandwerlen
Member
United States

Jlandwerlen is offline
 
Join Date: Jan 2022
Location: Atlanta
Posts: 60
I would create a simple state machine. No need to make this harder than it should be.
  Reply With Quote
Old May 22nd, 2022, 01:33 PM   #12
NetNathan
Lifetime Supporting Member
United States

NetNathan is offline
 
Join Date: Nov 2011
Location: Corona, CA
Posts: 2,038
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.
__________________
****Control Freak****
Net is where I be and Nathan is me.
I have a condition called "The Knack".
https://www.youtube.com/watch?v=g8vHhgh6oM0&t=2s
  Reply With Quote
Old May 22nd, 2022, 03:36 PM   #13
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,150
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.
_
__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good

Last edited by drbitboy; May 22nd, 2022 at 04:05 PM.
  Reply With Quote
Old May 22nd, 2022, 04:47 PM   #14
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,150
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
__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good
  Reply With Quote
Old May 23rd, 2022, 04:46 PM   #15
Nova5
Member
United States

Nova5 is offline
 
Join Date: May 2013
Location: Northern Snowball
Posts: 561
Quote:
Originally Posted by roxusa View Post
OP said every ten seconds, is that a typo
Its a school project. they could say rocket engines if they wanted, its just a sequenced output firing example.

No one in their right mind would cycle motors every ten seconds. thats barley spin up and down time.
__________________
Problems that go away on their own mystically are not solved. They will return.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Logix Designer Studio 5000v28 Crash when opening Predefined mwright_00 LIVE PLC Questions And Answers 4 December 30th, 2019 01:03 PM
Running code every 16 seconds Crimson 3 secs LIVE PLC Questions And Answers 2 October 23rd, 2015 07:57 PM
Powerfllex 40 running to motors of different HP fwagner5 LIVE PLC Questions And Answers 12 October 18th, 2011 10:56 AM
Can a VFD do magic with motors Goody LIVE PLC Questions And Answers 37 February 25th, 2004 03:01 PM
how often should I trigger the PID? Ron Beaufort LIVE PLC Questions And Answers 11 February 22nd, 2003 11:57 AM


All times are GMT -4. The time now is 05:50 PM.


.