From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-27-2019 03:51 AM
Hi,
I want to update a value on changing the setting of a boolean switch. I'm trying to use a shift register to do this, but I have no idea how to make the register only update if the boolean value changes, rather than every iteration. Can anyone help?
Solved! Go to Solution.
04-27-2019 07:57 AM
I'm assuming you have learned almost no LabVIEW (maybe you are taking a class and have had only 2 lectures, maybe you are playing around by yourself, maybe you have viewed one Tutorial Video or taken one Tutorial Web lesson).
Learn a little more LabVIEW. There are a series of Tutorials mentioned on the first page of this Forum. Spend time with them. Do them in order. Pay attention if you see something that discusses the Event Structure.
Bob Schor
04-27-2019 10:49 AM
@jnc8mc wrote:
Hi,
I want to update a value on changing the setting of a boolean switch. I'm trying to use a shift register to do this, but I have no idea how to make the register only update if the boolean value changes, rather than every iteration. Can anyone help?
There is a value changed vim. But, there is also a value changed event! Can you show us how you want to respond to the user,?
04-27-2019 12:33 PM
The desired behavior is a smooth transition into increasing or decreasing from the value currently displayed on the numeric.
I tried to use an event structure to make this happen, but my understanding of how they work is poor, even after viewing a few YouTube videos on their implementation, and reading their NI documentation.
The ideal thing now would be to have a structure that outputs false except when the value of "True: decrease" is changed, and outputs true to the select statement for only one tick, updating "Numeric 2". I think there is a way to do this via case structure, but as I said, I can't get them to work.
04-27-2019 01:10 PM - edited 04-27-2019 01:15 PM
You really need to do a few simple tutorial and exactly define the problem.
Now about your latest code. Maybe fixing the basics will get you closer to an easy solution:
So please explain exactly how the program should be used and what the operator should experience. Don't focus on algorithmic detais, because they might be wrong.
04-27-2019 01:16 PM
I've realized that the way I'm trying to do this is totally wrong. Please ignore the VI attached to the previous post. The one attached to this post displays minimum working behavior, except for one thing - when the switch is flipped, the numeric jumps to where it would be had the VI been running with the switch in that position since the beginning. I would like a smooth transition from growth to decay and vice versa.
04-27-2019 01:44 PM - edited 04-27-2019 02:37 PM
Maybe you are looking for something like an exponetial smoothing filter (wild guess). Her's a simple example (see also)
04-27-2019 02:04 PM - edited 04-27-2019 02:23 PM
... and here's a possibility with just two states controlled by the boolean:
Note that an exponetial filter does NOT need an exponential function. An exponential is inherent to successive scaling operations. Think about it! 😄 It is left as exercise to the student how to convert from exponential time constant to the filter factor (0 ...1, fixed at 0.05 here)
04-27-2019 02:27 PM
Thank you! I see why my algorithm wasn't working, and why yours does. I apologize for my bad quality code - some of my quirky style makes it easier for me to see what is going on (although it probably makes it harder for everyone else).
Regardless, which a little modification, the exponential filter works wonders.
I think I need to redo the tutorials in the meantime...
04-27-2019 02:35 PM
I am glad it helped. Good luck and success with the project! 😄