Debian Codegraph @

pymeasure/instruments/razorbill/razorbillRP100.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
26 from pymeasure.instruments import Instrument, SCPIUnknownMixin
27 from pymeasure.instruments.validators import (strict_discrete_set,
28 strict_range)
29
30
31 class razorbillRP100(SCPIUnknownMixin, Instrument):
32 """Represents Razorbill RP100 strain cell controller
33
34 .. code-block:: python
35
36 scontrol = razorbillRP100("ASRL/dev/ttyACM0::INSTR")
37
38 scontrol.output_1 = True # turns output on
39 scontrol.slew_rate_1 = 1 # sets slew rate to 1V/s
40 scontrol.voltage_1 = 10 # sets voltage on output 1 to 10V
41
42 """
43
44 def __init__(self, adapter, name="Razorbill RP100 Piezo Stack Powersupply", **kwargs):
45 super().__init__(
46 adapter, name,
47 **kwargs
48 )
49 self.timeout = 20
50
51 output_1 = Instrument.control("OUTP1?", "OUTP1 %d",
52 """Control output of channel 1 on or off""",
53 validator=strict_discrete_set,
54 values={True: 1, False: 0},
55 map_values=True)
56
57 output_2 = Instrument.control("OUTP2?", "OUTP2 %d",
58 """Control output of channel 2 on or off""",
59 validator=strict_discrete_set,
60 values={True: 1, False: 0},
61 map_values=True)
62
63 voltage_1 = Instrument.control("SOUR1:VOLT?", "SOUR1:VOLT %g",
64 """Control the output voltage of channel 1""",
65 validator=strict_range,
66 values=[-230, 230])
67
68 voltage_2 = Instrument.control("SOUR2:VOLT?", "SOUR2:VOLT %g",
69 """Control the output voltage of channel 2""",
70 validator=strict_range,
71 values=[-230, 230])
72
73 slew_rate_1 = Instrument.control(
74 "SOUR1:VOLT:SLEW?", "SOUR1:VOLT:SLEW %g",
75 """Control the source slew rate in volts/sec of channel 1""",
76 validator=strict_range,
77 values=[0.1 * 10e-3, 100 * 10e3]
78 )
79
80 slew_rate_2 = Instrument.control(
81 "SOUR2:VOLT:SLEW?", "SOUR2:VOLT:SLEW %g",
82 """Control the source slew rate in volts/sec of channel 2""",
83 validator=strict_range,
84 values=[0.1 * 10e-3, 100 * 10e3]
85 )
86
87 instant_voltage_1 = Instrument.measurement(
88 "SOUR1:VOLT:NOW?",
89 """Get the instantaneous output of source one in volts"""
90 )
91
92 instant_voltage_2 = Instrument.measurement(
93 "SOUR2:VOLT:NOW?",
94 """Get the instantaneous output of source two in volts"""
95 )
96
97 contact_voltage_1 = Instrument.measurement(
98 "MEAS1:VOLT?",
99 """Get the Voltage in volts present at the front panel output of channel 1"""
100 )
101
102 contact_voltage_2 = Instrument.measurement(
103 "MEAS2:VOLT?",
104 """Get the Voltage in volts present at the front panel output of channel 2"""
105 )
106
107 contact_current_1 = Instrument.measurement(
108 "MEAS1:CURR?",
109 """Get the current in amps present at the front panel output of channel 1"""
110 )
111
112 contact_current_2 = Instrument.measurement(
113 "MEAS2:CURR?",
114 """Get the current in amps present at the front panel output of channel 2"""
115 )