XPRESS/Sweep/Amplitude.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 74 CC 3 SCAR 14.6
CC
3
Cov
0%
exit_loop
12.0
new
2.0
go_to_sweep_start
2.0
CRAP 4.3
1 package Lab::XPRESS::Sweep::Amplitude;
2 $Lab::XPRESS::Sweep::Amplitude::VERSION = '3.899';
3 #ABSTRACT: Amplitude sweep of AC voltage/current
4  
5 use v5.20;
6  
7 use Lab::XPRESS::Sweep;
8 use Time::HiRes qw/usleep/, qw/time/;
9 use strict;
10  
11 our @ISA = ('Lab::XPRESS::Sweep');
12  
13 sub new {
14 my $proto = shift;
15 my @args = @_;
16 my $class = ref($proto) || $proto;
17 my $self->{default_config} = {
18 id => 'Amplitude_Sweep',
19 filename_extension => 'AMP=',
20 interval => 1,
21 points => [],
22 rate => [1],
23 mode => 'step',
24 allowed_instruments => [
25 qw/Lab::Instrument::SR830 Lab::Moose::Instrument::ZI_MFLI Lab::Moose::Instrument::ZI_MFIA/
26 ],
27 allowed_sweep_modes => [ 'list', 'step' ],
28 number_of_points => [undef]
29 };
30  
31 $self = $class->SUPER::new( $self->{default_config}, @args );
32 bless( $self, $class );
33  
34 return $self;
35 }
36  
37 sub go_to_sweep_start {
38 my $self = shift;
39  
40 # go to start:
41 $self->{config}->{instrument}
42 ->set_amplitude( { value => @{ $self->{config}->{points} }[0] } );
43 }
44  
45 sub start_continuous_sweep {
46 my $self = shift;
47  
48 return;
49  
50 }
51  
52 sub go_to_next_step {
53 my $self = shift;
54  
55 $self->{config}->{instrument}->set_amplitude(
56 { value => @{ $self->{config}->{points} }[ $self->{iterator} ] } );
57  
58 }
59  
60 sub exit_loop {
61 my $self = shift;
62  
63 if ( $self->{config}->{mode} =~ /step|list/ ) {
64 if (
65 not
66 defined @{ $self->{config}->{points} }[ $self->{iterator} + 1 ] )
67 {
68 return 1;
69 }
70 else {
71 return 0;
72 }
73 }
74 }
75  
76 sub get_value {
77 my $self = shift;
78 return $self->{config}->{instrument}->get_amplitude();
79 }
80  
81 sub exit {
82 my $self = shift;
83 $self->{config}->{instrument}->abort();
84 }
85  
86 1;
87  
88 __END__