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 SCAR 18.6
CC
4
Cov
47%
condensate
12.0
set_T
6.0
BUILD
2.0
CRAP 6.4
« Connection/Log.pm ↑ Summary Instrument/DummySource.pm »
1 package Lab::Moose::Instrument::Lakeshore340::Helium3;
2 1 $Lab::Moose::Instrument::Lakeshore340::Helium3::VERSION = '3.881';
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/
11 1 ▶ validated_getter validated_setter setter_params /;
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/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 sub BUILD {
22 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
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 sub condensate {
54 0 ▶ my ( $self, %args ) = validated_getter(
Subroutine condensate: not called CC=3 SCAR=24.8
Pod documented
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 sub set_T {
115 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine set_T: not called CC=2 SCAR=17.9
Pod documented
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__
137  
138 =pod
139  
140 =encoding UTF-8
141  
142 =head1 NAME
143  
144 Lab::Moose::Instrument::Lakeshore340::Helium3 - Lakeshore Model 340 Temperature Controller for Helium3 operation
145  
146 =head1 VERSION
147  
148 version 3.881
149  
150 =head1 SYNOPSIS
151  
152 use Lab::Moose;
153  
154 # Constructor
155 my $helium3 = instrument(
156 type => 'Lakeshore340::Helium3',
157 connection_type => 'LinuxGPIB',
158 connection_options => {pad => 22},
159
160 );
161  
162 default thermometers:
163 sample => 'A'
164 sample_high => 'B' (optional)
165 sorb => 'C'
166 1K-pot => 'D'
167  
168 Can be configured with attributes C<sample_channel>, C<sorb_channel>, C<one_K_channel>.
169  
170 default heater config:
171 loop 1 (dual Banana jack) => sorb heater
172 loop 2 (Analog output 2, BNC) => he3-pot heater
173  
174 (Analog out 1 can be used for IVC-sorb)
175  
176 The attribute C<T_switch> (default: 1.5) determines the used control loop for a given temperature setpoint:
177  
178 - T < C<T_switch>: use sorb heater, ramp sample heater to zero
179 - T > C<T_switch>: use 3He-pot heater, set sorb to 15K
180  
181 =head1 METHODS
182  
183 Supports all methods from L<Lab::Moose::Instrument::Lakeshore340>.
184  
185 =head2 condensate
186  
187 $lakeshore->condensate(
188 T_sorb => 35, # default: 35 K
189 wait => 1800, # default: 30 min
190 T_cool => 0.4, # default: 0.4 K
191 );
192  
193 Heat sorb to 35K for 30min. Then turn off sorb heater and wait until sample temperature is below 400mK.
194  
195 =head2 set_T
196  
197 $helium3->set_T(value => 0.345);
198  
199 Behaviour depends on the attribute value C<T_switch> (see L</Synopsis>).
200  
201 =head1 COPYRIGHT AND LICENSE
202  
203 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
204  
205 Copyright 2022 Simon Reinhardt
206  
207  
208 This is free software; you can redistribute it and/or modify it under
209 the same terms as the Perl 5 programming language system itself.
210  
211 =cut
« Connection/Log.pm ↑ Summary Instrument/DummySource.pm »