| 1 | package Lab::XPRESS::Sweep; | ||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | $Lab::XPRESS::Sweep::VERSION = '3.881'; | |||||||||||||||||||||||||||||||||||||||||||
| 3 | #ABSTRACT: Base sweep class | ||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use v5.20; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Role::Tiny::With; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use Time::HiRes qw/usleep/, qw/time/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use POSIX qw(ceil); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | ▶ | use Term::ReadKey; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | use Lab::Generic; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | ▶ | use Lab::XPRESS::Sweep::Dummy; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | ▶ | use Lab::XPRESS::Utilities::Utilities; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 8 | ▶ | use Lab::Exception; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 8 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | 8 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | $Storable::forgive_me = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | 8 | ▶ | use Carp qw(cluck croak); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 8 | our @ISA = ('Lab::Generic'); | |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | 8 | our $PAUSE = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 8 | our $ACTIVE_SWEEPS = (); | |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 8 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | $self->{default_config} = { | ||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | instrument => undef, | |||||||||||||||||||||||||||||||||||||||||||
| 39 | allowed_instruments => [undef], | ||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | interval => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 42 | mode => 'dummy', | ||||||||||||||||||||||||||||||||||||||||||||
| 43 | delay_before_loop => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 44 | delay_in_loop => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 45 | delay_after_loop => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 46 | before_loop => undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | points => [ undef, undef ], | ||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | rate => [undef], | ||||||||||||||||||||||||||||||||||||||||||||
| 51 | duration => [undef], | ||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | stepwidth => [undef], | ||||||||||||||||||||||||||||||||||||||||||||
| 54 | number_of_points => [undef], | ||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | backsweep => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 57 | repetitions => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||
| 59 | separate_files => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 60 | folders => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||
| 62 | filename_extension => '#' | ||||||||||||||||||||||||||||||||||||||||||||
| 63 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | $self->{LOG} = (); | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | @{ $self->{LOG} }[0] = {}; | |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | # deep copy $default_config: | ||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | while ( my ( $k, $v ) = each %{ $self->{default_config} } ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 70 | 36 | ▶ | if ( ref($v) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 12 | $self->{config}->{$k} = (); | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 12 | foreach ( @{$v} ) { | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 14 | push( @{ $self->{config}->{$k} }, $_ ); | |||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 76 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 77 | 24 | $self->{config}->{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | my $type = ref $_[0]; | |||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | 2 | ▶ | if ( $type =~ /HASH/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | %{ $self->{config} } | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | = ( %{ $self->{config} }, %{ shift @_ }, %{ shift @_ } ); | |||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | #for debugging: print config parameters: | ||||||||||||||||||||||||||||||||||||||||||||
| 89 | # while ( my ($k,$v) = each %{$self->{config}} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 90 | # { | ||||||||||||||||||||||||||||||||||||||||||||
| 91 | # print "$k => $v\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 92 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 93 | # print "\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | # print "\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | $self->prepaire_config(); | |||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | $self->{master} = undef; | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | $self->{slaves} = (); | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | $self->{slave_counter} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | $self->{DataFile_counter} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | $self->{DataFiles} = (); | |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | $self->{filenamebase} = (); | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 2 | $self->{filename_extensions} = []; | |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | $self->{pause} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | $self->{active} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | $self->{repetition} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | sub prepaire_config { | ||||||||||||||||||||||||||||||||||||||||||||
| 117 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepaire_config: called CC=59 SCAR=52.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | # deep Copy original Config Data: | ||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | # correct typing errors: | ||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | $self->{config}->{mode} =~ s/\s+//g; #remove all whitespaces | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | $self->{config}->{mode} =~ "\L$self->{config}->{mode}" | |||||||||||||||||||||||||||||||||||||||||||
| 124 | ; # transform all uppercase letters to lowercase letters | ||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | ▶ | if ( $self->{config}->{mode} | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 126 | =~ /continuous|contious|cont|continuouse|continouse|coninuos|continuose/ | ||||||||||||||||||||||||||||||||||||||||||||
| 127 | ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $self->{config}->{mode} = 'continuous'; | |||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | # make an Array out of single values if necessary: | ||||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | if ( ref( $self->{config}->{points} ) ne 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $self->{config}->{points} = [ $self->{config}->{points} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | ▶ | if ( ref( $self->{config}->{rate} ) ne 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{config}->{rate} = [ $self->{config}->{rate} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | ▶ | if ( ref( $self->{config}->{duration} ) ne 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $self->{config}->{duration} = [ $self->{config}->{duration} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | if ( ref( $self->{config}->{stepwidth} ) ne 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $self->{config}->{stepwidth} = [ $self->{config}->{stepwidth} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 144 | 2 | ▶ | if ( ref( $self->{config}->{number_of_points} ) ne 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 145 | $self->{config}->{number_of_points} | ||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | = [ $self->{config}->{number_of_points} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | ▶ | if ( ref( $self->{config}->{interval} ) ne 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | $self->{config}->{interval} = [ $self->{config}->{interval} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | $self->{config_original} = dclone( $self->{config} ); | |||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | # calculate the length of each Array: | ||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | my $length_points = @{ $self->{config}->{points} }; | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 2 | my $length_rate = @{ $self->{config}->{rate} }; | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | my $length_duration = @{ $self->{config}->{duration} }; | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | my $length_stepwidth = @{ $self->{config}->{stepwidth} }; | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | my $length_number_of_points = @{ $self->{config}->{number_of_points} }; | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | my $length_interval = @{ $self->{config}->{interval} }; | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | # Look for inconsistent sweep parameters: | ||||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | ▶ | if ( $length_points < 2 and $self->{config}->{mode} ne 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$length_points < 2 and $self->{"config"}{"mode"} ne "list"
MC/DC0%0/2
$length_points < 2 and $self->{"config"}{"mode"} ne "list"
$length_points < 2
$self->{"config"}{"mode"} ne "list"
Truth table33%1/3
A and B
A= $length_points < 2B= $self->{"config"}{"mode"} ne "list"
| |||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 165 | "inconsistent definition of sweep_config_data: less than two elements defined in 'points'. You need at least a 'start' and a 'stop' point."; | ||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | ▶ | if ( $length_rate > $length_points ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 170 | "inconsistent definition of sweep_config_data: number of elements in 'rate' larger than number of elements in 'points'."; | ||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | ▶ | if ( $length_duration > $length_points ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 174 | "inconsistent definition of sweep_config_data: number of elements in 'duration' larger than number of elements in 'points'."; | ||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | ▶ | if ( $length_stepwidth > $length_points - 1 | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$length_stepwidth > $length_points - 1 and $self->{"config"}{"mode"} ne "list"
MC/DC0%0/2
$length_stepwidth > $length_points - 1 and $self->{"config"}{"mode"} ne "list"
$length_stepwidth > $length_points - 1
$self->{"config"}{"mode"} ne "list"
Truth table33%1/3
A and B
A= $length_stepwidth > $length_points - 1B= $self->{"config"}{"mode"} ne "list"
| |||||||||||||||||||||||||||||||||||||||||||||
| 177 | and $self->{config}->{mode} ne 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 179 | "inconsistent definition of sweep_config_data: number of elements in 'stepwidth' larger than number of sweep sequences."; | ||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | ▶ | if ( $length_number_of_points > $length_points - 1 | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$length_number_of_points > $length_points - 1 and $self->{"config"}{"mode"} ne "list"
MC/DC0%0/2
$length_number_of_points > $length_points - 1 and $self->{"config"}{"mode"} ne "list"
$length_number_of_points > $length_points - 1
$self->{"config"}{"mode"} ne "list"
Truth table33%1/3
A and B
A= $length_number_of_points > $length_points - 1B= $self->{"config"}{"mode"} ne "list"
| |||||||||||||||||||||||||||||||||||||||||||||
| 182 | and $self->{config}->{mode} ne 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 184 | "inconsistent definition of sweep_config_data: number of elements in 'number_of_points' larger than number of sweep sequences."; | ||||||||||||||||||||||||||||||||||||||||||||
| 185 | } # | ||||||||||||||||||||||||||||||||||||||||||||
| 186 | 2 | ▶ | if ( $length_interval > $length_points | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$length_interval > $length_points and $self->{"config"}{"mode"} ne "list"
MC/DC0%0/2
$length_interval > $length_points and $self->{"config"}{"mode"} ne "list"
$length_interval > $length_points
$self->{"config"}{"mode"} ne "list"
Truth table33%1/3
A and B
A= $length_interval > $length_pointsB= $self->{"config"}{"mode"} ne "list"
| |||||||||||||||||||||||||||||||||||||||||||||
| 187 | and $self->{config}->{mode} ne 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 189 | "inconsistent definition of sweep_config_data: number of elements in 'interval' larger than number of sweep sequences."; | ||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | # fill up Arrays to fit with given Points: | ||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | ▶ | while ( ( $length_rate = @{ $self->{config}->{rate} } ) < $length_points ) | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||||
| 195 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | @{ $self->{config}->{rate} }, | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 2 | @{ $self->{config}->{rate} }[-1] | |||||||||||||||||||||||||||||||||||||||||||
| 198 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | ▶ | while ( ( $length_duration = @{ $self->{config}->{duration} } ) | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 202 | < $length_points ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 203 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 204 | 4 | @{ $self->{config}->{duration} }, | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | @{ $self->{config}->{duration} }[-1] | |||||||||||||||||||||||||||||||||||||||||||
| 206 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | ▶ | while ( ( $length_stepwidth = @{ $self->{config}->{stepwidth} } ) | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 210 | < $length_points ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 211 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 212 | 2 | @{ $self->{config}->{stepwidth} }, | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | @{ $self->{config}->{stepwidth} }[-1] | |||||||||||||||||||||||||||||||||||||||||||
| 214 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 218 | ( | ||||||||||||||||||||||||||||||||||||||||||||
| 219 | $length_number_of_points | ||||||||||||||||||||||||||||||||||||||||||||
| 220 | 4 | = @{ $self->{config}->{number_of_points} } | |||||||||||||||||||||||||||||||||||||||||||
| 221 | ) < $length_points | ||||||||||||||||||||||||||||||||||||||||||||
| 222 | ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 223 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | @{ $self->{config}->{number_of_points} }, | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 2 | @{ $self->{config}->{number_of_points} }[-1] | |||||||||||||||||||||||||||||||||||||||||||
| 226 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | ▶ | while ( ( $length_interval = @{ $self->{config}->{interval} } ) | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 230 | < $length_points ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 231 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | @{ $self->{config}->{interval} }, | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 2 | @{ $self->{config}->{interval} }[-1] | |||||||||||||||||||||||||||||||||||||||||||
| 234 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | # calculate the length of each Array again: | ||||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | my $length_points = @{ $self->{config}->{points} }; | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | my $length_rate = @{ $self->{config}->{rate} }; | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | my $length_duration = @{ $self->{config}->{duration} }; | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | my $length_stepwidth = @{ $self->{config}->{stepwidth} }; | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 2 | my $length_number_of_points = @{ $self->{config}->{number_of_points} }; | |||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||
| 244 | # evaluate sweep sign: | ||||||||||||||||||||||||||||||||||||||||||||
| 245 | 2 | foreach my $i ( 0 .. $length_points - 2 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | ▶ | if ( @{ $self->{config}->{points} }[$i] | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | - @{ $self->{config}->{points} }[ $i + 1 ] < 0 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 2 | @{ $self->{config}->{sweepsigns} }[$i] = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | elsif ( @{ $self->{config}->{points} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | - @{ $self->{config}->{points} }[ $i + 1 ] > 0 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | @{ $self->{config}->{sweepsigns} }[$i] = -1; | |||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 254 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | @{ $self->{config}->{sweepsigns} }[$i] = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||
| 259 | # add current position to Points-Array: | ||||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | unshift( @{ $self->{config}->{points} }, $self->get_value() ); | |||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||
| 262 | # calculate duration from rate and vise versa: | ||||||||||||||||||||||||||||||||||||||||||||
| 263 | 2 | ▶ | if ( defined @{ $self->{config}->{rate} }[0] | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition33%1/3
defined @{$$self{"config"}{"rate"};}[0] and defined @{$$self{"config"}{"duration"};}[0]
MC/DC0%0/2
defined @{$$self{"config"}{"rate"};}[0] and defined @{$$self{"config"}{"duration"};}[0]
defined @{$$self{"config"}{"rate"};}[0]
defined @{$$self{"config"}{"duration"};}[0]
Truth table33%1/3
A and B
A= defined @{$$self{"config"}{"rate"};}[0]B= defined @{$$self{"config"}{"duration"};}[0]
| |||||||||||||||||||||||||||||||||||||||||||||
| 264 | 2 | and defined @{ $self->{config}->{duration} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 'inconsistent definition of sweep_config_data: rate as well as duration defined. Use only one of both.'; | ||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | ▶ | elsif ( defined @{ $self->{config}->{duration} }[0] | ||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined @{$$self{"config"}{"duration"};}[0] and @{$$self{"config"}{"duration"};}[0] == 0
MC/DC0%0/2
defined @{$$self{"config"}{"duration"};}[0] and @{$$self{"config"}{"duration"};}[0] == 0
defined @{$$self{"config"}{"duration"};}[0]
@{$$self{"config"}{"duration"};}[0] == 0
Truth table33%1/3
A and B
A= defined @{$$self{"config"}{"duration"};}[0]B= @{$$self{"config"}{"duration"};}[0] == 0
| |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | and @{ $self->{config}->{duration} }[0] == 0 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | die 'bad definition of sweep parameters: duration == 0 not allowed'; | |||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 272 | 2 | ▶ | elsif ( defined @{ $self->{config}->{rate} }[0] | ||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined @{$$self{"config"}{"rate"};}[0] and @{$$self{"config"}{"rate"};}[0] == 0
MC/DC0%0/2
defined @{$$self{"config"}{"rate"};}[0] and @{$$self{"config"}{"rate"};}[0] == 0
defined @{$$self{"config"}{"rate"};}[0]
@{$$self{"config"}{"rate"};}[0] == 0
Truth table33%1/3
A and B
A= defined @{$$self{"config"}{"rate"};}[0]B= @{$$self{"config"}{"rate"};}[0] == 0
| |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 2 | and @{ $self->{config}->{rate} }[0] == 0 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | die 'bad definition of sweep parameters: rate == 0 not allowed'; | |||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 276 | 2 | elsif ( defined @{ $self->{config}->{duration} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | foreach my $i ( 0 .. $length_points - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | @{ $self->{config}->{rate} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | = abs(@{ $self->{config}->{points} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | - @{ $self->{config}->{points} }[$i] ) | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | / @{ $self->{config}->{duration} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 284 | 2 | elsif ( defined @{ $self->{config}->{rate} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | foreach my $i ( 0 .. $length_points - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 4 | @{ $self->{config}->{duration} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 4 | = abs(@{ $self->{config}->{points} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 4 | - @{ $self->{config}->{points} }[$i] ) | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 4 | / @{ $self->{config}->{rate} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||
| 293 | # calculate stepwidth from Number_of_Points and vise versa: | ||||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | ▶ | if ( defined @{ $self->{config}->{stepwidth} }[0] | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
defined @{$$self{"config"}{"stepwidth"};}[0] and defined @{$$self{"config"}{"number_of_points"};}[0]
MC/DC0%0/2
defined @{$$self{"config"}{"stepwidth"};}[0] and defined @{$$self{"config"}{"number_of_points"};}[0]
defined @{$$self{"config"}{"stepwidth"};}[0]
defined @{$$self{"config"}{"number_of_points"};}[0]
Truth table33%1/3
A and B
A= defined @{$$self{"config"}{"stepwidth"};}[0]B= defined @{$$self{"config"}{"number_of_points"};}[0]
| |||||||||||||||||||||||||||||||||||||||||||||
| 295 | 2 | and defined @{ $self->{config}->{number_of_points} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 'inconsistent definition of sweep_config_data: step as well as number_of_points defined. Use only one of both.'; | ||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 299 | 2 | elsif ( defined @{ $self->{config}->{number_of_points} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | unshift( @{ $self->{config}->{number_of_points} }, 1 ); | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | foreach my $i ( 1 .. $length_points - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | @{ $self->{config}->{stepwidth} }[ $i - 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | = abs(@{ $self->{config}->{points} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | - @{ $self->{config}->{points} }[$i] ) | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | / @{ $self->{config}->{number_of_points} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | elsif ( defined @{ $self->{config}->{stepwidth} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | foreach my $i ( 1 .. $length_points - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | @{ $self->{config}->{number_of_points} }[ $i - 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 2 | = abs(@{ $self->{config}->{points} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 2 | - @{ $self->{config}->{points} }[$i] ) | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 2 | / @{ $self->{config}->{stepwidth} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | shift @{ $self->{config}->{points} }; | |||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||
| 318 | # Calculations and checks depending on the selected sweep mode: | ||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | ▶ | if ( $self->{config}->{mode} eq 'continuous' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | if ( not defined @{ $self->{config}->{rate} }[0] | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined @{$$self{"config"}{"rate"};}[0] and defined @{$$self{"config"}{"duration"};}[0]
MC/DC0%0/2
defined @{$$self{"config"}{"rate"};}[0] and defined @{$$self{"config"}{"duration"};}[0]
defined @{$$self{"config"}{"rate"};}[0]
defined @{$$self{"config"}{"duration"};}[0]
Truth table0%0/3
A and B
A= defined @{$$self{"config"}{"rate"};}[0]B= defined @{$$self{"config"}{"duration"};}[0]
| |||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | or not defined @{ $self->{config}->{duration} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 323 | "inconsistent definition of sweep_config_data: for sweep_mode 'continuous' you have to define the rate or the duration for the sweep."; | ||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 326 | elsif ( $self->{config}->{mode} eq 'step' ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | $self->{config}->{interval} = [0]; | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 2 | ▶ | if ( not defined @{ $self->{config}->{stepwidth} }[0] | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined @{$$self{"config"}{"stepwidth"};}[0] and defined @{$$self{"config"}{"number_of_points"};}[0]
MC/DC0%0/2
defined @{$$self{"config"}{"stepwidth"};}[0] and defined @{$$self{"config"}{"number_of_points"};}[0]
defined @{$$self{"config"}{"stepwidth"};}[0]
defined @{$$self{"config"}{"number_of_points"};}[0]
Truth table33%1/3
A and B
A= defined @{$$self{"config"}{"stepwidth"};}[0]B= defined @{$$self{"config"}{"number_of_points"};}[0]
| |||||||||||||||||||||||||||||||||||||||||||||
| 329 | 2 | or not defined @{ $self->{config}->{number_of_points} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 331 | "inconsistent definition of sweep_config_data: for sweep_mode 'step' you have to define the setp-size or the number_of_points."; | ||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | # calculate each point/rate/stepsign/duration in step-sweep: | ||||||||||||||||||||||||||||||||||||||||||||
| 335 | 2 | my $temp_points = (); | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 2 | my $temp_rate = (); | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 2 | my $temp_sweepsigns = (); | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 2 | my $temp_duration = (); | |||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||
| 340 | 2 | foreach my $i ( 0 .. $length_points - 2 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 341 | my $nop = abs( | ||||||||||||||||||||||||||||||||||||||||||||
| 342 | ( | ||||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | @{ $self->{config}->{points} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | - @{ $self->{config}->{points} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | ) / @{ $self->{config}->{stepwidth} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 346 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | $nop = ceil($nop); | |||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||
| 349 | 2 | my $point = @{ $self->{config}->{points} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 2 | ▶ | for ( my $j = 0; $j <= $nop; $j++ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 351 | 22 | ▶ | if ( $point != @{$temp_points}[-1] | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$point != @{$temp_points;}[-1] or not defined @{$temp_points;}[-1]
MC/DC0%0/2
$point != @{$temp_points;}[-1] or not defined @{$temp_points;}[-1]
$point != @{$temp_points;}[-1]
not defined @{$temp_points;}[-1]
Truth table66%2/3
A or not(B)
A= $point != @{$temp_points;}[-1]B= not defined @{$temp_points;}[-1]
| |||||||||||||||||||||||||||||||||||||||||||||
| 352 | 2 | or not defined @{$temp_points}[-1] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 22 | push( @{$temp_points}, $point ); | |||||||||||||||||||||||||||||||||||||||||||
| 354 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 355 | 22 | @{$temp_rate}, | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 22 | @{ $self->{config}->{rate} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 357 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 358 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 359 | 22 | @{$temp_duration}, | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 22 | @{ $self->{config}->{duration} }[ $i + 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 22 | / @{ $self->{config}->{number_of_points} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 362 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 363 | push( | ||||||||||||||||||||||||||||||||||||||||||||
| 364 | 22 | @{$temp_sweepsigns}, | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 22 | @{ $self->{config}->{sweepsigns} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 366 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 368 | 22 | $point += @{ $self->{config}->{stepwidth} }[$i] | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 22 | * @{ $self->{config}->{sweepsigns} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 371 | 2 | @{$temp_points}[-1] = @{ $self->{config}->{points} }[ $i + 1 ]; | |||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 373 | 2 | pop @{$temp_rate}; | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 2 | pop @{$temp_duration}; | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 2 | pop @{$temp_sweepsigns}; | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 2 | unshift( @{$temp_rate}, @{ $self->{config}->{rate} }[0] ); | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 2 | unshift( @{$temp_duration}, @{ $self->{config}->{duration} }[0] ); | |||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||
| 379 | #unshift ( @{$temp_sweepsigns}, @{$self->{config}->{sweepsigns}}[0]); | ||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||
| 381 | 2 | $self->{config}->{points} = $temp_points; | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 2 | $self->{config}->{rate} = $temp_rate; | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 2 | $self->{config}->{duration} = $temp_duration; | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 2 | $self->{config}->{sweepsigns} = $temp_sweepsigns; | |||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 386 | elsif ( $self->{config}->{mode} eq 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $self->{config}->{interval} = [0]; | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ( not defined @{ $self->{config}->{rate} }[0] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 390 | "inconsistent definition of sweep_config_data: 'rate' needs to be defined in sweep mode 'list'"; | ||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||
| 394 | # check if instrument is supported: | ||||||||||||||||||||||||||||||||||||||||||||
| 395 | 2 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined @{$$self{"config"}{"allowed_instruments"};}[0] and not grep({$_ eq ref $self->{"config"}{"instrument"};} @{$$self{"config"}{"allowed_instruments"};})
MC/DC0%0/2
defined @{$$self{"config"}{"allowed_instruments"};}[0] and not grep({$_ eq ref $self->{"config"}{"instrument"};} @{$$self{"config"}{"allowed_instruments"};})
defined @{$$self{"config"}{"allowed_instruments"};}[0]
not grep({$_ eq ref $self->{"config"}{"instrument"};} @{$$self{"config"}{"allowed_instruments"};})
Truth table33%1/3
A and not(B)
A= defined @{$$self{"config"}{"allowed_instruments"};}[0]B= not grep({$_ eq ref $self->{"config"}{"instrument"};} @{$$self{"config"}{"allowed_instruments"};})
| |||||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | defined @{ $self->{config}->{allowed_instruments} }[0] | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 19 | and not( grep { $_ eq ref( $self->{config}->{instrument} ) } | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 2 | @{ $self->{config}->{allowed_instruments} } ) | |||||||||||||||||||||||||||||||||||||||||||
| 399 | ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 401 | "inconsistent definition of sweep_config_data: Instrument (ref($self->{config}->{instrument})) is not supported by Sweep."; | ||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||
| 404 | # check if sweep-mode is supported: | ||||||||||||||||||||||||||||||||||||||||||||
| 405 | 2 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined @{$$self{"config"}{"allowed_sweep_modes"};}[0] and not grep({$_ eq $self->{"config"}{"mode"};} @{$$self{"config"}{"allowed_sweep_modes"};})
MC/DC0%0/2
defined @{$$self{"config"}{"allowed_sweep_modes"};}[0] and not grep({$_ eq $self->{"config"}{"mode"};} @{$$self{"config"}{"allowed_sweep_modes"};})
defined @{$$self{"config"}{"allowed_sweep_modes"};}[0]
not grep({$_ eq $self->{"config"}{"mode"};} @{$$self{"config"}{"allowed_sweep_modes"};})
Truth table33%1/3
A and not(B)
A= defined @{$$self{"config"}{"allowed_sweep_modes"};}[0]B= not grep({$_ eq $self->{"config"}{"mode"};} @{$$self{"config"}{"allowed_sweep_modes"};})
| |||||||||||||||||||||||||||||||||||||||||||||
| 406 | 2 | defined @{ $self->{config}->{allowed_sweep_modes} }[0] | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 6 | and not( grep { $_ eq $self->{config}->{mode} } | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | @{ $self->{config}->{allowed_sweep_modes} } ) | |||||||||||||||||||||||||||||||||||||||||||
| 409 | ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||
| 411 | "inconsistent definition of sweep_config_data: Sweep mode $self->{config}->{mode} is not supported by Sweep."; | ||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||
| 414 | # adjust repetitions in case of Backsweep selected: | ||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2 | ▶ | if ( $self->{config}->{backsweep} == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | $self->{config}->{repetitions} *= 2; | |||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||
| 422 | sub prepare_backsweep { | ||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_backsweep: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $points = (); | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $rates = (); | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my $durations = (); | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | foreach my $point ( @{ $self->{config}->{points} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | unshift( @{$points}, $point ); | |||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | foreach my $rate ( @{ $self->{config}->{rate} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | unshift( @{$rates}, $rate ); | |||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | foreach my $duration ( @{ $self->{config}->{duration} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | unshift( @{$durations}, $duration ); | |||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | unshift( @{$rates}, pop( @{$rates} ) ); | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | unshift( @{$durations}, 0 ); | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | pop( @{$durations} ); | |||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||
| 441 | #print "Points @{$points} \n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 442 | #print "rate @{$rate} \n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 443 | #print "duration @{$duration} \n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | $self->{config}->{points} = $points; | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $self->{config}->{rate} = $rates; | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $self->{config}->{duration} = $durations; | |||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||
| 450 | sub add_DataFile { | ||||||||||||||||||||||||||||||||||||||||||||
| 451 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_DataFile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | my $DataFile = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||
| 454 | 2 | push( @{ $self->{filenamebase} }, $DataFile->{filenamebase} ); | |||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||
| 456 | 2 | push( @{ $self->{DataFiles} }, $DataFile ); | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | $self->{DataFile_counter}++; | |||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||
| 459 | 2 | @{ $self->{LOG} }[ $self->{DataFile_counter} ] = {}; | |||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||
| 461 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||
| 464 | sub start { | ||||||||||||||||||||||||||||||||||||||||||||
| 465 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=26 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 466 | 2 | ReadMode('cbreak'); | |||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | unshift( @{$ACTIVE_SWEEPS}, $self ); | |||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||
| 470 | # calculate duration for the defined sweep: | ||||||||||||||||||||||||||||||||||||||||||||
| 471 | #$self->estimate_sweep_duration(); | ||||||||||||||||||||||||||||||||||||||||||||
| 472 | 2 | foreach my $slave ( @{ $self->{slaves} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||
| 474 | #$slave->estimate_sweep_duration(); | ||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||
| 477 | # show estimated sweep duration: | ||||||||||||||||||||||||||||||||||||||||||||
| 478 | #my $sweep_structure = $self->sweep_structure(); | ||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||
| 480 | # create header for each DataFile: | ||||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | foreach my $file ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 2 | foreach my $instrument ( @{ ${Lab::Instrument::INSTRUMENTS} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||
| 484 | #print $instrument."\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $file->add_header( $instrument->create_header() ); | |||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||
| 489 | 2 | ▶ | if ( not defined @{ $self->{slaves} }[0] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 490 | 2 | ▶ | if ( $self->{DataFile_counter} <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | print new Lab::Exception::Warning( error => "Attention: " | |||||||||||||||||||||||||||||||||||||||||||
| 492 | . ref($self) | ||||||||||||||||||||||||||||||||||||||||||||
| 493 | . " has no DataFile ! \n" ); | ||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 495 | 2 | ▶ | if ( defined @{ $self->{filename_extensions} }[0] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | foreach my $DataFile ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $filenamebase = $DataFile->{filenamebase}; | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $new_filenamebase | |||||||||||||||||||||||||||||||||||||||||||
| 499 | = $self->add_filename_extensions($filenamebase); | ||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | if ( $new_filenamebase ne $DataFile->{file} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $DataFile->change_filenamebase($new_filenamebase); | |||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||
| 506 | # elsif ($self->{config}->{separate_files} == 1) { | ||||||||||||||||||||||||||||||||||||||||||||
| 507 | # foreach my $DataFile (@{$self->{DataFiles}}) { | ||||||||||||||||||||||||||||||||||||||||||||
| 508 | # my $filenamebase = $DataFile->{filenamebase}; | ||||||||||||||||||||||||||||||||||||||||||||
| 509 | # $DataFile->change_filenamebase($filenamebase); | ||||||||||||||||||||||||||||||||||||||||||||
| 510 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 511 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||
| 515 | # link break signals to default functions: | ||||||||||||||||||||||||||||||||||||||||||||
| 516 | 2 | $SIG{BREAK} = \&enable_pause; | |||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||
| 518 | #$SIG{INT} = \&abort; | ||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | ▶ | for ( | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$i <= $self->{"config"}{"repetitions"} or $self->{"config"}{"repetitions"} < 0
MC/DC50%1/2
$i <= $self->{"config"}{"repetitions"} or $self->{"config"}{"repetitions"} < 0
$i <= $self->{"config"}{"repetitions"}
$self->{"config"}{"repetitions"} < 0
Truth table66%2/3
A or B
A= $i <= $self->{"config"}{"repetitions"}B= $self->{"config"}{"repetitions"} < 0
| |||||||||||||||||||||||||||||||||||||||||||||
| 521 | my $i = 1; | ||||||||||||||||||||||||||||||||||||||||||||
| 522 | ( $i <= $self->{config}->{repetitions} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 523 | or ( $self->{config}->{repetitions} < 0 ); | ||||||||||||||||||||||||||||||||||||||||||||
| 524 | $i++ | ||||||||||||||||||||||||||||||||||||||||||||
| 525 | ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 526 | 2 | $self->{repetition}++; | |||||||||||||||||||||||||||||||||||||||||||
| 527 | 2 | foreach my $file ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 2 | $file->start_block(); | |||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 530 | 2 | $self->{iterator} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | $self->{sequence} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 2 | $self->before_loop(); | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 2 | $self->go_to_sweep_start(); | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 2 | $self->delay( $self->{config}->{delay_before_loop} ); | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | my $before_loop = $self->{config}{before_loop}; | |||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||
| 537 | 2 | ▶ | if ($before_loop) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | if ( ref $before_loop ne 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | croak "'before_loop' argument must be a coderef"; | |||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $self->$before_loop(); | |||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||
| 544 | # continuous sweep: | ||||||||||||||||||||||||||||||||||||||||||||
| 545 | 2 | ▶ | if ( $self->{config}->{mode} eq 'continuous' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->start_continuous_sweep(); | |||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 548 | 2 | $self->{Time_start} = time(); | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 2 | $self->{Date_start}, $self->{TimeStamp_start} = timestamp(); | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 2 | $self->{loop}->{t0} = $self->{Time_start}; | |||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||
| 552 | 2 | $self->{active} = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||
| 554 | 2 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||
| 555 | 22 | $self->in_loop(); | |||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||
| 557 | # step mode: | ||||||||||||||||||||||||||||||||||||||||||||
| 558 | 22 | ▶ | if ( $self->{config}->{mode} =~ /step|list/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 559 | 22 | $self->go_to_next_step(); | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 22 | $self->delay( $self->{config}->{delay_in_loop} ); | |||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 562 | 22 | $self->{Time} = time() - $self->{Time_start}; | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 22 | $self->{Date}, $self->{TimeStamp} = timestamp(); | |||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||
| 565 | # Master mode: call slave measurements if defined | ||||||||||||||||||||||||||||||||||||||||||||
| 566 | 22 | ▶ | if ( defined @{ $self->{slaves} }[0] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | my $extension = $self->get_filename_extension(); | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | foreach my $slave ( @{ $self->{slaves} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||
| 570 | my $extensions | ||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | = dclone( \@{ $self->{filename_extensions} } ); | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | push( @{$extensions}, $extension ); | |||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $slave->{filename_extensions} = $extensions; | |||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $slave->start($self); | |||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||
| 580 | # Slave mode: do measurement | ||||||||||||||||||||||||||||||||||||||||||||
| 581 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 582 | 22 | my $i = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 583 | 22 | foreach my $DataFile ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||
| 585 | 22 | $DataFile->{measurement}->($self); | |||||||||||||||||||||||||||||||||||||||||||
| 586 | 22 | ▶ | if ( $DataFile->{autolog} == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 587 | 22 | $DataFile->LOG( $self->create_LOG_HASH($i) ); | |||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||
| 590 | 22 | $i++; | |||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||
| 594 | # exit loop: | ||||||||||||||||||||||||||||||||||||||||||||
| 595 | 22 | ▶ | if ( $self->exit_loop() or $self->{last} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->exit_loop or $self->{"last"}
MC/DC50%1/2
$self->exit_loop or $self->{"last"}
$self->exit_loop
$self->{"last"}
Truth table66%2/3
A or B
A= $self->exit_loopB= $self->{"last"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 596 | 2 | $self->{last} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 597 | 2 | last; | |||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||
| 600 | # pause: | ||||||||||||||||||||||||||||||||||||||||||||
| 601 | 20 | ▶ | if ( $self->{config}->{mode} =~ /step|list/ and $PAUSE ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"config"}{"mode"} =~ /step|list/u and $Lab::XPRESS::Sweep::PAUSE
MC/DC0%0/2
$self->{"config"}{"mode"} =~ /step|list/u and $Lab::XPRESS::Sweep::PAUSE
$self->{"config"}{"mode"} =~ /step|list/u
$Lab::XPRESS::Sweep::PAUSE
Truth table33%1/3
A and B
A= $self->{"config"}{"mode"} =~ /step|list/uB= $Lab::XPRESS::Sweep::PAUSE
| |||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $self->pause(); | |||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | $PAUSE = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||
| 606 | # check loop duratioin: | ||||||||||||||||||||||||||||||||||||||||||||
| 607 | 20 | $self->{iterator}++; | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 20 | $self->check_loop_duration(); | |||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||
| 611 | 2 | $self->{active} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||
| 613 | 2 | $self->after_loop(); | |||||||||||||||||||||||||||||||||||||||||||
| 614 | 2 | ▶ | if ($PAUSE) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $self->pause(); | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $PAUSE = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 618 | 2 | $self->delay( $self->{config}->{delay_after_loop} ); | |||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||
| 620 | # prepare_backsweep: | ||||||||||||||||||||||||||||||||||||||||||||
| 621 | 2 | ▶ | if ( $self->{config}->{backsweep} > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $self->prepare_backsweep(); | |||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||
| 627 | # finish measurement: | ||||||||||||||||||||||||||||||||||||||||||||
| 628 | 2 | $self->finish(); | |||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||
| 630 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||
| 634 | sub delay { | ||||||||||||||||||||||||||||||||||||||||||||
| 635 | 26 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delay: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 636 | 26 | my $delay = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||
| 638 | 26 | ▶ | if ( $delay <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 639 | 26 | return; | |||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 641 | elsif ( $delay > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | my_sleep( $delay, $self, \&user_command ); | |||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 644 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | my_usleep( $delay * 1e6, $self, \&user_command ); | |||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||
| 650 | sub estimate_sweep_duration { | ||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
estimate_sweep_duration: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | my $duration = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | $duration += $self->{config}->{delay_before_loop}; | |||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | if ( $self->{config}->{mode} =~ /conti/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | foreach ( @{ $self->{config}->{duration} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $duration += $_; | |||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 661 | elsif ( $self->{config}->{mode} =~ /step|list/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | foreach ( @{ $self->{config}->{duration} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | $duration += $_; | |||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $duration += $self->{config}->{delay_in_loop}; | |||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | $duration += $self->{config}->{delay_after_loop}; | |||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | $duration *= $self->{config}->{repetitions}; | |||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | $self->{config}->{estimated_sweep_duration} = $duration; | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | return $duration; | |||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||
| 676 | sub estimate_total_sweep_duration { | ||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
estimate_total_sweep_duration: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | ▶ | if ( not defined $self->{master} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | my $duration_total = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | foreach my $slave ( @{ $self->{slaves} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $duration_total += $slave->{config}->{estimated_sweep_duration}; | |||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||
| 685 | #print "duration_total_1: $duration_total\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | my $number_of_steps = @{ $self->{config}->{duration} } - 1; | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | $duration_total *= $number_of_steps; | |||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||
| 689 | #print "duration_total_2: $duration_total\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | $duration_total += $self->{config}->{estimated_sweep_duration}; | |||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||
| 692 | #print "duration_total_3: $duration_total\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | $duration_total *= $self->{config}->{repetitions}; | |||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||
| 695 | #print "duration_total_4: $duration_total\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | $self->{config}->{estimated_sweep_duration_total} = $duration_total; | |||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||
| 701 | sub sweep_structure { | ||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sweep_structure: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | my $text = ""; | |||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | if ( not defined $self->{master} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | $self->estimate_total_sweep_duration(); | |||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 709 | .= "\n\n\n=====================================================================\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 711 | .= "=================== Master/Slave Sweep ============================\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 713 | .= "=====================================================================\n\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | $text .= "=========================\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | $text .= " Master = $self->{config}->{id}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $text .= "=========================\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | $text .= "\t|\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | $text .= "\t|\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 719 | $text .= "\t|--> Instrument = " | ||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | . ref( $self->{config}->{instrument} ) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||
| 722 | # while ( my ($key,$value) = each %{$self->{config}} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 723 | # { | ||||||||||||||||||||||||||||||||||||||||||||
| 724 | # if ( ref($value) eq "ARRAY" ) | ||||||||||||||||||||||||||||||||||||||||||||
| 725 | # { | ||||||||||||||||||||||||||||||||||||||||||||
| 726 | # $text .= "\t|--> $key = @{$value}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 727 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 728 | # elsif ( ref($value) eq "HASH" ) | ||||||||||||||||||||||||||||||||||||||||||||
| 729 | # { | ||||||||||||||||||||||||||||||||||||||||||||
| 730 | # $text .= "\t|--> $key = %{$value}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 731 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 732 | # else | ||||||||||||||||||||||||||||||||||||||||||||
| 733 | # { | ||||||||||||||||||||||||||||||||||||||||||||
| 734 | # $text .= "\t|--> $key = $value\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 735 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 736 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | $text .= "\t|--> Mode = $self->{config}->{mode}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | ▶ | if ( $self->{config}->{mode} =~ /conti/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | $text .= "\t|--> Interval = $self->{config}->{interval}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | $text .= "\t|--> Points = @{$self->{config_original}->{points}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | if ( $self->{config}->{mode} =~ /step/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $text .= "\t|--> stepwidth = @{$self->{config}->{stepwidth}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | $text .= "\t|--> rate = @{$self->{config_original}->{rate}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | .= "\t|--> duration = @{$self->{config_original}->{duration}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 749 | .= "\t|--> Delays (before, in, after) loop = $self->{config}->{delay_before_loop}, $self->{config}->{delay_in_loop}, $self->{config}->{delay_after_loop}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $text .= "\t|--> Backsweep = $self->{config}->{backsweep}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 752 | .= "\t|--> Repetitions = $self->{config_original}->{repetitions}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 753 | $text | ||||||||||||||||||||||||||||||||||||||||||||
| 754 | .= "\t|--> Estimated Duration = " | ||||||||||||||||||||||||||||||||||||||||||||
| 755 | . seconds2time( $self->{config}->{estimated_sweep_duration} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | . "\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | $text .= "\t|----------------------------------------------------\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | foreach my $slave ( @{ $self->{slaves} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | $text .= "\t\t|\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $text .= "\t\t|\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | $text .= "\t=========================\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | $text .= "\t Slave = $slave->{config}->{id}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | $text .= "\t=========================\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | $text .= "\t\t|\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | $text .= "\t\t|\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 767 | $text .= "\t\t|--> Instrument = " | ||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | . ref( $slave->{config}->{instrument} ) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | $text .= "\t\t|--> Mode = $slave->{config}->{mode}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | ▶ | if ( $slave->{config}->{mode} =~ /conti/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | $text .= "\t\t|--> Interval = $slave->{config}->{interval}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 774 | $text | ||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | .= "\t\t|--> Points = @{$slave->{config_original}->{points}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | if ( $slave->{config}->{mode} =~ /step/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | .= "\t\t|--> stepwidth = @{$slave->{config}->{stepwidth}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | $text .= "\t\t|--> rate = @{$slave->{config_original}->{rate}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | .= "\t\t|--> duration = @{$slave->{config_original}->{duration}}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 784 | .= "\t\t|--> Delays (before, in, after) loop = $slave->{config}->{delay_before_loop}, $slave->{config}->{delay_in_loop}, $slave->{config}->{delay_after_loop}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | $text .= "\t\t|--> Backsweep = $slave->{config}->{backsweep}\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 787 | .= "\t\t|--> Repetitions = $slave->{config_original}->{repetitions}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 788 | $text | ||||||||||||||||||||||||||||||||||||||||||||
| 789 | .= "\t\t|--> Estimated Duration = " | ||||||||||||||||||||||||||||||||||||||||||||
| 790 | . seconds2time( $slave->{config}->{estimated_sweep_duration} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | . "\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 793 | .= "\t\t|----------------------------------------------------\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $text .= "\n\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 796 | $text | ||||||||||||||||||||||||||||||||||||||||||||
| 797 | .= "Estimated Duration for Master/Slave-Sweep: " | ||||||||||||||||||||||||||||||||||||||||||||
| 798 | . seconds2time( | ||||||||||||||||||||||||||||||||||||||||||||
| 799 | $self->{config}->{estimated_sweep_duration_total} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | . "\n\n\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 802 | .= "=====================================================================\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | $text | |||||||||||||||||||||||||||||||||||||||||||
| 804 | .= "=====================================================================\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | foreach my $slave ( @{ $self->{slaves} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | foreach my $file ( @{ $slave->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | $file->add_header($text); | |||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | print $text; | |||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 813 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||
| 819 | sub add_filename_extensions { | ||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_filename_extensions: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | my $filenamebase = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | $filenamebase =~ /(.+)(\/|\/\/|\\|\\\\)(.+)\b/; | |||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | my $directory = $1; | |||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | my $filename = $3; | |||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | my $filetype = ".dat"; | |||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | if ( $filename =~ /(.+)(\..+)\b/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | $filename = $1; | |||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | $filetype = $2; | |||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | my $extension_length = @{ $self->{filename_extensions} }; | |||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | ▶ | if ( $self->{config}->{separate_files} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | for ( my $i = 0; $i < $extension_length - 2; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | $directory .= "/" . @{ $self->{filename_extensions} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | ▶ | for ( my $i = 0; $i < $extension_length - 1; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | $filename .= "_" . @{ $self->{filename_extensions} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 846 | elsif ( $self->{config}->{separate_files} == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | ▶ | for ( my $i = 0; $i < $extension_length - 1; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | $directory .= "/" . @{ $self->{filename_extensions} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | ▶ | for ( my $i = 0; $i < $extension_length; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | $filename .= "_" . @{ $self->{filename_extensions} }[$i]; | |||||||||||||||||||||||||||||||||||||||||||
| 853 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | if ( $self->{config}->{folders} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | $directory = $1; #do not create folder | |||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | return $directory . "/" . $filename . $filetype; | |||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||
| 863 | sub get_value { | ||||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | return @{ $self->{config}->{points} }[ $self->{iterator} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||
| 868 | sub enable_pause { | ||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | ▶ | print "Sweep will be paused after finishing this sweep. \n"; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_pause: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | $PAUSE = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||
| 873 | sub pause { | ||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pause: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | print "\n\nPAUSE: continue with <ENTER>\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ReadMode('normal'); | |||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | <>; | |||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ReadMode('cbreak'); | |||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | $PAUSE = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||
| 882 | sub finish { | ||||||||||||||||||||||||||||||||||||||||||||
| 883 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish: called CC=14 SCAR=35.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||
| 885 | # delete entry in ACTIVE_SWEEPS: | ||||||||||||||||||||||||||||||||||||||||||||
| 886 | 2 | foreach my $i ( 0 .. ( my $length = @{$ACTIVE_SWEEPS} ) - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||
| 888 | #print "$i FINISH: ".$self."\t".@{$ACTIVE_SWEEPS}[$i]."\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 889 | #print "active array before: {@{$ACTIVE_SWEEPS}}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 890 | 2 | ▶ | if ( $self eq @{$ACTIVE_SWEEPS}[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||||
| 892 | #@LIST = splice(@ARRAY, OFFSET, LENGTH, @REPLACE_WITH); | ||||||||||||||||||||||||||||||||||||||||||||
| 893 | 2 | @{$ACTIVE_SWEEPS} = splice( @{$ACTIVE_SWEEPS}, $i + 1, 1 ); | |||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||
| 895 | #print "active array after: {@{$ACTIVE_SWEEPS}}\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||
| 899 | # save plot image for all defined measurements: | ||||||||||||||||||||||||||||||||||||||||||||
| 900 | 2 | foreach my $file ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 901 | 2 | foreach ( 0 .. $file->{plot_count} - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | if ( $file->{logger}->{plots}->[$_]->{autosave} eq 'always' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | $file->save_plot($_); | |||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||
| 908 | # close DataFiles for all defined slaves: | ||||||||||||||||||||||||||||||||||||||||||||
| 909 | 2 | foreach my $slave ( @{ $self->{slaves} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | foreach my $file ( @{ $slave->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | foreach ( 0 .. $file->{plot_count} - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | if ( $file->{logger}->{plots}->[$_]->{autosave} eq 'last' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | $file->save_plot($_); | |||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||
| 920 | # close DataFiles of Master: | ||||||||||||||||||||||||||||||||||||||||||||
| 921 | 2 | ▶ | if ( not defined $self->{master} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 922 | 2 | foreach my $file ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 923 | 2 | foreach ( 0 .. $file->{plot_count} - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | if ( $file->{logger}->{plots}->[$_]->{autosave} eq 'last' ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | $file->save_plot($_); | |||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||
| 931 | 2 | ReadMode('normal'); | |||||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||
| 934 | sub active { | ||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | return $self->{active}; | |||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||
| 939 | sub abort { | ||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||
| 941 | 2 | ▶ | foreach my $sweep ( @{$ACTIVE_SWEEPS} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
abort: called CC=3 SCAR=13.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | $sweep->exit(); | |||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||
| 945 | 2 | ▶ | while ( @{$ACTIVE_SWEEPS}[0] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | my $sweep = @{$ACTIVE_SWEEPS}[0]; | |||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | $sweep->finish(); | |||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||||
| 950 | 2 | exit; | |||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||
| 953 | sub stop { | ||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | ▶ | print "Sweep stopped by User!\n"; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stop: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | foreach my $sweep ( @{$ACTIVE_SWEEPS} ) { | |||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | $sweep->exit(); | |||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||
| 962 | sub exit { | ||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||
| 966 | sub last { | ||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | $self->{last} = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||
| 972 | sub before_loop { | ||||||||||||||||||||||||||||||||||||||||||||
| 973 | 2 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_loop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||
| 976 | sub go_to_sweep_start { | ||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_to_sweep_start: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||||
| 980 | sub start_continuous_sweep { | ||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_continuous_sweep: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||||
| 984 | sub in_loop { | ||||||||||||||||||||||||||||||||||||||||||||
| 985 | 22 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_loop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 986 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||||
| 988 | sub go_to_next_step { | ||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_to_next_step: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||||
| 992 | sub after_loop { | ||||||||||||||||||||||||||||||||||||||||||||
| 993 | 2 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_loop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||
| 996 | sub exit_loop { | ||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ▶ | return shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_loop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||||
| 1000 | sub check_loop_duration { | ||||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 20 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_loop_duration: called CC=10 SCAR=42.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 20 | my $char = ReadKey(1e-5); | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | 20 | ▶ | if ( defined $char ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | $self->user_command($char); | |||||||||||||||||||||||||||||||||||||||||||
| 1007 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 20 | ▶ | if ( @{ $self->{config}->{interval} }[ $self->{sequence} ] == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 20 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | ▶ | if ( $self->{config}->{mode} =~ /step|list/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | $self->{loop}->{t1} = time(); | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | ▶ | if ( not defined $self->{loop}->{t0} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | $self->{loop}->{t0} = time(); | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | if ( ( $self->{loop}->{t1} - $self->{loop}->{t0} ) | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | > @{ $self->{config}->{interval} }[ $self->{sequence} ] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | carp( "WARNING: Measurement Loop takes more time (" | ||||||||||||||||||||||||||||||||||||||||||||
| 1027 | . ( $self->{loop}->{t1} - $self->{loop}->{t0} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | . ") than specified by measurement intervall (@{$self->{config}->{sequence}}[$self->{iterator}]).\n" | |||||||||||||||||||||||||||||||||||||||||||
| 1029 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1031 | my $delta_time = ( $self->{loop}->{t1} - $self->{loop}->{t0} ) | ||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | + $self->{loop}->{overtime}; | |||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | ▶ | if ( defined $self->{config}->{instrument} | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"config"}{"instrument"} and $self->{"config"}{"instrument"}->can("active")
MC/DC0%0/2
defined $self->{"config"}{"instrument"} and $self->{"config"}{"instrument"}->can("active")
defined $self->{"config"}{"instrument"}
$self->{"config"}{"instrument"}->can("active")
Truth table0%0/3
A and B
A= defined $self->{"config"}{"instrument"}B= $self->{"config"}{"instrument"}->can("active")
| |||||||||||||||||||||||||||||||||||||||||||||
| 1035 | and $self->{config}->{instrument}->can("active") ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1037 | ( | ||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | @{ $self->{config}->{interval} }[ $self->{sequence} ] | |||||||||||||||||||||||||||||||||||||||||||
| 1039 | - $delta_time | ||||||||||||||||||||||||||||||||||||||||||||
| 1040 | ) > 0.2 | ||||||||||||||||||||||||||||||||||||||||||||
| 1041 | ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | my $time0 = time(); | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | $self->{config}->{instrument}->active(); | |||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | $delta_time = $delta_time + ( ( time() - $time0 ) ); | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | ▶ | if ( $delta_time > @{ $self->{config}->{interval} }[ $self->{sequence} ] ) | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1049 | { | ||||||||||||||||||||||||||||||||||||||||||||
| 1050 | $self->{loop}->{overtime} = $delta_time | ||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | - @{ $self->{config}->{interval} }[ $self->{sequence} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | $delta_time = @{ $self->{config}->{interval} }[ $self->{sequence} ]; | |||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||
| 1054 | #warn "WARNING: Measurement Loop takes more time ($self->{loop}->{overtime}) than specified by measurement intervall (@{$self->{config}->{sequence}}[$self->{iterator}]).\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 1055 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1056 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | $self->{loop}->{overtime} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 1058 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||
| 1060 | usleep( | ||||||||||||||||||||||||||||||||||||||||||||
| 1061 | ( | ||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | @{ $self->{config}->{interval} }[ $self->{sequence} ] | |||||||||||||||||||||||||||||||||||||||||||
| 1063 | - $delta_time | ||||||||||||||||||||||||||||||||||||||||||||
| 1064 | ) * 1e6 | ||||||||||||||||||||||||||||||||||||||||||||
| 1065 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | $self->{loop}->{t0} = time(); | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | return $delta_time; | |||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||
| 1070 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||||
| 1072 | sub user_command { | ||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user_command: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | my $cmd = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | print "user_command = " . $cmd . "\n"; | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | if ( $cmd eq "g" ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | foreach my $datafile ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1080 | 0 | $datafile->gnuplot_restart(); | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1083 | elsif ( $cmd eq "p" ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||
| 1085 | #foreach my $datafile (@{$self->{DataFiles}}) | ||||||||||||||||||||||||||||||||||||||||||||
| 1086 | # { | ||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | @{ $self->{DataFiles} }[0]->gnuplot_pause(); | |||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||||
| 1089 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 1090 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||
| 1096 | sub LOG { | ||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 44 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LOG: called CC=7 SCAR=24.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 44 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 44 | ▶ | if ( ref( $args[0] ) eq "HASH" ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 44 | ▶ | my $file = ( defined $args[1] ) ? $args[1] : 0; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 44 | ▶ | if ( not defined @{ $self->{DataFiles} }[ $args[1] - 1 ] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | "DataFile $file is not defined! \n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1106 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 44 | ▶ | while ( my ( $key, $value ) = each %{ $args[0] } ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 110 | @{ $self->{LOG} }[$file]->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1111 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1112 | # for old style: LOG("column_name", "value", "File") | ||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | my $file = ( defined $args[2] ) ? $args[2] : 0; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | ▶ | if ( not defined @{ $self->{DataFiles} }[ $args[2] - 1 ] ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||||||||||||||||||||||||||
| 1116 | "DataFile $file is not defined! \n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1117 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | @{ $self->{LOG} }[$file]->{ $args[0] } = $args[1]; | |||||||||||||||||||||||||||||||||||||||||||
| 1119 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||
| 1122 | sub set_autolog { | ||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_autolog: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 0 | ▶ | if ( not defined $file or $file == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not defined $file or $file == 0
MC/DC0%0/2
not defined $file or $file == 0
not defined $file
$file == 0
Truth table0%0/3
not(A) or B
A= not defined $fileB= $file == 0
| |||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | foreach my $DataFile ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | 0 | $DataFile->set_autolog($value); | |||||||||||||||||||||||||||||||||||||||||||
| 1130 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1131 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | elsif ( defined @{ $self->{DataFiles} }[ $file - 1 ] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | @{ $self->{DataFiles} }[ $file - 1 ]->set_autolog($value); | |||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1135 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 0 | print new Lab::Exception::Warning( | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | "DataFile $file is not defined! \n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1138 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 1141 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||||
| 1143 | sub skip_LOG { | ||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_LOG: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | ▶ | if ( not defined $file or $file == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not defined $file or $file == 0
MC/DC0%0/2
not defined $file or $file == 0
not defined $file
$file == 0
Truth table0%0/3
not(A) or B
A= not defined $fileB= $file == 0
| |||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | foreach my $DataFile ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | $DataFile->skiplog(); | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1151 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | elsif ( defined @{ $self->{DataFiles} }[ $file - 1 ] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | @{ $self->{DataFiles} }[ $file - 1 ]->skiplog(); | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1155 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | print new Lab::Exception::Warning( | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | "DataFile $file is not defined! \n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1158 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||||
| 1163 | sub write_LOG { | ||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 22 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_LOG: called CC=5 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 22 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 22 | ▶ | if ( not defined $file or $file == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
not defined $file or $file == 0
MC/DC0%0/2
not defined $file or $file == 0
not defined $file
$file == 0
Truth table33%1/3
not(A) or B
A= not defined $fileB= $file == 0
| |||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 22 | my $i = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 1169 | 22 | foreach my $DataFile ( @{ $self->{DataFiles} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1170 | 22 | $DataFile->LOG( $self->create_LOG_HASH($i) ); | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | 22 | $i++; | |||||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1173 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 0 | elsif ( defined @{ $self->{DataFiles} }[ $file - 1 ] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | @{ $self->{DataFiles} }[ $file - 1 ] | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | ->LOG( $self->create_LOG_HASH($file) ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1177 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1178 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | print new Lab::Exception::Warning( | |||||||||||||||||||||||||||||||||||||||||||
| 1180 | "DataFile $file is not defined! \n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1181 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 22 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||
| 1185 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||||
| 1187 | sub create_LOG_HASH { | ||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 44 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_LOG_HASH: called CC=6 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 44 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 44 | my $LOG_HASH = {}; | |||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 44 | foreach | |||||||||||||||||||||||||||||||||||||||||||
| 1194 | 44 | my $column ( @{ @{ $self->{DataFiles} }[ $file - 1 ]->{COLUMNS} } ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | 110 | ▶ | if ( defined @{ $self->{LOG} }[$file]->{$column} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | $LOG_HASH->{$column} = @{ $self->{LOG} }[$file]->{$column}; | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 110 | elsif ( defined @{ $self->{LOG} }[0]->{$column} ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 110 | $LOG_HASH->{$column} = @{ $self->{LOG} }[0]->{$column}; | |||||||||||||||||||||||||||||||||||||||||||
| 1200 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1201 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 0 | ▶ | if ( exists @{ $self->{LOG} }[$file]->{$column} | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists @{$$self{"LOG"};}[$file]->{$column} or exists @{$$self{"LOG"};}[0]->{$column}
MC/DC0%0/2
exists @{$$self{"LOG"};}[$file]->{$column} or exists @{$$self{"LOG"};}[0]->{$column}
exists @{$$self{"LOG"};}[$file]->{$column}
exists @{$$self{"LOG"};}[0]->{$column}
Truth table0%0/3
A or B
A= exists @{$$self{"LOG"};}[$file]->{$column}B= exists @{$$self{"LOG"};}[0]->{$column}
| |||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 0 | or exists @{ $self->{LOG} }[0]->{$column} ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | print new Lab::Exception::Warning( | |||||||||||||||||||||||||||||||||||||||||||
| 1205 | "Value for Paramter $column undefined\n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1206 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1207 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | print new Lab::Exception::Warning( | |||||||||||||||||||||||||||||||||||||||||||
| 1209 | "Paramter $column not found. Maybe a typing error??\n"); | ||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | $LOG_HASH->{$column} = '?'; | |||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1213 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 44 | return $LOG_HASH; | |||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||
| 1219 | sub add_slave { | ||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_slave: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | my $slave = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | ▶ | if ( not $self->{config}->{mode} =~ /step|list/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 0 | Lab::Exception::Warning->throw( error => | |||||||||||||||||||||||||||||||||||||||||||
| 1225 | "Can't add slave to master-sweep which is not in mode list or step." | ||||||||||||||||||||||||||||||||||||||||||||
| 1226 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | my $type = ref($slave); | |||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | ▶ | if ( $type =~ /^Lab::XPRESS::Sweep::Frame/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | ▶ | if ( not defined $slave->{master} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | error => 'No master defined in Frame.' ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1234 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | elsif ( not defined @{ $slave->{master}->{slaves} }[0] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||||||||||||||||||||||||||
| 1237 | error => 'No slave(s) defined in Frame.' ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1238 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | push( @{ $self->{slaves} }, $slave->{master} ); | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | $slave = $slave->{master}; | |||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | $self->{slave_counter}++; | |||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||
| 1245 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1246 | elsif ( $type =~ /^Lab::XPRESS::Sweep/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | ▶ | if ( defined $slave->{master} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | Lab::Exception::Warning->throw( error => | |||||||||||||||||||||||||||||||||||||||||||
| 1249 | "Cannot add slave sweep with an already defined master sweep ." | ||||||||||||||||||||||||||||||||||||||||||||
| 1250 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1251 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | ▶ | if ( $slave->{DataFile_counter} <= 0 | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$slave->{"DataFile_counter"} <= 0 and not defined @{$$slave{"slaves"};}[-1]
MC/DC0%0/2
$slave->{"DataFile_counter"} <= 0 and not defined @{$$slave{"slaves"};}[-1]
$slave->{"DataFile_counter"} <= 0
not defined @{$$slave{"slaves"};}[-1]
Truth table0%0/3
A and not(B)
A= $slave->{"DataFile_counter"} <= 0B= not defined @{$$slave{"slaves"};}[-1]
| |||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | and not defined @{ $slave->{slaves} }[-1] ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | ||||||||||||||||||||||||||||||||||||||||||||
| 1257 | "\n XPRESS::FRAME: -- Added slave sweep has no DataFile! Continue anyway (y/n) ?\n"; | ||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 0 | my $answer = <>; | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | ▶ | if ( $answer =~ /y|Y/ ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1262 | elsif ( $answer =~ /n|N/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1265 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1266 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | push( @{ $self->{slaves} }, $slave ); | |||||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | $self->{slave_counter}++; | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1271 | elsif ( $type eq 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | $slave = new Lab::XPRESS::Sweep::Dummy($slave); | |||||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | push( @{ $self->{slaves} }, $slave ); | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | $self->{slave_counter}++; | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1276 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | error => "slave object is of type $type. Cannot add slave." ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 0 | $slave->{master} = $self; | |||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | $self->{DataFile_counter} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | $self->{DataFiles} = (); | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||
| 1288 | sub get_filename_extension { | ||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_filename_extension: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | return $self->{config}->{filename_extension} . $self->get_value(); | |||||||||||||||||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||
| 1293 | sub deep_copy { | ||||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||||
| 1295 | # if not defined then return it | ||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | ▶ | return undef if $#_ < 0 || !defined( $_[0] ); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deep_copy: not called CC=14 SCAR=53.5
Pod
undocumented
Branch: 1 branch
Condition0%0/3
$#_ < 0 or not defined $_[0]
MC/DC0%0/2
$#_ < 0 or not defined $_[0]
$#_ < 0
not defined $_[0]
Truth table0%0/3
A or not(B)
A= $#_ < 0B= not defined $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||
| 1298 | # if not a reference then return the parameter | ||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 0 | ▶ | return $_[0] if !ref( $_[0] ); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1301 | 0 | ▶ | if ( UNIVERSAL::isa( $obj, 'SCALAR' ) ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 0 | my $temp = deepcopy($$obj); | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | return \$temp; | |||||||||||||||||||||||||||||||||||||||||||
| 1304 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1305 | elsif ( UNIVERSAL::isa( $obj, 'HASH' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | my $temp_hash = {}; | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | 0 | foreach my $key ( keys %$obj ) { | |||||||||||||||||||||||||||||||||||||||||||
| 1308 | 0 | ▶ | if ( !defined( $obj->{$key} ) || !ref( $obj->{$key} ) ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $obj->{$key} && ref $obj->{$key}
MC/DC0%0/2
defined $obj->{$key} && ref $obj->{$key}
defined $obj->{$key}
ref $obj->{$key}
Truth table0%0/3
A && B
A= defined $obj->{$key}B= ref $obj->{$key}
| |||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | $temp_hash->{$key} = $obj->{$key}; | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1311 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | $temp_hash->{$key} = deep_copy( $obj->{$key} ); | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1314 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 0 | return $temp_hash; | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1317 | elsif ( UNIVERSAL::isa( $obj, 'ARRAY' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 0 | my $temp_array = []; | |||||||||||||||||||||||||||||||||||||||||||
| 1319 | 0 | foreach my $array_val (@$obj) { | |||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | ▶ | if ( !defined($array_val) || !ref($array_val) ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $array_val && ref $array_val
MC/DC0%0/2
defined $array_val && ref $array_val
defined $array_val
ref $array_val
Truth table0%0/3
A && B
A= defined $array_valB= ref $array_val
| |||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 0 | push( @$temp_array, $array_val ); | |||||||||||||||||||||||||||||||||||||||||||
| 1322 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1323 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | push( @$temp_array, deep_copy($array_val) ); | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1326 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 0 | return $temp_array; | |||||||||||||||||||||||||||||||||||||||||||
| 1328 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||
| 1330 | # ?? I am uncertain about this one | ||||||||||||||||||||||||||||||||||||||||||||
| 1331 | elsif ( UNIVERSAL::isa( $obj, 'REF' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 0 | my $temp = deepcopy($$obj); | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | return \$temp; | |||||||||||||||||||||||||||||||||||||||||||
| 1334 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||||||||||||
| 1336 | # I guess that it is either CODE, GLOB or LVALUE | ||||||||||||||||||||||||||||||||||||||||||||
| 1337 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 0 | return $obj; | |||||||||||||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1340 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||||
| 1342 | # Need to provide this or AUTOLOAD cannot find it and will die on object destruction. | ||||||||||||||||||||||||||||||||||||||||||||
| 1343 | ▶ | sub DESTROY { | |||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||||
| 1345 | # do nothing | ||||||||||||||||||||||||||||||||||||||||||||
| 1346 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||||
| 1348 | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | ▶ | my $type = ref($self) or croak "\$self is not an object"; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 0 | my $value = undef; | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 0 | my $name = $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | $name =~ s/.*://; # strip fully qualified portion | |||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | ▶ | if ( exists $self->{_permitted}->{$name} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 0 | return $self->{$name} = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 1360 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1361 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 0 | return $self->{$name}; | |||||||||||||||||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1364 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1365 | elsif ( $name =~ qr/^(set_)(.*)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||
| 1367 | # There is a problem with deep copying of the instrument hash. | ||||||||||||||||||||||||||||||||||||||||||||
| 1368 | # The elements of the hash could not be accessed correctly. | ||||||||||||||||||||||||||||||||||||||||||||
| 1369 | # The workaround is to tempsave the hashref and put it back in | ||||||||||||||||||||||||||||||||||||||||||||
| 1370 | # place. This should be only temporary though. | ||||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||||
| 1372 | # NOTE: changed the creation of config_original (in prepare_config function), so it is a copy | ||||||||||||||||||||||||||||||||||||||||||||
| 1373 | # of {config} unsing dclone instead of deep_copy. I think this adresses the issue above. | ||||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | my $instrument = $self->{config}->{instrument}; | |||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 0 | ▶ | if ( exists $self->{config_original}->{$2} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | ▶ | if ( $self->active() ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | print Lab::Exception::Warning->new( error => | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | "WARNING: Cannot set parameter while sweep is active \n" | ||||||||||||||||||||||||||||||||||||||||||||
| 1381 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 0 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 0 | $self->{config_original}->{$2} = @_[0]; | |||||||||||||||||||||||||||||||||||||||||||
| 1386 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1387 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | $self->{config_original}->{$2} = deep_copy( \@_ ); | |||||||||||||||||||||||||||||||||||||||||||
| 1389 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | $self->{config} = deep_copy( $self->{config_original} ); | |||||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||||
| 1393 | #use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||||
| 1395 | #print Dumper $self->{config}; | ||||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 0 | $self->{config}->{instrument} = $instrument; | |||||||||||||||||||||||||||||||||||||||||||
| 1398 | 0 | $self->prepaire_config(); | |||||||||||||||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1400 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 0 | print Lab::Exception::Warning->new( | |||||||||||||||||||||||||||||||||||||||||||
| 1402 | error => "WARNING: Parameter $2 does not exist \n" ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1403 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||||
| 1406 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | Lab::Exception::Warning->throw( error => "AUTOLOAD in " | |||||||||||||||||||||||||||||||||||||||||||
| 1408 | . __PACKAGE__ | ||||||||||||||||||||||||||||||||||||||||||||
| 1409 | . " couldn't access field '${name}'.\n" ); | ||||||||||||||||||||||||||||||||||||||||||||
| 1410 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 8 | with 'Lab::XPRESS::Sweep::LogBlock'; | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||||
| 1415 | # sub timestamp { | ||||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||||
| 1417 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||
| 1418 | # my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, | ||||||||||||||||||||||||||||||||||||||||||||
| 1419 | # $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); | ||||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||||
| 1421 | # $Monat+=1; | ||||||||||||||||||||||||||||||||||||||||||||
| 1422 | # $Jahrestag+=1; | ||||||||||||||||||||||||||||||||||||||||||||
| 1423 | # $Monat = $Monat < 10 ? $Monat = "0".$Monat : $Monat; | ||||||||||||||||||||||||||||||||||||||||||||
| 1424 | # $Monatstag = $Monatstag < 10 ? $Monatstag = "0".$Monatstag : $Monatstag; | ||||||||||||||||||||||||||||||||||||||||||||
| 1425 | # $Stunden = $Stunden < 10 ? $Stunden = "0".$Stunden : $Stunden; | ||||||||||||||||||||||||||||||||||||||||||||
| 1426 | # $Minuten = $Minuten < 10 ? $Minuten = "0".$Minuten : $Minuten; | ||||||||||||||||||||||||||||||||||||||||||||
| 1427 | # $Sekunden = $Sekunden < 10 ? $Sekunden = "0".$Sekunden : $Sekunden; | ||||||||||||||||||||||||||||||||||||||||||||
| 1428 | # $Jahr+=1900; | ||||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||||
| 1430 | # return "$Monatstag.$Monat.$Jahr", "$Stunden:$Minuten:$Sekunden"; | ||||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||||
| 1432 | # } | ||||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||||
| 1436 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||||
| 1438 | =pod | ||||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||||
| 1440 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||||
| 1442 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||||
| 1444 | Lab::XPRESS::Sweep - Base sweep class | ||||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||||
| 1446 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||||
| 1448 | version 3.881 | ||||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||||
| 1450 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||||
| 1452 | Lab::XPRESS::Sweep is meant to be used as a base class for inheriting Sweeps. | ||||||||||||||||||||||||||||||||||||||||||||
| 1453 | It should not be used directly. | ||||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||||
| 1455 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||
| 1457 | The Lab::XPRESS::Sweep class implements major parts of the Lab::XPRESS framework, a modular way for easy scripting measurements in perl and Lab::Measurement. | ||||||||||||||||||||||||||||||||||||||||||||
| 1458 | Direct usage of this class would not result in any action. However it constitutes the fundament for more spezialized subclass Sweeps e.g. Lab::XPRESS::Sweep::Magnet. | ||||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||||
| 1460 | =head1 SWEEP PARAMETERS | ||||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||||
| 1462 | The configuration parameters are described in the particular subclasses (e.g. Lab::XPRESS::Sweep::Magnet). | ||||||||||||||||||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||||||||||||||||||
| 1464 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||||
| 1466 | =head2 add_DataFile [Lab::XPRESS::Data::XPRESS_DataFile object] | ||||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||||
| 1468 | use this method to assign a DataFile object with a sweep if it operates as a slave or as a individual sweep. The sweep will call the user-defined measurment routine assigned with the DataFile. | ||||||||||||||||||||||||||||||||||||||||||||
| 1469 | Sweeps accept multiple DataFile objects when add_DataFile is used repeatedly. | ||||||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||||
| 1471 | =head2 start | ||||||||||||||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||||||||||||||
| 1473 | use this method to execute the sweep. | ||||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||||
| 1475 | =head2 get_value | ||||||||||||||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||||||||||||||
| 1477 | returns by default the current value of the points array or the current step. The method is intended to be overloaded by Sweep-Subclasses, in order to return the current value of the sweeping instrument. | ||||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||||
| 1479 | =head2 LOG [hash, int (default = 0)] | ||||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||||
| 1481 | use this method to store the data collected by user-defined measurment routine in the DataFile object. | ||||||||||||||||||||||||||||||||||||||||||||
| 1482 | |||||||||||||||||||||||||||||||||||||||||||||
| 1483 | The hash has to look like this: $column_name => $value | ||||||||||||||||||||||||||||||||||||||||||||
| 1484 | The column_name has to be one of the previously defined columnames in the DataFile object. | ||||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||||
| 1486 | When using multiple DataFile objects within one sweep, you can direct the data hash one of the DataFiles by the second parameter (int). If this parameter is set to 0 (default) the data hash will be directed to all DataFile objects. | ||||||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||||
| 1488 | Examples: | ||||||||||||||||||||||||||||||||||||||||||||
| 1489 | $sweep->LOG({ | ||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 'voltage' => 10, | ||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 'current' => 1e-6, | ||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 'reistance' => $R | ||||||||||||||||||||||||||||||||||||||||||||
| 1493 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||||
| 1495 | OR: | ||||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||||
| 1497 | $sweep->LOG({'voltage' => 10}); | ||||||||||||||||||||||||||||||||||||||||||||
| 1498 | $sweep->LOG({'current' => 1e-6}); | ||||||||||||||||||||||||||||||||||||||||||||
| 1499 | $sweep->LOG({'reistance' => $R}); | ||||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||||
| 1501 | for two DataFiles: | ||||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||||
| 1503 | # this value will be logged in both DataFiles | ||||||||||||||||||||||||||||||||||||||||||||
| 1504 | $sweep->LOG({'voltage' => 10},0); | ||||||||||||||||||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||||||||||||||||||
| 1506 | # this values will be logged in DataFile 1 | ||||||||||||||||||||||||||||||||||||||||||||
| 1507 | $sweep->LOG({ | ||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 'current' => 1e-6, | ||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 'reistance' => $R1 | ||||||||||||||||||||||||||||||||||||||||||||
| 1510 | },1); | ||||||||||||||||||||||||||||||||||||||||||||
| 1511 | |||||||||||||||||||||||||||||||||||||||||||||
| 1512 | # this values will be logged in DataFile 2 | ||||||||||||||||||||||||||||||||||||||||||||
| 1513 | $sweep->LOG({ | ||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 'current' => 10e-6, | ||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 'reistance' => $R2 | ||||||||||||||||||||||||||||||||||||||||||||
| 1516 | },2); | ||||||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||||
| 1518 | . | ||||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||||
| 1520 | =head2 last | ||||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||||
| 1522 | use this method, in order to stop the current sweep. Example: | ||||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||||
| 1524 | # Stop a voltage Sweep if device current exeeds a critical limit. | ||||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||||
| 1526 | if ($current > $high_limit) { | ||||||||||||||||||||||||||||||||||||||||||||
| 1527 | $voltage_sweep->last(); | ||||||||||||||||||||||||||||||||||||||||||||
| 1528 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||||
| 1530 | . | ||||||||||||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||||||||||||
| 1532 | =head1 HOW TO DEVELOP SUBCLASS OF Lab::XPRESS::Sweep | ||||||||||||||||||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||||||||||||||||||
| 1534 | preefine the default_config hash values in method 'new': | ||||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||||
| 1536 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
| 1537 | my $proto = shift; | ||||||||||||||||||||||||||||||||||||||||||||
| 1538 | my @args=@_; | ||||||||||||||||||||||||||||||||||||||||||||
| 1539 | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||
| 1540 | my $self->{default_config} = { | ||||||||||||||||||||||||||||||||||||||||||||
| 1541 | id => 'Magnet_sweep', | ||||||||||||||||||||||||||||||||||||||||||||
| 1542 | filename_extension => 'B=', | ||||||||||||||||||||||||||||||||||||||||||||
| 1543 | interval => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 1544 | points => [], | ||||||||||||||||||||||||||||||||||||||||||||
| 1545 | duration => [], | ||||||||||||||||||||||||||||||||||||||||||||
| 1546 | mode => 'continuous', | ||||||||||||||||||||||||||||||||||||||||||||
| 1547 | allowed_instruments => ['Lab::Instrument::IPS', 'Lab::Instrument::IPSWeiss1', 'Lab::Instrument::IPSWeiss2', 'Lab::Instrument::IPSWeissDillFridge'], | ||||||||||||||||||||||||||||||||||||||||||||
| 1548 | allowed_sweep_modes => ['continuous', 'list', 'step'], | ||||||||||||||||||||||||||||||||||||||||||||
| 1549 | number_of_points => [undef] | ||||||||||||||||||||||||||||||||||||||||||||
| 1550 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||||
| 1552 | $self = $class->SUPER::new($self->{default_config},@args); | ||||||||||||||||||||||||||||||||||||||||||||
| 1553 | bless ($self, $class); | ||||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||||
| 1555 | return $self; | ||||||||||||||||||||||||||||||||||||||||||||
| 1556 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||||
| 1558 | the following methodes have to be overloaded in the subclass: | ||||||||||||||||||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||||||||||||||||||
| 1560 | sub go_to_sweep_start{} | ||||||||||||||||||||||||||||||||||||||||||||
| 1561 | sub start_continuous_sweep{} | ||||||||||||||||||||||||||||||||||||||||||||
| 1562 | sub go_to_next_step{} | ||||||||||||||||||||||||||||||||||||||||||||
| 1563 | sub exit_loop{} | ||||||||||||||||||||||||||||||||||||||||||||
| 1564 | sub get_value{} | ||||||||||||||||||||||||||||||||||||||||||||
| 1565 | sub exit{} | ||||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||||
| 1567 | additionally see one of the present Sweep-Subclasses. | ||||||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||||
| 1569 | =head1 CAVEATS/BUGS | ||||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||||
| 1571 | probably some | ||||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||||
| 1573 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||
| 1574 | |||||||||||||||||||||||||||||||||||||||||||||
| 1575 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||||
| 1577 | Copyright 2012 Stefan Geissler | ||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 2013 Alois Dirnaichner, Andreas K. Huettel, Christian Butschkow, Stefan Geissler | ||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 2014 Alexei Iankilevitch, Christian Butschkow | ||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 2015 Christian Butschkow | ||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 2016-2017 Andreas K. Huettel, Simon Reinhardt | ||||||||||||||||||||||||||||||||||||||||||||
| 1582 | 2018 Simon Reinhardt | ||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 2020 Andreas K. Huettel | ||||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||||||||||||||||||
| 1586 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||
| 1587 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||||
| 1589 | =cut | ||||||||||||||||||||||||||||||||||||||||||||