LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Few problems with acquiring and generating data from 3 modules (cDAQ 9178 Chassis)

Hi!

Firstly, I'd like to describe objects on which I do the research:

1. It's an engine set to the 'velocity control' mode (so I use cDAQ 9263 AO to control the speed of a shaft),

2. There is a MR Brake joined to the shaft of the engine (I externally supply its circuit with the current, and I measure that current with cDAQ 9227),

3. Between the MR Brake and the engine there is a torque meter (the higher is current at MR Brake circuit, the higher will be the torque of braking which I can measure with cDAQ 9205),

 

I already managed to create a VI which copes with all the things I mentioned above but it still needs enhacing. For example if I increase the Rate (Hz), my VI stops running, no window error is occuring, and no data is logged to the file.

 

What's more even if VI is running at the correct Rate(Hz) and after I press the stop button, the engine keeps spinning ( I think the DAQmx_Clear_Task.vi for the Analog Output is not executed [?] )

 

I would also like to know how to add 'DC value' option to the Waveform Type list, because it would be very helpful to set the engine at one particular speed.

 

And could you tell if I can synchronise these two measurements without a counter module (does the chassis have some built-in clock?)

 

Sorry if my problems seem to you infant, but I'm still new to LabVIEW.

I'd be most grateful for any help you can provide me.

 

Tom

0 Kudos
Message 1 of 24
(3,619 Views)

If you want the engine to stop, do you need to set the analog output to zero?  Clear task doesn't do anything but remove the task from memory, it doesn't change the analog output value.  You will need to write a zero to the analog output before you clear the task.

 

"DC value option to the Waveform Type list".  I'm not exactly sure what you are asking.  But I think you are looking for a 1 channel 1 sample Analog write using the double datatype rather than a waveform datatype.  Click on the polymorphic selector below the DAQmx Write to change it to this.

0 Kudos
Message 2 of 24
(3,612 Views)

Hi teamo89!

 

First welcome to the forums! Smiley Happy

 

To get to your issue:

 

Whilst waiting for the answers on questions posted by Ravens Fan, I'd just also like to add, that the 9178 is able to synchronize measurements using it's onboard counters. However, I'd like to ask you to specify a bit more precisely, what you'd like to synchronize if possible.

 

Looking forward for more information!

 

 

Best regards,
Jano
0 Kudos
Message 3 of 24
(3,587 Views)

Firstly, thank you Ravens Fan, your feedback turned out to be very helpful. Indeed to stop the engine it has to receive zero signal. And yes, writing 1 channel 1 sample was exactly what I had on my mind.

 

Secondly, to answer your question, Ardent, I'm trying to synchronize measurements from these two modules: 9227 and 9205 running in a 9178 Chassis.

I found a video http://zone.ni.com/devzone/cda/tut/p/id/12493 which describes how to synchronize multiple devices using BNC cables and PFI lines. But in my case I would like to get synchronization between two modules, not devices, and they don't have any PFI lines. So would you be able to tell me how should I do it?

 

Looking forward for your answer!

 

Best regards,

Tomasz Rys

0 Kudos
Message 4 of 24
(3,575 Views)

Hi everyone,

 

I am also interested in knowing how to synchronize different modules (start and sample clock) across the cDAQ-9178, has there been any headway on this?  

 

Thanks,
Nick

 

0 Kudos
Message 5 of 24
(3,555 Views)

 Hi Tomasz and Nick-

 

If I understand your question correctly, it sounds like you are interested in synchronizing different modules with one another within the same cDAQ chassis.  If that is true, then the earlier advice to use an onboard counter would work but is overcomplicated.

 

You can simply include channels from multiple modules within the same task.  If you are using the DAQmx API, you would specify the channels as a comma-separated list (like 'cDAQ1Mod1/ai0:3, cDAQ1Mod2/ai0:3'). 

 

If the measurement types are different (for example, if one module provides a voltage measurement and the other a strain measurement, or similar), you can just chain multiple versions of the DAQmx Create Channel VI within the same task and specify the channels as you would in separate tasks.  If you are using the DAQ Assistant you can just add additional channels of whatever measurement type is necessary.

 

If you do need to synchronize between chassis you may find some challenges based on the module types you are using.  For the case of PFI-based synchronization, you may need to add a digital/PFI module like the NI 9402 to your system or just use the PFI lines built into your chassis (if it is an 8-slot cDAQ-9178 or cDAQ-9188 chassis).  Otherwise you might have to be more creative with synchronization options.  If you post more about your specific careabouts for synchronization (which channels and module types need to be synchronized/triggered, and at what rates?) you might get more specific advice here.

 

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 6 of 24
(3,551 Views)

Thanks for the quick response, and some good info although I don't think it can apply to me.  I am running a 9178 with two 9201's a 9401 and a 9213 module.  I am trying to collect data on the 9201's and the 9213 in a single task (which will use the same sample clocks and start triggers), I believe this should be ok, correct?.

 

The issue lies in the 9401 module, since its digital inputs (i'm measuring the angular position using an incremental encoder) I can't figure out how to synchronize its sample clock and start trigger with the analog inputs off the 9201 and 9213.

 

I have included a screen cap of some samples (blue is off 9201, green is off 9401).  There's an apparent timing issue and I can't sort it out.   

 

Just as a note, I am using the 9401 ctr0 as an input for the Encoder, and I'm using the ctr1 as a trigger output for an external device.  So I'm already using PFI0:3 for inputs and PFI7 as an output.

 

Hopefully that's enough detail to help me. 

0 Kudos
Message 7 of 24
(3,547 Views)

Hey Nick-

 

Thanks for the clarification.

 

You should be able to synchronize the DI lines with the AI task.  You can do this by specifying an 'external' clock for the DI task; the external clock in your case would be the ai/sampleClock for one of the AI modules.  Since the DI task would be a slave task to the AI task in that case, you should be sure to enforce the DI task starting first (via DAQmx Start Task) before the AI task starts, else your DI task might miss some of the AI sample clocks.

 

Since you mention splitting use-cases on the 9401 you should also be aware of some additional hoops you have to jump through to make best use of that module.  This KB gives some tips on how to do input and output on each half of the 9401 simulatenously.  You may need to do the same reservation dance to make sure that your task that uses the PFI lines is Reserved before the DI task is Started.  This can be confusing, so if you have a hard time with the specifics post back and we can try to help.

Tom W
National Instruments
0 Kudos
Message 8 of 24
(3,541 Views)

Hi Tom,

 

Thanks for the advice.  I have put together what I think is what you meant by the 'external' clock for the DI task, unfortunately I'm not at the workstation right now to test it out but I wanted to run it by you and see if this is what you meant regarding the triggers and sample clocks as well as the "channel reserving and start task".  If you can see something evidently wrong please point it out as I will make the changes and test it tomorrow.

 

As for the attached pictures, the "analog section.jpg" should be placed to the "left" of the "digital input and output.jpg" picture.

 

Thanks again for you help.

Nick

 

 

 

Download All
0 Kudos
Message 9 of 24
(3,537 Views)

Hey Nick-

 

Thanks for the code drop.  I can offer a couple of suggestions based on what you described:

 

You don't need to specify the AI timebase as an external clock.  You can specify the rate you want and the DAQmx driver will find an appropriate timebase to divide down and generate that clock for you.

 

Rather than hardcode the ai/SampleClock like I suggested before, you can make things more dynamic by choosing task parameters programmatically to bridge between the AI task and the CI task.  Check out this screenshot for an example of some useful properties (note that I omitted the CO task because it seems like you have that under control):

 

CI_AI_synch.png

Tom W
National Instruments
0 Kudos
Message 10 of 24
(3,525 Views)