Is there or should there be a RND instruction

Using a Counter to SHIFT patterns??

Goody,
I have recently done a project that required the starting of Chiller System units in random order (with each unit operating independently and each being assigned a specific number). I used an AB Compute instruction to create a truth table (I suggest you use the dye cycle events as the conditions). I then created an equation that would generate a different output each time ------------------------------>
[{A*(-B)}+{(B^2)*(-1)}]*C^2
In this way you can create two truth tables of fairly small size and have different outputs depending on operator inputs. You can change the math to fit your process or just associate the output to different dye lenghts. You can associated the value of the output with an integer address using an EQU instruction. You can then use MOV instructions to to manipulate the data. I am attaching my original excel sheet with example.
 
Just a quick note;

Allen Nelson wrote
Isn't the term for that "stripy" color OMBRE?

From the Oxford English Dictionary;

Etymology: French, past participle of ombrer to shade, from Italian ombrare, from ombra shade, from Latin umbra -- more at UMBRAGE
Date: 1893
: having colors or tones that shade into each other -- used especially of fabrics in which the color is graduated from light to dark
- ombré noun


Now I know for sure that I am in the presence of masters.

(Not getting into a game of scrabble with him)
 
I Forgot To Mention..................

Goody,
I forgot to add (I got interrupted)that utilizing a counter (create a bit off the dye cycle being done) and assumming that you have 6 cycles, use and up-counter with a Preset of 5 (reset with the done bit) and an EQU instruction where 0=1st Dye Cycle and 5=6th Dye Cycle to move the random patterns through the program. Sorry that I neglected to include in the previous message.
 
Thanks wil, I dowloaded your chart and it did not make any sense to me. Now perhaps it will. I am looking into all the options of randomness. Once I have decided and got it working ok, it will be saved for future use, maybe labelled 'RND'
 
Nothing to take UMBRAGE at

Goody said:
Now I know for sure that I am in the presence of masters.

(Not getting into a game of scrabble with him)

Not that big of a deal. My wife knits and crochets. When in yarn stores - I ask questions.

You never know when some piece of trivia is actualy going to be useful.

I've seen one person land a contract, just because they knew that a TROUGH (in the baking industry) is pronouced TRO (long 'O'), not TROFF (what cattle eat out of).

Next time you're with the customer, call the yarn 'ombre' instead of 'stripe-y' and see what happens.
 
Explanation Of "The Chart"....................

Goody,
Sorry not to explain the chart, but the columns (from left to right) represent the 1st, 2nd, and 3rd integers entered into the program (or A, B, and C). Substitue these numbers into the equation that I sent and the VARIABLE column represents the results. I originally put this all in an excel spreadsheet that shows all of the calculations (I can e-mail the spreadsheet to you if you want it). The four columns off on the far right are just calculations used in Excel to get my final variable.
 
Random Output for Mitsubishi From Basic

Used for generating random cycles on a Mitsubishi FX0 and FX1N
A program does not need to be in the plc to control the plc.
RAN:
CLS
DO
CLOSE #1
OPEN "COM1:9600,E,7,1,CD0,CS0,DS0,OP0,TB2048,RB2048" FOR RANDOM AS #1
'*******************************
'***RANDOM NUMBERS GENERATORS***
'*******************************
Y = INT(RND * 8)
DELAY1 = INT(RND * 31)
DELAY2 = INT(RND * 31)
RNDLOOPS = INT(RND * 11)
'PRINT Y
'PRINT DELAY1
'PRINT DELAY2
'PRINT RNDLOOPS
FOR LPS = 0 TO RNDLOOPS
'Y0-Y7 FORCE ON
IF Y = 0 THEN ADDR$ = "0005": SUMCK$ = "FF"
IF Y = 1 THEN ADDR$ = "0105": SUMCK$ = "00"
IF Y = 2 THEN ADDR$ = "0205": SUMCK$ = "01"
IF Y = 3 THEN ADDR$ = "0305": SUMCK$ = "02"
IF Y = 4 THEN ADDR$ = "0405": SUMCK$ = "03"
IF Y = 5 THEN ADDR$ = "0505": SUMCK$ = "04"
IF Y = 6 THEN ADDR$ = "0605": SUMCK$ = "05"
IF Y = 7 THEN ADDR$ = "0705": SUMCK$ = "06"
CMD$ = "7"
LOCATE 3, 28: PRINT " Activating Y"; : PRINT Y
FOR PRESS = 1 TO 2
PRINT #1, CHR$(2); CMD$; ADDR$; CHR$(3); SUMCK$
NEXT PRESS
CLOSE #1
OPEN "COM1:9600,E,7,1,CD0,CS0,DS0,OP0,TB2048,RB2048" FOR RANDOM AS #1
'Y0-Y7 FORCE OFF
IF Y = 0 THEN ADDR$ = "0005": SUMCK$ = "00"
IF Y = 1 THEN ADDR$ = "0105": SUMCK$ = "01"
IF Y = 2 THEN ADDR$ = "0205": SUMCK$ = "02"
IF Y = 3 THEN ADDR$ = "0305": SUMCK$ = "03"
IF Y = 4 THEN ADDR$ = "0405": SUMCK$ = "04"
IF Y = 5 THEN ADDR$ = "0505": SUMCK$ = "05"
IF Y = 6 THEN ADDR$ = "0605": SUMCK$ = "06"
IF Y = 7 THEN ADDR$ = "0705": SUMCK$ = "07"
CMD$ = "8"
FOR PRESS = 1 TO 2
PRINT #1, CHR$(2); CMD$; ADDR$; CHR$(3); SUMCK$
NEXT PRESS
NEXT LPS
CLS
LOOP
 
It's been ages, but didn't the Square D Symax 400/600 have a math function for generating a random number? Truly there was a calculation to it so it is not really random, but it was one instrucion that generated a random number.

OG
 
If you have the real time clock function ,
FX1N etc....
you can used the data from the seconds register
(D8013) to truly acheive some sort of random
number generator.
The high speed timers may be utilized for faster durations.

ladder00.jpg
 
Last edited:
OK, my head is not working due to a beauty of a head cold, so forgive me if this doesn't make sense...

My reading of the problem is that Goody does not necessarily need a purely random number, but rather a number sequence that does not repeat, at least in any noticeable time frame. By this I mean that it would be acceptable to have the digit 4 used twice in a row, but not every other time.

My memory of my math in school has some recollection that there are certain "constants" such as the much beloved Pi that are infinitely long, non-repeating numbers. I believe that Pi has been calculated to about 4 billion characters so far, with no repeating or ending...

Now I would hazard a guess that a basic PLC would not be able to calculate Pi to that level, but if there was some number that was similar, could it be used in this way:
Pi= 3.1415(962759) I got lost after 3.1415!
For the first "random" number, use 1, for the next use 4, next 1, next 5, next whatever it is that comes next.

Even using the square roots of the numbers from 1 to 10, one after the other, would produce a fairly long string of digits. When it does repeat, just add 1 to every digit and away you go...


Enough from me, I going home.
 
I am glad that this is still inspiring thoughts in people. And I suppose that what was a new concept to me then, is a new one to somebody else now.

If you look at the date when my first post was made on this subject it was
August 23rd, 2002 08:24 PM

In the end, if I recall correctly, I gave the customer the ability to make a recipe of a long string of numbers of his choice.
If he didnt like the result, it was his numbers.

I havnt been near the machine since about the above date and in PLC world 'no news' is usually a sign of good news.
 

Similar Topics

Hi, I am working on automating an industrial fabric shrinkage tester to replace its outdated electronics with a PLC. To get the tank's water level...
Replies
14
Views
538
In a control System, I need to move 3 motors attached to roller in stages with speed of 1 to 2 RPM and the torque of motor should be 8-10 Nm...
Replies
0
Views
829
Hi, I want to build a production line project using a PLC. This is the project page...
Replies
14
Views
2,220
See picture. I want to add a rung (magenta) into the existing code. Can't figure out how to do this. I select a -||- , right? When I drag/drop...
Replies
21
Views
1,800
Sorry for the basic question: On my HMI, I've created a button labelled SAVE to save the current values (distances in mm). It's not linked to any...
Replies
22
Views
2,268
Back
Top Bottom