LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Charge/Discharge curve

Hi All,

I am trying to generate a charge/discharge curve, I have attached a diagram showing what I am aiming for.

In the past when I have needed to generate curves I have used the signal generation palette - functions such as pulse pattern, ramp pattern etc. However I cannot see anything that would fit my needs in this case.

I had an idea that I coud use a ramp pattern function then use some mathematical operators to get the exponential charging/discharging that I need but haven't been able to get very far after playing around for some time.

I would appreciate some guidance on how to get my solution to work or if there is a better/easier route to take.

Thanks,

 

Parker

0 Kudos
Message 1 of 4
(3,028 Views)

Reminds me of an R-C circuit, also known as a Low-Pass Filter.  What would happen if you put a square pulse through a Low Pass Filter?

 

Care to say anything about the data rates you are using to generate your curve, and about the Charge/Discharge parameters?  In particular, are they "decaying exponentials" (even though one looks like a "growing" exponential, but it isn't, of course ...) with the same Time Constant?  [If so, a Low-Pass Filter is an easy way to go -- you don't even need to use the Filter functions, you should be able to build a pretty good approximation just with a While loop and a shift register ...].

 

Bob Schor

0 Kudos
Message 2 of 4
(2,993 Views)

Hi Bob,

 

The information that I am working with is that the first 'charge' section charges from 13.5V to 27V over a period of 10ms. Then the signal stays at 27V for 300ms before discharging back to 13.5V. I have no figures for the discharge time so I am working on the assumption that they are both decaying exponentials with the same time constant.

 

Could you perhaps expand on the while loop with shift register solution that you mentioned?

 

Thanks,

 

Parker

0 Kudos
Message 3 of 4
(2,962 Views)

I'm not an engineer, so I get a bit "wobbly" when trying to explain filters in the digital domain (z-transforms, anyone?).  However, you can do a little experiment and you'll get the idea.

 

Suppose you have an input/output system, input is X(n) and output is Y(n).  I write X(n) to emphasize that I'm measuring ("sampling") X at discrete intervals of time, so I have a series of numbers.

 

Consider the following:  Let Y(n) = (X(n) + k*X(n-1))/(1-k), where k takes on values between (but not equal to) 0 and 1.  Here's a little VI that can generate this, with X(n) set to a fixed value of "Final X" of 1, with an Initial X of 0:

Simple LP Filter.png

If you try this, you'll see it gives you a rising "decaying exponential" -- if k = 0.95, at 10 it is a 0.4, and at 50 it is at 0.9, while if k = 0.8, the values at 10 and 50 are 0.7 and 0.98 (i.e. lower numbers give faster rise times).

 

If you have access to the Signal Processing Toolkit, it probably has "real" Low Pass filters that you can implement, but this simple example illustrates how filters work (by feeding back part of the signal and combining it with incoming signals, usually with an op amp or similar circuitry).

 

Bob Schor 

0 Kudos
Message 4 of 4
(2,946 Views)