File Coverage

blib/lib/Lab/Moose/Instrument/Lakeshore340/Helium3.pm
Criterion Covered Total %
statement 26 59 44.0
branch 0 4 0.0
condition n/a
subroutine 9 12 75.0
pod 2 3 66.6
total 37 78 47.4


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::Lakeshore340::Helium3;
2             $Lab::Moose::Instrument::Lakeshore340::Helium3::VERSION = '3.880';
3             #ABSTRACT: Lakeshore Model 340 Temperature Controller for Helium3 operation
4              
5 1     1   2678 use v5.20;
  1         5  
6              
7 1     1   6 use Moose;
  1         3  
  1         9  
8 1     1   7574 use Moose::Util::TypeConstraints qw/enum/;
  1         3  
  1         11  
9 1     1   574 use MooseX::Params::Validate;
  1         3  
  1         10  
10 1         73 use Lab::Moose::Instrument qw/
11 1     1   544 validated_getter validated_setter setter_params /;
  1         3  
12 1     1   6 use Lab::Moose::Instrument::Cache;
  1         3  
  1         11  
13 1     1   712 use Carp;
  1         4  
  1         59  
14 1     1   6 use namespace::autoclean;
  1         3  
  1         21  
15 1     1   133 use Time::HiRes qw/time sleep/;
  1         2  
  1         10  
16              
17             #use POSIX qw/log10 ceil floor/;
18              
19             extends 'Lab::Moose::Instrument::Lakeshore340';
20              
21             sub BUILD {
22 0     0 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             has sample_channel =>
41             ( is => 'ro', isa => enum( [qw/A B C D/] ), default => 'A' );
42              
43             has sorb_channel =>
44             ( is => 'ro', isa => enum( [qw/A B C D/] ), default => 'C' );
45              
46             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             has T_switch => ( is => 'ro', isa => 'Num', default => 1.5 );
51              
52              
53             sub condensate {
54 0     0 1   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 ) {
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 0         if ( $t_sample < $T_cool ) {
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     0 1   my ( $self, $value, %args ) = validated_setter(
116             \@_,
117             );
118              
119 0 0         if ( $value < $self->T_switch ) {
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             __PACKAGE__->meta()->make_immutable();
133              
134             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.880
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