PLC Code Motor Staggering

jperiera

Member
Join Date
Jan 2013
Location
Oklahoma
Posts
6
Hello and Thank you in advance. I am relatively new to PLC and I was just encountered with a code issue that has kept me from advancing in my project.

I have a generator power control system that starts 6 motors. Motors will come ON and OFF at random due to control requirements. I am trying to write code to delay the start of any motor anywhere from 3 to 7 seconds from the time the last motor that started.

Using ML1400

Thanks
 
One of many possible ways to skin this cat

Is the delay time for each motor different? Or, variable? Or, will all delays be for the same time?
 
When a motor comes on use a one-shot to latch a bit in a binary word. Each motor will have its own bit assigned. As one of the conditions of starting a motor compare the value in the WORD containing the bit to zero. If EQU, it's OK to start.


Lower down in the logic add rungs to:
  1. Compare the binary word to zero. If GRT, start a TON.
  2. When the timer is done CLR the binary word. This will reenable the start circuit.
No matter which motor is started the value in the binary word will be greater than zero. With the correct logic added
 
What I did for a cycle starting of 6 HVAC units was program a one minute looping timer, them using the LIM command let one motor start at its own window of the timer.

The first motor would only start between the time of 0.1 to 5.0 seconds on the loop, 5 second pause then motor 2 would start from 10.1 to 15 seconds.

This would cause a longer delay sometimes, but not over 55 seconds from motor call to actual start.
 
Aabeck the only issue with your system is that I do not have a predetermined start sequence. Any motor can come ON at any given time I just need to make sure that once one more comes ON no other motor will come ON after a specific delay.

Thank you very much
 
Doug, Thank you for your idea I think it will work great, but due to the lack of PLC code knowledge I do not know how to set specific bits in a binary word to 1. Do you have a sample you can share?

Thank you
 
About as simple as it gets:


motor has started set bit one
I:0.1 B3:1/1
-------------| |----------------------------(L)-----



The bits to be set will be one of B3:1/0 thru 15. If you would ever need to use bit 15, change the compare to a NEQ.
 
Thank you Doug, I do know about setting a bit for some reason on previous post I got confused by WORD bit. I thought you were asking me to set specific bits out of a word.

Thank you I will try now to write the code.
 
Code

Doug,

Is this something like what you recommended? I think this will work just fine. All I would have to do now is duplicate rung 3 for each one of the motors.

Thanks

Untitled.jpg
 
My conception was to have a separate bit latched for each motor start event. If using one bit, as you have constructed, the word compare instructions would not be needed, you could just test the bit by itself.

Also, check the instruction set help for the ONS instruction. I'm not sure all those ONS instructions in parallel will work properly.

One more thing - In rung 5 you have the ONS referencing T4:16/DN. I have never seen this done, and while the processor might accept it (doubtful), it's questionable practice. ONS bits, at least all the ones I've ever seen, are normally located in a binary word. I strongly recommend that you find an unused bit in a binary word for the ONS. Do not use the word you're using for these compares, keep the word for the compares dedicated to that purpose.

Finally, the ladder you posted is just barely legible (font size) but it appears that in rung 3 the EQU is testing B3:5 [something I can't make out] 6. This does not appear as an error because you haven't yet attempted to compile the rung. The compare instructions work on WORDS. So, the correct syntax would be: EQU B3:5 0 - meaning, if the 16-bit value in binary file 3, word 5 is equal to zero the rung is true to this point.
 
How about this?

XIC O:1.0 TON T4:0 0.01 600 0
XIC O:1.1 TON T4:1 0.01 600 0
XIC O:1.2 TON T4:2 0.01 600 0
XIC O:1.3 TON T4:3 0.01 600 0
XIC O:1.4 TON T4:4 0.01 600 0
XIC O:1.5 TON T4:5 0.01 600 0
XIO T4:0/TT XIO T4:1/TT XIO T4:2/TT XIO T4:3/TT XIO T4:4/TT XIO T4:5/TT OTE B3:1/0

The first 6 rungs are simply a timer that runs based on each of the 6 motor's run output. Each timer runs for 6 seconds when each motor is commanded to start.
The 7th rung just checks if any of the 6 timers are timing.
If B3:1/0 is true, it's OK to start a motor. Since this is a permissive to start a motor, it belongs in the part of your logic that starts each motor.

I also think you have some problems with your ONS instructions. I think the basic issue is: The memory address assigned to a ONS instruction is a storage bit that the instruction uses to record the input state. You can't just assign an address like a timer .dn bit to a ONS. If you want a bit that is on for one scan when the timer .dn bit goes true, you do something like this:

XIC T4:0/DN ONS B3:0/0 OTE B3:0/1

The B3:0/0 is used by the ONS instruction, the B3:0/1 will be on for one scan when the T4:0/DN bit is on.

If you post how you want the system to work and the code you intend to use, people here will give you suggestions on how to make it work.
 
How about this?

XIC O:1.0 TON T4:0 0.01 600 0
XIC O:1.1 TON T4:1 0.01 600 0
XIC O:1.2 TON T4:2 0.01 600 0
XIC O:1.3 TON T4:3 0.01 600 0
XIC O:1.4 TON T4:4 0.01 600 0
XIC O:1.5 TON T4:5 0.01 600 0
XIO T4:0/TT XIO T4:1/TT XIO T4:2/TT XIO T4:3/TT XIO T4:4/TT XIO T4:5/TT OTE B3:1/0
I like it.
 

Similar Topics

i am new to these things. I have no intention of using this in a commercial way whatsoever. I wanted to write a small plc programme for myself. We...
Replies
18
Views
7,848
I have a machine which is undergoing upgradation. As part of the process two SEW drives are being replaced., existing Gen B with new Gen C. The...
Replies
3
Views
191
I want to set user security level based on the value of a tag in my PLC called "ActiveUser". That tag will contain the A-P code which we use for...
Replies
6
Views
207
Hi All, I wanted some feedback/thoughts on code implementation or development across several offices. What has been your collaborative...
Replies
6
Views
398
Hi! I'm fairly new to PLCs, and a PLC I was swapping sensors for shows the error code 497 - 0x050000 on the top of the HMI when I powered it back...
Replies
6
Views
591
Back
Top Bottom