05-10-2017 04:32 AM
Whenever I place a guage to display analog data, i always feel it should behave like a car speedometer. Smooth with no jerks ... most times the user is interested the level of a parameter and it makes no sense if the needle flutters reacting to all data variations.
I have tried a concept with shift registers as below and it seems to work - but the downside is the number of shift registers cannot be altered by the end user as its hard coded. Ideally i would like to have a control called "Damping Factor " which the user can adjust depending on the raw data. Like for instance there is little to gain by damping a Temperature reading which anyway does not change fast. Here is the Sub.VI that does it :
Solved! Go to Solution.
05-10-2017 06:42 AM - edited 05-10-2017 06:44 AM
edit: and I would not call it "damped" value, but "moving average" or "rolling average", as it is...
05-10-2017 07:01 AM
Excellent Blokk !!
The exact solution that I was looking for .. initial check outs are fine and I have full control over the behaviour.
I am a bit not clear about the Initialize input though. When I close the main VI where I will be using this sub, the data always comes to zero. So I am not if I should wire it to a control at all.
( The location of the Mean Point By Point is inside Signal Processing and I missed it looking inside Mathematics !!)
Thanks.
05-10-2017 07:02 AM
... and a "moving average" can be shown to be the equivalent of a low-pass filter (a bit of Fourier math is involved).
Bob Schor
05-10-2017 07:51 AM
@MogaRaghu wrote:
Excellent Blokk !!
The exact solution that I was looking for .. initial check outs are fine and I have full control over the behaviour.
I am a bit not clear about the Initialize input though. When I close the main VI where I will be using this sub, the data always comes to zero. So I am not if I should wire it to a control at all.
( The location of the Mean Point By Point is inside Signal Processing and I missed it looking inside Mathematics !!)
Thanks.
If you want to empty the buffer of the internal moving average, you can set the Initialize input to True value for once. Of course, after that you need to use it again with False. Naturally, if you keep this input True, no value will be produced at the output (always emptying the buffer).
05-10-2017 10:07 AM
@Bob_Schor wrote:
... and a "moving average" can be shown to be the equivalent of a low-pass filter (a bit of Fourier math is involved).
Bob Schor
Fourier math chapter left in choice in third year control technique paper
Incidentally when I am using this to smoothen out about six analogue gauges on the same screen I guess I need to set the Execution property of the sub VI to "Preallocated clone re-entrant execution" ?
05-10-2017 10:30 AM
@MogaRaghu wrote:
@Bob_Schor wrote:
... and a "moving average" can be shown to be the equivalent of a low-pass filter (a bit of Fourier math is involved).
Bob Schor
Fourier math chapter left in choice in third year control technique paper
Incidentally when I am using this to smoothen out about six analogue gauges on the same screen I guess I need to set the Execution property of the sub VI to "Preallocated clone re-entrant execution" ?
If you mean the subVI which contains this Point by point Mean calculation, yes (never change the code or execution mode of a built-in LV vi). So if you have your subVI 6 times present in the block diagram, you can set its mode to re-entrant as you mentioned, and in this way 6 instances of the subVI will be present in the memory, holding the 6 "Mean Point by Point.vi" separated.