Monitor Limit Switches to Index Count

I realize I'm a little late on this, but wanted you to have another example.

This has been tested!

It won't count half cycles, should you start in the middle of a cycle and you can adjust the number of cycles to run.

Have a great day.

ValveTest.jpg
 
Here are the fixes, plus a .RSS and .PDF of a working RSLogix version, with simulator.


Code:
...




I do not like my count-up solution; looking at damica1's solution, there is a better way:

  • On the rising edge of the Auto_Run, [Reset] a CW_Limit_Falling_Edge bit
    • I.e. [XIC Auto_RunONS.Q <Reset> CW_Limit_Falling_Edge]
  • Add an [XIO CW_Limit_Falling_Edge] branch around the [XIC CCW_Limit TON TON_1 ...] bits so CW_Control.0 will be 1 until the [XI0 CW_Limit] goes false (which could be on the first scan)
  • On the first falling edge of CW_Limit (or rising edge of [XIO CW_Limit], [Set] the CW_Limit_Falling_Edge bit
  • Only count CW_Limit rising edges, ignore CCW_Limit in the CTU, but
    • Inhibit the CTU while CW_Limit_Falling_Edge is 0
 
Code:
=======================================
On the rising edge of Auto_Run, [Reset]
CW_Limit_Falling bit that indicates the
valve has been to the CW limit
=======================================
                ____________
               [ AutoRunONS ]
 Auto_Run      [   R_TRIG   ]   CW_Limit_Falling
----] [--------[CLK        Q]--------(R)--------
               [____________]


======================================
Detect first falling edge of CW limit,
[Set] CW_Limit_Falling when it occurs
======================================
            _________________
           [ CWLimFallingONS ]
 CW_Limit  [     R_TRIG      ]   CW_Limit_Falling
---]/[-----CLK              Q]--------(S)--------
           [_________________]


===========================================
Start CW motion EITHER
- After holding at CCW_Limit for TON
    OR
- If CW_Limit falling edge has not occurred
    OR
- If CW motion has started, seal it in
CW limit event stops, or avoids, CW motion
===========================================
                             _______
                            [ TON_1 ]
 Auto_Run    CCW_Limit      [  TON  ]          CW_Limit   CW_Control.0
----] [---+-----] [---------[IN    Q]-------+-----]/[---+---( )-------
          |                 [       ]       |
          |                 [PT   ET]       |
          |                 [_______]       |
          |                                 |
          |     CW_Limit_Falling            |
          +----------]/[--------------------+
          |                                 |
          |     CW_Control.0                |
          +----------] [--------------------+


===============================================
Hold at CW_Limit for TON, then start CCW motion
- Also if CCW motion has started, seal it in
- CCW limit event stops CCW motion
===============================================
                                  _______
                                 [ TON_2 ]
 Auto_Run         CW_Limit       [  TON  ]       CCW_Limit  CCW_Control.0
----] [--------+-----] [---------[IN    Q]---+------]/[----------( )-----
               |                 [       ]   |
               |                 [PT   ET]   |
               |                 [_______]   |
               |                             |
               |  CCW_Control.0              |
               +-----] [---------------------+


==================================================
Count CW limit rising edges
- CW_Limit is counted only a CW limit falling edge 
==================================================
                                                          ____________
                              _______                    [ CycleCount ]
 CW_Limit  CW_Limit_Falling  [   >   ]                   [     CTU    ]  Auto_run
----] [---------] [----------[EN   o1]-------------------[CU         Q]-----{R)---
                             [       ]                   [            ]
               CycleCount.CV-[i1     ]      AutoRunONS.Q-[RESET     CV]
                             [       ]                   [            ]
                           0-[i2     ]                 N-[PV          ]
                             [_______]                   [____________]
 
Last edited:
Thanks so much everyone for your assistance! I was able to get the program working and my testing running. I've attached a PDF showing the wiring diagram I used in my application. I tried attaching my full program export (.ccwarc file in a zipped folder), but it's too large. If anyone needs/wants the program, shoot me a message and I'll get it to you.

Components used include -

  • Allen-Bradley 2080-LC20-20QBBR
  • Allen-Bradley 2080-PS120-240VAC
  • Allen-Bradley 2711R-T7T
  • SPDT Relay, 24vdc Coil
  • DPDT Relay, 24vdc Coil
  • Assured Automation EV3S3V9
 
I'm late on this, but is this a homework question or a work exercise?


if it's work, may I suggest that you use 3 counters
#1 - open limit switch occurances
#2 - open limit switch occurances
#3 - open and closed as you have it.
Why, what if one or both limit switches fail in the open / closed
position? will you then be able to count the cycles correctly?


I have built many cycle testers and you need to count each side and total cycles.


food for thought,
james
 
is this a homework question or a work exercise?
It's for work; I needed a quick program to work with a valve actuator, so I wrote the one that's been discussed. Ran into some trouble with it, so I came here to ask the guru's. Turns out to be a pretty simple exercise, so I could see how it would make a good homework assignment.


if it's work, may I suggest that you use 3 counters
#1 - open limit switch occurances
#2 - open limit switch occurances
#3 - open and closed as you have it.
Why, what if one or both limit switches fail in the open / closed
position? will you then be able to count the cycles correctly
This is phenomenal advice! With this current test, I'm only cycling the valve 35 times, so I'm typically standing right there watching it. But I could see myself using this program to cycle potentially several thousand times, something that takes a long time to complete. In that case, I will definitely keep this in mind.
 
Am I missing something here.... The OP wants to count complete cycles, and says he has the motor control working, but the count is not happening.

I would have thought it only necessary to count off ONLY ONE of the limit switches, and the CCW limit switch would indicate a complete cycle has been performed.

Methinks some people have over-complicated it...
 
Spot on Dabba, I thought that too, but then if the OP does not describe exactly what he wants then..... however, If he uses both limits to effectively drive the logic i.e. closed limit initiates open then when it reaches the open initiates the close sequence, if it fails to reach a limit then it will stop ? only other way to keep it going is ignore the limits, count the strokes & also count the limit trues.
So have three counts or even four although that does not quite make sense.
I think the replies so far has given the OP some food for thought though 👨🏻‍🏫👨🏻‍🏫
 
Spot on Dabba, I thought that too, but then if the OP does not describe exactly what he wants then..... however, If he uses both limits to effectively drive the logic i.e. closed limit initiates open then when it reaches the open initiates the close sequence, if it fails to reach a limit then it will stop ? only other way to keep it going is ignore the limits, count the strokes & also count the limit trues.
So have three counts or even four although that does not quite make sense.
I think the replies so far has given the OP some food for thought though 👨🏻‍🏫👨🏻‍🏫

The limit switches are controlling the motor direction adequately, ergo, reaching the CCW limit switch signifies a complete cycle has been performed. If either limit switch fails, the motor direction alternating will cease. If the alternating ceases, there's no point in counting anything.

IMHO the replies given may have confused the OP, and therefore most likely will be counter-productive to his needs.

He has already done the hard work, getting the motor to cycle, so now just needs to count the end of each, so just the CCW limit switch, simples....
 

Similar Topics

We have a quad monitor setup with FT SE and we are utilizing a header screen at the top of every display. when we open a new page we abort the...
Replies
0
Views
86
Our plant manger/my boss wants each line to display the takt time above the line. I am trying to research the cheapest way to do this. Our plant...
Replies
3
Views
179
Hi Folks, Looking for support and ideas. We are trying to go online to monitor/fault find on an S7-300 programmed with TIA Portal V15. I can...
Replies
9
Views
339
We finally replaced our Cognex Checker with an IV-3 and I'm wondering if can replace the s/w in the monitor with anything else. I haven't been...
Replies
0
Views
96
Im very new to programmin,but i was wanting to try and set up a program that could monitor the speed of a roller. Would it be possible to use the...
Replies
4
Views
150
Back
Top Bottom