Sign in to follow this  
Followers 0
bearsgone

Start timer or counter every day at specific time

14 posts in this topic

Was wondering if anybody can give me a hint on how to go about creating, timer?, that will run another timer or counter say every day at 10am. Not sure if system date and time can be used for this? If anybody has basic code sample that would be huge help as well Thanks in advance

Share this post


Link to post
Share on other sites
Compare system time to the time desired. When they are equal starrt your timer or counter. Seriously, to get any more specific we need to know the precise system.

Share this post


Link to post
Share on other sites
I have Micrologix 1400. The logic would be to turn a pump on at 10am every day. As soon as pump goes on, I have AI from a flow meter that should kill the pump as soon as 500 gal accumulated. Thank you

Share this post


Link to post
Share on other sites
You can use the RTC (Real Time Clock) function. Do an EQU statement. If RTC:0.HR = 10, then turn on another bit to turn on the pump. If you double click the function files on the left hand side of RsLogix 500, then click the rtc tab, then right click on the one you want and copy, it will tell you what the time and date addresses are. Rude and crude, but you will get the idea.

Share this post


Link to post
Share on other sites
You also need to consider how long the timer is going to be and when it will be triggered. If you want the timer to trigger at exactly 10:00:00 AM with no other qualifying logic and it is less than an hour long, then a single EQU statement for RTC:0.HR=10 will be sufficient (Rung 0). The rung will be true for the entire 10AM hour, allowing the timer to complete and then set the DN bit. If the timer is longer than an hour, then you will also need to put the timer's TT bit on a branch to keep the timer true until it finishes (Rung 1). If you have other qualifying logic on the rung, then you may run into a condition where the timer can re-trigger during the 10AM hour. To prevent this, you add another EQU statement for RTC:0.MIN=0 so the timer can only trigger during the first minute of the 10AM hour. To further refine it, you can add a third EQU statement for RTC:0.SEC, so it will only trigger during the first second of the first minute of 10AM. To keep the rung true, you will need the TT bit on a parallel branch (Rung 2). If you want to take this to the extreme, then you can use just the first EQU for RTC:0.HR=10 and a ONS instruction to turn on a bit. On the next rung, the bit will trigger the timer. With this logic, the rung will only be true for the first scan of the 10AM hour. To keep the run true to continue the timer execution, you put the timer's TT bit on a parallel branch (Rung 3). This logic was written for a ML1100 not a ML1400, but for this example, the two are the same. Timer_Example_Logic.pdf ~Jeff Edited by JStevens

Share this post


Link to post
Share on other sites
Because all he said he wanted to do was at 10AM turn a pump on. The pump then fills a container until the analog input says it is full. So he really doesn't want a timer. He just wants a start/stop circuit. Try this on for size. Unless I missed something. Pump.pdf

Share this post


Link to post
Share on other sites
This. You make the conditions of the rung true when your Real Timeclock is at 10am (does 1400 have an instruction for this or does he need to use the S file hours/minutes, and maybe a ONS?). Once that's true, you latch in your conditions with the pump running bit NO, with an NC contact to de-activate once the level (AI) is GEQ (greater or equal) to what your desired. Be sure to use GEQ and not EQU, because if you skip data on the AI you'll never turn off the pump. --------------|time|----------------------------------------------(pump)------------------------ | | | --------------|pump|------|GEQ |-------------| Edited by IamJon

Share this post


Link to post
Share on other sites
I missed that requirement that it pumps 500 gal and then turns off. This makes more sense and is easier to implement. I actually think he would want to use a LES, not a GEQ, because he wants the pump to run until it reaches 500. If you use a GEQ, the pump won't stay running until it reaches 500+ gallons. Try this: Pump_Start_Logic.pdf At 10:00:00AM, the first (top) branch becomes true and starts the pump. It will remain true for 1 second. After the first scan which turned on the pump, the second branch will remain true until the total flow reaches 500. This method assumes that your total flow is stored in a floating point elsewhere and is reset every time the flow is equal to or exceeds 500. The total flow must be calculated elsewhere. Most flow meters I have encountered only tell you the instantaneous flow at that point in time and you have to use a totalizer to find the total flow, but I don't know what you intend to use. ~Jeff Edited by JStevens

Share this post


Link to post
Share on other sites
Yes, you're right about the LES. I was going to put a GEQ command to a coil and use the NC contact, and forgot to reverse the GEQ when I did Edited by IamJon

Share this post


Link to post
Share on other sites
Thank you for your help JStevens. What if I want to allow a user have the ability to increase 500 to 1000 and not higher. If I hardcore 500 into CEQ, a user wont be able to modify it from HMI, is it correct?

Share this post


Link to post
Share on other sites
Correct, if you use immediate addressing (i.e., placing "500" in the instruction itself). You can use an integer or another floating point address as the comparison and then store the number of gallons in that address. Then they can adjust that through the HMI. ~Jeff

Share this post


Link to post
Share on other sites
Then do a compare on what they enter. If it is greater than 1000, then do a move instruction and move 1000 into the register. Less than 500, move 500 into the register. Actually, you might be able to do this with a LMT, or limit instruction...

Share this post


Link to post
Share on other sites
Hello Thank you all for your feedback. I have a pump that is running 24/7. it should stop at certain time, switch valve, turn the pump on for 500 gallons, stop the pump, valve goes to default position, restart the pump. How can I improve/shorten my Rungs? Thank you for any pointers.

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