6/6/2008 3:08 PM | |
Posts: 7 Rating: (0) |
Hello how do i create an moving average signal in wincc for a tag specified? I tried scripting it but i dont get it to work. Thanks in advance B Bakels |
6/9/2008 1:06 PM | |
Joined: 12/8/2006 Last visit: 11/27/2023 Posts: 170 Rating: (26) |
hi, wincc don't provide the moving average in tag managment or tag logging. - in wincc tag managment only linear scaling is provided - in tag logging only arithmetic average is provided But you can use global script to calculate the moving average yourself. The attachment contains the calculation rule. notes: - the (new) moving average is calculated from the "old" moving average and the current measuring value. - In global script C you can use a static C-tag to "store" the"old" moving average. (e.g. "static float fAverage;"); The using of an internal WinCC-Tag is possible too. - During startup you have to increment and usea counter tag. - During the first cycle the current value is used instead of the calculation rule. - The startup is finished, if the counter tag equals the count of the average AttachmentMovingAverage.pdf (505 Downloads) |
6/9/2008 1:42 PM | |
Posts: 7 Rating: (0) |
thanks, this was very helpfull, i going to try to make my c code to work. I will keep you informed. Thnkx, B Bakels |
6/10/2008 6:29 PM | |
Posts: 42 Rating: (5) |
Hi,
In general it is very simple to do. You can do it either in the PLC or in the WinCC. The general Formula is the following expresion for creating an average of any value. A=LA+((MV-LA)/N) A=Average LA=Last Average MV=Meassured Value N=Number of samples (i.E. seconds) You will save a lot of execution time while you need to store just the last average (LA) and the number of samples (N) I got this Information out of the www.sps-forum.de and it was posted by harry at this time. This worked fine for me. harry got the formula from the book "C für die Automatisierunstechnik". I am not sure if this book is availabe in English or not. Hope it helps Markus |
This contribution was helpful to1 thankful Users |
Follow us on