line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lab::Instrument::SR830::AuxOut; |
2
|
|
|
|
|
|
|
#ABSTRACT: Aux Outputs of the Stanford Research SR830 Lock-In Amplifier |
3
|
|
|
|
|
|
|
$Lab::Instrument::SR830::AuxOut::VERSION = '3.880'; |
4
|
2
|
|
|
2
|
|
2369
|
use v5.20; |
|
2
|
|
|
|
|
18
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
8
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
11
|
use Lab::Instrument; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
38
|
|
12
|
2
|
|
|
2
|
|
24
|
use Data::Dumper; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
114
|
|
13
|
2
|
|
|
2
|
|
18
|
use Carp; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
141
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
16
|
use parent qw/Lab::Instrument::Source/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
25
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our %fields = ( |
18
|
|
|
|
|
|
|
supported_connections => [ 'GPIB', 'VISA' ], |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# default settings for the supported connections |
21
|
|
|
|
|
|
|
connection_settings => { |
22
|
|
|
|
|
|
|
gpib_board => 0, |
23
|
|
|
|
|
|
|
gpib_address => undef, |
24
|
|
|
|
|
|
|
timeout => 1 |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
device_settings => { |
28
|
|
|
|
|
|
|
gate_protect => 1, |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#gp_equal_level => 1e-5, |
31
|
|
|
|
|
|
|
gp_max_units_per_second => 0.005, |
32
|
|
|
|
|
|
|
gp_max_units_per_step => 0.001, |
33
|
|
|
|
|
|
|
gp_max_step_per_second => 5, |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
max_sweep_time => 3600, |
36
|
|
|
|
|
|
|
min_sweep_time => 0.1, |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
stepsize => 0.01, |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
channel => undef, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
2
|
|
|
2
|
1
|
5
|
my $proto = shift; |
47
|
2
|
|
33
|
|
|
18
|
my $class = ref($proto) || $proto; |
48
|
2
|
|
|
|
|
9
|
my $self = $class->SUPER::new(@_); |
49
|
2
|
|
|
|
|
5
|
$self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); |
|
2
|
|
|
|
|
11
|
|
50
|
2
|
|
|
|
|
7
|
$self->empty_buffer(); |
51
|
2
|
|
|
|
|
10
|
my $channel = $self->channel; |
52
|
2
|
50
|
|
|
|
28
|
if ( not defined $channel ) { |
|
|
50
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
croak "need channel (1-4) in constructor for ", __PACKAGE__; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
elsif ( $channel !~ /^[1-4]$/ ) { |
56
|
0
|
|
|
|
|
0
|
croak "channel '$channel' is not in the range (1..4)"; |
57
|
|
|
|
|
|
|
} |
58
|
2
|
|
|
|
|
16
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub empty_buffer { |
62
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
63
|
2
|
|
|
|
|
9
|
my ($times) = $self->_check_args( \@_, ['times'] ); |
64
|
2
|
50
|
|
|
|
7
|
if ($times) { |
65
|
0
|
|
|
|
|
0
|
for ( my $i = 0; $i < $times; $i++ ) { |
66
|
0
|
|
|
|
|
0
|
eval { $self->read( brutal => 1 ) }; |
|
0
|
|
|
|
|
0
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
2
|
|
|
|
|
6
|
while ( $self->read( brutal => 1 ) ) { |
71
|
0
|
|
|
|
|
0
|
print "Cleaning buffer."; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _set_level { |
78
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
79
|
0
|
|
|
|
|
0
|
my ( $value, $tail ) = $self->_check_args( \@_, ['value'] ); |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
0
|
if ( abs($value) > 10.5 ) { |
82
|
0
|
|
|
|
|
0
|
Lab::Exception::CorruptParameter->throw( |
83
|
|
|
|
|
|
|
"The desired source level $value is not within the source range (10.5 V) \n" |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
0
|
my $cmd = sprintf( "AUXV %d, %ee", $self->{channel}, $value ); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
0
|
$self->write( $cmd, { error_check => 1 }, $tail ); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
return $value; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub set_voltage { |
96
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
97
|
0
|
|
|
|
|
0
|
my ( $voltage, $tail ) = $self->_check_args( \@_, ['voltage'] ); |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
0
|
return $self->set_level( $voltage, $tail ); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub get_level { |
104
|
6
|
|
|
6
|
1
|
1120
|
my $self = shift; |
105
|
6
|
|
|
|
|
21
|
my ($tail) = $self->_check_args( \@_, [] ); |
106
|
6
|
|
|
|
|
32
|
my $channel = $self->channel; |
107
|
6
|
|
|
|
|
23
|
return $self->query( "AUXV? $channel", $tail ); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub active { |
111
|
0
|
|
|
0
|
0
|
|
return 0; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=pod |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=encoding UTF-8 |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 NAME |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Lab::Instrument::SR830::AuxOut - Aux Outputs of the Stanford Research SR830 Lock-In Amplifier |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 VERSION |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
version 3.880 |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SYNOPSIS |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
use Lab::Instrument::SR830::AuxOut |
133
|
|
|
|
|
|
|
my $output = Lab::Instrument::SR830::AuxOut->new(%options, channel => 1); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 DESCRIPTION |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This class provides access to the four DC outputs of the SR830. You have to |
138
|
|
|
|
|
|
|
provide a C<channel> (1..4) parameter in the constructor. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
B<To use multiple virtual instruments, which use the same physical device, you have to share the connection between the virtual instruments:> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
use Lab::Measurement; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# Create the shared connection. |
145
|
|
|
|
|
|
|
my $connection = Connection('LinuxGPIB', {gpib_address => 8}); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Create two outputs. |
148
|
|
|
|
|
|
|
my $gate = Instrument('SR830::AuxOut', {connection => $connection, |
149
|
|
|
|
|
|
|
channel => 1, |
150
|
|
|
|
|
|
|
gate_protect => 0}); |
151
|
|
|
|
|
|
|
my $bias = Instrument('SR830::AuxOut', {connection => $connection, |
152
|
|
|
|
|
|
|
channel => 2, |
153
|
|
|
|
|
|
|
gate_protect => 0}); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
You can now use C<$gate> and C<$bias> to build XPRESS L<Voltage |
156
|
|
|
|
|
|
|
Sweeps|Lab::XPRESS::Sweep::Voltage>. The SR830 does not have hardware support |
157
|
|
|
|
|
|
|
for continuous voltage sweeps. Thus, the C<mode> parameter of the sweep must be |
158
|
|
|
|
|
|
|
set to C<'step'> or C<'list'> and the C<jump> parameter must be set to |
159
|
|
|
|
|
|
|
C<1>. Example sweep configuration: |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my $gate_sweep = Sweep('Voltage', |
162
|
|
|
|
|
|
|
{ |
163
|
|
|
|
|
|
|
mode => 'step', |
164
|
|
|
|
|
|
|
instrument => $gate, |
165
|
|
|
|
|
|
|
points => [-0.1,0.1], |
166
|
|
|
|
|
|
|
stepwidth => [0.001], |
167
|
|
|
|
|
|
|
jump => 1, |
168
|
|
|
|
|
|
|
rate => [0.001], |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
}); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $bias_sweep = Sweep('Voltage', |
173
|
|
|
|
|
|
|
{ |
174
|
|
|
|
|
|
|
mode => 'step', |
175
|
|
|
|
|
|
|
instrument => $bias, |
176
|
|
|
|
|
|
|
points => [-0.1,0.1], |
177
|
|
|
|
|
|
|
stepwidth => [0.001], |
178
|
|
|
|
|
|
|
rate => [0.001], |
179
|
|
|
|
|
|
|
jump => 1, |
180
|
|
|
|
|
|
|
}); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 Methods |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 _set_level($voltage) |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Set the output voltage. Will throw an exception, if the absolute value of |
187
|
|
|
|
|
|
|
C<$voltage> is bigger than 10.5 V. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 set_voltage($voltage) |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Equivalent to C<_set_level>. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 set_level($voltage) |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
See L<Lab::Instrument::Source>. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 get_level() |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Query the current output voltage. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Copyright 2016 Simon Reinhardt |
206
|
|
|
|
|
|
|
2017 Andreas K. Huettel |
207
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
211
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |