Author Topic: random behavior desired  (Read 12505 times)

Gizmobreaker

  • Newbie
  • Posts: 2
    • View Profile
random behavior desired
« on: February 19, 2007, 06:48:09 AM »
I am using a T40H-Relay controller.  I chose it because the relays are on the card and I have very limited space.  The first 12 relays control lights and 15 + 16 control an MP-3 player.  The lights turn on in 1 second steps according to a plan from the artist.

The timing chart looks like this (summarized):
60 seconds of 1 second light displays
60 seconds of lights 11+12 on steady
3 minutes of music
60 seconds of lights 11+12 on steady
go back to the start

Since the 60 steps of lights 1-10 are pre-programmed, the artist would like to re-enter the list at a random point each cycle to avoid the lights looking like they are repeating.  So if I start on step 1 the first time, I would like to start on step 7 the second time, or something like that, then loop through the steps.

If I was using a more complex language, I could generate a random number and use math to control the steps.  In the past I have used IDEC's PLCs to do that, but they are too big for this project.

Thanks for any help,
Marty

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:random behavior desired
« Reply #1 on: February 19, 2007, 07:02:26 AM »
H-series PLC like the T40H-Relay doesn't support random number generation. One possibility may be to use a second Sequencer triggered by a 0.1s clock pulse which moves from one step to another. When the artist press a button connected to the digital input it will use the 2nd sequencer's step to [STEPN] the first sequencer so that it set the first sequencer at a random step depending on when the artist press the button. This should work for this application.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Gizmobreaker

  • Newbie
  • Posts: 2
    • View Profile
Re:random behavior desired
« Reply #2 on: February 19, 2007, 09:58:14 AM »
Since the PLC will run unattended, all day, I am thinking that perhaps the best way might be to create several (depending on how many programming steps it takes) lists of steps and use a sequence counter as an input.  That way if the sequence value is 1 then it will run the first list, if the value is 2 then it will run the second list, and so on.  Lots of keyboard time to get it done, but I cannot think of another way to vary the procedure from run to run.

Along those lines, the program length limit is 400 steps, I believe.  Does that include ladder rungs used only for comments?  Is it a count of rungs or lines?  In InstallationT40.pdf I see that a step is roughly equal to a NO or NC contact.  Does that mean that if there are 4 NO contacts on a ladder line, it uses 4 steps?

Thanks again,
Marty

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:random behavior desired
« Reply #3 on: February 20, 2007, 04:47:18 AM »
Yes, each contact uses 1 step and a timer or counter coil uses two steps. There is a 400 steps limit for standard T40H-Relay. There is another PLC model T40Hplus-Relay which has 800 steps and that is already the absolute maximum number of steps. To implement what you want to do by "brute force" it may take up a lot of memory.

Note that since there are only a maximum of 8 sequencer you may have a problem achieving not more than 8 diferent list.

A T100MD888+ PLC with EXP1616R gives you 24 digital inputs, 16 relay outputs and 8 transistor outputs. There are a maximum of 6016 words (steps) and the programming language is far more flexible so you  may be able to create more "random" looking light shows. E.g. you could store the bit pattern in different data memory locations and use the bit patterns to generate the actual output sequences on the 16 outputs.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS