01-29-2014 02:36 AM
Hi,
I have been trying to create a VI which will allow me to convert a pulsed signal (generated by a tachometer) into a single thickness line, indicating that a revolution has passed. I would like to overlay this line onto the other signals being generated.
I am able to detect the falling edge of the signal, but I have not been able to make a suitable line. I have tried creating a new waveform, and fiddling with markers, but neither method has worked for me.
Does anyone have any ideas of a good way to do this?
My test VI is below.
Solved! Go to Solution.
01-29-2014 08:05 AM
@CamW wrote:
Hi,
I have been trying to create a VI which will allow me to convert a pulsed signal (generated by a tachometer) into a single thickness line, indicating that a revolution has passed. I would like to overlay this line onto the other signals being generated.
I am able to detect the falling edge of the signal, but I have not been able to make a suitable line. I have tried creating a new waveform, and fiddling with markers, but neither method has worked for me.
Does anyone have any ideas of a good way to do this?
My test VI is below. [snipped]
I've got a couple of problems here. First, I have no idea what you mean by "convert a pulsed signal ... into a single thickness line". Second, your posted VI throws an error every cycle (1 ms) because your stuff on the bottom of the BD makes no sense.
If you mean that you want to create a waveform to test your zero-crossing detection on, I would advise not using the Simulate Signal (Express) VIs, go to the Signal Processing -> Create Waveform subpallete and pick something from there, or add a few together and roll your own. Then throw it onto a waveform graph, look for zero-crossings,and process it further however you wish. Note that the Create Waveform VIs can be tailored however you wish so you can work with them comfortably.
Cameron
01-29-2014 08:39 AM
Thanks for having a look,
The snippet process seems to have changed my block diagram, the property node should be linked to the waveform graph, rather than having a constant input.
It lets me change the colour of the tachometer plot between red and transparent, to allow the user to view the plot with and without the tacho.
I am trying to find a way to only show the negative edge of a square wave on a chart, as below (the top chart would be the input, the bottom is the desired plot).
I will trying re-producing my test VI with Create Waveform VIs, and see if I can find a way to do it.
Thanks,
Cam
01-29-2014 08:48 AM
Looks like you should be able to do this with vertical line cursors.
Create your cursor with Cursor Style=2 and then Set the X position via property node.
01-29-2014 09:11 AM
Hi Taki,
Ideally this should be done with charts, as graphs will not work well with the rest of the VI.
So no cursors, unfortunately. (Unless there there is a way to get a cursor onto a chart that I am unaware of!)
01-29-2014 09:15 AM
Yeah, I find that those snippets don't always work exactly like attaching the real thing.
Taki1999's suggestion sounds good, or you may set your second (red) plot to flip between +5 and -5 when your signal goes positive, then negative, while keeping the graph's Y-scale at +/-1 (or whatever). You should also be able to program your red plot to go invisible when its level reaches -5, then to go visible when it reaches +5 again, to eliminate the positive transition. However, if you do this, you are going to have to consider your plotting rate, because using property nodes to change things takes a lot longer than straightforward programming. (There was a fairly long conversation a month or two ago on this, altenbach gave the definitive answer - as usual .) Thinking about it a little more, you should be able to program things to ignore the positive transition by playing with the red plot's flip trigger.
Good luck.
Cameron
01-29-2014 09:31 AM - edited 01-29-2014 12:45 PM
Make the second plot style vertical lines (plot style: no points, no interpolation, fill to -inf). feed a NaN whener you don't want a line and a "+inf" whenever you want a vertical line.
Here's a simple example:
01-30-2014 05:24 AM - edited 01-30-2014 05:26 AM
Thanks to everyone's help I've managed to solve my problem.
Here is a snippet showing the process working, for anyone else who may get stuck on this problem (the second plot on the chart has been configured as Altenbach suggested).
And here is a screenshot showing how I have implemented the solution with a custom scale and a tachometer. (The custom scale works as an ADC).
Thanks again to everyone who helped!
Cam
01-30-2014 10:35 AM
These "solutions" can still be improved dramatically. I would never hardwire a size (1000 in the upper example). First of all, the loop needs to iterate one less than the number of samples and the array is right there to get the size. What is the size changes down the road. Do you really want to search for all diagram constants that need to be changed? What if you miss one by accident?
Also, the loop could be simplified quite a bit. Try it!
(Typically you would also mark the most helpful answer as solution, not your own summary)
01-31-2014 01:57 AM
Firstly, I've changed the solution tag, I misunderstood it's purpose, sorry if I've annoyed people.
Secondly, I undertand what you mean about the number of interations, the second example doesn't actually have the same problem, bar the fact it loops one too many times, but I can't see a way to simplify the loop, could you enlighten me?