LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan mode, sampling and inner clock Crio

Hello all,

I am new with labview and have few simple questions I need to be sure with them. I am using Crio-9076 with input card NI9234 and output card NI9263.

I have simple program where I generate chirp signal 100 sample/second. The chirp signal is continued to output channel in output car. At same time I measuring acceleration with 3 sensors via NI 9234. All this are in timed loop which is synchronized to scan mode.

  1. The scan period is 1 ms, does this mean that the sample rate in hardware (cRio 9076) is 1 KHz even the sample rate of 9234 is 51.2 KS/s/ch and the sample rate of 9263 is 100kS/s/Ch?
  2. Network publishing period is 10 ms, does this mean that even the sample rate of cRio 9076 is 1 KHz, published data and the data (points) I really can handle are sampled in 100?
  3. The loop is synchronized with scan mode, does this mean that the loop’s rate is also 1 KHz (the data I get is anyway 100 Hz sampled)?
  4. When I use output and input card are channels synchronized to start sampling at same time?

Thanks in advance

0 Kudos
Message 1 of 10
(4,248 Views)

Hi WatFin,

 

1. Yes. Scan period = 1ms means a sample rate of 1kS/s…

2. The publishing will be done each 10ms, but you can write faster into the network stream. (I suppose you use a network stream!?)

3. As long as the code in the loop will be executed within this 1ms the loop will iterate at 1kHz…

4. Why should the be synchronized? Did you program this in any way? Also keep in mind: those two modules use different sampling techniques as the NI9234 is using a delta-sigma ADC. They cannot be synchronized in a simple way…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(4,224 Views)

Lets continue!

  1. Does this also means that it will sample output and input with this rate?
  2. Does this mean, that if I have phenomena with 160 Hz and I am using 1 ms scan period it is not going to aliasing it BUT when I save samples for analysing those are aliased? Is there any method in labview so I can visualize how many loops program run in specific time (I am using loop count, but it seems giving me rubbish, because I am running the program with 1KHz rate and 100 Hz publishing for 10 s and it give me 121 loop)
  3. With synchronizing I meant that when I have 3-D acc, I want to get acc from each channel exactly at same time without any significant delay between them. Same with output and input channels. Is this feature automatically build in modules?

Thankyou

0 Kudos
Message 3 of 10
(4,216 Views)

Hi WatFin,

 

1. Yes. That's what you can configure within the ScanEngine…

2. To measure to loop rate you could use time functions. Counting iterations within a know period of time is ok too. Getting "rubbish" data means: you need to look into details here. Why would you doubt those 121 iterations within 10s?

3. To measure simultanously you need a module with separate ADC per channel (as your NI9234 module). Other modules only use one ADC with a MUX in front, here you will get a (known!) delay between samples of different channels.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(4,213 Views)

 

  1. Does this mean, that if I have phenomena with 160 Hz and I am using 1 ms scan period it is not going to aliasing it BUT when I save samples for analyzing those are aliased?
  2. I have used elapsed time function which run my loop for 10s then it stops. I am using 1 kHz sampling time, the loop is synchronized so in 10 s the counter should give 10*1000 = 10000, am I wrong Smiley Surprised ?
  3. There should be also about 10000 sample per acc?
  4. Is there any example how I can save every sample after every loop in array including time?
0 Kudos
Message 5 of 10
(4,206 Views)

Hi WatFin,

 

Does this mean, that if I have phenomena with 160 Hz and I am using 1 ms scan period it is not going to aliasing it BUT when I save samples for analyzing those are aliased?

When sampling a signal with 1kHz you are able to examine a 160Hz content in the signal.

Why should the data get aliased when you save it? Nobody says you need to reduce sampling frequency when saving…

 

I have used elapsed time function which run my loop for 10s then it stops. I am using 1 kHz sampling time, the loop is synchronized so in 10 s the counter should give 10*1000 = 10000, am I wrong Smiley Surprised ?

When sampling at 1kHz for 10s you should get 10k samples. Simple math - as long as your loop really spins at 1kHz…

Can you check ALL iteration times for this 10s period?

 

There should be also about 10000 sample per acc?

Yes, it should be like this.

 

Is there any example how I can save every sample after every loop in array including time?

Put the samples into a waveform - when they are evenly spaced in time.

Otherwise collect timestamps and samples in two arrays…

 

The main problem is: we don't know your VI(s) and so we can only guess what you are doing…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(4,202 Views)

I have attached my VI. It is a little bit tumbled, because I have tried different things. Well I wonder that the things in the graphs and sample I get are actually not truth because it is published fewer than loop is running, I am not sure about that? I this right or not?

My goals are simple:

  1. Generate chirp signal with 1000 Hz samplings out and read 3 acc with 1000 Hz sampling. The loop will works for 10 s.
  2. Save following data: 1. time 2. Generated signal 3. acc1 4. acc2 5. acc3 into array (matrix 5X 10000 (samples)) Publishing does not working don’t know why
  3. I really want to see that the loop working in 1000 Hz…
  4. It will be cool to tune the graph in front panel so they show everything in real-time…

I am really sorry. Labview is very new for me.

thanks

0 Kudos
Message 7 of 10
(4,198 Views)

Hi WatFin,

 

Labview is very new for me.

Then please take all those free beginner tutorials which are offered in the header of the LabVIEW board!

 

Your VI is far from "optimized"…

- Cleanup! (More often!) Nobody wants to debug a VI which misses any kind of structure and "cleanliness"…

- Get rid of ExpressVIs when you want to create fast and reliable code!

- Don't even think about mixing usual datatypes (like DBL) with those thick blue DDT wires!

- Don't create arrays in a RT environment like you do! RT environments don't like to call the memory management in  thight loops!

- Don't use charts/graphs in tight loops. Don't use them at all in RT targets…

- Consider a clean consumer-producer scheme to optimize loop iteration rates!

- Remove any unneeded code (like subtracting zero)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(4,194 Views)

Thanks for your exhaustive answer. will never use labview again.

0 Kudos
Message 9 of 10
(4,190 Views)

Hi WatFin,

 

Thanks for your exhaustive answer. will never use labview again.

You want to achieve a certain goal and I pointed out some of the problems in your VI.

What kind of answer do you expect/wish instead?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(4,186 Views)