| 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 |
import logging |
| 26 |
import time |
| 27 |
|
| 28 |
from pymeasure.instruments.keithley.keithley2260B import Keithley2260B |
| 29 |
|
| 30 |
log = logging.getLogger(__name__) |
| 31 |
log.addHandler(logging.NullHandler()) |
| 32 |
|
| 33 |
|
| 34 |
class TexioPSW360L30(Keithley2260B): |
| 35 |
r""" Represents the TEXIO PSW-360L30 Power Supply (minimal implementation) |
| 36 |
and provides a high-level interface for interacting with the instrument. |
| 37 |
|
| 38 |
For a connection through tcpip, the device only accepts |
| 39 |
connections at port 2268, which cannot be configured otherwise. |
| 40 |
example connection string: 'TCPIP::xxx.xxx.xxx.xxx::2268::SOCKET' |
| 41 |
|
| 42 |
For a connection through USB on Linux, the kernel is going to create |
| 43 |
a /dev/ttyACMX device automatically. The serial connection properties are |
| 44 |
fixed at 9600–8-N-1. |
| 45 |
|
| 46 |
The read termination for this interface is Line-Feed \n. |
| 47 |
|
| 48 |
This driver inherits from the Keithley2260B one. All instructions |
| 49 |
implemented in the Keithley 2260B driver are also available for the |
| 50 |
TEXIO PSW-360L30 power supply. |
| 51 |
|
| 52 |
The only addition is the "output" property that is just an alias for |
| 53 |
the "enabled" property of the Keithley 2260B. Calling the output switch |
| 54 |
"enabled" is confusing because it is not clear if the whole device is |
| 55 |
enabled/disable or only the output. |
| 56 |
|
| 57 |
.. code-block:: python |
| 58 |
|
| 59 |
source = TexioPSW360L30("TCPIP::xxx.xxx.xxx.xxx::2268::SOCKET") |
| 60 |
source.voltage = 1 |
| 61 |
print(source.voltage) |
| 62 |
print(source.current) |
| 63 |
print(source.power) |
| 64 |
print(source.applied) |
| 65 |
""" |
| 66 |
|
| 67 |
def __init__(self, adapter, name="TEXIO PSW-360L30 Power Supply", **kwargs): |
| 68 |
super().__init__(adapter, name, **kwargs) |
| 69 |
|
| 70 |
def check_errors(self): |
| 71 |
""" Logs any system errors reported by the instrument. |
| 72 |
""" |
| 73 |
code, message = self.next_error |
| 74 |
while code != 0: |
| 75 |
t = time.time() |
| 76 |
log.info("TEXIO PSW-360L30 reported error: %d, %s" % (code, message)) |
| 77 |
code, message = self.next_error |
| 78 |
if (time.time() - t) > 10: |
| 79 |
log.warning("Timed out for TEXIO PSW-360L30 error retrieval.") |