| 1 | package Lab::Instrument::YokogawaGS200; | ||||||||||||||||||||||||||||||||
| 2 | #ABSTRACT: Yokogawa GS200 DC source | ||||||||||||||||||||||||||||||||
| 3 | 3 | $Lab::Instrument::YokogawaGS200::VERSION = '3.881'; | |||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use v5.20; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use feature "switch"; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Lab::Instrument; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Lab::Instrument::Source; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Lab::SCPI; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 3 | our @ISA = ('Lab::Instrument::Source'); | |||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | 3 | our %fields = ( | |||||||||||||||||||||||||||||||
| 18 | supported_connections => [ 'VISA_GPIB', 'GPIB', 'VISA' ], | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | # default settings for the supported connections | ||||||||||||||||||||||||||||||||
| 21 | connection_settings => { | ||||||||||||||||||||||||||||||||
| 22 | gpib_board => 0, | ||||||||||||||||||||||||||||||||
| 23 | gpib_address => 22, | ||||||||||||||||||||||||||||||||
| 24 | }, | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | device_settings => { | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | gate_protect => 1, | ||||||||||||||||||||||||||||||||
| 29 | gp_equal_level => 1e-5, | ||||||||||||||||||||||||||||||||
| 30 | gp_max_units_per_second => 0.05, | ||||||||||||||||||||||||||||||||
| 31 | gp_max_units_per_step => 0.005, | ||||||||||||||||||||||||||||||||
| 32 | gp_max_step_per_second => 10, | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | stepsize => 0.01, # default stepsize for sweep without gate protect | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | max_sweep_time => 3600, | ||||||||||||||||||||||||||||||||
| 37 | min_sweep_time => 0.1, | ||||||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | # If class does not provide set_$var for those, AUTOLOAD will take care. | ||||||||||||||||||||||||||||||||
| 41 | device_cache => { | ||||||||||||||||||||||||||||||||
| 42 | function => undef, | ||||||||||||||||||||||||||||||||
| 43 | range => undef, | ||||||||||||||||||||||||||||||||
| 44 | level => undef, | ||||||||||||||||||||||||||||||||
| 45 | output => undef, | ||||||||||||||||||||||||||||||||
| 46 | }, | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | device_cache_order => [ 'function', 'range' ], | ||||||||||||||||||||||||||||||||
| 49 | request => 0 | ||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | sub new { | ||||||||||||||||||||||||||||||||
| 53 | 2 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 54 | 2 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||
| 55 | 2 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||
| 56 | 2 | $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); | |||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | 2 | $self->configure( $self->config() ); | |||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | 2 | return $self; | |||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | sub set_voltage { | ||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_voltage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 65 | 0 | my $voltage = shift; | |||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | 0 | my $function = $self->get_function( { read_mode => 'cache' } ); | |||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ( $function ne 'VOLT' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 70 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 71 | "Source is in mode $function. Can't set voltage level." ); | ||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | 0 | return $self->set_level( $voltage, @_ ); | |||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | sub set_voltage_auto { | ||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_voltage_auto: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 79 | 0 | my $voltage = shift; | |||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 0 | my $function = $self->get_function(); | |||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if ( $function ne 'VOLT' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 84 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 85 | "Source is in mode $function. Can't set voltage level." ); | ||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if ( abs($voltage) > 32. ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 89 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 90 | "Source is not capable of voltage level > 32V. Can't set voltage level." | ||||||||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 0 | $self->set_level_auto( $voltage, @_ ); | |||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | sub set_current_auto { | ||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_current_auto: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 99 | 0 | my $current = shift; | |||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | 0 | my $function = $self->get_function(); | |||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ( $function ne 'CURR' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 104 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 105 | "Source is in mode $function. Can't set current level." ); | ||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ( abs($current) > 0.200 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 109 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 110 | "Source is not capable of current level > 200mA. Can't set current level." | ||||||||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | 0 | $self->set_level_auto( $current, @_ ); | |||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||
| 117 | sub set_current { | ||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_current: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 119 | 0 | my $current = shift; | |||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||
| 121 | 0 | my $function = $self->get_function(); | |||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ( $self->get_function() ne 'CURR' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 124 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 125 | "Source is in mode $function. Can't set current level." ); | ||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | 0 | $self->set_level( $current, @_ ); | |||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||
| 131 | sub _set_level { | ||||||||||||||||||||||||||||||||
| 132 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_set_level: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 133 | 11 | my $value = shift; | |||||||||||||||||||||||||||||||
| 134 | 11 | my $srcrange = $self->get_range(); | |||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||
| 136 | 11 | ( my $dec, my $exp ) = ( $srcrange =~ m/(^\d+)E([-\+]\d+)$/ ); | |||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||
| 138 | 11 | $srcrange = eval("$dec*10**$exp+2*$dec*10**($exp-1)"); | |||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||
| 140 | 11 | ▶ | if ( abs($value) <= $srcrange ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 141 | 11 | my $cmd = sprintf( ":SOURce:LEVel %f", $value ); | |||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | #print $cmd; | ||||||||||||||||||||||||||||||||
| 144 | 11 | $self->write($cmd); | |||||||||||||||||||||||||||||||
| 145 | 11 | return $self->{'device_cache'}->{'level'} = $value; | |||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||
| 147 | else { | ||||||||||||||||||||||||||||||||
| 148 | 0 | Lab::Exception::CorruptParameter->throw( | |||||||||||||||||||||||||||||||
| 149 | error => "Level $value is out of curren range $srcrange." ); | ||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | sub set_level_auto { | ||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_level_auto: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 156 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||
| 158 | 0 | my $cmd = sprintf( ":SOURce:LEVel:AUTO %e", $value ); | |||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | 0 | $self->write($cmd); | |||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | 0 | $self->{'device_cache'}->{'range'} = $self->get_range( from_device => 1 ); | |||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | 0 | return $self->{'device_cache'}->{'level'} = $value; | |||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||
| 168 | sub program_run { | ||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
program_run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 170 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||
| 172 | # print "Running program\n"; | ||||||||||||||||||||||||||||||||
| 173 | 0 | $self->write( ":PROG:RUN", $tail ); | |||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||
| 177 | sub program_pause { | ||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
program_pause: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||
| 180 | 0 | my $cmd = sprintf(":PROGram:PAUSe"); | |||||||||||||||||||||||||||||||
| 181 | 0 | $self->write("$cmd"); | |||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||
| 184 | sub program_continue { | ||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
program_continue: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 186 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 187 | 0 | my $cmd = sprintf(":PROGram:CONTinue"); | |||||||||||||||||||||||||||||||
| 188 | 0 | $self->write("$cmd"); | |||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||
| 192 | sub program_halt { | ||||||||||||||||||||||||||||||||
| 193 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
program_halt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 194 | 2 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||
| 196 | 2 | $self->write( ":PROG:HALT", $tail ); | |||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||
| 199 | sub start_program { | ||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
start_program: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 201 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||
| 203 | #print "Start program\n"; | ||||||||||||||||||||||||||||||||
| 204 | 0 | $self->write( ":PROG:EDIT:START", $tail ); | |||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | sub end_program { | ||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
end_program: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 209 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | #print "End program\n"; | ||||||||||||||||||||||||||||||||
| 212 | 0 | $self->write( ":PROG:EDIT:END", $tail ); | |||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | sub set_setpoint { | ||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_setpoint: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 217 | 0 | my ( $value, $tail ) = $self->_check_args( \@_, ['value'] ); | |||||||||||||||||||||||||||||||
| 218 | 0 | my $cmd = sprintf(":SOUR:LEV $value"); | |||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||
| 220 | #print "Do $cmd"; | ||||||||||||||||||||||||||||||||
| 221 | 0 | $self->write( $cmd, { error_check => 1 }, $tail ); | |||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||
| 224 | sub config_sweep { | ||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
config_sweep: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 226 | 0 | my ( $start, $target, $duration, $sections, $tail ) | |||||||||||||||||||||||||||||||
| 227 | = $self->check_sweep_config(@_); | ||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | 0 | $self->write( ":PROG:REP 0", $tail ); | |||||||||||||||||||||||||||||||
| 230 | 0 | $self->write( "*CLS", $tail ); | |||||||||||||||||||||||||||||||
| 231 | 0 | $self->set_output( 1, $tail ); | |||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||
| 233 | 0 | $self->start_program($tail); | |||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | #print "Program:\n"; | ||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | for ( my $i = 1; $i <= $sections; $i++ ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 237 | 0 | $self->set_setpoint( $start + ( $target - $start ) / $sections * $i ); | |||||||||||||||||||||||||||||||
| 238 | 0 | printf "sweep to setpoint: %+.4e\n", | |||||||||||||||||||||||||||||||
| 239 | $start + ( $target - $start ) / $sections * $i; | ||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||
| 241 | 0 | $self->end_program($tail); | |||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||
| 243 | 0 | $self->set_time( $duration, $duration, $tail ); | |||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||
| 247 | sub set_time { # internal use only | ||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_time: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 249 | 0 | my ( $sweep_time, $interval_time, $tail ) | |||||||||||||||||||||||||||||||
| 250 | = $self->_check_args( \@_, [ 'sweep_time', 'interval_time' ] ); | ||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ( $sweep_time < $self->device_settings()->{min_sweep_time} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 252 | 0 | print Lab::Exception::CorruptParameter->new( error => | |||||||||||||||||||||||||||||||
| 253 | " Sweep Time: $sweep_time smaller than $self->device_settings()->{min_sweep_time} sec!\n Sweep time set to $self->device_settings()->{min_sweep_time} sec" | ||||||||||||||||||||||||||||||||
| 254 | ); | ||||||||||||||||||||||||||||||||
| 255 | 0 | $sweep_time = $self->device_settings()->{min_sweep_time}; | |||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||
| 257 | elsif ( $sweep_time > $self->device_settings()->{max_sweep_time} ) { | ||||||||||||||||||||||||||||||||
| 258 | 0 | print Lab::Exception::CorruptParameter->new( error => | |||||||||||||||||||||||||||||||
| 259 | " Sweep Time: $sweep_time> $self->device_settings()->{max_sweep_time} sec!\n Sweep time set to $self->device_settings()->{max_sweep_time} sec" | ||||||||||||||||||||||||||||||||
| 260 | ); | ||||||||||||||||||||||||||||||||
| 261 | 0 | $sweep_time = $self->device_settings()->{max_sweep_time}; | |||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | if ( $interval_time < $self->device_settings()->{min_sweep_time} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 264 | 0 | print Lab::Exception::CorruptParameter->new( error => | |||||||||||||||||||||||||||||||
| 265 | " Interval Time: $interval_time smaller than $self->device_settings()->{min_sweep_time} sec!\n Interval time set to $self->device_settings()->{min_sweep_time} sec" | ||||||||||||||||||||||||||||||||
| 266 | ); | ||||||||||||||||||||||||||||||||
| 267 | 0 | $interval_time = $self->device_settings()->{min_sweep_time}; | |||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||
| 269 | elsif ( $interval_time > $self->device_settings()->{max_sweep_time} ) { | ||||||||||||||||||||||||||||||||
| 270 | 0 | print Lab::Exception::CorruptParameter->new( error => | |||||||||||||||||||||||||||||||
| 271 | " Interval Time: $interval_time> $self->device_settings()->{max_sweep_time} sec!\n Interval time set to $self->device_settings()->{max_sweep_time} sec" | ||||||||||||||||||||||||||||||||
| 272 | ); | ||||||||||||||||||||||||||||||||
| 273 | 0 | $interval_time = $self->device_settings()->{max_sweep_time}; | |||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||
| 275 | 0 | $self->write( ":PROG:SLOP $sweep_time", $tail ); | |||||||||||||||||||||||||||||||
| 276 | 0 | $self->write( ":PROG:INT $interval_time", $tail ); | |||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||
| 280 | sub wait { | ||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
wait: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 282 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 283 | 0 | my $flag = 1; | |||||||||||||||||||||||||||||||
| 284 | 0 | local $| = 1; | |||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||
| 286 | 0 | while (1) { | |||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||
| 288 | #my $status = $self->get_status(); | ||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||
| 290 | 0 | my $current_level | |||||||||||||||||||||||||||||||
| 291 | = $self->get_level( { read_mode => 'device' }, $tail ); | ||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if ( $flag <= 1.1 and $flag >= 0.9 ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$flag <= "1.1" and $flag >= "0.9"
MC/DC0%0/2
$flag <= "1.1" and $flag >= "0.9"
$flag <= "1.1"
$flag >= "0.9"
Truth table0%0/3
A and B
A= $flag <= "1.1"B= $flag >= "0.9"
| |||||||||||||||||||||||||||||||||
| 293 | 0 | print "\t\t\t\t\t\t\t\t\t\r"; | |||||||||||||||||||||||||||||||
| 294 | 0 | print $self->get_id() . " is sweeping ($current_level )\r"; | |||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||
| 297 | elsif ( $flag <= 0 ) { | ||||||||||||||||||||||||||||||||
| 298 | 0 | print "\t\t\t\t\t\t\t\t\t\r"; | |||||||||||||||||||||||||||||||
| 299 | 0 | print $self->get_id() . " is ($current_level ) \r"; | |||||||||||||||||||||||||||||||
| 300 | 0 | $flag = 2; | |||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||
| 302 | 0 | $flag -= 0.5; | |||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if ( $self->active($tail) == 0 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 305 | 0 | print "\t\t\t\t\t\t\t\t\t\r"; | |||||||||||||||||||||||||||||||
| 306 | 0 | $| = 0; | |||||||||||||||||||||||||||||||
| 307 | 0 | last; | |||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||
| 313 | sub _sweep_to_level { | ||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_sweep_to_level: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 315 | 0 | my ( $target, $time, $tail ) | |||||||||||||||||||||||||||||||
| 316 | = $self->_check_args( \@_, [ 'points', 'time' ] ); | ||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||
| 318 | 0 | $self->config_sweep( { points => $target, time => $time }, $tail ); | |||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||
| 320 | 0 | $self->program_run($tail); | |||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||
| 322 | 0 | $self->wait($tail); | |||||||||||||||||||||||||||||||
| 323 | 0 | my $current = $self->get_level($tail); | |||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||
| 325 | 0 | my $eql = $self->get_gp_equal_level(); | |||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | if ( abs( $current - $target ) > $eql ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 328 | 0 | print "YokogawaGS200.pm: error current neq target\n"; | |||||||||||||||||||||||||||||||
| 329 | 0 | Lab::Exception::CorruptParameter->throw( | |||||||||||||||||||||||||||||||
| 330 | "Sweep failed: $target not equal to $current. \n"); | ||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||
| 333 | 0 | $self->{'device_cache'}->{'level'} = $target; | |||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | 0 | return $target; | |||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||
| 338 | sub trg { | ||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
trg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 340 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 341 | 0 | $self->write( "*CLS", $tail ); | |||||||||||||||||||||||||||||||
| 342 | 0 | $self->program_run($tail); | |||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||
| 345 | sub abort { | ||||||||||||||||||||||||||||||||
| 346 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
abort: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 347 | 2 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 348 | 2 | $self->program_halt($tail); | |||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | sub get_voltage { | ||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_voltage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||
| 354 | 0 | my $function = $self->get_function(); | |||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | if ( !$function eq 'VOLT' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 357 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 358 | "Source is in mode $function. Can't get voltage level." ); | ||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||
| 361 | 0 | return $self->get_level(@_); | |||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||
| 364 | sub active { | ||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
active: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 366 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||
| 368 | 0 | $self->write( "STAT:ENAB 128", $tail ); | |||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | if ( $self->get_status( "EES", $tail ) == 1 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 370 | 0 | return 0; | |||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||
| 372 | else { | ||||||||||||||||||||||||||||||||
| 373 | 0 | return 1; | |||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||
| 378 | sub get_status { | ||||||||||||||||||||||||||||||||
| 379 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_status: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 380 | 6 | my ( $request, $tail ) = $self->_check_args( \@_, ['request'] ); | |||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||
| 382 | # The status byte is read | ||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||
| 384 | 6 | my $status = int( $self->query( '*STB?', $tail ) ); | |||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||
| 386 | #printf "Status: %i",$status; | ||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||
| 388 | 6 | my @flags = qw/NONE EES ESB MAV NONE EAV MSS NONE/; | |||||||||||||||||||||||||||||||
| 389 | 6 | my $result = {}; | |||||||||||||||||||||||||||||||
| 390 | 6 | for ( 0 .. 7 ) { | |||||||||||||||||||||||||||||||
| 391 | 48 | $result->{ $flags[$_] } = $status & 1; | |||||||||||||||||||||||||||||||
| 392 | 48 | $status >>= 1; | |||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||
| 395 | #print "EOP: $result->{'EOP'}\n"; | ||||||||||||||||||||||||||||||||
| 396 | 6 | ▶ | return $result->{$request} if defined $request; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 397 | 6 | return $result; | |||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||
| 401 | sub get_current { | ||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_current: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||
| 404 | 0 | my $function = $self->get_function(); | |||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | if ( !$self->get_function() eq 'CURR' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 407 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 408 | "Source is in mode $function. Can't get current level." ); | ||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||
| 411 | 0 | return $self->get_level(@_); | |||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||
| 414 | sub get_level { | ||||||||||||||||||||||||||||||||
| 415 | 17 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_level: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 416 | 17 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 417 | 17 | my $cmd = ":SOUR:LEV?"; | |||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||
| 419 | 17 | return $self->request( $cmd, $tail ); | |||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||
| 422 | sub get_function { | ||||||||||||||||||||||||||||||||
| 423 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_function: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 424 | 10 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | 10 | my $cmd = ":SOURce:FUNCtion?"; | |||||||||||||||||||||||||||||||
| 427 | 10 | return $self->query( $cmd, $tail ); | |||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||
| 430 | sub get_range { | ||||||||||||||||||||||||||||||||
| 431 | 28 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_range: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 432 | 28 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||
| 434 | 28 | my $cmd = ":SOUR:RANG?"; | |||||||||||||||||||||||||||||||
| 435 | 28 | return $self->query( $cmd, $tail ); | |||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||
| 439 | sub set_function { | ||||||||||||||||||||||||||||||||
| 440 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_function: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 441 | 2 | my $func = shift; | |||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||
| 443 | 2 | ▶ | if ( scpi_match( $func, 'current|voltage' ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 444 | 2 | my $cmd = ":SOURce:FUNCtion " . $func; | |||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||
| 446 | #print "$cmd\n"; | ||||||||||||||||||||||||||||||||
| 447 | 2 | $self->write($cmd); | |||||||||||||||||||||||||||||||
| 448 | 2 | return $self->{'device_cache'}->{'function'} = $func; | |||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||
| 450 | else { | ||||||||||||||||||||||||||||||||
| 451 | 0 | Lab::Exception::CorruptParameter->throw( | |||||||||||||||||||||||||||||||
| 452 | error => "source function $func not defined for this device.\n" ); | ||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||
| 457 | sub set_range { | ||||||||||||||||||||||||||||||||
| 458 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_range: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 459 | 6 | my $range = shift; | |||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||
| 461 | 6 | my $srcf = $self->get_function(); | |||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||
| 463 | 6 | $self->write( "SOURce:RANGe $range", error_check => 1 ); | |||||||||||||||||||||||||||||||
| 464 | 6 | return $self->{'device_cache'}->{'range'} | |||||||||||||||||||||||||||||||
| 465 | = $self->get_range( from_device => 1 ); | ||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||
| 469 | sub set_output { | ||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_output: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 471 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if ( $value =~ /(on|1)/i ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 474 | 0 | $value = 1; | |||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||
| 476 | elsif ( $value =~ /(off|0)/i ) { | ||||||||||||||||||||||||||||||||
| 477 | 0 | $value = 0; | |||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||
| 479 | else { | ||||||||||||||||||||||||||||||||
| 480 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 481 | "set_output accepts only on or off (case non-sensitive) and 1 or 0. $value is not valid." | ||||||||||||||||||||||||||||||||
| 482 | ); | ||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||
| 485 | 0 | return $self->{"device_cache"}->{"output"} = $self->write(":OUTP $value"); | |||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||
| 488 | sub get_output { | ||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_output: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 490 | 0 | my ($tail) = $self->_check_args( \@_ ); | |||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||
| 492 | 0 | return $self->query( ":OUTP?", $tail ); | |||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||
| 495 | sub set_voltage_limit { | ||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_voltage_limit: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 497 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 498 | 0 | my $cmd = ":SOURce:PROTection:VOLTage $value"; | |||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | if ( $value > 30. || $value < 1. ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$value > 30 or $value < 1
MC/DC0%0/2
$value > 30 or $value < 1
$value > 30
$value < 1
Truth table0%0/3
A or B
A= $value > 30B= $value < 1
| |||||||||||||||||||||||||||||||||
| 501 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 502 | "The voltage limit $value is not within the allowed range.\n" | ||||||||||||||||||||||||||||||||
| 503 | ); | ||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||
| 506 | 0 | $self->connection()->write($cmd); | |||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||
| 508 | 0 | return $self->device_cache()->{'voltage_limit'} = $value; | |||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||
| 512 | sub set_current_limit { | ||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
set_current_limit: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 514 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 515 | 0 | my $cmd = ":SOURce:PROTection:CURRent $value"; | |||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | if ( $value > 0.2 || $value < 0.001 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$value > "0.2" or $value < "0.001"
MC/DC0%0/2
$value > "0.2" or $value < "0.001"
$value > "0.2"
$value < "0.001"
Truth table0%0/3
A or B
A= $value > "0.2"B= $value < "0.001"
| |||||||||||||||||||||||||||||||||
| 518 | 0 | Lab::Exception::CorruptParameter->throw( error => | |||||||||||||||||||||||||||||||
| 519 | "The current limit $value is not within the allowed range.\n" | ||||||||||||||||||||||||||||||||
| 520 | ); | ||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||
| 523 | 0 | $self->connection()->write($cmd); | |||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||
| 525 | 0 | return $self->device_cache()->{'current_limit'} = $value; | |||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||
| 529 | sub get_error { | ||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get_error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||
| 532 | 0 | my $cmd = ":SYSTem:ERRor?"; | |||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||
| 534 | 0 | return $self->query($cmd); | |||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||
| 537 | 3 | 1; | |||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||
| 539 | __END__ | ||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||
| 541 | =pod | ||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||
| 543 | =encoding utf-8 | ||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||
| 545 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||
| 547 | Lab::Instrument::YokogawaGS200 - Yokogawa GS200 DC source | ||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||
| 549 | =head1 VERSION | ||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||
| 551 | version 3.881 | ||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||
| 553 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||
| 555 | use Lab::Instrument::YokogawaGS200; | ||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||
| 557 | my $gate14=new Lab::Instrument::YokogawaGS200( | ||||||||||||||||||||||||||||||||
| 558 | connection_type => 'LinuxGPIB', | ||||||||||||||||||||||||||||||||
| 559 | gpib_address => 22, | ||||||||||||||||||||||||||||||||
| 560 | function => 'VOLT', | ||||||||||||||||||||||||||||||||
| 561 | level => 0.4, | ||||||||||||||||||||||||||||||||
| 562 | ); | ||||||||||||||||||||||||||||||||
| 563 | $gate14->set_voltage(0.745); | ||||||||||||||||||||||||||||||||
| 564 | print $gate14->get_voltage(); | ||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||
| 566 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||
| 568 | The Lab::Instrument::YokogawaGS200 class implements an interface to the | ||||||||||||||||||||||||||||||||
| 569 | discontinued voltage and current source GS200 by Yokogawa. This class derives from | ||||||||||||||||||||||||||||||||
| 570 | L<Lab::Instrument::Source> and provides all functionality described there. | ||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||
| 572 | =head1 CONSTRUCTORS | ||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||
| 574 | =head2 new( %configuration_HASH ) | ||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||
| 576 | HASH is a list of tuples given in the format | ||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||
| 578 | key => value, | ||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||
| 580 | please supply at least the configuration for the connection: | ||||||||||||||||||||||||||||||||
| 581 | connection_type => "LinxGPIB" | ||||||||||||||||||||||||||||||||
| 582 | gpib_address => | ||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||
| 584 | you might also want to have gate protect from the start (the default values are given): | ||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||
| 586 | gate_protect => 1, | ||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||
| 588 | gp_equal_level => 1e-5, | ||||||||||||||||||||||||||||||||
| 589 | gp_max_units_per_second => 0.05, | ||||||||||||||||||||||||||||||||
| 590 | gp_max_units_per_step => 0.005, | ||||||||||||||||||||||||||||||||
| 591 | gp_max_step_per_second => 10, | ||||||||||||||||||||||||||||||||
| 592 | gp_max_units_per_second => 0.05, | ||||||||||||||||||||||||||||||||
| 593 | gp_max_units_per_step => 0.005, | ||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||
| 595 | max_sweep_time=>3600, | ||||||||||||||||||||||||||||||||
| 596 | min_sweep_time=>0.1, | ||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||
| 598 | Additinally there is support to set parameters for the device "on init": | ||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||
| 600 | function => undef, # 'VOLT' - voltage, 'CURR' - current | ||||||||||||||||||||||||||||||||
| 601 | range => undef, | ||||||||||||||||||||||||||||||||
| 602 | level => undef, | ||||||||||||||||||||||||||||||||
| 603 | output => undef, | ||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||
| 605 | If those values are not specified, they are read from the device. | ||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||
| 607 | =head1 METHODS | ||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||
| 609 | =head2 sweep_to_level | ||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||
| 611 | $src->sweep_to_level($lvl,$time) | ||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||
| 613 | Sweep to the level $lvl in $time seconds. | ||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||
| 615 | =head2 set_voltage | ||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||
| 617 | $src->set_voltage($voltage) | ||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||
| 619 | Sets the output voltage to $voltage. | ||||||||||||||||||||||||||||||||
| 620 | Returns the newly set voltage. | ||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||
| 622 | =head2 get_voltage | ||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||
| 624 | Returns the currently set $voltage. The value is read from the driver cache by default. Provide the option | ||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||
| 626 | device_cache => 1 | ||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||
| 628 | to read directly from the device. | ||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||
| 630 | =head2 set_current | ||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||
| 632 | $src->set_current($current) | ||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||
| 634 | Sets the output current to $current. | ||||||||||||||||||||||||||||||||
| 635 | Returns the newly set current. | ||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||
| 637 | =head2 get_current | ||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||
| 639 | Returns the currently set $current. The value is read from the driver cache by default. Provide the option | ||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||
| 641 | device_cache => 1 | ||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||
| 643 | to read directly from the device. | ||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||
| 645 | =head2 set_level | ||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||
| 647 | $src->set_level($lvl) | ||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||
| 649 | Sets the level $lvl in the current operation mode. | ||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||
| 651 | =head2 get_level | ||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||
| 653 | $lvl = $src->get_level() | ||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||
| 655 | Returns the currently set level. Use | ||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||
| 657 | device_cache => 1 | ||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||
| 659 | to enforce a reading directly from the device. | ||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||
| 661 | =head2 set_range($range) | ||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||
| 663 | Fixed voltage mode | ||||||||||||||||||||||||||||||||
| 664 | 10E-3 10mV | ||||||||||||||||||||||||||||||||
| 665 | 100E-3 100mV | ||||||||||||||||||||||||||||||||
| 666 | 1E+0 1V | ||||||||||||||||||||||||||||||||
| 667 | 10E+0 10V | ||||||||||||||||||||||||||||||||
| 668 | 30E+0 30V | ||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||
| 670 | Fixed current mode | ||||||||||||||||||||||||||||||||
| 671 | 1E-3 1mA | ||||||||||||||||||||||||||||||||
| 672 | 10E-3 10mA | ||||||||||||||||||||||||||||||||
| 673 | 100E-3 100mA | ||||||||||||||||||||||||||||||||
| 674 | 200E-3 200mA | ||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||
| 676 | Please use the format on the left for the range command. | ||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||
| 678 | =head2 program_run($program) | ||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||
| 680 | Runs a program stored on the YokogawaGS200. If no prgram name is given, the currently loaded program is executed. | ||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||
| 682 | =head2 program_pause | ||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||
| 684 | Pauses the currently running program. | ||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||
| 686 | =head2 program_continue | ||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||
| 688 | Continues the paused program. | ||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||
| 690 | =head2 set_function($function) | ||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||
| 692 | Sets the source function. The Yokogawa supports the values | ||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||
| 694 | "CURR" for current mode and | ||||||||||||||||||||||||||||||||
| 695 | "VOLT" for voltage mode. | ||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||
| 697 | Returns the newly set source function. | ||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||
| 699 | =head2 set_voltage_limit($limit) | ||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||
| 701 | Sets a voltage limit to protect the device. | ||||||||||||||||||||||||||||||||
| 702 | Returns the new voltage limit. | ||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||
| 704 | =head2 set_current_limit($limit) | ||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||
| 706 | See set_voltage_limit. | ||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||
| 708 | =head2 output_on() | ||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||
| 710 | Sets the output switch to on and returns the new value of the output status. | ||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||
| 712 | =head2 output_off() | ||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||
| 714 | Sets the output switch to off. The instrument outputs no voltage | ||||||||||||||||||||||||||||||||
| 715 | or current then, no matter what voltage you set. Returns the new value of the output status. | ||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||
| 717 | =head2 get_error() | ||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||
| 719 | Queries the error code from the device. This is a very useful thing to do when you are working remote and the source is not responding. | ||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||
| 721 | =head2 get_output() | ||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||
| 723 | =head2 get_range() | ||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||
| 725 | =head1 CAVEATS | ||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||
| 727 | probably many | ||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||
| 729 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||
| 731 | =over 4 | ||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||
| 733 | =item * Lab::Instrument | ||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||
| 735 | The YokogawaGP200 class is a Lab::Instrument (L<Lab::Instrument>). | ||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||
| 737 | =item * Lab::Instrument::Source | ||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||
| 739 | The YokogawaGP200 class is a Source (L<Lab::Instrument::Source>) | ||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||
| 741 | =back | ||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||
| 743 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||
| 745 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||
| 747 | Copyright 2005-2006 Daniel Schroeer | ||||||||||||||||||||||||||||||||
| 748 | 2009 Andreas K. Huettel, Daniela Taubert | ||||||||||||||||||||||||||||||||
| 749 | 2010 Andreas K. Huettel, Daniel Schroeer | ||||||||||||||||||||||||||||||||
| 750 | 2011 Andreas K. Huettel, David Kalok, Florian Olbrich | ||||||||||||||||||||||||||||||||
| 751 | 2012 Alois Dirnaichner, Andreas K. Huettel, Florian Olbrich | ||||||||||||||||||||||||||||||||
| 752 | 2013 Andreas K. Huettel, Christian Butschkow | ||||||||||||||||||||||||||||||||
| 753 | 2014 Alois Dirnaichner, Christian Butschkow | ||||||||||||||||||||||||||||||||
| 754 | 2015 Alois Dirnaichner | ||||||||||||||||||||||||||||||||
| 755 | 2016 Simon Reinhardt | ||||||||||||||||||||||||||||||||
| 756 | 2017 Andreas K. Huettel | ||||||||||||||||||||||||||||||||
| 757 | 2020 Andreas K. Huettel | ||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||
| 760 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||
| 761 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||
| 763 | =cut | ||||||||||||||||||||||||||||||||