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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number of samples and zero crossing

I have an issue running a "Continuous" ( -1 read) analog waveform through the Zero Crossing Pt2Pt. If I change the "number of samples per channel" to 2, it will count correctly. However at -1, It doesn't count the crossings, it just increments my counter indicator super fast once it crosses zero for the first time.

 

I'm sending an array of one of my analog channels into the input of the crossing VI, not a waveform. Any suggestions?

0 Kudos
Message 1 of 17
(3,398 Views)

You are going to need to show some code.  The Zero Crossing Pt2Pt doesn't accept arrays.  It doesn't even keep a count.  So I'm thinking you have a bug somewhere in your counting code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 17
(3,395 Views)

The bug doesn't show it's face when my samples per channel is 2. The counter works perfectly. Here's the code, pardon the mess. The Strain and Stress state is where my counter and crossing code are. The stress state has a crossing function, but I've modified the code to adhere to an offset, so it's not the Zero Crossing PT2PT. Both Stress and Strain portions have this counter issue. (but only at -1 samples per channel)

0 Kudos
Message 3 of 17
(3,392 Views)

As was pointed out in one of the other threads to which you have posted about this topic, converting a waveform to an array to Dynamic Data Type to a scalar causes you to lose all but one point in the data. So when you take multiple points (samples = -1) you do not analyze most of them.  Without testing I do not know which point your convoluted conversion uses, but that is clearly at least part of the issue.

 

The inner loops should not be necessary. Repeat the Stress or Strain states as needed to get the same result.

 

The use of local variables can lead to race conditions and they break dataflow. Shift registers would be a better choice in this situation.

 

It looks like your loop timing is determined by the time it takes the code inside the loop to execute. With File Writes inside the loops the timing could vary considerably if the OS needs to reallocate file space. Consider a Producer/Consumer architecture.

 

Lynn

Message 4 of 17
(3,380 Views)

I have no idea why I have that data as scalar. I think initially, my mindset was - I want to read one value at a time on my indicators. Stupid I know. I'll change these to the original arrays that I indexed from the read and see how it runs. 

0 Kudos
Message 5 of 17
(3,351 Views)

how to I preform "check calculations" on something that's not a scalar value? IE: -if this value is greater than this value, then...- I know you can do this with a 1D array but I'm not sure how.

0 Kudos
Message 6 of 17
(3,345 Views)

You can wire an array into a comparison function.  You can even wire an array and a scaler to the same comparison function.  The result will be an array of booleans.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 17
(3,342 Views)

Thanks Cross, that seems basic enough. What about doing calculations on a waveform DBL...I'm not sure I'm even doing the most efficient way. I'm taking my Analog wfm 1d Nchan NSample and indexing it so I can get the seperate channels. When I attach one of these seperate waveforms  that has get wfm components of Y,  to a shift register that has comparison functions applied, it converts it to dynamic data of 1d array of scalar, then to a scalar. I'm lost.

0 Kudos
Message 8 of 17
(3,336 Views)

@glskinner wrote:

When I attach one of these seperate waveforms  that has get wfm components of Y,  to a shift register that has comparison functions applied, it converts it to dynamic data of 1d array of scalar, then to a scalar. I'm lost.


Huh?  Attaching your VI will tell me a lot more.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 17
(3,333 Views)

I know, I'm a bit fuzzed. Here ya go.

0 Kudos
Message 10 of 17
(3,328 Views)