Sign in to follow this  
Followers 0
TimWilborne

Random Number Generator

22 posts in this topic

I'm working on some training material and have a nice application for a random number generator. I'm now trying to figure out some real world applications for this. In my programs I'm always looking for predictable operations. What would be an application that would require this unpredictable operation? Thanks TW

Share this post


Link to post
Share on other sites
In-process automatic gages that I've done in the past are often required by the customer to have a built in GR&R study so the measuring capability could be verfified. The order of the measured parts is to be randomized hence a RNG comes in handy. Edited by jstolaruk

Share this post


Link to post
Share on other sites
I did a NASCAR pool thingy for work. That's the only time I've ever used a random number picky thingy. http://forums.mrplc.com/index.php?autocom=downloads&showfile=207 Check in the MACROS.

Share this post


Link to post
Share on other sites
see link to generate a random number http://computer.howstuffworks.com/question697.htm

Share this post


Link to post
Share on other sites
I already have random number generator code that works great. Someone asked for my Solitaire code I wrote for a Panelview and that made me think to include a random number generator as a training exercise. It is the same code and while I'm not doing the full blown Solitaire I'm going to do a simpler game. I just can't come up with real world applications for it. Jstolaruk's measuring verification is an example but is a bit more complex than what I'm looking for. I would have to write an entire chapter just to explain it's application. Picking Nascar numbers is about as close to real world as I can think of or using a PLC for a slot machine. Was just trying to find a simple need for this unpredictable application in our predictable control world Any other ideas? Thanks TW

Share this post


Link to post
Share on other sites
Well, this is not an industrial application, its one that I'm going to "commission" at our local sportsmens club and is pretty simple. The game of Trap uses a machine that throws clay targets in random directions. The shooter calls for the target and then the machine uses hydraulics to pivot back and forth between two limit switches for a random amount of time and ends in a new direction for the next shooter. These machines come with relay logic and their reliability is not as good as it should be so I was going to put a smart relay in it, like a ML1000 or Pico controller. I'll need to program a RNG to replace the random time device that is used now.

Share this post


Link to post
Share on other sites
Now that is a cool application

Share this post


Link to post
Share on other sites
you can use this code http://www.plctalk.net/qanda/attachment.ph...tachmentid=4974

Share this post


Link to post
Share on other sites
I have the code, it is easy. I wrote it 5 or so years ago. I'm trying to find real world applications that would use the code for a training manual Thanks TW

Share this post


Link to post
Share on other sites
How about generating industrial safety tips on the HMI? Kinda like the Windows 'Tip of the day' pop ups. Example: "Did you know.... XX out of XXX people lost a digit when reaching into a running industrial machine." Just a thought.

Share this post


Link to post
Share on other sites
Now that's an Idea! I like that.

Share this post


Link to post
Share on other sites
Good idea IO-Rack, thanks

Share this post


Link to post
Share on other sites
This question arose once before, and someone responded that they used random numbers in a waste processing plant to randomize the setpoint for a tank level to prevent the scum layer from building up in one spot on the tank wall. That was something I never would have thought of as a real industrial application for random numbers.

Share this post


Link to post
Share on other sites
I can't say more than what follows here TW, but a variant of Random Number Generator code is used in baggage selection when determining what to hand screen and what is auto screened.

Share this post


Link to post
Share on other sites
I use random numbers to generate noise on simulated feedback signals just so my PIDs work with something closer to real world when testing. I also round or quantize the feedback. I would also use random number generators to generate different size, color or shape of an object that must be sorted. For instance a lumber mill has a sorter that must sort different lengths, widths, thicknesses and grades. I think lumber sorters are excellent projects for advanced programmers but not for beginners.

Share this post


Link to post
Share on other sites
There's times I've been convinced that there's some kind of program determining which luggage gets delivered to the right airport at the right time, too!

Share this post


Link to post
Share on other sites
I think Jstolaruk and Peter both have excellent examples but I think all practible examples are too complicated for a basic trainer. I think I will just make this one a fun exercise at the end Thanks TW

Share this post


Link to post
Share on other sites
Have them make a roulette wheel.

Share this post


Link to post
Share on other sites
Those are the simple ones. For kicks one time I generated a sine wave and then used an FFT to determine te frequency. That was simple. Then I added noise the the sine wave and then used the FFT to determine if I could still pick out the signal. I could. I made the amplitude the of the noise MUCH bigger than the amplitude of the sine wave and I could still pick out the signal. I just just playing around. I wanted to know how space vehicles out beyond Mars could still send messages back to earth with just a small transmitter. Now I know. It can be done but there is a trade of with the data rate. I like to see how much noise I can generate on feedback and still calculate a good signal. The list goes on. I know this is too much for a PLC class but don't you ever wonder how they do that?. I do.

Share this post


Link to post
Share on other sites
Back on topic. Alaric's idea is good but too simple. How about playing black jack? The trick would be shuffling the cards. Craps would be much easier than black jack but still harder than a roulette wheel Keno would be a little harder than craps. Now TWControls has many options with varying degrees of difficulty.

Share this post


Link to post
Share on other sites
My trainer has 4 lights. Green, Red, Yellow, and blue. Remember the game Simon from back in the 80's? This is my random number generator. For those of you who don't remember it or are too young to have played the game I put it up on my wifes site Simon Game

Share this post


Link to post
Share on other sites
This subject that you're interested of is a part of information theory, more specifically channel coding, and the limit you're curious about is called the Shannon limit (after Claude Shannon, who found the theorem describing it). More information is available about the Shannon-Hartley theorem at Wikipedia.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0