| 1 | package Lab::Moose::Instrument::Keithley2400; | ||
| 2 | 2 | $Lab::Moose::Instrument::Keithley2400::VERSION = '3.881'; | |
| 3 | #ABSTRACT: Keithley 2400 voltage/current sourcemeter. | ||
| 4 | |||
| 5 | 2 | ▶ | use v5.20; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | |||
| 8 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use MooseX::Params::Validate; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | use Lab::Moose::Instrument | ||
| 11 | 2 | ▶ | qw/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 | |||
| 16 | 2 | extends 'Lab::Moose::Instrument'; | |
| 17 | |||
| 18 | 2 | has [qw/max_units_per_second max_units_per_step min_units max_units/] => | |
| 19 | ( is => 'ro', isa => 'Num', required => 1 ); | ||
| 20 | |||
| 21 | 2 | has source_level_timestamp => ( | |
| 22 | is => 'rw', | ||
| 23 | isa => 'Num', | ||
| 24 | init_arg => undef, | ||
| 25 | ); | ||
| 26 | |||
| 27 | 2 | has verbose => ( | |
| 28 | is => 'ro', | ||
| 29 | isa => 'Bool', | ||
| 30 | default => 1 | ||
| 31 | ); | ||
| 32 | |||
| 33 | sub BUILD { | ||
| 34 | 1 | ▶ | my $self = shift; |
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 35 | |||
| 36 | 1 | $self->clear(); | |
| 37 | 1 | $self->cls(); | |
| 38 | } | ||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | sub set_level { | ||
| 43 | 1 | ▶ | my ( $self, $value, %args ) = validated_setter( |
|
Subroutine
set_level: called CC=1 SCAR=0.0
Pod
documented
| |||
| 44 | \@_, | ||
| 45 | value => { isa => 'Num' }, | ||
| 46 | ); | ||
| 47 | |||
| 48 | 1 | return $self->linear_step_sweep( | |
| 49 | to => $value, verbose => $self->verbose, | ||
| 50 | %args | ||
| 51 | ); | ||
| 52 | } | ||
| 53 | |||
| 54 | |||
| 55 | sub get_measurement { | ||
| 56 | 0 | ▶ | my ( $self, %args ) = validated_getter( \@_ ); |
|
Subroutine
get_measurement: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 57 | 0 | my $meas = $self->query( command => ':MEAS:CURR?', %args ); | |
| 58 | 0 | my $elements = $self->query( command => ':FORM:ELEM?' ); | |
| 59 | 0 | my @elements = split /,/, $elements; | |
| 60 | 0 | my @meas_values = split /,/, $meas; | |
| 61 | 0 | my %result = map { $_ => shift @meas_values } @elements; | |
| 62 | 0 | return \%result; | |
| 63 | } | ||
| 64 | |||
| 65 | # | ||
| 66 | # Aliases for Lab::XPRESS::Sweep API | ||
| 67 | # | ||
| 68 | |||
| 69 | |||
| 70 | sub cached_level { | ||
| 71 | 1 | ▶ | my $self = shift; |
|
Subroutine
cached_level: called CC=1 SCAR=0.0
Pod
documented
| |||
| 72 | 1 | return $self->cached_source_level(@_); | |
| 73 | } | ||
| 74 | |||
| 75 | |||
| 76 | sub get_level { | ||
| 77 | 1 | ▶ | my $self = shift; |
|
Subroutine
get_level: called CC=1 SCAR=0.0
Pod
documented
| |||
| 78 | 1 | return $self->source_level_query(@_); | |
| 79 | } | ||
| 80 | |||
| 81 | |||
| 82 | sub set_voltage { | ||
| 83 | 0 | ▶ | my $self = shift; |
|
Subroutine
set_voltage: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 84 | 0 | my $value = shift; | |
| 85 | 0 | return $self->set_level( value => $value ); | |
| 86 | } | ||
| 87 | |||
| 88 | |||
| 89 | 2 | with qw( | |
| 90 | Lab::Moose::Instrument::Common | ||
| 91 | Lab::Moose::Instrument::SCPI::Sense::Function::Concurrent | ||
| 92 | Lab::Moose::Instrument::SCPI::Sense::Protection | ||
| 93 | Lab::Moose::Instrument::SCPI::Sense::Range | ||
| 94 | Lab::Moose::Instrument::SCPI::Sense::NPLC | ||
| 95 | Lab::Moose::Instrument::SCPI::Source::Function | ||
| 96 | Lab::Moose::Instrument::SCPI::Source::Level | ||
| 97 | Lab::Moose::Instrument::SCPI::Source::Range | ||
| 98 | Lab::Moose::Instrument::LinearStepSweep | ||
| 99 | ); | ||
| 100 | |||
| 101 | 2 | __PACKAGE__->meta()->make_immutable(); | |
| 102 | |||
| 103 | 2 | 1; | |
| 104 | |||
| 105 | __END__ | ||
| 106 | |||
| 107 | =pod | ||
| 108 | |||
| 109 | =encoding UTF-8 | ||
| 110 | |||
| 111 | =head1 NAME | ||
| 112 | |||
| 113 | Lab::Moose::Instrument::Keithley2400 - Keithley 2400 voltage/current sourcemeter. | ||
| 114 | |||
| 115 | =head1 VERSION | ||
| 116 | |||
| 117 | version 3.881 | ||
| 118 | |||
| 119 | =head1 SYNOPSIS | ||
| 120 | |||
| 121 | use Lab::Moose; | ||
| 122 | |||
| 123 | my $source = instrument( | ||
| 124 | type => 'Keithley2400', | ||
| 125 | connection_type => 'LinuxGPIB', | ||
| 126 | connection_options => {gpib_address => 15}, | ||
| 127 | # mandatory protection settings | ||
| 128 | max_units_per_step => 0.001, # max step is 1mV/1mA | ||
| 129 | max_units_per_second => 0.01, | ||
| 130 | min_units => -10, | ||
| 131 | max_units => 10, | ||
| 132 | ); | ||
| 133 | |||
| 134 | ### Sourcing | ||
| 135 | |||
| 136 | |||
| 137 | # Source voltage | ||
| 138 | $source->source_function(value => 'VOLT'); | ||
| 139 | $source->source_range(value => 210); | ||
| 140 | |||
| 141 | # Step-sweep to new level. | ||
| 142 | # Stepsize and speed is given by (max|min)_units* settings. | ||
| 143 | $source->set_level(value => 9); | ||
| 144 | |||
| 145 | # Get current level from device cache (without sending a query to the | ||
| 146 | # instrument): | ||
| 147 | my $level = $source->cached_level(); | ||
| 148 | |||
| 149 | ### Measurement | ||
| 150 | |||
| 151 | # Measure current | ||
| 152 | $source->sense_function_on(value => ['CURR']); | ||
| 153 | # Use measurement integration time of 2 NPLC | ||
| 154 | $source->sense_function(value => 'CURR'); | ||
| 155 | $source->sense_nplc(value => 2); | ||
| 156 | |||
| 157 | # Get measurement sample | ||
| 158 | my $sample = $source->get_measurement(); | ||
| 159 | my $current = $sample->{CURR}; | ||
| 160 | # print all entries in sample (Voltage, Current, Resistance, Timestamp): | ||
| 161 | use Data::Dumper; | ||
| 162 | print Dumper $sample; | ||
| 163 | |||
| 164 | =head1 METHODS | ||
| 165 | |||
| 166 | Used roles: | ||
| 167 | |||
| 168 | =over | ||
| 169 | |||
| 170 | =item L<Lab::Moose::Instrument::Common> | ||
| 171 | |||
| 172 | =item L<Lab::Moose::Instrument::SCPI::Sense::Protection> | ||
| 173 | |||
| 174 | =item L<Lab::Moose::Instrument::SCPI::Sense::Range> | ||
| 175 | |||
| 176 | =item L<Lab::Moose::Instrument::SCPI::Sense::NPLC> | ||
| 177 | |||
| 178 | =item L<Lab::Moose::Instrument::SCPI::Source::Function::Concurrent> | ||
| 179 | |||
| 180 | =item L<Lab::Moose::Instrument::SCPI::Source::Level> | ||
| 181 | |||
| 182 | =item L<Lab::Moose::Instrument::SCPI::Source::Range> | ||
| 183 | |||
| 184 | =item L<Lab::Moose::Instrument::LinearStepSweep> | ||
| 185 | |||
| 186 | =back | ||
| 187 | |||
| 188 | =head2 set_level | ||
| 189 | |||
| 190 | $source->set_level(value => $new_level); | ||
| 191 | |||
| 192 | Go to new level. Sweep with multiple steps if the distance between current and | ||
| 193 | new level is larger than C<max_units_per_step>. | ||
| 194 | |||
| 195 | =head2 get_measurement | ||
| 196 | |||
| 197 | my $sample = $source->get_measurement(); | ||
| 198 | my $current = $sample->{CURR}; | ||
| 199 | |||
| 200 | Do new measurement and return sample hashref of measured elements. | ||
| 201 | |||
| 202 | =head2 cached_level | ||
| 203 | |||
| 204 | my $current_level = $source->cached_level(); | ||
| 205 | |||
| 206 | Get current value from device cache. | ||
| 207 | |||
| 208 | =head2 get_level | ||
| 209 | |||
| 210 | my $current_level = $source->get_level(); | ||
| 211 | |||
| 212 | Query current level. | ||
| 213 | |||
| 214 | =head2 set_voltage | ||
| 215 | |||
| 216 | $source->set_voltage($value); | ||
| 217 | |||
| 218 | For XPRESS voltage sweep. Equivalent to C<< set_level(value => $value) >>. | ||
| 219 | |||
| 220 | =head1 COPYRIGHT AND LICENSE | ||
| 221 | |||
| 222 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||
| 223 | |||
| 224 | Copyright 2018 Simon Reinhardt | ||
| 225 | 2020 Andreas K. Huettel | ||
| 226 | |||
| 227 | |||
| 228 | This is free software; you can redistribute it and/or modify it under | ||
| 229 | the same terms as the Perl 5 programming language system itself. | ||
| 230 | |||
| 231 | =cut | ||