Logix 500 Timer Question

Thughes

Lifetime Supporting Member
Join Date
Jul 2020
Location
Arkansas
Posts
6
I added T4:50 to delay the OTE from coming on, but the customer only wants T4:50 to delay the OTE every 12 hours. I am a beginner and can't figure out how to do it, any help would be greatly apprecitated.

Capture.PNG
 
I'm not sure I understand.




I think you seem to be saying that you want

  • a two-minute [T4:50] delay between
    • the [Lube System I:0.4 changing from 0 to 1] event
    • and [assigning 1 to O:0/0 via the OTE on rung 0000]
BUT
  • You don't want that [T4:50] delay to occur less than 12h after the last time that [T4:50] delay occurred.
So if that [T4:50] delay occurs at 8AM, then you don't want it to occur again before 8PM, even if [Lube System I:0.4] changes from 0 to 1 several times in between 8AM and 8PM.


Is that correct?
 
Assuming you can be off a second or two in you 12 hour time. You could set up a timer that had a preset of 3600 (1 hour) count the done bits and when you get to 12, enable your other logic. Afterwards reset timer and the count.
 
[Update: I forgot to put the [pXIC I:0/4] in series with the [LES ct12h 12] in that blue [OR] branch around the [XIC T4:50.DN] on the original rung 0000]
[Update II: fixed]




12h is 43,200s, which may be too big for the (assumed signed INT) .Pre of a timer with a 1s base time.


It will require a few new quantities (I will use tag-based names for them for clarity here; you will need to assign them to their proper file elements e.g. TON [TON1h] might become your [T4:51])

  • Timer TON1h
  • INT ct12h


I was not sure this approach would work,but since it is basically what Ken Moore suggested, it has a decent chance of being correct.


Caveats

  • There may still be some edge cases where it fails.
    • Specifically, the logic in front of the TON [TON1h] may not play well with the logic that assigns 0 to ct12h on the last rung
    • It may work better if that last rung is triggered on a one-shot of T4:50.DN
  • It feels more complex than necessary, but if nothing else it is a starting point.
Code:
########################################################################
### Assume PLC has been off for at least 12h:  set 12h counter to 12

  First Pass
   S:1/15          ______________
----] [-----------[MOV           ]----
                  [Source      12]
                  [Dest     ct12h]
                   --------------


########################################################################
### Modify Rung 0000 from post #0:  OR ct12h comparison with T4:50.DN (in blue)

  T4:23    I:1         I:0        B3:3        I:0          T4:50                          O:0
---] [-----] [----+----] [----+----] [----+---] [---+---+---] [---------------------+-----( )---
   DN       1059  |      8    |     10    |     4   |   |   DN                      |       0
                  |           |           |         |   |                           |
                  |   B3:7    |           |  B3:6   |   [COLOR=Blue][B]|   I:0    ______________   |[/B][/COLOR]
                  +----] [----+           +---] [---+   [COLOR=blue][B]+---] [---[LES           ]--+[/B][/COLOR]
                         4                      8           [COLOR=Blue][B]  4   [SourceA  ct12h][/B][/COLOR]
                                                                  [COLOR=blue][B][SourceB     12][/B][/COLOR]
[COLOR=blue][B]                                                                   --------------[/B][/COLOR]


########################################################################
### No change to Rung 0001 from post #0

   I:0                  ______________
---] [-----------------[TON           ]--(EN)--
     4                 [Timer    T4:50]
                       [Time Base  1.0]--(DN)--
                       [Preset     120]
                        --------------


########################################################################
### Start a 1h (=3600s), repeating, self-sealing, timer [TON1h] when
### - ct12h is 0
### AND
### - T4:50 is done
### Repeat until 12h have elapsed

      T4:50        ______________            ______________      TON1h      ________________
---+----] [-------[EQ            ]-------+--[LES           ]------]/[------[TON             ]--(EN)--
   |    DN        [SourceA  ct12h]       |  [SourceA  ct12h]      DN       [Timer      TON1h]
   |              [SourceB      0]       |  [SourceB     12]               [Time base    1.0]--(DN)--
   |               --------------        |   --------------                [Preset      3600]
   |  ______________    ______________   |                                  ----------------
   +-[GRT           ]--[LES           ]--+
   | [SourceA  ct12h]  [SourceA  ct12h]  |
   | [SourceB      0]  [SourceB     12]  |
   |  --------------    --------------   |
   |                                     |
   |   TON1h                             |
   +----] [------------------------------+
        DN


########################################################################
### When [T1h.DN] becomes 1, increment ct12h up to 12

     ______________          TON1h        ______________
----[LES           ]----------] [--------[ADD           ]--------------
    [SourceA  ct12h]          DN         [SourceA  ct12h]
    [SourceB     12]                     [SourceB      1]
     --------------                      [Dest     ct12h]
                                          --------------


########################################################################
### Restart 12h counter, from 12, when 2minute delay (T4:50] is done

       T4:50       ______________            _____________
--------] [-------[EQ            ]----------[MOV          ]---
        DN        [SourceA  ct12h]          [Source      0]
                  [SourceB     12]          [Dest    ct12h]
                   --------------            -------------

xxx.png
 
Last edited:
Corrected in blue a typo below: the seal-in branch at the start of the TON instruction for Timer TON1h should be TON1h.TT, not TON1h.DN.


Update: the first [LES ct12h 12] in the initial middle branch of the rung with the TON1h TON instruction is redundant with the instruction following the branch.




Code:
...


########################################################################
### Start a 1h (=3600s), repeating, self-sealing, timer [TON1h] when
### - ct12h is 0
### AND
### - T4:50 is done
### Repeat until 12h have elapsed

      T4:50        ______________            ______________      TON1h      ________________
---+----] [-------[EQ            ]-------+--[LES           ]------]/[------[TON             ]--(EN)--
   |    DN        [SourceA  ct12h]       |  [SourceA  ct12h]      DN       [Timer      TON1h]
   |              [SourceB      0]       |  [SourceB     12]               [Time base    1.0]--(DN)--
   |               --------------        |   --------------                [Preset      3600]
[B][COLOR=Blue]   |  ______________                     |                                 [/COLOR][/B] ----------------[B][COLOR=Blue]
   +-[GRT           ]--------------------+
   | [SourceA  ct12h]                    |
   | [SourceB      0]                    |
   |  --------------                     |[/COLOR][/B]
   |                                     |
   |   TON1h                             |
   +----] [------------------------------+
         TT




...
 
 

########################################################################
### Start a 1h (=3600s), repeating, self-sealing, timer [TON1h] when
### - ct12h is 0
### AND
### - T4:50 is done
### Repeat until 12h have elapsed

      T4:50        ______________            ______________      TON1h      ________________
---+----] [-------[EQ            ]-------+--[LES           ]------]/[------[TON             ]--(EN)--
   |    DN        [SourceA  ct12h]       |  [SourceA  ct12h]      DN       [Timer      TON1h]
   |              [SourceB      0]       |  [SourceB     12]               [Time base    1.0]--(DN)--
   |               --------------        |   --------------                [Preset      3600]
   |  ______________    ______________   |                                  ----------------
   +-[GRT           ]--[LES           ]--+
   | [SourceA  ct12h]  [SourceA  ct12h]  |
   | [SourceB      0]  [SourceB     12]  |
   |  --------------    --------------   |
   |                                     |
[COLOR=Blue][B]   |   TON1h                             |[/B][/COLOR]
[B][COLOR=Blue]   +----] [------------------------------+
        TT[/COLOR][/B]

...
 
Last edited:
And here is an alternate approach, using a CTU; it's a bit cleaner because [XIC CTL12.DN] replaces [EQ ctl12h 12].


That said, and with the caveat that I know nothing about your process, I noticed that the two-minute [T4:50] delay was from [Lube Stream I:0/4] going to 1 and output [O:0/0]. If this is delaying the start of a motor and its driven rotating machinery until a lube stream has been running for two minutes, then you should be very careful about implementing this change. In fact, even using a delay for such a purpose could be risky. It would be much better to monitor the pressure of the lubricating fluid and not starting until that pressure reached the level where it lifts the shaft off the bearing (or journal or whatever). It might also be advisable to ensure the lube pressure transitions from a low value to a high value when [Lube Stream I:4/0] becomes 1, so that a faulty pressure sensor (if not two parallel pressure sensors) doesn't indicate a false high pressure and fool the system into starting up.


Unless some number of two-minute delays are more costly than an the downtime it takes to replace a ruined bearing, I would be very careful about implementing this change. For example, in a large ball mill a ruined bearing could cost millions of dollars, and even without inhibiting the delay, using a delay to ensure lubrication is not a good practice.


Again, I don't know your process, so I provide this sample code as-is and as my best effort to answer simply the question of your original post, and leave it to your organization to evaluate whether it is advisable to use it or anything like it.





Code:
########################################################################
### Assume PLC has been off for at least 12h:  set 12h counter to 12
### - This should force two-minute delay on next time I:0/4 is 1
### - N.B. can MOV write to counter Control .ACCumulator element?
###        - If not, replace this [First Scan] rung with a RESet and a
###          loop to increment CTL12.ACC to 12 manually

  First Scan
   S:1/15          __________________
----] [-----------[MOV              ]----
                  [Source         12]
                  [Dest    CTL12.ACC]
                   -----------------


########################################################################
### Modify Rung 0000 from post #0:
### - Add OR branch [XIC I:0/4 XIO CTL12.DN] to T4:50.DN
###   - This will bypass delay for 12h since last delay rising edge

  T4:23    I:1         I:0        B3:3        I:0          T4:50                O:0
---] [-----] [----+----] [----+----] [----+---] [---+---+---] [-----------+-----( )---
   DN       1059  |      8    |     10    |     4   |   |   DN            |       0
                  |           |           |         |   |                 |
                  |   B3:7    |           |  B3:6   |   |   I:0    CTL12  |
                  +----] [----+           +---] [---+   +---] [-----]/[---+
                        4                      8              4     DN


########################################################################
### Two-minute delay of [I:0/4]; no change to Rung 0001 from post #0

   I:0                  ______________
---] [-----------------[TON           ]--(EN)--
     4                 [Timer    T4:50]
                       [Time Base  1.0]--(DN)--
                       [Preset     120]
                        --------------


########################################################################
### Save one-shot rising edge of 2-minute delay done bit

       T4:50       _____________________
--------] [-------[OSR                  ]------
        DN        [Storage bit    B?:?/?]
                  [Output bit   DelayOSR]
                   ---------------------


########################################################################
### Start a 1h (=3600s), repeating, self-sealing, timer [TON1h] on
### - [XIC DelayOSR EQU CTL12.ACC 0] => first delay after CTL12 reset
### - [XIC TON1h.TT] seals-in running timer to complete first 1h cycle
### - [GRT CTL12.ACC 0] start repeat each of next 11 cycles
### - [XIO TON1h.DN] resets timer at end of each cycle
### - [XIO CTL12.DN] stops repeat after 12th cycle
### - TON1h.DN rising edge will increment CTL12.ACC
###   - N.B. [EQU CTL12.ACC 0] may not be necessary

      DelayOSR     __________________        TON1h       CTL12      ________________
---+----] [-------[EQU               ]---+----]/[---------]/[------[TON             ]--(EN)--
   |              [SourceA  CTL12.ACC]   |    DN          DN       [Timer      TON1h]
   |              [SourceB          0]   |                         [Time base    1.0]--(DN)--
   |               ------------------    |                         [Preset      3600]
   |                                     |                          ----------------
   |   TON1h                             |
   +----] [------------------------------+
   |    TT                               |
   |                                     |
   |    __________________               |
   +---[GRT               ]--------------+
       [SourceA  CTL12.ACC]
       [SourceB          0]
        ------------------


########################################################################
### [TON1h.DN] rising edge increments counter up to 12 (CTL12.ACC),
### indicating approximately 12h have passed since last delay OSR

     TON1h        ______________
------] [--------[CTU           ]---(CU)---
      DN         [Counter  CTL12]
                 [Preset      12]---(DN)---
                 [Accum        0]
                  --------------


########################################################################
### Reset CTL12 counter, when complete & delay has rising edge

       CTL12   DelayOSR             CTL12
--------] [-------] [---------------[RES]------
        DN
 
This. KISS




Yes, my implementation added 18 rungs, which seems like too many for KISS, but almost half of those are getting around the [12h = 43,400s > maximum INT (32,767) for TON Preset] issue.


Also, I think my last rung, the counter reset, should move up two rungs, to just after the OSR instruction.


Oh dear, I just found another problem with my code: if the [Lube Stream I:04] becomes 1 at 11h59m after the 12h timer/counter process started, the order of events will be

  1. 11:59 [output O:0/0] will become 1 (on)
  2. 11:59 [T4:50] delay timer will start
  3. 12:00 [CTL12.DN] will become 1 as 12h counter completes
  4. 12:00 [output O:0/0] will become 0 (off)
  5. 12:01 [T4:50.DN] will become 1 as delay timer completes
  6. 12:01 [output O:0/0[ will become 1 (on)
Doggone edge cases ... the fix is a seal-in using [O:0/0] around the [XIO CTL12.DN] (in blue below)


So it's now 19 instructions to add the OP's requested behavior, but this kind of creep makes me think this approach is not KISS.



Code:
########################################################################
### Assume PLC has been off for at least 12h:  set 12h counter to 12
### - This should force two-minute delay on next time I:0/4 is 1
### - N.B. can MOV write to counter Control .ACCumulator element?
###        - If not, replace this [First Scan] rung with a RESet and a
###          loop to increment CTL12.ACC to 12 manually

  First Scan
   S:1/15          __________________
----] [-----------[MOV              ]----
                  [Source         12]
                  [Dest    CTL12.ACC]
                   -----------------


########################################################################
### Modify Rung 0000 from post #0:
### - Add OR branch [XIC I:0/4 XIO CTL12.DN] to T4:50.DN
###   - This will bypass delay for 12h since last delay rising edge

  T4:23    I:1         I:0        B3:3        I:0          T4:50                   O:0
---] [-----] [----+----] [----+----] [----+---] [---+---+---] [--------------+-----( )---
   DN       1059  |      8    |     10    |     4   |   |   DN               |       0
                  |           |           |         |   |                    |
                  |   B3:7    |           |  B3:6   |   |   I:0     CTL12    |
                  +----] [----+           +---] [---+   +---] [--+---]/[---+-+
                        4                      8              4  |   DN    |
                                                                 [COLOR=Blue][B]|         |
                                                                 |   O:0   |
                                                                 +---] [---+
                                                                       0
[/B][/COLOR]

########################################################################
### Two-minute delay of [I:0/4]; no change to Rung 0001 from post #0

   I:0                  ______________
---] [-----------------[TON           ]--(EN)--
     4                 [Timer    T4:50]
                       [Time Base  1.0]--(DN)--
                       [Preset     120]
                        --------------


########################################################################
### Save one-shot rising edge of 2-minute delay done bit

       T4:50       _____________________
--------] [-------[OSR                  ]------
        DN        [Storage bit    B?:?/?]
                  [Output bit   DelayOSR]
                   ---------------------


########################################################################
### Reset CTL12 counter, when complete & delay has rising edge

       CTL12   DelayOSR             CTL12
--------] [-------] [---------------[RES]------
        DN


########################################################################
### Start a 1h (=3600s), repeating, self-sealing, timer [TON1h]
### - [XIC DelayOSR EQU CTL12.ACC 0] => first delay after CTL12 reset
### - [XIC TON1h.TT] seals-in running timer to complete first 1h cycle
### - [GRT CTL12.ACC 0] start repeat each of next 11 cycles
### - [XIO TON1h.DN] resets timer at end of each cycle
### - [XIO CTL12.DN] stops repeat after 12th cycle
### - TON1h.DN rising edge will increment CTL12.ACC
###   - N.B. [EQU CTL12.ACC 0] on first branch may not be necessary

      DelayOSR     __________________        TON1h       CTL12      ________________
---+----] [-------[EQU               ]---+----]/[---------]/[------[TON             ]--(EN)--
   |              [SourceA  CTL12.ACC]   |    DN          DN       [Timer      TON1h]
   |              [SourceB          0]   |                         [Time base    1.0]--(DN)--
   |               ------------------    |                         [Preset      3600]
   |                                     |                          ----------------
   |   TON1h                             |
   +----] [------------------------------+
   |    TT                               |
   |                                     |
   |    __________________               |
   +---[GRT               ]--------------+
       [SourceA  CTL12.ACC]
       [SourceB          0]
        ------------------


########################################################################
### [TON1h.DN] rising edge increments counter up to 12 (CTL12.ACC),
### indicating approximately 12h have passed since last delay OSR

     TON1h        ______________
------] [--------[CTU           ]---(CU)---
      DN         [Counter  CTL12]
                 [Preset      12]---(DN)---
                 [Accum        0]
                  --------------
 
Last edited:
One more approach

  • Use RTC:0.HR to "measure" 12h
    • but it is approximate: the period during which the two-minute delay is disabled can range from 11h to 13h.
  • Adds 15 instructions, which still feels like a lot
    • But only three rungs
      • One for First Scan
      • One to latch BypassDelay
      • One to unlatch BypassDelay

Code:
########################################################################
### On first scan, unlatch Bypass Delay, which enables two-minute delay

  First Scan
   S:1/15     BypassDelay
----] [-----------(U)-----------


########################################################################
### Modify Rung 0000 from post #0:
### - Branch [XIC I:0/4 [XIC BypassDelay OR XIC O:0/0] around T4:50.DN
###   - This will bypass delay for 12h since last delay rising edge

  T4:23    I:1         I:0        B3:3        I:0          T4:50                      O:0
---] [-----] [----+----] [----+----] [----+---] [---+---+---] [-----------------+-----( )---
   DN       1059  |      8    |     10    |     4   |   |   DN                  |       0
                  |           |           |         |   |                       |
                  |   B3:7    |           |  B3:6   |   |   I:0    BypassDelay  |
                  +----] [----+           +---] [---+   +---] [--+----] [---+---+
                        4                      8              4  |          |
                                                                 |    O:0   |
                                                                 +----] [---+
                                                                       0


########################################################################
### Two-minute delay of [I:0/4]; no change to Rung 0001 from post #0

   I:0                  ______________
---] [-----------------[TON           ]--(EN)--
     4                 [Timer    T4:50]
                       [Time Base  1.0]--(DN)--
                       [Preset     120]
                        --------------


########################################################################
### When BypassDelay is off & delay has rising edge
### - Latch BypassDelay, which will bypass two-minute delay
### - Set the Fin12h value 12h hence, when BypassDelay will be unlatched
### - DlyStore ensures the above occurs on T4:50.DN rising edge only

      T4:50     DlyStore  BypassDelay            BypassDelay
-------] [---+----]/[--------]/[-------+-------------(L)---------------------------+---
        DN   |                         |    _________________                      |
             |                         +---[ADD              ]---------------------+
             |                         |   [SourceA  RTC:0.HR]                     |
             |                         |   [SourceB        12]                     |
             |                         |   [Dest       Fin12h]                     |
             |                         |    -----------------                      |
             |                         |    _______________     _______________    |
             |                         +---[GRT            ]---[SUB            ]---+
             |                             [SourceA  Fin12h]   [SourceA  Fin12h]   |
             |                             [SourceB      23]   [SourceB      24]   |
             |                              ---------------     ---------------    |
             |                                                                     |
             |  DlyStore                                                           |
             +----( )--------------------------------------------------------------+


########################################################################
### Unlatch BypassDelay when ~12h have passed since last used delay

    _________________      BypassDelay
---[EQU              ]---------(U)------
   [SourceA  RTC:0.HR]
   [SourceB    Fin12h]
    -----------------
 
Last edited:
The lube system is for a cone crusher, there are pressure transmitter's on the lube system that indicate flow/pressure. The customer had a cone at another facility have a catastrophic failure because someone jumped out the safety circuit and they wanted the two minute timer to allow for extra circulation of the lube system. I told them that it didn't really matter because the pressure transmitter is what they need to pay attention to. I am sure the transmitter is in the logic as an enable but I can't really tell because nothing is tagged in the logic.
 
... I am sure the transmitter is in the logic as an enable but I can't really tell because nothing is tagged in the logic.


Thanks for the explanation; so I:0/4 would not be 1 until there is adequate pressure in the lube system to ensure flow, valves are open, etc. Nice.


Someone jumped out the safety circuit at another site? Ouch!
 

Similar Topics

Why is it that I Can't drag Done bits from timer, when I can drag Bit values into an instruction?
Replies
6
Views
2,379
Hello friends! Might someone be able to give me a brief explanation of the differences between the .TT (Timer Timing) bit and the .EN (Enabled)...
Replies
2
Views
1,864
I ran across something new today. Tried to change the timer preset on T10:21 but it would change back. Found that the preset was set by N124:23. I...
Replies
6
Views
3,553
Hello my name is Dorrance I am very new to plc programming. I am capable to make simple programs like inputs that trigger outputs but never worked...
Replies
11
Views
3,830
How do I get the timer to trip a relay using the ACC instruction. I am using a CTU and a CTD Both are C5:1. I used an examine if closed with...
Replies
4
Views
2,090
Back
Top Bottom