Eksperimendid alalisvooluga

Valter Kiisk
TÜ Füüsika Instituut
Viimati muudetud: 30.03.2020
$\renewcommand{\vec}[1]{{\bf #1}}$ $\newcommand{\aver}[1]{\langle #1 \rangle}$ $\newcommand{\eps}{\varepsilon}$

Selles juhendis kirjeldatakse lihtsate arvutijuhitavate alalisvoolumõõtmiste realiseerimist Jupyteri keskkonnas, kasutades programmeerimiskeelena Pythonit. Käsitletakse eksperimente, kus pinge ja vool muutuvad võrdlemisi aeglaselt (sekundite diapasoonis või aeglasemalt), nii et hetksignaali mõõtmiseks saab kasutada tavalist (arvutiühendusega) multimeetrit. Lisaks läheb tarvis ka arvutiga juhitavat toiteallikat, mille digitaalset volt- või ampermeetrit saab kasutada täiendava mõõteriistana.

Katsevahendid

Seda laadi lihtsamad seadmed ühenduvad arvutiga järjestikliidese kaudu (RS232 standard). Kaasaegsetel arvutitel reeglina füüsilist jadaväratit enam ei ole, kuid need saab tekitada vastava USB lisaseadmega (pildil näitena 4 pordiga seade). Paljud aparaadid kasutavad virtuaalset jadaväratit, nii et need seadmed ühenduvad arvutiga otse USB kaabliga. Füüsiline RS232 liides ei vaja mingit lisatarkvara, USB-RS232 üleminek vajab siiski draiverit. Jadaväratiga seadmete juhtimine on võrdlemisi lihtne ja seisneb sageli lihtsalt teksti kujul käskude/info saatmisel/vastuvõtmisel. Vastav käsustik/andmete formaat on üldiselt iga seadme jaoks spetsiifiline.

Järgnevates katsetes multimeetriks on UNI-T UT61E. See võtab 2 lugemit sekundis ja maksimaalne näit on 22000. Üle jadavärati edastatavate andmete formaat on kirjeldatud siin.

Toiteallikaks on KORAD KD3005P (0–30 V, 0–5 A). Selle käsustik on kirjeldatud siin ja siin. On ka teisi mudeleid identse või sarnase funktsionaalsuse ja käsustikuga (nt Velleman PS3005D).

Ettevalmistused

Pythonis saab mugavalt järjestikpordiga suhelda kasutades teeki pySerial. Sõltuvalt kasutatavast Pythoni distributsioonist saab selle installeerida kas paketihalduri pip või conda abil:

pip install pyserial

või

conda install -c conda-forge pyserial

Lisaks on vaja vahendeid graafikute tegemiseks (matplotlib), aja mõõtmist/viivitamist (time) ja mudeli sobitamist vähimruutude meetodil (scipy.optimize.curve_fit).

In [1]:
import numpy as np
from matplotlib.pyplot import *
from matplotlib import rcParams
from serial import *
import serial.tools.list_ports as list_ports
import time
from scipy.optimize import curve_fit
In [2]:
%matplotlib notebook

Graafikute üldise kujunduse seadistamine:

In [51]:
rcParams['figure.figsize'] = 4, 3
rcParams['figure.dpi'] = 120
rcParams['lines.markersize'] = 6
rcParams['lines.markeredgewidth'] = 1
rcParams['axes.titlesize'] = 'medium'
rcParams['savefig.dpi'] = 200

Kuvame loetelu jadaväratitest. Tulemus võiks sarnaneda sellega, mida näitab ka Windowsi kontrollpaneel (Control Panel/Hardware and Sound/Device Manager/Ports).

In [3]:
for p in list(list_ports.comports()):
    print(p)
COM6 - Standard Serial over Bluetooth link (COM6)
COM3 - Intel(R) Active Management Technology - SOL (COM3)
COM1 - High-Speed USB Serial Port (COM1)
COM2 - High-Speed USB Serial Port (COM2)
COM8 - High-Speed USB Serial Port (COM8)
COM9 - High-Speed USB Serial Port (COM9)
COM7 - Standard Serial over Bluetooth link (COM7)

Olles identifitseerinud pordid, mille külge aparaadid on ühendatud, jätame need edaspidiseks meelde:

In [4]:
COM_MM = 'COM1' # multimeeter
COM_PS = 'COM2' # toiteallikas

Seadmete programmeerimine

Mõistlik on iga konkreetse seadme juhtimine kapseldada omaette klassi. Kuna mingil määral on erinevatel seadmetel siiski ühine funktsionaalsus, tasub kasutada ka polümorfismi, st ühine funktsionaalsus realiseerida baasklassis ja sellest tuletada erinevad klassid vastavate konkreetsete seadmete jaoks.

Pythonis klassid defineeritakse võtmesõnaga class. Klassi mistahes meetodi defineerimisel esimeseks argumendiks on muutuja, mis viitab antud objektile (klassi eksemplarile), tavaliselt nimega self. Objekti liikmetele (nt muutujale serial) pääseb siis ligi kujul self.serial. Klassi koosseisus on ka spetsiaalseid meetodeid, mille nimi algab ja lõpeb kahe allkriipsuga. Näiteks klassi konstruktor on nimega __init__.

Esmalt loome baasklassi mistahes jadaväratiga seadmega suhtlemiseks:

In [77]:
class SerialDevice:
    def __init__(self, port):
        self.init()
        self.serial.port = port
    
    def open(self):
        if not self.serial.is_open:
            self.serial.open()
        
    def close(self):
        if self.serial.is_open:
            self.serial.close()
        
    def __enter__(self):
        self.open()
        return self
    
    def __exit__(self, type, value, traceback):
        self.close()

Selle koosseisus on meetodid open ja close, nii et seadme kasutamise sessioon näeb välja nii:

seade = Seade('COM1'):
seade.open()
# eksperiment
seade.close()

Siin Seade tähistab klassi, mis on tuletatud baasklassist SerialDevice, ning 'COM1' on konstruktori parameeter.

Seevastu meetodid __enter__ ja __exit__ lubavad teha sedasama mõnevõrra mugavamal kujul

with Seade('COM1') as seade:
    # eksperiment

kus meetod open käivitatakse automaatselt with-bloki alguses ja meetod close lõpus. Seejuures viimane käivitatakse ka juhul kui with-blokis peaks tekkima programmiviga.

Siin ja edaspidi konstruktori ainsaks argumendiks on jadavärati nimi. Jadavärati seadistamine (andmevahetuskiirus, bittide arvud, jne) peab aset leidma meetodis init(), kus luuakse ka vastav Serial objekt. Selliseid seadistusi teab vaid tuletatud klass, mis on konkreetse aparaadiga seotud, seega meetod init() on baasklassis defineerimata.

Multimeeter

Järgmine klass loeb multimeetri UNI-T UT61E näidu. Multimeeter saadab andmeid pidevalt, umbes kaks lugemit sekundis. Andmepakett on 14 baiti, millest kaks baiti on realõpusümbolid (\n ja \r, ASCII koodid vastavalt 10 ja 13). Meetod lugem kontrollib, kas sisendpuhvris on uusi andmeid, interpreteerib jooksvalt iga tuvastatud 12 baidi pikkuse andmepaketi ja tagastab viimase lugemi.

In [6]:
class UT61E(SerialDevice):
    ANDMED = {
        48: { 48: -3 }, # 10 A
        59: {48: -4, 49: -3, 50: -2, 51: -1, 52: -5}, # voldid
        61: {48: -8, 49: -7}, # auto uA
        63: {48: -6, 49: -5} # auto mA
    }
    
    def init(self):
        self.serial = Serial(
            baudrate = 19230, bytesize = SEVENBITS, parity = PARITY_ODD,
            stopbits = STOPBITS_ONE
        )
        self.serial.rts = False
        self.baidid = []
        self.ootab_reavahetust = True
        
    def lugem(self):
        lugem = None
        for b in self.serial.read_all():
            if b == 10 or b == 13:
                if self.ootab_reavahetust:
                    self.ootab_reavahetust = False
                elif len(self.baidid) > 0:
                    lugem = self.teisenda()
            elif not self.ootab_reavahetust:
                self.baidid.append(b)
        return lugem
        
    def teisenda(self):
        baidid = bytearray(self.baidid)
        self.baidid.clear()
        
        if len(baidid) != 12:
            raise IOError("UT61E: loeti vale arv baite '%s'" % baidid.decode())

        olek = baidid[7]
        negat = olek & 0x4 == 0x4  # negatiivne väärtus?
        
        if olek & 0x1 == 0x1:  # ületäitumine?
            return float('-inf') if negat else float('inf')

        lugem = int(baidid[1:6])
        if negat:
            lugem = -lugem;

        režiim = baidid[6]
        piirkond = baidid[0]

        if režiim not in UT61E.ANDMED:
            raise IOError("UT61E: tundmatu režiim '%d'" % režiim)
        
        piirkonnad = UT61E.ANDMED[režiim]
        if piirkond not in piirkonnad:
            raise IOError("UT61E: tundmatu tööpiirkond '%d'" % piirkond)
        
        aste = piirkonnad[piirkond]
        return lugem * 10**aste

Minimalistlik kood multimeetri testimiseks, nt lugemi võtmine iga sekundi tagant, kokku kolm mõõtmist:

In [98]:
with UT61E(COM_MM) as mm:
    for i in range(3):
        time.sleep(1)
        print('%.4f' % mm.lugem())
-0.0042
0.0019
-0.0038

Kuna antud multimeeter väljastab 2 lugemit sekundis, siis pooled neist lähevad antud näites kaotsi. Kõigi mõõtepunktide registreerimiseks tuleks tsükli aeg teha lühemaks kui 0,5 s, aga siis tuleb ka kontrollida, kas mm.lugem() tagastab arvulise väärtuse või None.

In [10]:
with UT61E(COM_MM) as mm:
    lugemite_arv = 0
    while lugemite_arv < 3:
        lugem = mm.lugem()
        if lugem is not None:
            print('%.4f' % lugem)
            lugemite_arv += 1
-0.0004
-0.0004
-0.0004

Toiteplokk

Kuna sarnaseid, vaid üksikutes detailides erinevaid toiteplokke on mitmeid, teeme esmalt baasklassi, mis kätkeb ühist funktsionaalsust. Meetodeid pinge ja vool saab välja kutsuda ühe argumendiga või ilma. Esimesel juhul seatakse vastav toiteploki režiim. Näiteks pinge(4.5) seab maksimaalse pinge 4,5 volti. Seejuures tuleks anda seadmele ka 2–3 sekundit aega uue seisundi stabiliseerimiseks.

Kui meetodid pinge ja vool kutsuda välja ilma argumentideta, siis tagastatakse vastavalt volt- või ampermeetri näit. Klassi Serial parameeter timeout = 1 annab mõista, et seadmele antakse reageerimiseks aega kuni 1 sekund.

In [7]:
class PSU(SerialDevice):
    def init(self):
        self.serial = Serial(
            baudrate = 9600, bytesize = EIGHTBITS, parity = PARITY_NONE,
            stopbits = STOPBITS_ONE, timeout = 1
        )
        
    def pinge(self, pinge=None):
        if pinge is None:
            self.serial.reset_input_buffer()
            self.serial.write('VOUT1?'.encode())
            baidid = self.serial.read(size=5)
            if len(baidid) < 5:
                raise IOError("UT61E: loeti vähem kui 5 baiti '%s'" % baidid.decode())
            return float(baidid)
        
        self.serial.write(('VSET1:%05.2f' % pinge).encode())
        
    def vool(self, vool=None):
        if vool is None:
            self.serial.reset_input_buffer()
            self.serial.write('IOUT1?'.encode())
            baidid = self.serial.read(size=5)
            if len(baidid) < 5:
                raise IOError("UT61E: loeti vähem kui 5 baiti '%s'" % baidid.decode())
            return float(baidid)
    
        self.serial.write(('ISET1:%05.3f' % vool).encode())

Toiteplokil KD3005P on väljund püsivalt aktiivne, aga PS3005D võimaldab seda sisse/välja lülitada:

In [8]:
class PS3005D(PSU):
    def toide_peale(self):
        self.serial.write('OUT1'.encode())
        
    def toide_maha(self):
        self.serial.write('OUT0'.encode())
        
class KD3005P(PSU):
    def toide_peale(self):
        pass  # ei tee midagi, funktsioon puudub
        
    def toide_maha(self):
        pass  # ei tee midagi, funktsioon puudub

Edaspidi kasutame seadet KD3005P ja seega arvutijuhitavat toite lülitamise võimalust ei ole.

Kontrolliks seame pinge ja voolu piirid ning loeme näidikute väärtused:

In [103]:
with KD3005P(COM_PS) as ps:
    ps.pinge(2)
    time.sleep(1)
    ps.vool(0.2)
    time.sleep(1)
    print('%.2f' % ps.pinge())
    print('%.3f' % ps.vool())
2.00
0.000

Kuna ahel oli avatud, siis pinge saavutas seatud maksimumväärtuse ja voolutugevus jäi nulliks.

Toiteploki näidikute täpsus

Kontrollimaks toiteploki pingenäidiku täpsust, mõõdame pinget toiteploki klemmidel multimeetriga ja võrdleme saadud näite.

In [95]:
U_set = np.arange(0.5, 28, 0.5)
with UT61E(COM_MM) as mm:
    with KD3005P(COM_PS) as ps:
        U_ps = []
        U_mm = []
        for U in U_set:
            ps.pinge(U)
            time.sleep(3)
            U_mm.append(mm.lugem())
            U_ps.append(ps.pinge())
            print('U_set = %4.1f, U_ps = %5.2f, U_mm = %7.4f' % (U, U_ps[-1], U_mm[-1]))
        ps.pinge(1)
        
U_ps = np.array(U_ps)
U_mm = np.array(U_mm)
U_set =  0.5, U_ps =  0.50, U_mm =  0.4981
U_set =  1.0, U_ps =  1.00, U_mm =  0.9965
U_set =  1.5, U_ps =  1.50, U_mm =  1.4990
U_set =  2.0, U_ps =  2.00, U_mm =  2.0002
U_set =  2.5, U_ps =  2.50, U_mm =  2.4940
U_set =  3.0, U_ps =  3.00, U_mm =  3.0000
U_set =  3.5, U_ps =  3.50, U_mm =  3.4950
U_set =  4.0, U_ps =  4.00, U_mm =  4.0000
U_set =  4.5, U_ps =  4.50, U_mm =  4.4940
U_set =  5.0, U_ps =  5.00, U_mm =  4.9920
U_set =  5.5, U_ps =  5.50, U_mm =  5.4950
U_set =  6.0, U_ps =  6.00, U_mm =  5.9980
U_set =  6.5, U_ps =  6.50, U_mm =  6.4930
U_set =  7.0, U_ps =  7.00, U_mm =  6.9920
U_set =  7.5, U_ps =  7.50, U_mm =  7.4950
U_set =  8.0, U_ps =  8.00, U_mm =  7.9970
U_set =  8.5, U_ps =  8.50, U_mm =  8.4970
U_set =  9.0, U_ps =  9.00, U_mm =  8.9960
U_set =  9.5, U_ps =  9.50, U_mm =  9.4970
U_set = 10.0, U_ps = 10.00, U_mm =  9.9920
U_set = 10.5, U_ps = 10.50, U_mm = 10.4940
U_set = 11.0, U_ps = 11.00, U_mm = 10.9960
U_set = 11.5, U_ps = 11.50, U_mm = 11.4940
U_set = 12.0, U_ps = 12.00, U_mm = 11.9970
U_set = 12.5, U_ps = 12.50, U_mm = 12.4950
U_set = 13.0, U_ps = 13.00, U_mm = 12.9980
U_set = 13.5, U_ps = 13.50, U_mm = 13.4970
U_set = 14.0, U_ps = 14.00, U_mm = 13.9940
U_set = 14.5, U_ps = 14.50, U_mm = 14.4960
U_set = 15.0, U_ps = 15.00, U_mm = 14.9980
U_set = 15.5, U_ps = 15.50, U_mm = 15.4960
U_set = 16.0, U_ps = 16.00, U_mm = 15.9990
U_set = 16.5, U_ps = 16.50, U_mm = 16.5070
U_set = 17.0, U_ps = 17.00, U_mm = 17.0080
U_set = 17.5, U_ps = 17.50, U_mm = 17.5060
U_set = 18.0, U_ps = 18.00, U_mm = 18.0010
U_set = 18.5, U_ps = 18.50, U_mm = 18.5030
U_set = 19.0, U_ps = 19.00, U_mm = 19.0050
U_set = 19.5, U_ps = 19.50, U_mm = 19.5060
U_set = 20.0, U_ps = 20.00, U_mm = 20.0010
U_set = 20.5, U_ps = 20.50, U_mm = 20.5100
U_set = 21.0, U_ps = 21.00, U_mm = 21.0040
U_set = 21.5, U_ps = 21.50, U_mm = 21.5030
U_set = 22.0, U_ps = 22.00, U_mm = 22.0100
U_set = 22.5, U_ps = 22.50, U_mm = 22.4900
U_set = 23.0, U_ps = 23.00, U_mm = 22.9900
U_set = 23.5, U_ps = 23.50, U_mm = 23.4900
U_set = 24.0, U_ps = 24.00, U_mm = 23.9900
U_set = 24.5, U_ps = 24.50, U_mm = 24.4800
U_set = 25.0, U_ps = 25.00, U_mm = 24.9900
U_set = 25.5, U_ps = 25.50, U_mm = 25.4900
U_set = 26.0, U_ps = 26.00, U_mm = 25.9900
U_set = 26.5, U_ps = 26.50, U_mm = 26.4900
U_set = 27.0, U_ps = 27.00, U_mm = 26.9900
U_set = 27.5, U_ps = 27.50, U_mm = 27.4900
In [47]:
ΔU = np.sqrt(np.mean(np.square(U_ps - U_mm)))
print('ruutkeskmine erinevus = %.3f V' % ΔU)
ruutkeskmine erinevus = 0.007 V

Analoogiliselt võrdleme ampermeetrite näite:

In [96]:
I_set = np.arange(0.01, 0.22, 0.01)
with UT61E(COM_MM) as mm:
    with KD3005P(COM_PS) as ps:
        I_ps = []
        I_mm = []
        for I in I_set:
            ps.vool(I)
            time.sleep(3)
            I_mm.append(mm.lugem())
            I_ps.append(ps.vool())
            print('I_set = %.2f, I_ps = %.3f, I_mm = %.5f' % (I, I_ps[-1], I_mm[-1]))
        ps.vool(0.01)
        
I_ps = np.array(I_ps)
I_mm = np.array(I_mm)
I_set = 0.01, I_ps = 0.009, I_mm = 0.01192
I_set = 0.02, I_ps = 0.019, I_mm = 0.02076
I_set = 0.03, I_ps = 0.028, I_mm = 0.03119
I_set = 0.04, I_ps = 0.039, I_mm = 0.04152
I_set = 0.05, I_ps = 0.049, I_mm = 0.05175
I_set = 0.06, I_ps = 0.058, I_mm = 0.06209
I_set = 0.07, I_ps = 0.070, I_mm = 0.07225
I_set = 0.08, I_ps = 0.079, I_mm = 0.08228
I_set = 0.09, I_ps = 0.089, I_mm = 0.09113
I_set = 0.10, I_ps = 0.100, I_mm = 0.10288
I_set = 0.11, I_ps = 0.109, I_mm = 0.11168
I_set = 0.12, I_ps = 0.119, I_mm = 0.12175
I_set = 0.13, I_ps = 0.129, I_mm = 0.13209
I_set = 0.14, I_ps = 0.140, I_mm = 0.14226
I_set = 0.15, I_ps = 0.149, I_mm = 0.15261
I_set = 0.16, I_ps = 0.160, I_mm = 0.16284
I_set = 0.17, I_ps = 0.170, I_mm = 0.17289
I_set = 0.18, I_ps = 0.178, I_mm = 0.18169
I_set = 0.19, I_ps = 0.191, I_mm = 0.19345
I_set = 0.20, I_ps = 0.199, I_mm = 0.20230
I_set = 0.21, I_ps = 0.210, I_mm = 0.21247
In [60]:
ΔI = np.sqrt(np.mean(np.square(I_ps - I_mm)))
print('ruutkeskmine erinevus = %.4f A' % ΔI)
ruutkeskmine erinevus = 0.0029 A

Milliamprite piirkonnas mõõtes jääb täpsusest 3 mA siiski väheks, seetõttu järgnevas kasutame sekundaarse mõõteriistana vaid toiteploki voltmeetrit. Sel juhul voolutugevuse mõõtmiseks tuleb lihtsalt ahelasse lisada järjestikku paraja suurusega takisti ja mõõta multimeetriga sellel tekkivat pingelangu.

Hõõglambi voltamperkarakteristik

Koostame joonisel kujutatud elektriskeemi. Hõõglamp on ühendatud järjestikku paraja suurusega takistiga. Multimeetriga mõõdetakse takistil tekkivat pingelangu ja selle järgi voolutugevust ahelas. Toiteploki väljundpinge ja takisti pingelangu vahe kaudu saame teada ka pinge lambil.

Alternatiivselt võiks multimeetriga mõõta pinget lambil. Optimaalne variant sõltub komponentide valikust. Ideaalis võiks mõlemad mõõteriistad töötada üle kogu oma mõõtepiirkonna, ning voltmeetrite näidud peaksid olema oluliselt erinevad, et kahe pingenäidu lahutamisel ei tekiks suurt suhtelist viga.

In [5]:
U_set = np.arange(0.5, 15.1, 0.5)
U_ps = []
U_mm = []
with UT61E(COM_MM) as mm:
    with KD3005P(COM_PS) as ps:
        for U in U_set:
            ps.pinge(U)
            time.sleep(3)
            U_mm.append(mm.lugem())
            U_ps.append(ps.pinge())
            print('U_ps = %5.2f, U_mm = %.4f' % (U_ps[-1], U_mm[-1]))
        ps.pinge(1)

U_ps = np.array(U_ps)
U_mm = np.array(U_mm)
U_ps =  0.50, U_mm = 0.2792
U_ps =  1.00, U_mm = 0.4784
U_ps =  1.50, U_mm = 0.6116
U_ps =  2.00, U_mm = 0.7271
U_ps =  2.50, U_mm = 0.8395
U_ps =  3.00, U_mm = 0.9474
U_ps =  3.50, U_mm = 1.0470
U_ps =  4.00, U_mm = 1.1429
U_ps =  4.50, U_mm = 1.2334
U_ps =  5.00, U_mm = 1.3220
U_ps =  5.50, U_mm = 1.4084
U_ps =  6.00, U_mm = 1.4913
U_ps =  6.50, U_mm = 1.5694
U_ps =  7.00, U_mm = 1.6468
U_ps =  7.50, U_mm = 1.7225
U_ps =  8.00, U_mm = 1.7956
U_ps =  8.50, U_mm = 1.8670
U_ps =  9.00, U_mm = 1.9366
U_ps =  9.50, U_mm = 2.0050
U_ps = 10.00, U_mm = 2.0708
U_ps = 10.50, U_mm = 2.1361
U_ps = 11.00, U_mm = 2.2004
U_ps = 11.50, U_mm = 2.2620
U_ps = 12.00, U_mm = 2.3230
U_ps = 12.50, U_mm = 2.3830
U_ps = 13.00, U_mm = 2.4420
U_ps = 13.50, U_mm = 2.4990
U_ps = 14.00, U_mm = 2.5550
U_ps = 14.50, U_mm = 2.6040
U_ps = 15.00, U_mm = 2.6620

Teostame esmased arvutused ja graafikud. Alati salvestame vähemalt otsesed mõõtmistulemused, et neid saaks edaspidi failist laadida ja analüüsida ilma katset kordamata.

In [10]:
fail = 'lambi_voltamper'
takistus = 20.5
U_lamp = U_ps - U_mm
I_lamp = U_mm / takistus
np.savetxt(fail + '.txt', np.column_stack((U_ps, U_mm, U_lamp, I_lamp)), fmt='%.8f')

plot(U_lamp, I_lamp, 'r.')
xlabel('Pinge (V)')
ylabel('Vool (A)')
grid()
savefig(fail + '.png', bbox_inches='tight')
show()

Edasiseks analüüsiks võime kasutada äsja mõõdetud andmeid (kui need on veel arvuti mälus) või vajadusel taastame need failist:

In [72]:
U_ps, U_mm, U_lamp, I_lamp = np.loadtxt('lambi_voltamper.txt').T

Lihtsaim hõõglambi mudel ennustab pinge ja voolu vahel astmeseost: $I=aU^b$.

In [9]:
mudel = lambda U, a, b: a*U**b

a, b = 0.1, 0.5
(a, b), _ = curve_fit(mudel, U_lamp, I_lamp, (a, b))
print('a = %.3f, b = %.3f' % (a, b))

U = np.linspace(0, 13, 100)
plot(U_lamp, I_lamp, 'r.')
plot(U, mudel(U, a, b), 'b-')
xlabel('Pinge (V)')
ylabel('Vool (A)')
grid()
savefig(fail + '_mudel.png', bbox_inches='tight')
show()
a = 0.031, b = 0.573

Dioodi voltamperkarakteristik

Seekord on mõistlik multimeetriga mõõta pinget dioodil, kuna pärast dioodi avanemist dioodi pinge muutub võrdlemisi aeglaselt.

In [13]:
U_set = np.geomspace(0.25, 7.1, 25)

U_ps = []
U_mm = []
with UT61E(COM_MM) as mm:
    with KD3005P(COM_PS) as ps:
        for U in U_set:
            ps.pinge(U)
            time.sleep(3)
            U_mm.append(mm.lugem())
            U_ps.append(ps.pinge())
            print('U_ps = %.2f, U_mm = %.4f' % (U_ps[-1], U_mm[-1]))
        ps.pinge(1)

U_ps = np.array(U_ps)
U_mm = np.array(U_mm)
U_ps = 0.25, U_mm = 0.2524
U_ps = 0.29, U_mm = 0.2867
U_ps = 0.33, U_mm = 0.3275
U_ps = 0.38, U_mm = 0.3830
U_ps = 0.44, U_mm = 0.4382
U_ps = 0.50, U_mm = 0.4898
U_ps = 0.58, U_mm = 0.5507
U_ps = 0.66, U_mm = 0.5907
U_ps = 0.76, U_mm = 0.6222
U_ps = 0.88, U_mm = 0.6467
U_ps = 1.01, U_mm = 0.6637
U_ps = 1.16, U_mm = 0.6789
U_ps = 1.33, U_mm = 0.6909
U_ps = 1.53, U_mm = 0.7019
U_ps = 1.76, U_mm = 0.7119
U_ps = 2.02, U_mm = 0.7208
U_ps = 2.33, U_mm = 0.7296
U_ps = 2.68, U_mm = 0.7374
U_ps = 3.08, U_mm = 0.7448
U_ps = 3.54, U_mm = 0.7519
U_ps = 4.06, U_mm = 0.7587
U_ps = 4.67, U_mm = 0.7656
U_ps = 5.37, U_mm = 0.7720
U_ps = 6.18, U_mm = 0.7784
U_ps = 7.10, U_mm = 0.7847
In [14]:
fail = 'dioodi_voltamper'
takistus = 20.5
U_diood = U_mm
I_diood = (U_ps - U_mm) / takistus
np.savetxt(fail + '.txt', np.column_stack((U_ps, U_diood, I_diood)), fmt='%.8f')

plot(U_diood, I_diood, 'r.')
xlabel('Pinge (V)')
ylabel('Vool (A)')
grid()
savefig(fail + '.png', bbox_inches='tight')
show()

Shockley dioodi mudel ennustab $$I=I_\text{s}\left[\exp\left(\frac{U}{nU_T}\right)-1\right],$$ kus $I_s$ on küllastav vool vastupingestatud dioodis, $U_T=k_\text{B}T/q$ (toatemperatuuril 25,4 mV) ja $n$ iseloomustab dioodi ideaalsust.

In [18]:
U_T = 0.025421
mudel = lambda U, I_s, n: I_s * (np.exp(U/(n * U_T)) - 1)
I_s, n = 1e-14, 1

(I_s, n), _ = curve_fit(mudel, U_diood, I_diood, (I_s, n))
print('I_s = %.3g A, n = %.2f' % (I_s, n))

U = np.linspace(0.2, 0.79, 100)
plot(U_diood, I_diood, 'r.')
plot(U, mudel(U, I_s, n), 'b-')
xlabel('Pinge (V)')
ylabel('Vool (A)')
grid()
savefig(fail + '_mudel.png', bbox_inches='tight')
show()
I_s = 1.14e-09 A, n = 1.59

Aku tühjenemine

Tühjendame täis laetud NiMH-aku üle mõistliku suurusega takisti, jälgides aku pinge muutumist multimeetriga. Teades takistust, saame ühtlasi teada voolutugevuse ja selle kaudu elektrilaengu. Seega selles katses on vaja vaid multimeetrit.

In [99]:
aeg = []
pinge = []

with UT61E(COM_MM) as mm:
    time.sleep(2)
    t0 = time.time()
    while True:
        aeg.append(time.time() - t0)
        pinge.append(mm.lugem())
        print('aeg = %6.1f s;  pinge = %6.4f V' % (aeg[-1], pinge[-1]))
        if (pinge[-1] < 0.5):
            break
        time.sleep(5)

aeg = np.array(aeg)
pinge = np.array(pinge)
aeg =    0.0 s;  pinge = 1.3014 V
aeg =    5.0 s;  pinge = 1.3009 V
aeg =   10.0 s;  pinge = 1.3004 V
aeg =   15.0 s;  pinge = 1.2999 V
aeg =   20.0 s;  pinge = 1.2996 V
aeg =   25.0 s;  pinge = 1.2992 V
aeg =   30.0 s;  pinge = 1.2988 V
aeg =   35.0 s;  pinge = 1.2985 V
aeg =   40.0 s;  pinge = 1.2982 V
aeg =   45.0 s;  pinge = 1.2979 V
aeg =   50.0 s;  pinge = 1.2976 V
aeg =   55.0 s;  pinge = 1.2973 V
aeg =   60.0 s;  pinge = 1.2970 V
aeg =   65.0 s;  pinge = 1.2968 V
aeg =   70.0 s;  pinge = 1.2965 V
aeg =   75.0 s;  pinge = 1.2963 V
aeg =   80.0 s;  pinge = 1.2961 V
aeg =   85.0 s;  pinge = 1.2958 V
aeg =   90.0 s;  pinge = 1.2955 V
aeg =   95.0 s;  pinge = 1.2953 V
aeg =  100.0 s;  pinge = 1.2951 V
aeg =  105.0 s;  pinge = 1.2949 V
aeg =  110.0 s;  pinge = 1.2947 V
aeg =  115.0 s;  pinge = 1.2945 V
aeg =  120.0 s;  pinge = 1.2942 V
aeg =  125.0 s;  pinge = 1.2940 V
aeg =  130.0 s;  pinge = 1.2939 V
aeg =  135.1 s;  pinge = 1.2937 V
aeg =  140.1 s;  pinge = 1.2934 V
aeg =  145.1 s;  pinge = 1.2933 V
aeg =  150.1 s;  pinge = 1.2931 V
aeg =  155.1 s;  pinge = 1.2929 V
aeg =  160.1 s;  pinge = 1.2927 V
aeg =  165.1 s;  pinge = 1.2926 V
aeg =  170.1 s;  pinge = 1.2923 V
aeg =  175.1 s;  pinge = 1.2922 V
aeg =  180.1 s;  pinge = 1.2920 V
aeg =  185.1 s;  pinge = 1.2918 V
aeg =  190.1 s;  pinge = 1.2917 V
aeg =  195.1 s;  pinge = 1.2915 V
aeg =  200.1 s;  pinge = 1.2913 V
aeg =  205.1 s;  pinge = 1.2912 V
aeg =  210.1 s;  pinge = 1.2910 V
aeg =  215.1 s;  pinge = 1.2909 V
aeg =  220.1 s;  pinge = 1.2907 V
aeg =  225.1 s;  pinge = 1.2906 V
aeg =  230.1 s;  pinge = 1.2904 V
aeg =  235.1 s;  pinge = 1.2903 V
aeg =  240.1 s;  pinge = 1.2901 V
aeg =  245.1 s;  pinge = 1.2899 V
aeg =  250.1 s;  pinge = 1.2898 V
aeg =  255.1 s;  pinge = 1.2896 V
aeg =  260.1 s;  pinge = 1.2895 V
aeg =  265.1 s;  pinge = 1.2893 V
aeg =  270.1 s;  pinge = 1.2892 V
aeg =  275.1 s;  pinge = 1.2891 V
aeg =  280.1 s;  pinge = 1.2889 V
aeg =  285.1 s;  pinge = 1.2888 V
aeg =  290.1 s;  pinge = 1.2886 V
aeg =  295.1 s;  pinge = 1.2885 V
aeg =  300.1 s;  pinge = 1.2884 V
aeg =  305.1 s;  pinge = 1.2882 V
aeg =  310.1 s;  pinge = 1.2881 V
aeg =  315.1 s;  pinge = 1.2879 V
aeg =  320.1 s;  pinge = 1.2879 V
...

Teades aega ja voolutugevust, saame ülekantud elektrilaengu leida integreerimise teel (näiteks trapetsmeetodiga).

In [175]:
fail = 'aku_tühjenemine'
takistus = 7.23
vool = pinge / takistus
np.savetxt(fail + '.txt', np.column_stack((aeg, pinge, vool)), fmt='%.8f')

print('Mahtuvus %.3g mAh' % (np.trapz(vool, aeg) * (1000 / 3600)))

plot(aeg, pinge, 'r-')
xlabel('Aeg (s)')
ylabel('Pinge (V)')
grid()
tight_layout()
savefig(fail + '.png', bbox_inches='tight')
show()
Mahtuvus 982 mAh

Kondensaator

Laadumine

Kondensaatori laadumise uurimiseks koostame joonisel kujutatud elektriskeemi. Eelnevalt veendume, et kondensaator on tühjaks laetud. Toiteplokile on seatud kindla suurusega pinge (ja seda ei ole tarvis arvutist juhtida). Käivitame mõõtmise ja mõne hetke pärast sulgeme lüliti.

Nendes katsetes kasutame superkondensaatorit nimimahtuvusega $C=$ 1,5 F, nii et isegi võrdlemisi väikese takistuse $R$ puhul on ajakonstant $RC$ minutite diapasoonis ja seega pinge muutused kergesti jälgitavad.

In [37]:
aeg = []
pinge = []

with UT61E(COM_MM) as mm:
    t0 = time.time()
    while True:
        lugem = mm.lugem()
        if lugem is not None:
            aeg.append(time.time() - t0)
            pinge.append(lugem)
            print('aeg = %6.1f s;  pinge = %6.3f V' % (aeg[-1], pinge[-1]))
            if aeg[-1] > 4000:
                break
        time.sleep(0.1)

aeg = np.array(aeg)
pinge = np.array(pinge)
aeg =    0.1 s;  pinge =  0.000 V
aeg =    0.6 s;  pinge =  0.000 V
aeg =    1.1 s;  pinge =  0.000 V
aeg =    1.6 s;  pinge =  0.000 V
aeg =    2.1 s;  pinge =  0.000 V
aeg =    2.6 s;  pinge =  0.000 V
aeg =    3.1 s;  pinge =  0.000 V
aeg =    3.6 s;  pinge =  0.000 V
aeg =    4.1 s;  pinge =  0.000 V
aeg =    4.6 s;  pinge =  0.000 V
aeg =    5.2 s;  pinge =  0.000 V
aeg =    5.7 s;  pinge =  0.000 V
aeg =    6.2 s;  pinge =  0.000 V
aeg =    6.7 s;  pinge =  0.000 V
aeg =    7.2 s;  pinge =  0.000 V
aeg =    7.7 s;  pinge =  0.000 V
aeg =    8.2 s;  pinge =  0.000 V
aeg =    8.7 s;  pinge =  0.000 V
aeg =    9.2 s;  pinge =  0.000 V
aeg =    9.6 s;  pinge =  0.014 V
aeg =   10.1 s;  pinge =  0.023 V
aeg =   10.6 s;  pinge =  0.032 V
aeg =   11.1 s;  pinge =  0.041 V
aeg =   11.6 s;  pinge =  0.050 V
aeg =   12.1 s;  pinge =  0.059 V
aeg =   12.6 s;  pinge =  0.068 V
aeg =   13.1 s;  pinge =  0.077 V
aeg =   13.6 s;  pinge =  0.086 V
aeg =   14.2 s;  pinge =  0.095 V
aeg =   14.7 s;  pinge =  0.104 V
aeg =   15.2 s;  pinge =  0.112 V
aeg =   15.7 s;  pinge =  0.121 V
aeg =   16.2 s;  pinge =  0.130 V
aeg =   16.7 s;  pinge =  0.130 V
aeg =   17.2 s;  pinge =  0.147 V
aeg =   17.7 s;  pinge =  0.156 V
aeg =   18.2 s;  pinge =  0.165 V
aeg =   18.6 s;  pinge =  0.173 V
aeg =   19.1 s;  pinge =  0.182 V
aeg =   19.6 s;  pinge =  0.190 V
aeg =   20.1 s;  pinge =  0.199 V
aeg =   20.6 s;  pinge =  0.208 V
aeg =   21.1 s;  pinge =  0.216 V
aeg =   21.6 s;  pinge =  0.225 V
aeg =   22.1 s;  pinge =  0.233 V
aeg =   22.6 s;  pinge =  0.242 V
aeg =   23.1 s;  pinge =  0.250 V
aeg =   23.7 s;  pinge =  0.250 V
aeg =   24.2 s;  pinge =  0.267 V
aeg =   24.7 s;  pinge =  0.276 V
aeg =   25.2 s;  pinge =  0.284 V
aeg =   25.7 s;  pinge =  0.293 V
aeg =   26.2 s;  pinge =  0.301 V
aeg =   26.7 s;  pinge =  0.301 V
aeg =   27.2 s;  pinge =  0.318 V
aeg =   27.7 s;  pinge =  0.326 V
aeg =   28.1 s;  pinge =  0.335 V
aeg =   28.6 s;  pinge =  0.343 V
aeg =   29.1 s;  pinge =  0.351 V
aeg =   29.6 s;  pinge =  0.360 V
aeg =   30.1 s;  pinge =  0.368 V
aeg =   30.6 s;  pinge =  0.376 V
aeg =   31.1 s;  pinge =  0.384 V
aeg =   31.6 s;  pinge =  0.393 V
aeg =   32.1 s;  pinge =  0.401 V
aeg =   32.6 s;  pinge =  0.401 V
aeg =   33.1 s;  pinge =  0.417 V
aeg =   33.7 s;  pinge =  0.426 V
aeg =   34.2 s;  pinge =  0.434 V
aeg =   34.7 s;  pinge =  0.442 V
aeg =   35.2 s;  pinge =  0.450 V
aeg =   35.7 s;  pinge =  0.450 V
aeg =   36.2 s;  pinge =  0.467 V
aeg =   36.7 s;  pinge =  0.475 V
aeg =   37.2 s;  pinge =  0.483 V
aeg =   37.6 s;  pinge =  0.491 V
aeg =   38.1 s;  pinge =  0.499 V
aeg =   38.6 s;  pinge =  0.507 V
aeg =   39.1 s;  pinge =  0.515 V
aeg =   39.6 s;  pinge =  0.524 V
aeg =   40.1 s;  pinge =  0.532 V
aeg =   40.6 s;  pinge =  0.540 V
aeg =   41.1 s;  pinge =  0.548 V
aeg =   41.6 s;  pinge =  0.556 V
aeg =   42.1 s;  pinge =  0.564 V
aeg =   42.7 s;  pinge =  0.572 V
aeg =   43.2 s;  pinge =  0.580 V
aeg =   43.7 s;  pinge =  0.580 V
aeg =   44.2 s;  pinge =  0.596 V
aeg =   44.7 s;  pinge =  0.604 V
aeg =   45.2 s;  pinge =  0.612 V
aeg =   45.7 s;  pinge =  0.620 V
aeg =   46.2 s;  pinge =  0.628 V
aeg =   46.6 s;  pinge =  0.636 V
aeg =   47.1 s;  pinge =  0.644 V
aeg =   47.6 s;  pinge =  0.652 V
aeg =   48.1 s;  pinge =  0.660 V
aeg =   48.6 s;  pinge =  0.660 V
aeg =   49.1 s;  pinge =  0.675 V
aeg =   49.6 s;  pinge =  0.683 V
aeg =   50.1 s;  pinge =  0.691 V
aeg =   50.6 s;  pinge =  0.691 V
aeg =   51.1 s;  pinge =  0.707 V
aeg =   51.6 s;  pinge =  0.715 V
aeg =   52.2 s;  pinge =  0.722 V
aeg =   52.7 s;  pinge =  0.730 V
aeg =   53.2 s;  pinge =  0.738 V
aeg =   53.7 s;  pinge =  0.746 V
aeg =   54.2 s;  pinge =  0.754 V
aeg =   54.7 s;  pinge =  0.761 V
aeg =   55.2 s;  pinge =  0.769 V
aeg =   55.7 s;  pinge =  0.777 V
aeg =   56.2 s;  pinge =  0.785 V
aeg =   56.6 s;  pinge =  0.792 V
aeg =   57.1 s;  pinge =  0.800 V
aeg =   57.6 s;  pinge =  0.800 V
...
In [41]:
fail = 'kondensaatori_laadumine'
np.savetxt(fail + '.txt', np.column_stack((aeg, pinge)), fmt='%.8f')

plot(aeg, pinge, 'r-')
xlabel('Aeg (s)')
ylabel('Pinge (V)')
grid()
tight_layout()
savefig(fail + '.png', bbox_inches='tight')
show()
In [82]:
aeg, pinge = np.loadtxt('kondensaatori_laadumine.txt').T

Kui saadud graafikut suumida, on näha, et alguses mõned hetked (enne lüliti L2 sulgemist) on pinge null. Eemaldame need andmepunktid ja nihutame vastavalt ajatelge. Ühtlasi arvutame voolutugevuse.

In [83]:
toitepinge = 9.994
takistus = 506.7

laadub = aeg > 9.1

aeg = aeg[laadub]
aeg -= aeg[0]
pinge = pinge[laadub]
vool = (toitepinge - pinge) / takistus

Kui kondensaatorit mahtuvusega $C$ laaditakse konstantse pingega $U_0$ üle takisti $R$, siis kondensaatori pinge kasvab ajas järgmiselt: $$U(t)=U_0\left[1-\exp\left(-\frac{t}{CR}\right)\right].$$ Teiste sõnadega, voolutugevus kahaneb eksponentsiaalselt: $$I(t)=\frac{U_0-U(t)}{R}=I_0\exp\left(-\frac{t}{CR}\right).$$ See mudel põhineb eeldusel, et kondensaatori laeng on võrdeline pingega, $Q=CU$ (st mahtuvus $C$ on konstantne), ja kondensaatoril endal mingit täiendavat relaksatsiooniaega ei ole. Selgub, et superkondensaatori (ja ka mõnede elektrolüütkondensaatorite) korral need eeldused ei pea paika, sest ioonide difundeerumine ja laengu relakseerumine poorsetel elektroodidel on võrdlemisi keerulised ja aeglased protsessid.

Seega voolutugevuse käik logaritmilisel graafikul ei tule päris sirge:

In [84]:
plot(aeg, vool, 'r-')
yscale('log')
xlabel('Aeg (s)')
ylabel('Vool (A)')
grid()
tight_layout()
savefig(fail + '_vool.png', bbox_inches='tight')
show()

Kui saadud sõltuvuse algusosa lähendada sirgele, saame vastavas lähenduses siiski mahtuvust hinnata:

In [85]:
n = len(aeg) // 5  # esimene viiendik andmepunktidest

# lähendame parabooliga, aga kasutame vaid selle algtõusu
_, tõus, algordinaat = np.polyfit(aeg[:n], np.log(vool[:n]), 2)
mahtuvus = -1 / (takistus * tõus)

print('Mahtuvus %.3f F' % mahtuvus)

t = np.linspace(0, 2100, 100)
plot(aeg, vool, 'r-', label='katse')
plot(t, np.exp(tõus * t + algordinaat), 'b--', label='lineaarne mudel')
yscale('log')
xlabel('Aeg (s)')
ylabel('Vool (A)')
axvline(aeg[n], color='red', lw=0.5)
grid()
legend()
tight_layout()
savefig(fail + '_mudel.png', bbox_inches='tight')
show()
Algmahtuvus 1.186 F

Tühjenemine

Seame toiteallikale mõistliku suurusega pinge ja voolu, ja laadime sellega kondensaatori. Seejärel asetame kondensaatori näidatud elektriskeemi, käivitame mõõtmise ning mõne hetke pärast sulgeme lüliti.

In [72]:
aeg = []
pinge = []

with UT61E(COM_MM) as mm:
    t0 = time.time()
    while True:
        lugem = mm.lugem()
        if lugem is not None:
            aeg.append(time.time() - t0)
            pinge.append(lugem)
            print('aeg = %6.1f s;  pinge = %6.3f V' % (aeg[-1], pinge[-1]))
            if aeg[-1] > 6000:
                break
        time.sleep(0.1)

aeg = np.array(aeg)
pinge = np.array(pinge)
aeg =    0.3 s;  pinge =  9.993 V
aeg =    0.9 s;  pinge =  9.993 V
aeg =    1.3 s;  pinge =  9.993 V
aeg =    1.8 s;  pinge =  9.993 V
aeg =    2.4 s;  pinge =  9.993 V
aeg =    2.9 s;  pinge =  9.993 V
aeg =    3.3 s;  pinge =  9.993 V
aeg =    3.9 s;  pinge =  9.993 V
aeg =    4.4 s;  pinge =  9.993 V
aeg =    4.8 s;  pinge =  9.993 V
aeg =    5.4 s;  pinge =  9.993 V
aeg =    5.9 s;  pinge =  9.993 V
aeg =    6.3 s;  pinge =  9.993 V
aeg =    6.9 s;  pinge =  9.993 V
aeg =    7.3 s;  pinge =  9.993 V
aeg =    7.8 s;  pinge =  9.993 V
aeg =    8.4 s;  pinge =  9.993 V
aeg =    8.8 s;  pinge =  9.993 V
aeg =    9.3 s;  pinge =  9.993 V
aeg =    9.9 s;  pinge =  9.992 V
aeg =   10.3 s;  pinge =  9.992 V
aeg =   10.8 s;  pinge =  9.993 V
aeg =   11.4 s;  pinge =  9.993 V
aeg =   11.9 s;  pinge =  9.993 V
aeg =   12.3 s;  pinge =  9.993 V
aeg =   12.9 s;  pinge =  9.992 V
aeg =   13.4 s;  pinge =  9.992 V
aeg =   13.8 s;  pinge =  9.992 V
aeg =   14.3 s;  pinge =  9.988 V
aeg =   14.9 s;  pinge =  9.977 V
aeg =   15.3 s;  pinge =  9.969 V
aeg =   15.8 s;  pinge =  9.961 V
aeg =   16.4 s;  pinge =  9.953 V
aeg =   16.8 s;  pinge =  9.946 V
aeg =   17.3 s;  pinge =  9.939 V
aeg =   17.9 s;  pinge =  9.931 V
aeg =   18.3 s;  pinge =  9.924 V
aeg =   18.8 s;  pinge =  9.916 V
aeg =   19.4 s;  pinge =  9.909 V
aeg =   19.8 s;  pinge =  9.901 V
aeg =   20.4 s;  pinge =  9.894 V
aeg =   20.9 s;  pinge =  9.887 V
aeg =   21.3 s;  pinge =  9.887 V
aeg =   21.8 s;  pinge =  9.872 V
aeg =   22.4 s;  pinge =  9.865 V
aeg =   22.8 s;  pinge =  9.858 V
aeg =   23.3 s;  pinge =  9.858 V
aeg =   23.9 s;  pinge =  9.843 V
aeg =   24.3 s;  pinge =  9.836 V
aeg =   24.9 s;  pinge =  9.829 V
aeg =   25.3 s;  pinge =  9.829 V
aeg =   25.8 s;  pinge =  9.815 V
aeg =   26.3 s;  pinge =  9.807 V
aeg =   26.9 s;  pinge =  9.801 V
aeg =   27.3 s;  pinge =  9.793 V
aeg =   27.9 s;  pinge =  9.786 V
aeg =   28.3 s;  pinge =  9.779 V
aeg =   28.8 s;  pinge =  9.772 V
aeg =   29.4 s;  pinge =  9.765 V
aeg =   29.8 s;  pinge =  9.758 V
aeg =   30.3 s;  pinge =  9.758 V
aeg =   30.9 s;  pinge =  9.743 V
aeg =   31.3 s;  pinge =  9.736 V
aeg =   31.8 s;  pinge =  9.730 V
aeg =   32.4 s;  pinge =  9.723 V
aeg =   32.9 s;  pinge =  9.715 V
aeg =   33.3 s;  pinge =  9.709 V
aeg =   33.9 s;  pinge =  9.702 V
aeg =   34.3 s;  pinge =  9.695 V
aeg =   34.8 s;  pinge =  9.687 V
aeg =   35.4 s;  pinge =  9.687 V
aeg =   35.9 s;  pinge =  9.674 V
aeg =   36.3 s;  pinge =  9.666 V
aeg =   36.9 s;  pinge =  9.659 V
aeg =   37.3 s;  pinge =  9.659 V
aeg =   37.8 s;  pinge =  9.646 V
aeg =   38.4 s;  pinge =  9.639 V
aeg =   38.9 s;  pinge =  9.632 V
aeg =   39.3 s;  pinge =  9.625 V
aeg =   39.8 s;  pinge =  9.618 V
aeg =   40.4 s;  pinge =  9.618 V
aeg =   40.8 s;  pinge =  9.604 V
aeg =   41.4 s;  pinge =  9.597 V
aeg =   41.8 s;  pinge =  9.591 V
aeg =   42.3 s;  pinge =  9.584 V
aeg =   42.9 s;  pinge =  9.577 V
aeg =   43.4 s;  pinge =  9.577 V
aeg =   43.8 s;  pinge =  9.563 V
aeg =   44.3 s;  pinge =  9.556 V
aeg =   44.9 s;  pinge =  9.549 V
aeg =   45.3 s;  pinge =  9.549 V
aeg =   45.8 s;  pinge =  9.536 V
aeg =   46.4 s;  pinge =  9.529 V
aeg =   46.8 s;  pinge =  9.522 V
aeg =   47.3 s;  pinge =  9.515 V
aeg =   47.9 s;  pinge =  9.508 V
aeg =   48.4 s;  pinge =  9.508 V
aeg =   48.8 s;  pinge =  9.495 V
aeg =   49.3 s;  pinge =  9.488 V
aeg =   49.8 s;  pinge =  9.481 V
aeg =   50.3 s;  pinge =  9.475 V
aeg =   50.8 s;  pinge =  9.468 V
aeg =   51.4 s;  pinge =  9.468 V
aeg =   51.8 s;  pinge =  9.454 V
aeg =   52.3 s;  pinge =  9.447 V
aeg =   52.9 s;  pinge =  9.441 V
aeg =   53.3 s;  pinge =  9.434 V
aeg =   53.8 s;  pinge =  9.427 V
aeg =   54.4 s;  pinge =  9.427 V
aeg =   54.8 s;  pinge =  9.414 V
aeg =   55.3 s;  pinge =  9.407 V
aeg =   55.9 s;  pinge =  9.401 V
aeg =   56.3 s;  pinge =  9.394 V
aeg =   56.9 s;  pinge =  9.387 V
aeg =   57.3 s;  pinge =  9.387 V
aeg =   57.8 s;  pinge =  9.374 V
aeg =   58.4 s;  pinge =  9.367 V
aeg =   58.8 s;  pinge =  9.361 V
aeg =   59.4 s;  pinge =  9.354 V
aeg =   59.8 s;  pinge =  9.347 V
aeg =   60.3 s;  pinge =  9.347 V
aeg =   60.9 s;  pinge =  9.334 V
aeg =   61.3 s;  pinge =  9.327 V
aeg =   61.9 s;  pinge =  9.320 V
aeg =   62.3 s;  pinge =  9.314 V
aeg =   62.8 s;  pinge =  9.307 V
aeg =   63.4 s;  pinge =  9.307 V
aeg =   63.8 s;  pinge =  9.294 V
aeg =   64.4 s;  pinge =  9.288 V
aeg =   64.8 s;  pinge =  9.281 V
...
In [74]:
fail = 'kondensaatori_tühjenemine'
np.savetxt(fail + '.txt', np.column_stack((aeg, pinge)), fmt='%.8f')

plot(aeg, pinge, 'r-')
xlabel('Aeg (s)')
ylabel('Pinge (V)')
grid()
tight_layout()
savefig(fail + '.png', bbox_inches='tight')
show()
In [75]:
tühjeneb = aeg > 13.7

aeg = aeg[tühjeneb]
aeg -= aeg[0]
pinge = pinge[tühjeneb]
vool = pinge / takistus
In [79]:
n = len(aeg) // 4
_, tõus, algordinaat = np.polyfit(aeg[:n], np.log(pinge[:n]), 2)
mahtuvus = -1 / (takistus * tõus)

print('Algmahtuvus %.3f F' % mahtuvus)

t = np.linspace(0, 3500, 100)
plot(aeg, pinge, 'r-', label='katse')
plot(t, np.exp(tõus * t + algordinaat), 'b--', label='lineaarne mudel')
yscale('log')
xlabel('Aeg (s)')
ylabel('Pinge (V)')
axvline(aeg[n], color='red', lw=0.5)
grid()
legend()
tight_layout()
savefig(fail + '_mudel.png', bbox_inches='tight')
show()
Algmahtuvus 1.395 F

Laengu sõltuvus pingest

Et täpsemalt karakteriseerida sellise kondensaatori omadusi, püüame mõõta kondensaatorisse kogunenud laengu sõltuvuse rakendatud pingest. Selleks laadime kondensaatorit läbi takisti, ja takistil tekkiva pingelangu järgi saame jälgida voolutugevuse muutumist. Voolutugevuse integreerimise teel saame hiljem arvutada ülekantud laengu. Toiteploki pinget tõstame 2 V sammuga. Pärast toitepinge tõstmist ootame, kuni voolutugevus muutub piisavalt väikeseks. Seejuures me muidugi eeldame, et kondensaatori isetühjenemine (lekkevoolu tõttu) toimub oluliselt pikemates ajamastaapides ja seda võib ignoreerida.

In [11]:
U_set = np.arange(2, 10.1, 2.0)
takistus = 20.5
andmed = []

with UT61E(COM_MM) as mm:
    with KD3005P(COM_PS) as ps:
        for U in U_set:
            print('======= toitepinge = %5.2f V =======' % U)
            time.sleep(1)
            ajutine = []
            t0 = time.time()
            ps.pinge(U)
            while True:
                pinge = mm.lugem()
                aeg = time.time() - t0
                if pinge is not None:
                    print('aeg = %5.1f s, pinge = %6.4f V' % (aeg, pinge))
                    ajutine.append((aeg, pinge, pinge / takistus))
                    if aeg > 1500 or (aeg > 100 and pinge < 0.002):
                        break
                time.sleep(0.1)
            andmed.append(np.array(ajutine))
======= toitepinge =  2.00 V =======
aeg =   0.0 s, pinge = -0.0001 V
aeg =   0.4 s, pinge = 1.9462 V
aeg =   1.0 s, pinge = 1.9009 V
aeg =   1.4 s, pinge = 1.8586 V
aeg =   1.9 s, pinge = 1.8179 V
aeg =   2.4 s, pinge = 1.7785 V
aeg =   3.0 s, pinge = 1.7402 V
aeg =   3.4 s, pinge = 1.7029 V
aeg =   3.9 s, pinge = 1.6665 V
aeg =   4.5 s, pinge = 1.6310 V
aeg =   4.9 s, pinge = 1.5963 V
aeg =   5.4 s, pinge = 1.5626 V
aeg =   6.0 s, pinge = 1.5295 V
aeg =   6.4 s, pinge = 1.4973 V
aeg =   6.9 s, pinge = 1.4659 V
aeg =   7.5 s, pinge = 1.4351 V
aeg =   7.9 s, pinge = 1.4051 V
aeg =   8.4 s, pinge = 1.3758 V
aeg =   9.0 s, pinge = 1.3471 V
aeg =   9.4 s, pinge = 1.3191 V
aeg =   9.9 s, pinge = 1.2918 V
aeg =  10.5 s, pinge = 1.2651 V
aeg =  10.9 s, pinge = 1.2389 V
aeg =  11.4 s, pinge = 1.2134 V
aeg =  12.0 s, pinge = 1.1885 V
aeg =  12.4 s, pinge = 1.1641 V
aeg =  12.9 s, pinge = 1.1402 V
aeg =  13.5 s, pinge = 1.1169 V
aeg =  13.9 s, pinge = 1.0941 V
aeg =  14.4 s, pinge = 1.0718 V
aeg =  15.0 s, pinge = 1.0500 V
aeg =  15.4 s, pinge = 1.0287 V
aeg =  15.9 s, pinge = 1.0079 V
aeg =  16.5 s, pinge = 0.9875 V
aeg =  16.9 s, pinge = 0.9676 V
aeg =  17.4 s, pinge = 0.9480 V
aeg =  18.0 s, pinge = 0.9290 V
aeg =  18.4 s, pinge = 0.9103 V
aeg =  18.9 s, pinge = 0.8921 V
aeg =  19.5 s, pinge = 0.8742 V
aeg =  19.9 s, pinge = 0.8567 V
aeg =  20.4 s, pinge = 0.8397 V
aeg =  21.0 s, pinge = 0.8229 V
aeg =  21.4 s, pinge = 0.8066 V
aeg =  21.9 s, pinge = 0.7906 V
aeg =  22.5 s, pinge = 0.7749 V
aeg =  22.9 s, pinge = 0.7596 V
aeg =  23.4 s, pinge = 0.7446 V
aeg =  24.0 s, pinge = 0.7299 V
aeg =  24.4 s, pinge = 0.7155 V
aeg =  24.9 s, pinge = 0.7015 V
aeg =  25.4 s, pinge = 0.6877 V
aeg =  26.0 s, pinge = 0.6743 V
aeg =  26.4 s, pinge = 0.6610 V
aeg =  26.9 s, pinge = 0.6482 V
aeg =  27.5 s, pinge = 0.6356 V
aeg =  27.9 s, pinge = 0.6232 V
aeg =  28.5 s, pinge = 0.6111 V
aeg =  29.0 s, pinge = 0.5992 V
aeg =  29.4 s, pinge = 0.5876 V
aeg =  30.0 s, pinge = 0.5763 V
aeg =  30.4 s, pinge = 0.5651 V
aeg =  30.9 s, pinge = 0.5543 V
aeg =  31.5 s, pinge = 0.5436 V
aeg =  31.9 s, pinge = 0.5332 V
aeg =  32.4 s, pinge = 0.5229 V
aeg =  33.0 s, pinge = 0.5129 V
aeg =  33.4 s, pinge = 0.5031 V
aeg =  33.9 s, pinge = 0.4935 V
aeg =  34.5 s, pinge = 0.4841 V
aeg =  34.9 s, pinge = 0.4749 V
aeg =  35.4 s, pinge = 0.4659 V
aeg =  36.0 s, pinge = 0.4571 V
aeg =  36.4 s, pinge = 0.4484 V
aeg =  36.9 s, pinge = 0.4400 V
aeg =  37.5 s, pinge = 0.4317 V
aeg =  37.9 s, pinge = 0.4235 V
aeg =  38.4 s, pinge = 0.4156 V
aeg =  39.0 s, pinge = 0.4078 V
aeg =  39.4 s, pinge = 0.4001 V
aeg =  39.9 s, pinge = 0.3927 V
aeg =  40.5 s, pinge = 0.3853 V
aeg =  40.9 s, pinge = 0.3782 V
aeg =  41.4 s, pinge = 0.3711 V
...
======= toitepinge =  4.00 V =======
aeg =   0.0 s, pinge = 0.0020 V
aeg =   0.5 s, pinge = 1.9485 V
aeg =   1.0 s, pinge = 1.9049 V
aeg =   1.5 s, pinge = 1.8639 V
aeg =   1.9 s, pinge = 1.8243 V
aeg =   2.5 s, pinge = 1.7860 V
aeg =   3.0 s, pinge = 1.7487 V
aeg =   3.4 s, pinge = 1.7124 V
aeg =   4.0 s, pinge = 1.6770 V
aeg =   4.5 s, pinge = 1.6426 V
aeg =   4.9 s, pinge = 1.6089 V
aeg =   5.5 s, pinge = 1.5761 V
aeg =   6.0 s, pinge = 1.5441 V
aeg =   6.4 s, pinge = 1.5128 V
aeg =   7.0 s, pinge = 1.4822 V
aeg =   7.5 s, pinge = 1.4524 V
aeg =   8.0 s, pinge = 1.4232 V
aeg =   8.5 s, pinge = 1.3948 V
aeg =   9.0 s, pinge = 1.3669 V
aeg =   9.5 s, pinge = 1.3397 V
aeg =  10.0 s, pinge = 1.3131 V
aeg =  10.4 s, pinge = 1.2872 V
aeg =  11.0 s, pinge = 1.2618 V
aeg =  11.5 s, pinge = 1.2369 V
aeg =  12.0 s, pinge = 1.2126 V
aeg =  12.5 s, pinge = 1.1889 V
aeg =  13.0 s, pinge = 1.1656 V
aeg =  13.5 s, pinge = 1.1429 V
aeg =  14.0 s, pinge = 1.1207 V
aeg =  14.4 s, pinge = 1.0990 V
aeg =  15.0 s, pinge = 1.0777 V
aeg =  15.5 s, pinge = 1.0569 V
aeg =  16.0 s, pinge = 1.0366 V
aeg =  16.5 s, pinge = 1.0166 V
aeg =  17.0 s, pinge = 0.9971 V
aeg =  17.5 s, pinge = 0.9780 V
aeg =  18.0 s, pinge = 0.9594 V
aeg =  18.4 s, pinge = 0.9411 V
aeg =  19.0 s, pinge = 0.9232 V
aeg =  19.5 s, pinge = 0.9057 V
aeg =  20.0 s, pinge = 0.8885 V
aeg =  20.5 s, pinge = 0.8717 V
aeg =  21.0 s, pinge = 0.8553 V
aeg =  21.5 s, pinge = 0.8392 V
aeg =  22.0 s, pinge = 0.8235 V
aeg =  22.5 s, pinge = 0.8080 V
aeg =  23.0 s, pinge = 0.7929 V
aeg =  23.5 s, pinge = 0.7781 V
aeg =  24.0 s, pinge = 0.7636 V
aeg =  24.4 s, pinge = 0.7494 V
aeg =  25.0 s, pinge = 0.7355 V
aeg =  25.5 s, pinge = 0.7219 V
aeg =  25.9 s, pinge = 0.7086 V
aeg =  26.5 s, pinge = 0.6955 V
aeg =  27.0 s, pinge = 0.6827 V
aeg =  27.4 s, pinge = 0.6702 V
aeg =  28.0 s, pinge = 0.6579 V
aeg =  28.5 s, pinge = 0.6458 V
aeg =  29.0 s, pinge = 0.6341 V
aeg =  29.5 s, pinge = 0.6225 V
aeg =  29.9 s, pinge = 0.6112 V
aeg =  30.5 s, pinge = 0.6000 V
aeg =  31.0 s, pinge = 0.5891 V
aeg =  31.5 s, pinge = 0.5785 V
aeg =  32.0 s, pinge = 0.5681 V
aeg =  32.5 s, pinge = 0.5578 V
aeg =  33.0 s, pinge = 0.5478 V
aeg =  33.5 s, pinge = 0.5380 V
aeg =  34.0 s, pinge = 0.5283 V
aeg =  34.5 s, pinge = 0.5189 V
aeg =  35.0 s, pinge = 0.5097 V
aeg =  35.5 s, pinge = 0.5006 V
aeg =  36.0 s, pinge = 0.4916 V
aeg =  36.5 s, pinge = 0.4829 V
aeg =  37.0 s, pinge = 0.4744 V
aeg =  37.5 s, pinge = 0.4660 V
aeg =  38.0 s, pinge = 0.4578 V
aeg =  38.5 s, pinge = 0.4497 V
aeg =  38.9 s, pinge = 0.4418 V
aeg =  39.5 s, pinge = 0.4340 V
aeg =  40.0 s, pinge = 0.4265 V
aeg =  40.5 s, pinge = 0.4190 V
aeg =  41.0 s, pinge = 0.4117 V
aeg =  41.5 s, pinge = 0.4046 V
...
======= toitepinge =  6.00 V =======
aeg =   0.0 s, pinge = 0.0026 V
aeg =   0.5 s, pinge = 1.9453 V
aeg =   1.1 s, pinge = 1.9044 V
aeg =   1.5 s, pinge = 1.8654 V
aeg =   2.0 s, pinge = 1.8279 V
aeg =   2.6 s, pinge = 1.7914 V
aeg =   3.0 s, pinge = 1.7560 V
aeg =   3.5 s, pinge = 1.7214 V
aeg =   4.0 s, pinge = 1.6877 V
aeg =   4.5 s, pinge = 1.6548 V
aeg =   5.0 s, pinge = 1.6227 V
aeg =   5.5 s, pinge = 1.5913 V
aeg =   6.0 s, pinge = 1.5607 V
aeg =   6.5 s, pinge = 1.5308 V
aeg =   7.1 s, pinge = 1.5015 V
aeg =   7.5 s, pinge = 1.4729 V
aeg =   8.0 s, pinge = 1.4449 V
aeg =   8.5 s, pinge = 1.4176 V
aeg =   9.0 s, pinge = 1.3908 V
aeg =   9.5 s, pinge = 1.3647 V
aeg =  10.0 s, pinge = 1.3391 V
aeg =  10.5 s, pinge = 1.3140 V
aeg =  11.1 s, pinge = 1.2895 V
aeg =  11.5 s, pinge = 1.2656 V
aeg =  12.0 s, pinge = 1.2421 V
aeg =  12.5 s, pinge = 1.2191 V
aeg =  13.0 s, pinge = 1.1967 V
aeg =  13.5 s, pinge = 1.1747 V
aeg =  14.1 s, pinge = 1.1531 V
aeg =  14.5 s, pinge = 1.1320 V
aeg =  15.0 s, pinge = 1.1114 V
aeg =  15.5 s, pinge = 1.0911 V
aeg =  16.0 s, pinge = 1.0713 V
aeg =  16.5 s, pinge = 1.0518 V
aeg =  17.0 s, pinge = 1.0328 V
aeg =  17.5 s, pinge = 1.0142 V
aeg =  18.0 s, pinge = 0.9959 V
aeg =  18.5 s, pinge = 0.9781 V
aeg =  19.0 s, pinge = 0.9605 V
aeg =  19.5 s, pinge = 0.9434 V
aeg =  20.1 s, pinge = 0.9265 V
aeg =  20.5 s, pinge = 0.9101 V
aeg =  21.0 s, pinge = 0.8939 V
aeg =  21.5 s, pinge = 0.8780 V
aeg =  22.0 s, pinge = 0.8625 V
aeg =  22.6 s, pinge = 0.8473 V
aeg =  23.0 s, pinge = 0.8324 V
aeg =  23.5 s, pinge = 0.8178 V
aeg =  24.0 s, pinge = 0.8035 V
aeg =  24.5 s, pinge = 0.7894 V
aeg =  25.0 s, pinge = 0.7756 V
aeg =  25.5 s, pinge = 0.7621 V
aeg =  26.0 s, pinge = 0.7488 V
aeg =  26.6 s, pinge = 0.7359 V
aeg =  27.0 s, pinge = 0.7231 V
aeg =  27.5 s, pinge = 0.7106 V
aeg =  28.1 s, pinge = 0.6984 V
aeg =  28.5 s, pinge = 0.6864 V
aeg =  29.0 s, pinge = 0.6746 V
aeg =  29.5 s, pinge = 0.6630 V
aeg =  30.0 s, pinge = 0.6517 V
aeg =  30.5 s, pinge = 0.6406 V
aeg =  31.0 s, pinge = 0.6297 V
aeg =  31.5 s, pinge = 0.6190 V
aeg =  32.1 s, pinge = 0.6085 V
aeg =  32.5 s, pinge = 0.5982 V
aeg =  33.0 s, pinge = 0.5881 V
aeg =  33.5 s, pinge = 0.5782 V
aeg =  34.0 s, pinge = 0.5684 V
aeg =  34.5 s, pinge = 0.5589 V
aeg =  35.0 s, pinge = 0.5495 V
aeg =  35.6 s, pinge = 0.5403 V
aeg =  36.0 s, pinge = 0.5313 V
aeg =  36.5 s, pinge = 0.5225 V
aeg =  37.0 s, pinge = 0.5137 V
aeg =  37.5 s, pinge = 0.5052 V
aeg =  38.0 s, pinge = 0.4969 V
aeg =  38.6 s, pinge = 0.4887 V
aeg =  39.0 s, pinge = 0.4806 V
aeg =  39.5 s, pinge = 0.4727 V
aeg =  40.1 s, pinge = 0.4649 V
aeg =  40.5 s, pinge = 0.4573 V
aeg =  41.0 s, pinge = 0.4499 V
aeg =  41.5 s, pinge = 0.4425 V
...
======= toitepinge =  8.00 V =======
aeg =   0.0 s, pinge = 0.0045 V
aeg =   0.5 s, pinge = 1.9517 V
aeg =   0.9 s, pinge = 1.9123 V
aeg =   1.4 s, pinge = 1.8750 V
aeg =   1.9 s, pinge = 1.8391 V
aeg =   2.5 s, pinge = 1.8043 V
aeg =   3.0 s, pinge = 1.7704 V
aeg =   3.5 s, pinge = 1.7372 V
aeg =   4.0 s, pinge = 1.7049 V
aeg =   4.5 s, pinge = 1.6734 V
aeg =   4.9 s, pinge = 1.6425 V
aeg =   5.4 s, pinge = 1.6124 V
aeg =   5.9 s, pinge = 1.5830 V
aeg =   6.5 s, pinge = 1.5541 V
aeg =   7.0 s, pinge = 1.5259 V
aeg =   7.5 s, pinge = 1.4984 V
aeg =   8.0 s, pinge = 1.4713 V
aeg =   8.5 s, pinge = 1.4449 V
aeg =   9.0 s, pinge = 1.4190 V
aeg =   9.5 s, pinge = 1.3938 V
aeg =  10.0 s, pinge = 1.3690 V
aeg =  10.4 s, pinge = 1.3447 V
aeg =  10.9 s, pinge = 1.3210 V
aeg =  11.4 s, pinge = 1.2977 V
aeg =  12.0 s, pinge = 1.2749 V
aeg =  12.5 s, pinge = 1.2526 V
aeg =  13.0 s, pinge = 1.2307 V
aeg =  13.5 s, pinge = 1.2092 V
aeg =  14.0 s, pinge = 1.1882 V
aeg =  14.4 s, pinge = 1.1676 V
aeg =  14.9 s, pinge = 1.1474 V
aeg =  15.4 s, pinge = 1.1277 V
aeg =  16.0 s, pinge = 1.1083 V
aeg =  16.5 s, pinge = 1.0892 V
aeg =  17.0 s, pinge = 1.0706 V
aeg =  17.4 s, pinge = 1.0524 V
aeg =  17.9 s, pinge = 1.0345 V
aeg =  18.5 s, pinge = 1.0169 V
aeg =  19.0 s, pinge = 0.9997 V
aeg =  19.5 s, pinge = 0.9828 V
aeg =  20.0 s, pinge = 0.9662 V
aeg =  20.5 s, pinge = 0.9500 V
aeg =  21.0 s, pinge = 0.9340 V
aeg =  21.5 s, pinge = 0.9184 V
aeg =  21.9 s, pinge = 0.9031 V
aeg =  22.4 s, pinge = 0.8880 V
aeg =  22.9 s, pinge = 0.8733 V
aeg =  23.5 s, pinge = 0.8588 V
aeg =  24.0 s, pinge = 0.8446 V
aeg =  24.5 s, pinge = 0.8306 V
aeg =  25.0 s, pinge = 0.8170 V
aeg =  25.5 s, pinge = 0.8035 V
aeg =  26.0 s, pinge = 0.7904 V
aeg =  26.5 s, pinge = 0.7775 V
aeg =  26.9 s, pinge = 0.7648 V
aeg =  27.4 s, pinge = 0.7524 V
aeg =  27.9 s, pinge = 0.7401 V
aeg =  28.4 s, pinge = 0.7281 V
aeg =  29.0 s, pinge = 0.7163 V
aeg =  29.5 s, pinge = 0.7048 V
aeg =  30.0 s, pinge = 0.6935 V
aeg =  30.5 s, pinge = 0.6823 V
aeg =  31.0 s, pinge = 0.6714 V
aeg =  31.4 s, pinge = 0.6606 V
aeg =  31.9 s, pinge = 0.6501 V
aeg =  32.4 s, pinge = 0.6397 V
aeg =  32.9 s, pinge = 0.6296 V
aeg =  33.5 s, pinge = 0.6196 V
aeg =  34.0 s, pinge = 0.6098 V
aeg =  34.5 s, pinge = 0.6002 V
aeg =  35.0 s, pinge = 0.5908 V
aeg =  35.5 s, pinge = 0.5815 V
aeg =  36.0 s, pinge = 0.5724 V
aeg =  36.5 s, pinge = 0.5634 V
aeg =  36.9 s, pinge = 0.5546 V
aeg =  37.4 s, pinge = 0.5460 V
aeg =  37.9 s, pinge = 0.5375 V
aeg =  38.4 s, pinge = 0.5292 V
aeg =  39.0 s, pinge = 0.5210 V
aeg =  39.5 s, pinge = 0.5130 V
aeg =  40.0 s, pinge = 0.5050 V
aeg =  40.5 s, pinge = 0.4973 V
aeg =  41.0 s, pinge = 0.4897 V
aeg =  41.5 s, pinge = 0.4822 V
...
======= toitepinge = 10.00 V =======
aeg =   0.0 s, pinge = 0.0059 V
aeg =   0.5 s, pinge = 1.9473 V
aeg =   1.1 s, pinge = 1.9101 V
aeg =   1.5 s, pinge = 1.8747 V
aeg =   2.0 s, pinge = 1.8403 V
aeg =   2.5 s, pinge = 1.8070 V
aeg =   3.0 s, pinge = 1.7745 V
aeg =   3.6 s, pinge = 1.7427 V
aeg =   4.0 s, pinge = 1.7118 V
aeg =   4.5 s, pinge = 1.6815 V
aeg =   5.1 s, pinge = 1.6519 V
aeg =   5.5 s, pinge = 1.6229 V
aeg =   6.0 s, pinge = 1.5945 V
aeg =   6.6 s, pinge = 1.5668 V
aeg =   7.0 s, pinge = 1.5396 V
aeg =   7.5 s, pinge = 1.5131 V
aeg =   8.1 s, pinge = 1.4871 V
aeg =   8.5 s, pinge = 1.4616 V
aeg =   9.0 s, pinge = 1.4366 V
aeg =   9.6 s, pinge = 1.4121 V
aeg =  10.0 s, pinge = 1.3882 V
aeg =  10.5 s, pinge = 1.3647 V
aeg =  11.1 s, pinge = 1.3417 V
aeg =  11.5 s, pinge = 1.3191 V
aeg =  12.0 s, pinge = 1.2970 V
aeg =  12.6 s, pinge = 1.2754 V
aeg =  13.0 s, pinge = 1.2540 V
aeg =  13.6 s, pinge = 1.2332 V
aeg =  14.0 s, pinge = 1.2128 V
aeg =  14.5 s, pinge = 1.1928 V
aeg =  15.1 s, pinge = 1.1732 V
aeg =  15.5 s, pinge = 1.1539 V
aeg =  16.0 s, pinge = 1.1351 V
aeg =  16.6 s, pinge = 1.1165 V
aeg =  17.0 s, pinge = 1.0983 V
aeg =  17.5 s, pinge = 1.0804 V
aeg =  18.1 s, pinge = 1.0630 V
aeg =  18.5 s, pinge = 1.0458 V
aeg =  19.0 s, pinge = 1.0290 V
aeg =  19.6 s, pinge = 1.0125 V
aeg =  20.0 s, pinge = 0.9962 V
aeg =  20.5 s, pinge = 0.9804 V
aeg =  21.1 s, pinge = 0.9648 V
aeg =  21.5 s, pinge = 0.9494 V
aeg =  22.0 s, pinge = 0.9344 V
aeg =  22.6 s, pinge = 0.9196 V
aeg =  23.0 s, pinge = 0.9051 V
aeg =  23.5 s, pinge = 0.8908 V
aeg =  24.1 s, pinge = 0.8769 V
aeg =  24.5 s, pinge = 0.8632 V
aeg =  25.0 s, pinge = 0.8498 V
aeg =  25.6 s, pinge = 0.8365 V
aeg =  26.0 s, pinge = 0.8235 V
aeg =  26.5 s, pinge = 0.8107 V
aeg =  27.1 s, pinge = 0.7983 V
aeg =  27.6 s, pinge = 0.7860 V
aeg =  28.0 s, pinge = 0.7739 V
aeg =  28.5 s, pinge = 0.7620 V
aeg =  29.1 s, pinge = 0.7504 V
aeg =  29.5 s, pinge = 0.7389 V
aeg =  30.0 s, pinge = 0.7276 V
aeg =  30.6 s, pinge = 0.7166 V
aeg =  31.0 s, pinge = 0.7057 V
aeg =  31.5 s, pinge = 0.6951 V
aeg =  32.1 s, pinge = 0.6846 V
aeg =  32.5 s, pinge = 0.6743 V
aeg =  33.0 s, pinge = 0.6642 V
aeg =  33.6 s, pinge = 0.6543 V
aeg =  34.0 s, pinge = 0.6446 V
aeg =  34.5 s, pinge = 0.6350 V
aeg =  35.1 s, pinge = 0.6255 V
aeg =  35.5 s, pinge = 0.6163 V
aeg =  36.0 s, pinge = 0.6072 V
aeg =  36.6 s, pinge = 0.5982 V
aeg =  37.0 s, pinge = 0.5894 V
aeg =  37.5 s, pinge = 0.5808 V
aeg =  38.1 s, pinge = 0.5723 V
aeg =  38.5 s, pinge = 0.5640 V
aeg =  39.0 s, pinge = 0.5557 V
aeg =  39.6 s, pinge = 0.5477 V
aeg =  40.0 s, pinge = 0.5398 V
aeg =  40.5 s, pinge = 0.5319 V
aeg =  41.0 s, pinge = 0.5243 V
aeg =  41.5 s, pinge = 0.5167 V
...

Järjendis andmed on nüüd hulk erineva suurusega massiive, ja lisaks tuleks salvestada ka U_set. Ühte tekstifaili (numpy.savetxt abil) selliseid erineva suurusega massiive ei saa paigutada. Kuid numpy.save abil saab tervikuna binaarfaili salvestada mistahes massiivi sarnase objekti, mille elemendid võivad samuti olla massiivid.

In [76]:
fail = 'kondensaatori_pinge_laeng'
np.save(fail, [U_set] + andmed, allow_pickle=True) # faili laiend .npy lisatakse automaatselt

for U, seeria in zip(U_set, andmed):
    plot(seeria[:,0], 1000 * seeria[:,2], label='%.1f V' % U)
xlabel('Aeg (s)')
ylabel('Vool (mA)')
yscale('log')
legend()
tight_layout()
savefig(fail + '.png', bbox_inches='tight')
show()