summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-08-01 09:35:22 +0200
committerErich Eckner <git@eckner.net>2022-08-01 09:35:22 +0200
commit0928e2cfd8b23bbb40574cfbabc7acb959e24c53 (patch)
treead03ac25572b0e91af8a13aacea900840df66e6d
parent8866a963343b03d1ee5369c418289c6bdb26e5c8 (diff)
downloadFH-Wetter-0928e2cfd8b23bbb40574cfbabc7acb959e24c53.tar.xz
nulls bekaempfenHEADmaster
-rw-r--r--fhunit.pas74
-rw-r--r--wetter.lps77
2 files changed, 107 insertions, 44 deletions
diff --git a/fhunit.pas b/fhunit.pas
index 66ba1f6..66fc40f 100644
--- a/fhunit.pas
+++ b/fhunit.pas
@@ -29,6 +29,7 @@ type
public
constructor create;
destructor destroy; override;
+ function merge(mP: tMessPunkt): integer;
function lade(s: string): boolean;
function schreibe: string;
property zeit: extended
@@ -55,6 +56,7 @@ type
property items[i: longint]: tMessPunkt
read rItem; default;
function hat(zeit: extended): boolean;
+ function hatNichtNull(zeit: extended): boolean;
function minMaxY(startZeit,stopZeit: extended): tMessWerteExtPoints;
procedure dump(p: pointer);
procedure pmud(p: pointer; version,len: longint);
@@ -163,6 +165,40 @@ begin
result:=_mW[mG];
end;
+function tMessPunkt.merge(mP: tMessPunkt): integer;
+var
+ mG: tMessGroesze;
+begin
+ result:=0;
+ if not isNan(mP.zeit) then begin
+ if isNan(zeit) then begin
+ result:=1;
+ _uZeit:=mP.Zeit;
+ setzeZeit;
+ end else begin
+ if zeit <> mP.zeit then begin
+ writeln('Inkonsistenz: ' + schreibe + ' -> ' + mP.schreibe);
+ result:=-1;
+ exit;
+ end;
+ end;
+ end;
+ for mG:=low(tMessGroesze) to high(tMessGroesze) do begin
+ if isNan(mP.mW[mG]) then
+ continue;
+ if isNan(mW[mG]) then begin
+ result:=1;
+ _mW[mG]:=mP.mW[mG];
+ continue;
+ end;
+ if mW[mG] <> mP.mW[mG] then begin
+ writeln('Inkonsistenz: ' + schreibe + ' -> ' + mP.schreibe);
+ result:=-1;
+ exit;
+ end;
+ end;
+end;
+
function tMessPunkt.lade(s: string): boolean;
var
zG: tZeitGroesze;
@@ -322,8 +358,10 @@ begin
result:=true;
if (i>=count) or (items[i].zeit<>nm.zeit) then
inhalt.Insert(i,nm)
- else
+ else begin
+ items[i].merge(nm);
nm.free;
+ end;
end;
function tMessPunkteListe.append(s: string): boolean;
@@ -380,9 +418,25 @@ begin
result:= round((items[i].zeit - zeit) * 6 * 24) = 0;
end;
+function tMessPunkteListe.hatNichtNull(zeit: extended): boolean;
+var
+ i: longint;
+ mG: tMessGroesze;
+begin
+ result:=false;
+ i:=bisekt(zeit);
+ if (i<0) or (i>=count) then
+ exit;
+ for mG:=low(tMessGroesze) to high(tMessGroesze) do
+ if isNan(items[i].mW[mG]) then
+ exit;
+ result:= round((items[i].zeit - zeit) * 6 * 24) = 0;
+end;
+
function tMessPunkteListe.statistics: string;
var
- i,gaps,gap: longint;
+ i,gaps,gap,nans: longint;
+ mG: tMessGroesze;
begin
if count=0 then begin
result:='leer';
@@ -391,14 +445,22 @@ begin
result:='';
gaps:=0;
gap:=0;
- for i:=count-1 downto 1 do
+ nans:=0;
+ for i:=count-1 downto 1 do begin
if round((items[i].zeit - items[i-1].zeit) * 6 * 24) <> 1 then begin
inc(gaps);
gap:=gap + round((items[i].zeit - items[i-1].zeit) * 6 * 24 - 1);
result:=result + dateTimeToStr(items[i-1].zeit) + ' -> ' + dateTimeToStr(items[i].zeit) + #10;
end;
- result:=result + intToStr(count) + ' Werte von ' + dateTimeToStr(items[0].zeit) + ' bis ' + dateTimeToStr(items[count-1].zeit) + #10;
- result:=result + intToStr(gaps) + ' Lücken, ' + intToStr(gap) + ' Messwerte';
+ for mG:=low(tMessGroesze) to high(tMessGroesze) do
+ if isNan(items[i].mW[mG]) then
+ inc(nans);
+ end;
+ result:=result + intToStr(count) + ' Werte von ' + dateTimeToStr(items[0].zeit) + ' bis ' + dateTimeToStr(items[count-1].zeit);
+ if gaps>0 then
+ result:=result + #10 + intToStr(gaps) + ' Lücken, ' + intToStr(gap) + ' Messwerte';
+ if nans>0 then
+ result:=result + #10 + intToStr(nans) + ' NaNs';
end;
// tMessPunkteUpdateThread *****************************************************
@@ -448,7 +510,7 @@ end;
procedure tMessPunkteUpdateThread.nZeitDuplikateAuslassen;
begin
- while _besitzer.werte.hat(nZeit) do begin
+ while _besitzer.werte.hatNichtNull(nZeit) do begin
if beenden then exit;
nZeit:= nZeit + _tAnz * 1 / 24 / 6;
end;
diff --git a/wetter.lps b/wetter.lps
index 2575592..40e4f0e 100644
--- a/wetter.lps
+++ b/wetter.lps
@@ -9,7 +9,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<CursorPos Y="17"/>
- <UsageCount Value="67"/>
+ <UsageCount Value="68"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@@ -19,9 +19,9 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
- <TopLine Value="153"/>
- <CursorPos X="13" Y="181"/>
- <UsageCount Value="67"/>
+ <TopLine Value="118"/>
+ <CursorPos X="15" Y="136"/>
+ <UsageCount Value="68"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@@ -29,16 +29,16 @@
<Filename Value="original/pegelunit.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
- <UsageCount Value="67"/>
+ <UsageCount Value="68"/>
</Unit2>
<Unit3>
<Filename Value="fhunit.pas"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
- <TopLine Value="444"/>
- <CursorPos Y="455"/>
- <UsageCount Value="67"/>
+ <TopLine Value="9"/>
+ <CursorPos X="25" Y="26"/>
+ <UsageCount Value="68"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
@@ -47,7 +47,7 @@
<EditorIndex Value="5"/>
<TopLine Value="5"/>
<CursorPos X="77" Y="30"/>
- <UsageCount Value="36"/>
+ <UsageCount Value="37"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
@@ -150,122 +150,123 @@
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="fhunit.pas"/>
- <Caret Line="32" Column="18" TopLine="15"/>
+ <Caret Line="168" Column="29" TopLine="155"/>
</Position1>
<Position2>
<Filename Value="fhunit.pas"/>
- <Caret Line="166" Column="25" TopLine="138"/>
+ <Caret Line="32" Column="19" TopLine="15"/>
</Position2>
<Position3>
<Filename Value="fhunit.pas"/>
- <Caret Line="310" Column="28" TopLine="301"/>
+ <Caret Line="168" Column="51" TopLine="155"/>
</Position3>
<Position4>
<Filename Value="fhunit.pas"/>
- <Caret Line="51" Column="17" TopLine="34"/>
+ <Caret Line="32" Column="44" TopLine="15"/>
</Position4>
<Position5>
<Filename Value="fhunit.pas"/>
- <Caret Line="310" Column="30" TopLine="297"/>
+ <Caret Line="182" Column="59" TopLine="155"/>
</Position5>
<Position6>
<Filename Value="fhunit.pas"/>
- <Caret Line="340" Column="13" TopLine="312"/>
+ <Caret Line="176" Column="16" TopLine="160"/>
</Position6>
<Position7>
<Filename Value="fhunit.pas"/>
- <Caret Line="473" Column="31" TopLine="457"/>
+ <Caret Line="178" Column="13" TopLine="161"/>
</Position7>
<Position8>
<Filename Value="fhunit.pas"/>
- <Caret Line="474" Column="31" TopLine="457"/>
+ <Caret Line="37" Column="14" TopLine="20"/>
</Position8>
<Position9>
<Filename Value="fhunit.pas"/>
- <Caret Line="475" Column="31" TopLine="457"/>
+ <Caret Line="178" Column="8" TopLine="161"/>
</Position9>
<Position10>
<Filename Value="fhunit.pas"/>
- <Caret Line="476" Column="31" TopLine="457"/>
+ <Caret Line="182" Column="35" TopLine="165"/>
</Position10>
<Position11>
<Filename Value="fhunit.pas"/>
- <Caret Line="477" Column="31" TopLine="457"/>
+ <Caret Line="34" Column="22" TopLine="10"/>
</Position11>
<Position12>
<Filename Value="fhunit.pas"/>
- <Caret Line="479" Column="31" TopLine="457"/>
+ <Caret Line="257" Column="29" TopLine="241"/>
</Position12>
<Position13>
<Filename Value="fhunit.pas"/>
- <Caret Line="486" Column="31" TopLine="458"/>
+ <Caret Line="179" Column="9" TopLine="165"/>
</Position13>
<Position14>
<Filename Value="fhunit.pas"/>
- <Caret Line="560" Column="17" TopLine="532"/>
+ <Caret Line="176" Column="7" TopLine="159"/>
</Position14>
<Position15>
<Filename Value="fhunit.pas"/>
- <Caret Line="566" Column="19" TopLine="538"/>
+ <Caret Line="35" Column="14" TopLine="18"/>
</Position15>
<Position16>
<Filename Value="fhunit.pas"/>
- <Caret Line="605" Column="26" TopLine="579"/>
+ <Caret Line="176" Column="9" TopLine="159"/>
</Position16>
<Position17>
<Filename Value="fhunit.pas"/>
- <Caret Line="94" Column="22" TopLine="77"/>
+ <Caret Line="24" Column="11" TopLine="7"/>
</Position17>
<Position18>
<Filename Value="fhunit.pas"/>
- <Caret Line="433" Column="33" TopLine="543"/>
+ <Caret Line="36" Column="18" TopLine="8"/>
</Position18>
<Position19>
<Filename Value="fhunit.pas"/>
+ <Caret Line="143" Column="9" TopLine="115"/>
</Position19>
<Position20>
<Filename Value="fhunit.pas"/>
- <Caret Line="62" Column="24" TopLine="34"/>
+ <Caret Line="155" Column="28" TopLine="136"/>
</Position20>
<Position21>
<Filename Value="fhunit.pas"/>
- <Caret Line="105" Column="24" TopLine="77"/>
+ <Caret Line="160" Column="21" TopLine="136"/>
</Position21>
<Position22>
<Filename Value="fhunit.pas"/>
- <Caret Line="346" Column="67" TopLine="325"/>
+ <Caret Line="177" Column="17" TopLine="154"/>
</Position22>
<Position23>
<Filename Value="fhunit.pas"/>
- <Caret Line="94" Column="22" TopLine="77"/>
+ <Caret Line="27" Column="24" TopLine="10"/>
</Position23>
<Position24>
<Filename Value="fhunit.pas"/>
- <Caret Line="428" Column="70" TopLine="413"/>
+ <Caret Line="158" Column="31" TopLine="130"/>
</Position24>
<Position25>
<Filename Value="fhunit.pas"/>
- <Caret Line="78" Column="28" TopLine="61"/>
+ <Caret Line="177" Column="16" TopLine="149"/>
</Position25>
<Position26>
<Filename Value="fhunit.pas"/>
- <Caret Line="458" Column="48" TopLine="445"/>
+ <Caret Line="293" Column="12" TopLine="265"/>
</Position26>
<Position27>
<Filename Value="fhunit.pas"/>
- <Caret Line="451" Column="27" TopLine="448"/>
+ <Caret Line="26" Column="25" TopLine="10"/>
</Position27>
<Position28>
<Filename Value="fhunit.pas"/>
- <Caret Line="57" Column="17" TopLine="40"/>
+ <Caret Line="153" Column="32" TopLine="125"/>
</Position28>
<Position29>
<Filename Value="fhunit.pas"/>
- <Caret Line="377" Column="8" TopLine="362"/>
+ <Caret Line="233" Column="15" TopLine="206"/>
</Position29>
<Position30>
<Filename Value="fhunit.pas"/>
- <Caret Line="47" Column="20" TopLine="30"/>
+ <Caret Line="265" Column="15" TopLine="238"/>
</Position30>
</JumpHistory>
<RunParams>