Moose/Instrument/Keithley2000.pm

filter: Statementstmt 18.0% 34 / 188 Branchbran 0.0% 0 / 44 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 25.0% 9 / 36 Podpod 60.0% 9 / 15 totaltotal 16.2% 52 / 320 SCAR 65.5
CC
32
Cov
13%
_set_triggercount
30.0
_set_triggerdelay
30.0
set_timer
30.0
CRAP 699.8
« Moose/Connection/LinuxGPIB.pm ↑ Summary XPRESS/Data/XPRESS_DataFile.pm »
1 package Lab::Moose::Instrument::Keithley2000;
2 1 $Lab::Moose::Instrument::Keithley2000::VERSION = '3.881';
3 #ABSTRACT: Keithley 2000 digital multimeter
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 use Lab::Moose::Instrument
11 1 ▶ qw/validated_getter validated_setter setter_params validated_no_param_setter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Time::HiRes qw (usleep);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 extends 'Lab::Moose::Instrument';
18  
19 1 with qw(
20 Lab::Moose::Instrument::Common
21 Lab::Moose::Instrument::SCPI::Sense::Function
22 Lab::Moose::Instrument::SCPI::Sense::NPLC
23 Lab::Moose::Instrument::SCPI::Sense::Range
24 Lab::Moose::Instrument::SCPI::Format
25 Lab::Moose::Instrument::SCPI::Initiate
26 );
27  
28 # ---------------------- Init DMM ----------------------------------------------
29 sub BUILD {
30 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
31  
32 0 $self->clear();
33 0 $self->cls();
34 0 $self->initiate_continuous(value => 0);
35 }
36  
37  
38 # ----------------------- Config DMM ------------------------------------------------------
39  
40 1 cache sense_average_state => ( getter => 'sense_average_state_query' );
41  
42 sub sense_average_state_query {
43 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine sense_average_state_query: not called CC=1 SCAR=6.9
Pod undocumented
44  
45 0 my $function = $self->sense_function_query();
46  
47 0 return $self->cached_sense_average_state(
48 $self->query( command => "SENS:$function:AVER:STAT?", %args ) );
49 }
50  
51 sub sense_average_state {
52 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_ );
Subroutine sense_average_state: not called CC=1 SCAR=6.9
Pod undocumented
53  
54 0 my $function = $self->sense_function_query();
55  
56 0 $self->write( command => "SENS:$function:AVER $value", %args );
57 0 return $self->cached_sense_average_state($value);
58 }
59  
60 1 cache sense_average_count => (
61 getter => 'sense_average_count_query',
62 isa => 'Int'
63 );
64  
65 sub sense_average_count_query {
66 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine sense_average_count_query: not called CC=1 SCAR=6.9
Pod undocumented
67  
68 0 my $function = $self->sense_function_query();
69  
70 0 return $self->cached_sense_average_state(
71 $self->query( command => "SENS:$function:AVER:COUN?", %args ) );
72 }
73  
74 sub sense_average_count {
75 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine sense_average_count: not called CC=1 SCAR=6.9
Pod undocumented
76 value => {isa => 'Int'}
77 );
78  
79 0 my $function = $self->sense_function_query();
80  
81 0 $self->write( command => "SENS:$function:AVER:COUN $value", %args );
82 0 return $self->cached_sense_average_state($value);
83 }
84  
85 # ----------------------------------------- MEASUREMENT ----------------------------------
86  
87  
88 1 cache value => ( getter => 'get_value' );
89  
90 sub get_value { # basic
91 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_value: not called CC=2 SCAR=17.9
Pod documented
92  
93 0 my $function = $self->sense_function_query();
94  
95 0 ▶ if ( $function
Branch: 1 branch
BranchTrueFalseTotal
if ($function =~ /\b(PERIOD|period|PER|per|FREQUENCY|frequency|FREQ|freq|TEMPERATURE|temperature|TEMP|temp|DIODE|diode|DIOD|diod|CURRENT|current|CURR|curr|CURRENT:AC|current:ac|CURR:AC|curr:ac|CURRENT:DC|current:dc|CURR:DC|curr:dc|VOLTAGE|voltage|VOLT|volt|VOLTAGE:AC|voltage:ac|VOLT:AC|volt:ac|VOLTAGE:DC|voltage:dc|VOLT:DC|volt:dc|RESISTANCE|resisitance|RES|res|FRESISTANCE|fresistance|FRES|fres)\b/u) { } 0 0 0
96 =~ /\b(PERIOD|period|PER|per|FREQUENCY|frequency|FREQ|freq|TEMPERATURE|temperature|TEMP|temp|DIODE|diode|DIOD|diod|CURRENT|current|CURR|curr|CURRENT:AC|current:ac|CURR:AC|curr:ac|CURRENT:DC|current:dc|CURR:DC|curr:dc|VOLTAGE|voltage|VOLT|volt|VOLTAGE:AC|voltage:ac|VOLT:AC|volt:ac|VOLTAGE:DC|voltage:dc|VOLT:DC|volt:dc|RESISTANCE|resisitance|RES|res|FRESISTANCE|fresistance|FRES|fres)\b/
97 ) {
98 0 return $self->query(command => 'MEAS?' );
99 }
100 else {
101 0 croak "unexpected value for 'function' in sub measure. Function can be CURRENT:AC, CURRENT:DC, VOLTAGE:AC, VOLTAGE:DC, RESISTANCE, FRESISTANCE, PERIOD, FREQUENCY, TEMPERATURE, DIODE";
102 }
103 }
104  
105  
106 sub config_measurement { # basic
107 0 ▶ my ( $self, %args ) = validated_getter( \@_,
Subroutine config_measurement: not called CC=3 SCAR=24.8
Pod documented
108 function => {optional => 1},
109 range => {default => 'DEF'},
110 trigger => {default => 'BUS'},
111 time => {isa => 'Num'},
112 nop => {isa => 'Int'},
113  
114 );
115  
116 0 my $function = delete $args{function};
117 0 my $nop = delete $args{nop};
118 0 my $time = delete $args{time};
119 0 my $range = delete $args{range};
120 0 my $trigger = delete $args{trigger};
121  
122  
123 # check input data
124 0 ▶ if ( not defined $time ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $time) 0 0 0
125 0 croak "too few arguments given in sub config_measurement. Expected arguments are FUNCTION, #POINTS, TIME, <RANGE>, <TRIGGERSOURCE>";
126 }
127  
128 0 $self->sense_function(value => $function);
129 0 print "sub config_measurement: set FUNCTION: "
130 . $self->cached_sense_function() . "\n";
131  
132 0 $self->sense_range(value => $range );
133 0 print "sub config_measurement: set RANGE: " . $self->cached_sense_range() . "\n";
134  
135 0 my $nplc = ( $time * 50 ) / $nop;
136 0 ▶ if ( $nplc < 0.01 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nplc < "0.01") 0 0 0
137 0 croak "unexpected value for TIME in sub config_measurement. Expected values are between 0.5 ... 50000 sec.";
138 }
139 0 $self->sense_nplc(value => $nplc );
140 0 print "sub config_measurement: set NPLC: " . $self->cached_sense_nplc() . "\n";
141  
142 0 print "sub config_measurement: init BUFFER: "
143 . $self->_init_buffer(value => $nop) . "\n";
144  
145 0 print "sub config_measurement: init TRIGGER: "
146 . $self->_init_trigger(value => $trigger) . "\n";
147  
148 0 return $nplc;
149  
150 }
151  
152  
153 sub trg { # basic
154 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine trg: not called CC=1 SCAR=6.9
Pod documented
155 0 $self->write(command => "*TRG");
156 }
157  
158  
159 sub abort { # basic
160 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine abort: not called CC=1 SCAR=6.9
Pod documented
161 0 $self->write(command => "ABORT");
162 }
163  
164  
165 sub wait { # basic
166 0 ▶ my ( $self, $timeout, %args ) = validated_getter( \@_,
Subroutine wait: not called CC=2 SCAR=17.9
Pod documented
167 timeout => {default => 100}
168 );
169  
170 0 print "waiting for data ... \n";
171 0 while (1) {
172 0 ▶ if ( $self->query(command => ":STATUS:OPERATION:CONDITION?") >= 1024 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->query('command', ':STATUS:OPERATION:CONDITION?') >= 1024) { } 0 0 0
173 0 last;
174 } # check if measurement has been finished
175 0 else { usleep(1e3); }
176 }
177 }
178  
179  
180 sub active { # basic
181 0 ▶ my ( $self, %args ) = validated_no_param_setter( \@_,
Subroutine active: not called CC=2 SCAR=17.9
Pod documented
182 timeout => {default => 100}
183 );
184  
185 0 my $timeout = delete $args{timeout};
186  
187 # check if measurement has been finished
188 0 ▶ if ( $self->query(command => ":STATUS:OPERATION:CONDITION?") >= 1024 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->query('command', ':STATUS:OPERATION:CONDITION?') >= 1024) { } 0 0 0
189 0 return 0;
190 }
191 else {
192 0 return 1;
193 }
194 }
195  
196  
197 sub get_data { # basic
198 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_data: not called CC=1 SCAR=6.9
Pod documented
199 0 return $self->_read_buffer();
200 }
201  
202 # ------------------------------------ DATA BUFFER ----------------------------------------
203  
204 sub _clear_buffer { # internal
205 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine _clear_buffer: not called CC=1 SCAR=6.9
206 0 $self->write(command => ":DATA:CLEAR");
207 0 return $self->query(command => ":DATA:FREE?");
208 }
209  
210 sub _init_buffer { # internal
211 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_ );
Subroutine _init_buffer: not called CC=3 SCAR=24.8
212  
213 0 $self->_clear_buffer();
214  
215 0 ▶ if ( $value >= 2 && $value <= 1024 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 2 and $value <= 1024) { } 0 0 0
Condition0%0/3
$value >= 2 and $value <= 1024
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 2 and $value <= 1024
$value >= 2 $value <= 1024
Truth table0%0/3
A and B
A= $value >= 2B= $value <= 1024
ABresult
0X0
100
111
216 0 $self->cls();
217 0 $self->write(command => ":STATUS:OPERATION:ENABLE 16");
218 # enable status bit for measuring/idle status
219 0 $self->write(command => "INIT:CONT OFF"); # set DMM to IDLE-state
220 0 $self->_init_trigger(value => "BUS");
221 # trigger-count = 1, trigger-delay = 0s, trigger-source = IMM/EXT/TIM/MAN/BUS
222 0 $self->_set_triggercount(value => 1);
223 0 $self->_set_triggerdelay(value => 0);
224 0 my $return_nop = $self->_set_samplecount(value => $value);
225 0 $self->write(command => ":INIT"); # set DMM from IDLE to WAIT-FOR_TRIGGER status
226 0 return $return_nop;
227 }
228 else {
229 0 croak "unexpected value in sub set_nop_for_buffer. Must be between 2 and 1024.";
230 }
231 }
232  
233 sub _read_buffer { # basic
234 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine _read_buffer: not called CC=3 SCAR=24.8
235 value => {isa => 'Bool', default => 0}
236 );
237  
238 # wait until data are available
239 0 $self->wait();
240  
241 #read data
242 0 $self->write(command => ":FORMAT:DATA ASCII; :FORMAT:ELEMENTS READING");
243  
244 # select Format for reading DATA
245 0 my $data = $self->query(command => ":DATA:DATA?", read_length => 65536);
246 0 chomp $data;
247 0 my @data = split( ",", $data );
248  
249 #print data
250 0 ▶ if ( $value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) 0 0 0
251 0 foreach my $item (@data) { print $item. "\n"; }
252 }
253  
254 0 return @data;
255 }
256  
257 # -------------------------------------- TRIGGER ----------------------------------------------
258  
259 sub _init_trigger { # internal
260 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine _init_trigger: not called CC=1 SCAR=6.9
261 value => {isa => 'Str', default => 'BUS'} # set BUS as default trigger source
262 );
263  
264 0 $self->_set_triggercount(value => "DEF"); # DEF = 1
265 0 $self->_set_triggerdelay(value => "DEF"); # DEF = 0
266 0 $self->_set_triggersource(value => "BUS");
267  
268 0 return "trigger initiated";
269 }
270  
271 sub _set_triggersource { # internal
272 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine _set_triggersource: not called CC=3 SCAR=24.8
273 value => {optional => 1}
274 );
275  
276 #return setting
277 0 ▶ if ( not defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
278 0 $value = $self->query(command => ":TRIGGER:SOURCE?");
279 0 chomp($value);
280 0 return $value;
281 }
282  
283 #set triggersoource
284 0 ▶ if ( $value =~ /\b(IMM|imm|EXT|ext|TIM|tim|MAN|man|BUS|bus)\b/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /\b(IMM|imm|EXT|ext|TIM|tim|MAN|man|BUS|bus)\b/u) { } 0 0 0
285 0 return $self->query(command =>
286 sprintf( ":TRIGGER:SOURCE %s; SOURCE?", $value ) );
287 }
288 else {
289 0 croak "unexpected value in sub _init_trigger. Must be IMM, EXT, TIM, MAN or BUS.";
290 }
291 }
292  
293 sub _set_samplecount { # internal
294 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine _set_samplecount: not called CC=4 SCAR=30.0
295 value => {optional => 1}
296 );
297  
298 #return setting
299 0 ▶ if ( not defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
300 0 $value = $self->query(command => ":SAMPLE:COUNT?");
301 0 chomp($value);
302 0 return $value;
303 }
304  
305 #set samplecount
306 0 ▶ if ( $value >= 1 && $value <= 1024 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 1 and $value <= 1024) { } 0 0 0
Condition0%0/3
$value >= 1 and $value <= 1024
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 1 and $value <= 1024
$value >= 1 $value <= 1024
Truth table0%0/3
A and B
A= $value >= 1B= $value <= 1024
ABresult
0X0
100
111
307 0 return $self->query(command =>
308 sprintf( ":SAMPLE:COUNT %d; COUNT?", $value ) );
309 }
310 else {
311 0 croak "unexpected value in sub _set_samplecount. Must be between 1 and 1024.";
312 }
313  
314 }
315  
316 sub _set_triggercount { # internal
317 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine _set_triggercount: not called CC=5 SCAR=34.0
318 value => {optional => 1}
319 );
320  
321 #return setting
322 0 ▶ if ( not defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
323 0 $value = $self->query(command => ":TRIGGER:COUNT?");
324 0 chomp($value);
325 0 return $value;
326 }
327  
328 #set triggercount
329 0 ▶ if ( ( $value >= 1 && $value <= 1024 )
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 1 and $value <= 1024 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u) { } 0 0 0
Condition0%0/6
$value >= 1 and $value <= 1024 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
l!l&&r!l&&!r
000
$value >= 1 and $value <= 1024
!ll&&!rl&&r
000
MC/DC0%0/3
$value >= 1 and $value <= 1024 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
$value >= 1 $value <= 1024 $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
Truth table0%0/5
A and B or C
A= $value >= 1B= $value <= 1024C= $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
ABCresult
11X1
0X11
1011
0X00
1000
330 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/ ) {
331 0 return $self->query(command => ":TRIGGER:COUNT $value; COUNT?");
332 }
333 else {
334 0 croak "unexpected value in sub _set_triggercount. Must be between 1 and 1024 or MIN/MAX/DEF.";
335 }
336 }
337  
338 sub _set_triggerdelay { # internal
339 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_ );
Subroutine _set_triggerdelay: not called CC=5 SCAR=34.0
340  
341 #return setting
342 0 ▶ if ( not defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
343 0 $value = $self->query(command => ":TRIGGER:DELAY?");
344 0 chomp($value);
345 0 return $value;
346 }
347  
348 #set triggerdelay
349 0 ▶ if ( ( $value >= 0 && $value <= 999999.999 )
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 0 and $value <= 999999.999 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u) { } 0 0 0
Condition0%0/6
$value >= 0 and $value <= "999999.999" or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
l!l&&r!l&&!r
000
$value >= 0 and $value <= "999999.999"
!ll&&!rl&&r
000
MC/DC0%0/3
$value >= 0 and $value <= "999999.999" or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
$value >= 0 $value <= "999999.999" $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
Truth table0%0/5
A and B or C
A= $value >= 0B= $value <= "999999.999"C= $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
ABCresult
11X1
0X11
1011
0X00
1000
350 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/ ) {
351 0 return $self->query(command => ":TRIGGER:DELAY $value; DELAY?");
352 }
353 else {
354 0 croak "unexpected value in sub _set_triggerdelay. Must be between 0 and 999999.999sec or MIN/MAX/DEF.";
355 }
356 }
357  
358 sub set_timer { # advanced
359 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_ );
Subroutine set_timer: not called CC=5 SCAR=34.0
Pod undocumented
360  
361 #return setting
362 0 ▶ if ( not defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
363 0 $value = $self->query(command => ":TRIGGER:TIMER?");
364 0 chomp($value);
365 0 return $value;
366 }
367  
368 #set timer
369 0 ▶ if ( ( $value >= 1e-3 && $value <= 999999.999 )
Branch: 1 branch
BranchTrueFalseTotal
if ($value >= 0.001 and $value <= 999999.999 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u) { } 0 0 0
Condition0%0/6
$value >= "0.001" and $value <= "999999.999" or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
l!l&&r!l&&!r
000
$value >= "0.001" and $value <= "999999.999"
!ll&&!rl&&r
000
MC/DC0%0/3
$value >= "0.001" and $value <= "999999.999" or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
$value >= "0.001" $value <= "999999.999" $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
Truth table0%0/5
A and B or C
A= $value >= "0.001"B= $value <= "999999.999"C= $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/u
ABCresult
11X1
0X11
1011
0X00
1000
370 or $value =~ /\b(MIN|min|MAX|max|DEF|def)\b/ ) {
371 0 return $self->query(command => ":TRIGGER:TIMER $value; TIMER?");
372 }
373 else {
374 0 croak "unexpected value for TIMER in sub set_timer. Must be between 0 and 999999.999sec or MIN/MAX/DEF.";
375 }
376 }
377  
378 # -----------------------------------------DISPLAY --------------------------------
379  
380  
381 sub display { # basic
382 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_ );
Subroutine display: not called CC=5 SCAR=34.0
Pod documented
383  
384 0 ▶ if ( not defined $value ) {
Branch: 4 branches
BranchTrueFalseTotal
if (not defined $value) { } 0 0 0
elsif ($value =~ /\b(ON|on)\b/u) { } 0 0 0
elsif ($value =~ /\b(OFF|off)\b/u) { } 0 0 0
elsif ($value =~ /\b(CLEAR|clear)\b/u) { } 0 0 0
385 0 return $self->_display_text();
386 }
387 elsif ( $value =~ /\b(ON|on)\b/ ) {
388 0 return $self->_display_on();
389 }
390 elsif ( $value =~ /\b(OFF|off)\b/ ) {
391 0 return $self->_display_off();
392 }
393 elsif ( $value =~ /\b(CLEAR|clear)\b/ ) {
394 0 return $self->_display_clear();
395 }
396 else {
397 0 return $self->_display_text(value => $value);
398 }
399  
400 }
401  
402 sub _display_on { # for internal/advanced use only
403 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine _display_on: not called CC=1 SCAR=6.9
404 0 $self->write(command => ":DISPLAY:ENABLE ON");
405 }
406  
407 sub _display_off { # for internal/advanced use only
408 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine _display_off: not called CC=1 SCAR=6.9
409 0 $self->write(command => ":DISPLAY:ENABLE OFF")
410 ; # when display is disabled, the instrument operates at a higher speed. Frontpanel commands are frozen.
411 }
412  
413 sub _display_text { # for internal/advanced use only
414 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine _display_text: not called CC=2 SCAR=17.9
415 value => {optional => 1}
416 );
417  
418 0 ▶ if ($value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 0 0 0
419 0 chomp( $value
420 = $self->query(command => "DISPLAY:TEXT:DATA '$value'; STATE 1; DATA?") );
421 0 $value =~ s/\"//g;
422 0 return $value;
423 }
424 else {
425 0 chomp( $value = $self->query(command => "DISPLAY:TEXT:DATA?") );
426 0 $value =~ s/\"//g;
427 0 return $value;
428 }
429 }
430  
431 sub _display_clear { # for internal/advanced use only
432 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine _display_clear: not called CC=1 SCAR=6.9
433 0 $self->write(command => "DISPlay:TEXT:STATE 0");
434 }
435  
436 # ----------------------------------------------------------------------------------------
437  
438  
439 sub beep {
440 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine beep: not called CC=1 SCAR=6.9
Pod documented
441 0 $self->write(command => "BEEP");
442 }
443  
444 1 __PACKAGE__->meta()->make_immutable();
445  
446 1 1;
447  
448 __END__
449  
450 =pod
451  
452 =encoding UTF-8
453  
454 =head1 NAME
455  
456 Lab::Moose::Instrument::Keithley2000 - Keithley 2000 digital multimeter
457  
458 =head1 VERSION
459  
460 version 3.881
461  
462 =head1 SYNOPSIS
463  
464 use Lab::Moose;
465  
466 my $DMM= instrument(
467 type => 'Keithley2000',
468 connection_type => 'LinuxGPIB',
469 connection_options => {gpib_address => 15},
470 );
471  
472 =head1 DESCRIPTION
473  
474 The Lab::Moose::Instrument::Keithley2000 class implements an interface to the
475 Keithley 2000 digital multimeter.
476  
477 =head1 METHODS
478  
479 Used roles:
480  
481 =over
482  
483 =item L<Lab::Moose::Instrument::Common>
484  
485 =item L<Lab::Moose::Instrument::SCPI::Sense::Function>
486  
487 =item L<Lab::Moose::Instrument::SCPI::Sense::NPLC>
488  
489 =item L<Lab::Moose::Instrument::SCPI::Sense::Range>
490  
491 =item L<Lab::Moose::Instrument::SCPI::Format>
492  
493 =item L<Lab::Moose::Instrument::SCPI::Initiate>
494  
495 =back
496  
497 =head2 get_value
498  
499 $DMM->get_value(value = $function);
500  
501 Make a measurement defined by $function with the previously specified range
502 and integration time.
503  
504 =over 4
505  
506 =item $function
507  
508 FUNCTION can be one of the measurement methods of the Keithley2000.
509  
510 "current:dc" --> DC current measurement
511 "current:ac" --> AC current measurement
512 "voltage:dc" --> DC voltage measurement
513 "voltage:ac" --> AC voltage measurement
514 "resisitance" --> resistance measurement (2-wire)
515 "fresistance" --> resistance measurement (4-wire)
516  
517 =back
518  
519 =head2 config_measurement
520  
521 $DMM->config_measurement(function => $function, $nop => $number_of_points, $time => time, range => $range, trigger => $trigger);
522  
523 Preset the Keithley2000 for a TRIGGERED measurement.
524  
525 WARNING: It's not recomended to perform triggered measurments with the KEITHLEY 2000 DMM due to unsolved timing problems!!!!!
526  
527 =over 4
528  
529 =item OPTIONAL $function
530  
531 FUNCTION can be one of the measurement methods of the Keithley2000.
532  
533 "current:dc" --> DC current measurement
534 "current:ac" --> AC current measurement
535 "voltage:dc" --> DC voltage measurement
536 "voltage:ac" --> AC voltage measurement
537 "resisitance" --> resistance measurement (2-wire)
538 "fresistance" --> resistance measurement (4-wire)
539  
540 =item $number_of_points
541  
542 Preset the NUMBER OF POINTS to be taken for one measurement TRACE .
543 The single measured points will be stored in the internal memory of the Keithley2000.
544 For the Keithley2000 the internal memory is limited to 1024 values.
545  
546 =item $time
547  
548 Preset the TIME duration for one full trace.
549 From TIME the integration time value for each measurement point will be derived [NPLC = (TIME *50Hz)/NOP].
550 Expected values are between 0.21 ... 20000 seconds.
551  
552 =item OPTIONAL $range
553  
554 RANGE is given in terms of amps, volts or ohms and can be 0...+3,03A | MIN | MAX | DEF | AUTO , 0...757V(AC)/1010V(DC) | MIN | MAX | DEF | AUTO or 0...101e6 | MIN | MAX | DEF | AUTO .
555 DEF is default AUTO activates the AUTORANGE-mode.
556 DEF will be set, if no value is given.
557  
558 =item OPTIONAL $trigger
559  
560 Set the TRIGGER
561  
562 =back
563  
564 =head2 trg
565  
566 $DMM->trg();
567  
568 Sends a trigger signal via the GPIB-BUS to start the predefined measurement.
569 The LabVisa-script can immediatally be continued, e.g. to start another triggered measurement using a second Keithley2000.
570  
571 =head2 abort
572  
573 $DMM->abort();
574  
575 Aborts current (triggered) measurement.
576  
577 =head2 wait
578  
579 $DMM->wait();
580  
581 WAIT until triggered measurement has been finished.
582  
583 =head2 active
584  
585 $DMM->active();
586  
587 Returns '1' if the current triggered measurement is still active and '0' if the current triggered measurement has allready been finished.
588  
589 =head2 get_data
590  
591 @data = $DMM->get_data();
592  
593 Reads all recorded values from the internal buffer and returnes them as an array of floatingpoint values.
594 Reading the buffer will start immediately after the triggered measurement has finished. The LabVisa-script cannot be continued until all requested readings have been recieved.
595  
596 =head2 display
597  
598 $DMM->display(value => 'ON');
599  
600 Control the K2000s display, $value can be
601  
602 =over 4
603  
604 =item ON
605  
606 Turn on the display
607  
608 =item OFF
609  
610 Turn off the display
611  
612 =item CLEAR
613  
614 Clear the display
615  
616 =item your text
617  
618 Display a custom text
619  
620 =back
621  
622 =head2 beep
623  
624 $DMM->beep();
625  
626 Make a beep sound
627  
628 =head1 CAVEATS/BUGS
629  
630 probably many
631  
632 =head1 SEE ALSO
633  
634 =over 4
635  
636 =item L<Lab::Instrument>
637  
638 =back
639  
640 =head1 COPYRIGHT AND LICENSE
641  
642 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
643  
644 Copyright 2021 Andreas K. Huettel, Fabian Weinelt
645  
646  
647 This is free software; you can redistribute it and/or modify it under
648 the same terms as the Perl 5 programming language system itself.
649  
650 =cut
« Moose/Connection/LinuxGPIB.pm ↑ Summary XPRESS/Data/XPRESS_DataFile.pm »