Hello, how can I make the value change corresponding to the changed unit in the array?
For example, when I change the unit of “flow” to be L/hr, the value should appear from 4 to 240 in the data mainstream without adjusting the value manually. It should pop up automatically. I know how to change the unit but don’t know how to make it appear in the data mainstream with the same numeric control block.
I tried to use an event structure but don’t know exactly how to work around it.
As Ryan said, this forum is mostly for the FIRST Robotics Competition, but you are more than welcome to join us. Just be warned that you might have to start a robotics team if you stick around.
It looks like the VI you attached is pretty close - the event structure is firing on the value change. However, the logic inside of it performs a unit conversion on all of the items in the array without paying attention to what the old units were.
To show this, set the unit to L/hr, type in a value, and hit enter. The value entered is mis-converted and replaced.
One way to work around this is with the “OldVal” node on the side of your event structure. This can help you find what the old unit was and convert (or not) as appropriate.