Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Relay Ladder logic Problem

  1. Mar 17, 2010 #1
    1. The problem statement, all variables and given/known data
    Ive been asked to create a roaming 7 day alarm for college. This alarm must trigger a lamp (output), after the input, which i am using to simulate an alarm, has been pressed 10 consecutive times in a 7 day period. if it is pressed less than 10 timesin a week, then any alarm that is older than 7 days must not be counted, but all other alarms that are younger than 7 days kept.

    I am using N/o, N/C contacts,as well as timers, (various types i.e. off delay, on pulse one shot etc) counters and counter resets and im getting absolutly nowhere.

    2. Relevant equations
    I am using the Zelio programme if any one is aware of this.
    I cannot use 7 day clocks or shift registers.

    3. The attempt at a solution

    i have tried to use timers to trigger off by a pulse, then count for 7 days, and if another pulse come in to trigger the next timer off, and so on for 10 timers, but i can seem to get it to work.

    Ive been at this for at least 10 hours oveer a 3 day period now, and im getting fustrated!!!

    Any help would be much appreciated.
     
  2. jcsd
  3. Mar 17, 2010 #2
    You need to know for each event how much time has passed since, or better how many time we have until expiry. This means as many counters.
    You need a logic to find a unused counter, and count them.

    However I would use a microcontroller for this type of task.
    An ATtiny comes to mind. It is packaged in SOT23-6 . Yes, 6 legs.
    Needs no extra circuitry for this task (other than a switch, the lamp, and e.g. a FET to drive the lamp).
    And it is dirt cheap. I would guess cheaper than the circuitry you would need for implement the logic.
     
    Last edited: Mar 17, 2010
  4. Mar 17, 2010 #3

    Filip Larsen

    User Avatar
    Gold Member

    Do you have up/down counters and if not what is the maximum up count?
     
  5. Mar 17, 2010 #4
    i have counters that can up count and down count, and also have resets for these(outputs).
     
  6. Mar 17, 2010 #5

    Filip Larsen

    User Avatar
    Gold Member

    I pretty much only know the theoretical basis of PLC and I surely do not know what you have already tried, but perhaps you are able to use parts of this idea:

    Counting input pulses and turning on the output after 10 with a counter is easy. The tricky part is directing each input pulse to a separate timer that after 7 days will count the counter down. One idea could be to have a 11 of what we could call timer blocks.

    Each timer block is associated with a logical 7 day timer (will come back to that) and one register bit indicating if the block is active. Each block has an input guard that only triggers if there is an input pulse and this block is inactive and the previous block is active, and as output it starts its 7-day timer and sets it active bit and resets the next timer block. The previous block for the first block should be the last block and the next block for the last block should be the first block so that the 11 blocks activate and reset each other in a cyclic manner. When the 7-day timer triggers, it result in count down of the event counter and a reset of this timer block. Initially all blocks are inactive and the first timer block should activate on the first input pulse, so you probably need some initialization or special bits to handle this situation.

    Each block then has a 7-day timer that is build from a counter that, when the timer block is active, count pulses from a single shared timer (or a timer with one or more counters if you have low word length) that act as clock sending out pulses, say, every hour. The limit of the timer block counter is set to make it trigger after 7 days (i.e. count 168 if your clock pulse is one hour). The timer block counter is reset when the block is reset.

    The idea of all that is to only remember the latest 10 input pulses and in case of "overflow" the latest pulse will just "overwrite" the 10th timer without making a count down of the counter. For this to work we also need to filter the input pulse counter to only count to 10 (it should only count up if alarm output is not on).

    Please note, that this is just "loose thoughts" that, even if it would work in principle, most likely require a lot more details in order to work as you like. Or maybe it would never work or has some serious flaw and make your PLC blow up. You have been warned :)
     
    Last edited: Mar 17, 2010
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook