-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpower_supply_controller.py
More file actions
108 lines (63 loc) · 1.56 KB
/
power_supply_controller.py
File metadata and controls
108 lines (63 loc) · 1.56 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python
# coding: utf-8
# # Power Supply Controller
# ## For use with Tektronix PWS4305
# In[1]:
# standard imports
import os
import sys
# SCPI imports
import usb
import visa
# instrument controller
import instrument_controller as ic
# In[2]:
class PowerSupply( ic.Instrument ):
def __init__( self, timeout = 10, rid = None ):
ic.Instrument.__init__( self, None, timeout, '\n', '\n' )
self.rid = 'USB0::0x0699::0x0392::C011451::INSTR' if ( rid is None ) else rid
#--- public methods ---
@property
def voltage( self ):
"""
Returns the voltage setting
"""
return self.source.volt.level()
@voltage.setter
def voltage( self, volts ):
"""
Sets the voltage of the instrument
"""
self.source.volt.level( volts )
@property
def current( self ):
"""
Returns the current setting in Amps
"""
return self.source.current.level()
@current.setter
def current( self, amps ):
"""
Set the current of the instrument
"""
self.source.current.level( amps )
def on( self ):
"""
Turns the output on
"""
self.output.state( 'on' )
def off( self):
"""
Turns the output off
"""
self.output.state( 'off' )
# In[3]:
# ps = PowerSupply()
# In[4]:
# ps.connect()
# In[5]:
# ps.id
# In[6]:
# del ps
# In[90]:
# ps.off()