Instrument/SignalRecovery726x.pm

filter: Statementstmt 4.3% 18 / 412 Branchbran 0.0% 0 / 208 Conditioncond 0.0% 0 / 126 MC/DCmcdc 0.0% 0 / 65 Subroutinesub 10.0% 5 / 50 Podpod 60.9% 25 / 41 totaltotal 5.3% 48 / 902 SCAR 99.3
CC
148
Cov
2%
get_value
812.0
config_measurement
306.0
set_offset
156.0
CRAP 20504.4
« Moose/Instrument/NanonisTramea.pm ↑ Summary XPRESS/Data/XPRESS_plotter.pm »
1 package Lab::Instrument::SignalRecovery726x;
2 1 $Lab::Instrument::SignalRecovery726x::VERSION = '3.881';
3 #ABSTRACT: Signal Recovery 7260 / 7265 Lock-in Amplifier
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Time::HiRes qw/usleep/, qw/time/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Lab::Instrument;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Time::HiRes qw (usleep);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our @ISA = ("Lab::Instrument");
13  
14 1 our %fields = (
15 supported_connections =>
16 [ 'VISA', 'VISA_GPIB', 'GPIB', 'VISA_RS232', 'RS232', 'DEBUG' ],
17  
18 connection_settings => {
19 baudrate => 19200,
20 databits => 7,
21 stopbits => 1,
22 parity => 'even',
23 handshake => 'none',
24 rs232_echo => 'character',
25 timeout => 500,
26 termchar => "\n",
27 timeout => 2
28 },
29  
30 device_settings => {},
31  
32 device_cache => {
33 imode => undef,
34 vmode => undef,
35 fet => undef,
36 float => undef,
37 cp => undef,
38 sen => undef,
39 linefilter => undef,
40 refchannel => undef,
41 refpha => undef,
42 ouputfilter_slope => undef,
43  
44 #value => undef,
45 osc => undef,
46 frq => undef,
47 acgain => undef,
48 tc => undef
49 }
50  
51 );
52  
53 sub new {
54 0 ▶ my $proto = shift;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
55 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
56 0 my $self = $class->SUPER::new(@_);
57 0 $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__);
58  
59 0 return $self;
60 }
61  
62 sub reset {
63  
64 0 ▶ my $self = shift;
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
65 0 $self->write("ADF 1");
66  
67 0 $self->_cache_init();
68 }
69  
70 # ------------------ SIGNAL CHANNEL -------------------------
71  
72 sub set_imode { # basic setting
73 0 ▶ my $self = shift;
Subroutine set_imode: not called CC=6 SCAR=37.4
Pod documented
74 0 my ($imode) = $self->_check_args( \@_, ['value'] );
75  
76 # $imode == 0 --> Current Mode OFF
77 # $imode == 1 --> High Bandwidth Current Mode
78 # $imode == 2 --> Low Noise Current Mode
79  
80 0 ▶ if ( not defined $imode ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $imode) 0 0 0
81 0 return get_imode();
82 }
83  
84 0 ▶ if ( defined $imode and ( $imode == 0 || $imode == 1 || $imode == 2 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $imode and $imode == 0 || $imode == 1 || $imode == 2) { } 0 0 0
Condition0%0/9
defined $imode and $imode == 0 || $imode == 1 || $imode == 2
!ll&&!rl&&r
000
$imode == 0 or $imode == 1 or $imode == 2
l!l&&r!l&&!r
000
$imode == 0 or $imode == 1
l!l&&r!l&&!r
000
MC/DC0%0/4
defined $imode and $imode == 0 || $imode == 1 || $imode == 2
defined $imode $imode == 0 $imode == 1 $imode == 2
Truth table0%0/5
A and B or C or D
A= defined $imodeB= $imode == 0C= $imode == 1D= $imode == 2
ABCDresult
0XXX0
10000
11XX1
101X1
10011
85 0 my $cmd = sprintf( "IMODE %d", $imode );
86 0 $self->write($cmd);
87 }
88 else {
89 0 Lab::Exception::CorruptParameter->throw( error =>
90 "\nSIGNAL REOCOVERY 726x:\nunexpected value for IMODE in sub set_imode. Expected values are:\n 0 --> Current Mode OFF\n 1 --> High Bandwidth Current Mode\n 2 --> Low Noise Current Mode\n"
91 );
92 }
93  
94 }
95  
96 sub get_imode {
97 0 ▶ my $self = shift;
Subroutine get_imode: not called CC=1 SCAR=6.9
Pod undocumented
98  
99 0 my ($tail) = $self->_check_args( \@_ );
100  
101 0 return $self->query( "IMODE", $tail );
102 }
103  
104 sub set_vmode { # basic setting
105 0 ▶ my $self = shift;
Subroutine set_vmode: not called CC=6 SCAR=37.4
Pod documented
106 0 my ($vmode) = $self->_check_args( \@_, ['value'] );
107  
108 # $vmode == 0 --> Both inputs grounded (testmode)
109 # $vmode == 1 --> A input only
110 # $vmode == 2 --> -B input only
111 # $vmode == 3 --> A-B differential mode
112  
113 0 ▶ if ( defined $vmode
Branch: 1 branch
BranchTrueFalseTotal
if (defined $vmode and $vmode == 0 || $vmode == 1 || $vmode == 2 || $vmode == 3) { } 0 0 0
Condition0%0/12
defined $vmode and $vmode == 0 || $vmode == 1 || $vmode == 2 || $vmode == 3
!ll&&!rl&&r
000
$vmode == 0 or $vmode == 1 or $vmode == 2 or $vmode == 3
l!l&&r!l&&!r
000
$vmode == 0 or $vmode == 1 or $vmode == 2
l!l&&r!l&&!r
000
$vmode == 0 or $vmode == 1
l!l&&r!l&&!r
000
MC/DC0%0/5
defined $vmode and $vmode == 0 || $vmode == 1 || $vmode == 2 || $vmode == 3
defined $vmode $vmode == 0 $vmode == 1 $vmode == 2 $vmode == 3
Truth table0%0/6
A and B or C or D or E
A= defined $vmodeB= $vmode == 0C= $vmode == 1D= $vmode == 2E= $vmode == 3
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
114 and ( $vmode == 0 || $vmode == 1 || $vmode == 2 || $vmode == 3 ) ) {
115  
116 0 my $cmd = sprintf( "VMODE %d", $vmode );
117 0 $self->write($cmd);
118 }
119 else {
120 0 Lab::Exception::CorruptParameter->throw( error =>
121 "\nSIGNAL REOCOVERY 726x:\nunexpected value for VMODE in sub set_vmode. Expected values are:\n 0 --> Both inputs grounded (testmode)\n 1 --> A input only\n 2 --> -B input only\n 3 --> A-B differential mode\n"
122 );
123 }
124  
125 }
126  
127 sub get_vmode {
128 0 ▶ my $self = shift;
Subroutine get_vmode: not called CC=1 SCAR=6.9
Pod undocumented
129  
130 0 my ($tail) = $self->_check_args( \@_ );
131  
132 0 return $self->query( "VMODE", $tail );
133 }
134  
135 sub set_fet { # basic setting
136 0 ▶ my $self = shift;
Subroutine set_fet: not called CC=4 SCAR=30.0
Pod documented
137 0 my ($value) = $self->_check_args( \@_, ['value'] );
138  
139 # $value == 0 --> Bipolar device, 10 kOhm input impedance, 2nV/sqrt(Hz) voltage noise at 1 kHz
140 # $value == 1 --> FET, 10 MOhm input impedance, 5nV/sqrt(Hz) voltage noise at 1 kHz
141  
142 0 ▶ if ( defined $value and ( $value == 0 || $value == 1 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and $value == 0 || $value == 1) { } 0 0 0
Condition0%0/6
defined $value and $value == 0 || $value == 1
!ll&&!rl&&r
000
$value == 0 or $value == 1
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $value and $value == 0 || $value == 1
defined $value $value == 0 $value == 1
Truth table0%0/4
A and B or C
A= defined $valueB= $value == 0C= $value == 1
ABCresult
0XX0
1000
11X1
1011
143 0 my $cmd = sprintf( "FET %d", $value );
144 0 $self->write($cmd);
145 }
146 else {
147 0 Lab::Exception::CorruptParameter->throw( error =>
148 "\nSIGNAL REOCOVERY 726x:\nunexpected value in sub set_fet. Expected values are:\n 0 --> Bipolar device, 10 kOhm input impedance, 2nV/sqrt(Hz) voltage noise at 1 kHz\n 1 --> FET, 10 MOhm input impedance, 5nV/sqrt(Hz) voltage noise at 1 kHz\n"
149 );
150 }
151  
152 }
153  
154 sub get_fet {
155 0 ▶ my $self = shift;
Subroutine get_fet: not called CC=1 SCAR=6.9
Pod undocumented
156  
157 0 my ($tail) = $self->_check_args( \@_ );
158  
159 0 return $self->query( "FET", $tail );
160 }
161  
162 sub set_float { # basic setting
163 0 ▶ my $self = shift;
Subroutine set_float: not called CC=4 SCAR=30.0
Pod documented
164 0 my ($value) = $self->_check_args( \@_, ['value'] );
165  
166 # $value == 0 --> input conector shield set to GROUND
167 # $value == 1 --> input conector shield set to FLOAT
168  
169 0 ▶ if ( defined $value and ( $value == 0 || $value == 1 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and $value == 0 || $value == 1) { } 0 0 0
Condition0%0/6
defined $value and $value == 0 || $value == 1
!ll&&!rl&&r
000
$value == 0 or $value == 1
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $value and $value == 0 || $value == 1
defined $value $value == 0 $value == 1
Truth table0%0/4
A and B or C
A= defined $valueB= $value == 0C= $value == 1
ABCresult
0XX0
1000
11X1
1011
170  
171 0 my $cmd = sprintf( "FLOAT %d", $value );
172 0 $self->write($cmd);
173 }
174 else {
175 0 Lab::Exception::CorruptParameter->throw( error =>
176 "\nSIGNAL REOCOVERY 726x:\nunexpected value in sub set_float. Expected values are:\n 0 --> input conector shield set to GROUND\n 1 --> input conector shield set to FLOAT\n"
177 );
178 }
179  
180 }
181  
182 sub get_float {
183 0 ▶ my $self = shift;
Subroutine get_float: not called CC=1 SCAR=6.9
Pod undocumented
184  
185 0 my ($tail) = $self->_check_args( \@_ );
186  
187 0 return $self->query("FLOAT");
188 }
189  
190 sub set_cp { # basic setting
191 0 ▶ my $self = shift;
Subroutine set_cp: not called CC=4 SCAR=30.0
Pod documented
192 0 my ($value) = $self->_check_args( \@_, ['value'] );
193  
194 # $value == 0 --> input coupling mode AC\n
195 # $value == 1 --> input coupling mode DC\n
196  
197 0 ▶ if ( defined $value and ( $value == 0 || $value == 1 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and $value == 0 || $value == 1) { } 0 0 0
Condition0%0/6
defined $value and $value == 0 || $value == 1
!ll&&!rl&&r
000
$value == 0 or $value == 1
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $value and $value == 0 || $value == 1
defined $value $value == 0 $value == 1
Truth table0%0/4
A and B or C
A= defined $valueB= $value == 0C= $value == 1
ABCresult
0XX0
1000
11X1
1011
198  
199 0 my $cmd = sprintf( "CP %d", $value );
200 0 $self->write($cmd);
201 }
202 else {
203 0 Lab::Exception::CorruptParameter->throw( error =>
204 "\nSIGNAL REOCOVERY 726x:\nunexpected value in sub set_cp. Expected values are:\n 0 --> input coupling mode AC\n 1 --> input coupling mode DC\n"
205 );
206 }
207  
208 }
209  
210 sub get_cp {
211 0 ▶ my $self = shift; #
Subroutine get_cp: not called CC=1 SCAR=6.9
Pod undocumented
212  
213 0 my ($tail) = $self->_check_args( \@_ );
214  
215 0 return $self->query("CP");
216 }
217  
218 sub set_sen { # basic setting
219 0 ▶ my $self = shift;
Subroutine set_sen: not called CC=8 SCAR=42.8
Pod documented
220 0 my ($value) = $self->_check_args( \@_, ['value'] );
221  
222 0 my @matrix = (
223 {
224 2e-9 => 1,
225 5e-9 => 2,
226 10e-9 => 3,
227 2e-8 => 4,
228 5e-8 => 5,
229 10e-8 => 6,
230 2e-7 => 7,
231 5e-7 => 8,
232 10e-7 => 9,
233 2e-6 => 10,
234 5e-6 => 11,
235 10e-6 => 12,
236 2e-5 => 13,
237 5e-5 => 14,
238 10e-5 => 15,
239 2e-4 => 16,
240 5e-4 => 17,
241 10e-4 => 18,
242 2e-3 => 19,
243 5e-3 => 20,
244 10e-3 => 21,
245 2e-2 => 22,
246 5e-2 => 23,
247 10e-2 => 24,
248 2e-1 => 25,
249 5e-1 => 26,
250 10e-1 => 27
251 },
252 {
253 2e-15 => 1,
254 5e-15 => 2,
255 10e-15 => 3,
256 2e-14 => 4,
257 5e-14 => 5,
258 10e-14 => 6,
259 2e-13 => 7,
260 5e-13 => 8,
261 10e-13 => 9,
262 2e-12 => 10,
263 5e-12 => 11,
264 10e-12 => 12,
265 2e-11 => 13,
266 5e-11 => 14,
267 10e-11 => 15,
268 2e-10 => 16,
269 5e-10 => 17,
270 10e-10 => 18,
271 2e-9 => 19,
272 5e-9 => 20,
273 10e-9 => 21,
274 2e-8 => 22,
275 5e-8 => 23,
276 10e-8 => 24,
277 2e-7 => 25,
278 5e-7 => 26,
279 10e-7 => 27
280 },
281 {
282 2e-15 => 7,
283 5e-15 => 8,
284 10e-15 => 9,
285 2e-14 => 10,
286 5e-14 => 11,
287 10e-14 => 12,
288 2e-13 => 13,
289 5e-13 => 14,
290 10e-13 => 15,
291 2e-12 => 16,
292 5e-12 => 17,
293 10e-12 => 18,
294 2e-11 => 19,
295 5e-11 => 20,
296 10e-11 => 21,
297 2e-10 => 22,
298 5e-10 => 23,
299 10e-10 => 24,
300 2e-9 => 25,
301 5e-9 => 26,
302 10e-9 => 27
303 }
304 );
305  
306 0 my $imode = $self->query("IMODE");
307  
308 # SENSITIVITY (IMODE == 0) --> 2nV, 5nV, 10nV, 20nV, 50nV, 100nV, 200nV, 500nV, 1uV, 2uV, 5uV, 10uV, 20uV, 50uV, 100uV, 200uV, 500uV, 1mV, 2mV, 5mV, 10mV, 20mV, 50mV, 100mV, 200mV, 500mV, 1V\n
309 # SENSITIVITY (IMODE == 1) --> 2fA, 5fA, 10fA, 20fA, 50fA, 100fA, 200fA, 500fA, 1pA, 2pA, 5pA, 10pA, 20pA, 50pA, 100pA, 200pA, 500pA, 1nA, 2nA, 5nA, 10nA, 20nA, 50nA, 100nA, 200nA, 500nA, 1uA\n
310 # SENSITIVITY (IMODE == 2) --> 2fA, 5fA, 10fA, 20fA, 50fA, 100fA, 200fA, 500fA, 1pA, 2pA, 5pA, 10pA, 20pA, 50pA, 100pA, 200pA, 500pA, 1nA, 2nA, 5nA, 10nA\n
311  
312 0 ▶ if ( index( $value, "n" ) >= 0 ) {
Branch: 5 branches
BranchTrueFalseTotal
if (index($value, 'n') != -1) { } 0 0 0
elsif (index($value, 'f') != -1) { } 0 0 0
elsif (index($value, 'p') != -1) { } 0 0 0
elsif (index($value, 'u') != -1) { } 0 0 0
elsif (index($value, 'm') != -1) { } 0 0 0
313 0 $value = int($value) * 1e-9;
314 }
315 elsif ( index( $value, "f" ) >= 0 ) {
316 0 $value = int($value) * 1e-15;
317 }
318 elsif ( index( $value, "p" ) >= 0 ) {
319 0 $value = int($value) * 1e-12;
320 }
321 elsif ( index( $value, "u" ) >= 0 ) {
322 0 $value = int($value) * 1e-6;
323 }
324 elsif ( index( $value, "m" ) >= 0 ) {
325 0 $value = int($value) * 1e-3;
326 }
327  
328 0 ▶ if ( exists $matrix[$imode]->{$value} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $matrix[$imode]{$value}) { } 0 0 0
elsif ($value == 'AUTO') { } 0 0 0
329  
330 0 my $cmd = sprintf( "SEN %d", $matrix[$imode]->{$value} );
331 0 $self->write($cmd);
332 }
333 elsif ( $value == "AUTO" ) {
334 0 $self->write("AS");
335 }
336  
337 else {
338 0 Lab::Exception::CorruptParameter->throw( error =>
339 "\nSIGNAL REOCOVERY 726x:\nunexpected value for SENSITIVITY in sub set_sen. Expected values are: \n\n SENSITIVITY (IMODE == 0) --> 2nV, 5nV, 10nV, 20nV, 50nV, 100nV, 200nV, 500nV, 1uV, 2uV, 5uV, 10uV, 20uV, 50uV, 100uV, 200uV, 500uV, 1mV, 2mV, 5mV, 10mV, 20mV, 50mV, 100mV, 200mV, 500mV, 1V\n\n SENSITIVITY (IMODE == 1) --> 2fA, 5fA, 10fA, 20fA, 50fA, 100fA, 200fA, 500fA, 1pA, 2pA, 5pA, 10pA, 20pA, 50pA, 100pA, 200pA, 500pA, 1nA, 2nA, 5nA, 10nA, 20nA, 50nA, 100nA, 200nA, 500nA, 1uA\n\n SENSITIVITY (IMODE == 2) --> 2fA, 5fA, 10fA, 20fA, 50fA, 100fA, 200fA, 500fA, 1pA, 2pA, 5pA, 10pA, 20pA, 50pA, 100pA, 200pA, 500pA, 1nA, 2nA, 5nA, 10nA\n"
340 );
341 }
342  
343 }
344  
345 sub get_sen {
346 0 ▶ my $self = shift;
Subroutine get_sen: not called CC=1 SCAR=6.9
Pod undocumented
347  
348 0 my ($tail) = $self->_check_args( \@_ );
349  
350 0 my @matrix_reverse = (
351 [
352 2e-9, 5e-9, 10e-9, 2e-8, 5e-8, 10e-8, 2e-7, 5e-7,
353 10e-7, 2e-6, 5e-6, 10e-6, 2e-5, 5e-5, 10e-5, 2e-4,
354 5e-4, 10e-4, 2e-3, 5e-3, 10e-3, 2e-2, 5e-2, 10e-2,
355 2e-1, 5e-1, 10e-1
356 ],
357 [
358 2e-15, 5e-15, 10e-15, 2e-14, 5e-14, 10e-14, 2e-13, 5e-13,
359 10e-13, 2e-12, 5e-12, 10e-12, 2e-11, 5e-11, 10e-11, 2e-10,
360 5e-10, 10e-10, 2e-9, 5e-9, 10e-9, 2e-8, 5e-8, 10e-8,
361 2e-7, 5e-7, 10e-7
362 ],
363 [
364 2e-15, 5e-15, 10e-15, 2e-14, 5e-14, 10e-14, 2e-13, 5e-13,
365 10e-13, 2e-12, 5e-12, 10e-12, 2e-11, 5e-11, 10e-11, 2e-10,
366 5e-10, 10e-10, 2e-9, 5e-9, 10e-9
367 ]
368 );
369  
370 0 my $imode = $self->get_imode( { 'read_mode' => "cache" } );
371  
372 0 return $matrix_reverse[$imode][ $self->query("SEN") - 1 ];
373  
374 }
375  
376 sub set_acgain { # basic setting
377 0 ▶ my $self = shift;
Subroutine set_acgain: not called CC=7 SCAR=40.3
Pod documented
378 0 my ($value) = $self->_check_args( \@_, ['value'] );
379  
380 # AC-GAIN == 0 --> 0 dB gain of the signal channel amplifier\n
381 # AC-GAIN == 1 --> 10 dB gain of the signal channel amplifier\n
382 # ...
383 # AC-GAIN == 9 --> 90 dB gain of the signal channel amplifier\n
384  
385 0 ▶ if ( index( $value, "dB" ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($value, "dB") != -1) 0 0 0
386 0 $value = int($value) / 10;
387 }
388  
389 0 ▶ if ( defined $value
Branch: 2 branches
BranchTrueFalseTotal
if (defined $value and int $value == $value and $value <= 9 and $value >= 0) { } 0 0 0
elsif ($value eq 'AUTO') { } 0 0 0
Condition0%0/9
defined $value and int $value == $value and $value <= 9 and $value >= 0
!ll&&!rl&&r
000
defined $value and int $value == $value and $value <= 9
!ll&&!rl&&r
000
defined $value and int $value == $value
!ll&&!rl&&r
000
MC/DC0%0/4
defined $value and int $value == $value and $value <= 9 and $value >= 0
defined $value int $value == $value $value <= 9 $value >= 0
Truth table0%0/5
A and B and C and D
A= defined $valueB= int $value == $valueC= $value <= 9D= $value >= 0
ABCDresult
0XXX0
10XX0
110X0
11100
11111
390 and int($value) == $value
391 and $value <= 9
392 and $value >= 0 ) {
393  
394 0 my $cmd = sprintf( "ACGAIN %d", $value );
395 0 $self->write($cmd);
396 0 my $gain = $self->query("ACGAIN");
397  
398 }
399 elsif ( $value eq "AUTO" ) {
400 0 my $cmd = sprintf("AUTOMATIC 1");
401 0 $self->write($cmd);
402 }
403 else {
404 0 Lab::Exception::CorruptParameter->throw( error =>
405 "\nSIGNAL REOCOVERY 726x:\nunexpected value for AC-GAIN in sub set_acgain. Expected values are:\n AC-GAIN == 0 --> 0 dB gain of the signal channel amplifier\n AC-GAIN == 1 --> 10 dB gain of the signal channel amplifier\n ...\n AC-GAIN == 9 --> 90 dB gain of the signal channel amplifier\n"
406 );
407 }
408  
409 }
410  
411 sub get_acgain {
412 0 ▶ my $self = shift;
Subroutine get_acgain: not called CC=1 SCAR=6.9
Pod undocumented
413  
414 0 my ($tail) = $self->_check_args( \@_ );
415  
416 0 return $self->query( "ACGAIN", $tail );
417 }
418  
419 sub set_linefilter { # basic setting
420 0 ▶ my $self = shift;
Subroutine set_linefilter: not called CC=9 SCAR=45.0
Pod documented
421 0 my ( $value, $linefrequency )
422 = $self->_check_args( \@_, [ 'value', 'line_frequency' ] );
423  
424 0 ▶ if ( not defined $linefrequency ) { $linefrequency = 1; } # 1-->50Hz
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $linefrequency) { } 0 0 0
elsif ($linefrequency eq '50Hz') { } 0 0 0
elsif ($linefrequency eq '60Hz') { } 0 0 0
425 0 elsif ( $linefrequency eq "50Hz" ) { $linefrequency = 1; }
426 0 elsif ( $linefrequency eq "60Hz" ) { $linefrequency = 0; } # 0 --> 60Hz
427 else {
428 0 Lab::Exception::CorruptParameter->throw( error =>
429 "\nSIGNAL REOCOVERY 726x:\nunexpected value for LINEFREQUENCY in sub set_linefilter. Expected values are '50Hz' or '60Hz'."
430 );
431 }
432  
433 # LINE-FILTER == 0 --> OFF\n
434 # LINE-FILTER == 1 --> enable 50Hz/60Hz notch filter\n
435 # LINE-FILTER == 2 --> enable 100Hz/120Hz notch filter\n
436 # LINE-FILTER == 3 --> enable 50Hz/60Hz and 100Hz/120Hz notch filter\n
437  
438 0 ▶ if ( defined $value
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and $value == 0 || $value == 1 || $value == 2 || $value == 3) { } 0 0 0
Condition0%0/12
defined $value and $value == 0 || $value == 1 || $value == 2 || $value == 3
!ll&&!rl&&r
000
$value == 0 or $value == 1 or $value == 2 or $value == 3
l!l&&r!l&&!r
000
$value == 0 or $value == 1 or $value == 2
l!l&&r!l&&!r
000
$value == 0 or $value == 1
l!l&&r!l&&!r
000
MC/DC0%0/5
defined $value and $value == 0 || $value == 1 || $value == 2 || $value == 3
defined $value $value == 0 $value == 1 $value == 2 $value == 3
Truth table0%0/6
A and B or C or D or E
A= defined $valueB= $value == 0C= $value == 1D= $value == 2E= $value == 3
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
439 and ( $value == 0 || $value == 1 || $value == 2 || $value == 3 ) ) {
440  
441 0 my $cmd = sprintf( "LF %d, %d", $value, $linefrequency );
442 0 $self->write($cmd);
443 }
444 else {
445 0 Lab::Exception::CorruptParameter->throw( error =>
446 "\nSIGNAL REOCOVERY 726x:\nunexpected value for FILTER in sub set_linefilter. Expected values are:\n LINE-FILTER == 0 --> OFF\n LINE-FILTER == 1 --> enable 50Hz/60Hz notch filter\n LINE-FILTER == 2 --> enable 100Hz/120Hz notch filter\n LINE-FILTER == 3 --> enable 50Hz/60Hz and 100Hz/120Hz notch filter\n"
447 );
448 }
449  
450 }
451  
452 sub get_linefilter {
453 0 ▶ my $self = shift;
Subroutine get_linefilter: not called CC=1 SCAR=6.9
Pod undocumented
454  
455 0 my ($tail) = $self->_check_args( \@_ );
456  
457 0 return $self->query("LF");
458 }
459  
460 # ------------------REFERENCE CHANNEL ---------------------------
461  
462 sub set_refchannel { # basic setting
463 0 ▶ my $self = shift;
Subroutine set_refchannel: not called CC=4 SCAR=30.0
Pod documented
464 0 my ($value) = $self->_check_args( \@_, ['value'] );
465  
466 # INT --> internal reference input mode\n
467 # EXT LOGIC --> external rear panel TTL input\n
468 # EXT --> external front panel analog input\n
469  
470 0 ▶ if ( $value eq "INT" ) { $value = 0; }
Branch: 3 branches
BranchTrueFalseTotal
if ($value eq 'INT') { } 0 0 0
elsif ($value eq 'EXT LOGIC') { } 0 0 0
elsif ($value eq 'EXT') { } 0 0 0
471 0 elsif ( $value eq "EXT LOGIC" ) { $value = 1; }
472 0 elsif ( $value eq "EXT" ) { $value = 2; }
473 else {
474 0 Lab::Exception::CorruptParameter->throw( error =>
475 "\nSIGNAL REOCOVERY 726x:\nunexpected value for REFERENCE CHANEL in sub set_refchennel. Expected values are:\n INT --> internal reference input mode\n EXT LOGIC --> external rear panel TTL input\n EXT --> external front panel analog input\n"
476 );
477 }
478  
479 0 my $cmd = sprintf( "IE %d", $value );
480 0 $self->write($cmd);
481  
482 }
483  
484 sub get_refchannel {
485 0 ▶ my $self = shift;
Subroutine get_refchannel: not called CC=4 SCAR=30.0
Pod undocumented
486  
487 0 my ($tail) = $self->_check_args( \@_ );
488  
489 0 my $result = $self->query( "IE", $tail );
490  
491 0 ▶ if ( $result == 0 ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($result == 0) { } 0 0 0
elsif ($result == 1) { } 0 0 0
elsif ($result == 2) { } 0 0 0
492 0 return 'INT';
493 }
494 elsif ( $result == 1 ) {
495 0 return 'EXT LOGIC';
496 }
497 elsif ( $result == 2 ) {
498 0 return 'EXT';
499 }
500  
501 }
502  
503 sub autophase { # basic setting
504 0 ▶ my $self = shift;
Subroutine autophase: not called CC=1 SCAR=6.9
Pod documented
505 0 $self->write("AQN");
506 0 usleep( 5 * $self->set_tc() * 1e6 );
507 }
508  
509 sub set_refpha { # basic setting
510 0 ▶ my $self = shift;
Subroutine set_refpha: not called CC=3 SCAR=24.8
Pod documented
511 0 my ($value) = $self->_check_args( \@_, ['value'] );
512  
513 0 ▶ if ( $value >= 0 && $value <= 360 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 0 and $value <= 360) { } 0 0 0
Condition0%0/3
$value >= 0 and $value <= 360
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 0 and $value <= 360
$value >= 0 $value <= 360
Truth table0%0/3
A and B
A= $value >= 0B= $value <= 360
ABresult
0X0
100
111
514 0 $self->write( sprintf( "REFP %d", $value * 1e3 ) );
515 }
516 else {
517 0 Lab::Exception::CorruptParameter->throw( error =>
518 "\nSIGNAL REOCOVERY 726x:\nunexpected value for REFERENCE PHASE in sub set_refpha. Expected values must be in the range 0..360"
519 );
520 }
521 }
522  
523 sub get_refpha { # basic setting
524 0 ▶ my $self = shift;
Subroutine get_refpha: not called CC=1 SCAR=6.9
Pod undocumented
525  
526 0 my ($tail) = $self->_check_args( \@_ );
527  
528 0 my $val = $self->query("REFP.");
529  
530 # Trailing zero byte if phase is zero. Device bug??
531 0 $val =~ s/\0//;
532  
533 0 return $val;
534  
535 }
536  
537 # ----------------- SIGNAL CHANNEL OUTPUT FILTERS ---------------
538  
539 sub set_ouputfilter_slope { # basic setting
540 0 ▶ my $self = shift;
Subroutine set_ouputfilter_slope: not called CC=5 SCAR=34.0
Pod undocumented
541 0 my ($value) = $self->_check_args( \@_, ['value'] );
542  
543 # 6dB --> 6dB/octave slope of output filter\n
544 # 12dB --> 12dB/octave slope of output filter\n
545 # 18dB --> 18dB/octave slope of output filter\n
546 # 24dB --> 24dB/octave slope of output filter\n
547  
548 0 ▶ if ( $value eq "6dB" ) { $value = 0; }
Branch: 4 branches
BranchTrueFalseTotal
if ($value eq '6dB') { } 0 0 0
elsif ($value eq '12dB') { } 0 0 0
elsif ($value eq '18dB') { } 0 0 0
elsif ($value eq '24dB') { } 0 0 0
549 0 elsif ( $value eq "12dB" ) { $value = 1; }
550 0 elsif ( $value eq "18dB" ) { $value = 2; }
551 0 elsif ( $value eq "24dB" ) { $value = 3; }
552 else {
553 0 Lab::Exception::CorruptParameter->throw( error =>
554 "\nSIGNAL REOCOVERY 726x:\nunexpected value for SLOPE in sub set_ouputfilter_slope. Expected values are:\n 6dB --> 6dB/octave slope of output filter\n 12dB --> 12dB/octave slope of output filter\n 18dB --> 18dB/octave slope of output filter\n 24dB --> 24dB/octave slope of output filter\n"
555 );
556 }
557  
558 0 my $cmd = sprintf( "SLOPE %d", $value );
559 0 $self->write($cmd);
560  
561 }
562  
563 sub get_ouputfilter_slope {
564 0 ▶ my $self = shift;
Subroutine get_ouputfilter_slope: not called CC=5 SCAR=34.0
Pod undocumented
565  
566 0 my ($tail) = $self->_check_args( \@_ );
567  
568 0 my $result = $self->query( "SLOPE", $tail );
569  
570 0 ▶ if ( $result == 0 ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($result == 0) { } 0 0 0
elsif ($result == 1) { } 0 0 0
elsif ($result == 2) { } 0 0 0
elsif ($result == 3) { } 0 0 0
571 0 return '6dB';
572 }
573 elsif ( $result == 1 ) {
574 0 return '12dB';
575 }
576 elsif ( $result == 2 ) {
577 0 return '18dB';
578 }
579 elsif ( $result == 3 ) {
580 0 return '24dB';
581 }
582  
583 }
584  
585 sub set_tc { # basic setting
586 0 ▶ my $self = shift;
Subroutine set_tc: not called CC=5 SCAR=34.0
Pod documented
587 0 my ($value) = $self->_check_args( \@_, ['value'] );
588  
589 # Filter Time Constant: 10us, 20us, 40us, 80us, 160us, 320us, 640us, 5ms, 10ms, 20ms, 50ms, 100ms, 200ms, 500ms, 1s, 2s, 5s, 10s, 20s, 50s, 100s, 200s, 500s, 1ks, 2ks, 5ks, 10ks, 20ks, 50ks, 100ks\n
590  
591 0 my %list = (
592 10e-6 => 0,
593 20e-6 => 1,
594 40e-6 => 2,
595 80e-6 => 3,
596 160e-6 => 4,
597 320e-6 => 5,
598 640e-6 => 6,
599 5e-3 => 7,
600 10e-3 => 8,
601 20e-3 => 9,
602 50e-3 => 10,
603 100e-3 => 11,
604 200e-3 => 12,
605 500e-3 => 13,
606 1 => 14,
607 2 => 15,
608 5 => 16,
609 10 => 17,
610 20 => 18,
611 50 => 19,
612 100 => 20,
613 200 => 21,
614 500 => 22,
615 1e3 => 23,
616 2e3 => 24,
617 5e3 => 25,
618 10e3 => 26,
619 20e3 => 27,
620 50e3 => 28,
621 100e3 => 29
622 );
623 0 my @list = (
624 10e-6, 20e-6, 40e-6, 80e-6, 160e-6, 320e-6, 640e-6, 5e-3,
625 10e-3, 20e-3, 50e-3, 100e-3, 200e-3, 500e-3, 1, 2,
626 5, 10, 20, 50, 100, 200, 500, 1e3,
627 2e3, 5e3, 10e3, 20e3, 50e3, 100e3
628 );
629  
630 0 ▶ if ( $value =~ /\b(\d+\.?[\d+]?)us?\b/ ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($value =~ /\b(\d+\.?[\d+]?)us?\b/u) { } 0 0 0
elsif ($value =~ /\b(\d+\.?[\d+]?)ms?\b/u) { } 0 0 0
elsif ($value =~ /\b(\d+\.?[\d+]?)ks?\b/u) { } 0 0 0
631 0 $value = $1 * 1e-6;
632 }
633 elsif ( $value =~ /\b(\d+\.?[\d+]?)ms?\b/ ) {
634 0 $value = $1 * 1e-3;
635 }
636 elsif ( $value =~ /\b(\d+\.?[\d+]?)ks?\b/ ) {
637 0 $value = $1 * 1000;
638 }
639  
640 0 ▶ if ( exists $list{$value} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $list{$value}) { } 0 0 0
641 0 my $cmd = sprintf( "TC %d", $list{$value} );
642 0 $self->write($cmd);
643 }
644 else {
645 0 Lab::Exception::CorruptParameter->throw( error =>
646 "\nSIGNAL REOCOVERY 726x:\nunexpected value for TIME CONSTANT in set_tc. Filter Time Constant TC can be:\n10us, 20us, 40us, 80us, 160us, 320us, 640us, 5ms, 10ms, 20ms, 50ms, 100ms, 200ms, 500ms, 1s, 2s, 5s, 10s, 20s, 50s, 100s, 200s, 500s, 1ks, 2ks, 5ks, 10ks, 20ks, 50ks, 100ks\n"
647 );
648 }
649  
650 }
651  
652 sub get_tc {
653 0 ▶ my $self = shift;
Subroutine get_tc: not called CC=1 SCAR=6.9
Pod undocumented
654  
655 0 my ($tail) = $self->_check_args( \@_ );
656  
657 0 my @list = (
658 10e-6, 20e-6, 40e-6, 80e-6, 160e-6, 320e-6, 640e-6, 5e-3,
659 10e-3, 20e-3, 50e-3, 100e-3, 200e-3, 500e-3, 1, 2,
660 5, 10, 20, 50, 100, 200, 500, 1e3,
661 2e3, 5e3, 10e3, 20e3, 50e3, 100e3
662 );
663  
664 0 my $tc = $self->query( "TC", $tail );
665  
666 0 return $list[$tc];
667 }
668  
669 # ---------------- SIGNAL CHANNEL OUTPUT AMPLIFIERS --------------
670  
671 sub set_offset
672 { # basic setting <-----Hier muessen Fehler noch besser abgefangen werden und eine get_funktion aingefügt werden + caching
673 0 ▶ my $self = shift;
Subroutine set_offset: not called CC=12 SCAR=50.5
Pod undocumented
674 0 my ( $x_value, $y_value ) = $self->_check_args( \@_, [ 'X', 'Y' ] );
675 0 my @offset;
676  
677 0 ▶ if ( $x_value >= -300 || $x_value <= 300 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x_value >= -300 or $x_value <= 300) 0 0 0
Condition0%0/3
$x_value >= -300 or $x_value <= 300
l!l&&r!l&&!r
000
MC/DC0%0/2
$x_value >= -300 or $x_value <= 300
$x_value >= -300 $x_value <= 300
Truth table0%0/3
A or B
A= $x_value >= -300B= $x_value <= 300
ABresult
1X1
011
000
678 0 my $cmd = sprintf( "XOF 1 %d", $x_value * 100 );
679 0 $self->write($cmd);
680 0 my @temp = split( /,/, $self->query("XOF") );
681 0 $offset[0] = $temp[1] / 100;
682 0 ▶ if ( $offset[0] != $x_value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset[0] != $x_value) 0 0 0
683 0 Lab::Exception::CorruptParameter->throw( error =>
684 "\nSIGNAL REOCOVERY 726x:\ncouldn't set X chanel output offset"
685 );
686 }
687 }
688  
689 0 ▶ if ( $y_value >= -300 || $y_value <= 300 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y_value >= -300 or $y_value <= 300) 0 0 0
Condition0%0/3
$y_value >= -300 or $y_value <= 300
l!l&&r!l&&!r
000
MC/DC0%0/2
$y_value >= -300 or $y_value <= 300
$y_value >= -300 $y_value <= 300
Truth table0%0/3
A or B
A= $y_value >= -300B= $y_value <= 300
ABresult
1X1
011
000
690 0 my $cmd = sprintf( "YOF 1 %d", $y_value * 100 );
691 0 $self->write($cmd);
692 0 my @temp = split( /,/, $self->query("YOF") );
693 0 $offset[1] = $temp[1] / 100;
694 0 ▶ if ( $offset[1] != $y_value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset[1] != $y_value) 0 0 0
695 0 Lab::Exception::CorruptParameter->throw( error =>
696 "\nSIGNAL REOCOVERY 726x:\ncouldn't set Y chanel output offset"
697 );
698 }
699 }
700  
701 0 ▶ if ( $x_value eq 'OFF' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x_value eq "OFF") 0 0 0
702 0 $self->write("XOF 0");
703 0 my @temp = split( /,/, $self->query("XOF") );
704 0 $offset[0] = $temp[0];
705 0 ▶ if ( $offset[0] != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset[0] != 0) 0 0 0
706 0 Lab::Exception::CorruptParameter->throw( error =>
707 "\nSIGNAL REOCOVERY 726x:\ncouldn't set X chanel output offset"
708 );
709 }
710 }
711  
712 0 ▶ if ( $y_value eq 'OFF' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y_value eq "OFF") 0 0 0
713 0 $self->write("YOF 0");
714 0 my @temp = split( /,/, $self->query("YOF") );
715 0 $offset[1] = $temp[0];
716 0 ▶ if ( $offset[1] != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset[1] != 0) 0 0 0
717 0 Lab::Exception::CorruptParameter->throw( error =>
718 "\nSIGNAL REOCOVERY 726x:\ncouldn't set Y chanel output offset"
719 );
720 }
721 }
722  
723 0 ▶ if ( $x_value eq 'AUTO' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x_value eq "AUTO") 0 0 0
724 0 $self->write("AXO");
725 0 my @temp = split( /,/, $self->query("XOF") );
726 0 $offset[0] = $temp[1];
727 0 my @temp = split( /,/, $self->query("YOF") );
728 0 $offset[1] = $temp[1];
729 }
730  
731 0 return @offset;
732  
733 }
734  
735 # -------------- INTERNAL OSCILLATOR ------------------------------
736  
737 sub set_osc { # basic setting
738 0 ▶ my $self = shift;
Subroutine set_osc: not called CC=7 SCAR=40.3
Pod documented
739 0 my ($value) = $self->_check_args( \@_, ['value'] );
740  
741 0 my $id = $self->query( "ID", { read_mode => "cache" } );
742  
743 0 ▶ if ( index( $value, "u" ) >= 0 ) {
Branch: 2 branches
BranchTrueFalseTotal
if (index($value, 'u') != -1) { } 0 0 0
elsif (index($value, 'm') != -1) { } 0 0 0
744 0 $value = int($value) * 1e-6;
745 }
746 elsif ( index( $value, "m" ) >= 0 ) {
747 0 $value = int($value) * 1e-3;
748 }
749  
750 0 ▶ if ( $value >= 0 && $value <= 5 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 0 and $value <= 5) { } 0 0 0
Condition0%0/3
$value >= 0 and $value <= 5
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 0 and $value <= 5
$value >= 0 $value <= 5
Truth table0%0/3
A and B
A= $value >= 0B= $value <= 5
ABresult
0X0
100
111
751 0 ▶ if ( $id == 7260 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($id == 7260) { } 0 0 0
elsif ($id == 7265) { } 0 0 0
752 0 $self->write( sprintf( "OA %d", sprintf( "%d", $value * 1e3 ) ) );
753 }
754 elsif ( $id == 7265 ) {
755 0 $self->write( sprintf( "OA %d", sprintf( "%d", $value * 1e6 ) ) );
756 }
757  
758 }
759 else {
760 0 Lab::Exception::CorruptParameter->throw( error =>
761 "\nSIGNAL REOCOVERY 726x:\n\nSIGNAL REOCOVERY 726x:\nunexpected value for OSCILLATOR OUTPUT in sub set_osc. Expected values must be in the range 0..5V."
762 );
763 }
764 }
765  
766 sub get_osc {
767 0 ▶ my $self = shift;
Subroutine get_osc: not called CC=3 SCAR=24.8
Pod undocumented
768  
769 0 my ($tail) = $self->_check_args( \@_ );
770  
771 0 my $id = $self->query( "ID", { read_mode => "cache" } );
772  
773 0 my $osc;
774  
775 0 ▶ if ( $id == 7260 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($id == 7260) { } 0 0 0
elsif ($id == 7265) { } 0 0 0
776 0 return $self->query( "OA", $tail ) / 1e3;
777 }
778 elsif ( $id == 7265 ) {
779 0 return $self->query( "OA", $tail ) / 1e6;
780 }
781  
782 }
783  
784 sub set_frq { # basic setting
785 0 ▶ my $self = shift;
Subroutine set_frq: not called CC=5 SCAR=34.0
Pod documented
786 0 my ($value) = $self->_check_args( \@_, ['value'] );
787  
788 0 ▶ if ( index( $value, "m" ) >= 0 ) {
Branch: 2 branches
BranchTrueFalseTotal
if (index($value, 'm') != -1) { } 0 0 0
elsif (index($value, 'k') != -1) { } 0 0 0
789 0 $value = int($value) * 1e-3;
790 }
791 elsif ( index( $value, "k" ) >= 0 ) {
792 0 $value = int($value) * 1e3;
793 }
794  
795 0 ▶ if ( $value > 0 && $value <= 250000 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value > 0 and $value <= 250000) { } 0 0 0
Condition0%0/3
$value > 0 and $value <= 250000
!ll&&!rl&&r
000
MC/DC0%0/2
$value > 0 and $value <= 250000
$value > 0 $value <= 250000
Truth table0%0/3
A and B
A= $value > 0B= $value <= 250000
ABresult
0X0
100
111
796 0 $self->write( sprintf( "OF %d", $value * 1e3 ) );
797 }
798 else {
799 0 Lab::Exception::CorruptParameter->throw( error =>
800 "\nSIGNAL REOCOVERY 726x:\n\nSIGNAL REOCOVERY 726x:\nunexpected value for OSCILLATOR FREQUENCY in sub set_frq. Expected values must be in the range 0..250kHz"
801 );
802 }
803  
804 }
805  
806 sub get_frq {
807 0 ▶ my $self = shift;
Subroutine get_frq: not called CC=1 SCAR=6.9
Pod undocumented
808  
809 0 my ($tail) = $self->_check_args( \@_ );
810 0 return $self->query( "OF", $tail ) / 1e3;
811 }
812  
813 # --------------- INSTRUMENT OUTPUTS ------------------------------
814  
815 sub get_value { # basic
816 0 ▶ my $self = shift;
Subroutine get_value: not called CC=28 SCAR=67.0
Pod documented
817 0 my ( $channel, $read_mode, $tail )
818 = $self->_check_args( \@_, [ 'channel', 'read_mode' ] );
819  
820 0 my $result;
821  
822 # $channel can be:\n X --> X channel output\n Y --> Y channel output\n MAG --> Magnitude\n PHA --> Signale phase\n XY --> X and Y channel output\n MP --> Magnitude and signal Phase\n ALL --> X,Y, Magnitude and signal Phase\n
823 0 ▶ if ( $channel eq "X" ) {
Branch: 7 branches
BranchTrueFalseTotal
if ($channel eq 'X') { } 0 0 0
elsif ($channel eq 'Y') { } 0 0 0
elsif ($channel eq 'MAG') { } 0 0 0
elsif ($channel eq 'PHA') { } 0 0 0
elsif ($channel eq 'XY') { } 0 0 0
elsif ($channel eq 'MP') { } 0 0 0
elsif ($channel eq 'ALL' or $channel eq '') { } 0 0 0
824  
825 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"}) 0 0 0
Condition0%0/3
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"}
!ll&&!rl&&r
000
MC/DC0%0/2
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"X"}
Truth table0%0/3
A and B
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"X"}
ABresult
0X0
100
111
826 and defined $self->{'device_cache'}->{'value'}->{'X'} ) {
827 0 return $self->{'device_cache'}->{'value'}->{'X'};
828 }
829  
830 0 $result = $self->query( "X.", $tail );
831 0 $result =~ s/\x00//g;
832 0 $self->{'device_cache'}->{'value'}->{'X'} = $result;
833 0 return $result;
834 }
835 elsif ( $channel eq "Y" ) {
836  
837 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"Y"}) 0 0 0
Condition0%0/3
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"Y"}
!ll&&!rl&&r
000
MC/DC0%0/2
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"Y"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"Y"}
Truth table0%0/3
A and B
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"Y"}
ABresult
0X0
100
111
838 and defined $self->{'device_cache'}->{'value'}->{'Y'} ) {
839 0 return $self->{'device_cache'}->{'value'}->{'Y'};
840 }
841  
842 0 $result = $self->query( "Y.", $tail );
843 0 $result =~ s/\x00//g;
844 0 $self->{'device_cache'}->{'value'}->{'Y'} = $result;
845 0 return $result;
846 }
847 elsif ( $channel eq "MAG" ) {
848  
849 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"}) 0 0 0
Condition0%0/3
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"}
!ll&&!rl&&r
000
MC/DC0%0/2
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"MAG"}
Truth table0%0/3
A and B
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"MAG"}
ABresult
0X0
100
111
850 and defined $self->{'device_cache'}->{'value'}->{'MAG'} ) {
851 0 return $self->{'device_cache'}->{'value'}->{'MAG'};
852 }
853  
854 0 $result = $self->query( "MAG.", $tail );
855 0 $result =~ s/\x00//g;
856 0 $self->{'device_cache'}->{'value'}->{'MAG'} = $result;
857 0 return $result;
858 }
859 elsif ( $channel eq "PHA" ) {
860  
861 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"PHA"}) 0 0 0
Condition0%0/3
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"PHA"}
!ll&&!rl&&r
000
MC/DC0%0/2
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"PHA"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"PHA"}
Truth table0%0/3
A and B
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"PHA"}
ABresult
0X0
100
111
862 and defined $self->{'device_cache'}->{'value'}->{'PHA'} ) {
863 0 return $self->{'device_cache'}->{'value'}->{'PHA'};
864 }
865  
866 0 $result = $self->query( "PHA.", $tail );
867 0 $result =~ s/\x00//g;
868 0 $self->{'device_cache'}->{'value'}->{'PHA'} = $result;
869 0 return $result;
870 }
871 elsif ( $channel eq "XY" ) {
872  
873 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"}) 0 0 0
Condition0%0/6
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"}
!ll&&!rl&&r
000
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"}
!ll&&!rl&&r
000
MC/DC0%0/3
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"X"} defined $self->{"device_cache"}{"value"}{"Y"}
Truth table0%0/4
A and B and C
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"X"}C= defined $self->{"device_cache"}{"value"}{"Y"}
ABCresult
0XX0
10X0
1100
1111
874 and defined $self->{'device_cache'}->{'value'}->{'X'}
875 and defined $self->{'device_cache'}->{'value'}->{'Y'} ) {
876 0 return $self->{'device_cache'}->{'value'};
877 }
878  
879 0 $result = $self->query( "XY.", $tail );
880 0 $result =~ s/\x00//g;
881  
882 (
883 $self->{'device_cache'}->{'value'}->{'X'},
884 0 $self->{'device_cache'}->{'value'}->{'Y'}
885 ) = split( ",", $result );
886  
887 0 return $self->{'device_cache'}->{'value'};
888 }
889 elsif ( $channel eq "MP" ) {
890  
891 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"} and defined $self->{"device_cache"}{"value"}{"PHA"}) 0 0 0
Condition0%0/6
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"} and defined $self->{"device_cache"}{"value"}{"PHA"}
!ll&&!rl&&r
000
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"}
!ll&&!rl&&r
000
MC/DC0%0/3
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"MAG"} and defined $self->{"device_cache"}{"value"}{"PHA"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"MAG"} defined $self->{"device_cache"}{"value"}{"PHA"}
Truth table0%0/4
A and B and C
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"MAG"}C= defined $self->{"device_cache"}{"value"}{"PHA"}
ABCresult
0XX0
10X0
1100
1111
892 and defined $self->{'device_cache'}->{'value'}->{'MAG'}
893 and defined $self->{'device_cache'}->{'value'}->{'PHA'} ) {
894 0 return $self->{'device_cache'}->{'value'};
895 }
896  
897 0 $result = $self->query( "MP.", $tail );
898 0 $result =~ s/\x00//g;
899 (
900 $self->{'device_cache'}->{'value'}->{'MAG'},
901 0 $self->{'device_cache'}->{'value'}->{'PHA'}
902 ) = split( ",", $result );
903 0 return $self->{'device_cache'}->{'value'};
904 }
905 ▶ elsif ( $channel eq "ALL" or $channel eq "" ) {
Condition0%0/3
$channel eq "ALL" or $channel eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
$channel eq "ALL" or $channel eq ""
$channel eq "ALL" $channel eq ""
Truth table0%0/3
A or B
A= $channel eq "ALL"B= $channel eq ""
ABresult
1X1
011
000
906  
907 0 ▶ if ( $read_mode eq 'cache'
Branch: 1 branch
BranchTrueFalseTotal
if ($read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"} and defined $self->{"device_cache"}{"value"}{"MAG"} and defined $self->{"device_cache"}{"value"}{"PHA"}) 0 0 0
Condition0%0/12
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"} and defined $self->{"device_cache"}{"value"}{"MAG"} and defined $self->{"device_cache"}{"value"}{"PHA"}
!ll&&!rl&&r
000
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"} and defined $self->{"device_cache"}{"value"}{"MAG"}
!ll&&!rl&&r
000
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"}
!ll&&!rl&&r
000
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"}
!ll&&!rl&&r
000
MC/DC0%0/5
$read_mode eq "cache" and defined $self->{"device_cache"}{"value"}{"X"} and defined $self->{"device_cache"}{"value"}{"Y"} and defined $self->{"device_cache"}{"value"}{"MAG"} and defined $self->{"device_cache"}{"value"}{"PHA"}
$read_mode eq "cache" defined $self->{"device_cache"}{"value"}{"X"} defined $self->{"device_cache"}{"value"}{"Y"} defined $self->{"device_cache"}{"value"}{"MAG"} defined $self->{"device_cache"}{"value"}{"PHA"}
Truth table0%0/6
A and B and C and D and E
A= $read_mode eq "cache"B= defined $self->{"device_cache"}{"value"}{"X"}C= defined $self->{"device_cache"}{"value"}{"Y"}D= defined $self->{"device_cache"}{"value"}{"MAG"}E= defined $self->{"device_cache"}{"value"}{"PHA"}
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
908 and defined $self->{'device_cache'}->{'value'}->{'X'}
909 and defined $self->{'device_cache'}->{'value'}->{'Y'}
910 and defined $self->{'device_cache'}->{'value'}->{'MAG'}
911 and defined $self->{'device_cache'}->{'value'}->{'PHA'} ) {
912 0 return $self->{'device_cache'}->{'value'};
913 }
914  
915 0 $result = $self->query( "XY.", $tail ) . ","
916 . $self->query( "MP.", $tail );
917 0 $result =~ s/\x00//g;
918 (
919 $self->{'device_cache'}->{'value'}->{'X'},
920 $self->{'device_cache'}->{'value'}->{'Y'},
921 $self->{'device_cache'}->{'value'}->{'MAG'},
922 0 $self->{'device_cache'}->{'value'}->{'PHA'}
923 ) = split( ",", $result );
924 0 return $self->{'device_cache'}->{'value'};
925 }
926 else {
927 0 Lab::Exception::CorruptParameter->throw( error =>
928 "\nSIGNAL REOCOVERY 726x:\nCHANNEL can be:\n X --> X channel output\n Y --> Y channel output\n MAG --> Magnitude\n PHA --> Signale phase\n XY --> X and Y channel output\n MP --> Magnitude and signal Phase\n ALL --> X,Y, Magnitude and signal Phase\n"
929 );
930 }
931 }
932  
933 sub config_measurement { # basic
934  
935 0 ▶ my $self = shift;
Subroutine config_measurement: not called CC=17 SCAR=57.2
Pod documented
936  
937 0 my ( $channel, $nop, $interval, $trigger ) = $self->_check_args(
938 \@_,
939 [ 'channel', 'nop', 'interval', 'trigger' ]
940 );
941  
942 0 print "--------------------------------------\n";
943 0 print "SignalRecovery sub config_measurement:\n";
944  
945 0 $self->_clear_buffer();
946  
947 # select which data to store in buffer
948 0 ▶ if ( $channel eq "X" ) { $channel = 17; }
Branch: 14 branches
BranchTrueFalseTotal
if ($channel eq 'X') { } 0 0 0
elsif ($channel eq 'Y') { } 0 0 0
elsif ($channel eq 'XY') { } 0 0 0
elsif ($channel eq 'MAG') { } 0 0 0
elsif ($channel eq 'PHA') { } 0 0 0
elsif ($channel eq 'MP') { } 0 0 0
elsif ($channel eq 'ALL') { } 0 0 0
elsif ($channel eq 'X-') { } 0 0 0
elsif ($channel eq 'Y-') { } 0 0 0
elsif ($channel eq 'XY-') { } 0 0 0
elsif ($channel eq 'MAG-') { } 0 0 0
elsif ($channel eq 'PHA-') { } 0 0 0
elsif ($channel eq 'MP-') { } 0 0 0
elsif ($channel eq 'ALL-') { } 0 0 0
949 0 elsif ( $channel eq "Y" ) { $channel = 18; }
950 0 elsif ( $channel eq "XY" ) { $channel = 19; }
951 0 elsif ( $channel eq "MAG" ) { $channel = 20; }
952 0 elsif ( $channel eq "PHA" ) { $channel = 24; }
953 0 elsif ( $channel eq "MP" ) { $channel = 28; }
954 0 elsif ( $channel eq "ALL" ) { $channel = 31; }
955 elsif ( $channel eq "X-" ) {
956 0 $channel = 1;
957 } # only X channel; Sensitivity not logged --> floating point read out not possible!
958 elsif ( $channel eq "Y-" ) {
959 0 $channel = 2;
960 } # only Y channel; Sensitivity not logged --> floating point read out not possible!
961 elsif ( $channel eq "XY-" ) {
962 0 $channel = 3;
963 } # only XY channel; Sensitivity not logged --> floating point read out not possible!
964 elsif ( $channel eq "MAG-" ) {
965 0 $channel = 4;
966 } # only MAG channel; Sensitivity not logged --> floating point read out not possible!
967 elsif ( $channel eq "PHA-" ) {
968 0 $channel = 8;
969 } # only PHA channel; Sensitivity not logged --> floating point read out not possible!
970 elsif ( $channel eq "MP-" ) {
971 0 $channel = 12;
972 } # only MP channel; Sensitivity not logged --> floating point read out not possible!
973 elsif ( $channel eq "ALL-" ) {
974 0 $channel = 15;
975 } # only XYMP channel; Sensitivity not logged --> floating point read out not possible!
976 else {
977 0 Lab::Exception::CorruptParameter->throw( error =>
978 "\nSIGNAL REOCOVERY 726x:\nunexpected value for DATA CHANNELS in sub config_measurement. Expected values are:\n X --> X channel output\n XY --> X and Y channel output\n MAG --> MAG channel output\n PHA --> PHA channel output\n MP --> MAG and PHA channel output\n ALL --> X,Y, Magnitude and signal Phase\n \n X- --> X channel output without Sensitivity \n XY- --> X and Y channel output without Sensitivity\n MAG- --> MAG channel output without Sensitivity\n PHA- --> PHA channel output without Sensitivity\n MP- --> MAG and PHA channel output without Sensitivity\n ALL- --> X,Y, Magnitude and signal Phase without Sensitivity\n"
979 );
980 }
981 0 $self->_set_buffer_datachannels($channel);
982  
983 0 print "SIGNAL REOCOVERY 726x: set channels: "
984 . $self->_set_buffer_datachannels($channel);
985  
986 # set buffer size
987 0 print "SIGNAL REOCOVERY 726x: set buffer length: "
988 . $self->_set_buffer_length($nop);
989  
990 # set measuremnt interval
991 0 ▶ if ( not defined $interval ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $interval) 0 0 0
992 0 $interval = $self->set_tc();
993 }
994 0 print "SIGNAL REOCOVERY 726x: set storage interval: "
995 . $self->_set_buffer_storageinterval($interval) . "\n";
996  
997 0 ▶ if ( $trigger eq "EXT" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($trigger eq "EXT") 0 0 0
998 0 $self->write("TDT");
999 0 usleep(1e6);
1000 }
1001  
1002 0 print "SignalRecovery config_measurement complete\n";
1003 0 print "--------------------------------------\n";
1004  
1005 }
1006  
1007 sub get_data { # basic
1008  
1009 0 ▶ my $self = shift;
Subroutine get_data: not called CC=10 SCAR=47.0
Pod documented
1010  
1011 0 my ( $SEN, $timeout ) = $self->_check_args( \@_, [ 'SEN', 'timeout' ] );
1012  
1013 0 my @dummy;
1014 my @data;
1015 0 my %channel_list = (
1016 1 => "0",
1017 2 => "1",
1018 3 => "0,1",
1019 4 => "2",
1020 8 => "3",
1021 12 => "2,3",
1022 15 => "0,1,2,3",
1023 17 => "0",
1024 18 => "1",
1025 19 => "0,1",
1026 20 => "2",
1027 24 => "3",
1028 28 => "2,3",
1029 31 => "0,1,2,3"
1030 );
1031  
1032 # it takes approx. 4ms per datapoint; 25k-Points --> 100sec
1033  
1034 # reduce Time-Out for READ
1035 0 ▶ if ( not defined $timeout ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $timeout) 0 0 0
1036 0 $timeout = 100;
1037 }
1038  
1039 my $status = Lab::VISA::viSetAttribute(
1040 $self->{vi}->{instr},
1041 0 $Lab::VISA::VI_ATTR_TMO_VALUE, $timeout
1042 );
1043 0 ▶ if ( $status != $Lab::VISA::VI_SUCCESS ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status != $Lab::VISA::VI_SUCCESS) 0 0 0
1044 0 Lab::Exception::CorruptParameter->throw(
1045 error => "Error while setting baud: $status" );
1046 }
1047  
1048 0 my @channels = split( ",", $channel_list{ int( $self->query("CBD") ) } );
1049  
1050 #if ($channels == 17) { $channels = 1; }
1051 #elsif ($channels == 19) { $channels = 2; }
1052 #elsif ($channels == 31) { $channels = 4; }
1053  
1054 0 $self->wait(); # wait until active sweep has been finished
1055  
1056 0 foreach my $i (@channels) {
1057 0 ▶ if ( defined $SEN and $SEN >= 2e-15 and $SEN <= 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $SEN and $SEN >= 2e-15 and $SEN <= 1) { } 0 0 0
Condition0%0/6
defined $SEN and $SEN >= "2e-15" and $SEN <= 1
!ll&&!rl&&r
000
defined $SEN and $SEN >= "2e-15"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $SEN and $SEN >= "2e-15" and $SEN <= 1
defined $SEN $SEN >= "2e-15" $SEN <= 1
Truth table0%0/4
A and B and C
A= defined $SENB= $SEN >= "2e-15"C= $SEN <= 1
ABCresult
0XX0
10X0
1100
1111
1058 0 $self->write( sprintf( "DC %d", $i ) );
1059 0 my @temp;
1060 my $data;
1061  
1062 0 while (1) {
1063 0 eval '$self->read(100)*$SEN*0.01';
1064 0 ▶ if ( $@ =~ /(Error while reading:)/ ) { last; }
Branch: 1 branch
BranchTrueFalseTotal
if ($@ =~ /(Error while reading:)/u) 0 0 0
1065 0 push( @temp, $data );
1066 }
1067 0 push( @data, \@temp );
1068  
1069 }
1070 else {
1071 0 $self->write( sprintf( "DC. %d", $i ) );
1072 0 my @temp;
1073 my $data;
1074  
1075 0 while (1) {
1076 0 eval '$data = $self->read(100)';
1077 0 ▶ if ( $@ =~ /(Error while reading:)/ ) { last; }
Branch: 1 branch
BranchTrueFalseTotal
if ($@ =~ /(Error while reading:)/u) 0 0 0
1078 0 push( @temp, $data );
1079 }
1080 0 push( @data, \@temp );
1081 }
1082  
1083 }
1084  
1085 # set Time-Out for READ back to default value
1086 my $status = Lab::VISA::viSetAttribute(
1087 $self->{vi}->{instr},
1088 0 $Lab::VISA::VI_ATTR_TMO_VALUE, 3000
1089 );
1090 0 ▶ if ( $status != $Lab::VISA::VI_SUCCESS ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status != $Lab::VISA::VI_SUCCESS) 0 0 0
1091 0 Lab::Exception::CorruptParameter->throw(
1092 error => "Error while setting baud: $status" );
1093 }
1094  
1095 0 return @data;
1096  
1097 }
1098  
1099 sub trg { # basic
1100 0 ▶ my $self = shift;
Subroutine trg: not called CC=1 SCAR=6.9
Pod documented
1101 0 $self->write("TD");
1102 }
1103  
1104 sub abort { # basic
1105  
1106 0 ▶ my $self = shift;
Subroutine abort: not called CC=1 SCAR=6.9
Pod documented
1107  
1108 0 $self->write("HC");
1109  
1110 }
1111  
1112 sub active {
1113 0 ▶ my $self = shift;
Subroutine active: not called CC=2 SCAR=17.9
Pod documented
1114  
1115 0 my @status = split( ",", $self->query("M") );
1116 0 ▶ if ( $status[0] == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status[0] == 0) { } 0 0 0
1117 0 return 0;
1118 }
1119 else {
1120 0 return 1;
1121 }
1122  
1123 }
1124  
1125 sub wait {
1126 0 ▶ my $self = shift;
Subroutine wait: not called CC=2 SCAR=17.9
Pod documented
1127  
1128 0 while (1) {
1129 0 usleep(1e3);
1130 0 my @status = split( ",", $self->query("M") );
1131 0 ▶ if ( $status[0] == 0 ) { last; }
Branch: 1 branch
BranchTrueFalseTotal
if ($status[0] == 0) 0 0 0
1132 }
1133 0 return 0;
1134 }
1135  
1136 # --------------- DISPLAY ------------------------------
1137  
1138 sub display_on { # basic setting
1139  
1140 0 ▶ my $self = shift;
Subroutine display_on: not called CC=1 SCAR=6.9
Pod documented
1141 0 $self->write("LTS 1");
1142 }
1143  
1144 sub display_off { # basic setting
1145  
1146 0 ▶ my $self = shift;
Subroutine display_off: not called CC=1 SCAR=6.9
Pod documented
1147 0 $self->write("LTS 0");
1148 }
1149  
1150 # --------------- OUTPUT DATA CURVE BUFFER -------------------------
1151  
1152 sub _clear_buffer { # internal / advanced use only
1153  
1154 0 ▶ my $self = shift;
Subroutine _clear_buffer: not called CC=1 SCAR=6.9
1155  
1156 0 $self->write("NC");
1157  
1158 }
1159  
1160 sub _set_buffer_datachannels { # internal / advanced use only
1161  
1162 0 ▶ my $self = shift;
Subroutine _set_buffer_datachannels: not called CC=2 SCAR=17.9
1163 0 my ($value) = $self->_check_args( \@_, ['value'] );
1164  
1165 0 ▶ if ( not defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
1166 0 return $self->query("CBD");
1167 }
1168  
1169 0 $self->write( sprintf( "CBD %d", $value ) );
1170 0 return $self->query("CBD");
1171 }
1172  
1173 sub _set_buffer_length { # internal / advanced use only
1174  
1175 0 ▶ my $self = shift;
Subroutine _set_buffer_length: not called CC=6 SCAR=37.4
1176 0 my ($nop) = $self->_check_args( \@_, ['nop'] );
1177  
1178 0 ▶ if ( not defined $nop ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $nop) 0 0 0
1179 0 return $self->query("LEN");
1180 }
1181  
1182 # get number of channels to be stored
1183 0 my $channels = $self->query("CBD");
1184 0 ▶ if ( $channels == 17 ) { $channels = 2; }
Branch: 3 branches
BranchTrueFalseTotal
if ($channels == 17) { } 0 0 0
elsif ($channels == 19) { } 0 0 0
elsif ($channels == 31) { } 0 0 0
1185 0 elsif ( $channels == 19 ) { $channels = 3; }
1186 0 elsif ( $channels == 31 ) { $channels = 5; }
1187  
1188 # check buffer size
1189 0 ▶ if ( $nop > int( 32000 / $channels ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nop > int 32000 / $channels) 0 0 0
1190 0 Lab::Exception::CorruptParameter->throw( error =>
1191 "\nSIGNAL REOCOVERY 726x:\n\nSIGNAL REOCOVERY 726x:\ncan't init BUFFER. Buffersize is too small for the given NUMBER OF POINTS and NUMBER OF CHANNELS to store.\n POINTS x (CHANNELS+1) cant exceed 32000.\n"
1192 );
1193 }
1194  
1195 0 $self->write( sprintf( "LEN %d", $nop ) );
1196 0 return my $return = $self->query("LEN");
1197  
1198 }
1199  
1200 sub _set_buffer_storageinterval { # internal / advanced use only
1201  
1202 0 ▶ my $self = shift;
Subroutine _set_buffer_storageinterval: not called CC=4 SCAR=30.0
1203 0 my ($interval) = $self->_check_args( \@_, ['value'] );
1204  
1205 0 ▶ if ( not defined $interval ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $interval) 0 0 0
1206 0 return $self->query("STR") / 1e3;
1207 }
1208  
1209 0 ▶ if ( $interval < 5e-3 or $interval > 1e6 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($interval < "0.005" or $interval > 1000000) 0 0 0
Condition0%0/3
$interval < "0.005" or $interval > 1000000
l!l&&r!l&&!r
000
MC/DC0%0/2
$interval < "0.005" or $interval > 1000000
$interval < "0.005" $interval > 1000000
Truth table0%0/3
A or B
A= $interval < "0.005"B= $interval > 1000000
ABresult
1X1
011
000
1210 0 Lab::Exception::CorruptParameter->throw( error =>
1211 "\nSIGNAL REOCOVERY 726x:\nunexpected value for INTERVAL in sub set_buffer_interval. Expected values are between 5ms...1E6s with a resolution of 5ms."
1212 );
1213 }
1214  
1215 0 $self->write( sprintf( "STR %d", $interval * 1e3 ) );
1216  
1217 0 return $self->query("STR") / 1e3;
1218  
1219 }
1220  
1221 1 1;
1222  
1223 __END__
1224  
1225 =pod
1226  
1227 =encoding UTF-8
1228  
1229 =head1 NAME
1230  
1231 Lab::Instrument::SignalRecovery726x - Signal Recovery 7260 / 7265 Lock-in Amplifier
1232  
1233 =head1 VERSION
1234  
1235 version 3.881
1236  
1237 =head1 SYNOPSIS
1238  
1239 use as GPIB-device
1240  
1241 ---------------------
1242  
1243 use Lab::Instrument::SignalRecovery726x;
1244 my $SR = new Lab::Instrument::SignalRecovery726x(0,22);
1245 print $SR->get_value('XY');
1246  
1247 .
1248  
1249 use as RS232-device
1250  
1251 ----------------------
1252  
1253 use Lab::Instrument::RS232;
1254 use Lab::Instrument::SignalRecovery726x;
1255 my $RS232 = new Lab::Instrument::RS232('ASRL1::INSTR'); # ASRL1::INSTR = COM 1, ASRL2::INSTR = COM 2, ...
1256 my $SR = new Lab::Instrument::SignalRecovery726x($RS232);
1257 print $SR->get_value('XY');
1258  
1259 .
1260  
1261 =head1 DESCRIPTION
1262  
1263 The Lab::Instrument::SignalRecovery726x class implements an interface to the Signal Recovery 7260 / 7265 Lock-in Amplifier.
1264 Note that the module Lab::Instrument::SignalRecovery726x can work via GPIB or RS232 interface.
1265  
1266 =head1 CONSTRUCTOR
1267  
1268 my $SR = new(\%options);
1269  
1270 =head1 METHODS
1271  
1272 =head2 get_value
1273  
1274 $value=$SR->get_value($channel);
1275  
1276 Makes a measurement using the actual settings.
1277 The CHANNELS defined by $channel are returned as floating point values.
1278 If more than one value is requested, they will be returned as an array.
1279  
1280 =over 4
1281  
1282 =item $channel
1283  
1284 CHANNEL can be:
1285  
1286 in floating point notation:
1287  
1288 -----------------------------
1289  
1290 'X' --> X channel output\n
1291 'Y' --> Y channel output\n
1292 'MAG' --> Magnitude\n
1293 'PHA' --> Signale phase\n
1294 'XY' --> X and Y channel output\n
1295 'MP' --> Magnitude and signal Phase\n
1296 'ALL' --> X,Y, Magnitude and signal Phase\n
1297  
1298 =back
1299  
1300 =head2 config_measurement
1301  
1302 $SR->config_measurement($channel, $number_of_points, $interval, [$trigger]);
1303  
1304 Preset the Signal Recovery 7260 / 7265 Lock-in Amplifier for a TRIGGERED measurement.
1305  
1306 =over 4
1307  
1308 =item $channel
1309  
1310 CHANNEL can be:
1311  
1312 in floating point notation:
1313  
1314 -----------------------------
1315  
1316 'X' --> X channel output\n
1317 'Y' --> Y channel output\n
1318 'MAG' --> Magnitude\n
1319 'PHA' --> Signale phase\n
1320 'XY' --> X and Y channel output\n
1321 'MP' --> Magnitude and signal Phase\n
1322 'ALL' --> X,Y, Magnitude and signal Phase\n
1323  
1324 .
1325  
1326 in percent of full range notation:
1327  
1328 ------------------------------------
1329  
1330 'X-' --> X channel output\n
1331 'Y-' --> Y channel output\n
1332 'MAG-' --> Magnitude\n
1333 'PHA-' --> Signale phase\n
1334 'XY-' --> X and Y channel output\n
1335 'MP-' --> Magnitude and signal Phase\n
1336 'ALL-' --> X,Y, Magnitude and signal Phase\n
1337  
1338 =item $number_of_points
1339  
1340 Preset the NUMBER OF POINTS to be taken for one measurement trace.
1341 The single measured points will be stored in the internal memory of the Lock-in Amplifier.
1342 For the Signal Recovery 7260 / 7265 Lock-in Amplifier the internal memory is limited to 32.000 values.
1343  
1344 --> If you request data for the channels X and Y in floating point notation, for each datapoint three values have to be stored in memory (X,Y and Sensitivity).
1345 --> So you can store effectivly 32.000/3 = 10666 datapoints.
1346 --> You can force the instrument not to store additionally the current value of the Sensitivity setting by appending a '-' when you select the channels, eg. 'XY-' instead of simply 'XY'.
1347 --> Now you will recieve only values between -30000 ... + 30000 from the Lock-in, which is called the full range notation.
1348 --> You can calculate the measurement value by ($value/100)*Sensitivity. This is easy if you used only a single setting for Sensitivity during the measurement, and it's very hard if you changed the Sensitivity several times during the measurment or even used the auto-range function.
1349  
1350 =item $interval
1351  
1352 Preset the STORAGE INTERVAL in which datavalues will be stored during the measurement.
1353 Note: the storage interval is independent from the low pass filters time constant tc.
1354  
1355 =item $trigger
1356  
1357 Ooptional value. Presets the source where the trigger signal is expected.
1358 'EXT' --> external trigger source
1359 'INT' --> internal trigger source
1360  
1361 DEF is 'INT'. If no value is given, DEF will be selected.
1362  
1363 =back
1364  
1365 .
1366  
1367 =head2 trg
1368  
1369 $SR->trg();
1370  
1371 Sends a trigger signal via the GPIB-BUS to start the predefined measurement.
1372 The LabVisa-script can immediatally be continued, e.g. to start another triggered measurement using a second Signal Recovery 7260 / 7265 Lock-in Amplifier.
1373  
1374 .
1375  
1376 =head2 get_data
1377  
1378 @data = $SR->get_data(<$sensitivity>);
1379  
1380 Reads all recorded values from the internal buffer and returns them as an (2-dim) array of floatingpoint values.
1381  
1382 Example:
1383  
1384 requested channels: X --> $SR->get_data(); returns an 1-dim array containing the X-trace as floatingpoint-values
1385 requested channels: XY --> $SR->get_data(); returns an 2-dim array:
1386 --> @data[0] contains an 1-dim array containing the X-trace as floatingpoint-values
1387 --> @data[1] contains an 1-dim array containing the Y-trace as floatingpoint-values
1388  
1389 Note: Reading the buffer will not start before all predevined measurement values have been recorded.
1390 The LabVisa-script cannot be continued until all requested readings have been recieved.
1391  
1392 =over 4
1393  
1394 =item $sensitivity
1395  
1396 SENSITIVITY is an optional parameter.
1397 When it is defined, it will be assumed that the data recieved from the Lock-in are in full range notation.
1398 The return values will be calculated by $value = ($value/100)*$sensitifity.
1399  
1400 =back
1401  
1402 =head2 abort
1403  
1404 $SR->abort();
1405  
1406 Aborts current (triggered) measurement.
1407  
1408 =head2 wait
1409  
1410 $SR->wait();
1411  
1412 Waits until current (triggered) measurement has been finished.
1413  
1414 =head2 active
1415  
1416 $SR->active();
1417  
1418 Returns '1' if current (triggered) measurement is still running and '0' if current (triggered) measurement has been finished.
1419  
1420 =head2 set_imode
1421  
1422 $SR->set_imode($imode);
1423  
1424 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1425  
1426 =over 4
1427  
1428 =item $imode
1429  
1430 $imode == 0 --> Current Mode OFF
1431 $imode == 1 --> High Bandwidth Current Mode
1432 $imode == 2 --> Low Noise Current Mode
1433  
1434 =back
1435  
1436 =head2 set_vmode
1437  
1438 $SR->set_vmode($vmode);
1439  
1440 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1441  
1442 =over 4
1443  
1444 =item $vmode
1445  
1446 $vmode == 0 --> Both inputs grounded (testmode)
1447 $vmode == 1 --> A input only
1448 $vmode == 2 --> -B input only
1449 $vmode == 3 --> A-B differential mode
1450  
1451 =back
1452  
1453 =head2 set_fet
1454  
1455 $SR->set_fet($value);
1456  
1457 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1458  
1459 =over 4
1460  
1461 =item $value
1462  
1463 $value == 0 --> Bipolar device, 10 kOhm input impedance, 2nV/sqrt(Hz) voltage noise at 1 kHz
1464 $value == 1 --> FET, 10 MOhm input impedance, 5nV/sqrt(Hz) voltage noise at 1 kHz
1465  
1466 =back
1467  
1468 =head2 set_float
1469  
1470 $SR->set_float($value);
1471  
1472 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1473  
1474 =over 4
1475  
1476 =item $value
1477  
1478 $value == 0 --> input conector shield set to GROUND
1479 $value == 1 --> input conector shield set to FLOAT
1480  
1481 =back
1482  
1483 .
1484  
1485 =head2 set_cp
1486  
1487 $SR->set_cp($value);
1488  
1489 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1490  
1491 =over 4
1492  
1493 =item $value
1494  
1495 $value == 0 --> input coupling mode AC\n
1496 $value == 1 --> input coupling mode DC\n
1497  
1498 =back
1499  
1500 =head2 set_linefilter
1501  
1502 $SR->set_linefilter($value);
1503  
1504 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1505  
1506 =over 4
1507  
1508 =item $value
1509  
1510 LINE-FILTER == 0 --> OFF\n
1511 LINE-FILTER == 1 --> enable 50Hz/60Hz notch filter\n
1512 LINE-FILTER == 2 --> enable 100Hz/120Hz notch filter\n
1513 LINE-FILTER == 3 --> enable 50Hz/60Hz and 100Hz/120Hz notch filter\n
1514  
1515 =back
1516  
1517 =head2 set_acgain
1518  
1519 $SR->set_acgain($value);
1520  
1521 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1522  
1523 =over 4
1524  
1525 =item $value
1526  
1527 AC-GAIN == 0 --> 0 dB gain of the signal channel amplifier\n
1528 AC-GAIN == 1 --> 10 dB gain of the signal channel amplifier\n
1529 ...
1530 AC-GAIN == 9 --> 90 dB gain of the signal channel amplifier\n
1531  
1532 =back
1533  
1534 =head2 set_sen
1535  
1536 $SR->set_sen($value);
1537  
1538 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1539  
1540 =over 4
1541  
1542 =item $value
1543  
1544 SENSITIVITY (IMODE == 0) --> 2nV, 5nV, 10nV, 20nV, 50nV, 100nV, 200nV, 500nV, 1uV, 2uV, 5uV, 10uV, 20uV, 50uV, 100uV, 200uV, 500uV, 1mV, 2mV, 5mV, 10mV, 20mV, 50mV, 100mV, 200mV, 500mV, 1V\n
1545 SENSITIVITY (IMODE == 1) --> 2fA, 5fA, 10fA, 20fA, 50fA, 100fA, 200fA, 500fA, 1pA, 2pA, 5pA, 10pA, 20pA, 50pA, 100pA, 200pA, 500pA, 1nA, 2nA, 5nA, 10nA, 20nA, 50nA, 100nA, 200nA, 500nA, 1uA\n
1546 SENSITIVITY (IMODE == 2) --> 2fA, 5fA, 10fA, 20fA, 50fA, 100fA, 200fA, 500fA, 1pA, 2pA, 5pA, 10pA, 20pA, 50pA, 100pA, 200pA, 500pA, 1nA, 2nA, 5nA, 10nA\n
1547  
1548 =back
1549  
1550 =head2 set_refchannel
1551  
1552 $SR->set_refchannel($value);
1553  
1554 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1555  
1556 =over 4
1557  
1558 =item $value
1559  
1560 INT --> internal reference input mode\n
1561 EXT LOGIC --> external rear panel TTL input\n
1562 EXT --> external front panel analog input\n
1563  
1564 =back
1565  
1566 =head2 set_refpha
1567  
1568 $SR->set_refpha($value);
1569  
1570 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1571  
1572 =over 4
1573  
1574 =item $value
1575  
1576 REFERENCE PHASE can be between 0 ... 306°
1577  
1578 =back
1579  
1580 =head2 autophase
1581  
1582 $SR->autophase();
1583  
1584 Trigger an autophase procedure
1585  
1586 .
1587  
1588 =head2 set_outputfilter_slope
1589  
1590 $SR->set_outputfilter_slope($value);
1591  
1592 Preset Signal Recovery 7260 / 7265 Lock-in Amplifier
1593  
1594 =over 4
1595  
1596 =item $value
1597  
1598 6dB --> 6dB/octave slope of output filter\n
1599 12dB --> 12dB/octave slope of output filter\n
1600 18dB --> 18dB/octave slope of output filter\n
1601 24dB --> 24dB/octave slope of output filter\n
1602  
1603 =back
1604  
1605 .
1606  
1607 =head2 set_tc
1608  
1609 $SR->set_tc($value);
1610  
1611 Preset the output(signal channel) low pass filters time constant tc of the Signal Recovery 7260 / 7265 Lock-in Amplifier
1612  
1613 =over 4
1614  
1615 =item $value
1616  
1617 Filter Time Constant:
1618 10us, 20us, 40us, 80us, 160us, 320us, 640us, 5ms, 10ms, 20ms, 50ms, 100ms, 200ms, 500ms, 1s, 2s, 5s, 10s, 20s, 50s, 100s, 200s, 500s, 1ks, 2ks, 5ks, 10ks, 20ks, 50ks, 100ks\n
1619  
1620 =back
1621  
1622 .
1623  
1624 =head2 set_osc
1625  
1626 $SR->set_osc($value);
1627  
1628 Preset the oscillator output voltage of the Signal Recovery 7260 / 7265 Lock-in Amplifier
1629  
1630 =over 4
1631  
1632 =item $value
1633  
1634 OSCILLATOR OUTPUT VOLTAGE can be between 0 ... 5V in steps of 1mV (Signal Recovery 7260) and 1uV (Signal Recovery 7265)
1635  
1636 =back
1637  
1638 .
1639  
1640 =head2 set_frq
1641  
1642 $SR->set_frq($value);
1643  
1644 Preset the oscillator frequency of the Signal Recovery 7260 / 7265 Lock-in Amplifier
1645  
1646 =over 4
1647  
1648 =item $value
1649  
1650 OSCILLATOR FREQUENCY can be between 0 ... 259kHz
1651  
1652 =back
1653  
1654 .
1655  
1656 =head2 display_on
1657  
1658 $SR->display_on();
1659  
1660 .
1661  
1662 =head2 display_off
1663  
1664 $SR->display_on();
1665  
1666 .
1667  
1668 =head2 reset
1669  
1670 $SR->reset();
1671  
1672 .
1673  
1674 =head1 CAVEATS/BUGS
1675  
1676 probably many
1677  
1678 =head1 SEE ALSO
1679  
1680 =over 4
1681  
1682 =item L<Lab::Instrument>
1683  
1684 =back
1685  
1686 =head1 COPYRIGHT AND LICENSE
1687  
1688 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
1689  
1690 Copyright 2012 Andreas K. Huettel, David Kalok, Stefan Geissler
1691 2013 Andreas K. Huettel, Stefan Geissler
1692 2014 Christian Butschkow
1693 2016 Simon Reinhardt
1694 2017 Andreas K. Huettel
1695 2020 Andreas K. Huettel
1696 2021 Simon Reinhardt
1697  
1698  
1699 This is free software; you can redistribute it and/or modify it under
1700 the same terms as the Perl 5 programming language system itself.
1701  
1702 =cut
« Moose/Instrument/NanonisTramea.pm ↑ Summary XPRESS/Data/XPRESS_plotter.pm »