Moose/Instrument/TBS1000C.pm

filter: Statementstmt 39.7% 29 / 73 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 32.0% 8 / 25 Podpod 93.7% 15 / 16 totaltotal 44.8% 52 / 116 SCAR 10.7
CC
2
Cov
39%
curve_query
6.0
__ANON__
2.0
BUILD
2.0
CRAP 2.9
« Moose/Instrument/SCPI/Sense/Frequency.pm ↑ Summary Instrument/LabViewHeater.pm »
1 package Lab::Moose::Instrument::TBS1000C;
2 1 $Lab::Moose::Instrument::TBS1000C::VERSION = '3.881';
3 #ABSTRACT: Tektronix TBS 1000C 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/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 extends 'Lab::Moose::Instrument';
17  
18 around default_connection_options => sub {
19 0 ▶ my $orig = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 0 my $self = shift;
21 0 my $options = $self->$orig();
22 0 my $usb_opts = { vid => 0x0699, pid => 0x03c4 };
23 0 $options->{USB} = $usb_opts;
24 0 $options->{'VISA::USB'} = $usb_opts;
25 0 return $options;
26 1 };
27  
28 sub BUILD {
29 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
30 0 $self->clear();
31 0 $self->cls();
32 }
33  
34  
35 #
36 # ACQUIRE
37 #
38  
39  
40 sub acquire_state {
41 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine acquire_state: not called CC=1 SCAR=6.9
Pod documented
42 \@_,
43 value => { isa => enum( [qw/0 1/] ) }
44 );
45 0 $self->write( command => "ACQUIRE:STATE $value", %args );
46 }
47  
48 sub acquire_state_query {
49 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine acquire_state_query: not called CC=1 SCAR=6.9
Pod documented
50 0 return $self->query( command => "ACQUIRE:STATE?", %args );
51 }
52  
53  
54 sub acquire_stopafter {
55 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine acquire_stopafter: not called CC=1 SCAR=6.9
Pod documented
56 \@_,
57 value => { isa => enum( [qw/RUNSTOP SEQUENCE/] ) }
58 );
59 0 $self->write( command => "ACQUIRE:STOPAFTER $value", %args );
60 }
61  
62 sub acquire_stopafter_query {
63 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine acquire_stopafter_query: not called CC=1 SCAR=6.9
Pod documented
64 0 return $self->query( command => "ACQUIRE:STOPAFTER?", %args );
65 }
66  
67 #
68 # BUSY
69 #
70  
71  
72 sub busy_query {
73 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine busy_query: not called CC=1 SCAR=6.9
Pod documented
74 0 return $self->query( command => "BUSY?", %args );
75 }
76  
77 #
78 # CURVE
79 #
80  
81  
82 sub curve_query {
83 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine curve_query: not called CC=2 SCAR=17.9
Pod documented
84 0 my $encoding = $self->waveform_output_encoding_query();
85 0 ▶ if ( $encoding ne 'ASCII' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($encoding ne "ASCII") 0 0 0
86 0 croak("only supports ASCII encoding, so far");
87 }
88  
89 0 my $data = $self->query( command => "CURVE?", %args );
90 0 return [ split /,/, $data ];
91 }
92  
93 #
94 # DATA
95 #
96  
97  
98 sub data_source {
99 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine data_source: not called CC=1 SCAR=6.9
Pod documented
100 \@_,
101 value => { isa => enum( [qw/CH1 CH2 MATH REF1 REF2/] ) }
102 );
103 0 $self->write( command => "DATA:SOURCE $value", %args );
104 }
105  
106 sub data_source_query {
107 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine data_source_query: not called CC=1 SCAR=6.9
Pod documented
108 0 return $self->query( command => "DATA:SOURCE?", %args );
109 }
110  
111 #
112 # TRIGGER
113 #
114  
115  
116 sub trigger_query {
117 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine trigger_query: not called CC=1 SCAR=6.9
Pod documented
118 0 return $self->query( command => "TRIGGER:A?", %args );
119 }
120  
121  
122 sub trigger_force {
123 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine trigger_force: not called CC=1 SCAR=6.9
Pod documented
124 0 return $self->write( command => "TRIGGER FORCE", %args );
125 }
126  
127  
128 sub trigger_state_query {
129 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine trigger_state_query: not called CC=1 SCAR=6.9
Pod documented
130 0 return $self->query( command => "TRIGGER:STATE?", %args );
131 }
132  
133  
134 sub trigger_mode {
135 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine trigger_mode: not called CC=1 SCAR=6.9
Pod documented
136 \@_,
137 value => { isa => enum( [qw/AUTO NORMAL/] ) }
138 );
139 0 $self->write( command => "TRIGGER:A:MODE $value", %args );
140 }
141  
142 sub trigger_mode_query {
143 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine trigger_mode_query: not called CC=1 SCAR=6.9
Pod documented
144 0 return $self->query( command => "TRIGGER:A:MODE?", %args );
145 }
146  
147 #
148 # Waveform
149 #
150  
151  
152 sub waveform_output_encoding {
153 0 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine waveform_output_encoding: not called CC=1 SCAR=6.9
Pod documented
154 \@_,
155 value => { isa => enum( [qw/BINARY ASCII/] ) }
156 );
157 0 $self->write( command => "WFMOUTPRE:ENCDG $value", %args );
158 }
159  
160 sub waveform_output_encoding_query {
161 0 ▶ my ( $self, %args ) = validated_getter( \@_, );
Subroutine waveform_output_encoding_query: not called CC=1 SCAR=6.9
Pod documented
162 0 return $self->query( command => "WFMOUTPRE:ENCDG?", %args );
163 }
164  
165 1 with qw(
166 Lab::Moose::Instrument::Common
167 );
168  
169 1 __PACKAGE__->meta()->make_immutable();
170  
171 1 1;
172  
173 __END__
174  
175 =pod
176  
177 =encoding UTF-8
178  
179 =head1 NAME
180  
181 Lab::Moose::Instrument::TBS1000C - Tektronix TBS 1000C series Oscilloscope.
182  
183 =head1 VERSION
184  
185 version 3.881
186  
187 =head1 SYNOPSIS
188  
189 use Lab::Moose;
190  
191 my $tbs = instrument(
192 type => 'TBS1000C',
193 connection_type => 'USB' # For NT-VISA use 'VISA::USB'
194 );
195  
196 # Configure measurement setup
197 $tbs->waveform_output_encoding(value => 'ASCII');
198 $tbs->trigger_mode(value => 'NORMAL');
199 $tbs->data_source(value => 'CH1');
200 $tbs->acquire_stopafter(value => 'SEQUENCE');
201  
202 # Start acquisition
203 $tbs->acquire_state(value =>1);
204  
205 # Waveform will be recorded once triggered
206 # software trigger:
207 # $tbs->trigger_force();
208  
209 # Wait until acquisition is finished
210 $tbs->opc_query();
211
212 # Get waveform as arrayref
213 my $data_block = $tbs->curve_query();
214
215 # Logging multiple blocks into a datafile
216
217 $sweep->log_block(prefix => ..., block => [$block1, $block2]);
218  
219 =head1 METHODS
220  
221 Used roles:
222  
223 =over
224  
225 =item L<Lab::Moose::Instrument::Common>
226  
227 =back
228  
229 =head2 acquire_state/acquire_state_query
230  
231 $tbs->acquire_state(value => 1);
232 say $tbs->acquire_state_query();
233  
234 Allowed values: C<0,1>
235  
236 =head2 acquire_stopafter/acquire_stopafter_query
237  
238 $tbs->acquire_stopafter(value => 'SEQUENCE');
239 say $tbs->acquire_stopafter_query();
240  
241 Allowed values: SEQUENCE, STOPAFTER
242  
243 =head2 busy_query
244  
245 my $busy = $tbs->busy_query();
246  
247 Return 1 if busy, 0 if idle.
248  
249 =head2 curve_query
250  
251 my $data_block = $tbs->curve_query();
252  
253 Get waveform from instrument as arrayref.
254  
255 The channel is defined by the C<data_source> method.
256  
257 =head2 data_source/data_source_query
258  
259 $tbs->data_source(value => 'CH1');
260 say $tbs->data_source_query();
261  
262 Data source for the C<curve_query> method.
263 Allowed values: C<CH1, CH2, MATH, REF1, REF2>
264  
265 =head2 trigger_query
266  
267 my $info = $tbs->trigger_query();
268  
269 Info about trigger setup.
270  
271 =head2 trigger_force
272  
273 $tbs->trigger_force();
274  
275 Force a trigger.
276  
277 =head2 trigger_state_query
278  
279 say $tbs->trigger_state_query();
280  
281 Returns one of C<ARMED, AUTO, READY, SAVE, TRIGGER>.
282  
283 =head2 trigger_mode/trigger_mode_query
284  
285 $tbs->trigger_mode(value => 'NORMAL');
286 say $tbs->trigger_mode_query();
287  
288 Allowed values: C<NORMAL, AUTO>
289  
290 =head2 waveform_output_encoding/waveform_output_encoding_query
291  
292 $tbs->waveform_output_encoding(value => 'ASCII');
293 say $tbs->waveform_output_encoding_query();
294  
295 Allowed values: C<ASCII, BINARY>
296  
297 =head1 COPYRIGHT AND LICENSE
298  
299 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
300  
301 Copyright 2020 Simon Reinhardt
302  
303  
304 This is free software; you can redistribute it and/or modify it under
305 the same terms as the Perl 5 programming language system itself.
306  
307 =cut
« Moose/Instrument/SCPI/Sense/Frequency.pm ↑ Summary Instrument/LabViewHeater.pm »