Sign in to follow this  
Followers 0
balerjoe

Sequencers!

13 posts in this topic

I'm trying at this point to understand how sequencers work. I have Rslogix5000 & emulator. I've looked at several downloads on here but for some reason it just doesn't click. Since you guys seem to be one of the pro's on here can you expain them to me in laymans terms??? It's driving me crazy not understands them totally. Thanks Joe Edited by balerjoe

Share this post


Link to post
Share on other sites
See the attached word document. I through it together quickly so ignore the typos. It should give you a general idea. Feel free to ask if you have any questions about it I can probably put together a small sample program in a day or two if you need it Sequencer.doc

Share this post


Link to post
Share on other sites
Imagine that you have a process that has 7 steps to it, including the initial step. Let’s imagine that we are going to add six ingredients to a tank in a specific order. Define an 8 element DINT array that has the following values in it (as shown in binary) 000000 (0) 000001 (1) 000010 (2) 000100 (4) 001000 (8) 010000 (16) 100000 (32) 000000 (0) Lets call the array STATE_STEPS. Each bit column in the array will represent one state. You have a tag named STATE and have defined STATE.0 as the first step in the operation and STATE.1 as the second step, etc. Now let’s imagine for a second that each step is turning on a specific valve and that you have programmed logic elsewhere that turns on the appropriate actuators when STATE.0 is true, and have done the same for STATE.0 thru STATE.5 That logic will look like this: XIC STATE.0 OTE Valve_1 XIC STATE.1 OTE Valve_2 XIC STATE.2 OTE Valve_3 XIC STATE.3 OTE Valve_4 XIC STATE.4 OTE Valve_5 XIC STATE.5 OTE Valve_6 Let’s also imagine that each valve should be on for a predetermined amount of time. So somewhere in the program we need the following logic. XIC STATE.0 TON Step1Timer 5000 0 XIC STATE.1 TON Step2Timer 6000 0 XIC STATE.2 TON Step3Timer 4000 0 XIC STATE.3 TON Step4Timer 8000 0 XIC STATE.4 TON Step5Timer 7000 0 XIC STATE.5 TON Step6Timer 5000 0 Now what we need next is to have a method that will determine what state number we are on and move the matching value from STATE_STEPS to STATE. So if we are in the third step of our process then we want to move STATE_STEPS[4] into the tag STATE. We could use a counter to keep track of which state we are in and as each timer is done we would increment the counter. The we could use a move instruction: MOV STATE_STEPS[sTATE_COUNTER.ACC] STATE. If we used a counter and a move statement then we must create some logic to cause the counter to wrap back around to the beginning of the process once it is completed. Or, we could use a SQO. The SQO will need a control tag, lets call it STATE_SEQUENCER. STATE_SEQUENCER has an element in it name POS, or position. Now when STATE_SEQUENCER.POS is 0, then the sequencer will move STATE_STEP[0] to STATE. When SEQUENCER.POS is 1 then it will move STATE_STEP[1] to STATE, and so on. The sequencer will upcount by 1 each time the rung is true, just as a counter would. When STATE_SEQUENCER.POS is 7 and the rung goes true, the value of STATE_SEQUENCER.POS wraps back around to 1. Notice it goes to 1, not 0. So STATE_SEQUENCER.POS = 0 and STATE_SEQUENCER.POS = 7 both become our process off steps. STATE_SEQUENCER.POS = 0 will be the initial off step and STATE_SEQUENCER.POS = 7 will be the normal off step once the sequencer has run once until such time as the sequencer is reset. Now we have everything we need to create our sequencer rung. It would look something like this BST XIC START_PROCESS NXB XIC Step1Timer.DN NXB XIC Step2Timer.DN NXB XIC Step3Timer.DN NXB XIC Step4Timer.DN NXB XIC Step5Timer.DN NXB XIC Step6Timer.DN BND SQO STATE_STEPS 000000FFh STATE STATE_SEQUENCER 7 0 When the start button is pushed STATE_SEQUENCR.POS will increment to 1. then valve 1 should open for 5 seconds. Then STATE_SEQUENCR.POS will increment to 2 and valve2 will be on for 6 seconds, followed by valve 3 for 4 seconds, valve 4 for 8 seconds, valve 5 for 7 seconds and valve 6 for 5 seconds. After valve six has been on for five seconds STATE_SEQUENCR.POS will increment to 7 and valves will be off. The sequencer will remain here until START_PROCESS is true again. If the process is started by the operator then START_PROCESS might be something like this: XIC START_BUTTON BST EQU STATE_SEQUENCER.POS 0 NXB EQU STATE_SEQUENCER.POS 7 BND OTE START_PROCESS So that the bit can only be true when the process is not running, thus preventing subsequent presses of the button from prematurely advancing the sequencer. So far so good? What would happen if we changed the values in STATE_STEPS to look like this? 000000 100001 000010 000100 001000 010000 100001 000000 I hope that helps. ------------------------------------- edit: I never directly drive outputs from a SQO instruction. For one thing this obfuscates the program function. I always show the outputs on a rung and drive them from a bit. For this reason I have shown the sequencer as writing into an intermediate DINT value. Additionally, this will make the program more readable and you can include interlocking logic on the output rung where it is visible and obvious rather than having to decipher some bit tables to determine a problem. Edited by Alaric

Share this post


Link to post
Share on other sites
Ok to make sure I know what going on I have attachment of the sample I made. As the sequencer begins to count in this case to 10. I set array to be true from 0-3. So on my destination I have used 2 of the statements that should be true. Are these statements true all time or are they like a one shot? destination[000].4 should be false all the time. During the count when I monitor destination for one second all is true then off then the ones I picked then various ones. Why???? They way I understood was one the length # matched the destination # the statement would be true. As long as the mask allowed it to pass. ( I hope I'm not confusing everyone). RSLogix_5000_Report_s_.pdf

Share this post


Link to post
Share on other sites
Here is a stripped down sequencer the way I do it, but there are many ways to use sequencers. Toggling the CycleStart bit latches the Machine.AutoMode bit and the Machine.InCycle bit. As long as the machine is in auto mode the sequencer runs. For simplicity I have just used timers off of the outputs of the sequencer to fire the input bits. It will cycle through turning on your Light, FenceLight, and YellowLight bits in one second increments. If you look at Machine.OutArray[4].31 in the tag browser, you will see a one in it. Put a one in the step after the last step of your sequence. Rung 6 turns on the Machine.CycleComplete. It will be on for one scan since rung 4 resets it. You can use this to increment counters or whatever. When it gets to rung 4 it resets the Machine.Control and moves zeros to your Machine.Out bits which restarts your sequencer. Toggling the CycleStop bit will stop the sequencer but does not reset it so when you toggle the CycleStart bit again it restarts where it left off. If the YellowLight bit was on when you stopped it, it will turn back on when you restart it. Toggling the CycleReset bit will stop the sequencer and reset it so when you toggle the CycleStart bit again it starts at the beginning of the sequence Hope this helps Edit - Sorry, guess it would help if I attached the file Sequencer.ACD Edited by TWControls

Share this post


Link to post
Share on other sites
Each time the rung containing the SQO instruction goes from false to true, it increments (like a counter) the POSition value, and writes the Array(POS) word to the destination word through the mask (which can also be indexed). The destination value should not change again (unless something else writes to it) 'til the next false to true transition of the SQO instruction. I'm not a controllogix expert, but it looks like you have a 3 dimensional array for the Array. I don't know what effect that will have. The SQO instruction will set the DN bit in the control word when the position value is equal to the length. It will then start again at position 1 on the next false to true transition. It only goes through step 0 at power up. Gotta go ... being paged ... hope this helps Paul C.

Share this post


Link to post
Share on other sites
twcontrol - Hey it won't let me open it says my version is too old 12.03.

Share this post


Link to post
Share on other sites
It is and I only have version 13 and 15 installed on my computer. Maybe someone else can get it down to version 12 for you. It will work fine in version 12.

Share this post


Link to post
Share on other sites
Converted to Ver. 12 Sequencer.ACD

Share this post


Link to post
Share on other sites
ok making more sense. VALUE ARRAY SEQUENCER 0-31 MASK -1 DEST: DESTINATION 0-10 EACH ONE HAVING 32BITS CONTROL: CONTROL LENGTH: 8 POSITION: Now I put into the array what I want to see pass through. (e.g. 0001) In this case with the mask being -1 the one should pass. Now why on my Destination do I get 32 bits for each # in length? Shouldn't it just be 0 or 1??? Showing true or false? Because theres no way my array can match my destination. Destination is like 0-31 for each length or step. While the ARRAY is a single digit. I know this must be getting on you guys nerves but I love to ask questions.

Share this post


Link to post
Share on other sites
Can you explain what you are asking a little more. I'm not quite understanding what you are asking. Can you specify when you are talking about Inputs or Outputs in your questions

Share this post


Link to post
Share on other sites
In the example, the sequencer uses 32 bit DINTs. They will all be used even if you're only concerned with four of them. Now, you can view the value in binary to see all 32 bits, or decimal to show it as a DINT. Also, when I opened the file, I found that the source data (Machine.OutArray[0]) is all zeroes. In the SQO instruction, right click on Machine.OutArray[0] and hit Montitor "Machine.OutArray[0]". This will take you to the "data table" and allow you to edit the source values. (When you get to that screen be sure to select the EDIT VALUES tab at the bottom os you'll be allowed to edit the values, and not just monitor them. This may not be necessary when offline, I don't have a test set-up to try online though.) You should be able to set bits in this file, and then see the same patterns appear in the destination word as the SQO control word position value changes. Each time the SQO executes, the Machine.Out DINT will be set equal to Machine.OutArray[Machine.Control.POS], and you should be able to correlate the pattern. It may be helpful to put the SQO on an unconditional rung and manually set the Machine.Control.POS value to see this in action. Once you understand how it works, the SQI will be simpler to grasp. The SQI is pretty much the same as a MEQ with indexed addressing but uses, as it's index, the position value from a control data type. Hope this helps ... Paul C.

Share this post


Link to post
Share on other sites
Thanks everyone for your help. After studying them I fully understand what they do & how to use them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0