Moose/Instrument/Lakeshore372.pm

filter: Statementstmt 13.5% 30 / 222 Branchbran n/a Conditioncond 0.0% 0 / 84 MC/DCmcdc 0.0% 0 / 56 Subroutinesub 12.0% 7 / 58 Podpod 98.0% 50 / 51 totaltotal 18.4% 87 / 471 SCAR 64.7
CC
29
Cov
10%
get_T
6.0
get_sensor_units_reading
6.0
get_quadrature_reading
6.0
CRAP 646.1
« Instrument/AH2700A.pm ↑ Summary Connection/Trace.pm »
1 package Lab::Moose::Instrument::Lakeshore372;
2 1 $Lab::Moose::Instrument::Lakeshore372::VERSION = '3.881';
3 #ABSTRACT: Lakeshore Model 372 Temperature Controller
4  
5 #
6 # TODO:
7 # TLIMIT, TLIMIT?
8 # HTR? RAMPST?, RDGPWR?, RDGST?, RDGSTL?
9 # MONITOR
10  
11 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 use Lab::Moose::Instrument qw/
17 1 ▶ validated_getter validated_setter setter_params /;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 extends 'Lab::Moose::Instrument';
22  
23 1 with qw(
24 Lab::Moose::Instrument::Common
25 );
26  
27 1 has input_channel => (
28 is => 'ro',
29 isa => enum( [ 'A', 1 .. 16 ] ),
30 default => 5,
31 );
32  
33 1 has default_loop => (
34 is => 'ro',
35 isa => enum( [ 0, 1 ] ),
36 default => 0,
37 );
38  
39 sub BUILD {
40 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
41 0 $self->clear();
42 0 $self->cls();
43 }
44  
45 1 my %channel_arg = ( channel => { isa => enum( [ 'A', 1 .. 16 ] ), optional => 1} );
46 1 my %loop_arg = ( loop => { isa => enum( [ 0, 1 ] ), optional => 1 } );
47 1 my %output_arg = ( output => { isa => enum( [ 0, 1, 2 ] ) } );
48  
49  
50 sub get_T {
51 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_T: not called CC=2 SCAR=17.9
Pod documented
52 \@_,
53 %channel_arg
54 );
55 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
56 0 return $self->query( command => "KRDG? $channel", %args );
57 }
58  
59 sub get_value {
60 0 ▶ my $self = shift;
Subroutine get_value: not called CC=1 SCAR=6.9
Pod documented
61 0 return $self->get_T(@_);
62 }
63  
64  
65 sub get_sensor_units_reading {
66 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_sensor_units_reading: not called CC=2 SCAR=17.9
Pod documented
67 \@_,
68 %channel_arg
69 );
70 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
71 0 return $self->query( command => "SRDG? $channel", %args );
72 }
73  
74  
75 sub get_quadrature_reading {
76 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_quadrature_reading: not called CC=2 SCAR=17.9
Pod documented
77 \@_,
78 %channel_arg
79 );
80 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
81 0 return $self->query( command => "QRDG? $channel", %args );
82 }
83  
84  
85 sub get_excitation_power_reading {
86 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_excitation_power_reading: not called CC=2 SCAR=17.9
Pod documented
87 \@_,
88 %channel_arg
89 );
90 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
91 0 return $self->query( command => "RDGPWR? $channel", %args );
92  
93 }
94  
95  
96 sub get_setpoint {
97 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_setpoint: not called CC=2 SCAR=17.9
Pod documented
98 \@_,
99 %loop_arg
100 );
101 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
102 0 return $self->query( command => "SETP? $loop", %args );
103 }
104  
105 sub set_setpoint {
106 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_setpoint: not called CC=2 SCAR=17.9
Pod documented
107 \@_,
108 %loop_arg
109 );
110 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
111  
112 # Device bug. The 340 cannot parse values with too many digits.
113 0 $value = sprintf( "%.6E", $value );
114 0 $self->write( command => "SETP $loop,$value", %args );
115 }
116  
117  
118 sub set_T {
119 0 ▶ my $self = shift;
Subroutine set_T: not called CC=1 SCAR=6.9
Pod documented
120 0 $self->set_setpoint(@_);
121 }
122  
123  
124 sub set_heater_range {
125 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_heater_range: not called CC=1 SCAR=6.9
Pod documented
126 \@_,
127 %output_arg,
128 value => { isa => enum( [ 0 .. 8 ] ) }
129 );
130 0 my $output = delete $args{output};
131 0 $self->write( command => "RANGE $output, $value", %args );
132 }
133  
134 sub get_heater_range {
135 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_heater_range: not called CC=1 SCAR=6.9
Pod documented
136 \@_,
137 %output_arg,
138 );
139 0 my $output = delete $args{output};
140 0 return $self->query( command => "RANGE? $output", %args );
141 }
142  
143  
144 sub set_heater_setup {
145 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_heater_setup: not called CC=2 SCAR=17.9
Pod documented
146 \@_,
147 %loop_arg,
148 resistance => { isa => 'Lab::Moose::PosNum' },
149 max_current => { isa => enum( [ 0, 1, 2 ] ) },
150 max_user_current => { isa => 'Lab::Moose::PosNum' },
151 display => { isa => enum( [ 0, 1 ] ) },
152 );
153 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
154 my ( $resistance, $max_current, $max_user_current, $display )
155 0 = delete @args{qw/resistance max_current max_user_current display/};
156 0 $self->write(
157 command =>
158 "HTRSET $loop, $resistance, $max_current, $max_user_current, $display",
159 %args
160 );
161 }
162  
163 sub get_heater_setup {
164 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_heater_setup: not called CC=2 SCAR=17.9
Pod documented
165 \@_,
166 %loop_arg,
167 );
168 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
169 0 my $rv = $self->query( command => "HTRSET? $loop", %args );
170 0 my %htr;
171 0 @htr{qw/resistance max_current max_user_current display/} = split ',',
172 $rv;
173 0 return %htr;
174 }
175  
176  
177 sub get_sample_heater_output {
178 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_sample_heater_output: not called CC=1 SCAR=6.9
Pod documented
179 0 return $self->query( command => "HTR?", %args );
180 }
181  
182  
183 sub set_outmode {
184 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_outmode: not called CC=2 SCAR=17.9
Pod documented
185 \@_,
186 %output_arg,
187 mode => { isa => enum( [ 0 .. 6 ] ) },
188 %channel_arg,
189 powerup_enable => { isa => enum( [ 0, 1 ] ), default => 0 },
190 polarity => { isa => enum( [ 0, 1 ] ), default => 0 },
191 filter => { isa => enum( [ 0, 1 ] ), default => 0 },
192 delay => { isa => enum( [ 1 .. 255 ] ) },
193 );
194 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
195 my ( $output, $mode, $powerup_enable, $polarity, $filter, $delay )
196 0 = delete @args{qw/output mode powerup_enable polarity filter delay/};
197 0 $self->write(
198 command =>
199 "OUTMODE $output, $mode, $channel, $powerup_enable, $polarity, $filter, $delay",
200 %args
201 );
202 }
203  
204 sub get_outmode {
205 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_outmode: not called CC=1 SCAR=6.9
Pod documented
206 \@_,
207 %output_arg,
208 );
209 0 my $output = delete $args{output};
210 0 my $rv = $self->query( command => "OUTMODE? $output", %args );
211 0 my @rv = split /,/, $rv;
212 return (
213 0 mode => $rv[0], channel => $rv[1], powerup_enable => $rv[2],
214 polarity => $rv[3], filter => $rv[4], delay => $rv[5]
215 );
216 }
217  
218  
219 sub set_input_curve {
220 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_input_curve: not called CC=2 SCAR=17.9
Pod documented
221 \@_,
222 %channel_arg,
223 value => { isa => enum( [ 0 .. 59 ] ) },
224 );
225 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
226 0 $self->write( command => "INCRV $channel,$value", %args );
227 }
228  
229 sub get_input_curve {
230 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_input_curve: not called CC=2 SCAR=17.9
Pod documented
231 \@_,
232 %channel_arg,
233 );
234 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
235 0 return $self->query( command => "INCRV? $channel", %args );
236 }
237  
238  
239 sub set_remote_mode {
240 0 ▶ my ( $self, $value, %args )
Subroutine set_remote_mode: not called CC=1 SCAR=6.9
Pod documented
241 = validated_setter( \@_, value => { isa => enum( [ 0 .. 2 ] ) } );
242 0 $self->write( command => "MODE $value", %args );
243 }
244  
245 sub get_remote_mode {
246 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_remote_mode: not called CC=1 SCAR=6.9
Pod documented
247 0 return $self->query( command => "MODE?", %args );
248 }
249  
250  
251 sub set_pid {
252 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_pid: not called CC=2 SCAR=17.9
Pod documented
253 \@_,
254 %loop_arg,
255 P => { isa => 'Lab::Moose::PosNum' },
256 I => { isa => 'Lab::Moose::PosNum' },
257 D => { isa => 'Lab::Moose::PosNum' }
258 );
259 0 my ( $loop, $P, $I, $D ) = delete @args{qw/loop P I D/};
260 0 ▶ $loop = $loop // $self->default_loop();
Condition0%0/3
$loop // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
$loop // $self->default_loop
$loop $self->default_loop
Truth table0%0/3
A // B
A= $loopB= $self->default_loop
ABresult
1X1
011
000
261 0 $self->write(
262 command => sprintf( "PID $loop, %.1f, %d, %d", $P, $I, $D ),
263 %args
264 );
265 }
266  
267 sub get_pid {
268 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_pid: not called CC=2 SCAR=17.9
Pod documented
269 \@_,
270 %loop_arg
271 );
272 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
273 0 my $pid = $self->query( command => "PID? $loop", %args );
274 0 my %pid;
275 0 @pid{qw/P I D/} = split /,/, $pid;
276 0 return %pid;
277 }
278  
279  
280 sub set_zone {
281 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_zone: not called CC=2 SCAR=17.9
Pod documented
282 \@_,
283 %loop_arg,
284 zone => { isa => enum( [ 1 .. 10 ] ) },
285 top => { isa => 'Lab::Moose::PosNum' },
286 P => { isa => 'Lab::Moose::PosNum' },
287 I => { isa => 'Lab::Moose::PosNum' },
288 D => { isa => 'Lab::Moose::PosNum' },
289 mout => { isa => 'Lab::Moose::PosNum', default => 0 },
290 range => { isa => enum( [ 0 .. 8 ] ) },
291 rate => { isa => 'Lab::Moose::PosNum' },
292 relay_1 => { isa => enum( [ 0, 1 ] ), default => 0 },
293 relay_2 => { isa => enum( [ 0, 1 ] ), default => 0 },
294 );
295 my (
296 $loop, $zone, $top, $P, $I, $D, $mout, $range, $rate, $relay_1,
297 $relay_2
298 )
299 = delete @args{
300 0 qw/loop zone top P I D mout range rate relay_1 relay_2/};
301 0 ▶ $loop = $loop // $self->default_loop;
Condition0%0/3
$loop // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
$loop // $self->default_loop
$loop $self->default_loop
Truth table0%0/3
A // B
A= $loopB= $self->default_loop
ABresult
1X1
011
000
302  
303 # if ( defined $mout ) {
304 # $mout = sprintf( "%.1f", $mout );
305 # }
306 # else {
307 # $mout = ' ';
308 # }
309  
310 0 $self->write(
311 command => sprintf(
312 "ZONE $loop, $zone, %.6G, %.1f, %.1f, %d, $mout, $range, %.1f, $relay_1, $relay_2",
313 $top, $P, $I, $D
314 ),
315 %args
316 );
317 }
318  
319 sub get_zone {
320 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_zone: not called CC=2 SCAR=17.9
Pod documented
321 \@_,
322 %loop_arg,
323 zone => { isa => enum( [ 1 .. 10 ] ) }
324 );
325 0 my ( $loop, $zone ) = delete @args{qw/loop zone/};
326 0 ▶ $loop = $loop // $self->default_loop;
Condition0%0/3
$loop // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
$loop // $self->default_loop
$loop $self->default_loop
Truth table0%0/3
A // B
A= $loopB= $self->default_loop
ABresult
1X1
011
000
327 0 my $result = $self->query( command => "ZONE? $loop, $zone", %args );
328 0 my %zone;
329 0 @zone{qw/top P I D mout range rate relay_1 relay_2/} = split /,/, $result;
330 0 return %zone;
331 }
332  
333  
334 sub set_filter {
335 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_filter: not called CC=2 SCAR=17.9
Pod documented
336 \@_,
337 %channel_arg,
338 on => { isa => enum( [ 0, 1 ] ) },
339 settle_time => { isa => enum( [ 1 .. 200 ] ) },
340 window => { isa => enum( [ 1 .. 80 ] ) }
341 );
342 my ( $channel, $on, $settle_time, $window )
343 0 = delete @args{qw/channel on settle_time window/};
344 0 ▶ $channel = $channel // $self->input_channel();
Condition0%0/3
$channel // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
$channel // $self->input_channel
$channel $self->input_channel
Truth table0%0/3
A // B
A= $channelB= $self->input_channel
ABresult
1X1
011
000
345  
346 0 $self->write(
347 command => "FILTER $channel,$on,$settle_time,$window",
348 %args
349 );
350 }
351  
352 sub get_filter {
353 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_filter: not called CC=2 SCAR=17.9
Pod documented
354 \@_,
355 %channel_arg,
356 );
357 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
358 0 my $result = $self->query( command => "FILTER? $channel", %args );
359  
360 0 my %filter;
361 0 @filter{qw/on settle_time window/} = split /,/, $result;
362 0 return %filter;
363 }
364  
365  
366 sub set_freq {
367 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_freq: not called CC=2 SCAR=17.9
Pod documented
368 \@_,
369 %channel_arg,
370 value => { isa => enum( [ 1 .. 5 ] ) },
371 );
372 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
373 0 $self->write( command => "FREQ $channel,$value", %args );
374 }
375  
376 sub get_freq {
377 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_freq: not called CC=2 SCAR=17.9
Pod documented
378 \@_,
379 %channel_arg,
380 );
381 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
382 0 return $self->query( command => "FREQ? $channel", %args );
383 }
384  
385  
386 sub set_common_mode_reduction {
387 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_common_mode_reduction: not called CC=1 SCAR=6.9
Pod documented
388 \@_,
389 value => { isa => enum( [ 0, 1 ] ) },
390 );
391 0 $self->write( command => "CMR $value", %args );
392 }
393  
394 sub get_common_mode_reduction {
395 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_common_mode_reduction: not called CC=1 SCAR=6.9
Pod documented
396 0 return $self->query( command => "CMR?", %args );
397 }
398  
399  
400 sub set_mout {
401 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_mout: not called CC=1 SCAR=6.9
Pod documented
402 \@_,
403 %output_arg,
404 value => { isa => 'Num' }
405 );
406 0 my $output = delete $args{output};
407 0 $self->write( command => "MOUT $output, $value", %args );
408 }
409  
410 sub get_mout {
411 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_mout: not called CC=1 SCAR=6.9
Pod documented
412 \@_,
413 %output_arg,
414 );
415 0 my $output = delete $args{output};
416 0 return $self->query( command => "MOUT? $output" );
417 }
418  
419  
420 sub set_inset {
421 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_inset: not called CC=2 SCAR=17.9
Pod documented
422 \@_,
423 %channel_arg,
424 enabled => { isa => enum( [ 0, 1 ] ) },
425 dwell => { isa => enum( [ 1 .. 200 ] ) },
426 pause => { isa => enum( [ 3 .. 200 ] ) },
427 curve_number => { isa => enum( [ 0 .. 59 ] ) },
428 tempco => { isa => enum( [ 1, 2 ] ) },
429 );
430 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
431 my ( $enabled, $dwell, $pause, $curve_number, $tempco )
432 0 = delete @args{qw/enabled dwell pause curve_number tempco/};
433 0 $self->write(
434 command =>
435 "INSET $channel, $enabled, $dwell, $pause, $curve_number, $tempco",
436 %args
437 );
438 }
439  
440 sub get_inset {
441 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_inset: not called CC=2 SCAR=17.9
Pod documented
442 \@_,
443 %channel_arg,
444 );
445 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
446 0 my $rv = $self->query( command => "INSET? $channel" );
447 0 my %inset;
448 0 @inset{qw/enabled dwell pause curve_number tempco/} = split /,/, $rv;
449 0 return %inset;
450 }
451  
452  
453 sub set_intype {
454 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_intype: not called CC=2 SCAR=17.9
Pod documented
455 \@_,
456 %channel_arg,
457 mode => { isa => enum( [ 0, 1 ] ) },
458 excitation => { isa => enum( [ 1 .. 22 ] ) },
459 autorange => { isa => enum( [ 0, 1, 2 ] ) },
460 range => { isa => enum( [ 1 .. 22 ] ) },
461 cs_shunt => { isa => enum( [ 0, 1 ] ), default => 0 },
462 units => { isa => enum( [ 1, 2 ] ), default => 1 },
463 );
464  
465 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
466 my ( $mode, $excitation, $autorange, $range, $cs_shunt, $units )
467 0 = delete @args{qw/mode excitation autorange range cs_shunt units/};
468 0 $self->write(
469 command =>
470 "INTYPE $channel, $mode, $excitation, $autorange, $range, $cs_shunt, $units",
471 %args
472 );
473 }
474  
475 sub get_intype {
476 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_intype: not called CC=2 SCAR=17.9
Pod documented
477 \@_,
478 %channel_arg,
479 );
480 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
481 0 my $rv = $self->query( command => "INTYPE? $channel", %args );
482 0 my %intype;
483 0 @intype{qw/mode excitation autorange range cs_shunt units/} = split /,/,
484 $rv;
485 0 return %intype;
486 }
487  
488  
489 sub curve_delete {
490 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine curve_delete: not called CC=1 SCAR=6.9
Pod documented
491 \@_,
492 curve => { isa => enum( [ 21 .. 59 ] ) },
493 );
494 0 my $curve = delete $args{curve};
495 0 $self->write( command => "CRVDEL $curve", %args );
496 }
497  
498  
499 sub set_curve_header {
500 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_curve_header: not called CC=1 SCAR=6.9
Pod documented
501 \@_,
502 curve => { isa => enum( [ 21 .. 59 ] ) },
503 name => { isa => 'Str' },
504 SN => { isa => 'Str' },
505 format => { isa => enum( [ 3, 4, 7 ] ) },
506 limit => { isa => 'Lab::Moose::PosNum' },
507 coefficient => { isa => enum( [ 1, 2 ] ) }
508 );
509 my ( $curve, $name, $SN, $format, $limit, $coefficient )
510 0 = delete @args{qw/curve name SN format limit coefficient/};
511 0 $self->write(
512 command =>
513 "CRVHDR $curve, \"$name\", \"$SN\", $format, $limit, $coefficient",
514 %args
515 );
516 }
517  
518 sub get_curve_header {
519 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_curve_header: not called CC=1 SCAR=6.9
Pod documented
520 \@_,
521 curve => { isa => enum( [ 1 .. 59 ] ) },
522 );
523 0 my $curve = delete $args{curve};
524 0 my $rv = $self->query( command => "CRVHDR? $curve", %args );
525 0 my %header;
526 0 @header{qw/name SN format limit coefficient/} = split /,/,
527 $rv;
528 0 return %header;
529 }
530  
531  
532 sub set_curve_point {
533 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_curve_point: not called CC=1 SCAR=6.9
Pod documented
534 \@_,
535 curve => { isa => enum( [ 21 .. 59 ] ) },
536 index => { isa => enum( [ 1 .. 200 ] ) },
537 units => { isa => 'Num' },
538 temp => { isa => 'Num' },
539 curvature => { isa => 'Num', default => 0 },
540 );
541 my ( $curve, $index, $units, $temp, $curvature )
542 0 = delete @args{qw/curve index units temp curvature/};
543 0 $self->write(
544 command => "CRVPT $curve, $index, $units, $temp, $curvature", %args );
545 }
546  
547 sub get_curve_point {
548 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_curve_point: not called CC=1 SCAR=6.9
Pod documented
549 \@_,
550 curve => { isa => enum( [ 1 .. 59 ] ) },
551 index => { isa => enum( [ 1 .. 200 ] ) },
552 );
553 0 my $curve = delete $args{curve};
554 0 my $index = delete $args{index};
555 0 my $rv = $self->query( command => "CRVPT? $curve, $index", %args );
556 0 my %point;
557 0 @point{qw/units temp curvature/} = split /,/,
558 $rv;
559 0 return %point;
560 }
561  
562  
563 sub set_input_name {
564 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_input_name: not called CC=2 SCAR=17.9
Pod documented
565 \@_,
566 %channel_arg,
567 );
568 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
569 0 $self->write( command => "INNAME $channel, $value", %args );
570 }
571  
572 sub get_input_name {
573 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_input_name: not called CC=2 SCAR=17.9
Pod documented
574 \@_,
575 %channel_arg,
576 );
577 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
578 0 return $self->query( command => "INNAME? $channel", %args );
579 }
580  
581  
582 sub set_ramp {
583 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_ramp: not called CC=2 SCAR=17.9
Pod documented
584 \@_,
585 %loop_arg,
586 rate => { isa => 'Lab::Moose::PosNum' },
587 on => { isa => enum( [ 0, 1 ] ) },
588 );
589 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
590 0 my $rate = delete $args{rate};
591 0 my $on = delete $args{on};
592 0 $self->write( command => "RAMP $loop, $on, $rate", %args );
593 }
594  
595 sub get_ramp {
596 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_ramp: not called CC=2 SCAR=17.9
Pod documented
597 \@_,
598 %loop_arg,
599 );
600 0 ▶ my $loop = delete $args{loop} // $self->default_loop;
Condition0%0/3
delete $args{"loop"} // $self->default_loop
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"loop"} // $self->default_loop
delete $args{"loop"} $self->default_loop
Truth table0%0/3
A // B
A= delete $args{"loop"}B= $self->default_loop
ABresult
1X1
011
000
601 0 my $rv = $self->query( command => "RAMP? $loop", %args );
602 0 my %ramp;
603 0 @ramp{qw/on rate/} = split ',', $rv;
604 0 return %ramp;
605 }
606  
607  
608 sub set_scanner {
609 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_scanner: not called CC=2 SCAR=17.9
Pod documented
610 \@_,
611 %channel_arg,
612 autoscan => { isa => enum( [ 0, 1 ] ) },
613 );
614 0 ▶ my $channel = delete $args{channel} // $self->input_channel();
Condition0%0/3
delete $args{"channel"} // $self->input_channel
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args{"channel"} // $self->input_channel
delete $args{"channel"} $self->input_channel
Truth table0%0/3
A // B
A= delete $args{"channel"}B= $self->input_channel
ABresult
1X1
011
000
615 0 my $autoscan = delete $args{autoscan};
616 0 $self->write( command => "SCAN $channel, $autoscan", %args );
617 }
618  
619 sub get_scanner {
620 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_scanner: not called CC=1 SCAR=6.9
Pod documented
621 0 my $rv = $self->query( command => "SCAN?", %args );
622 0 my ( $channel, $autoscan ) = split ',', $rv;
623 0 return ( channel => $channel, autoscan => $autoscan );
624 }
625  
626  
627 sub set_display_field {
628 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_display_field: not called CC=1 SCAR=6.9
Pod documented
629 \@_,
630 field => { isa => enum( [ 1 .. 8 ] ) },
631 input => { isa => enum( [ 0 .. 17 ] ) },
632 units => { isa => enum( [ 1 .. 6 ] ) },
633 );
634 0 my ( $field, $input, $units ) = delete @args{qw/field input units/};
635 0 $self->write( command => "DISPFLD $field, $input, $units", %args );
636 }
637  
638 sub get_display_field {
639 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine get_display_field: not called CC=1 SCAR=6.9
Pod documented
640 \@_,
641 field => { isa => enum( [ 1 .. 8 ] ) }
642 );
643 0 my $field = delete $args{field};
644 0 my $rv = $self->query( command => "DISPFLD? $field", %args );
645 0 my ( $input, $units ) = split ',', $rv;
646 0 return ( input => $input, units => $units );
647 }
648  
649  
650 sub set_display {
651 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine set_display: not called CC=1 SCAR=6.9
Pod documented
652 \@_,
653 mode => { isa => enum( [ 0, 1, 2 ] ) },
654 num_fields => { isa => enum( [ 0, 1, 2 ] ) },
655 displayed_info => { isa => enum( [ 0 .. 3 ] ) }
656 );
657 my ( $mode, $num_fields, $displayed_info )
658 0 = delete @args{qw/mode num_fields displayed_info/};
659 0 $self->write(
660 command => "DISPLAY $mode, $num_fields, $displayed_info",
661 %args
662 );
663 }
664  
665 sub get_display {
666 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_display: not called CC=1 SCAR=6.9
Pod documented
667 0 my $rv = $self->query( command => "DISPLAY?", %args );
668 0 my ( $mode, $num_fields, $displayed_info ) = split ',', $rv;
669 return (
670 0 mode => $mode, num_fields => $num_fields,
671 displayed_info => $displayed_info
672 );
673 }
674  
675  
676 1 __PACKAGE__->meta()->make_immutable();
677  
678 1 1;
679  
680 __END__
681  
682 =pod
683  
684 =encoding UTF-8
685  
686 =head1 NAME
687  
688 Lab::Moose::Instrument::Lakeshore372 - Lakeshore Model 372 Temperature Controller
689  
690 =head1 VERSION
691  
692 version 3.881
693  
694 =head1 SYNOPSIS
695  
696 use Lab::Moose;
697  
698 # Constructor
699 my $lakeshore = instrument(
700 type => 'Lakeshore372',
701 connection_type => 'Socket',
702 connection_options => {host => '192.168.3.24'},
703
704 input_channel => '5', # set default input channel for all method calls
705 );
706  
707  
708 my $temp_5 = $lakeshore->get_T(channel => 5); # Get temperature for channel 5.
709 my $resistance_5 = TODO
710  
711 Example: Configure inputs
712  
713 # enable channels 1..3
714 for my $channel (1..3) {
715 $lakeshore->set_inset(
716 channel => $channel,
717 enabled => 1,
718 dwell => 1,
719 pause => 3,
720 curve_number => 0, # no curve
721 tempco => 1, # negative temp coeff
722 );
723 }
724 # disable the other channels
725 for my $channel ('A', 4..16) {
726 $lakeshore->set_inset(
727 channel => $channel,
728 enabled => 0,
729 dwell => 1,
730 pause => 3,
731 curve_number => 0, # no curve
732 tempco => 1, # negative temp coeff
733 );
734 }
735
736 # setup the enabled input channels 1,2,3 for 20μV voltage excitation:
737 for my $channel (1..3) {
738 $lakeshore->set_intype(
739 channel => $channel,
740 mode => 0,
741 excitation => 3,
742 # control input, ignored:
743 autorange => 0,
744 range => 1,
745 );
746 }
747  
748 =head1 METHODS
749  
750 =head2 get_T
751  
752 my $temp = $lakeshore->get_T(channel => $channel);
753  
754 C<$channel> needs to be one of 'A', 1, ..., 16.
755  
756 =head2 get_value
757  
758 alias for C<get_T>.
759  
760 =head2 get_sensor_units_reading
761  
762 my $reading = $lakeshore->get_sensor_units_reading(channel => $channel);
763  
764 Get sensor units reading (in ohm) of an input channel.
765  
766 =head2 get_quadrature_reading
767  
768 my $imaginary_part = $lakeshore->get_quadrature_reading(
769 channel => 1, # 1..16 (only measurement input)
770 );
771  
772 =head2 get_excitation_power_reading
773  
774 my $excitation_power = $lakeshore->get_excitation_power_reading(
775 channel => 1, # 1..16 or A
776 );
777  
778 =head2 set_setpoint/get_setpoint
779  
780 Set/get setpoint for loop 0 in whatever units the setpoint is using
781  
782 $lakeshore->set_setpoint(value => 10, loop => 0);
783 my $setpoint1 = $lakeshore->get_setpoint(loop => 0);
784  
785 =head2 set_T
786  
787 alias for C<set_setpoint>
788  
789 =head2 set_heater_range/get_heater_range
790  
791 $lakeshore->set_heater_range(output => 0, value => 1);
792 my $range = $lakeshore->get_heater_range(output => 0);
793  
794 For output 0 (sample heater), value is one of 0 (off), 1, ..., 8.
795 For outputs 1 and 2, value is one of 0 and 1.
796  
797 =head2 set_heater_setup/get_heater_setup
798  
799 $lakeshore->set_heater_setup(
800 loop => 0,
801 resistance => 1500, # Ohms
802 max_current => 0, # warm-up heater
803 max_user_current => 0.1, # Amps
804 display => 2, # Display power
805 );
806  
807 my %setup = $lakeshore->get_heater_setup(loop => 0);
808  
809 =head2 get_sample_heater_output
810  
811 my $power = $lakeshore->get_sample_heater_output();
812  
813 Depending on setting, return either percentage of current range or power.
814  
815 =head2 set_outmode/get_outmode
816  
817 $lakeshore->set_outmode(
818 output => 0, # 0, 1, 2
819 mode => 3, # 0, ..., 6
820 channel => 5, # A, 1, ..., 16
821 powerup_enable => 1, # (default: 0)
822 polarity => 1, # (default: 0)
823 filter => 1, # (default: 0)
824 delay => 1, # 1,...,255
825 );
826
827 my $args = $lakeshore->get_outmode(output => 0);
828  
829 =head2 set_input_curve/get_input_curve
830  
831 # Set channel 5 to use curve 25
832 $lakeshore->set_input_curve(channel => 5, value => 25);
833 my $curve = $lakeshore->get_input_curve(channel => 5);
834  
835 =head2 set_remote_mode/get_remote_mode
836  
837 $lakeshore->set_remote_mode(value => 0);
838 my $mode = $lakeshore->get_remote_mode();
839  
840 Valid entries: 0 = local, 1 = remote, 2 = remote with local lockout.
841  
842 =head2 set_pid/get_pid
843  
844 $lakeshore->set_pid(loop => 0, P => 1, I => 50, D => 50)
845 my %PID = $lakeshore->get_pid(loop => 0);
846 # %PID = (P => $P, I => $I, D => $D);
847  
848 =head2 set_zone/get_zone
849  
850 $lakeshore->set_zone(
851 loop => 0,
852 zone => 1,
853 top => 10,
854 P => 25,
855 I => 10,
856 D => 20,
857 mout => 0, # 0%
858 range => 1,
859 rate => 1.2, # 1.2 K / min
860 relay_1 => 0,
861 relay_2 => 0,
862 );
863  
864 my %zone = $lakeshore->get_zone(loop => 0, zone => 1);
865  
866 =head2 set_filter/get_filter
867  
868 $lakeshore->set_filter(
869 channel => 5,
870 on => 1,
871 settle_time => 1, # (1s..200s)
872 window => 2, # % 2 percent of full scale window (1% ... 80%)
873 );
874  
875 my %filter = $lakeshore->get_filter(channel => 5);
876  
877 =head2 set_freq/get_freq
878  
879 # Set input channel 0 (measurement input) excitation frequency to 9.8Hz
880 $lakeshore->set_freq(channel => 0, value => 1);
881  
882 my $freq = $lakeshore->get_freq(channel => 0);
883  
884 Allowed channels: 0 (measurement input), 'A' (control input).
885 Allowed values: 1 = 9.8 Hz, 2 = 13.7 Hz, 3 = 16.2 Hz, 4 = 11.6 Hz, 5 = 18.2 Hz.
886  
887 =head2 set_common_mode_reduction/get_common_mode_reduction
888  
889 $lakeshore->set_common_mode_reduction(value => 1);
890 my $cmr = $lakeshore->get_common_mode_reduction();
891  
892 Allowed values: 0 and 1.
893  
894 =head2 set_mout/get_mout
895  
896 $lakeshore->set_mout(output => 0, value => 10);
897 my $mout = $lakeshore->get_mout(output => 0);
898  
899 =head2 set_inset/get_inset
900  
901 $lakeshore->set_inset(
902 channel => 1, # A, 1, ..., 16
903 enabled => 1,
904 dwell => 1,
905 pause => 3,
906 curve_number => 1,
907 tempco => 1, # 1 or 2
908 );
909  
910 my %inset = $lakeshore->get_inset(channel => 1);
911  
912 =head2 set_intype/get_intype
913  
914 $lakeshore->set_intype(
915 channel => 1,
916 mode => 0, # voltage excitation mode
917 excitation => 3, # 20μV, only relevant for measurement input
918 autorange => 0, # only relevant for control input
919 range => 1, # only relevant for control input
920 cs_shunt => 0, # default: 0
921 units => 1, # Kelvin, default: 1
922  
923 my %intype = $lakeshore->get_intype(channel => 1);
924  
925 =head2 curve_delete
926  
927 $lakeshore->curve_delete(curve => 21);
928  
929 =head2 set_curve_header/get_curve_header
930  
931 $lakeshore->set_curve_header(
932 curve => 21,
933 name => "Germanium",
934 SN => "selfmade",
935 format => 4, # log Ohm / Kelvin
936 limit => 300,
937 coefficient => 1, # negative
938 );
939
940 my %header = $lakeshore->get_curve_header(curve => 21);
941  
942 =head2 set_curve_point/get_curve_point
943  
944 $lakeshore->set_curve_point(
945 curve => 21, # 21..59
946 index => 1, # sets first point (1..200)
947 units => 2, # R or log(R)
948 temp => 0.012345,
949 curvature => 0, # default: 0
950 );
951  
952 my %point = $lakeshore->get_curve_point(curve => 21, point => 1);
953  
954 =head2 set_input_name/get_input_name
955  
956 $lakeshore->set_input_name(channel => 1, value => 'RuOx_Sample');
957
958 my $name = $lakeshore->get_input_name(channel => 1);
959  
960 =head2 set_ramp/get_ramp
961  
962 $lakeshore->set_ramp(
963 loop => 0,
964 on => 1, # 0 or 1
965 rate => 10e-3, # ramp rate in K/min
966 );
967  
968 my %rate = $lakeshore->get_ramp(loop => 0);
969  
970 =head2 set_scanner/get_scanner
971  
972 # Set scanner to channel 5 and start autoscanning
973 $lakeshore->set_scanner(
974 channel => 5,
975 autoscan => 1,
976 );
977
978 my %scanner = $lakeshore->get_scanner();
979 my $current_channel = $scanner{channel};
980  
981 =head2 set_display_field/get_display_field
982  
983 $lakeshore->set_display_field(
984 field => 1,
985 input => 1,
986 units => 1, # Kelvin
987 );
988  
989 my %field = $lakeshore->get_display_field(field => 1);
990  
991 =head2 set_display/get_display
992  
993 $lakeshore->set_display(
994 mode => 2, # custom
995 num_fields => 2, # 8 fields
996 displayed_info => 1, # sample_heater
997 );
998  
999 my %display = $lakeshore->get_display();
1000  
1001 =head2 Consumed Roles
1002  
1003 This driver consumes the following roles:
1004  
1005 =over
1006  
1007 =item L<Lab::Moose::Instrument::Common>
1008  
1009 =back
1010  
1011 =head1 COPYRIGHT AND LICENSE
1012  
1013 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
1014  
1015 Copyright 2018 Simon Reinhardt
1016 2020 Andreas K. Huettel, Simon Reinhardt
1017 2021-2023 Simon Reinhardt
1018  
1019  
1020 This is free software; you can redistribute it and/or modify it under
1021 the same terms as the Perl 5 programming language system itself.
1022  
1023 =cut
« Instrument/AH2700A.pm ↑ Summary Connection/Trace.pm »