| 1 | package Lab::Moose::Instrument::OI_Mercury::Magnet; | ||||||||||||||||||||
| 2 | 2 | $Lab::Moose::Instrument::OI_Mercury::Magnet::VERSION = '3.881'; | |||||||||||||||||||
| 3 | #ABSTRACT: Oxford Instruments Mercury magnet power supply | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 2 | ▶ | use v5.20; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | ▶ | use Moose::Util::TypeConstraints qw/enum/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 2 | ▶ | use MooseX::Params::Validate 'validated_hash'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 2 | use Lab::Moose::Instrument qw/ | |||||||||||||||||||
| 11 | 2 | ▶ | validated_getter validated_setter setter_params /; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 2 | ▶ | use Lab::Moose::Instrument::Cache; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 2 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 2 | ▶ | use YAML::XS; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 2 | ▶ | use Lab::Moose::Countdown; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 2 | extends 'Lab::Moose::Instrument'; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 2 | has verbose => ( | |||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||
| 22 | isa => 'Bool', | ||||||||||||||||||||
| 23 | default => 1 | ||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 2 | has magnet => ( | |||||||||||||||||||
| 27 | is => 'ro', | ||||||||||||||||||||
| 28 | isa => enum( [qw/X Y Z/] ), | ||||||||||||||||||||
| 29 | default => 'Z' | ||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 2 | has heater_delay => ( | |||||||||||||||||||
| 33 | is => 'ro', | ||||||||||||||||||||
| 34 | isa => 'Lab::Moose::PosInt', | ||||||||||||||||||||
| 35 | default => 60 | ||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 2 | has ATOB => ( | |||||||||||||||||||
| 39 | is => 'ro', | ||||||||||||||||||||
| 40 | isa => 'Lab::Moose::PosNum', | ||||||||||||||||||||
| 41 | builder => '_build_ATOB', | ||||||||||||||||||||
| 42 | lazy => 1, | ||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | sub _build_ATOB { | ||||||||||||||||||||
| 46 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
_build_ATOB: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 47 | 1 | my $magnet = $self->magnet(); | |||||||||||||||||||
| 48 | 1 | return $self->oi_getter( cmd => "READ:DEV:GRP${magnet}:PSU:ATOB" ); | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | # default connection options: | ||||||||||||||||||||
| 52 | around default_connection_options => sub { | ||||||||||||||||||||
| 53 | 1 | ▶ | my $orig = shift; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | 1 | my $self = shift; | |||||||||||||||||||
| 55 | 1 | my $options = $self->$orig(); | |||||||||||||||||||
| 56 | 1 | $options->{Socket}{port} = 7020; | |||||||||||||||||||
| 57 | 1 | $options->{Socket}{timeout} = 10; | |||||||||||||||||||
| 58 | 1 | return $options; | |||||||||||||||||||
| 59 | 2 | }; | |||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 2 | with 'Lab::Moose::Instrument::OI_Common'; | |||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | sub get_catalogue { | ||||||||||||||||||||
| 65 | 1 | ▶ | my ( $self, %args ) = validated_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
get_catalogue: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 66 | 1 | return $self->oi_getter( cmd => "READ:SYS:CAT", %args ); | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | sub get_temperature { | ||||||||||||||||||||
| 71 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
get_temperature: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 72 | \@_, | ||||||||||||||||||||
| 73 | channel => { isa => 'Str', default => 'MB1.T1' } | ||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | 0 | return $self->get_temperature_channel(%args); | |||||||||||||||||||
| 77 | } | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | sub get_he_level { | ||||||||||||||||||||
| 81 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
get_he_level: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 82 | \@_, | ||||||||||||||||||||
| 83 | channel => { isa => 'Str', default => 'DB5.L1' } | ||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||
| 85 | 0 | my $channel = delete $args{channel}; | |||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 0 | my $rv | |||||||||||||||||||
| 88 | = $self->oi_getter( cmd => "READ:DEV:$channel:LVL:SIG:HEL", %args ); | ||||||||||||||||||||
| 89 | 0 | $rv =~ s/^LEV://; | |||||||||||||||||||
| 90 | 0 | $rv =~ s/%.*$//; | |||||||||||||||||||
| 91 | 0 | return $rv; | |||||||||||||||||||
| 92 | } | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | sub get_he_level_resistance { | ||||||||||||||||||||
| 96 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
get_he_level_resistance: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 97 | \@_, | ||||||||||||||||||||
| 98 | channel => { isa => 'Str', default => 'DB5.L1' } | ||||||||||||||||||||
| 99 | ); | ||||||||||||||||||||
| 100 | 0 | my $channel = delete $args{channel}; | |||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | 0 | my $res | |||||||||||||||||||
| 103 | = $self->oi_getter( cmd => "READ:DEV:$channel:LVL:SIG:HEL", %args ); | ||||||||||||||||||||
| 104 | 0 | $res =~ s/^.*:RES://; | |||||||||||||||||||
| 105 | 0 | $res =~ s/O$//; | |||||||||||||||||||
| 106 | 0 | return $res; | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | sub get_n2_level { | ||||||||||||||||||||
| 111 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
get_n2_level: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 112 | \@_, | ||||||||||||||||||||
| 113 | channel => { isa => 'Str', default => 'DB5.L1' } | ||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||
| 115 | 0 | my $channel = delete $args{channel}; | |||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 0 | my $level | |||||||||||||||||||
| 118 | = $self->oi_getter( cmd => "READ:DEV:$channel:LVL:SIG:NIT", %args ); | ||||||||||||||||||||
| 119 | 0 | $level =~ s/^.*:LEV://; | |||||||||||||||||||
| 120 | 0 | $level =~ s/%.*$//; | |||||||||||||||||||
| 121 | 0 | return $level; | |||||||||||||||||||
| 122 | } | ||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | sub get_n2_level_frequency { | ||||||||||||||||||||
| 126 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
get_n2_level_frequency: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 127 | \@_, | ||||||||||||||||||||
| 128 | channel => { isa => 'Str', default => 'DB5.L1' } | ||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||
| 130 | 0 | my $channel = delete $args{channel}; | |||||||||||||||||||
| 131 | 0 | my $level | |||||||||||||||||||
| 132 | = $self->oi_getter( cmd => "READ:DEV:$channel:LVL:SIG:NIT", %args ); | ||||||||||||||||||||
| 133 | 0 | $level =~ s/^.*:FREQ://; | |||||||||||||||||||
| 134 | 0 | $level =~ s/:.*$//; | |||||||||||||||||||
| 135 | 0 | return $level; | |||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | sub get_n2_level_counter { | ||||||||||||||||||||
| 139 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
get_n2_level_counter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 140 | \@_, | ||||||||||||||||||||
| 141 | channel => { isa => 'Str', default => 'DB5.L1' } | ||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||
| 143 | 0 | my $channel = delete $args{channel}; | |||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | 0 | my $level | |||||||||||||||||||
| 146 | = $self->oi_getter( cmd => "READ:DEV:$channel:LVL:SIG:NIT", %args ); | ||||||||||||||||||||
| 147 | 0 | $level =~ s/^COUN://; | |||||||||||||||||||
| 148 | 0 | $level =~ s/n:.*$//; | |||||||||||||||||||
| 149 | 0 | return $level; | |||||||||||||||||||
| 150 | } | ||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | # | ||||||||||||||||||||
| 153 | # now follow the core magnet functions | ||||||||||||||||||||
| 154 | # | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | sub validated_magnet_getter { | ||||||||||||||||||||
| 157 | 9 | ▶ | my $args_ref = shift; | ||||||||||||||||||
|
Subroutine
validated_magnet_getter: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 158 | 9 | my %extra_args = @_; | |||||||||||||||||||
| 159 | 9 | my ( $self, %args ) = validated_getter( | |||||||||||||||||||
| 160 | $args_ref, | ||||||||||||||||||||
| 161 | channel => { isa => enum( [qw/X Y Z/] ), optional => 1 }, | ||||||||||||||||||||
| 162 | %extra_args, | ||||||||||||||||||||
| 163 | ); | ||||||||||||||||||||
| 164 | 9 | ▶ | my $channel = delete $args{channel} // $self->magnet(); | ||||||||||||||||||
|
Condition33%1/3
delete $args{"channel"} // $self->magnet
MC/DC0%0/2
delete $args{"channel"} // $self->magnet
delete $args{"channel"}
$self->magnet
Truth table33%1/3
A // B
A= delete $args{"channel"}B= $self->magnet
| |||||||||||||||||||||
| 165 | 9 | $channel = "GRP$channel"; | |||||||||||||||||||
| 166 | 9 | return ( $self, $channel, %args ); | |||||||||||||||||||
| 167 | } | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | sub validated_magnet_setter { | ||||||||||||||||||||
| 170 | 6 | ▶ | my $args_ref = shift; | ||||||||||||||||||
|
Subroutine
validated_magnet_setter: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 171 | 6 | my %extra_args = @_; | |||||||||||||||||||
| 172 | 6 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||
| 173 | $args_ref, | ||||||||||||||||||||
| 174 | channel => { isa => enum( [qw/X Y Z/] ), optional => 1 }, | ||||||||||||||||||||
| 175 | %extra_args, | ||||||||||||||||||||
| 176 | ); | ||||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | 6 | ▶ | my $channel = delete $args{channel} // $self->magnet(); | ||||||||||||||||||
|
Condition33%1/3
delete $args{"channel"} // $self->magnet
MC/DC0%0/2
delete $args{"channel"} // $self->magnet
delete $args{"channel"}
$self->magnet
Truth table33%1/3
A // B
A= delete $args{"channel"}B= $self->magnet
| |||||||||||||||||||||
| 179 | 6 | $channel = "GRP$channel"; | |||||||||||||||||||
| 180 | 6 | return ( $self, $value, $channel, %args ); | |||||||||||||||||||
| 181 | } | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | |||||||||||||||||||||
| 184 | sub oim_get_current { | ||||||||||||||||||||
| 185 | 2 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_current: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | 2 | my $current | |||||||||||||||||||
| 188 | = $self->oi_getter( cmd => "READ:DEV:$channel:PSU:SIG:CURR", %args ); | ||||||||||||||||||||
| 189 | 2 | $current =~ s/A$//; | |||||||||||||||||||
| 190 | 2 | return $current; | |||||||||||||||||||
| 191 | } | ||||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | sub oim_get_persistent_current { | ||||||||||||||||||||
| 195 | 0 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_persistent_current: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 0 | my $current | |||||||||||||||||||
| 198 | = $self->oi_getter( cmd => "READ:DEV:$channel:PSU:SIG:PCUR", %args ); | ||||||||||||||||||||
| 199 | 0 | $current =~ s/A$//; | |||||||||||||||||||
| 200 | 0 | return $current; | |||||||||||||||||||
| 201 | } | ||||||||||||||||||||
| 202 | |||||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | sub oim_get_field { | ||||||||||||||||||||
| 205 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
oim_get_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 206 | 1 | my $current = $self->oim_get_current(@_); | |||||||||||||||||||
| 207 | 1 | my $rv = $current / $self->ATOB(); | |||||||||||||||||||
| 208 | 1 | return sprintf( "%.6f", $rv ); | |||||||||||||||||||
| 209 | } | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | |||||||||||||||||||||
| 212 | sub oim_get_persistent_field { | ||||||||||||||||||||
| 213 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
oim_get_persistent_field: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 214 | 0 | my $current = $self->oim_get_persistent_current(@_); | |||||||||||||||||||
| 215 | |||||||||||||||||||||
| 216 | 0 | my $rv = $current / $self->ATOB(); | |||||||||||||||||||
| 217 | 0 | return sprintf( "%.6f", $rv ); | |||||||||||||||||||
| 218 | } | ||||||||||||||||||||
| 219 | |||||||||||||||||||||
| 220 | |||||||||||||||||||||
| 221 | sub oim_get_heater { | ||||||||||||||||||||
| 222 | 1 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_heater: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 223 | 1 | return $self->oi_getter( cmd => "READ:DEV:$channel:PSU:SIG:SWHT", %args ); | |||||||||||||||||||
| 224 | } | ||||||||||||||||||||
| 225 | |||||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | sub oim_set_heater { | ||||||||||||||||||||
| 228 | 1 | ▶ | my ( $self, $value, $channel, %args ) = validated_magnet_setter( | ||||||||||||||||||
|
Subroutine
oim_set_heater: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 229 | \@_, | ||||||||||||||||||||
| 230 | value => { isa => enum( [qw/ON OFF/] ) }, | ||||||||||||||||||||
| 231 | ); | ||||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | 1 | return $self->oi_setter( | |||||||||||||||||||
| 234 | cmd => "SET:DEV:$channel:PSU:SIG:SWHT", | ||||||||||||||||||||
| 235 | value => $value, | ||||||||||||||||||||
| 236 | %args | ||||||||||||||||||||
| 237 | ); | ||||||||||||||||||||
| 238 | } | ||||||||||||||||||||
| 239 | |||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | sub heater_on { | ||||||||||||||||||||
| 242 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
heater_on: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 243 | 0 | $self->oim_set_heater( value => 'ON' ); | |||||||||||||||||||
| 244 | 0 | countdown( $self->heater_delay, "OI Mercury heater ON: " ); | |||||||||||||||||||
| 245 | } | ||||||||||||||||||||
| 246 | |||||||||||||||||||||
| 247 | sub heater_off { | ||||||||||||||||||||
| 248 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
heater_off: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 249 | 0 | $self->oim_set_heater( value => 'OFF' ); | |||||||||||||||||||
| 250 | 0 | countdown( $self->heater_delay(), "OI Mercury heater OFF: " ); | |||||||||||||||||||
| 251 | } | ||||||||||||||||||||
| 252 | |||||||||||||||||||||
| 253 | |||||||||||||||||||||
| 254 | sub in_persistent_mode { | ||||||||||||||||||||
| 255 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
in_persistent_mode: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 256 | 0 | my $rv = $self->oim_get_heater(@_); | |||||||||||||||||||
| 257 | 0 | ▶ | if ( $rv eq 'ON' ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 258 | 0 | return; | |||||||||||||||||||
| 259 | } | ||||||||||||||||||||
| 260 | elsif ( $rv eq 'OFF' ) { | ||||||||||||||||||||
| 261 | 0 | return 1; | |||||||||||||||||||
| 262 | } | ||||||||||||||||||||
| 263 | else { | ||||||||||||||||||||
| 264 | 0 | croak("unknown heater setting $rv"); | |||||||||||||||||||
| 265 | } | ||||||||||||||||||||
| 266 | } | ||||||||||||||||||||
| 267 | |||||||||||||||||||||
| 268 | |||||||||||||||||||||
| 269 | sub oim_force_heater { | ||||||||||||||||||||
| 270 | 0 | ▶ | my ( $self, $value, $channel, %args ) = validated_magnet_setter( | ||||||||||||||||||
|
Subroutine
oim_force_heater: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 271 | \@_, | ||||||||||||||||||||
| 272 | value => { isa => enum( [qw/ON OFF/] ) }, | ||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||
| 274 | |||||||||||||||||||||
| 275 | 0 | return $self->oi_setter( | |||||||||||||||||||
| 276 | cmd => "SET:DEV:$channel:PSU:SIG:SWHN", | ||||||||||||||||||||
| 277 | value => $value, %args | ||||||||||||||||||||
| 278 | ); | ||||||||||||||||||||
| 279 | } | ||||||||||||||||||||
| 280 | |||||||||||||||||||||
| 281 | |||||||||||||||||||||
| 282 | sub oim_get_current_sweeprate { | ||||||||||||||||||||
| 283 | 2 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_current_sweeprate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 284 | |||||||||||||||||||||
| 285 | 2 | my $sweeprate | |||||||||||||||||||
| 286 | = $self->oi_getter( cmd => "READ:DEV:$channel:PSU:SIG:RCST", %args ); | ||||||||||||||||||||
| 287 | 2 | $sweeprate =~ s/A\/m$//; | |||||||||||||||||||
| 288 | 2 | return $sweeprate; | |||||||||||||||||||
| 289 | } | ||||||||||||||||||||
| 290 | |||||||||||||||||||||
| 291 | |||||||||||||||||||||
| 292 | sub oim_set_current_sweeprate { | ||||||||||||||||||||
| 293 | 2 | ▶ | my ( $self, $value, $channel, %args ) = validated_magnet_setter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_set_current_sweeprate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 294 | |||||||||||||||||||||
| 295 | 2 | $value = sprintf( "%.3f", $value ); | |||||||||||||||||||
| 296 | |||||||||||||||||||||
| 297 | 2 | my $rv = $self->oi_setter( | |||||||||||||||||||
| 298 | cmd => "SET:DEV:$channel:PSU:SIG:RCST", | ||||||||||||||||||||
| 299 | value => $value, %args | ||||||||||||||||||||
| 300 | ); | ||||||||||||||||||||
| 301 | |||||||||||||||||||||
| 302 | # this returns amps per minute | ||||||||||||||||||||
| 303 | 2 | $rv =~ s/A\/m$//; | |||||||||||||||||||
| 304 | 2 | return $rv; | |||||||||||||||||||
| 305 | } | ||||||||||||||||||||
| 306 | |||||||||||||||||||||
| 307 | |||||||||||||||||||||
| 308 | sub oim_get_field_sweeprate { | ||||||||||||||||||||
| 309 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
oim_get_field_sweeprate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 310 | 1 | my $current_sweeprate = $self->oim_get_current_sweeprate(@_); | |||||||||||||||||||
| 311 | 1 | my $rv = $current_sweeprate / $self->ATOB(); | |||||||||||||||||||
| 312 | 1 | return sprintf( "%.6f", $rv ); | |||||||||||||||||||
| 313 | } | ||||||||||||||||||||
| 314 | |||||||||||||||||||||
| 315 | |||||||||||||||||||||
| 316 | sub oim_set_field_sweeprate { | ||||||||||||||||||||
| 317 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
oim_set_field_sweeprate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 318 | 1 | my %args = @_; | |||||||||||||||||||
| 319 | 1 | my $value = delete $args{value}; | |||||||||||||||||||
| 320 | 1 | $value = $value * $self->ATOB(); | |||||||||||||||||||
| 321 | 1 | my $rv = $self->oim_set_current_sweeprate( value => $value, %args ); | |||||||||||||||||||
| 322 | 1 | return $rv / $self->ATOB(); | |||||||||||||||||||
| 323 | } | ||||||||||||||||||||
| 324 | |||||||||||||||||||||
| 325 | |||||||||||||||||||||
| 326 | sub oim_get_activity { | ||||||||||||||||||||
| 327 | 1 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_activity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 328 | 1 | return $self->oi_getter( cmd => "READ:DEV:$channel:PSU:ACTN", %args ); | |||||||||||||||||||
| 329 | } | ||||||||||||||||||||
| 330 | |||||||||||||||||||||
| 331 | |||||||||||||||||||||
| 332 | sub oim_set_activity { | ||||||||||||||||||||
| 333 | 1 | ▶ | my ( $self, $value, $channel, %args ) = validated_magnet_setter( | ||||||||||||||||||
|
Subroutine
oim_set_activity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 334 | \@_, | ||||||||||||||||||||
| 335 | value => { isa => enum( [qw/HOLD RTOS RTOZ CLMP/] ) }, | ||||||||||||||||||||
| 336 | ); | ||||||||||||||||||||
| 337 | 1 | return $self->oi_setter( | |||||||||||||||||||
| 338 | cmd => "SET:DEV:$channel:PSU:ACTN", | ||||||||||||||||||||
| 339 | value => $value, %args | ||||||||||||||||||||
| 340 | ); | ||||||||||||||||||||
| 341 | } | ||||||||||||||||||||
| 342 | |||||||||||||||||||||
| 343 | |||||||||||||||||||||
| 344 | sub oim_set_current_setpoint { | ||||||||||||||||||||
| 345 | 2 | ▶ | my ( $self, $value, $channel, %args ) = validated_magnet_setter( | ||||||||||||||||||
|
Subroutine
oim_set_current_setpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 346 | \@_, | ||||||||||||||||||||
| 347 | value => { isa => 'Num' }, | ||||||||||||||||||||
| 348 | ); | ||||||||||||||||||||
| 349 | |||||||||||||||||||||
| 350 | 2 | $value = sprintf( "%.4f", $value ); | |||||||||||||||||||
| 351 | |||||||||||||||||||||
| 352 | 2 | my $rv = $self->oi_setter( | |||||||||||||||||||
| 353 | cmd => "SET:DEV:$channel:PSU:SIG:CSET", | ||||||||||||||||||||
| 354 | value => $value, %args | ||||||||||||||||||||
| 355 | ); | ||||||||||||||||||||
| 356 | 2 | $rv =~ s/A$//; | |||||||||||||||||||
| 357 | 2 | return $rv; | |||||||||||||||||||
| 358 | } | ||||||||||||||||||||
| 359 | |||||||||||||||||||||
| 360 | |||||||||||||||||||||
| 361 | sub oim_get_current_setpoint { | ||||||||||||||||||||
| 362 | 2 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_current_setpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 363 | |||||||||||||||||||||
| 364 | 2 | my $result | |||||||||||||||||||
| 365 | = $self->oi_getter( cmd => "READ:DEV:$channel:PSU:SIG:CSET", %args ); | ||||||||||||||||||||
| 366 | 2 | $result =~ s/A$//; | |||||||||||||||||||
| 367 | 2 | return $result; | |||||||||||||||||||
| 368 | } | ||||||||||||||||||||
| 369 | |||||||||||||||||||||
| 370 | |||||||||||||||||||||
| 371 | sub oim_set_field_setpoint { | ||||||||||||||||||||
| 372 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
oim_set_field_setpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 373 | 1 | my %args = @_; | |||||||||||||||||||
| 374 | 1 | my $value = delete $args{value}; | |||||||||||||||||||
| 375 | |||||||||||||||||||||
| 376 | 1 | $value = $value * $self->ATOB(); | |||||||||||||||||||
| 377 | |||||||||||||||||||||
| 378 | 1 | my $rv = $self->oim_set_current_setpoint( value => $value, %args ); | |||||||||||||||||||
| 379 | |||||||||||||||||||||
| 380 | 1 | $rv = $rv / $self->ATOB(); | |||||||||||||||||||
| 381 | 1 | return sprintf( "%.6f", $rv ); | |||||||||||||||||||
| 382 | } | ||||||||||||||||||||
| 383 | |||||||||||||||||||||
| 384 | |||||||||||||||||||||
| 385 | sub oim_get_field_setpoint { | ||||||||||||||||||||
| 386 | 1 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
oim_get_field_setpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 387 | |||||||||||||||||||||
| 388 | 1 | my $rv = $self->oim_get_current_setpoint(@_); | |||||||||||||||||||
| 389 | |||||||||||||||||||||
| 390 | 1 | return $rv / $self->ATOB(); | |||||||||||||||||||
| 391 | } | ||||||||||||||||||||
| 392 | |||||||||||||||||||||
| 393 | |||||||||||||||||||||
| 394 | sub oim_get_fieldconstant { | ||||||||||||||||||||
| 395 | 1 | ▶ | my ( $self, $channel, %args ) = validated_magnet_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
oim_get_fieldconstant: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 396 | 1 | return $self->oi_getter( cmd => "READ:DEV:$channel:PSU:ATOB", %args ); | |||||||||||||||||||
| 397 | } | ||||||||||||||||||||
| 398 | |||||||||||||||||||||
| 399 | |||||||||||||||||||||
| 400 | sub field_step { | ||||||||||||||||||||
| 401 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
field_step: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 402 | 0 | return 1e-4 / $self->oim_get_fieldconstant(@_); | |||||||||||||||||||
| 403 | } | ||||||||||||||||||||
| 404 | |||||||||||||||||||||
| 405 | ############### XPRESS interface ##################### | ||||||||||||||||||||
| 406 | |||||||||||||||||||||
| 407 | 2 | has device_settings => | |||||||||||||||||||
| 408 | ( is => 'ro', isa => 'HashRef', builder => 'build_device_settings' ); | ||||||||||||||||||||
| 409 | |||||||||||||||||||||
| 410 | 2 | has max_field_deviation => ( is => 'ro', isa => 'Num', default => 0.0001 ); | |||||||||||||||||||
| 411 | |||||||||||||||||||||
| 412 | sub build_device_settings { | ||||||||||||||||||||
| 413 | return { | ||||||||||||||||||||
| 414 | 1 | ▶ | has_switchheater => 0, # for now | ||||||||||||||||||
|
Subroutine
build_device_settings: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 415 | }; | ||||||||||||||||||||
| 416 | } | ||||||||||||||||||||
| 417 | |||||||||||||||||||||
| 418 | sub get_field { | ||||||||||||||||||||
| 419 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
get_field: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 420 | 0 | return $self->oim_get_field(@_); | |||||||||||||||||||
| 421 | } | ||||||||||||||||||||
| 422 | |||||||||||||||||||||
| 423 | sub get_persistent_field { | ||||||||||||||||||||
| 424 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
get_persistent_field: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 425 | 0 | return $self->oim_get_persistent_field(@_); | |||||||||||||||||||
| 426 | } | ||||||||||||||||||||
| 427 | |||||||||||||||||||||
| 428 | sub sweep_to_field { | ||||||||||||||||||||
| 429 | 0 | ▶ | my ( $self, %args ) = validated_getter( | ||||||||||||||||||
|
Subroutine
sweep_to_field: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 430 | \@_, | ||||||||||||||||||||
| 431 | target => { isa => 'Num' }, | ||||||||||||||||||||
| 432 | rate => { isa => 'Num' }, | ||||||||||||||||||||
| 433 | ); | ||||||||||||||||||||
| 434 | |||||||||||||||||||||
| 435 | 0 | my $point = delete $args{target}; | |||||||||||||||||||
| 436 | 0 | my $rate = delete $args{rate}; | |||||||||||||||||||
| 437 | |||||||||||||||||||||
| 438 | 0 | $self->config_sweep( point => $point, rate => $rate, %args ); | |||||||||||||||||||
| 439 | |||||||||||||||||||||
| 440 | 0 | $self->trg(%args); | |||||||||||||||||||
| 441 | |||||||||||||||||||||
| 442 | 0 | $self->wait(%args); | |||||||||||||||||||
| 443 | |||||||||||||||||||||
| 444 | 0 | return $self->oim_get_field(%args); | |||||||||||||||||||
| 445 | } | ||||||||||||||||||||
| 446 | |||||||||||||||||||||
| 447 | sub config_sweep { | ||||||||||||||||||||
| 448 | 0 | ▶ | my ( $self, %args ) = validated_hash( | ||||||||||||||||||
|
Subroutine
config_sweep: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 449 | \@_, | ||||||||||||||||||||
| 450 | point => { isa => 'Num' }, | ||||||||||||||||||||
| 451 | rate => { isa => 'Num' }, | ||||||||||||||||||||
| 452 | ); | ||||||||||||||||||||
| 453 | 0 | my $target = delete $args{point}; | |||||||||||||||||||
| 454 | 0 | my $rate = delete $args{rate}; | |||||||||||||||||||
| 455 | |||||||||||||||||||||
| 456 | 0 | my $setrate = $self->oim_set_field_sweeprate( value => $rate, %args ); | |||||||||||||||||||
| 457 | 0 | my $setpoint = $self->oim_set_field_setpoint( value => $target, %args ); | |||||||||||||||||||
| 458 | 0 | ▶ | if ( $self->verbose() ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 459 | 0 | say "config_sweep: setpoint: $setpoint (T), rate: $setrate (T/min)"; | |||||||||||||||||||
| 460 | } | ||||||||||||||||||||
| 461 | } | ||||||||||||||||||||
| 462 | |||||||||||||||||||||
| 463 | # In go_to_next_step, the XPRESS will call the sequence | ||||||||||||||||||||
| 464 | # config_sweep(...); | ||||||||||||||||||||
| 465 | # trg(); | ||||||||||||||||||||
| 466 | # wait(); | ||||||||||||||||||||
| 467 | |||||||||||||||||||||
| 468 | sub trg { | ||||||||||||||||||||
| 469 | 0 | ▶ | my ( $self, %args ) = validated_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
trg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 470 | 0 | $self->oim_set_activity( value => 'RTOS', %args ); | |||||||||||||||||||
| 471 | } | ||||||||||||||||||||
| 472 | |||||||||||||||||||||
| 473 | sub wait { | ||||||||||||||||||||
| 474 | 0 | ▶ | my ( $self, %args ) = validated_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
wait: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 475 | 0 | my $target = $self->oim_get_field_setpoint(%args); | |||||||||||||||||||
| 476 | 0 | my $verbose = $self->verbose(); | |||||||||||||||||||
| 477 | |||||||||||||||||||||
| 478 | # enable autoflush | ||||||||||||||||||||
| 479 | 0 | my $autoflush = STDOUT->autoflush(); | |||||||||||||||||||
| 480 | 0 | my $last_field; | |||||||||||||||||||
| 481 | 0 | my $time_step = 1; | |||||||||||||||||||
| 482 | 0 | while (1) { | |||||||||||||||||||
| 483 | 0 | sleep $time_step; | |||||||||||||||||||
| 484 | 0 | my $field = $self->oim_get_field(%args); | |||||||||||||||||||
| 485 | |||||||||||||||||||||
| 486 | 0 | ▶ | if ($verbose) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 487 | 0 | my $rate; | |||||||||||||||||||
| 488 | 0 | ▶ | if ( defined $last_field ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 489 | 0 | $rate = ( $field - $last_field ) * 60 / $time_step; | |||||||||||||||||||
| 490 | 0 | $rate = sprintf( "%.5g", $rate ); | |||||||||||||||||||
| 491 | } | ||||||||||||||||||||
| 492 | else { | ||||||||||||||||||||
| 493 | 0 | $rate = "unknown"; | |||||||||||||||||||
| 494 | } | ||||||||||||||||||||
| 495 | 0 | printf( | |||||||||||||||||||
| 496 | "Field: %.6e T, Estimated rate: $rate T/min \r", | ||||||||||||||||||||
| 497 | $field | ||||||||||||||||||||
| 498 | ); | ||||||||||||||||||||
| 499 | 0 | $last_field = $field; | |||||||||||||||||||
| 500 | } | ||||||||||||||||||||
| 501 | |||||||||||||||||||||
| 502 | 0 | ▶ | if ( abs( $field - $target ) < $self->max_field_deviation() ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 503 | 0 | last; | |||||||||||||||||||
| 504 | } | ||||||||||||||||||||
| 505 | } | ||||||||||||||||||||
| 506 | |||||||||||||||||||||
| 507 | 0 | ▶ | if ($verbose) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 508 | 0 | print " " x 70 . "\r"; | |||||||||||||||||||
| 509 | } | ||||||||||||||||||||
| 510 | |||||||||||||||||||||
| 511 | # reset autoflush to previous value | ||||||||||||||||||||
| 512 | 0 | STDOUT->autoflush($autoflush); | |||||||||||||||||||
| 513 | |||||||||||||||||||||
| 514 | } | ||||||||||||||||||||
| 515 | |||||||||||||||||||||
| 516 | sub active { | ||||||||||||||||||||
| 517 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
active: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 518 | |||||||||||||||||||||
| 519 | # with the legacy command set, one could use the "X" command to find | ||||||||||||||||||||
| 520 | # whether the magnet has finshed the sweep | ||||||||||||||||||||
| 521 | # We do it manually by comparing field and setpoint. | ||||||||||||||||||||
| 522 | 0 | my $field = $self->oim_get_field(); | |||||||||||||||||||
| 523 | 0 | my $target = $self->oim_get_field_setpoint(); | |||||||||||||||||||
| 524 | 0 | ▶ | if ( abs( $field - $target ) < $self->max_field_deviation() ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 525 | 0 | return 0; | |||||||||||||||||||
| 526 | } | ||||||||||||||||||||
| 527 | else { | ||||||||||||||||||||
| 528 | 0 | return 1; | |||||||||||||||||||
| 529 | } | ||||||||||||||||||||
| 530 | } | ||||||||||||||||||||
| 531 | |||||||||||||||||||||
| 532 | sub exit { | ||||||||||||||||||||
| 533 | 0 | ▶ | my ( $self, %args ) = validated_getter( \@_ ); | ||||||||||||||||||
|
Subroutine
exit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 534 | 0 | $self->oim_set_activity( value => 'HOLD', %args ); | |||||||||||||||||||
| 535 | } | ||||||||||||||||||||
| 536 | |||||||||||||||||||||
| 537 | 2 | __PACKAGE__->meta()->make_immutable(); | |||||||||||||||||||
| 538 | |||||||||||||||||||||
| 539 | 2 | 1; | |||||||||||||||||||
| 540 | |||||||||||||||||||||
| 541 | __END__ | ||||||||||||||||||||
| 542 | |||||||||||||||||||||
| 543 | =pod | ||||||||||||||||||||
| 544 | |||||||||||||||||||||
| 545 | =encoding UTF-8 | ||||||||||||||||||||
| 546 | |||||||||||||||||||||
| 547 | =head1 NAME | ||||||||||||||||||||
| 548 | |||||||||||||||||||||
| 549 | Lab::Moose::Instrument::OI_Mercury::Magnet - Oxford Instruments Mercury magnet power supply | ||||||||||||||||||||
| 550 | |||||||||||||||||||||
| 551 | =head1 VERSION | ||||||||||||||||||||
| 552 | |||||||||||||||||||||
| 553 | version 3.881 | ||||||||||||||||||||
| 554 | |||||||||||||||||||||
| 555 | =head1 SYNOPSIS | ||||||||||||||||||||
| 556 | |||||||||||||||||||||
| 557 | use Lab::Moose; | ||||||||||||||||||||
| 558 | |||||||||||||||||||||
| 559 | my $magnet = instrument( | ||||||||||||||||||||
| 560 | type => 'OI_Mercury::Magnet', | ||||||||||||||||||||
| 561 | connection_type => 'Socket', | ||||||||||||||||||||
| 562 | connection_options => {host => '192.168.3.15'}, | ||||||||||||||||||||
| 563 | magnet => 'X', # 'X', 'Y' or 'Z'. default is 'Z' | ||||||||||||||||||||
| 564 | ); | ||||||||||||||||||||
| 565 | |||||||||||||||||||||
| 566 | say "He level (%): ", $magnet->get_he_level(); | ||||||||||||||||||||
| 567 | say "N2 level (%): ", $magnet->get_n2_level(); | ||||||||||||||||||||
| 568 | say "temperature: ", $magnet->get_temperature(); | ||||||||||||||||||||
| 569 | |||||||||||||||||||||
| 570 | $magnet->oim_set_heater(value => 'ON'); | ||||||||||||||||||||
| 571 | |||||||||||||||||||||
| 572 | say "Current field (T): ", $magnet->get_field(); | ||||||||||||||||||||
| 573 | |||||||||||||||||||||
| 574 | # Sweep to 0.1 T with rate of 1 T/min | ||||||||||||||||||||
| 575 | $magnet->sweep_to_field(target => 0.1, rate => 1); | ||||||||||||||||||||
| 576 | |||||||||||||||||||||
| 577 | See also an L<example|https://github.com/lab-measurement/Lab-Measurement/blob/master/examples/RealWorld/level-plot.pl> of a He/N2 level plotter. | ||||||||||||||||||||
| 578 | |||||||||||||||||||||
| 579 | =head1 METHODS | ||||||||||||||||||||
| 580 | |||||||||||||||||||||
| 581 | The default names for the used board names are as follows. You can | ||||||||||||||||||||
| 582 | get the values for your instrument with the C<get_catalogue> method | ||||||||||||||||||||
| 583 | and use the methods with the C<channel> argument. | ||||||||||||||||||||
| 584 | |||||||||||||||||||||
| 585 | =over | ||||||||||||||||||||
| 586 | |||||||||||||||||||||
| 587 | =item * | ||||||||||||||||||||
| 588 | |||||||||||||||||||||
| 589 | Temperature measurement: B<MB1.T1>. | ||||||||||||||||||||
| 590 | |||||||||||||||||||||
| 591 | =item * | ||||||||||||||||||||
| 592 | |||||||||||||||||||||
| 593 | Level meter: B<DB5.L1> | ||||||||||||||||||||
| 594 | |||||||||||||||||||||
| 595 | =item * | ||||||||||||||||||||
| 596 | |||||||||||||||||||||
| 597 | Magnet: B<Z> (use DEV:GRPZ:PSU) | ||||||||||||||||||||
| 598 | |||||||||||||||||||||
| 599 | The default can be changed to B<X> or B<Y> with the C<magnet> attribute in | ||||||||||||||||||||
| 600 | the constructor as shown in SYNOPSIS. | ||||||||||||||||||||
| 601 | |||||||||||||||||||||
| 602 | =back | ||||||||||||||||||||
| 603 | |||||||||||||||||||||
| 604 | =head2 get_catalogue | ||||||||||||||||||||
| 605 | |||||||||||||||||||||
| 606 | $mcat = $m->get_catalogue(); | ||||||||||||||||||||
| 607 | print "$mcat\n"; | ||||||||||||||||||||
| 608 | |||||||||||||||||||||
| 609 | Returns the hardware configuration of the Mercury system. A typical response would be | ||||||||||||||||||||
| 610 | |||||||||||||||||||||
| 611 | DEV:GRPX:PSU:DEV:MB1.T1:TEMP:DEV:GRPY:PSU:DEV:GRPZ:PSU:DEV:PSU.M1:PSU:DEV:PSU.M2:PSU:DEV:GRPN:PSU:DEV:DB5.L1:LVL | ||||||||||||||||||||
| 612 | |||||||||||||||||||||
| 613 | Here, each group starting with "DEV:" describes one hardware component. | ||||||||||||||||||||
| 614 | In this case, we obtain for example: | ||||||||||||||||||||
| 615 | |||||||||||||||||||||
| 616 | DEV:GRPX:PSU | | ||||||||||||||||||||
| 617 | DEV:GRPY:PSU |- a 3-axis magnet power supply unit | ||||||||||||||||||||
| 618 | DEV:GRPZ:PSU | | ||||||||||||||||||||
| 619 | DEV:MB1.T1:TEMP -- a temperature sensor | ||||||||||||||||||||
| 620 | DEV:DB5.L1:LVL -- a cryoliquid level sensor | ||||||||||||||||||||
| 621 | |||||||||||||||||||||
| 622 | In each of these blocks, the second component after "DEV:" is the UID of the device; | ||||||||||||||||||||
| 623 | it can be used in other commands such as get_level to address it. | ||||||||||||||||||||
| 624 | |||||||||||||||||||||
| 625 | =head2 get_temperature | ||||||||||||||||||||
| 626 | |||||||||||||||||||||
| 627 | $t = $m->get_temperature(); | ||||||||||||||||||||
| 628 | $t = $m->get_temperature(channel => 'MB1.T1'); # default channel is 'MB1.T1' | ||||||||||||||||||||
| 629 | |||||||||||||||||||||
| 630 | Read out the designated temperature channel. Result is in Kelvin. | ||||||||||||||||||||
| 631 | |||||||||||||||||||||
| 632 | =head2 get_he_level | ||||||||||||||||||||
| 633 | |||||||||||||||||||||
| 634 | $level = $m->get_he_level(channel => 'DB5.L1'); | ||||||||||||||||||||
| 635 | |||||||||||||||||||||
| 636 | Read out the designated liquid helium level meter. Result is in percent as calibrated. | ||||||||||||||||||||
| 637 | |||||||||||||||||||||
| 638 | =head2 get_he_level_resistance | ||||||||||||||||||||
| 639 | |||||||||||||||||||||
| 640 | $res = $m->get_he_level_resistance(channel => 'DB5.L1'); | ||||||||||||||||||||
| 641 | |||||||||||||||||||||
| 642 | Read out the designated liquid helium level meter. Result is the raw sensor resistance. | ||||||||||||||||||||
| 643 | |||||||||||||||||||||
| 644 | =head2 get_n2_level | ||||||||||||||||||||
| 645 | |||||||||||||||||||||
| 646 | $level = $m->get_n2_level(channel => 'DB5.L1'); | ||||||||||||||||||||
| 647 | |||||||||||||||||||||
| 648 | Read out the designated liquid nitrogen level meter. Result is in percent as calibrated. | ||||||||||||||||||||
| 649 | |||||||||||||||||||||
| 650 | =head2 get_n2_level_frequency | ||||||||||||||||||||
| 651 | |||||||||||||||||||||
| 652 | $frq = $m->get_n2_level_frequency(channel => 'DB5.L1'); | ||||||||||||||||||||
| 653 | |||||||||||||||||||||
| 654 | Read out the designated liquid nitrogen level meter. Result is the raw internal frequency value. | ||||||||||||||||||||
| 655 | |||||||||||||||||||||
| 656 | =head2 oim_get_current | ||||||||||||||||||||
| 657 | |||||||||||||||||||||
| 658 | $curr = $m->oim_get_current(); | ||||||||||||||||||||
| 659 | |||||||||||||||||||||
| 660 | Reads out the momentary current of the PSU in Ampere. | ||||||||||||||||||||
| 661 | |||||||||||||||||||||
| 662 | TODO: what happens if we're in persistent mode? | ||||||||||||||||||||
| 663 | |||||||||||||||||||||
| 664 | =head2 oim_get_persistent_current | ||||||||||||||||||||
| 665 | |||||||||||||||||||||
| 666 | $field = $m->oim_get_persistent_current(); | ||||||||||||||||||||
| 667 | |||||||||||||||||||||
| 668 | Read PSU current for persistent mode in Amps. | ||||||||||||||||||||
| 669 | |||||||||||||||||||||
| 670 | =head2 oim_get_field | ||||||||||||||||||||
| 671 | |||||||||||||||||||||
| 672 | $field = $m->oim_get_field(); | ||||||||||||||||||||
| 673 | |||||||||||||||||||||
| 674 | Read PSU field in Tesla. | ||||||||||||||||||||
| 675 | Internally, this uses oim_get_current and calculates the field with the A-to-B factor. | ||||||||||||||||||||
| 676 | |||||||||||||||||||||
| 677 | Returns 0 when in persistent mode. | ||||||||||||||||||||
| 678 | |||||||||||||||||||||
| 679 | =head2 oim_get_persistent_field | ||||||||||||||||||||
| 680 | |||||||||||||||||||||
| 681 | $field = $m->oim_get_persistent_field(); | ||||||||||||||||||||
| 682 | |||||||||||||||||||||
| 683 | Read PSU field for persistent mode in Tesla. | ||||||||||||||||||||
| 684 | Internally, this uses oim_get_persistent_current and calculates the field with the A-to-B factor. | ||||||||||||||||||||
| 685 | |||||||||||||||||||||
| 686 | =head2 oim_get_heater | ||||||||||||||||||||
| 687 | |||||||||||||||||||||
| 688 | $t = $m->oim_get_heater(); | ||||||||||||||||||||
| 689 | |||||||||||||||||||||
| 690 | Returns the persistent mode switch heater status as B<ON> or B<OFF>. | ||||||||||||||||||||
| 691 | |||||||||||||||||||||
| 692 | =head2 oim_set_heater | ||||||||||||||||||||
| 693 | |||||||||||||||||||||
| 694 | $m->oim_set_heater(value => 'ON'); | ||||||||||||||||||||
| 695 | $m->oim_set_heater(value => 'OFF'); | ||||||||||||||||||||
| 696 | |||||||||||||||||||||
| 697 | Switches the persistent mode switch heater. | ||||||||||||||||||||
| 698 | Nothing happens if the power supply thinks the magnet current and the lead current are different. | ||||||||||||||||||||
| 699 | |||||||||||||||||||||
| 700 | =head2 heater_on/heater_off | ||||||||||||||||||||
| 701 | |||||||||||||||||||||
| 702 | $m->heater_on(); | ||||||||||||||||||||
| 703 | $m->heater_off(); | ||||||||||||||||||||
| 704 | |||||||||||||||||||||
| 705 | Enable/disable switch heater. Wait for 60s after changing the state of the | ||||||||||||||||||||
| 706 | heater. | ||||||||||||||||||||
| 707 | |||||||||||||||||||||
| 708 | =head2 in_persistent_mode | ||||||||||||||||||||
| 709 | |||||||||||||||||||||
| 710 | if ($m->in_persistent_mode()) { | ||||||||||||||||||||
| 711 | ... | ||||||||||||||||||||
| 712 | } | ||||||||||||||||||||
| 713 | |||||||||||||||||||||
| 714 | Return 1 if in persistent mode; otherwise return false. | ||||||||||||||||||||
| 715 | |||||||||||||||||||||
| 716 | =head2 oim_force_heater | ||||||||||||||||||||
| 717 | |||||||||||||||||||||
| 718 | Switches the persistent mode switch heater. Parameter is "ON" or "OFF". | ||||||||||||||||||||
| 719 | |||||||||||||||||||||
| 720 | Dangerous. Works also if magnet and lead current are differing. | ||||||||||||||||||||
| 721 | |||||||||||||||||||||
| 722 | =head2 oim_get_current_sweeprate | ||||||||||||||||||||
| 723 | |||||||||||||||||||||
| 724 | $rate = $m->oim_get_current_sweeprate(); | ||||||||||||||||||||
| 725 | |||||||||||||||||||||
| 726 | Gets the current target sweep rate (i.e., the sweep rate with which we want to | ||||||||||||||||||||
| 727 | go to the target; may be bigger than the actual rate if it is hardware limited), | ||||||||||||||||||||
| 728 | in Ampere per minute. | ||||||||||||||||||||
| 729 | |||||||||||||||||||||
| 730 | =head2 oim_set_current_sweeprate | ||||||||||||||||||||
| 731 | |||||||||||||||||||||
| 732 | $m->oim_set_current_sweeprate(value => 0.01); | ||||||||||||||||||||
| 733 | |||||||||||||||||||||
| 734 | Sets the desired target sweep rate, parameter is in Amperes per minute. | ||||||||||||||||||||
| 735 | |||||||||||||||||||||
| 736 | =head2 oim_get_field_sweeprate | ||||||||||||||||||||
| 737 | |||||||||||||||||||||
| 738 | $rate = $m->oim_get_field_sweeprate(); | ||||||||||||||||||||
| 739 | |||||||||||||||||||||
| 740 | Get sweep rate (Tesla/min). | ||||||||||||||||||||
| 741 | |||||||||||||||||||||
| 742 | =head2 oim_set_field_sweeprate | ||||||||||||||||||||
| 743 | |||||||||||||||||||||
| 744 | $rate_setpoint = $m->oim_set_field_sweeprate(value => 0.001); # 1mT / min | ||||||||||||||||||||
| 745 | |||||||||||||||||||||
| 746 | Set sweep rate (Tesla/min). | ||||||||||||||||||||
| 747 | |||||||||||||||||||||
| 748 | =head2 oim_get_activity | ||||||||||||||||||||
| 749 | |||||||||||||||||||||
| 750 | Retrieves the current power supply activity. See oim_set_activity for values. | ||||||||||||||||||||
| 751 | |||||||||||||||||||||
| 752 | =head2 oim_set_activity | ||||||||||||||||||||
| 753 | |||||||||||||||||||||
| 754 | $m->oim_set_activity(value => 'HOLD'); | ||||||||||||||||||||
| 755 | |||||||||||||||||||||
| 756 | Sets the current activity of the power supply. Values are: | ||||||||||||||||||||
| 757 | |||||||||||||||||||||
| 758 | HOLD - hold current | ||||||||||||||||||||
| 759 | RTOS - ramp to set point | ||||||||||||||||||||
| 760 | RTOZ - ramp to zero | ||||||||||||||||||||
| 761 | CLMP - clamp output if current is zero | ||||||||||||||||||||
| 762 | |||||||||||||||||||||
| 763 | =head2 oim_set_current_setpoint | ||||||||||||||||||||
| 764 | |||||||||||||||||||||
| 765 | $setpoint = $m->oim_set_current_setpoint(value => 0.001); | ||||||||||||||||||||
| 766 | |||||||||||||||||||||
| 767 | Sets the current set point in Ampere. | ||||||||||||||||||||
| 768 | |||||||||||||||||||||
| 769 | =head2 oim_get_current_setpoint | ||||||||||||||||||||
| 770 | |||||||||||||||||||||
| 771 | $sp = $m->oim_get_current_setpoint(); | ||||||||||||||||||||
| 772 | |||||||||||||||||||||
| 773 | Get the current set point in Ampere. | ||||||||||||||||||||
| 774 | |||||||||||||||||||||
| 775 | =head2 oim_set_field_setpoint | ||||||||||||||||||||
| 776 | |||||||||||||||||||||
| 777 | $m->oim_set_field_setpoint(value => 0.01); # 10 mT | ||||||||||||||||||||
| 778 | |||||||||||||||||||||
| 779 | Set the field setpoint in Tesla. | ||||||||||||||||||||
| 780 | |||||||||||||||||||||
| 781 | =head2 oim_get_field_setpoint | ||||||||||||||||||||
| 782 | |||||||||||||||||||||
| 783 | $sp = $m->oim_get_field_setpoint(); | ||||||||||||||||||||
| 784 | |||||||||||||||||||||
| 785 | Get the field setpoint in Tesla. | ||||||||||||||||||||
| 786 | |||||||||||||||||||||
| 787 | =head2 oim_get_fieldconstant | ||||||||||||||||||||
| 788 | |||||||||||||||||||||
| 789 | Returns the current to field factor (A/T) | ||||||||||||||||||||
| 790 | |||||||||||||||||||||
| 791 | =head2 field_step | ||||||||||||||||||||
| 792 | |||||||||||||||||||||
| 793 | Return the minimum field stepwidth of the magnet | ||||||||||||||||||||
| 794 | |||||||||||||||||||||
| 795 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 796 | |||||||||||||||||||||
| 797 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||
| 798 | |||||||||||||||||||||
| 799 | Copyright 2017 Simon Reinhardt | ||||||||||||||||||||
| 800 | 2018 Andreas K. Huettel, Simon Reinhardt | ||||||||||||||||||||
| 801 | 2019 Simon Reinhardt | ||||||||||||||||||||
| 802 | 2020 Andreas K. Huettel, Simon Reinhardt | ||||||||||||||||||||
| 803 | 2021-2022 Simon Reinhardt | ||||||||||||||||||||
| 804 | |||||||||||||||||||||
| 805 | |||||||||||||||||||||
| 806 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 807 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 808 | |||||||||||||||||||||
| 809 | =cut | ||||||||||||||||||||