aboutsummaryrefslogtreecommitdiff
path: root/run.py
blob: 1576fa3459d4b030974cf1c856019cedbf3e6935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from qolab.hardware.multimeter.hp3457a import HP3457A
from qolab.hardware.multimeter.bk_5491 import BK_5491
from qolab.hardware.multimeter.hp_34401 import HP_34401
from qolab.hardware.vacuum_gauge.mks390 import MKS390
from qolab.hardware.power_supply.psw25045 import PSW25045
from qolab.hardware.power_supply.gpp3610h import GPP3610H


from qolab.hardware.scope.sds800xhd import SDS800XHD

import pyvisa

# Example usage
if __name__ == "__main__":
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    import time

    mpl.style.use('custom-style')

    rm = pyvisa.ResourceManager()
    address_dict = {
        'scope': 'TCPIP0::192.168.110.191::inst0::INSTR',
        'dmm_hpa': 'visa://192.168.194.15/GPIB1::22::INSTR',
        'dmm_hp': 'visa://192.168.194.15/ASRL9::INSTR',
        'dmm_bk': 'visa://192.168.194.15/ASRL12::INSTR',
        'vacgauge': 'visa://192.168.194.15/ASRL13::INSTR',
        'psu_anode': 'visa://192.168.194.15/ASRL10::INSTR',
        'psu_disp': 'TCPIP0::192.168.2.213::1026::SOCKET'       
    }
    #----------------------------------------------
    # Open visa resources and initialize intruments
    dmm_hpa = HP3457A(
        rm.open_resource(address_dict['dmm_hpa'])
    )
    dmm_bk = BK_5491(
        rm.open_resource(address_dict['dmm_bk'])
    )

    dmm_hp = HP_34401(
        rm.open_resource(address_dict['dmm_hp'])
    )

    scope = SDS800XHD(
        rm.open_resource(address_dict['scope'])
    )

    gauge = MKS390(
        rm.open_resource(address_dict['vacgauge'])
    )

    psu_anode = PSW25045(
        rm.open_resource(address_dict['psu_anode'])
    )

    psu_disp = GPP3610H(
        rm.open_resource(address_dict['psu_disp'])
    )

    #-----------------------------------------------

    # Get DMM readings
    print(dmm_hpa.get_idn())
    print(f'HP4357A reading: {dmm_hpa.getAdc()}')
    print(f'BK5491 reading: {dmm_bk.getAdc()}')
    print(f'HP34401 reading: {dmm_hp.getAdc()}')
    print(f'MKS390 reading: {gauge.get_pressure()}')

    print(psu_anode.get_idn())
    psu_anode.set_voltage(5)
    psu_anode.enable_output(True)
    time.sleep(2)
    psu_anode.enable_output(False)

    print(psu_disp.get_idn())
    psu_disp.set_voltage(0.2)
    psu_disp.enable_output(True)
    time.sleep(3)
    print(psu_disp.get_out_current())
    print(psu_disp.get_out_voltage())
    time.sleep(2)
    psu_disp.enable_output(False)

    #trace = scope.getTrace(4)
    #trace.plot()
    plt.show()