Home > Libraries > ID 0033 > Detail
 
  Random event
 
 
  Step7-MicroWin: [V4.0.1.10 (V4.0+SP1)]
  CPU:   [all CPU22x]
  Operating system:    --
  Other:    --
Author:     Damir Krdzalic Homepage:    http://www.damir.com
Created:   08.12.2004 License:   Freeware
Update:   Price:  
Views:   401 Downloads:   152
 
QUESTION:
How to realize a Random event with S7-200 ?

ANSWER:
The LOGO! Random generator offers only a random time event. This library contain a random generator which create events in combination with a counter. This could be useful for security or quality assurance applications.
For example at Siemens factories bags of the employed staff would be checked
randomly at entrance.
Another sample is to take a product probe for quality assurance from a running production.



The Library "Random V1.1" add the "Random event" function. The functions "Rnd_B", "Rnd_I" and "Rnd_DI" are already described in a previous entry, see the links at bottom of this entry.


Random event



Parameter Variable Type Explication
EN [BOOL] enable Function, should be always TRUE(1)
Cnt [BOOL] signal input, function is enabled as long Signal TRUE(1) applied
Reset [BYTE] Reset current pass. Start new pass at next count.
Event [WORD] Max number of counts until output should be switched
1..65535
Mode [BYTE] 0=next pass after random is reached
1=next pass after number under "Event" reached
RndUv [BYTE] User given characteristic for the random generator
Memory [DWORD] !! ADDRESS !! of temp Memory, not value (e.g. &VB2000)
5 Bytes onwards used
Output [BOOL] signal output, Output which should be switched

The following picture shows the structure behind the temp memory.
Keep in mind that the cross reference of Microwin wouldn shows these bytes as used
(since they indirect addressed). The function takes 5 bytes onwards from the given address.


Functionality:
The random generator generates at first count a random number (shown im memory, Offset 1+2, e.g. previous sample VW16). When the number of "Cnt" pulse reach the random number, the output would be switched On for 1 cycle. Depend on parameter "mode" the next pass will start immediately with next count or the next pass will start at first when the number of "Cnt" pulse reach the value of "Event" + 1.





Difference between Mode=0 and Mode=1


Simulator
The parameter RndUv enables you to select for any instance a unique characteristic so the behavior of any instance would be different.
To show how the parameter "RndUv" would affect the results, use the "Random formula simulator". For download see links at bottom.




Sample 1 - Entrance check
Check at least 1 of 50.
Depend on random generator it could be multiple executions within 50.
If you want check 2 of 50 you should enter as "Event" 25.




Sample 2 - Quality assurance 2
Snap 1 of 100 bottels. Ensure that only 1 event would be generated.
Set therefore parameter "Mode" to 1.



Download (14 KB)
The author makes no warranty, expressed or implied, with regard to this informations and/or software. All implied warranties, including the warranties of merchantability and fitness for a particular use, are hereby excluded. Under no circumstances shall the author of this product or the author(s) of S7-200.net, be liable for any incidental or consequential damages, nor for any damages. Attachments could contain viruses, the user is repsonsible to check the downloaded files before using. The user has no claims, especialy not for error correction or support.
Rate this entry
   
    
5 votes
 Last Forum topics regarding this entry:
  show all topics
 Similar entries wich could interrest:
  ID 0010 Library Random numbers
  ID 0012 Tool Random formula simulator
  ID 0031 Library LOGO! Random generator
 
optimized for MS Internet Explorer and 1024 x 768 resoltution
   
  © Copyright 2003-2006 S7-200.NET - all rights reserved.
S7-200.NET and his author(s) are not liable for any incidental or consequential damages, nor for any damages caused by informations or software published on this page. Simatic, Step7-MicroWin and
S7-200 are registered trademarks of Siemens AG in Germany and other countries. Further designated trademarks and brands are the property of their respective owners.
 
 S7-200.NET ©2003-2006
External eprom
linear read & write access
+ linear access
+ variables >32Bit (string)
+ backup whole V-Memory
More...
Yearly timer
events by date & time
+ up top 3 configurations
+ min. Resolution = 1 min
+ unlimitted blocks
More...
Random event
counter generated events
+ quality assurance
+ security applications
+ unique characteristic
More...
Weekly Timer
Switch devices by clock
+ up top 3 configurations
+ overlapping configurations
+ unlimitted blocks
More...