Random Output

tawnyjets

Member
Join Date
Jan 2006
Location
North Carolina
Posts
2
I need to come up with a way to get a random output. This will be used at a security check pointe to randomly search people. We would have a input from metal detector and would like the PLC to randomly turn on a green or red light. We will be useing a micrologix 1000 controller and RSlogix 500 software. Any suggestions would be helpful.

Thanks,
Tim
 
One way to do this is to use the free-running clock to generate a new random number. As people will be moving at inexact intervals a simple algorithim can create an impossbile to predict random number.

In the attached file the bitwise NOT of the free running clock is placed in the 32 bit math register, then a double divide by 10 is performed. The remainder is now in S:13 and is between zero and nine. The quotient is discarded. One is added to the remainder to make it one to ten and the counter gets this as a new preset.
 
Last edited:
If this is a stop and search at something like an airport... random numbers between 1 and 10, as in... somewhere between, and including, the next 1st to the next 10th, would be unmanageable. The inspectors, and the inspection area, would be back-logged in no time!

How about something like... two clocks... one running at a normal rate (system clock), and one running at a variable-random rate?

The variable-random rate clock could change rates, at anytime, based on events... such as someone walking through the entry barrier. This would require a roll-yer-own clock with a specified-variable rate. The rate is likely to change... but maybe not. The rate would change, between 1 and 10, on any entry, based on Alaric's scheme. The variable-rate clock would be no slower than the real-rate clock.

This would produce two separate waves... one being a real-time based sine-wave, the other being a random-time based sine-wave. Where the random time-base is equal to, or greater than, the real time-base.

Then, when the milli-second (or second) values of each clock coincided, or were within a particular range of each other... that range possibly being defined, or random by the same method, then... on the next entry, no matter how long before that next entry, turn on the RED light for inspection. (Damn... I hate these inspections!)

Methods can be applied to allow for tuning the system to provide adequate strip-searching without overloading the inspection process room.

Don't forget to throw in a "random" setting that will allow an inspector to get a coke and a smoke, now and then.
 
Since only a binary output is desired, would something like this work??
random.jpg
 
Bruce,

Since randomly arranged people move at random speeds they provide the necessary randomness so that could work except for one thing: There is no uppper bound. That algorithim could conceivably let a thousand people through before selecting one.
 
Why not just make it appear to be random? Just make a fixed data table, maybe 100 values, with random numbers nubmers from Execl. Then use the values sequentually from the table.
 
The ML1K has a fixed data table size. N files may be 105 words long. It cannot be expanded. If the program has no other N word needs then that would work, though diligent surveillance would discover the repeating pattern.

Worse yet, on the ML1K, indirect addressing is not supported, so programming the slection of the next value will be a pain in the butt.


(in case you haven't noticed... I'm not a huge fan of the ML1K)
 
Last edited:

Similar Topics

Î
hi any one can tell me if its posible to program random output ? and how ? on ladder software. thanks
Replies
43
Views
12,962
Looking for some advice for backing up the programs on a bunch of old random PLCs. All I'm really concerned about is getting the program out of...
Replies
43
Views
4,709
We have several Powerflex 4M (22F-D013N114) VFD’s controlled by compactlogix PLC’s. Control is simple, a run and direction signal with the speed...
Replies
6
Views
1,524
Hi all, I know this is a PLC forum, but I know there is a gread deal of knowlege on drives as well. This drive has been running on stone...
Replies
2
Views
886
Hey folks, I was just wondering what thoughts were about a completely 100% random number generator. I looked on The Google but didn't really open...
Replies
54
Views
16,540
Back
Top Bottom