| 1 | package Lab::Moose::Instrument::KeysightDSOS604A; | ||||||||||||||||||||||||||||
| 2 | 1 | $Lab::Moose::Instrument::KeysightDSOS604A::VERSION = '3.931'; | |||||||||||||||||||||||||||
| 3 | #ABSTRACT: Keysight DSOS604A infiniium S-Series Oscilloscope. | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use v5.20; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use MooseX::Params::Validate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Moose::Util::TypeConstraints qw/enum/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | use Lab::Moose::Instrument | ||||||||||||||||||||||||||||
| 11 | 1 | ▶ | qw/validated_getter validated_setter setter_params validated_channel_getter | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | validated_channel_setter/; | |||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Lab::Moose::Instrument::Cache; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | extends 'Lab::Moose::Instrument'; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | has input_impedance => ( | |||||||||||||||||||||||||||
| 20 | is => 'ro', | ||||||||||||||||||||||||||||
| 21 | isa => enum( [qw/DC DC50 DCFifty LFR1 LFR2/]), | ||||||||||||||||||||||||||||
| 22 | default => 'DC50' | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | has instrument_nselect => ( | |||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||
| 27 | isa => 'Int', | ||||||||||||||||||||||||||||
| 28 | default => 1 | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | has waveform_format => ( | |||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||
| 33 | isa => enum([qw/ASCii BINary BYTE WORD FLOat/]), | ||||||||||||||||||||||||||||
| 34 | default => 'FLOat' | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | around default_connection_options => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 38 | 0 | my $orig = shift; | |||||||||||||||||||||||||||
| 39 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 40 | 0 | my $options = $self->$orig(); | |||||||||||||||||||||||||||
| 41 | 0 | my $usb_opts = { vid => 0x2a8d, pid => 0x9045, | |||||||||||||||||||||||||||
| 42 | reset_device => 0 # Same as with the B2901A | ||||||||||||||||||||||||||||
| 43 | }; | ||||||||||||||||||||||||||||
| 44 | 0 | $options->{USB} = $usb_opts; | |||||||||||||||||||||||||||
| 45 | 0 | $options->{'VISA::USB'} = $usb_opts; | |||||||||||||||||||||||||||
| 46 | 0 | return $options; | |||||||||||||||||||||||||||
| 47 | 1 | }; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | # It is recommended to use the :PDER? query instead of the standard *OPC? query | ||||||||||||||||||||||||||||
| 51 | # on this oscilloscope. This is because *OPC? returns after the previous | ||||||||||||||||||||||||||||
| 52 | # commands are parsed, not after the previous commands are executed completely. | ||||||||||||||||||||||||||||
| 53 | # :PDER? does just this, like you would expect from the standard SCPI *OPC? | ||||||||||||||||||||||||||||
| 54 | # query. See the programming manual page 209 for more information. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | # around opc_query => sub { | ||||||||||||||||||||||||||||
| 57 | # my ( $self, %args ) = validated_getter( \@_ ); | ||||||||||||||||||||||||||||
| 58 | # return $self->query( command => ':PDER?', %args ); | ||||||||||||||||||||||||||||
| 59 | # }; | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 63 | 0 | $self->clear(); | |||||||||||||||||||||||||||
| 64 | 0 | $self->cls(); | |||||||||||||||||||||||||||
| 65 | 0 | $self->write(command => ":CHANnel".$self->instrument_nselect.":DISPlay ON"); | |||||||||||||||||||||||||||
| 66 | 0 | $self->write(command => ":WAVeform:FORMat ".$self->waveform_format); | |||||||||||||||||||||||||||
| 67 | 0 | $self->write(command => ":WAVeform:BYTeorder LSBFirst" ); | |||||||||||||||||||||||||||
| 68 | 0 | $self->write(command => ":WAVeform:SOURce CHANnel".$self->instrument_nselect); | |||||||||||||||||||||||||||
| 69 | 0 | $self->write(command => ":WAVeform:STReaming ON" ); | |||||||||||||||||||||||||||
| 70 | 0 | $self->timebase_reference(value => 'LEFT'); | |||||||||||||||||||||||||||
| 71 | 0 | $self->timebase_ref_perc(value => 5); | |||||||||||||||||||||||||||
| 72 | 0 | $self->channel_input(channel => $self->instrument_nselect, parameter => $self->input_impedance); | |||||||||||||||||||||||||||
| 73 | 0 | $self->write(command => ":TRIGger:EDGE:SOURce CHANnel".$self->instrument_nselect); | |||||||||||||||||||||||||||
| 74 | 0 | $self->write(command => ":TRIGger:EDGE:SLOPe POSitive"); | |||||||||||||||||||||||||||
| 75 | 0 | $self->write(command => ":MEASure:CLEar"); | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub get_default_channel { | ||||||||||||||||||||||||||
|
Subroutine
get_default_channel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 81 | 0 | return $self->instrument_nselect; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | ### | ||||||||||||||||||||||||||||
| 85 | ### DEBUGGING | ||||||||||||||||||||||||||||
| 86 | ### | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub read_error { | ||||||||||||||||||||||||||
|
Subroutine
read_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 89 | 0 | my ( $self, %args ) = validated_getter( \@_ ); | |||||||||||||||||||||||||||
| 90 | 0 | return $self->query( command => ":SYSTem:ERRor? STRing", %args ); | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub system_debug { | ||||||||||||||||||||||||||
|
Subroutine
system_debug: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | 0 | my ( $self, $output, $filename, %args ) = validated_setter( \@_, | |||||||||||||||||||||||||||
| 95 | output => { isa => enum( [qw/FILE SCReen FileSCReen/]) }, | ||||||||||||||||||||||||||||
| 96 | filename => { isa => 'Str' } | ||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||
| 98 | 0 | $self->write( command => ":SYSTem:DEBug ON,$output,\"$filename\",CREate", %args ); | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub disable_debug { | ||||||||||||||||||||||||||
|
Subroutine
disable_debug: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 102 | 0 | my ( $self, %args ) = validated_getter( \@_); | |||||||||||||||||||||||||||
| 103 | 0 | $self->write( command => ":SYSTem:DEBug OFF", %args ); | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | ### | ||||||||||||||||||||||||||||
| 107 | ### MEASURE | ||||||||||||||||||||||||||||
| 108 | ### | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub save_measurement { | ||||||||||||||||||||||||||
|
Subroutine
save_measurement: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 113 | \@_, | ||||||||||||||||||||||||||||
| 114 | value => { isa => 'Str' } | ||||||||||||||||||||||||||||
| 115 | ); | ||||||||||||||||||||||||||||
| 116 | 0 | $self->write( command => ":DISK:SAVE:MEASurements \"$value\"", %args ); | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub measure_vpp { | ||||||||||||||||||||||||||
|
Subroutine
measure_vpp: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 121 | 0 | my ( $self, $channel, %args ) = validated_getter( \@_ ); | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | return $self->query( command => ":MEASure:VPP? CHANnel${channel}", %args ); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | ### | ||||||||||||||||||||||||||||
| 127 | ### SAVE TO DISK | ||||||||||||||||||||||||||||
| 128 | ### | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub save_waveform { | ||||||||||||||||||||||||||
|
Subroutine
save_waveform: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( \@_, | |||||||||||||||||||||||||||
| 133 | filename => { isa => 'Str'}, | ||||||||||||||||||||||||||||
| 134 | format => { isa => enum( [qw/BIN CSV INTernal TSV TXT H5 H5INt MATlab/])} | ||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||
| 136 | my ( $source, $filename, $format) | ||||||||||||||||||||||||||||
| 137 | 0 | = delete @args{qw/source filename format/}; | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | $self->write( command => ":DISK:SAVE:WAVeform CHANnel${channel},\"$filename\",$format,ON", %args ); | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub save_measurements { | ||||||||||||||||||||||||||
|
Subroutine
save_measurements: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 144 | 0 | my ( $self, %args ) = validated_getter( \@_, | |||||||||||||||||||||||||||
| 145 | filename => { isa => 'Str'} | ||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||
| 147 | 0 | my $filename = delete $args{'filename'}; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | $self->write( command => ":DISK:SAVE:MEASurements \"$filename\"", %args ); | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | ### | ||||||||||||||||||||||||||||
| 153 | ### TRIGGER | ||||||||||||||||||||||||||||
| 154 | ### | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub force_trigger { | ||||||||||||||||||||||||||
|
Subroutine
force_trigger: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 158 | 0 | my ( $self, %args ) = validated_getter( \@_ ); | |||||||||||||||||||||||||||
| 159 | 0 | $self->write( command => ":TRIGger:FORCe", %args ); | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub trigger_level { | ||||||||||||||||||||||||||
|
Subroutine
trigger_level: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 164 | 0 | my ( $self, $channel, $value, %args ) = validated_channel_setter( \@_ ); | |||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | $self->write( command => ":TRIGger:LEVel CHANnel${channel},$value", %args ); | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | ### | ||||||||||||||||||||||||||||
| 170 | ### ACQUIRE | ||||||||||||||||||||||||||||
| 171 | ### | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | ▶ | sub acquire_mode { | ||||||||||||||||||||||||||
|
Subroutine
acquire_mode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 175 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 176 | \@_, | ||||||||||||||||||||||||||||
| 177 | value => { isa => enum( [qw/ETIMe RTIMe PDETect HRESolution SEGMented SEGPdetect SEGHres/])}, | ||||||||||||||||||||||||||||
| 178 | ); | ||||||||||||||||||||||||||||
| 179 | 0 | $self->write( command => ":ACQuire:MODE $value", %args ); | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub acquire_hres { | ||||||||||||||||||||||||||
|
Subroutine
acquire_hres: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 184 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 185 | \@_, | ||||||||||||||||||||||||||||
| 186 | value => { isa => 'Int', default => 0}, | ||||||||||||||||||||||||||||
| 187 | ); | ||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ($value == 0){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 189 | 0 | $self->write( command => ":ACQuire:HRESolution AUTO", %args ); | |||||||||||||||||||||||||||
| 190 | ▶ | } elsif ($value >= 11 and $value <= 16){ | |||||||||||||||||||||||||||
|
Condition0%0/3
$value >= 11 and $value <= 16
MC/DC0%0/2
$value >= 11 and $value <= 16
$value >= 11
$value <= 16
Truth table0%0/3
A and B
A= $value >= 11B= $value <= 16
| |||||||||||||||||||||||||||||
| 191 | 0 | $self->write( command => ":ACQuire:HRESolution BITF$value", %args ); | |||||||||||||||||||||||||||
| 192 | } else { | ||||||||||||||||||||||||||||
| 193 | 0 | croak "The Bit resolution can be 0 (for an automatic choice) or between 11 and 16"; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub acquire_points { | ||||||||||||||||||||||||||
|
Subroutine
acquire_points: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 200 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 201 | \@_, | ||||||||||||||||||||||||||||
| 202 | value => { isa => 'Lab::Moose::PosNum' } | ||||||||||||||||||||||||||||
| 203 | ); | ||||||||||||||||||||||||||||
| 204 | 0 | $self->write( command => ":ACQuire:POINts:ANALog $value", %args ); | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | ### | ||||||||||||||||||||||||||||
| 208 | ### TIMEBASE | ||||||||||||||||||||||||||||
| 209 | ### | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub timebase_range { | ||||||||||||||||||||||||||
|
Subroutine
timebase_range: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 213 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 214 | \@_, | ||||||||||||||||||||||||||||
| 215 | value => { isa => 'Lab::Moose::PosNum' } | ||||||||||||||||||||||||||||
| 216 | ); | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | $self->write( command => ":TIMebase:RANGe $value", %args ); | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub timebase_reference { | ||||||||||||||||||||||||||
|
Subroutine
timebase_reference: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 223 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 224 | \@_, | ||||||||||||||||||||||||||||
| 225 | value => { isa => enum( [qw/LEFT CENTer RIGHt/]) } | ||||||||||||||||||||||||||||
| 226 | ); | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | $self->write( command => ":TIMebase:REFerence $value", %args ); | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub timebase_ref_perc { | ||||||||||||||||||||||||||
|
Subroutine
timebase_ref_perc: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 233 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 234 | \@_, | ||||||||||||||||||||||||||||
| 235 | value => { isa => 'Num' } | ||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ($value > 100 || $value < 0){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$value > 100 or $value < 0
MC/DC0%0/2
$value > 100 or $value < 0
$value > 100
$value < 0
Truth table0%0/3
A or B
A= $value > 100B= $value < 0
| |||||||||||||||||||||||||||||
| 238 | 0 | croak "The offset percentage must be between 0 and 100"; | |||||||||||||||||||||||||||
| 239 | }; | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | $self->write( command => ":TIMebase:REFerence:PERCent $value", %args ); | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 0 | ▶ | sub timebase_clock { | ||||||||||||||||||||||||||
|
Subroutine
timebase_clock: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 246 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 247 | \@_, | ||||||||||||||||||||||||||||
| 248 | value => { isa => enum( [qw/ON 1 OFF 0 HFRequency/]) } | ||||||||||||||||||||||||||||
| 249 | ); | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | $self->write( command => ":TIMebase:REFClock $value", %args ); | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | ### | ||||||||||||||||||||||||||||
| 255 | ### WAVEFORM | ||||||||||||||||||||||||||||
| 256 | ### | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub get_waveform { | ||||||||||||||||||||||||||
|
Subroutine
get_waveform: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 260 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( \@_); | |||||||||||||||||||||||||||
| 261 | 0 | ▶ | if ($channel < 1 or $channel > 4){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$channel < 1 or $channel > 4
MC/DC0%0/2
$channel < 1 or $channel > 4
$channel < 1
$channel > 4
Truth table0%0/3
A or B
A= $channel < 1B= $channel > 4
| |||||||||||||||||||||||||||||
| 262 | 0 | croak "The available channels are 1,2,3 and 4"; | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | # Capture a waveform after the next trigger event | ||||||||||||||||||||||||||||
| 265 | 0 | $self->write(command => ":DIGitize CHANnel${channel}"); | |||||||||||||||||||||||||||
| 266 | 0 | $self->opc_query(); | |||||||||||||||||||||||||||
| 267 | # Query some parameters | ||||||||||||||||||||||||||||
| 268 | 0 | my $yOrg = $self->query(command => ":WAVeform:YORigin?"); | |||||||||||||||||||||||||||
| 269 | 0 | my $yInc = $self->query(command => ":WAVeform:YINCrement?"); | |||||||||||||||||||||||||||
| 270 | 0 | my $xOrg = $self->query(command => ":WAVeform:XORigin?"); | |||||||||||||||||||||||||||
| 271 | 0 | my $xInc = $self->query(command => ":WAVeform:XINCrement?"); | |||||||||||||||||||||||||||
| 272 | 0 | my $points = $self->query(command => ":ACQuire:POINts:ANALog?"); | |||||||||||||||||||||||||||
| 273 | # Compute the required data size in bits depending on the waveform format | ||||||||||||||||||||||||||||
| 274 | 0 | my $format = $self->query(command => ":WAVeform:FORMat?"); | |||||||||||||||||||||||||||
| 275 | 0 | my $fbits; | |||||||||||||||||||||||||||
| 276 | 0 | ▶ | if ($format eq 'BYTE') { $fbits = 8; } elsif ($format eq 'WORD') { $fbits = 16; } | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 277 | 0 | elsif ($format eq 'FLOat') { $fbits = 32; } else { $fbits = 64; } | |||||||||||||||||||||||||||
| 278 | # The read length is the amount of acquired points times the bit count plus | ||||||||||||||||||||||||||||
| 279 | # a small buffer of 128 bits | ||||||||||||||||||||||||||||
| 280 | 0 | my @data = ( split /,/, $self->query( | |||||||||||||||||||||||||||
| 281 | command => ":WAVeform:DATA?", | ||||||||||||||||||||||||||||
| 282 | read_length => $points*$fbits+128 | ||||||||||||||||||||||||||||
| 283 | )); | ||||||||||||||||||||||||||||
| 284 | # Wait for the data download to complete | ||||||||||||||||||||||||||||
| 285 | 0 | $self->opc_query(); | |||||||||||||||||||||||||||
| 286 | # Turn on the display for visual feedback | ||||||||||||||||||||||||||||
| 287 | 0 | $self->write(command => ":CHANnel${channel}:DISPlay ON"); | |||||||||||||||||||||||||||
| 288 | # Rescale the voltage values | ||||||||||||||||||||||||||||
| 289 | 0 | foreach (0..@data-1) {$data[$_] = $data[$_]*$yInc+$yOrg;} | |||||||||||||||||||||||||||
| 290 | # Compute the time axis corresponding to each voltage value | ||||||||||||||||||||||||||||
| 291 | 0 | my @times; | |||||||||||||||||||||||||||
| 292 | 0 | foreach (1..@data) {@times[$_-1] = $_*$xInc+$xOrg} | |||||||||||||||||||||||||||
| 293 | # Return a data block containing both the time and voltage values | ||||||||||||||||||||||||||||
| 294 | 0 | return [\@times, \@data]; | |||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub set_waveform_format { | ||||||||||||||||||||||||||
|
Subroutine
set_waveform_format: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 299 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||||||||||||||||||||
| 300 | \@_, | ||||||||||||||||||||||||||||
| 301 | value => { isa => enum( [qw/ASCii BINary BYTE WORD FLOat/]) } | ||||||||||||||||||||||||||||
| 302 | ); | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 0 | $self->write( command => ":WAVeform:FORMat $value", %args ); | |||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub waveform_source { | ||||||||||||||||||||||||||
|
Subroutine
waveform_source: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 309 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( \@_, ); | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | $self->write( command => ":WAVeform:SOURce CHANnel${channel}", %args ); | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | ### | ||||||||||||||||||||||||||||
| 315 | ### CHANNEL | ||||||||||||||||||||||||||||
| 316 | ### | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 0 | ▶ | sub channel_input { | ||||||||||||||||||||||||||
|
Subroutine
channel_input: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 320 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( | |||||||||||||||||||||||||||
| 321 | \@_, | ||||||||||||||||||||||||||||
| 322 | parameter => { isa => enum( [qw/DC DC50 DCFifty LFR1 LFR2/])} | ||||||||||||||||||||||||||||
| 323 | ); | ||||||||||||||||||||||||||||
| 324 | 0 | my $parameter = delete $args{'parameter'}; | |||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 0 | $self->write( command => ":CHANnel${channel}:INPut $parameter", %args ); | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub channel_differential { | ||||||||||||||||||||||||||
|
Subroutine
channel_differential: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 331 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( | |||||||||||||||||||||||||||
| 332 | \@_, | ||||||||||||||||||||||||||||
| 333 | mode => { isa => 'Bool'} | ||||||||||||||||||||||||||||
| 334 | ); | ||||||||||||||||||||||||||||
| 335 | 0 | my $mode = delete $args{'mode'}; | |||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | $self->write( command => ":CHANnel${channel}:DIFFerential $mode", %args ); | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 0 | ▶ | sub channel_range { | ||||||||||||||||||||||||||
|
Subroutine
channel_range: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 342 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( | |||||||||||||||||||||||||||
| 343 | \@_, | ||||||||||||||||||||||||||||
| 344 | range => { isa => 'Num'} | ||||||||||||||||||||||||||||
| 345 | ); | ||||||||||||||||||||||||||||
| 346 | 0 | my $range = delete $args{'range'}; | |||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | 0 | $self->write( command => ":CHANnel${channel}:RANGe $range", %args ); | |||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | 0 | ▶ | sub channel_offset { | ||||||||||||||||||||||||||
|
Subroutine
channel_offset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 352 | 0 | my ( $self, $channel, %args ) = validated_channel_getter( | |||||||||||||||||||||||||||
| 353 | \@_, | ||||||||||||||||||||||||||||
| 354 | offset => { isa => 'Num'} | ||||||||||||||||||||||||||||
| 355 | ); | ||||||||||||||||||||||||||||
| 356 | 0 | my $offset = delete $args{'offset'}; | |||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 0 | $self->write( command => ":CHANnel${channel}:OFFSet $offset", %args ); | |||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | 1 | with qw( | |||||||||||||||||||||||||||
| 362 | Lab::Moose::Instrument::Common | ||||||||||||||||||||||||||||
| 363 | ); | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 1 | __PACKAGE__->meta()->make_immutable(); | |||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | 1 | 1; | |||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | __END__ | ||||||||||||||||||||||||||||