LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

9205 resource conflict?

Alright, gang, let me darken your doors again with a DAQmx problem.  I have a cDAQ 9174 chassis with a 9263 AO card, and a 9205 AI.  Running LabVIEW 2019 and DAQmx 19-something.  I'm using 2 different tasks, one uses cDAQ1Mod2/ai0 for finite samples, differential.  The other task is on cDAQ1Mod2/ai1, also finite samples, differential.  I'm jumpering the (only one) analog voltage to be measured together for AI0 and AI1.  Why? I use AI0 for repetitive measurements, and use AI1 strictly to detect voltage crossing thresholds to trigger an event.  In DAQmx Create Virtual Channel, I gave them the names AnalogIn and AnalogInTrigger.  I've verified using NI-MAX that both channels are measuring my voltage input properly.

 

In my application, I 1st run the vi that 'arms' the analog trigger (using AI1), and it works properly without error.  This means that now it's just sitting, waiting for a trigger.  Then I attempt to read the (same) voltage on AI0.  I am outputting voltages on cDAQMod1/ao0, but 'infrequently' - no waveform generation, synchronization or anything fancy.

 

THE PROBLEM: The very 1st time I attempt to read from AI0 (requesting # samples = 20), I get a -50103 "specified resource is reserved" error.  Any ideas of why DAQmx thinks I have a resource conflict? Appreciate any insight, paul

0 Kudos
Message 1 of 6
(2,925 Views)

You can only run one task per module in a cDAQ chassis. You will need to propagate the task ID wire between your VI's. It acts as a reference to the task that is running on the card. If you call Create Virtual Channel again, it doesn't pick up an existing task, it tries to create a new one.

 

I think you can technically use named channels to get around this, but you'd have to reference the same name, not different names. It would also help to post the code you're using.

0 Kudos
Message 2 of 6
(2,910 Views)

Bert - yeeouch!  I sure did want to run 1 task for 'repetitive' finite sample measurements, while running a 2nd task for triggering, sitting/waiting for a trigger to happen.  Definitely need for those 2 things to happen simultaneously & independently - I created separate loops/processes for the 2.  I'm just not grasping at the moment how I would have a single task running repetitive "on demand'  sampling, and the same task (but different physical channel) 'snoozing' waiting for an analog trigger.  So here are my vi's.

 

Download All
0 Kudos
Message 3 of 6
(2,871 Views)

I can't see your VI's as I'm in v18 (do a Save for Previous Version and I'll take a peek). Also I'd recommend using a project to organize things.

 

Without looking at your code I'm having trouble figuring out what you're doing. A trigger is typically used to say "OK, start acquiring samples after [event] happens", where [event] can be an analog voltage rising above a certain level, or a digital line going high, etc. Triggers can also be used to Stop acquisitions- say you want to save the previous 4 seconds of data when a trigger occurs. Or as Reference triggers, where you save the previous 4 seconds and the next 2 seconds, or whatever. (I may have my names wrong here but I believe that's right).

 

Having a task with *just* a trigger in it seems to not be super useful. If you need to be constantly analyzing data, then have a software event fire when the data does something specific (like crosses a threshold), can't you do it in your analysis loop? In other words if you're already analyzing the data, just use that to trigger your software event. You don't have to set up a second trigger dedicated to doing that.

 

If you need to have two separate channels on one device, you can just read both sets of data in your processing loop (you CAN have multiple channels in one task, that's not a problem at all) then display one (for your finite repetitive tasks) and analyze the other (for your trigger conditions).

 

Can you explain exactly how you'd like the program to work? I'm just having trouble following.

0 Kudos
Message 4 of 6
(2,866 Views)

Bert - I can save as LV18, maybe earlier so others can see it.  I am using using a project, I just didn't think it would be useful to include all of it.  So for now, here are my initialization, analog input and trigger arming vi's.

 

My rationale (not necessarily correct or even sane!) was this:  the app is running a little hydraulic control system.  I made a PID-ish algorithm to control things.  So I grab analog input samples, analyze and generate a new analog output.  I worried that my loop speed might be slow enough such that, while the AI card is is getting samples, or I'm analyzing, or whatever, a "spike" in hydraulic force might potentially damage an expensive, customer-owned load cell.  So I wanted an independent loop ready to detect that condition, fire an event so that I 'instantly' back off on the control valve (sending a new analog output voltage).  Now, that said, I *think* I'm doing reasonable things to make the loop run as fast as possible - user interface and display in a UI loop, separate loops for the DAQ in & out.  So maybe I'm worried about nothing...  Maybe the best thing to do is to run the AI card as fast as it'll go, fetch 1 sample at a time and check *each* one for "dangerous" forces.  Need to rethink, it seems.  Definitely open to suggestion - paul

Download All
0 Kudos
Message 5 of 6
(2,858 Views)

Ah, that makes sense. I have a few rambling thoughts- hopefully something will help.

 

Unfortunately you can't do multiple tasks per physical device, as the article said, but you can always split your acquisition and your processing into different loops. Look at some of the examples in the Example Finder and Project Templates to do a Producer-Consumer loop. This will let you pull in data in one place, then send half to a "slow" analysis routine and half to a "fast" limit detection routine. That way your slow routine won't interrupt the fast one (within the limits of Windows, a nondeterministic, non real-time system, of course).

 

For a point of reference, one project I did used a pair of cards sampling at 1,000,000 samples per second on both cards, doing some analysis in realtime, and saving the results of the data (I didn't store ALL of the data- I just detected a failure condition, and the response time wasn't critical like it is in your case). At any rate, a throughput of 2,000,000 Double values per second didn't peg the processor nor blow up my memory usage.

 

In your case, having a triggered task be detected by software will be fairly quick, but the trigger is more for the card than for Windows. The trigger will cause your acquisition to start very quickly on the card, but reading the buffer will be slower. I think you would be OK with just sampling the data and making a software decision, but it all depends on how fast you need to respond. 10 ms should be easily doable (I've done it before), but 10 µs will be impossible within Windows (you could do it with an FPGA device, like a cRIO, but that's a whole other can of worms).

 

Your idea to sample one at a time is good in theory, BUT there is a significant overhead associated with starting a transfer. In other words, transferring 1 point 1000 times is considerably slower than transferring 1000 points 1 time. You will need to find the right balance of immediate detection vs. bus speed. I usually try for a ~10 Hz buffer read, but 100 Hz is probably fine too (the actual amount transferred per buffer read can be quite high with no troubles). Faster than that you might get into OS issues and may not be able to keep up, but it's quite hard to say theoretically so I'd recommend just trying things and seeing what works. It'll depend on your RAM, USB bus speed, processor, hard drive, phase of the moon, your favorite color, etc.

 

Last, with multiple input cards (in the same chassis) you could theoretically have a digital output task set to start on an analog trigger, firing a digital signal to E-stop the cylinder, and all of that should take place only on the cDAQ chassis which would be quite fast, but you'd need a dedicated AI device for that.

Message 6 of 6
(2,833 Views)