line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lab::Moose::Instrument::HP33120A; |
2
|
|
|
|
|
|
|
$Lab::Moose::Instrument::HP33120A::VERSION = '3.900'; |
3
|
|
|
|
|
|
|
#ABSTRACT: HP 33120A 15 MHz Arbitrary Waveform Generator, also as voltage source |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
621
|
use v5.20; |
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
8
|
1
|
|
|
1
|
|
5
|
use Time::HiRes qw (usleep); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
141
|
use Moose; |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
11
|
|
10
|
1
|
|
|
1
|
|
6522
|
use Moose::Util::TypeConstraints qw/enum/; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
15
|
|
11
|
1
|
|
|
1
|
|
470
|
use MooseX::Params::Validate; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
15
|
|
12
|
1
|
|
|
|
|
110
|
use Lab::Moose::Instrument qw/ |
13
|
|
|
|
|
|
|
validated_getter |
14
|
|
|
|
|
|
|
validated_setter |
15
|
|
|
|
|
|
|
validated_no_param_setter |
16
|
|
|
|
|
|
|
setter_params |
17
|
1
|
|
|
1
|
|
519
|
/; |
|
1
|
|
|
|
|
6
|
|
18
|
1
|
|
|
1
|
|
8
|
use Lab::Moose::Instrument::Cache; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
19
|
1
|
|
|
1
|
|
685
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
69
|
|
20
|
1
|
|
|
1
|
|
11
|
use namespace::autoclean; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
21
|
1
|
|
|
1
|
|
77
|
use Time::HiRes qw/time usleep/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
20
|
|
22
|
1
|
|
|
1
|
|
107
|
use Lab::Moose 'linspace'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
13
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
extends 'Lab::Moose::Instrument'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has [qw/max_units_per_second max_units_per_step min_units max_units/] => |
28
|
|
|
|
|
|
|
( is => 'ro', isa => 'Num', required => 1 ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has source_level_timestamp => ( |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
isa => 'Num', |
33
|
|
|
|
|
|
|
init_arg => undef, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has verbose => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => 'Bool', |
39
|
|
|
|
|
|
|
default => 1 |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub BUILD { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
0
|
|
|
|
|
|
$self->get_id(); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub get_id { |
48
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
return $self->query( command => sprintf("*IDN?") ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub reset { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
0
|
|
|
|
|
|
$self->write( command => sprintf("*RST") ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub set_frq { |
61
|
0
|
|
|
0
|
1
|
|
my ( $self, $value, %args ) = validated_setter( \@_, |
62
|
|
|
|
|
|
|
value => { isa => 'Num' }, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self->write( command => sprintf("FREQuency %d Hz", $value), %args ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub get_frq { |
70
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return $self->query( command => sprintf("FREQuency?") ); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub set_amplitude { |
77
|
0
|
|
|
0
|
1
|
|
my ( $self, $value, %args ) = validated_setter( \@_, |
78
|
|
|
|
|
|
|
value => { isa => 'Num' }, |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$self->write( command => sprintf("VOLTage %e V", $value) ); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub get_amplitude { |
86
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $self->query( command => sprintf("VOLTage?") ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub set_offset { |
94
|
0
|
|
|
0
|
1
|
|
my ( $self, $value, %args ) = validated_setter( \@_, |
95
|
|
|
|
|
|
|
value => { isa => 'Num' }, |
96
|
|
|
|
|
|
|
); |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
$self->write( command => sprintf("VOLTage:OFFSet %e V", $value) ); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub get_offset { |
103
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
return $self->query( command => "VOLTage:OFFSet?" ); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# |
109
|
|
|
|
|
|
|
# from here on we define the voltage source interface to be able |
110
|
|
|
|
|
|
|
# to use the AWG as replacement for a boring dc source |
111
|
|
|
|
|
|
|
# |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
cache source_level => ( getter => 'source_level_query' ); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub source_level_query { |
116
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
return $self->cached_source_level( |
119
|
|
|
|
|
|
|
$self->get_offset() |
120
|
|
|
|
|
|
|
); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub source_level { |
124
|
0
|
|
|
0
|
0
|
|
my ( $self, $value, %args ) = validated_setter( |
125
|
|
|
|
|
|
|
\@_, |
126
|
|
|
|
|
|
|
value => { isa => 'Num' } |
127
|
|
|
|
|
|
|
); |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
$self->set_offset( value => $value, %args ); |
130
|
0
|
|
|
|
|
|
$self->cached_source_level($value); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub set_level { |
135
|
0
|
|
|
0
|
1
|
|
my ( $self, $value, %args ) = validated_setter( |
136
|
|
|
|
|
|
|
\@_, |
137
|
|
|
|
|
|
|
value => { isa => 'Num' }, |
138
|
|
|
|
|
|
|
); |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return $self->linear_step_sweep( |
141
|
|
|
|
|
|
|
to => $value, verbose => $self->verbose, |
142
|
|
|
|
|
|
|
%args |
143
|
|
|
|
|
|
|
); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub cached_level { |
148
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
149
|
0
|
|
|
|
|
|
return $self->cached_source_level(@_); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub get_level { |
154
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
155
|
0
|
|
|
|
|
|
return $self->source_level_query(@_); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# odds and oods |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub selftest { |
162
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
163
|
0
|
|
|
|
|
|
return $self->query( command => sprintf("*TST?") ); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub display_on { |
167
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
168
|
0
|
|
|
|
|
|
$self->write( command => sprintf("DISPlay ON") ); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub display_off { |
172
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
173
|
0
|
|
|
|
|
|
$self->write( command => sprintf("DISPlay OFF") ); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub set_shape { |
177
|
0
|
|
|
0
|
0
|
|
my ( $self, $value, %args ) = validated_setter( \@_, |
178
|
|
|
|
|
|
|
value => { isa => 'Str' }, |
179
|
|
|
|
|
|
|
); |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
$self->write( command => 'FUNCtion:SHAPe '.$value ); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub get_shape { |
185
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
186
|
0
|
|
|
|
|
|
return $self->query( command => 'FUNCtion:SHAPe?' ); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
with qw( |
191
|
|
|
|
|
|
|
Lab::Moose::Instrument::Common |
192
|
|
|
|
|
|
|
Lab::Moose::Instrument::SCPI::Source::Function |
193
|
|
|
|
|
|
|
Lab::Moose::Instrument::LinearStepSweep |
194
|
|
|
|
|
|
|
); |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
1; |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
__END__ |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=pod |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=encoding UTF-8 |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 NAME |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Lab::Moose::Instrument::HP33120A - HP 33120A 15 MHz Arbitrary Waveform Generator, also as voltage source |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 VERSION |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
version 3.900 |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head1 SYNOPSIS |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
use Lab::Moose; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
# Constructor |
219
|
|
|
|
|
|
|
my $HP = instrument( |
220
|
|
|
|
|
|
|
type => 'HP33120A', |
221
|
|
|
|
|
|
|
connection_type => 'VISA_GPIB', |
222
|
|
|
|
|
|
|
connection_options => { |
223
|
|
|
|
|
|
|
pad => 28, |
224
|
|
|
|
|
|
|
}, |
225
|
|
|
|
|
|
|
); |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 METHODS |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 reset |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
$HP->reset(); |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 set_frq |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
$HP->set_frq( value => ); |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
The frequency can range up to 15MHz |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 get_frq |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
$HP->get_frq(); |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 set_amplitude |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
$HP->set_amplitude( value => ); |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head2 get_amplitude |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
$HP->get_amplitude(); |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 set_offset |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
$HP->set_offset( value => ); |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 get_offset |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
$HP->get_offset(); |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head2 set_level |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
$HP->set_level(value => $new_level); |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Go to new level. Sweep with multiple steps if the distance between current and |
264
|
|
|
|
|
|
|
new level is larger than C<max_units_per_step>. |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head2 cached_level |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
my $current_level = $hp->cached_level(); |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Get current value from device cache. |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head2 get_level |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
my $current_level = $hp->get_level(); |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Query current level. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
Copyright 2023 Andreas K. Huettel |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
286
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=cut |