12/4/2007 5:13 AM | |
Posts: 27 Rating:
|
Greetings everyone... It's really nice to get back after a large absence, well as usual I need some help with a very common issue (i think). I'm using some EM235 modules (4AI/1AO), when I test my program and watch the behavior of the analog inputs, these are literally dancing with important variations (around an incredible +/- 20% of the value, in other words, if my theorical input correspond to a value of 20000 in the raw input of the module, i observe in the program that this value can fall to 17000 or rise to 23000 randomly. Of course this bahavior it's originated by fluctuations in the signal and fluctuations in the power supply of the sensor that provides the analog signal. For this reason I search and found a simple smoothing filter like this: FILTERED_SIGNAL = K * FILTERED_SIGNAL + (1 - K) * ACTUAL_ANALOG_SIGNAL where K = [0:1], if K approachesto 1 the filter is stronger (the output value is less variable) Obviously I implement this with some blocks in an S7-224XP and all works fine, this filter stabilize the output even when the input signal is randomly varying. The problem occurs now when I try to create a library with the code previously described, if I call this block from the library once, the value in the output indeed is the filtered version of the input, but if I add more of this blocks in the same rung or in separated rungs, suddenly the outputs of the filters don't correspond to the filtrated images of the inputs. I'm I doing something wrong with my library's source file?. I'm attaching this code expecting somebody can examine it and help me with this problem. Thanks for your attention and your answer. AttachmentSmoothing.zip (436 Downloads) |
Last edited by: AleksF at: 04.12.2007 05:30I forget to mention that I'm actually using the Input Filter in the System Block of the Step 7 Micro Win, but due to the large variations this filtering seems to do a very poor action on the value of the analog inputs. The parameters that I'm using on this filter are: Samples: 256 Deadband: 320 |
|
Follow us on