XPRESS/Sweep/DietersCrazyTempSweep.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 98 CC 10 SCAR 38.4
CC
10
Cov
0%
exit_loop
90.0
check_config_paramters
6.0
new
2.0
CRAP 46.4
1 package Lab::XPRESS::Sweep::DietersCrazyTempSweep;
2 #ABSTRACT: Dieter's crazy temperature sweep
3 $Lab::XPRESS::Sweep::DietersCrazyTempSweep::VERSION = '3.899';
4 use v5.20;
5  
6 use Lab::XPRESS::Sweep;
7 use Time::HiRes qw/usleep/, qw/time/;
8 use strict;
9  
10 our @ISA = ('Lab::XPRESS::Sweep');
11  
12 sub new {
13 my $proto = shift;
14 my @args = @_;
15 my $class = ref($proto) || $proto;
16  
17 # define default values for the config parameters:
18 my $self->{default_config} = {
19 id => 'Time_sweep',
20 interval => 1,
21 points => [ 0, 10 ],
22 duration => [1],
23 stepwidth => 1,
24 mode => 'continuous',
25 allowed_instruments => ['Lab::Instrument::ITC'],
26 allowed_sweep_modes => ['continuous'],
27 };
28  
29 # create self from Sweep basic class:
30 $self = $class->SUPER::new( $self->{default_config}, @args );
31 bless( $self, $class );
32  
33 # check and adjust config values if necessary:
34 $self->check_config_paramters();
35  
36 # init mandatory parameters:
37 $self->{DataFile_counter} = 0;
38 $self->{DataFiles} = ();
39  
40 return $self;
41 }
42  
43 sub check_config_paramters {
44 my $self = shift;
45  
46 # No Backsweep allowed; adjust number of Repetitions if Backsweep is 1:
47 if ( $self->{config}->{backsweep} == 1 ) {
48 $self->{config}->{repetitions} /= 2;
49 $self->{config}->{backsweep} = 0;
50 }
51  
52 # Set loop-Interval to Measurement-Interval:
53 $self->{loop}->{interval} = $self->{config}->{interval};
54  
55 }
56  
57 sub exit_loop {
58 my $self = shift;
59  
60 my $T_Probe = $self->{config}->{instrument}->get_value(3);
61  
62 if ( $self->{sequence} == 0 ) {
63  
64 if ( $T_Probe >= @{ $self->{config}->{points} }[1] ) {
65 $self->{config}->{instrument}->set_heateroutput(0);
66 $self->{sequence}++;
67 foreach my $file ( @{ $self->{DataFiles} } ) {
68 $file->start_block();
69 }
70 $self->skip_LOG();
71 }
72 elsif ( $T_Probe < 15 ) {
73 $self->{config}->{instrument}->set_heateroutput(33)
74 ; # 0..99% of heaterlimit
75 }
76 elsif ( $T_Probe >= 15 and $T_Probe <= 40 ) {
77 $self->{config}->{instrument}->set_heateroutput(56)
78 ; # 0..99% of heaterlimit
79 }
80 elsif ( $T_Probe > 40 ) {
81 $self->{config}->{instrument}->set_heateroutput(70)
82 ; # 0..99% of heaterlimit
83 }
84  
85 }
86 elsif ( $self->{sequence} == 1 ) {
87 if ( $T_Probe > @{ $self->{config}->{points} }[1] ) {
88 $self->skip_LOG();
89 }
90 elsif ( $T_Probe <= @{ $self->{config}->{points} }[0] ) {
91 return 1;
92 }
93 }
94  
95 return 0;
96  
97 }
98  
99 sub get_value {
100 my $self = shift;
101 return $self->{config}->{instrument}->get_value(3);
102 }
103  
104 sub halt {
105 return shift;
106 }
107  
108 1;
109  
110 __END__