07-31-2013 05:45 PM
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?
07-31-2013 06:22 PM
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.
07-31-2013 06:33 PM
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)
07-31-2013 07:13 PM
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
08-01-2013 09:51 AM
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.
08-01-2013 10:16 AM
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.
08-01-2013 10:52 AM - edited 08-01-2013 10:53 AM
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.
08-01-2013 11:03 AM
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.
08-01-2013 11:22 AM
@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.
08-01-2013 11:47 AM
I know, I'm a bit fuzzed. Here ya go.