| 1 |
# |
| 2 |
# This file is part of the PyMeasure package. |
| 3 |
# |
| 4 |
# Copyright (c) 2013-2022 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 |
| 26 |
from pymeasure.instruments.validators import strict_discrete_set, strict_range |
| 27 |
|
| 28 |
|
| 29 |
class DCXS(Instrument): |
| 30 |
""" AJA DCXS-750 or 1500 DC magnetron sputtering power supply with multiple outputs |
| 31 |
|
| 32 |
Connection to the device is made through an RS232 serial connection. |
| 33 |
The communication settings are fixed in the device at 38400, one stopbit, no parity. |
| 34 |
The device's communication protocol uses single character commands and fixed length replies, |
| 35 |
both without any terminator. |
| 36 |
|
| 37 |
:param adapter: pyvisa resource name of the instrument or adapter instance |
| 38 |
:param string name: The name of the instrument. |
| 39 |
:param kwargs: Any valid key-word argument for Instrument |
| 40 |
""" |
| 41 |
|
| 42 |
def __init__(self, adapter, name="AJA DCXS sputtering power supply", **kwargs): |
| 43 |
super().__init__( |
| 44 |
adapter, |
| 45 |
name, |
| 46 |
includeSCPI=False, |
| 47 |
write_termination="", |
| 48 |
read_termination="", |
| 49 |
asrl={"baud_rate": 38400}, |
| 50 |
**kwargs |
| 51 |
) |
| 52 |
# here we want to flush the read buffer since the device upon power up sends some '>' |
| 53 |
# characters. |
| 54 |
self.adapter.flush_read_buffer() |
| 55 |
|
| 56 |
def ask(self, command, query_delay=None, **kwargs): |
| 57 |
"""Write a command to the instrument and return the read response. |
| 58 |
|
| 59 |
:param command: Command string to be sent to the instrument. |
| 60 |
:param query_delay: Delay between writing and reading in seconds. |
| 61 |
:param \\**kwargs: Keyword arguments passed to the read method. |
| 62 |
:returns: String returned by the device without read_termination. |
| 63 |
""" |
| 64 |
self.write(command) |
| 65 |
self.wait_for(query_delay) |
| 66 |
return self.read(**kwargs) |
| 67 |
|
| 68 |
def read(self, reply_length=-1, **kwargs): |
| 69 |
return self.read_bytes(reply_length, **kwargs).decode() |
| 70 |
|
| 71 |
id = Instrument.measurement( |
| 72 |
"?", """Get the power supply type identifier.""", |
| 73 |
cast=str, |
| 74 |
values_kwargs={'reply_length': 9}, |
| 75 |
) |
| 76 |
|
| 77 |
software_version = Instrument.measurement( |
| 78 |
"z", """Get the software revision of the power supply firmware.""", |
| 79 |
cast=str, |
| 80 |
values_kwargs={'reply_length': 5}, |
| 81 |
) |
| 82 |
|
| 83 |
power = Instrument.measurement( |
| 84 |
"d", """Measure the actual output power in W.""", |
| 85 |
cast=int, |
| 86 |
values_kwargs={'reply_length': 4}, |
| 87 |
) |
| 88 |
|
| 89 |
voltage = Instrument.measurement( |
| 90 |
"e", """Measure the output voltage in V.""", |
| 91 |
cast=int, |
| 92 |
values_kwargs={'reply_length': 4}, |
| 93 |
) |
| 94 |
|
| 95 |
current = Instrument.measurement( |
| 96 |
"f", """Measure the output current in mA.""", |
| 97 |
cast=int, |
| 98 |
values_kwargs={'reply_length': 4}, |
| 99 |
) |
| 100 |
|
| 101 |
remaining_deposition_time_min = Instrument.measurement( |
| 102 |
"k", """Get the minutes part of remaining deposition time.""", |
| 103 |
cast=int, |
| 104 |
values_kwargs={'reply_length': 3}, |
| 105 |
) |
| 106 |
|
| 107 |
remaining_deposition_time_sec = Instrument.measurement( |
| 108 |
"l", """Get the seconds part of remaining deposition time.""", |
| 109 |
cast=int, |
| 110 |
values_kwargs={'reply_length': 2}, |
| 111 |
) |
| 112 |
|
| 113 |
fault_code = Instrument.measurement( |
| 114 |
"o", """Get the error code from the power supply.""", |
| 115 |
values_kwargs={'reply_length': 1}, |
| 116 |
) |
| 117 |
|
| 118 |
shutter_state = Instrument.measurement( |
| 119 |
"p", """Get the status of the gun shutters. 0 for closed and 1 for open shutters.""", |
| 120 |
values_kwargs={'reply_length': 1}, |
| 121 |
cast=lambda x: int.from_bytes(x.encode(), "big"), |
| 122 |
get_process=lambda x: [x & 1, x & 2, x & 4, x & 8, x & 16], |
| 123 |
) |
| 124 |
|
| 125 |
enabled = Instrument.control( |
| 126 |
"a", "%s", """Control the on/off state of the power supply""", |
| 127 |
values_kwargs={'reply_length': 1}, |
| 128 |
validator=strict_discrete_set, |
| 129 |
map_values=True, |
| 130 |
cast=int, |
| 131 |
get_process=lambda c: "A" if c == 1 else "B", |
| 132 |
values={True: "A", False: "B"}, |
| 133 |
) |
| 134 |
|
| 135 |
setpoint = Instrument.control( |
| 136 |
"b", "C%04d", |
| 137 |
"""Control the setpoint value. Units are determined by regulation mode |
| 138 |
(power -> W, voltage -> V, current -> mA).""", |
| 139 |
values_kwargs={'reply_length': 4}, |
| 140 |
validator=strict_range, |
| 141 |
map_values=True, |
| 142 |
values=range(0, 1001), |
| 143 |
) |
| 144 |
|
| 145 |
regulation_mode = Instrument.control( |
| 146 |
"c", "D%d", |
| 147 |
"""Control the regulation mode of the power supply.""", |
| 148 |
values_kwargs={'reply_length': 1}, |
| 149 |
validator=strict_discrete_set, |
| 150 |
map_values=True, |
| 151 |
values={"power": 0, |
| 152 |
"voltage": 1, |
| 153 |
"current": 2, |
| 154 |
}, |
| 155 |
) |
| 156 |
|
| 157 |
ramp_time = Instrument.control( |
| 158 |
"g", "E%02d", |
| 159 |
"""Control the ramp time in seconds. Can be set only when 'enabled' is False.""", |
| 160 |
values_kwargs={'reply_length': 2}, |
| 161 |
cast=int, |
| 162 |
validator=strict_range, |
| 163 |
values=range(100), |
| 164 |
) |
| 165 |
|
| 166 |
shutter_delay = Instrument.control( |
| 167 |
"h", "F%02d", |
| 168 |
"""Control the shutter delay in seconds. Can be set only when 'enabled' is False.""", |
| 169 |
values_kwargs={'reply_length': 2}, |
| 170 |
cast=int, |
| 171 |
validator=strict_range, |
| 172 |
values=range(100), |
| 173 |
) |
| 174 |
|
| 175 |
deposition_time_min = Instrument.control( |
| 176 |
"i", "G%03d", |
| 177 |
"""Control the minutes part of deposition time. Can be set only when 'enabled' is False.""", |
| 178 |
values_kwargs={'reply_length': 3}, |
| 179 |
cast=int, |
| 180 |
validator=strict_range, |
| 181 |
values=range(1000), |
| 182 |
) |
| 183 |
|
| 184 |
deposition_time_sec = Instrument.control( |
| 185 |
"j", "H%02d", |
| 186 |
"""Control the seconds part of deposition time. Can be set only when 'enabled' is False.""", |
| 187 |
values_kwargs={'reply_length': 2}, |
| 188 |
cast=int, |
| 189 |
validator=strict_range, |
| 190 |
values=range(60), |
| 191 |
) |
| 192 |
|
| 193 |
material = Instrument.control( |
| 194 |
"n", "I%08s", """Control the material name of the sputter target.""", |
| 195 |
cast=str, |
| 196 |
values_kwargs={'reply_length': 8}, |
| 197 |
validator=lambda value, maxlength: value[:maxlength], |
| 198 |
values=8, |
| 199 |
) |
| 200 |
|
| 201 |
active_gun = Instrument.control( |
| 202 |
"y", "Z%d", """Control the active gun number.""", |
| 203 |
cast=int, |
| 204 |
values_kwargs={'reply_length': 1}, |
| 205 |
validator=strict_range, |
| 206 |
values=range(1, 6), |
| 207 |
) |