Home > Libraries > ID 0031 > Detail
 
  LOGO! Random generator
 
 
  Step7-MicroWin: [V4.0.1.10 (V4.0+SP1)]
  CPU:   [all CPU22x]
  Operating system:    --
  Other:    --
Author:     Damir Krdzalic Homepage:    http://www.damir.com
Created:   02.12.2004 License:   Freeware
Update:   Price:  
Views:   346 Downloads:   141
 
QUESTION:
How to realize the LOGO!-Function Random generator in STEP 7 Micro/WIN ?

ANSWER:
The following library emulates the Random generator function in S7-200. Additional features compared to LOGO Version are the max delay time is extended up to 255h, the max amount of blocks are limited trough the CPU memory size only.



The Library "Logo functions V1.3" add the "Random generator" function. The functions "Pulse_Relay", "Weekly_timer" and "Hour_counter" are described in previous entries, see the links at bottom of this entry.

Description:
The random generator contains a combined On/Off delay with a random execution within user defined limits. The random generator is useful for security related applications.

Random generator



Parameter Variable Type Explication
EN [BOOL] enable Function, should be always TRUE(1)
IN [BOOL] signal input, function is enabled as long Signal TRUE(1) applied
On1 [BYTE] Max. time to SET the output
On2 [BYTE] Max. time to SET the output
hms1 [BYTE] Time base for On: 0= hh:mm 1=mm:ss
Q [BOOL] Q=0 -> reset OUT if Reset=1 or RAL=1
Q=1 -> reset OUT if Reset=1 or RAL=1 or IN=0
Off1 [BYTE] Max. time to RESET the output
Off2 [BYTE] Max. time to RESET the output
hms2 [BYTE] Time base for Off: 0= hh:mm 1=mm:ss
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 act as a regular combined ON+OFF delay, with the difference,
that the execution time is selected by the function itself.
If you need only the ON or OFF delay, set the value for the another part to 0, so the function would work as ON or OFF delay only.



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 - Pretend presence
To protect your home or facilities you could combine the weekly timer and random generator to pretend your presence to left thieves uncertainty. The random generator would be triggered by the weekly timer. - On time: everyday (Mo..Su) 17:00 (05:00pm)
- Off time: everyday (Mo..Su) 23:00 (11:00pm)
The random generator has a max delay of 2h after 17h to switch the light on and max 2h after 23h to shut off.



Sample 2 - Pretend presence 2
Since the time of sundown changes frequently within a year, you should spend a CPU input and connect a LDR to balance this. The following picture shows this implementation in LOGO. The equal in S7-200 is add to the samples donwload (see link at bottom).



Download (36 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
   
    
2 votes
 Last Forum topics regarding this entry:
  show all topics
 Similar entries wich could interrest:
  ID 0032 Sample Random generator samples
  ID 0012 Tool Random formula simulator
  ID 0009 Library LOGO! Weekly timer
  ID 0011 Library LOGO! Hour counter
  ID 0006 Library LOGO! Pulse Relay
 
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...