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.
11-15-2012 10:27 AM
Hello all
I would like to have the state of a boolean indicator change based on a simulated sinusoidal signal. I have partially succeeded in doing this but need help to further develop this.
See the attached vi. At present the boolean changes from false to true when the signal value is greater than 8 or less than -8.
The further development I require is:
Once the signal goes over 8 (and the boolean becomes true), I would like it to become false again at a value of 9, but only after the peak value has been passed i.e. when the signal is decreasing.
Likewise on the negative side of the graph, I'd like the boolean to become true at -8, remain true until after the peak value has been passed and then change back to false when the value becomes greater than -9.
Any suggeastions?
Thanks
Solved! Go to Solution.
11-15-2012 10:58 AM
Maybe try using a shift register to compare the current value with the previous value, allowing you to know if the signal is on its way up or on its way back down.
11-15-2012 11:09 AM
First of all, your simulated signal is only putting out a single scaler. Change your From Dynamic Data setting to only put out a single scaler.
Secondly, your case structures can be easily reduced down to a few boolean functions. The boolean functions would make it a lot easier to read.
I recommend building up a Truth Table. From there you should be able to easier find the boolean logic needed.
Use a Feedback Node to hold the previous value of the signal. If the new is greather than the old, then the signal is rising. Else it is falling.
11-15-2012 11:16 AM
Whilst Crossrulz was replying I was having a bit of a look.
Dont let me spoil your fun with the attached VI. Have a go yourself.
11-15-2012 11:38 AM - edited 11-15-2012 11:39 AM
@Phil_ wrote:
Whilst Crossrulz was replying I was having a bit of a look.
Dont let me spoil your fun with the attached VI. Have a go yourself.
Yeah, I was having a little fun myself. Made it a lot simpler. But I'm not going to give away all of the logic. The deleted section is just 5 logic gates. I'll let you figure out what goes where.
11-15-2012 05:34 PM
Is there a reason you have gone for a feedback node instead of shift register?
Style or technical?
11-17-2012 02:46 AM
Many thanks for your suggestion. A great help and a valuable learning exercise.
11-17-2012 02:50 AM
crossrulz - thanks for your suggestion. It looks like it'll provide a neat solution. Unfortunately I've not yet been able to find the remaining 5 logic gates and how to wire them. I could probably work it out, but being a mechanical engineer and thus not having a programming background its taking me a long time. Also, I have a test rig which need to be up and running asap. It looks like the solution from Phil_ will work. Thanks anyway
11-18-2012 07:10 PM
@Phil_ wrote:
Is there a reason you have gone for a feedback node instead of shift register?
Style or technical?
Purely style in this case. The feedback node removed some crossing wires.