Autor Beitrag
Tabakbrummel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 124

win 7
Turbo Delphi, VS 20010 Express
BeitragVerfasst: Sa 14.04.07 00:44 
Hi

Ich habe ein Problem mit der Ungültige Gleitkommaoperation. Bis zum Datum 17.05.2007 kommt keine Ungültige Gleitkommaoperation und ab den 18.05.2207 kommt die Ungültige Gleitkommaoperation.

Hier ist mal mein QuellCode und die EXE.

ausblenden volle Höhe Delphi-Quelltext
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:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Math, ComCtrls, DateUtils;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Edit1: TEdit;
    Edit2: TEdit;
    DateTimePicker1: TDateTimePicker;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    function Jahrestage: Integer;
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.Jahrestage: Integer;
var
  Datum1, Datum2: TDate;
begin
 Datum1 := StrToDate('01.01');
 Datum2 := DateTimePicker1.Date;
 Result := DaysBetween(Datum1, Datum2)+1;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Laenge : Extended;//Längengrad des Standorts, Bogenmaß
  Breite : Extended;//Breitengrad des Standorts, Bogenmaß
  h : Extended;//Korrekturfaktor für Lichtbeugung in Horizontnähe
  Deklination : Extended;//Deklination der Sonne
  Zeitdifferenz : Extended;
  Zeitgleichung : Extended;
  Woz_a : Extended;//wahre Ortszeit Sonnenaufgang
  Woz_u : Extended;//wahre Ortszeit Sonnenuntergang
  Moz_a : Extended;//mittlere Ortszeit Sonnenaufgang
  Moz_u : Extended;//mittlere Ortszeit Sonnenuntergang
  T : Extended;//Tageszahl, 1.Jan=1, 31.Dez=365 bzw. 366
  Aufgang_Std, Aufgang_Min : Extended;
  Untergang_Std, Untergang_Min : Extended;
  Daemmerung : Extended;
  Sonnenaufgang,Sonnenaufgang1,Sonnenuntergang,Sonnenuntergang1: string;
begin
  Laenge := Pi * StrToFloat(Edit1.Text) / 180;
  Breite := Pi * StrToFloat(Edit2.Text) / 180;
  T := Jahrestage;
  h := -0.0145;//Konstante, 50 Bogenminuten
  Deklination := 0.40954*sin(0.0172*(T-79.349740));
  Zeitdifferenz := 12*arccos((sin(h)-sin(Breite)*sin(Deklination))/(cos(Breite)*cos(Deklination)))/Pi;
  Zeitgleichung := -0.1752*sin(0.033430*T+0.5474)-0.1340*sin(0.018234*T-0.1939);
  Woz_a := 12-Zeitdifferenz-Zeitgleichung;
  Woz_u := 12+Zeitdifferenz-Zeitgleichung;
  Moz_a := Woz_a-Zeitgleichung+((15-(Laenge*180/Pi))*4/60)+1;
  Moz_u := Woz_u-Zeitgleichung+((15-(Laenge*180/Pi))*4/60)+1;
  Aufgang_Std := Int(Moz_a);
  Aufgang_Min := Int(60*(Moz_a-Int(Moz_a)));
  Sonnenaufgang := FloatToStr(Aufgang_Std);
  Sonnenaufgang1 := FloatToStr(Aufgang_Min);
  Panel1.Caption := Format('%.2d',[StrToInt(Sonnenaufgang)])+':'+Format('%.2d',[StrToInt(Sonnenaufgang1)]) + ' Uhr';
  Untergang_Std := Int(Moz_u);
  Untergang_Min := Int(60*(Moz_u-Int(Moz_u)));
  Sonnenuntergang := FloatToStr(Untergang_Std);
  Sonnenuntergang1 := FloatToStr(Untergang_Min);
  Panel2.Caption := Format('%.2d',[StrToInt(Sonnenuntergang)])+':'+Format('%.2d',[StrToInt(Sonnenuntergang1)]) + ' Uhr';
  Daemmerung := Round((12*arccos((sin(-0.31415926)-sin(Breite)*sin(Deklination))/(cos(Breite)*cos(Deklination)))/Pi)/0.25);<----  Hier kommt der fehler
  Panel3.Caption := FloatToStr(Daemmerung) + ' min';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.Text := '13,25';//Länge in 13°25´
  Edit2.Text := '52,31';//Breite  in 52°31´
end;

end.
Einloggen, um Attachments anzusehen!
_________________
MfG
Tabakbrummel
Silas
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 478

Windows XP Home
Delphi 2005, RAD Studio 2007, MASM32, FASM, SharpDevelop 3.0
BeitragVerfasst: Sa 14.04.07 06:54 
Moin!

Lad doch bitte mal die Formulardatei hoch, dann lass ich's mal durch den Debugger laufen.

_________________
Religionskriege sind nur Streitigkeiten darüber, wer den cooleren imaginären Freund hat ;-)
Tabakbrummel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 124

win 7
Turbo Delphi, VS 20010 Express
BeitragVerfasst: Sa 14.04.07 09:16 
Moin Silas

Ein bisschen Komisch ist es schon, nicht wahr.
Einloggen, um Attachments anzusehen!
_________________
MfG
Tabakbrummel
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 14.04.07 09:40 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  Daemmerung := (sin(-0.31415926) - sin(Breite) * sin(Deklination));
  Daemmerung := Daemmerung / (cos(Breite)*cos(Deklination));
  Daemmerung := arccos(Daemmerung);
  Daemmerung := (12*Daemmerung/Pi);


In der markierten Zeile hat Daemmerung einen Wert > 1. Arccos braucht aber einen Wert <= 1.

Zitat:
Wenn das Argument des arccos im Betrag grösser als eins ist, so erreicht die Sonne im Laufe des Tages nie die geforderte Horizonthöhe h.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Tabakbrummel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 124

win 7
Turbo Delphi, VS 20010 Express
BeitragVerfasst: Sa 14.04.07 14:28 
Hi

Es liegt an der Astronomische Dämmerung entspricht h = -18 Grad = -0.31415926. Bei der bürgerlicher Dämmerung h = -12 Grad = 0.10471975 und nautische Dämmerung h = -12 Grad = -0.20943950 funktioniert es.
Vielleicht hat jemand eine Idee wie man es mit der Astronomische Dämmerung hin bekommt.

_________________
MfG
Tabakbrummel