line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lab::Moose::Instrument::RS_SMB; |
2
|
|
|
|
|
|
|
$Lab::Moose::Instrument::RS_SMB::VERSION = '3.900'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Rohde & Schwarz SMB Signal Generator |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
2734
|
use v5.20; |
|
2
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Moose; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
19
|
|
9
|
2
|
|
|
2
|
|
15118
|
use Moose::Util::TypeConstraints; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
24
|
|
10
|
2
|
|
|
2
|
|
4580
|
use MooseX::Params::Validate; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
11
|
2
|
|
|
2
|
|
1029
|
use Lab::Moose::Instrument qw/validated_getter validated_setter/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
128
|
|
12
|
2
|
|
|
2
|
|
12
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
132
|
|
13
|
2
|
|
|
2
|
|
489
|
use Lab::Moose::Instrument::Cache; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
15
|
|
14
|
2
|
|
|
2
|
|
1229
|
use namespace::autoclean; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
13
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'Lab::Moose::Instrument'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
around default_connection_options => sub { |
19
|
|
|
|
|
|
|
my $orig = shift; |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
my $options = $self->$orig(); |
22
|
|
|
|
|
|
|
my $usb_opts = { vid => 0x0aad, pid => 0x0054 }; |
23
|
|
|
|
|
|
|
$options->{USB} = $usb_opts; |
24
|
|
|
|
|
|
|
$options->{'VISA::USB'} = $usb_opts; |
25
|
|
|
|
|
|
|
return $options; |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
with qw( |
29
|
|
|
|
|
|
|
Lab::Moose::Instrument::Common |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Lab::Moose::Instrument::SCPI::Source::Power |
32
|
|
|
|
|
|
|
Lab::Moose::Instrument::SCPI::Output::State |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub BUILD { |
36
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
37
|
1
|
|
|
|
|
8
|
$self->clear(); |
38
|
1
|
|
|
|
|
7
|
$self->cls(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
cache source_frequency => ( getter => 'source_frequency_query' ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub source_frequency_query { |
46
|
3
|
|
|
3
|
0
|
1432
|
my ( $self, %args ) = validated_getter( \@_ ); |
47
|
3
|
|
|
|
|
1556
|
return $self->cached_source_frequency( |
48
|
|
|
|
|
|
|
$self->query( command => "FREQ?", %args ) ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub source_frequency { |
52
|
3
|
|
|
3
|
0
|
9929
|
my ( $self, $value, %args ) = validated_setter( |
53
|
|
|
|
|
|
|
\@_, |
54
|
|
|
|
|
|
|
value => { isa => 'Num' }, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
11
|
my $min_freq = 9e3; |
58
|
3
|
50
|
|
|
|
15
|
if ( $value < $min_freq ) { |
59
|
0
|
|
|
|
|
0
|
croak "value smaller than minimal frequency $min_freq"; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
41
|
$self->write( command => sprintf( "FREQ %.17g", $value ), %args ); |
63
|
3
|
|
|
|
|
17
|
$self->cached_source_frequency($value); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub set_power { |
68
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
return $self->source_power_level_immediate_amplitude(@_); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub get_power { |
73
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
return $self->source_power_level_immediate_amplitude_query(@_); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub cached_power { |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
return $self->cached_source_power_level_immediate_amplitude(@_); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub cached_frq { |
84
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
85
|
0
|
|
|
|
|
|
return $self->cached_source_frequency(@_); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# Aliases for Lab::XPRESS::Sweep API |
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub set_frq { |
93
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
94
|
0
|
|
|
|
|
|
return $self->source_frequency(@_); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub get_frq { |
98
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
99
|
0
|
|
|
|
|
|
return $self->source_frequency_query(); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# |
103
|
|
|
|
|
|
|
# Pulse/AM modulation stuff from old RSSMB100A driver; TODO: caching + docs |
104
|
|
|
|
|
|
|
# |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub set_pulselength { |
107
|
0
|
|
|
0
|
0
|
|
my ( $self, $value, %args ) = validated_setter( \@_ ); |
108
|
0
|
|
|
|
|
|
$self->write( command => "PULM:WIDT $value s", %args ); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub get_pulselength { |
112
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
113
|
0
|
|
|
|
|
|
return $self->query( command => "PULM:WIDT?", %args ); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub set_pulseperiod { |
117
|
0
|
|
|
0
|
0
|
|
my ( $self, $value, %args ) = validated_setter( \@_ ); |
118
|
0
|
|
|
|
|
|
$self->write( command => "PULM:PER $value s", %args ); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub get_pulseperiod { |
122
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
123
|
0
|
|
|
|
|
|
return $self->query( command => "PULM:PER?", %args ); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub selftest { |
127
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
128
|
0
|
|
|
|
|
|
return $self->query( command => "*TST?", %args ); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub display_on { |
132
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
133
|
0
|
|
|
|
|
|
$self->write( command => "DISPlay ON", %args ); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub display_off { |
137
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
138
|
0
|
|
|
|
|
|
$self->write( command => "DISPlay OFF", %args ); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub enable_external_am { |
142
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
143
|
0
|
|
|
|
|
|
$self->write( command => "AM:DEPTh MAX", %args ); |
144
|
0
|
|
|
|
|
|
$self->write( command => "AM:SENSitivity 70PCT/VOLT", %args ); |
145
|
0
|
|
|
|
|
|
$self->write( command => "AM:TYPE LINear", %args ); |
146
|
0
|
|
|
|
|
|
$self->write( command => "AM:STATe ON", %args ); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub disable_external_am { |
150
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
151
|
0
|
|
|
|
|
|
$self->write( command => "AM:STATe OFF", %args ); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub enable_internal_pulsemod { |
155
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
156
|
0
|
|
|
|
|
|
$self->write( command => "PULM:SOUR INT", %args ); |
157
|
0
|
|
|
|
|
|
$self->write( command => "PULM:DOUB:STAT OFF", %args ); |
158
|
0
|
|
|
|
|
|
$self->write( command => "PULM:MODE SING", %args ); |
159
|
0
|
|
|
|
|
|
$self->write( command => "PULM:STAT ON", %args ); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub disable_internal_pulsemod { |
163
|
0
|
|
|
0
|
0
|
|
my ( $self, %args ) = validated_getter( \@_ ); |
164
|
0
|
|
|
|
|
|
$self->write( command => "PULM:STAT OFF", %args ); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
1; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
__END__ |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=pod |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=encoding UTF-8 |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 NAME |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Lab::Moose::Instrument::RS_SMB - Rohde & Schwarz SMB Signal Generator |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 VERSION |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
version 3.900 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 SYNOPSIS |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
my $smb = instrument( |
188
|
|
|
|
|
|
|
type => 'RS_SMB', |
189
|
|
|
|
|
|
|
connection_type => 'VXI11', |
190
|
|
|
|
|
|
|
connection_options => {host => '192.168.3.26'}, |
191
|
|
|
|
|
|
|
); |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# Set frequency to 2 GHz |
194
|
|
|
|
|
|
|
$smb->set_frq(value => 2e9); |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# Get frequency from device cache |
197
|
|
|
|
|
|
|
my $frq = $smb->cached_frq(); |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# Set power to -10 dBm |
200
|
|
|
|
|
|
|
$smb->set_power(value => -10); |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 METHODS |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Used roles: |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=over |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item L<Lab::Moose::Instrument::SCPI::Source::Power> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item L<Lab::Moose::Instrument::SCPI::Output::State> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=back |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 get_power/set_power |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
$smb->set_power(value => -10); |
217
|
|
|
|
|
|
|
$power = $smb->get_power(); # or $smb->cached_power(); |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Get set output power (dBm); |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head2 get_frq/set_frq |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
$smb->set_frq(value => 1e6); # 1MHz |
224
|
|
|
|
|
|
|
$frq = $smb->get_frq(); # or $smb->cached_frq(); |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Get/Set output frequency (Hz). |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Copyright 2017 Andreas K. Huettel, Simon Reinhardt |
233
|
|
|
|
|
|
|
2018 Simon Reinhardt |
234
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
238
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |