LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capacitor charging and discharging

Solved!
Go to solution

Hey! 

I have an assignment to make a simulation about the charging and uncharging of a RC circuit. I have already created a VI  about finding the value of Vc ( Capacitor Voltage ) by the formula Vc=V*(1-e^(-t/R*C) ) . I put that in a while loop and wanted to get a wave graph but i dont get a simulation of the graph when i press the stop button. I also want to create a case loop,with a boolean switch so that i can do two cases : Charging and uncharging,but i dont know how to do the uncharging part 😕 I want to add that I am new in Labview,it's only been like 3 days that I started watching the tutorials .

Thank yyou in advance 

Download All
0 Kudos
Message 1 of 6
(5,740 Views)

I guess you want to profile the value of Vc obtained by modifying the input parameters, but the while loop you created executes continuously operating the same calculation millions of times by the moment you are able to change a control value on the front panel - and it also saturates your memory.

I would go for an event structure (inside the while loop) programmed to process the data through your formula as soon as one of the controls varies. Then, having one single data for each set of controls, you may send it to a waveform chart.

0 Kudos
Message 2 of 6
(5,677 Views)
Solution
Accepted by engee5

Hi; I suggest to you to take some basic labview courses that could be useful to solve questions like these.


For the probelem you submitted, you should keep in mind that, to graph the charge/discharge values, tou must use the time as a variable inside your formula. 

Time begins from zero and goes on.

So when the loop is running, you should calculate the iteration's delay and put it (in seconds) inside your formula, to extract the output Vc value at that time.

Remebmer to put ALWAYS a fixed delay (0.005 s in the case) inside your while loops to leave time to the CPU.

You could use the Waveform Charts to refresh your output graph at each iteration.

In this example the x axis is the nr of point. Each nr of point means a delay of 0.005 s sampling time.

The Output Waveform chart nr 2 uses a formula node, that is more practical to calculate the output and gives the same results.

The waveform graph (the output outside the loop), gives you the exact timing correlation and it is available after the STOP.

You will be able evaluate the first ms instants by using the graph zoom tools.

 

Now you could be able to do by yourself the discharging vi, that could be a useful exercise.

Kudos are well-accepted!

Bye,

Marco

 

 

 

0 Kudos
Message 3 of 6
(5,666 Views)

Sorry, writing my previous post I didn't see the expression is time-dependant, so I was not correct.

0 Kudos
Message 4 of 6
(5,657 Views)

Thank you loads! It was really helpful! 🙂 

Any site you could suggest me for tutorials? 

0 Kudos
Message 5 of 6
(5,628 Views)

Look for "sixclear" channel in YouTube, their VI high series is very well made, and offer some of the best explanations I have found for several basic portions of LV. 

0 Kudos
Message 6 of 6
(5,611 Views)