Kinzie

studio 5000 Programmatic Timer/Delay

14 posts in this topic

Howdy,
Wasn't sure the best place to post this Programmatic Timer/Delay question.

I need to create a Timer whose 'time' will change programmatically. I am having trouble coding this in RSLogix/Studio 5000.
I need to delay a little more every time 1 Product passes through up to a certain count then reset and start over.
Basically during a conveyor transition, via a pop=up conveyor, I don't want the product in the same place every time. I want each successive product to be in a little bit different spot, call it the Conveyor Land Point. The product will land a little further each product, then start back at the first land point

I have no code to share as all attempts were FAILs :-(

Inputs:
> Product Count (Count up or down counter)
> Product Count Cycle (Number, constant, set able, currently = 4)
> Delay Time Sequence Interval (Number, constant, set able, currently = 0.25 seconds)

Outputs:
A sequencing delay, based on Product Count
> Delay Sequence:  1st delay 1 second. 2nd delay 2 seconds, ... up to Product Count Cycle (4) then reset back to 1.

Program: (As I was thinking)

  • Set Product Count Cycle, Product Count Cycle = 4 (May change could be 3,4,5, or 6) (Might be hard code, might be an HMI input)

  • Set Delay Time Sequence = 0.25 seconds (May change could be 0.5, 0.75, 1.0 etc.) (Might be hard code, might be an HMI input)

  • Line start, Product Count at one (1)

  • Calculate Delay

    Delay   = Delay Time Sequence Interval * Product Count Cycle * Product Count

  •  Product Count increments via PE

  • Repeat

e.g.

    Delay 1 = 0.25 * 4 * 1 = 1 second


    Delay 2 = 0.25 * 4 * 2 = 2 seconds


    Delay 3 = 0.25 * 4 * 3 = 3 seconds


    Delay 4 = 0.25 * 4 * 4 = 4 seconds


    Delay 5 = 0.25 * 4 * 1 = 1 second


    Delay 6 = 0.25 * 4 * 2 = 2 seconds


    Delay 7 = 0.25 * 4 * 3 = 3 seconds


    Delay 8 = 0.25 * 4 * 4 = 4 seconds


    Delay 9 = 0.25 * 4 * 1 = 1 second


    etc.

Hopefully I have not 'run' at the mouth, wanted to give as much info upfront                I included a picture

Any thoughts, help would be great. thanks,

SanderShift.png

Share this post


Link to post
Share on other sites

The answer is probably no but at least I'll see the replies. Admittedly I don't think I'm following what you want to do (it sounds too easy)

Can you use a TON and write the parameters that you need to change via a tag (I'd use an array but individual tags work too). Ie use a MOV (might by Copy, I don't have my laptop handy) and move the  value in a tag into the timer preset and then reset it? Each step would have it's own tag. The Preset can be calculated, hard coded, from the HMI, whatever...

Share this post


Link to post
Share on other sites

Thank you,

I took a stab at it during a brief window break in production, didn't get it, figured I try the Forums to be ready for next time.  I used the MOV set preset values, I used DIV for the calculations.  I used A CTR, preloaded it for the cycle count all fed into a TON. Seemed like the CTR preload didn't work, anyhow the Counter went negative, right away. It was preset, i had hoped, to a Tag that should have had the value of 4. Counter value went negative, PLC faulted. Production had to run again right away to I reverted to old program and that was it.

I am away from my laptop as well but, I was hoping maybe somebody might post a little code for this easy challenge for me.

There are three types of people in the world...

Those that can count and those who can't

 

Share this post


Link to post
Share on other sites

Make a PDF of the section of code you have tried and post it. It doesn't sound like it should be very many rungs. To get a negative preset you must have something basically wrong.

Share this post


Link to post
Share on other sites

I've attached copy of a program that has "something like" what you were trying to do. Look at the routine called meter fail

There are 3 meters. When flow is initiated (pump and valves) the timer preset is raised to the "establish flow rate". After the .DN bit for that timer trips it reduces the timer preset to 3s so as to "catch" when a meter fails to measure the flow rate correctly.

2 rungs per meter...

 

 

WestRanchRev2.ACD

Share this post


Link to post
Share on other sites

okay,

thanks guys, when I get back in the shop @wrk I'll post the PDF and have a look at the code that was sent, thanks!

Share this post


Link to post
Share on other sites

I don't see where you are moving anything to the Timer.PRE. The PDF doesn't look like it's a complete listing or what would accomplish what is described above. 

Share this post


Link to post
Share on other sites

Yeah I was trying to put the math result directly into POPDWN4_DLY.PRE then additionally I was trying to put POPDWN4_DLY.PRE into the (TON) Timer.PRE,  , then got String invalid

I think I am beginning to see the problem... I gotta mess going :-( Being new to 5000, is there like an emulator so I can test my code w/out hook'n to a processor?

"The Hurryier I go the behinder I get"  as they say,

Share this post


Link to post
Share on other sites

Ah. It's better to just write a DINT to the actual Timer.PRE. I used a One Shot before the MOV

I think there is an emulator. I've never used it so I'll have to defer to someone else. I usually have a station that's out of service that I can test code if I need to. Your situation is different than mine. Some of our stuff can be down for days so I can backup, play, download, escape :) 

Share this post


Link to post
Share on other sites

roger that

Thanks for all your help. yeah I have no escape, I gotta few spare PLCs hanging on the wall to test w/ but unfortunately this is a new one of a kind, its in a new machine.

If it were you where would you have originally posted this? Trying to learn the Forum Rules of the Road.

Is there a way to say/post I got my answer to properly 'close' the Topic?

Share this post


Link to post
Share on other sites
Just now, Kinzie said:

roger that

Thanks for all your help. yeah I have no escape, I gotta few spare PLCs hanging on the wall to test w/ but unfortunately this is a new one of a kind, its in a new machine.

If it were you where would you have originally posted this? Trying to learn the Forum Rules of the Road.

Is there a way to say/post I got my answer to properly 'close' the Topic?

I absolutely would have posted the question here. I've asked a ton of questions and been given a lot of help. One person can't know it all but collectively we can kick a problems a**. The hardest part is figuring out how to describe what you want to do to those of us that don't work in the machine industry. My stuff controls pumps and valves. It's pretty easy.

Hang in there. There are some very talented people on this forum.

Share this post


Link to post
Share on other sites

Yeah, that looks good. I have to take a closer look at when i get back in the shop.

It looks like it will work great and its short and simple.

Thank you!

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