Ano Ano Posted October 11, 2011 Report Share Posted October 11, 2011 Hello, I got 10 on-off switches, When switch number "X" turns on I want to display its change in a graph (bar plot) that it turned on (y-axis value/amplitude 1 if it turns on) and on x-axis display the time that it turned on (see attached picture). When other switch turns on then I want the graph to display all previous switches activity (with their time stamp (in sec)). This has to be a graph so that I can put cursor labels on each bar. Any ideas how to do this? Thank you in advance Quote Link to comment
asbo Posted October 11, 2011 Report Share Posted October 11, 2011 There's a Boolean to 0,1 primitive which will help. Use an array of booleans to create an array of your Y values, bundle it into a waveform, and adjust its properties as necessary. Quote Link to comment
crelf Posted October 11, 2011 Report Share Posted October 11, 2011 Have a look at the attached VI - should give you something to get started with. Graph to display all previous activity.vi Quote Link to comment
Ano Ano Posted October 14, 2011 Author Report Share Posted October 14, 2011 Have a look at the attached VI - should give you something to get started with. Thank you for the help! I have an issue though...If the "switches" control becomes and indicator, then the vi does not work! (see picture here http://imageshack.us/photo/my-images/442/evenstructureindicator.jpg/) Please help Quote Link to comment
crelf Posted October 14, 2011 Report Share Posted October 14, 2011 Thank you for the help! My pleasure I have an issue though...If the "switches" control becomes and indicator, then the vi does not work! (see picture here http://imageshack.us...eindicator.jpg/) Right - the code I gave you is a place to get started - you need to work out how to put it into your higher-level application. Hint: the event structure acts when the switches array is changed, so you can't use that: try keeping the state of your switches indicator in a shift register, and comparing that with the new value to get your two Boolean arrays. Another option is to use the OpenG "Changed?" VI to select whether to execute my code or not. Quote Link to comment
Ano Ano Posted October 17, 2011 Author Report Share Posted October 17, 2011 try keeping the state of your switches indicator in a shift register, and comparing that with the new value to get your two Boolean arrays Hello & Thank you very much ...again! I used two things to get it working: 1. The shift register 2. I wired the output of the boolean array with a property node "val(signl)" linked with the "switches" indicator that was inside the event structure The problem now is that with both solutions the code is a bit slow...what am I doing wrong? Quote Link to comment
Ano Ano Posted October 17, 2011 Author Report Share Posted October 17, 2011 Hello, I thought to write an update. While playing around with the codes limits I noticed that if the boolean array is longer than 32 elements/switches then the code does not display the change of the booleans (numbered from 33 and above) in the graph. Why is that happening? Quote Link to comment
crelf Posted October 18, 2011 Report Share Posted October 18, 2011 I wired the output of the boolean array with a property node "val(signl)" linked with the "switches" indicator that was inside the event structure Yep - that'll work nicely - good job. While playing around with the codes limits I noticed that if the boolean array is longer than 32 elements/switches then the code does not display the change of the booleans (numbered from 33 and above) in the graph. I don't have the code in front of me, but maybe the conversion to number (to decide which Boolean has transitioned from false to true) is set to only I32? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.