Instrument/OI_Triton.pm

filter: Statementstmt 17.0% 15 / 88 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 21.0% 4 / 19 Podpod 13.3% 2 / 15 totaltotal 14.6% 21 / 143 SCAR 43.0
CC
10
Cov
14%
set_T
30.0
new
6.0
get_temperature
6.0
CRAP 73.6
« Moose/Instrument/AMI_430.pm ↑ Summary Moose/Connection/VISA.pm »
1 package Lab::Instrument::OI_Triton;
2 #ABSTRACT: Oxford Instruments Triton dilution refrigerator control
3 1 $Lab::Instrument::OI_Triton::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 1 ▶use Lab::Instrument;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our @ISA = ("Lab::Instrument");
11  
12 1 our %fields = (
13 supported_connections => [ 'Socket', 'VISA' ],
14  
15 # default settings for the supported connections
16 connection_settings => {
17 remote_port => 33576,
18 remote_addr => 'triton',
19 },
20 );
21  
22 sub new {
23 0 ▶ my $proto = shift;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
24 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
25 0 my $self = $class->SUPER::new(@_);
26 0 $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__);
27  
28 0 return $self;
29 }
30  
31 sub get_temperature {
32 0 ▶ my $self = shift;
Subroutine get_temperature: not called CC=2 SCAR=17.9
Pod documented
33 0 my $channel = shift;
34 0 ▶ $channel = "1" unless defined($channel);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $channel 0 0 0
35  
36 0 my $temp = $self->query("READ:DEV:T$channel:TEMP:SIG:TEMP\n");
37  
38 # typical response: STAT:DEV:T1:TEMP:SIG:TEMP:1.47628K
39  
40 0 $temp =~ s/^.*:SIG:TEMP://;
41 0 $temp =~ s/K.*$//;
42 0 return $temp;
43 }
44  
45 sub enable_control {
46 0 ▶ my $self = shift;
Subroutine enable_control: not called CC=1 SCAR=6.9
Pod undocumented
47 0 my $temp = $self->query("SET:SYS:USER:NORM\n");
48  
49 # typical response: STAT:SET:SYS:USER:NORM:VALID
50 0 return $temp;
51 }
52  
53 sub disable_control {
54 0 ▶ my $self = shift;
Subroutine disable_control: not called CC=1 SCAR=6.9
Pod undocumented
55 0 my $temp = $self->query("SET:SYS:USER:GUEST\n");
56  
57 # typical response: STAT:SET:SYS:USER:GUEST:VALID
58 0 return $temp;
59 }
60  
61 sub enable_temp_pid {
62 0 ▶ my $self = shift;
Subroutine enable_temp_pid: not called CC=1 SCAR=6.9
Pod undocumented
63 0 my $temp = $self->query("SET:DEV:T5:TEMP:LOOP:MODE:ON\n");
64  
65 # typical response: STAT:SET:DEV:T5:TEMP:LOOP:MODE:ON:VALID
66 0 return $temp;
67 }
68  
69 sub disable_temp_pid {
70 0 ▶ my $self = shift;
Subroutine disable_temp_pid: not called CC=1 SCAR=6.9
Pod undocumented
71 0 my $temp = $self->query("SET:DEV:T5:TEMP:LOOP:MODE:OFF\n");
72  
73 # typical response: STAT:SET:DEV:T5:TEMP:LOOP:MODE:OFF:VALID
74 0 return $temp;
75 }
76  
77 sub get_T {
78 0 ▶ my $self = shift;
Subroutine get_T: not called CC=1 SCAR=6.9
Pod undocumented
79 0 my $temp = $self->get_temperature("5");
80 0 return $temp;
81 }
82  
83 sub waitfor_T {
84 0 ▶ my $self = shift;
Subroutine waitfor_T: not called CC=2 SCAR=17.9
Pod undocumented
85 0 my $target = shift;
86 0 my $now = 10000000;
87  
88 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
unless (abs($now - $target) / $target < "0.05") 0 0 0
89 0 sleep(10);
90 0 $now = get_T();
91 0 print "Waiting for T=$target ; current temperature is T=$now\n";
92 } unless ( abs( $now - $target ) / $target < 0.05 );
93 }
94  
95 sub set_T {
96 0 ▶ my $self = shift;
Subroutine set_T: not called CC=5 SCAR=34.0
Pod undocumented
97 0 my $temp = shift;
98
99 0 ▶ if ( $temp > 0.7 ) { croak "OI_Triton::set_T: setting temperatures above 0.7K is forbidden\n"; };
Branch: 1 branch
BranchTrueFalseTotal
if ($temp > "0.7") 0 0 0
100
101 0 ▶ if ( $temp < 0.035 ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($temp < 0.035) { } 0 0 0
elsif ($temp < 0.07) { } 0 0 0
elsif ($temp < 0.35) { } 0 0 0
102 0 $self->set_Imax(0.000316);
103 } elsif ( $temp < 0.07 ) {
104 0 $self->set_Imax(0.001);
105 } elsif ( $temp < 0.35 ) {
106 0 $self->set_Imax(0.00316);
107 } else {
108 0 $self->set_Imax(0.01);
109 };
110
111 0 my $temp = $self->query("SET:DEV:T5:TEMP:LOOP:TSET:$temp\n");
112 # typical reply: STAT:SET:DEV:T5:TEMP:LOOP:TSET:0.1:VALID
113
114 0 $self->enable_temp_pid();
115  
116 0 my $temp = $self->query("SET:DEV:T5:TEMP:LOOP:TSET:$temp\n");
117 # typical reply: STAT:SET:DEV:T5:TEMP:LOOP:TSET:0.1:VALID
118 }
119  
120 sub set_Imax {
121 0 ▶ my $self = shift;
Subroutine set_Imax: not called CC=2 SCAR=17.9
Pod undocumented
122 0 my $imax = shift; # in Ampere
123
124 0 ▶ if ($imax > 0.0101) { croak "OI_Triton::set_Imax: Setting too large heater current limit\n"; };
Branch: 1 branch
BranchTrueFalseTotal
if ($imax > "0.0101") 0 0 0
125
126 0 $imax=$imax*1000; # in mA
127
128 0 return $self->query("SET:DEV:T5:TEMP:LOOP:RANGE:$imax\n");
129 };
130  
131  
132 sub get_P {
133 0 ▶ my $self = shift;
Subroutine get_P: not called CC=1 SCAR=6.9
Pod undocumented
134 0 my $power = $self->query("READ:DEV:H1:HTR:SIG:POWR\n");
135
136 0 $power =~ s/^.*SIG:POWR://;
137 0 $power =~ s/uW$//;
138 0 return $power;
139 }
140  
141 sub set_P {
142 0 ▶ my $self = shift;
Subroutine set_P: not called CC=1 SCAR=6.9
Pod undocumented
143 0 my $power = shift;
144
145 0 return $self->query("SET:DEV:H1:HTR:SIG:POWR:$power\n");
146 }
147  
148  
149  
150 # now follows the temperature sweep interface for XPRESS
151  
152 sub set_heatercontrol {
153 0 ▶ my $self = shift;
Subroutine set_heatercontrol: not called CC=2 SCAR=17.9
Pod undocumented
154  
155 0 my $mode = shift;
156 # assumption: MAN=no control loop, AUTO=internal PID loop
157
158 0 ▶ if ( $mode eq 'AUTO' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode eq 'AUTO') { } 0 0 0
159 0 $self->enable_temp_pid();
160 } else {
161 0 $self->disable_temp_pid();
162 };
163
164 0 return;
165 }
166  
167 sub set_heateroutput {
168 0 ▶ my $self = shift;
Subroutine set_heateroutput: not called CC=1 SCAR=6.9
Pod undocumented
169  
170 0 $self->disable_temp_pid();
171 0 $self->set_P(0);
172
173 0 return;
174 }
175  
176 sub get_value {
177 0 ▶ my $self = shift;
Subroutine get_value: not called CC=1 SCAR=6.9
Pod undocumented
178 0 return $self->get_T(@_);
179 }
180  
181  
182  
183  
184 # requires set_T
185  
186  
187 1 1;
188  
189 __END__
190  
191 =pod
192  
193 =encoding utf-8
194  
195 =head1 NAME
196  
197 Lab::Instrument::OI_Triton - Oxford Instruments Triton dilution refrigerator control
198  
199 =head1 VERSION
200  
201 version 3.881
202  
203 =head1 SYNOPSIS
204  
205 use Lab::Instrument::OI_Triton;
206
207 my $m=new Lab::Instrument::OI_Triton(
208 connection_type=>'Socket',
209 remote_port=>33576,
210 remote_addr=>'triton',
211 );
212  
213 =head1 DESCRIPTION
214  
215 The Lab::Instrument::OI_Triton class implements an interface to the Oxford Instruments
216 Triton dilution refrigerator control system.
217  
218 =head1 METHODS
219  
220 =head2 get_temperature
221  
222 $t=$m->get_temperature('1');
223  
224 Read out the designated temperature channel. Result is in Kelvin (?).
225  
226 =head1 CAVEATS/BUGS
227  
228 probably many
229  
230 =head1 SEE ALSO
231  
232 =over 4
233  
234 =item L<Lab::Instrument>
235  
236 =back
237  
238 =head1 COPYRIGHT AND LICENSE
239  
240 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
241  
242 Copyright 2014
243 2015 Andreas K. Huettel
244 2016 Andreas K. Huettel, Simon Reinhardt
245 2017 Andreas K. Huettel
246 2020 Andreas K. Huettel
247  
248  
249 This is free software; you can redistribute it and/or modify it under
250 the same terms as the Perl 5 programming language system itself.
251  
252 =cut
« Moose/Instrument/AMI_430.pm ↑ Summary Moose/Connection/VISA.pm »