Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -5,10 +5,7 @@ file_sum, file_cnt_data, file_lines = 0, 0, 0
|
|||
max_rejected, n_rejected = 0, 0
|
||||
max_rejected_date, rejected_date = "", ""
|
||||
|
||||
while true do
|
||||
data = io.read("*line")
|
||||
if data == nil then break end
|
||||
|
||||
for data in io.lines() do
|
||||
date = string.match( data, "%d+%-%d+%-%d+" )
|
||||
if date == nil then break end
|
||||
|
||||
|
|
@ -24,9 +21,9 @@ while true do
|
|||
cnt = cnt + 1
|
||||
n_rejected = 0
|
||||
else
|
||||
if n_rejected == 0 then
|
||||
rejected_date = date
|
||||
end
|
||||
if n_rejected == 0 then
|
||||
rejected_date = date
|
||||
end
|
||||
n_rejected = n_rejected + 1
|
||||
if n_rejected > max_rejected then
|
||||
max_rejected = n_rejected
|
||||
|
|
|
|||
49
Task/Text-processing-1/XPL0/text-processing-1.xpl0
Normal file
49
Task/Text-processing-1/XPL0/text-processing-1.xpl0
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
include xpllib; \for Print
|
||||
|
||||
char File_name, C, Date(10+1), FalseDate(10+1);
|
||||
int N, I, Flag, Count, FalseCount, FalseRun, Readings;
|
||||
real Data, Line_tot, Line_avg, Total;
|
||||
|
||||
[File_name:= "readings.txt";
|
||||
FSet(FOpen(File_name, 0), ^i); OpenI(3);
|
||||
Total:= 0.; Readings:= 0; FalseCount:= 0; FalseRun:= 0;
|
||||
loop
|
||||
[for N:= 0 to 10-1 do
|
||||
[C:= ChIn(3);
|
||||
if C = LF then C:= ChIn(3);
|
||||
if C = EOF then quit;
|
||||
Date(N):= C;
|
||||
];
|
||||
Date(N):= 0;
|
||||
|
||||
Line_tot:= 0.; Count:= 0;
|
||||
for N:= 0 to 24-1 do
|
||||
[Data:= RlIn(3);
|
||||
Flag:= IntIn(3);
|
||||
if Flag > 0 then
|
||||
[Line_tot:= Line_tot + Data;
|
||||
Count:= Count + 1;
|
||||
FalseCount:= 0;
|
||||
]
|
||||
else
|
||||
[FalseCount:= FalseCount+1;
|
||||
if FalseCount > FalseRun then
|
||||
[FalseRun:= FalseCount;
|
||||
for I:= 0 to 10 do FalseDate(I):= Date(I);
|
||||
];
|
||||
];
|
||||
];
|
||||
Total:= Total + Line_tot;
|
||||
Readings:= Readings + Count;
|
||||
Line_avg:= Line_tot / float(Count);
|
||||
Print("Line: %s Reject: %2d Accept: %2d Line_tot: %4.3f Line_avg: %3.3f\n",
|
||||
Date, 24-Count, Count, Line_tot, Line_avg);
|
||||
];
|
||||
Print("\nFile = %s\n", File_name);
|
||||
Print("Total = %1.3f\n", Total);
|
||||
Print("Readings = %d\n", Readings);
|
||||
Print("Average = %1.3f\n", Total/float(Readings));
|
||||
|
||||
Print("\nMaximum run of %d consecutive false readings", FalseRun);
|
||||
Print("\nends at line starting with date: %s\n", FalseDate);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue