3/17/2009 11:22 AM | |
Posts: 557 Rating: (64) |
HI You can use fc105(scaling) & fc106(unscaling) siemens libraries block. or see the code in STL Suppose 1 example PIW512===0---------27648(4---20ms) change in 0 to 100 then L PIW512 ITD DTR L 100.0 *R L 27648.0 /R T MD0 Suppose 2 example PIW256==INPUT to start motor from 0 to 1450 rpm PQW256==(0-------27648) OUTPUT (4 TO 20 ms) is 0 to 1450RPM L PIW256 ITD DTR L 1450.0 *R L 27648.0 /R +RND T PQW256 BY Using these example you can create a one standard block in FC OR FB & YOU can call many time, also find the source file of one block for comparsion, this file you can copy & paste in ur simatic manager source then compile , program will automaticlly create from FB22. regards AttachmentFB22 source file for comparision.zip (383 Downloads) |
Last edited by: Eastern at: 3/17/2009 12:04 PMLast edited by: Eastern at: 3/17/2009 11:33 AM |
|
This contribution was helpful to1 thankful Users |
3/17/2009 12:49 PM | |
Joined: 3/21/2006 Last visit: 11/1/2024 Posts: 10229 Rating: (1181) |
Hello Perhaps this simple program would be helpfull: calculating an average value regards |
This contribution was helpful to1 thankful Users |
3/17/2009 1:26 PM | |
Joined: 9/27/2006 Last visit: 11/12/2024 Posts: 12293 Rating: (2691)
|
Hello ScubaMike; The basic idea for stats calculations on a list of registers is basically the use of a loop. In a higher-language program, you would do a [for..next] or a [while...do] loop, add elements and compare them in a running sum, and return the calculated values at the end of the loop. In STL you can use indirect addressing or pointers to control the loop.In SCL, a Pascal-type programming language used in S7 programming, you could directly program [for...next] loops for this. This is where such a programming language is used at its best. Here are a fewexamples of programming techniques available from Siemens' (and other) website to make running average calculations; you can add these to Umencho's earlier proposed code: http://support.automation.siemens.com/WW/view/en/19345299 Calculating the sum and average of a list, using ANY Pointer. http://www.plctalk.net/qanda/showthread.php?t=23925&highlight=S7-300+average Code to calculate running sum and average without pointers. http://support.automation.siemens.com/WW/view/en/19345564 Programming a loop with indirect addressingNow, if you really want to make life easy (but you might lose an opportunity to learn interesting and useful programming concepts), Siemens provides the following: http://support.automation.siemens.com/WW/view/en/16772536 Siemens application note to calculate average, min and max values, but not free. 25 Credits on Simatic card.
|
This contribution was helpful to1 thankful Users |
Follow us on