Instrument/Cryogenic_SMS.pm

filter: Statementstmt 10.7% 12 / 112 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 27.2% 3 / 11 Podpod 12.5% 1 / 8 totaltotal 9.6% 16 / 166 SCAR 54.8
CC
17
Cov
8%
ramp_to_mid
30.0
ramp_to_zero
30.0
ramp_to_max
30.0
CRAP 240.0
« Moose/Connection/Zhinst.pm ↑ Summary Data/Analysis/TekTDS.pm »
1 package Lab::Instrument::Cryogenic_SMS;
2 #ABSTRACT: Cryogenic SMS magnet power supply
3 1 $Lab::Instrument::Cryogenic_SMS::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  
9 1 our @ISA = ('Lab::Instrument');
10  
11 # does not use any magnet supply specific code yet
12  
13 1 our %fields = (
14 supported_connections => [ 'GPIB', 'VISA' ],
15  
16 # default settings for the supported connections
17 connection_settings => {
18 gpib_board => 0,
19 gpib_address => undef,
20 },
21  
22 # device_settings => {
23 # use_persistentmode => 0,
24 # can_reverse => 0,
25 # can_use_negative_current => 0,
26 # },
27 );
28  
29 sub new {
30 0 ▶ my $proto = shift;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
31 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
32 0 my $self = $class->SUPER::new(@_);
33 0 $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__);
34 0 print "Cryogenic SMS magnet supply code is experimental.\n";
35 0 return $self;
36 }
37  
38 sub ramp_to_mid {
39 0 ▶ my $self = shift;
Subroutine ramp_to_mid: not called CC=5 SCAR=34.0
Pod undocumented
40 0 $self->write("RAMP MID\n");
41 0 my $status = $self->status();
42 0 ▶ while ( $status =~ /HOLDING/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /HOLDING/u) 0 0 0
43 { # takes care that command is finally executed
44 0 $status = $self->status();
45  
46 0 $status =~ /MID SETTING: (.*) AMPS/;
47 0 my $mid = $1;
48 0 $status =~ /OUTPUT: (.*) AMPS/;
49 0 my $out = $1;
50  
51 0 ▶ last if $mid == $out; # breaks if we have already reached target
Branch: 1 branch
BranchTrueFalseTotal
if $mid == $out 0 0 0
52  
53 0 $self->write("RAMP MID\n");
54 0 print "power supply not responding, send command again\n";
55 0 sleep(1);
56 }
57  
58 0 ▶ while ( $status =~ /RAMPING/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /RAMPING/u) 0 0 0
59 0 $status = $self->status();
60 0 sleep(1);
61 }
62  
63 0 $status =~ /MID SETTING: (.*) AMPS/;
64 0 my $mid = $1;
65 0 $status =~ /OUTPUT: (.*) AMPS/;
66 0 my $out = $1;
67  
68 0 ▶ return 0 if $mid == $out;
Branch: 1 branch
BranchTrueFalseTotal
if $mid == $out 0 0 0
69 0 return 1;
70 }
71  
72 sub ramp_to_zero {
73 0 ▶ my $self = shift;
Subroutine ramp_to_zero: not called CC=5 SCAR=34.0
Pod undocumented
74 0 $self->write("RAMP ZERO\n");
75 0 my $status = $self->status();
76 0 ▶ while ( $status =~ /HOLDING/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /HOLDING/u) 0 0 0
77 { # takes care that command is finally executed
78 0 $status = $self->status();
79  
80 0 $status =~ /OUTPUT: (.*) AMPS/;
81 0 my $out = $1;
82  
83 0 ▶ last if $out == 0; # breaks if we have already reached target
Branch: 1 branch
BranchTrueFalseTotal
if $out == 0 0 0 0
84  
85 0 $self->write("RAMP ZERO\n");
86 0 print "power supply not responding, send command again\n";
87 0 sleep(1);
88 }
89  
90 0 ▶ while ( $status =~ /RAMPING/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /RAMPING/u) 0 0 0
91 0 $status = $self->status();
92 0 sleep(1);
93 }
94  
95 0 $status = $self->status();
96 0 $status =~ /OUTPUT: (.*) AMPS/;
97 0 my $out = $1;
98 0 ▶ if ( $out == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($out == 0) 0 0 0
99 0 return 0;
100 }
101 0 return 1;
102 }
103  
104 sub ramp_to_max {
105 0 ▶ my $self = shift;
Subroutine ramp_to_max: not called CC=5 SCAR=34.0
Pod undocumented
106 0 $self->write("RAMP MAX\n");
107 0 my $status = $self->status();
108 0 ▶ while ( $status =~ /HOLDING/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /HOLDING/u) 0 0 0
109 { # takes care that command is finally executed
110 0 $status = $self->status();
111  
112 0 $status =~ /MAX SETTING: (.*) AMPS/;
113 0 my $max = $1;
114 0 $status =~ /OUTPUT: (.*) AMPS/;
115 0 my $out = $1;
116  
117 0 ▶ last if $max == $out; # breaks if we have already reached target
Branch: 1 branch
BranchTrueFalseTotal
if $max == $out 0 0 0
118  
119 0 $self->write("RAMP MID\n");
120 0 print "power supply not responding, send command again\n";
121 0 sleep(1);
122 }
123  
124 0 ▶ while ( $status =~ /RAMPING/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /RAMPING/u) 0 0 0
125 0 $status = $self->status();
126 0 sleep(1);
127 }
128  
129 0 $status =~ /MAX SETTING: (.*) AMPS/;
130 0 my $max = $1;
131 0 $status =~ /OUTPUT: (.*) AMPS/;
132 0 my $out = $1;
133  
134 0 ▶ return 0 if $max == $out;
Branch: 1 branch
BranchTrueFalseTotal
if $max == $out 0 0 0
135 0 return 1;
136 }
137  
138 sub heater_on {
139 0 ▶ my $self = shift;
Subroutine heater_on: not called CC=2 SCAR=17.9
Pod undocumented
140 0 $self->write("HEATER ON\n");
141  
142 0 my $status = $self->status();
143 0 ▶ while ( $status =~ /HEATER STATUS: OFF/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /HEATER STATUS: OFF/u) 0 0 0
144 { # takes care that command is finally executed
145 0 sleep(1);
146 0 $self->write("HEATER ON\n");
147 0 print "power supply not responding, send command again\n";
148 0 sleep(1);
149 0 $status = $self->status();
150 }
151 0 sleep(10);
152 0 return 0;
153 }
154  
155 sub heater_off {
156 0 ▶ my $self = shift;
Subroutine heater_off: not called CC=2 SCAR=17.9
Pod undocumented
157 0 $self->write("HEATER OFF\n");
158  
159 0 my $status = $self->status();
160 0 ▶ while ( $status =~ /HEATER STATUS: ON/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ /HEATER STATUS: ON/u) 0 0 0
161 { # takes care that command is finally executed
162 0 sleep(1);
163 0 print "power supply not responding, send command again\n";
164 0 $self->write("HEATER OFF\n");
165 0 sleep(1);
166 0 $status = $self->status();
167 }
168 0 sleep(10);
169 0 return 0;
170 }
171  
172 sub status {
173 0 ▶ my $self = shift;
Subroutine status: not called CC=2 SCAR=17.9
Pod undocumented
174 0 my $result = $self->query( command => "U\n", read_length => 1000 );
175 0 ▶ for ( my $i = 1; $i <= 20; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= 20) 0 0 0
176 0 $result .= $self->query( command => "U\n", read_length => 1000 );
177  
178 }
179 0 return $result;
180 }
181  
182 sub read_messages {
183 0 ▶ my $self = shift;
Subroutine read_messages: not called CC=1 SCAR=6.9
Pod undocumented
184 0 my $result = $self->read( read_length => 1000 );
185 }
186  
187 1 1;
188  
189 __END__
190  
191 =pod
192  
193 =encoding UTF-8
194  
195 =head1 NAME
196  
197 Lab::Instrument::Cryogenic_SMS - Cryogenic SMS magnet power supply
198  
199 =head1 VERSION
200  
201 version 3.881
202  
203 =head1 COPYRIGHT AND LICENSE
204  
205 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
206  
207 Copyright 2013 Andreas K. Huettel
208 2016 Simon Reinhardt
209 2017 Andreas K. Huettel
210 2020 Andreas K. Huettel
211  
212  
213 This is free software; you can redistribute it and/or modify it under
214 the same terms as the Perl 5 programming language system itself.
215  
216 =cut
« Moose/Connection/Zhinst.pm ↑ Summary Data/Analysis/TekTDS.pm »