Moose/Instrument/Lakeshore340/Helium3.pm

filter: Statementstmt 50.7% 34 / 67 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 9 / 12 Podpod 66.6% 2 / 3 totaltotal 51.1% 45 / 88 CC 4 SCAR 13.7
CC
4
Cov
47%
condensate
12.0
set_T
6.0
BUILD
2.0
CRAP 3.9
« Moose/Connection/Socket.pm ↑ Summary Moose/Instrument/Lakeshore350.pm »
1 package Lab::Moose::Instrument::Lakeshore340::Helium3;
2 1 $Lab::Moose::Instrument::Lakeshore340::Helium3::VERSION = '3.931';
3 #ABSTRACT: Lakeshore Model 340 Temperature Controller for Helium3 operation
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 Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Lab::Moose::Instrument qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 validated_getter validated_setter setter_params /;
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/time sleep/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #use POSIX qw/log10 ceil floor/;
18  
19 1 extends 'Lab::Moose::Instrument::Lakeshore340';
20  
21 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my $self = shift;
23  
24 # enable analog output 2
25 0 $self->set_analog_out(
26 output => 2,
27 mode => 3, # loop,
28 );
29 0 $self->set_control_parameters(
30 loop => 2,
31 input => $self->sample_channel(),
32 units => 1,
33 state => 1,
34 );
35 0 $self->set_setpoint( loop => 2, value => 0 );
36 }
37  
38 # the set_T/get_T functions use these channels
39  
40 1 has sample_channel =>
41 ( is => 'ro', isa => enum( [qw/A B C D/] ), default => 'A' );
42  
43 1 has sorb_channel =>
44 ( is => 'ro', isa => enum( [qw/A B C D/] ), default => 'C' );
45  
46 1 has one_K_channel =>
47 ( is => 'ro', isa => enum( [qw/A B C D/] ), default => 'D' );
48  
49 # use He3-pot heater if T > T_switch
50 1 has T_switch => ( is => 'ro', isa => 'Num', default => 1.5 );
51  
52  
53 0 ▶sub condensate {
Subroutine condensate: not called CC=3 SCAR=24.8
Pod documented
54 0 my ( $self, %args ) = validated_getter(
55 \@_,
56 T_sorb => { isa => 'Lab::Moose::PosNum', default => 35 },
57 wait => { isa => 'Lab::Moose::PosNum', default => 1800 },
58 T_cool => { isa => 'Lab::Moose::PosNum', default => 0.4 },
59 );
60 0 my ( $sorb_temp, $wait, $T_cool ) = delete @args{qw/T_sorb wait/};
61  
62 0 $self->set_setpoint( loop => 1, value => $sorb_temp );
63  
64 0 my $t_start = time();
65  
66 # enable autoflush
67 0 my $autoflush = STDOUT->autoflush();
68  
69 0 ▶ while ( time() - $t_start < $wait ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Lab::Moose::Instrument::Lakeshore340::Helium3::time() - $t_start < $wait) 0 0 0
70 0 my $t_sorb = $self->get_T( channel => $self->sorb_channel, %args );
71 0 my $t_1k = $self->get_T( channel => $self->one_K_channel, %args );
72 0 my $t_sample
73 = $self->get_T( channel => $self->sample_channel, %args );
74 0 printf(
75 "T_sorb = %.1f, T_1K = %.1f, T_sample = %.1f \r",
76 $t_sorb, $t_1k, $t_sample
77 );
78 0 sleep 5;
79  
80 }
81 0 print " " x 70 . "\r";
82  
83 # heater off
84 0 $self->set_heater_range( value => 0 );
85  
86 # wait until sample is cold again
87 0 while (1) {
88 0 my $t_sorb = $self->get_T( channel => $self->sorb_channel, %args );
89 0 my $t_1k = $self->get_T( channel => $self->one_K_channel, %args );
90 0 my $t_sample
91 = $self->get_T( channel => $self->sample_channel, %args );
92  
93 0 printf(
94 "T_sorb = %.1f, T_1K = %.1f, T_sample = %.1f \r",
95 $t_sorb, $t_1k, $t_sample
96 );
97  
98 0 ▶ if ( $t_sample < $T_cool ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t_sample < $T_cool) 0 0 0
99 0 last;
100 }
101  
102 0 sleep 5;
103  
104 }
105  
106 0 print " " x 70 . "\r";
107  
108 # reset autoflush to previous value
109 0 STDOUT->autoflush($autoflush);
110  
111 }
112  
113  
114 0 ▶sub set_T {
Subroutine set_T: not called CC=2 SCAR=17.9
Pod documented
115 0 my ( $self, $value, %args ) = validated_setter(
116 \@_,
117 );
118  
119 0 ▶ if ( $value < $self->T_switch ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value < $self->T_switch) { } 0 0 0
120  
121 # use Sorb heater (loop 1). Turn down loop 2 output.
122 0 $self->set_setpoint( loop => 1, value => $value );
123 0 $self->set_setpoint( loop => 2, value => 0 );
124 }
125 else {
126 # set Sorb on 15K and use loop 2
127 0 $self->set_setpoint( loop => 1, value => 15 );
128 0 $self->set_setpoint( loop => 2, value => $value );
129 }
130 }
131  
132 1 __PACKAGE__->meta()->make_immutable();
133  
134 1 1;
135  
136 __END__
« Moose/Connection/Socket.pm ↑ Summary Moose/Instrument/Lakeshore350.pm »