XPRESS/Sweep/Power.pm

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