Jump to content
  • 0

capacitance charge energy


attila

Question

1 answer to this question

Recommended Posts

1. The best, most accurate way to measure the capacitor is using the Impedance Analyzer interface.
For this you can use the Impedance Analyzer adapter for Analog Discovery or a using reference resistor with a circuit setup shown in help.
https://store.digilentinc.com/impedance-analyzer-for-analog-discovery/ 
https://forum.digilentinc.com/topic/15602-impedance-analyzer-internal-compensation/?do=findComment&comment=38071

image.png.d74d16a4dc49b7dad7b80e5dbf55a521.png

image.png.90c40a3fd3da04f8ec60e0ba22d507b3.png

image.png.965380873d0232d3427fcb68e1c2227a.png

 

2. You can use a custom measurement to calculate the capacitance from charge/discharge.
This is useful for bigger capacitors for faster measurement.
Workspace: capacitor.dwf3work

image.thumb.png.ed022ad97dd9c67e73885144d0e097f7.png

Resistor:

1000

Capacitance:

var res = Channel.measure("Resistor") // 1000
var hz = Time.Rate.real // sample rate
var data = Channel.visibledata
var samples = data.length-1

var vpeak = 100
var ipeak = -1
var v = 0
var v2 = 0
var v3 = 0
var charge = false
var charge2 = false
var charge3 = false

var value = 0
var count = 0

for(var i = 0; i <= samples; i++){
    v3 = v2
    v2 = v
    v = data[i]
    charge3 = charge2
    charge2 = charge
    if(v2!=v) charge = v>v2
    // filter charge/discharge start detection from noise
    if((charge3!=charge2 && charge2==charge) || i==samples){
        if(ipeak>=0 && i-ipeak>10){ // make sure to have sufficient samples
            var d = vpeak/v3
            if(d<1) d = 1.0/d
            if(d>3){ // make sure to have significant voltage difference
                value += (i-ipeak-2)/hz/logn(d)/res
                count++
            }
        }
        ipeak = i // store index for time calculation
        vpeak = v // and peak voltage for next measurement
    }
}
count?value/count:0 // average

 

3. In order to measure the energy, WF v3.8.12 will add integrate feature for math channels.
This adds initialization option where you can declare global variables, like one to store the sum.
Workspace: energy.dwf3work

image.png.6475cc77a5b0c0915c0abd6437e08374.png

image.thumb.png.0412966056b4d4a4907cb3ab003f8177.png

 

4. To measure the charge:
Workspace: charge.dwf3work

image.png.a893a758e488acd499d76d7dc4fc59cc.png

image.thumb.png.520cd53c2489bbf0ff24e6962c8ea609.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...