Instrument/Lakeshore224.pm

filter: Statementstmt 16.6% 18 / 108 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 63 MC/DCmcdc 0.0% 0 / 32 Subroutinesub 20.0% 5 / 25 Podpod 5.2% 1 / 19 totaltotal 8.9% 24 / 267 SCAR 66.8
CC
32
Cov
9%
set_alarm
182.0
set_filter
110.0
set_leds
20.0
CRAP 792.9
« Instrument/TRMC2.pm ↑ Summary Moose/Instrument/ABB_TRMC2.pm »
1 package Lab::Instrument::Lakeshore224;
2 #ABSTRACT: Lake Shore 224 temperature monitor
3 1 $Lab::Instrument::Lakeshore224::VERSION = '3.881';
4 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Lab::Instrument;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Lab::MultiChannelInstrument;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our @ISA = ( "Lab::MultiChannelInstrument", "Lab::Instrument" );
13  
14 1 our %fields = (
15 supported_connections => [ 'VISA', 'VISA_GPIB', 'GPIB', 'DEBUG' ],
16  
17 # default settings for the supported connections
18 connection_settings => {
19 gpib_board => 0,
20 gpib_address => 12,
21 connection_type => 'VISA_GPIB',
22 timeout => 1,
23 },
24  
25 device_settings => {
26 channels => {
27 ChA => 'A',
28 ChB => 'B',
29 ChC1 => 'C1',
30 ChC2 => 'C2',
31 ChC3 => 'C3',
32 ChC4 => 'C4',
33 ChC5 => 'C5',
34 ChD1 => 'D1',
35 ChD2 => 'D2',
36 ChD3 => 'D3',
37 ChD4 => 'D4',
38 ChD5 => 'D5',
39 },
40 channel_default => 'ChA',
41 channel => undef
42 },
43  
44 device_cache => { T => undef },
45  
46 device_cache_order => [],
47  
48 multichannel_shared_cache => [],
49  
50 );
51  
52 sub new {
53 0 ▶ my $proto = shift;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
54 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
55 0 my $self = $class->SUPER::new(@_);
56 0 $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__);
57  
58 0 return $self;
59 }
60  
61 sub _device_init {
62 0 ▶ my $self = shift;
Subroutine _device_init: not called CC=1 SCAR=6.9
63  
64 }
65  
66 sub get_tst {
67 0 ▶ my $self = shift;
Subroutine get_tst: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my ($tail) = $self->_check_args( \@_, [] );
69  
70 0 return $self->query( "*TST? ", $tail );
71 }
72  
73 sub get_T {
74 0 ▶ my $self = shift;
Subroutine get_T: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my ($tail) = $self->_check_args( \@_, [] );
76  
77 0 return $self->query( 'KRDG? ' . $self->{channel}, $tail );
78 }
79  
80 sub get_R {
81 0 ▶ my $self = shift;
Subroutine get_R: not called CC=1 SCAR=6.9
Pod undocumented
82 0 my ($tail) = $self->_check_args( \@_, [] );
83  
84 0 return $self->query( "SRDG? " . $self->{channel}, $tail );
85 }
86  
87 sub set_leds {
88 0 ▶ my $self = shift;
Subroutine set_leds: not called CC=4 SCAR=30.0
Pod undocumented
89 0 my ( $state, $tail ) = $self->_check_args( \@_, ['state'] );
90  
91 0 ▶ if ( defined $state and ( $state != 1 and $state != 0 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $state and ($state != 1 and $state != 0)) 0 0 0
Condition0%0/6
defined $state and ($state != 1 and $state != 0)
!ll&&!rl&&r
000
$state != 1 and $state != 0
!ll&&!rl&&r
000
MC/DC0%0/3
defined $state and ($state != 1 and $state != 0)
defined $state $state != 1 $state != 0
Truth table0%0/4
A and B and C
A= defined $stateB= $state != 1C= $state != 0
ABCresult
0XX0
10X0
1100
1111
92 0 carp('State has to be 1 or 0');
93 0 return;
94 }
95  
96 0 $self->write( "LEDS " . $state, $tail );
97 }
98  
99 sub get_leds {
100 0 ▶ my $self = shift;
Subroutine get_leds: not called CC=1 SCAR=6.9
Pod undocumented
101 0 my ($tail) = $self->_check_args( \@_, [] );
102  
103 0 return $self->query( "LEDS?", $tail );
104 }
105  
106 sub reset_minmax {
107 0 ▶ my $self = shift;
Subroutine reset_minmax: not called CC=1 SCAR=6.9
Pod undocumented
108 0 my ($tail) = $self->_check_args( \@_, [] );
109  
110 0 $self->write("MNMXRST");
111  
112 }
113  
114 sub get_minmax {
115 0 ▶ my $self = shift;
Subroutine get_minmax: not called CC=1 SCAR=6.9
Pod undocumented
116 0 my ($tail) = $self->_check_args( \@_, [] );
117  
118 0 return $self->query( "MDAT?" . $self->{channel}, $tail );
119 }
120  
121 sub get_T_Celsius {
122 0 ▶ my $self = shift;
Subroutine get_T_Celsius: not called CC=1 SCAR=6.9
Pod undocumented
123 0 my ($tail) = $self->_check_args( \@_, [] );
124  
125 0 return $self->query( "CRDG? " . $self->{channel}, $tail );
126 }
127  
128 sub get_filter {
129 0 ▶ my $self = shift;
Subroutine get_filter: not called CC=1 SCAR=6.9
Pod undocumented
130 0 my ($tail) = $self->_check_args( \@_, [] );
131  
132 0 return $self->query( "FILTER?" . $self->{channel}, $tail );
133 }
134  
135 sub set_filter {
136 0 ▶ my $self = shift;
Subroutine set_filter: not called CC=10 SCAR=47.0
Pod undocumented
137 0 my ( $on_off, $points, $window, $tail )
138 = $self->_check_args( \@_, [ 'on_off', 'points', 'window' ] );
139  
140 0 ▶ if ( defined $on_off and ( $on_off != 1 and $on_off != 0 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $on_off and ($on_off != 1 and $on_off != 0)) 0 0 0
Condition0%0/6
defined $on_off and ($on_off != 1 and $on_off != 0)
!ll&&!rl&&r
000
$on_off != 1 and $on_off != 0
!ll&&!rl&&r
000
MC/DC0%0/3
defined $on_off and ($on_off != 1 and $on_off != 0)
defined $on_off $on_off != 1 $on_off != 0
Truth table0%0/4
A and B and C
A= defined $on_offB= $on_off != 1C= $on_off != 0
ABCresult
0XX0
10X0
1100
1111
141 0 carp('on_off has to be 1 or 0');
142 0 return;
143 }
144  
145 0 ▶ if ( defined $points and ( $points < 2 or $points > 64 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $points and $points < 2 || $points > 64) 0 0 0
Condition0%0/6
defined $points and $points < 2 || $points > 64
!ll&&!rl&&r
000
$points < 2 or $points > 64
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $points and $points < 2 || $points > 64
defined $points $points < 2 $points > 64
Truth table0%0/4
A and B or C
A= defined $pointsB= $points < 2C= $points > 64
ABCresult
0XX0
1000
11X1
1011
146 0 carp('Valid range for points is 2 to 64');
147 0 return;
148 }
149  
150 0 ▶ if ( defined $window and ( $window < 1 or $window > 10 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $window and $window < 1 || $window > 10) 0 0 0
Condition0%0/6
defined $window and $window < 1 || $window > 10
!ll&&!rl&&r
000
$window < 1 or $window > 10
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $window and $window < 1 || $window > 10
defined $window $window < 1 $window > 10
Truth table0%0/4
A and B or C
A= defined $windowB= $window < 1C= $window > 10
ABCresult
0XX0
1000
11X1
1011
151 0 carp('Valid range for window is 1 to 10');
152 0 return;
153 }
154  
155 0 $self->write( "FILTER $self->{channel},$on_off,$points,$window", $tail );
156 }
157  
158 sub get_mode {
159 0 ▶ my $self = shift;
Subroutine get_mode: not called CC=1 SCAR=6.9
Pod undocumented
160 0 my ($tail) = $self->_check_args( \@_, [] );
161  
162 0 return $self->query( "MODE?", $tail );
163 }
164  
165 sub set_mode {
166 0 ▶ my $self = shift;
Subroutine set_mode: not called CC=4 SCAR=30.0
Pod undocumented
167 0 my ( $state, $tail ) = $self->_check_args( \@_, ['state'] );
168  
169 0 ▶ if ( defined $state and ( $state < 1 or $state > 2 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $state and $state < 1 || $state > 2) 0 0 0
Condition0%0/6
defined $state and $state < 1 || $state > 2
!ll&&!rl&&r
000
$state < 1 or $state > 2
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $state and $state < 1 || $state > 2
defined $state $state < 1 $state > 2
Truth table0%0/4
A and B or C
A= defined $stateB= $state < 1C= $state > 2
ABCresult
0XX0
1000
11X1
1011
170 0 carp(
171 'State has to be 0 (local), 1 (remote) or 2 (remote with local lockout)'
172 );
173 0 return;
174 }
175  
176 0 $self->write( "MODE " . $state, $tail );
177 }
178  
179 sub get_lock {
180 0 ▶ my $self = shift;
Subroutine get_lock: not called CC=1 SCAR=6.9
Pod undocumented
181 0 my ($tail) = $self->_check_args( \@_, [] );
182  
183 0 return $self->query( "LOCK?", $tail );
184 }
185  
186 sub set_lock {
187 0 ▶ my $self = shift;
Subroutine set_lock: not called CC=4 SCAR=30.0
Pod undocumented
188 0 my ( $state, $tail ) = $self->_check_args( \@_, ['state'] );
189  
190 0 ▶ if ( defined $state and ( $state != 0 and $state != 1 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $state and ($state != 0 and $state != 1)) 0 0 0
Condition0%0/6
defined $state and ($state != 0 and $state != 1)
!ll&&!rl&&r
000
$state != 0 and $state != 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $state and ($state != 0 and $state != 1)
defined $state $state != 0 $state != 1
Truth table0%0/4
A and B and C
A= defined $stateB= $state != 0C= $state != 1
ABCresult
0XX0
10X0
1100
1111
191 0 carp('State has to be 0 (unlocked) or 1 (locked)');
192 0 return;
193 }
194  
195 0 $self->write( "LOCK " . $state, $tail );
196 }
197  
198 sub get_alarm {
199 0 ▶ my $self = shift;
Subroutine get_alarm: not called CC=1 SCAR=6.9
Pod undocumented
200 0 my ( $state, $tail ) = $self->_check_args( \@_, ['state'] );
201  
202 0 return $self->query( "ALARM?" . $self->{channel}, $tail );
203 }
204  
205 sub set_alarm {
206 0 ▶ my $self = shift;
Subroutine set_alarm: not called CC=13 SCAR=52.0
Pod undocumented
207 my (
208 0 $on_off, $high_setpoint, $low_setpoint, $deadband, $latch_enable,
209 $audible, $display, $tail
210 )
211 = $self->_check_args(
212 \@_,
213 [
214 'on_off', 'high_setpoint', 'low_setpoint', 'deadband',
215 'latch_enable', 'audible', 'display'
216 ]
217 );
218  
219 0 ▶ if ( defined $on_off and ( $on_off != 1 and $on_off != 0 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $on_off and ($on_off != 1 and $on_off != 0)) 0 0 0
Condition0%0/6
defined $on_off and ($on_off != 1 and $on_off != 0)
!ll&&!rl&&r
000
$on_off != 1 and $on_off != 0
!ll&&!rl&&r
000
MC/DC0%0/3
defined $on_off and ($on_off != 1 and $on_off != 0)
defined $on_off $on_off != 1 $on_off != 0
Truth table0%0/4
A and B and C
A= defined $on_offB= $on_off != 1C= $on_off != 0
ABCresult
0XX0
10X0
1100
1111
220 0 carp('on_off has to be 1 or 0');
221 0 return;
222 }
223  
224 0 ▶ if ( defined $latch_enable
Branch: 1 branch
BranchTrueFalseTotal
if (defined $latch_enable and $latch_enable != 1 || $latch_enable != 0) 0 0 0
Condition0%0/6
defined $latch_enable and $latch_enable != 1 || $latch_enable != 0
!ll&&!rl&&r
000
$latch_enable != 1 or $latch_enable != 0
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $latch_enable and $latch_enable != 1 || $latch_enable != 0
defined $latch_enable $latch_enable != 1 $latch_enable != 0
Truth table0%0/4
A and B or C
A= defined $latch_enableB= $latch_enable != 1C= $latch_enable != 0
ABCresult
0XX0
1000
11X1
1011
225 and ( $latch_enable != 1 or $latch_enable != 0 ) ) {
226 0 carp('latch_enable has to be 1 or 0');
227 0 return;
228 }
229  
230 0 ▶ if ( defined $audible and ( $audible != 1 and $audible != 0 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $audible and ($audible != 1 and $audible != 0)) 0 0 0
Condition0%0/6
defined $audible and ($audible != 1 and $audible != 0)
!ll&&!rl&&r
000
$audible != 1 and $audible != 0
!ll&&!rl&&r
000
MC/DC0%0/3
defined $audible and ($audible != 1 and $audible != 0)
defined $audible $audible != 1 $audible != 0
Truth table0%0/4
A and B and C
A= defined $audibleB= $audible != 1C= $audible != 0
ABCresult
0XX0
10X0
1100
1111
231 0 carp('audible has to be 1 or 0');
232 0 return;
233 }
234  
235 0 ▶ if ( defined $display and ( $display != 1 or $display != 0 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $display and $display != 1 || $display != 0) 0 0 0
Condition0%0/6
defined $display and $display != 1 || $display != 0
!ll&&!rl&&r
000
$display != 1 or $display != 0
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $display and $display != 1 || $display != 0
defined $display $display != 1 $display != 0
Truth table0%0/4
A and B or C
A= defined $displayB= $display != 1C= $display != 0
ABCresult
0XX0
1000
11X1
1011
236 0 carp('display has to be 1 or 0');
237 0 return;
238 }
239  
240 $self->write(
241 0 "ALARM $self->{channel}, $on_off, $high_setpoint, $low_setpoint, $deadband, $latch_enable, $audible, $display",
242 $tail
243 );
244 }
245  
246 sub reset_alarm {
247 0 ▶ my $self = shift;
Subroutine reset_alarm: not called CC=1 SCAR=6.9
Pod undocumented
248 0 my ($tail) = $self->_check_args( \@_, [] );
249  
250 0 $self->write( "ALMRST", $tail );
251 }
252  
253 sub get_value {
254 0 ▶ my $self = shift;
Subroutine get_value: not called CC=1 SCAR=6.9
Pod undocumented
255 0 return $self->get_T(@_);
256 }
257  
258 1 1;
259  
260 #----------Include features in measurment scripts-----------------------------------------------------------------------------------------------------------------------------------
261 # use Lab::Measurement;
262  
263 # my $lake=Instrument('Lakeshore224');
264  
265 # my $t_sample=$lake->get_value();
266  
267 # my $minmax = $lake->get_minmax();
268  
269 # my $celsius = $lake->get_T_Celsius();
270  
271 # $lake->reset_minmax;
272  
273 # my $light = $lake->get_leds();
274  
275 # $lake->set_leds(1);
276  
277 # my $filter=$lake->get_filter();
278  
279 # my $mode=$lake->get_mode();
280  
281 # $lake->set_mode(2); #State has to be 0 (local), 1 (remote) or 2 (remote with local lockout)
282  
283 # my $lock = $lake ->get_lock();
284  
285 # $lake->set_lock(0);
286  
287 # my $alarm = $lake->get_alarm();
288  
289 # $lake->reset_alarm();
290  
291 # $lake->set_alarm({
292 # on_off => 0, #0=off, 1=on
293 # high_setpoint => 296.906,
294 # low_setpoint => 290.00,
295 # deadband => 0, #Sets the value that the source must change outside of an alarm condition to deactivate an unclatched alarm
296 # latch_enable => 1, #Specifies wheter alarm remains active after alarm condition correction. 0=off, 1=on
297 # audible => 0, #speaker will beep when alarm condition occurs: 0=off, 1=on
298 # display => 1, #Alarm LED on front panel will blink when an alarm condition occurs: 0=off, 1=on
299 # });
300  
301 # $lake->set_filter({
302 # on_off => 1, #Specifies wheter the filter function is 0=Off or 1=On
303 # points => 2, #Specifies how many data points the filtering function uses. Valid range= 2 to 64
304 # window => 10, #Specifies what percent of full scale reading limits the filtering fuction. Valid range = 1 to 10 %
305 # });
306  
307 __END__
308  
309 =pod
310  
311 =encoding UTF-8
312  
313 =head1 NAME
314  
315 Lab::Instrument::Lakeshore224 - Lake Shore 224 temperature monitor
316  
317 =head1 VERSION
318  
319 version 3.881
320  
321 =head1 COPYRIGHT AND LICENSE
322  
323 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
324  
325 Copyright 2015 Christian Butschkow
326 2016 Simon Reinhardt
327 2017 Andreas K. Huettel
328 2020 Andreas K. Huettel
329  
330  
331 This is free software; you can redistribute it and/or modify it under
332 the same terms as the Perl 5 programming language system itself.
333  
334 =cut
« Instrument/TRMC2.pm ↑ Summary Moose/Instrument/ABB_TRMC2.pm »