LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring polarity durrations of waveforms

So I have an application where I'm trying to measure regenerative currents in a motor drive system.  Got all the hardware set up, got my program to do the data recording correctly, tested it so far and it works.

 

Now I want to add a table to my real time displays that will list off time of occurrance when the current goes negative and a durration for how long it stays negative.

 

Currently the current measurement is brought in via an Analog n-Channel n-Sample read command that outputs an array of waveform data that is processed in a loop at a 10Hz rate.  So I have already isolated my current waveform from the array and I came up with a method to do a comparison against 0 and produce a boolean array that corrisponds to "is the current positive or 0?" that I then turn into a digital waveform.

 

I was hoping to use the DWDT Get Waveforem Time Array.vi to get the timestamps of all the transitions (points where the waveform goes from "Positive" to "Negative" and then just calculate the difference between time stamps when the digital waveform is zero.  (note that I already asked about the functionality of this in another thread here)  Unfortunately, the test VI I created to trial this (with the intention of turning it into a sub-VI for my main program) does not seem to work at all.

 

So below I have included an image of where I'm trying to generate the timestamps.  The Transistions property is actually copied from the DWDT Get Waveforem Time Array.vi  The trick is no mater what I set the constant to that tells it to give me the "transistions array" the output is never different.  In fact the Transistions property outputs a null array.  Here, I'm not sure whether I'm missing something, not using these pieces correctly, or they don't do what I think they do...

2016-12-21_15-45-27.png

 

That aside, if the above cannot be made to work is there a simple way to find the transition points I'm after short of using a FOR loop to go through the data points one by one and generating the timestamps "manually"?  I don't know that it makes any difference but so far the picture below is how I am generating the digital "polarity" waveform.

2016-12-21_15-55-09.png

The wire coming in from the left is my original analog waveform containing my amperage data.  From there I split the components out, do a greater than 0 comparison against the data and then pipe the resulting boolean 1D array through a build Array to make it a 2D array that I can then run through a Boolean To Digital Waveform.vi and then do a Build Digital Waveform to guaranty that the t0 and dt properties match the original analog waveform.  As I said above, I wanted to use the Get Time Array function to simplify getting identifying the transistion points but figured I could probably do the whole operation neater in a Sub-VI and that would give me an opportunity to test it before creating a big mess I'd have to delete later.

 

So any ideas on how to use the digital waveform to get what I'm looking for?

Is there a way to do it using just the analog form?

 

One last thing of note is that there is the possibility of there being more than one positive->negative/negative->positive transistion in a single sample period.  In fact, depending on what's going on with the motor, there may be 10, 20, or more such transisions in a single 0.1s sample period.  And I need to be able to account for each one, not just the first. (which is why I didn't just use a simple Waveform Transistion Measurement or Basic Level Trigger function)

0 Kudos
Message 1 of 5
(2,801 Views)

Once you have created the Digital Waveform have you checked to see that that wavefrom you are creating is what you are expecting? I just want to make sure that the digtial waveform isn't wrong because if it is only outputting zero then this could bea good starting point.

0 Kudos
Message 2 of 5
(2,731 Views)

Sorry I have not replied sooner.  Christmas shutdown and all.

 

Actually when I was testing this I was manually inputing a digital waveform in the control on the front panel.  Is there something special I needed to do to get it to creat the "transistions" data?

 

Here is a screen shot of the front panel of the VI with the sample data I put in.

2017-01-03_6-43-46.png

 

Is that not sufficient or is there other data that needs to be entered to make this work correctly?

0 Kudos
Message 3 of 5
(2,699 Views)

If you're just running the data in as Boolean values you can implement a comparison function that starts a time sequence if a value is greater than zero and once the value is equal to zero stop the timing sequence and subtract the two values. 

0 Kudos
Message 4 of 5
(2,679 Views)

So it sounds like there really isn't a better option than to "brute force" it with a for loop comparison.  I can't say that its the answer I wanted, but it's an answer that I can use.  Thanks anyway.

0 Kudos
Message 5 of 5
(2,670 Views)