line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lab::XPRESS::Sweep::Frequency; |
2
|
|
|
|
|
|
|
$Lab::XPRESS::Sweep::Frequency::VERSION = '3.881'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Frequency sweep |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1721
|
use v5.20; |
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Lab::XPRESS::Sweep; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
8
|
1
|
|
|
1
|
|
5
|
use Time::HiRes qw/usleep/, qw/time/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
100
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
493
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = ('Lab::XPRESS::Sweep'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
15
|
0
|
|
|
|
|
|
my @args = @_; |
16
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
17
|
|
|
|
|
|
|
my $self->{default_config} = { |
18
|
0
|
|
|
|
|
|
id => 'Frequency_Sweep', |
19
|
|
|
|
|
|
|
filename_extension => 'FRQ=', |
20
|
|
|
|
|
|
|
interval => 1, |
21
|
|
|
|
|
|
|
points => [], |
22
|
|
|
|
|
|
|
rate => [1], |
23
|
|
|
|
|
|
|
mode => 'step', |
24
|
|
|
|
|
|
|
allowed_instruments => [ |
25
|
|
|
|
|
|
|
qw/ |
26
|
|
|
|
|
|
|
Lab::Instrument::SignalRecovery726x Lab::Instrument::SR830 |
27
|
|
|
|
|
|
|
Lab::Instrument::HP83732A Lab::Instrument::MG369xB |
28
|
|
|
|
|
|
|
Lab::Instrument::RSSMB100A Lab::Moose::Instrument::RS_SMB |
29
|
|
|
|
|
|
|
Lab::Moose::Instrument::ZI_MFIA Lab::Moose::Instrument::ZI_MFLI |
30
|
|
|
|
|
|
|
/ |
31
|
|
|
|
|
|
|
], |
32
|
|
|
|
|
|
|
allowed_sweep_modes => [ 'list', 'step' ], |
33
|
|
|
|
|
|
|
number_of_points => [undef] |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$self = $class->SUPER::new( $self->{default_config}, @args ); |
37
|
0
|
|
|
|
|
|
bless( $self, $class ); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $self; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub go_to_sweep_start { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# go to start: |
46
|
|
|
|
|
|
|
$self->{config}->{instrument} |
47
|
0
|
|
|
|
|
|
->set_frq( { value => @{ $self->{config}->{points} }[0] } ); |
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub start_continuous_sweep { |
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub go_to_next_step { |
58
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$self->{config}->{instrument}->set_frq( |
61
|
0
|
|
|
|
|
|
{ value => @{ $self->{config}->{points} }[ $self->{iterator} ] } ); |
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub exit_loop { |
66
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
if ( $self->{config}->{mode} =~ /step|list/ ) { |
69
|
0
|
0
|
|
|
|
|
if ( |
70
|
|
|
|
|
|
|
not |
71
|
0
|
|
|
|
|
|
defined @{ $self->{config}->{points} }[ $self->{iterator} + 1 ] ) |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
|
|
|
return 1; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
0
|
|
|
|
|
|
return 0; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub get_value { |
82
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
83
|
0
|
|
|
|
|
|
return $self->{config}->{instrument}->get_frq(); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub exit { |
87
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
88
|
0
|
|
|
|
|
|
$self->{config}->{instrument}->abort(); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding UTF-8 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Lab::XPRESS::Sweep::Frequency - Frequency sweep |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 VERSION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
version 3.881 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SYNOPSIS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
use Lab::XPRESS::hub; |
110
|
|
|
|
|
|
|
my $hub = new Lab::XPRESS::hub(); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $Osc = $hub->Instrument('SignalRecovery726x', |
114
|
|
|
|
|
|
|
{ |
115
|
|
|
|
|
|
|
connection_type => 'VISA_GPIB', |
116
|
|
|
|
|
|
|
gpib_address => 2 |
117
|
|
|
|
|
|
|
}); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my $sweep_voltage = $hub->Sweep('Frequency', |
120
|
|
|
|
|
|
|
{ |
121
|
|
|
|
|
|
|
instrument => $Osc, |
122
|
|
|
|
|
|
|
points => [100,1e5], |
123
|
|
|
|
|
|
|
stepwidth => [1e5,100], |
124
|
|
|
|
|
|
|
mode => 'step', |
125
|
|
|
|
|
|
|
backsweep => 0 |
126
|
|
|
|
|
|
|
}); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 DESCRIPTION |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Parent: Lab::XPRESS::Sweep |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The Lab::XPRESS::Sweep::Frequency class implements a module for frequncy sweeps in the Lab::XPRESS::Sweep framework. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my $sweep_voltage = $hub->Sweep('Frequency', |
141
|
|
|
|
|
|
|
{ |
142
|
|
|
|
|
|
|
instrument => $Osc, |
143
|
|
|
|
|
|
|
points => [100,1e5], |
144
|
|
|
|
|
|
|
stepwidth => [1e5,100], |
145
|
|
|
|
|
|
|
mode => 'step', |
146
|
|
|
|
|
|
|
backsweep => 0 |
147
|
|
|
|
|
|
|
}); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Instantiates a new frequency-sweep. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 PARAMETERS |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 instrument [Lab::Instrument] (mandatory) |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Instrument, conducting the sweep. Must be of type Lab:Instrument. |
158
|
|
|
|
|
|
|
Allowed instruments: Lab::Instrument::SignalRecovery726x |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 mode [string] (default = 'step' | 'list') |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
step: measurements will be performed at discrete values of the frequency between start and end points defined in parameter points, seperated by steps defined in parameter stepwidth |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
list: measurements will be performed at a list frequencies defined in parameter points |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 points [float array] (mandatory) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
array of values (in Hz) that defines the characteristic points of the sweep. |
173
|
|
|
|
|
|
|
First value is appraoched before measurement begins. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Case mode => 'step' : |
176
|
|
|
|
|
|
|
Same as in 'continuous' but frequency will be swept in stop and go mode. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Case mode => 'list' : |
179
|
|
|
|
|
|
|
Array of values, with minimum length 1, that are approached in sequence to perform a measurment. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 stepwidth [float array] |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This parameter is relevant only if mode = 'step' has been selected. |
186
|
|
|
|
|
|
|
Stepwidth has to be an array of length '1' or greater. The values define the width for each step within the corresponding sweep sequence. |
187
|
|
|
|
|
|
|
If the length of the defined sweep sequence devided by the stepwidth is not an integer number, the last step will be smaller in order to reach the defined points-value. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
points = [100, 3000, 300] |
190
|
|
|
|
|
|
|
stepwidth = [500, 1000] |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
==> steps: 100, 600, 1100, 1600, 2100, 2600, 3000, 2000, 1000, 300 |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 number_of_points [int array] |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
can be used instead of 'stepwidth'. Attention: Use only the 'number_of_points' or the 'stepwidth' parameter. Using both will cause an Error! |
199
|
|
|
|
|
|
|
This parameter is relevant only if mode = 'step' has been selected. |
200
|
|
|
|
|
|
|
Number_of_points has to be an array of length '1' or greater. The values defines the number of steps within the corresponding sweep sequence. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
points = [100, 3000, 300] |
203
|
|
|
|
|
|
|
number_of_points = [10, 2] |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
==> steps: 100, 390, 680, 970, 1260, 1550, 1840, 2130, 2420, 2710, 3000, 1650, 300 |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 backsweep [int] (default = 0 | 1 | 2) |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
0 : no backsweep (default) |
212
|
|
|
|
|
|
|
1 : a backsweep will be performed |
213
|
|
|
|
|
|
|
2 : no backsweep performed automatically, but sweep sequence will be reverted every second time the sweep is started (relevant eg. if sweep operates as a slave. This way the sweep sequence is reverted at every second step of the master) |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 id [string] (default = 'Frequency_Sweep') |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Just an ID. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 filename_extention [string] (default = 'FRQ=') |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Defines a postfix, that will be appended to the filenames if necessary. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 delay_before_loop [int] (default = 0) |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
defines the time in seconds to wait after the starting point has been reached. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head2 delay_in_loop [int] (default = 0) |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This parameter is relevant only if mode = 'step' or 'list' has been selected. |
238
|
|
|
|
|
|
|
Defines the time in seconds to wait after the value for the next step has been reached. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head2 delay_after_loop [int] (default = 0) |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Defines the time in seconds to wait after the sweep has been finished. This delay will be executed before an optional backsweep or optional repetitions of the sweep. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head1 CAVEATS/BUGS |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
probably none |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 SEE ALSO |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=over 4 |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=item L<Lab::XPRESS::Sweep> |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=back |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
Copyright 2013 Alois Dirnaichner, Andreas K. Huettel, Christian Butschkow, Stefan Geissler |
267
|
|
|
|
|
|
|
2014 Andreas K. Huettel |
268
|
|
|
|
|
|
|
2016 Simon Reinhardt |
269
|
|
|
|
|
|
|
2017 Andreas K. Huettel, Simon Reinhardt |
270
|
|
|
|
|
|
|
2019 Simon Reinhardt |
271
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
275
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=cut |