|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
5 |----------|
| |
| |
| |
| |
0------------------------- ------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /usr/bin/perl
use strict;
use warnings;
my $file = 'test.dat';
my $out = 'test.dat.out';
my $count_ = 1;
my $datensatz = '';
{
open(my $outfh,">$out") or die $!;
open(my $fh,"<$file") or die $!;
while(my $entry = <$fh>){
$entry =~ s/\r?\n//g;
if($entry =~ /^\s*?#/){
print $outfh $entry,"\n";
}
else{
if($entry =~ /^\s*?$/){
$count_++;
}
else{
$datensatz .= $entry."\n";
}
if($count_ % 3 == 0){
$datensatz = getDatensatz($datensatz);
print $outfh $datensatz;
$count_ = 1;
$datensatz = '';
}
}
}
if($datensatz){
$datensatz = getDatensatz($datensatz);
print $outfh $datensatz;
}
close $fh;
close $outfh;
}
sub getDatensatz{
my ($entry) = @_;
my $bool = 0;
my $set = '';
my @steigend;
for my $line(split(/\r?\n/,$entry)){
chomp $line;
my $wert = (split(/\s+/,$line))[-1];
$bool = 1 if($bool || $wert =~ /^4/);
unless($bool){
push(@steigend,$line);
}
else{
$set .= $line."\n";
}
}
$set .= $_."\n" for(@steigend);
$set .= "\n\n";
return $set;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
my $warte_auf_flanke=0;
while($daten=...)
{
if($daten > 5)
{
$warte_auf_flanke=1;
}
if($warte_auf_flanke and $daten < 3)
{
$warte_auf_flanke=0;
sub_die_bei_flanke_aufgerufen_wird();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
Wert | Ist-Zustand | Soll-Zustand | Flankenabfall ?
-----+-------------+--------------+-----------------
1 | >3 | <=3 | ja
1 | <=3 | <=3 | nein
2 | >3 | <=3 | ja
2 | <=3 | <=3 | nein
3 | >3 | <=3 | ja
3 | <=3 | <=3 | nein
4 | >3 | >3 | nein
4 | <=3 | >3 | nein
5 | >3 | >3 | nein
5 | <=3 | >3 | nein
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
my $state = 'start';
my $crit = 3;
sub f_ab {
my ($value) = @_;
my $return = 0;
if ($value >= $crit and $state ne 'high') {
$state = 'high;
}
elsif ($value < $crit and $state ne 'low') {
if ($state eq 'high) {
$return = 1;
}
$state = 'low';
}
retrun $return;
}
}
|< 1 2 >| | 18 Einträge, 2 Seiten |