LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using USB NI-6363 for hardware re-triggerable analog trigger signal(APFI0)

Solved!
Go to solution

Posting code would be one step, just please save back to LV 2020 or earlier.  What's also going to be needed is a much more thorough description of the system, the behavior you're capturing, what's "wrong" about it, and some rationale for why you expect to see something different.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 11 of 24
(253 Views)

Hi,

 

Thank you for your response.

I am currently working on a project to develop a DAQ system for real-time, multichannel dosimetry in a LINAC (medical linear accelerator) environment. While I have made significant progress under ideal (lab) conditions, I am encountering a transient behaviour in the data that is limiting my ability to move forward toward real-time clinical scenarios.

This transient behaviour appears consistently and is proving difficult to resolve. Despite gaining a lot of valuable insights from this forum — and I truly appreciate the support and guidance I've received so far — this issue remains a critical bottleneck in my workflow.

I’ve attached a screenshot of setup and the relevant LabVIEW 2020 code in case it helps provide context.

Any suggestions or insights would be greatly appreciated.

Kind regards

Hasham

Hasham622x_0-1750840954210.png

 

0 Kudos
Message 12 of 24
(234 Views)

I reviewed the thread and even followed over to a linked one where I had tried to help you last fall, on mostly the same problem (I think).  I'm still not sure I know what "transient behavior" you mean, what you expect different from that, and why.

 

In the plots up in msg #8, what I see is some noise superimposed on what looks like a "settling into steady state" response.  If the ~10 mV worth of apparent settling is the transient you're talking about, the fact that it appears to be rather consistent and repeatable inclines me *not* suspect the DAQ config as a root cause.

 

Is your DAQ system just passively observing and measuring things that are already in a steady continuous run state?  Or does it (or you) initiate some kind of start-up conditions when you run the program?

 

I'm mulling a theory about a combination of the DAQ circuitry and the sensor's source impedance contributing to this "settling in" time.  The DAQ hardware is a place where there's some degree of startup conditions each time you start the program.  But I'm not an EE to be able to really get into the weeds with such a theory.

 

What happens if you keep collecting out to, say, 1000 samples rather than the 100 shown in those screencaps?  Does the data show a pretty horizontal "settled" trend all the way out to 1000?   Again, if so, I'm inclined to say that you're capturing something that's real, you just need to understand its cause well enough to eliminate or work around it.

 

I'm also mulling a theory that your repeatedly retriggered 2-sample finite acquisition might not be the best approach.  Why exactly 2 samples?  And why approach the maximum available sample rate for those 2 samples?

   My *guess* is that you really only want 1 sample but are stuck taking 2 because DAQmx requires at least 2 for finite acquisition.  And then you use a max sample rate to try to "waste" as little time as possible getting the 2nd sample.  But it's also the case that max sample rates are more demanding on the DAQ circuitry, possibly playing a role in this brief "settling in at startup" behavior.

 

A further troubleshooting thought occurs to me now.  You've been at this a long time, so bear with me and take just a little more time to go down a different path for the sake of diagnosis.  Start with a simple shipping example for continuous voltage acquisition.  Configure it to use TDMS logging and capture 2 channels -- one of your sensors and the 360 Hz sine wave you want to use as an analog trigger.  For starters, capture at 100 kHz and run for about 3 seconds.

 

Now you've got a data set that gives you a more continuous view of things.  You can put together a fairly simple algorithm that searches through the sine wave data and identifies the points that *should* have produced a trigger event, which in turn identifies the sensor sample that *should* have been captured in response to that trigger.

    Do you still see that same startup "settling in" behavior?   What happens if you increase to 500 kHz sample rate?  How about if you decrease to 25 kHz?

 

That's a very specific suggestion, but the general one is to start exploring this problem from different angles. Poke, prod, see what happens.  Try to understand *why* it happens.  Use that understanding to solve or work around the anomalies.   An extremely crude example might possibly be:  accept that on startup, you need to ignore the first second or so worth of data as things "settle in".  Only start believing data that comes after that.  The rationale is that you're keeping the same data you'd have gotten from a perfect system if you had hit the start button 1 second later.   Seen in that light, it might be totally acceptable to ignore that first second.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 13 of 24
(225 Views)

Hi,

Thank you for your reply. I conducted the test again, and this time I used a pulse signal as the analog trigger (APFI1) and a sine wave as the input signal. Under this configuration, I did not observe any transient behaviour.

However, when I switched the input signal to a triangular wave, I started getting inconsistent captured values.

Could you please share your comments or guidance on this approach?

I also attached a short PDF report on this test.

0 Kudos
Message 14 of 24
(195 Views)

To be perfectly honest, I'm very dubious about the analysis and reasoning found in your report.  Maybe I'm missing some crucial knowledge about your setup and intentions?

 

For example, you claim that supplying the same sine signal to both the trigger terminal and the channel terminal results in "no synchronization or phase locking."   This strikes me as being EXACTLY wrong.  What could possibly be more synchronized to your sine wave than... ITSELF?   There must be some other explanation.  I don't know what it is, but it can't be that a signal is uncorrelated to itself.

 

Something that isn't clear at all in the report is why a pulse-style trigger should be *expected* to be in sync with a sine or triangle wave.  Is it coming from the same function generator used to generate the sine or triangle?  I presume that it is, but something like that needs to be spelled out clearly.

 

I don't find the final conclusion to be credible.  I believe what you observed, I just don't think you've come up with the right explanation for it.  In a good experiment, the triangle wave should have been "just as synced" to the trigger pulse as the sine wave had been.  Whether the input channel is a "smooth" sine or "ramp-like" triangle makes no difference to the DAQmx trigger circuitry that's seeing a pulse in both cases.

 

    Have you looked at these signals (pulse, sine, triangle) on a scope?  Does the function generator keep the pulse sync'ed to its sine wave but fail to sync to a triangle output?   These are some of the kinds of troubleshooting things that need to be explored more carefully.  Another key area of exploration would be variations in analog trigger config parameters on the DAQmx side.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 15 of 24
(180 Views)

Hi,

 

Thanks for your reply...

Yes, I am providing both signals from the same function generator, utilizing both output channels. Previously, I was using only one channel and splitting the signal using a T-BNC connector to feed both the trigger input (APFI0) and the analog input channel (ai0). In that setup, I observed transient behavior.

I suspect this transient behavior might be due to the internal comparator in the DAQ system, which converts the sine wave trigger into a square wave. This conversion could introduce timing uncertainty, especially since a continuous sine wave does not provide a sharply defined trigger edge. In contrast, a pulse signal has a clear, sharp edge, which likely explains why the transient behavior is not present when using a pulse for triggering.

...

0 Kudos
Message 16 of 24
(168 Views)

I spent a little more time looking at the specs and manual for the 6363 device and also digging into the ol' memory bank a little harder.  I came across one thing worth mentioning and I failed to find another thing or two also worth mentioning.

 

1. The spec sheet seems to show that the regular AI channels themselves can be configured to be the analog trigger.  Supported analog trigger sources are shown as: "AI <0..31>APFI <0,1>".

 

2. I have a fuzzy memory that I couldn't confirm in the manual.  I *think* that when you use a regular AI channel as the analog trigger, it might also need to be the first channel in the channel list for the task.  This memory dates back many years and I don't recall whether it was only supposed to apply to *some* DAQ devices.  It's also possible that this restriction no longer applies in more recent DAQmx versions.  Or my memory could be faulty.

 

3. Another even more fuzzy memory I have is that some devices have a dedicated A/D converter for the analog trigger detection circuitry.  As I recall, they offer faster conversion & reaction time at the expense of reduced resolution, such as maybe 8,10, or 12 bits?
    In my mind, I associate this with devices that have dedicated APFI terminals.  What I don't have any recollection about is whether the dedicated lower-resolution circuitry is only used when the trigger comes from an APFI terminal or whether it's also used when the trigger comes from a regular AI terminal.

    More things I'm not sure about include whether any such dedicated trigger circuitry always spans the max AI range, and what sample rate is used by the dedicated trigger circuitry.

 

At this point, as far as I know it's possible that a lower-resolution trigger circuit could be adding a little "noise" around the trigger point.  But that still doesn't address what you've been calling the "transient" trend behavior that looks to me like a "settling in" to steady state.

 

It's also possible (as far as I know) that by designating the regular AI channel that receives the sine wave as the analog trigger, you'll be using the the full resolution regular A/D converter and reduce the noise around the trigger point.

 

So, a lot of things there.  Here are some more suggestions you might try:

4. Configure the analog trigger to be ai1 and connect ai1 to your sine wave.  Also explore the various kinds of analog trigger modes and parameters.

5. Configure the analog trigger to be ai0 and connect ai0 to your pulse.  Connect ai1 to the sine wave.

 

Compare what happens in these conditions to what had been happening when you used APFI0.  Maybe there's something to be learned?

 

 

-Kevin P

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 17 of 24
(158 Views)

20250709_095201.jpg

20250709_095114.jpg

20250709_095052.jpg

20250709_095205.jpg

    

0 Kudos
Message 18 of 24
(153 Views)

Hi,

 

thanks for your reply. I tried to change the analog trigger (APFI0 & 1) to AI channels, but I'm getting an error.

 

Kind regards

 

Hasham

Hasham622x_0-1752033925178.png

 

0 Kudos
Message 19 of 24
(136 Views)

As the error text suggests, the trigger source must either be a channel that's part of the channel list for acquisition, or one of the dedicated APFI terminals.   Here you're acquiring only ai1 while configuring ai0 as the trigger source.   Set the trigger source to *also* be ai1, which is what the error text says is valid.  Then you can connect your sine wave *only* to ai1 for the experiments with trigger parameters.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 20 of 24
(103 Views)