Debian Codegraph @

pymeasure/instruments/aimtti/aimttiPL.py

raw
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2024 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24
25 from pymeasure.instruments import Instrument, Channel, SCPIUnknownMixin
26 from pymeasure.instruments.validators import strict_discrete_set, strict_range
27
28
29 class PLChannel(Channel):
30 """A channel of AimTTI PL series power supplies.
31
32 Channels of the power supply. The channels are number from right-to-left, starting at 1.
33 """
34
35 def __init__(self, parent, id, voltage_range: list = None, current_range: list = None):
36 super().__init__(parent, id)
37 self.voltage_setpoint_values = voltage_range
38 self.current_limit_values = current_range
39
40 voltage_setpoint = Channel.control(
41 "V{ch}?", "V{ch}V %g",
42 """ Control the output voltage of this channel.
43 With verify: the operation is completed when the parameter being adjusted
44 reaches the required value to within ±5% or ±10 counts.""",
45 validator=strict_range,
46 values=[0, 6],
47 dynamic=True,
48 get_process=lambda x: float(x[3:]),
49 )
50
51 current_limit = Channel.control(
52 "I{ch}?", "I{ch} %g",
53 """ Control the current limit in Amps.""",
54 validator=strict_range,
55 values=[0, 1.5],
56 dynamic=True,
57 get_process=lambda x: float(x[3:]),
58 )
59
60 voltage = Channel.measurement(
61 "V{ch}O?",
62 """ Measure the output readback voltage for this output channel in Volts.""",
63 get_process=lambda x: float(x[:-1]),
64 )
65
66 current = Channel.measurement(
67 "I{ch}O?",
68 """ Measure the output readback current for this output channel in Amps.""",
69 get_process=lambda x: float(x[:-1]),
70 )
71
72 current_range = Channel.control(
73 "IRANGE{ch}?", "IRANGE{ch} %g",
74 """ Control the current range of the channel.
75 Low (500/800mA) range, or High range.
76 Output must be switched off before changing range.""",
77 validator=strict_discrete_set,
78 values={"LOW": 1, "HIGH": 2},
79 map_values=True,
80 )
81
82 output_enabled = Channel.control(
83 "OP{ch}?", "OP{ch} %i",
84 """ Control whether the source is enabled, takes values True or False.""",
85 validator=strict_discrete_set,
86 values={True: 1, False: 0},
87 map_values=True,
88 )
89
90
91 class PLBase(SCPIUnknownMixin, Instrument):
92 """Control AimTTI PL series power supplies.
93 Model number ending with -P or P(G) support this remote interface.
94
95 Documentation:
96 https://resources.aimtti.com/manuals/New_PL+PL-P_Series_Instruction_Manual-Iss18.pdf
97 PL-series devices:
98 https://www.aimtti.com/product-category/dc-power-supplies/aim-plseries
99
100 The default value for the timeout argument is set to 5000ms.
101
102 .. code-block:: python
103
104 psu = PL303QMDP("ASRL7::INSTR")
105 psu.reset()
106 psu.ch_2.voltage = 1.2
107 psu.ch_2.output_enabled = True
108 ...
109 psu.ch_2.output_enabled = False
110 psu.local()
111
112 """
113
114 def __init__(self, adapter, name="AimTTI PL", **kwargs):
115 kwargs.setdefault("timeout", 5000)
116 super().__init__(adapter, name, **kwargs)
117
118 all_outputs_enabled = Instrument.setting(
119 "OPALL %d",
120 """ Control whether all sources are enabled simultaneously, takes
121 values True or False.""",
122 validator=strict_discrete_set,
123 values={True: 1, False: 0},
124 map_values=True,
125 )
126
127 def local(self):
128 """Go to local. Make sure all output are disabled first."""
129 self.write("LOCAL")
130
131
132 class PL068P(PLBase):
133 ch_1: PLChannel = Instrument.ChannelCreator(
134 PLChannel, "1", voltage_range=[0, 6], current_range=[0, 8]
135 )
136
137 def __init__(self, adapter, name="AimTTI PL068-P", **kwargs):
138 super().__init__(adapter, name, **kwargs)
139
140
141 class PL155P(PLBase):
142 ch_1: PLChannel = Instrument.ChannelCreator(
143 PLChannel, "1", voltage_range=[0, 15], current_range=[0, 5]
144 )
145
146 def __init__(self, adapter, name="AimTTI PL155-P", **kwargs):
147 super().__init__(adapter, name, **kwargs)
148
149
150 class PL303P(PLBase):
151 ch_1: PLChannel = Instrument.ChannelCreator(
152 PLChannel, "1", voltage_range=[0, 30], current_range=[0, 3]
153 )
154
155 def __init__(self, adapter, name="AimTTI PL303-P", **kwargs):
156 super().__init__(adapter, name, **kwargs)
157
158
159 class PL601P(PLBase):
160 ch_1: PLChannel = Instrument.ChannelCreator(
161 PLChannel, "1", voltage_range=[0, 60], current_range=[0, 1.5]
162 )
163
164 def __init__(self, adapter, name="AimTTI PL601-P", **kwargs):
165 super().__init__(adapter, name, **kwargs)
166
167
168 class PL303QMDP(PLBase):
169 ch_1: PLChannel = Instrument.ChannelCreator(
170 PLChannel, "1", voltage_range=[0, 30], current_range=[0, 3]
171 )
172 ch_2: PLChannel = Instrument.ChannelCreator(
173 PLChannel, "2", voltage_range=[0, 30], current_range=[0, 3]
174 )
175
176 def __init__(self, adapter, name="AimTTI PL303QMD-P", **kwargs):
177 super().__init__(adapter, name, **kwargs)
178
179
180 class PL303QMTP(PLBase):
181 ch_1: PLChannel = Instrument.ChannelCreator(
182 PLChannel, "1", voltage_range=[0, 30], current_range=[0, 3]
183 )
184 ch_2: PLChannel = Instrument.ChannelCreator(
185 PLChannel, "2", voltage_range=[0, 30], current_range=[0, 3]
186 )
187 ch_3: PLChannel = Instrument.ChannelCreator(
188 PLChannel, "3", voltage_range=[0, 30], current_range=[0, 3]
189 )
190
191 def __init__(self, adapter, name="AimTTI PL303QMT-P", **kwargs):
192 super().__init__(adapter, name, **kwargs)