NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
CDreher99
Posts: 49
0 Kudos

Re: Generating multiple ramps problem

Hi Yan,


did you have success, with the generating of the multiple ramps?


Regards,
Christian

Active Participant
Mystogan
Posts: 239
0 Kudos

Re: Generating multiple ramps problem

[ Edited ]

hi christian,

thanks for asking. Actually, I think I've managed to get what I need from the other thread (old one) with help from an NI engineer (http://forums.ni.com/t5/Multifunction-DAQ/Generating-multiple-ramp-pattern/m-p/2037048#M71574). This is what I got:

 

testramp.png

 

It can build multiple ramps nicely at the same time. The key is: sample numbers must be the same for all ramps. I'm initializing high numbers for sample numbers (must be power of two), and then comparing this number to the samples of each ramps), then dividing the maximum samples thats been compared, then dividing it with samples of each ramps and then expanding the steps of each ramp.

 

This program runs pretty good if I want to generate just constants or ramps for all channels. But, if I try to generate sine wave, it sometimes very lagging, sometimes gives me error  -200018, (which means my sample rates is too big?). I'm still trying to find solution to this. The pict on the right is the zoom pict of my signals.

 

Oh yeah, dont bother to see the big green button in the left of the pict, its using another NI card.

 

regards,

Yan.

 

Active Participant
Mystogan
Posts: 239
0 Kudos

Re: Generating multiple ramps problem

hi all,

 

any suggestion how to add delay to a single channel? Is there any sub vi that can add delay to one specific channel?

 

regards,

Yan.

 

Active Participant
Mystogan
Posts: 239
0 Kudos

Re: Generating multiple ramps problem

hi all,

 

I think I can get the delay with using two ramp pattern.vi. I use the 1st ramp pattern to generate 0, then the 2nd to generate ramp. Then using insert to array, then build waveform. But this means, I'm using only one dt. Which means, to have my multiple ramps working properly, the delay time and the ramp generating time must be quotient of 2. Otherwise, the sample numbers will not be shared equally in each ramp step. So confusing... :smileysad:

 

regards,

Yan.

Proven Zealot
johnsold
Posts: 7,854
0 Kudos

Re: Generating multiple ramps problem

A few posts back you said "The key is: sample numbers must be the same..." That also applies here.

 

Suppose you have 10 samples so that the ramp values are {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. Now if you want to delay that ramp by 3*dt, you put three zeros at the front while keeping the number of samples the same.  The delayed ramp values are {0, 0, 0, 0, 1, 2, 3, 4, 5, 6}.  The Array palette has several tools to manipulate the arrays to do this.

 

Lynn

Active Participant
Mystogan
Posts: 239
0 Kudos

Re: Generating multiple ramps problem

hi Lynn, thanks for response.

 

I was thinking the same idea and I could manage to do such delay while generating finite sinewave (ex: 1000 cycles sinewave with 500cycles-delay gives me the delay+the rest 500cylces in output). But seems harder to apply to ramp.

If the input for generating ramp are:

- delay time (free selectable)

- ramp time from min to max

- min & max value

- sample numbers

and I want the ramp goes from min value to max value after delay time, is it possible? I keep thinking that the delay time cant be freely selectable, if I want to have equally samples amount in each step.

 

regards,

Yan.

Proven Zealot
johnsold
Posts: 7,854
0 Kudos

Re: Generating multiple ramps problem

Yan,

 

I think you are correct that you cannot independently specify all those parameters.  The total time is specified by the number of samples and the sample rate.  If you also specify the total time as the sum of the delay time and the ramp time, then you have a conflict unless both sums are exactly equal.  If you also want a specified number of samples per step, you have an additional conflicting constraint.

 

Here is a quick example showing some possibilities.

1. A simple ramp pattern with the total number of samples is show for reference.

2. Using the Ramp Pattern VI and Initialize Array to generate simple delays.

3. A delay followed by a ramp with specified number of samples per step.  Note that some "bookkeeping" is required to get the numbers of samples for each segment correct.  Also many combinations of values do not produce a valid result.  This example does no error checking and soe settings may crash the program with out of memory errors.

 

 

Lynn

Active Participant
Mystogan
Posts: 239
0 Kudos

Re: Generating multiple ramps problem

[ Edited ]

Hi Lynn, thanks for your small but inspiring program.

 

I can manage to get into the direction that I want. But still, with using 8 channels and generating signals from 6733, I can have maximal 2^19 samples/channel/second, right?

Now with my program, I can have the desired delay and ramp as long my delay duration is less than ramp duration. When I put delay duration more than ramp duration, I'm getting error: my sample numbers changing.

It's because I keep building my ramp using half of total sample numbers: 2^18 samples.

 

regards,

Yan.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page