Suche nach Codeschnipsel für Sonnenstand

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Suche nach Codeschnipsel für Sonnenstand

      Hallo Forum,

      ich suche einen universellen Codeschnipsel zur Berechnung des aktuellen Sonnenstands bei bekannter CET Zeit und natürlich Position (lat / long). Da da jemand etwas brauchbares ? Muss nicht supergenau sein, gerne auch Näherungslösungen.

      Danke,
      Darth Weber
    • Ich hab' jetzt das gefunden
      geoastro.de/SME/tk/index.htm
      Ich denke mal, bascom bietet alle nötigen Funktionen an, um die Berechnungen auszuführen. Man müsste/könnte noch versuchen, den einen oder anderen Ausdruck durch eine Konstante zu ersetzen, um eine einfachere, aber dafür ungenauere Berechnung zu erhalten.
      Raum für Notizen

      -----------------------------------------------------------------------------------------------------

      -----------------------------------------------------------------------------------------------------
    • Das ist aus meinem Programm.
      Musst du mal testen ob noch Vars fehlen.
      Dann melde dich nochmal.

      Source Code

      1. '---------------------------------[ Mondphase ]---------------------------------
      2. Declare Sub Mondphase_funktionen()
      3. Declare Function Radians(byval Value As Single) As Single
      4. Const Negativdisplay = 0
      5. Const 1pi = 3.141593
      6. Const 2pi = 6.283185
      7. Const Sin_e = 0.3978187 ' Sinus Neigung der Erdachse
      8. Const Cos_e = 0.9174641 ' Cosinus Neigung der Erdachse
      9. Const Rad2h = 3.819719 ' RAD in Stunden umrechen
      10. Const Neumond_zeit = 29.530588853
      11. Const Gradbogen = 0.017453
      12. Dim Longitude As Single : Longitude = 10.15 ' geografische Länge
      13. Dim Latitude As Single : Latitude = 50.10 ' geografische Breite
      14. Dim Zeitzone As Byte ': Zeitzone = 2 ' Zeitzone
      15. Dim Mondphase_errechnen As Byte : Mondphase_errechnen = 1
      16. Dim Temp_long As Long
      17. Dim Q(10) As Single ' Temporäte Variable zur astronomischen Berechnung
      18. Dim M_sun(2) As Single ' M der Sonne
      19. Dim L_sun(2) As Single ' Lambda der Sonne
      20. Dim De(2) As Single ' Deklination in Grad
      21. Dim Ra(2) As Single ' Rektarszensin in Stunden
      22. Dim Gst(6) As Single ' Auf- und Untergangszeiten
      23. Dim Beginn As Single ' Dämmerungsbeginn
      24. Dim Ende As Single ' Dämmerungsende
      25. Dim Mm(2) As Single ' Mm vom Mond
      26. Dim Ec(2) As Single ' Ec vom Mond
      27. Dim Dem As Single ' mittlere Deklination
      28. Dim Azimuth As Single
      29. Dim Sonnenhoehe As Single
      30. Dim Sonnenhoehe_ist As Single
      31. Dim Fehler As Byte
      32. Dim Temp_single1 As Single
      33. Dim Temp_single2 As Single
      34. Dim Temp_integer1 As Integer
      35. Dim Mondsymbol_prozent As Single
      36. Dim Mond_ab_zu As Byte
      37. Dim Temp_byte As Byte
      38. Dim Mondsymbol As Byte
      39. Dim Mondsymbol_alter As String * 4
      40. Dim Temp_string1 As String * 4
      41. Dim Temp_string2 As String * 6
      42. Dim Temp_string3 As String * 8
      43. Dim Temp_string5 As String * 1
      44. Dim Temp_string6 As String * 3
      45. Dim Sternzeit As String * 8
      46. Dim T00 As Single ' Greenwich sideral Time T00 (0h UT)
      47. Dim P(8) As Single ' Temporäte Variable zur astronomischen Berechnung
      48. Dim Korrektur As Byte ' Korrektur Delta t für Refraktion, Parallaxe und Durchmesser
      49. Dim Days As Single ' Anzahl der Tage seit Epoche 1990
      50. Dim Mondphase As Single ' Mondphasensymbol
      51. Dim Mondalter As Single ' Mondalter
      52. Dim Lsyssec_sonne_max As Long
      53. Dim Sonnenhoehe_max As Single
      54. Dim Zeit As String * 5 ' für Uhrzeiten ohne Sekunden
      55. Dim Sonnenaufgang As String * 5
      56. Dim Sonnenuntergang As String * 5
      57. Dim Mondneigung As String * 5
      58. Dim Mondaufgang As String * 5
      59. Dim Monduntergang As String * 5
      60. Dim Daemmerungsende As String * 5
      61. Dim Daemmerungsbeginn As String * 5
      62. Dim Mondsymbol_alter_s As Single
      63. Dim Neumond_strdate As String * 8
      64. Dim Neumond_strtime As String * 8
      65. Dim Sonnenhoehe_strtime As String * 5
      66. '-------------------------------------------------
      Display All
      rest kommt noch
      Gruß Holger
      link zu mir..
      forum.auto-steuerung.de
      ___
    • BASCOM Source Code

      1. '------------------[ Mondphase funktionen errechnen ]---------------------------
      2. Sub Mondphase_funktionen()
      3. Anzeige_mondphasefunktionen_:
      4. '@Knickohr
      5. If Mondphase_errechnen = 1 Then
      6. Temp_long = Sysday() ' Sternzeit berechnen
      7. Q(1) = Temp_long - 0.5
      8. Q(1) = Q(1) / 36525
      9. Q(2) = Q(1) * 2400.051
      10. Q(3) = Q(1) * Q(1)
      11. Q(3) = Q(3) * 0.000025862
      12. Q(1) = Q(2) + Q(3)
      13. Q(1) = Q(1) + 6.697375
      14. Q(1) = Q(1) / 24 ' Modulo funktioniert bei Fließkomma nicht, also von Hand machen
      15. Q(2) = Int(q(1))
      16. Q(1) = Q(1) - Q(2)
      17. T00 = Q(1) * 24 ' T00
      18. Temp_long = Secofday()
      19. Q(2) = Temp_long / 3600
      20. Q(2) = Q(2) - Zeitzone ' Zeitzone subtrahieren
      21. Q(2) = Q(2) * 1.002738
      22. Q(1) = T00 + Q(2)
      23. Q(2) = Longitude / 15
      24. Q(1) = Q(1) + Q(2)
      25. Select Case Q(1) ' LST in Stunden (Sternzeit)
      26. Case Is < 0
      27. Q(1) = Q(1) + 24
      28. Case Is >= 24
      29. Q(1) = Q(1) - 24
      30. End Select
      31. Q(1) = Q(1) * 3600
      32. Q(1) = Round(q(1))
      33. Temp_long = Q(1)
      34. Temp_string3 = Time(temp_long)
      35. 'Print "Lokale Sternzeit: " ; Temp_string3
      36. Sternzeit = Temp_string3
      37. Fehler = 0
      38. Temp_long = Sysday() ' Sonnenauf- und -untergangszeiten
      39. Days = Temp_long + 3653.01 ' Tage seit Epoche 1990
      40. Q(1) = Days * 0.01720279
      41. Q(2) = Radians(q(1)) ' N
      42. Q(1) = Q(2) + 4.876508
      43. Q(1) = Q(1) - 4.93524
      44. If Q(1) < 0 Then Q(1) = Q(1) + 2pi
      45. M_sun(1) = Q(1) ' M
      46. Q(1) = Sin(m_sun(1))
      47. Q(1) = Q(1) * 0.033426 ' Ec
      48. Q(1) = Q(2) + Q(1)
      49. Q(1) = Q(1) + 4.876508
      50. L_sun(1) = Radians(q(1)) ' L
      51. Q(1) = Sin(l_sun(1))
      52. Q(2) = Cos(l_sun(1))
      53. Q(1) = Q(1) * Cos_e
      54. Q(1) = Atn2(q(1) , Q(2))
      55. Ra(1) = Q(1) ' RA
      56. Q(1) = Sin(l_sun(1))
      57. Q(1) = Q(1) * Sin_e
      58. De(1) = Asin(q(1)) ' Dec
      59. Q(1) = Tan(de(1))
      60. Q(2) = Deg2rad(latitude)
      61. Q(2) = Tan(q(2))
      62. Q(1) = Q(1) * Q(2)
      63. Q(1) = -1 * Q(1)
      64. Temp_single1 = Abs(q(1))
      65. If Temp_single1 < 1 Then
      66. Q(1) = Acos(q(1))
      67. Q(2) = Ra(1) - Q(1)
      68. Q(2) = Q(2) + 2pi
      69. Q(3) = Deg2rad(longitude)
      70. Q(2) = Q(2) - Q(3)
      71. Select Case Q(2)
      72. Case Is < 0
      73. Q(2) = Q(2) + 2pi
      74. Case Is > 2pi
      75. Q(2) = Q(2) - 2pi
      76. End Select
      77. Gst(1) = Q(2) * Rad2h ' Aufgangszeit in Stunden
      78. Q(2) = Ra(1) + Q(1)
      79. Q(2) = Q(2) - Q(3)
      80. Select Case Q(2)
      81. Case Is < 0
      82. Q(2) = Q(2) + 2pi
      83. Case Is > 2pi
      84. Q(2) = Q(2) - 2pi
      85. End Select
      86. Gst(2) = Q(2) * Rad2h ' Untergangszeit in Stunden
      87. Else
      88. Fehler = 1
      89. End If
      90. Q(1) = Days + 1 ' Tage seit Epoche 1990 + 24 Stunden
      91. Q(1) = Q(1) * 0.01720279
      92. Q(2) = Radians(q(1)) ' N
      93. Q(1) = Q(2) + 4.876508
      94. Q(1) = Q(1) - 4.93524
      95. If Q(1) < 0 Then Q(1) = Q(1) + 2pi
      96. M_sun(2) = Q(1) ' M
      97. Q(1) = Sin(m_sun(2))
      98. Q(1) = Q(1) * 0.033426 ' Ec
      99. Q(1) = Q(2) + Q(1)
      100. Q(1) = Q(1) + 4.876508
      101. L_sun(2) = Radians(q(1)) ' L
      102. Q(1) = Sin(l_sun(2))
      103. Q(2) = Cos(l_sun(2))
      104. Q(1) = Q(1) * Cos_e
      105. Q(1) = Atn2(q(1) , Q(2))
      106. Ra(2) = Q(1) ' RA
      107. Q(1) = Sin(l_sun(2))
      108. Q(1) = Q(1) * Sin_e
      109. De(2) = Asin(q(1)) ' Dec
      110. Q(1) = Tan(de(2))
      111. Q(2) = Deg2rad(latitude)
      112. Q(2) = Tan(q(2))
      113. Q(1) = Q(1) * Q(2)
      114. Q(1) = -1 * Q(1)
      115. Temp_single1 = Abs(q(1))
      116. If Temp_single1 < 1 Then
      117. Q(1) = Acos(q(1))
      118. Q(2) = Ra(2) - Q(1)
      119. Q(2) = Q(2) + 2pi
      120. Q(3) = Deg2rad(longitude)
      121. Q(2) = Q(2) - Q(3)
      122. Select Case Q(2)
      123. Case Is < 0
      124. Q(2) = Q(2) + 2pi
      125. Case Is > 2pi
      126. Q(2) = Q(2) - 2pi
      127. End Select
      128. Gst(3) = Q(2) * Rad2h ' Aufgangszeit in Stunden
      129. If Gst(1) > Gst(3) Then Gst(3) = Gst(3) + 24
      130. Q(2) = Ra(2) + Q(1)
      131. Q(2) = Q(2) - Q(3)
      132. Select Case Q(2)
      133. Case Is < 0
      134. Q(2) = Q(2) + 2pi
      135. Case Is > 2pi
      136. Q(2) = Q(2) - 2pi
      137. End Select
      138. Gst(4) = Q(2) * Rad2h ' Untergangszeit in Stunden
      139. If Gst(2) > Gst(4) Then Gst(4) = Gst(4) + 24
      140. Else
      141. Fehler = 1
      142. End If
      143. If Fehler = 1 Then
      144. 'Lcdtext " N/A " , 159 , 23 , 1 , 0 , 1
      145. Else
      146. Q(1) = Longitude / 15
      147. Q(1) = Q(1) * 1.002738
      148. Q(1) = T00 - Q(1)
      149. If Q(1) < 0 Then Q(1) = Q(1) + 24 ' T00'
      150. If Gst(1) < Q(1) Then
      151. Gst(1) = Gst(1) + 24
      152. Gst(3) = Gst(3) + 24
      153. End If
      154. If Gst(2) < Q(1) Then
      155. Gst(2) = Gst(2) + 24
      156. Gst(4) = Gst(4) + 24
      157. End If
      158. Q(1) = Gst(1) - Gst(3)
      159. Q(2) = Q(1) + 24.07
      160. Q(3) = Q(1) * T00
      161. Q(4) = Gst(1) * 24.07
      162. Q(3) = Q(4) + Q(3)
      163. Gst(5) = Q(3) / Q(2)
      164. Q(1) = Gst(2) - Gst(4)
      165. Q(2) = Q(1) + 24.07
      166. Q(3) = Q(1) * T00
      167. Q(4) = Gst(2) * 24.07
      168. Q(3) = Q(4) + Q(3)
      169. Gst(6) = Q(3) / Q(2)
      170. Korrektur = 1
      171. Gosub Zeiten_berechnen
      172. Temp_long = Round(beginn) ' Sonnenaufgang
      173. Temp_string3 = Time(temp_long)
      174. Zeit = Left(temp_string3 , 5)
      175. Sonnenaufgang = Zeit
      176. 'Print "Sonnenaufgang " ; Zeit
      177. Temp_long = Round(ende) ' Sonnenuntergang
      178. Temp_string3 = Time(temp_long)
      179. Zeit = Left(temp_string3 , 5)
      180. Sonnenuntergang = Zeit
      181. 'Print "Sonnenuntergang " ; Zeit
      182. End If
      183. Korrektur = 2
      184. Gosub Zeiten_berechnen
      185. Q(1) = Tan(dem) ' Zeiten astronomische Dämmerung
      186. Q(2) = Deg2rad(latitude)
      187. Q(3) = Tan(q(2))
      188. Q(1) = Q(1) * Q(3)
      189. Q(1) = -1 * Q(1)
      190. Q(5) = Acos(q(1))
      191. Q(1) = Sin(q(2))
      192. Q(2) = Cos(q(2))
      193. Q(3) = Sin(dem)
      194. Q(4) = Cos(dem)
      195. Q(1) = Q(1) * Q(3)
      196. Q(2) = Q(2) * Q(4)
      197. Q(1) = -0.309017 - Q(1)
      198. Q(1) = Q(1) / Q(2)
      199. Temp_single1 = Abs(q(1))
      200. If Temp_single1 < 1 Then
      201. Q(1) = Acos(q(1))
      202. Q(1) = Q(1) - Q(5)
      203. Q(1) = Q(1) * 13713.86
      204. Beginn = Beginn - Q(1) ' Dämmerungsbeginn
      205. Temp_long = Round(beginn)
      206. Temp_string3 = Time(temp_long)
      207. Zeit = Left(temp_string3 , 5)
      208. Daemmerungsende = Zeit
      209. 'Print "Ende völlige Dunkelheit: " ; Temp_string3
      210. Ende = Ende + Q(1) ' Dämmerungsende
      211. Temp_long = Round(ende)
      212. Temp_string3 = Time(temp_long)
      213. Zeit = Left(temp_string3 , 5)
      214. Daemmerungsbeginn = Zeit
      215. 'Print "Beginn völlige Dunkelheit: " ; Temp_string3
      216. Else
      217. 'Lcdtext " N/A " , 167 , 23 , 1 , 0 , 1
      218. Daemmerungsbeginn = " N/A"
      219. Daemmerungsende = " N/A"
      220. End If
      Display All
      Gruß Holger
      link zu mir..
      forum.auto-steuerung.de
      ___
    • BASCOM Source Code

      1. Fehler = 0
      2. Q(1) = Days * 0.2299715 ' Mondauf- und -untergangszeiten
      3. Q(1) = Q(1) + 5.556284
      4. Q(1) = Radians(q(1)) ' l
      5. Q(2) = Days * 0.001944368
      6. Q(2) = Q(1) - Q(2)
      7. Q(2) = Q(2) - 0.6342598
      8. Q(7) = Radians(q(2)) ' Mm
      9. Q(2) = Days * 0.0009242199
      10. Q(2) = 5.55905 - Q(2)
      11. Q(8) = Radians(q(2)) ' Nm
      12. Q(2) = Q(1) - L_sun(1)
      13. Q(2) = Q(2) * 2
      14. Q(2) = Q(2) - Q(7)
      15. Q(2) = Sin(q(2))
      16. Q(2) = Q(2) * 0.02223375 ' Ev
      17. Q(3) = Sin(m_sun(1))
      18. Q(4) = Q(3) * 0.003242822 ' Ae
      19. Q(5) = Q(3) * 0.006457718 ' A3
      20. Q(6) = Q(3) * 0.002792527
      21. Q(3) = Q(7) - Q(4)
      22. Q(3) = Q(3) + Q(2)
      23. Mm(1) = Q(3) - Q(5) ' M'm
      24. Q(5) = Sin(mm(1))
      25. Ec(1) = Q(5) * 0.1097568 ' Ec
      26. Q(3) = Mm(1) * 2
      27. Q(3) = Sin(q(3))
      28. Q(3) = Q(3) * 0.003735005 ' A4
      29. Q(1) = Q(1) + Q(2)
      30. Q(1) = Q(1) + Ec(1)
      31. Q(1) = Q(1) - Q(4)
      32. Q(1) = Q(1) + Q(3) ' l'
      33. Q(2) = Q(1) - L_sun(1)
      34. Q(2) = Q(2) * 2
      35. Q(2) = Sin(q(2))
      36. Q(2) = Q(2) * 0.0114895 ' V
      37. Q(1) = Q(1) + Q(2) ' l''
      38. Mondalter = Q(1) - L_sun(1)
      39. Q(2) = Q(8) - Q(6) ' N'
      40. Q(3) = Q(1) - Q(2)
      41. Q(4) = Cos(q(3))
      42. Q(3) = Sin(q(3))
      43. Q(6) = Q(3) * 0.9959703
      44. Q(4) = Atn2(q(6) , Q(4))
      45. If Q(4) < 0 Then Q(4) = Q(4) + 2pi
      46. Q(5) = Q(4) + Q(2) ' L
      47. Q(3) = Q(3) * 0.08968344
      48. Q(6) = Asin(q(3))
      49. Q(1) = Sin(q(6))
      50. Q(2) = Cos(q(6))
      51. Q(3) = Tan(q(6))
      52. Q(4) = Sin(q(5))
      53. Q(5) = Cos(q(5))
      54. Q(3) = Q(3) * Sin_e
      55. Q(6) = Q(4) * Cos_e
      56. Q(3) = Q(6) - Q(3)
      57. Q(3) = Atn2(q(3) , Q(5))
      58. If Q(3) < 0 Then Q(3) = Q(3) + 2pi
      59. Ra(1) = Q(3) ' Ra
      60. Q(1) = Q(1) * Cos_e
      61. Q(2) = Q(2) * Sin_e
      62. Q(2) = Q(2) * Q(4)
      63. Q(1) = Q(1) + Q(2)
      64. De(1) = Asin(q(1)) ' De
      65. Q(1) = Tan(de(1))
      66. Q(2) = Deg2rad(latitude)
      67. Q(2) = Tan(q(2))
      68. Q(1) = Q(1) * Q(2)
      69. Q(1) = -1 * Q(1)
      70. Temp_single1 = Abs(q(1))
      71. If Temp_single1 < 1 Then
      72. Q(1) = Acos(q(1))
      73. Q(2) = Ra(1) - Q(1)
      74. Q(2) = Q(2) + 2pi
      75. Q(3) = Deg2rad(longitude)
      76. Q(2) = Q(2) - Q(3)
      77. Select Case Q(2)
      78. Case Is < 0
      79. Q(2) = Q(2) + 2pi
      80. Case Is > 2pi
      81. Q(2) = Q(2) - 2pi
      82. End Select
      83. Gst(1) = Q(2) * Rad2h ' Aufgangszeit in Stunden
      84. Q(2) = Ra(1) + Q(1)
      85. Q(2) = Q(2) - Q(3)
      86. Select Case Q(2)
      87. Case Is < 0
      88. Q(2) = Q(2) + 2pi
      89. Case Is > 2pi
      90. Q(2) = Q(2) - 2pi
      91. End Select
      92. Gst(2) = Q(2) * Rad2h ' Untergangszeit in Stunden
      93. Else
      94. Fehler = 1
      95. End If
      96. Q(1) = Days + 1 ' 24 Sunden später
      97. Q(1) = Q(1) * 0.2299715
      98. Q(1) = Q(1) + 5.556284
      99. Q(1) = Radians(q(1)) ' l
      100. Q(2) = Days * 0.001944368
      101. Q(2) = Q(1) - Q(2)
      102. Q(2) = Q(2) - 0.6342598
      103. Q(7) = Radians(q(2)) ' Mm
      104. Q(2) = Days * 0.0009242199
      105. Q(2) = 5.55905 - Q(2)
      106. Q(8) = Radians(q(2)) ' Nm
      107. Q(2) = Q(1) - L_sun(1)
      108. Q(2) = Q(2) * 2
      109. Q(2) = Q(2) - Q(7)
      110. Q(2) = Sin(q(2))
      111. Q(2) = Q(2) * 0.02223375 ' Ev
      112. Q(3) = Sin(m_sun(1))
      113. Q(4) = Q(3) * 0.003242822 ' Ae
      114. Q(5) = Q(3) * 0.006457718 ' A3
      115. Q(6) = Q(3) * 0.002792527
      116. Q(3) = Q(7) - Q(4)
      117. Q(3) = Q(3) + Q(2)
      118. Mm(2) = Q(3) - Q(5) ' M'm
      119. Q(5) = Sin(mm(2))
      120. Ec(2) = Q(5) * 0.1097568 ' Ec
      121. Q(3) = Mm(2) * 2
      122. Q(3) = Sin(q(3))
      123. Q(3) = Q(3) * 0.003735005 ' A4
      124. Q(1) = Q(1) + Q(2)
      125. Q(1) = Q(1) + Ec(2)
      126. Q(1) = Q(1) - Q(4)
      127. Q(1) = Q(1) + Q(3) ' l'
      128. Q(2) = Q(1) - L_sun(1)
      129. Q(2) = Q(2) * 2
      130. Q(2) = Sin(q(2))
      131. Q(2) = Q(2) * 0.0114895 ' V
      132. Q(1) = Q(1) + Q(2) ' l''
      133. Q(2) = Q(8) - Q(6) ' N'
      134. Q(3) = Q(1) - Q(2)
      135. Q(4) = Cos(q(3))
      136. Q(3) = Sin(q(3))
      137. Q(6) = Q(3) * 0.9959703
      138. Q(4) = Atn2(q(6) , Q(4))
      139. If Q(4) < 0 Then Q(4) = Q(4) + 2pi
      140. Q(5) = Q(4) + Q(2) ' L
      141. Q(3) = Q(3) * 0.08968344
      142. Q(6) = Asin(q(3))
      143. Q(1) = Sin(q(6))
      144. Q(2) = Cos(q(6))
      145. Q(3) = Tan(q(6))
      146. Q(4) = Sin(q(5))
      147. Q(5) = Cos(q(5))
      148. Q(3) = Q(3) * Sin_e
      149. Q(6) = Q(4) * Cos_e
      150. Q(3) = Q(6) - Q(3)
      151. Q(3) = Atn2(q(3) , Q(5))
      152. If Q(3) < 0 Then Q(3) = Q(3) + 2pi
      153. Ra(2) = Q(3) ' Ra
      154. Q(1) = Q(1) * Cos_e
      155. Q(2) = Q(2) * Sin_e
      156. Q(2) = Q(2) * Q(4)
      157. Q(1) = Q(1) + Q(2)
      158. De(2) = Asin(q(1)) ' De
      159. Q(1) = Tan(de(2))
      160. Q(2) = Deg2rad(latitude)
      161. Q(2) = Tan(q(2))
      162. Q(1) = Q(1) * Q(2)
      163. Q(1) = -1 * Q(1)
      164. Temp_single1 = Abs(q(1))
      165. If Temp_single1 < 1 Then
      166. Q(1) = Acos(q(1))
      167. Q(2) = Ra(2) - Q(1)
      168. Q(2) = Q(2) + 2pi
      169. Q(3) = Deg2rad(longitude)
      170. Q(2) = Q(2) - Q(3)
      171. Select Case Q(2)
      172. Case Is < 0
      173. Q(2) = Q(2) + 2pi
      174. Case Is > 2pi
      175. Q(2) = Q(2) - 2pi
      176. End Select
      177. Gst(3) = Q(2) * Rad2h ' Aufgangszeit in Stunden
      178. If Gst(1) > Gst(3) Then Gst(3) = Gst(3) + 24
      179. Q(2) = Ra(2) + Q(1)
      180. Q(2) = Q(2) - Q(3)
      181. Select Case Q(2)
      182. Case Is < 0
      183. Q(2) = Q(2) + 2pi
      184. Case Is > 2pi
      185. Q(2) = Q(2) - 2pi
      186. End Select
      187. Gst(4) = Q(2) * Rad2h ' Untergangszeit in Stunden
      188. If Gst(2) > Gst(4) Then Gst(4) = Gst(4) + 24
      189. Else
      190. Fehler = 1
      191. End If
      192. If Fehler = 1 Then
      193. 'Lcdtext " N/A " , 151 , 23 , 1 , 0 , 1
      194. Else
      195. Q(1) = Longitude / 15
      196. Q(1) = Q(1) * 1.002738
      197. Q(1) = T00 - Q(1)
      198. If Q(1) < 0 Then Q(1) = Q(1) + 24 ' T00'
      199. If Gst(1) < Q(1) Then
      200. Gst(1) = Gst(1) + 24
      201. Gst(3) = Gst(3) + 24
      202. End If
      203. If Gst(2) < Q(1) Then
      204. Gst(2) = Gst(2) + 24
      205. Gst(4) = Gst(4) + 24
      206. End If
      207. Q(1) = Gst(1) - Gst(3)
      208. Q(2) = Q(1) + 24.07
      209. Q(3) = Q(1) * T00
      210. Q(4) = Gst(1) * 24.07
      211. Q(3) = Q(4) + Q(3)
      212. Gst(5) = Q(3) / Q(2)
      213. Q(1) = Gst(2) - Gst(4)
      214. Q(2) = Q(1) + 24.07
      215. Q(3) = Q(1) * T00
      216. Q(4) = Gst(2) * 24.07
      217. Q(3) = Q(4) + Q(3)
      218. Gst(6) = Q(3) / Q(2)
      219. Korrektur = 3
      220. Gosub Zeiten_berechnen
      221. Temp_long = Round(beginn) ' Mondaufgang
      222. Temp_string3 = Time(temp_long)
      223. Zeit = Left(temp_string3 , 5)
      224. Mondaufgang = Zeit
      225. 'Print "Mondaufgang " ; Zeit
      226. Temp_long = Round(ende) ' Monduntergang
      227. Temp_string3 = Time(temp_long)
      228. Zeit = Left(temp_string3 , 5)
      229. Monduntergang = Zeit
      230. 'Print "Monduntergang " ; Zeit
      231. End If
      Display All
      Gruß Holger
      link zu mir..
      forum.auto-steuerung.de
      ___
    • BASCOM Source Code

      1. Temp_single1 = _hour * 0.008865372 ' mittlere synodische Umlaufzeit des Mondes pro Stunde
      2. Temp_single2 = Mondalter + Temp_single1
      3. Temp_single1 = Cos(temp_single2)
      4. Temp_single1 = 1 - Temp_single1
      5. Mondphase = Temp_single1 / 2
      6. Temp_single1 = Mondphase * 22
      7. Temp_integer1 = Round(temp_single1)
      8. Mondalter = Radians(temp_single2)
      9. 'Print "Mondalter " ; Mondalter
      10. #if Negativdisplay ' Negativ-Display ?
      11. If Mondalter < 1pi Then
      12. Temp_byte = Temp_integer1 + 32 ' zunehmender Mond
      13. Mond_ab_zu = 1
      14. Else
      15. Temp_byte = 76 - Temp_integer1 ' abnehmender Mond
      16. Mond_ab_zu = 0
      17. End If
      18. #else
      19. If Mondalter < 1pi Then
      20. Temp_byte = Temp_integer1 + 54 ' zunehmender Mond
      21. Mond_ab_zu = 1
      22. Else
      23. Temp_byte = 98 - Temp_integer1 ' abnehmender Mond
      24. Mond_ab_zu = 0
      25. End If
      26. #endif
      27. Mondsymbol = Temp_byte
      28. Temp_string5 = Chr(temp_byte)
      29. Temp_single1 = Mondphase * 100
      30. Temp_integer1 = Round(temp_single1)
      31. Mondsymbol_prozent = Temp_single1
      32. Temp_string1 = Str(temp_integer1)
      33. If Temp_integer1 = 100 Then ' Mondphase in %
      34. 'Print "Mondphase " ; Temp_string1 'Ganzzahl
      35. Else
      36. 'Print "Mondphase " ; Temp_string1 'Ganzzahl
      37. End If
      38. Temp_single1 = Mondalter * 46.99934 ' Mondalter in Tagen
      39. 'Print "Mondalter " ; Temp_single1
      40. Mondneigung = Fusing(temp_single1 , "##.#")
      41. Temp_integer1 = Round(temp_single1)
      42. Temp_string3 = Str(temp_integer1)
      43. Temp_string3 = Format(temp_string3 , " 0.0")
      44. Temp_string3 = Trim(temp_string3)
      45. Mondsymbol_alter_s = Val(temp_string3 )
      46. 'Print "Mondsymbol_alter " ; Mondsymbol_alter_s
      47. Q(3) = Val(temp_string3)
      48. Temp_byte = Len(temp_string3)
      49. Temp_byte = Temp_byte - 1
      50. Temp_string2 = Left(temp_string3 , Temp_byte)
      51. Temp_string1 = Right(temp_string3 , 1)
      52. Temp_string1 = Temp_string1 + Chr(63) + " "
      53. 'Print "Mondalter in Tagen " ; Temp_byte
      54. Mondsymbol_alter = Temp_string3
      55. If Temp_byte < 3 Then
      56. 'Lcdtext Temp_string1 , 205 , 106 , 4 , 0 , 1
      57. Else
      58. 'Lcdtext Temp_string1 , 205 , 110 , 4 , 0 , 1
      59. End If
      60. Q(4) = Neumond_zeit / 2
      61. Q(4) = Q(4) - 1
      62. Q(4) = Q(4) - Mondsymbol_alter_s
      63. Q(4) = Q(4) + 0.35 '0,0 = 23:33 zu 14:25 | 0,25 = 5:36 zu 14:25 | 0,5 = 11:38 zu 14:25 | 0,625 = 14:40 zu 14:25
      64. Q(3) = Q(4) * 24
      65. Q(3) = Q(3) * 60
      66. Q(3) = Q(3) * 60 'Rest sec von Mondmonat
      67. Lsyssec(1) = Syssec(_sec)
      68. Lsyssec(3) = Q(3)
      69. Lsyssec(3) = Lsyssec(3) + Lsyssec(1)
      70. Bsec = Time(lsyssec(3))
      71. Bday = Date(lsyssec(3))
      72. Neumond_strtime = Time(bsec)
      73. Neumond_strdate = Date(bday)
      74. '-------------[ Sonnenhoehe ]--------------
      75. 'Tageszahl
      76. Lsyssec(1) = Syssec(_sec)
      77. Bsec = Time(lsyssec(1))
      78. Bday = Date(lsyssec(1))
      79. Q(1) = Bmonth - 1
      80. Q(1) = Q(1) * 30
      81. Q(1) = Q(1) + Bday
      82. Q(1) = Q(1) + 0.5
      83. 'Print #2 ,"Q(1) " ; Q(1)
      84. 'Deklination
      85. Q(2) = Gradbogen * 360
      86. Q(3) = Q(1) + 10
      87. Q(4) = Q(2) * Q(3)
      88. Q(4) = Q(4) / 365
      89. Q(5) = Cos(q(4))
      90. Q(2) = -23.45 * Q(5)
      91. 'Print #2 , "Q(2) " ; Q(2)
      92. 'Zeitdiff
      93. Q(3) = Bmin / 60
      94. Q(4) = 15 - Longitude
      95. Q(4) = Q(4) / 15
      96. Q(5) = Bhour + Q(3)
      97. Q(5) = Q(5) - Q(4)
      98. Q(3) = Q(5) - 12
      99. Q(3) = Q(3) + 1 'neu
      100. Q(3) = Q(3) - Zeitzone 'neu
      101. 'Print #2 ,"Q(3) " ; Q(3)
      102. 'x
      103. Q(4) = Gradbogen * Latitude
      104. Q(4) = Sin(q(4))
      105. Q(5) = Gradbogen * Q(2)
      106. Q(5) = Sin(q(5))
      107. Q(6) = Gradbogen * Latitude
      108. Q(6) = Cos(q(6))
      109. Q(7) = Gradbogen * Q(2)
      110. Q(7) = Cos(q(7))
      111. Q(8) = Gradbogen * 15
      112. Q(8) = Q(8) * Q(3)
      113. Q(8) = Cos(q(8))
      114. Q(9) = Q(4) * Q(5)
      115. Q(10) = Q(6) * Q(7)
      116. Q(10) = Q(10) * Q(8)
      117. Q(4) = Q(9) + Q(10)
      118. 'Print #2 ,"Q(4) " ; Q(4)
      119. 'Sonnenhoehe
      120. Q(9) = Asin(q(4))
      121. Q(5) = Q(9) / Gradbogen
      122. Q(5) = Q(5) - 1 'neu
      123. Q(5) = Q(5) + Zeitzone 'neu
      124. Sonnenhoehe_ist = Q(5)
      125. 'Print #2 , "Sonnenhoehe " ; Sonnenhoehe_ist
      126. 'y
      127. Q(6) = Gradbogen * Latitude
      128. Q(6) = Sin(q(6))
      129. Q(6) = Q(6) * Q(4)
      130. Q(7) = Gradbogen * Q(2)
      131. Q(8) = Q(6) - Q(7)
      132. Q(6) = Gradbogen * Latitude
      133. Q(6) = Cos(q(6))
      134. Q(7) = Acos(q(4))
      135. Q(7) = Sin(q(7))
      136. Q(9) = Q(6) * Q(7)
      137. Q(10) = Q(8) / Q(9)
      138. Q(6) = -q(10)
      139. 'Print #2 , Q(6)
      140. 'Azimuth
      141. If _hour <= 12 Then
      142. Q(7) = Acos(q(6))
      143. Azimuth = Q(7) / Gradbogen
      144. Else
      145. Q(7) = Acos(q(6))
      146. Q(7) = Q(7) / Gradbogen
      147. Azimuth = 360 - Q(7)
      148. End If
      149. 'Print #2 ,"Azimuth " ; Azimuth
      150. '----------------------------------------
      151. Csec = 0 : Cmin = 0 : Chour = 11 : Cday = _day : Cmonth = _month : Cyear = _year
      152. Lsyssec(2) = Syssec(csec)
      153. If _hour > 15 Then Lsyssec(2) = Lsyssec(2) + 86400
      154. Lsyssec(4) = Lsyssec(2) + 10800 '10800=3h 5min=300
      155. For Lsyssec(3) = Lsyssec(2) To Lsyssec(4)
      156. 'Tageszahl
      157. Lsyssec(1) = Syssec(csec)
      158. Bsec = Time(lsyssec(1))
      159. Bday = Date(lsyssec(1))
      160. Q(1) = Bmonth - 1
      161. Q(1) = Q(1) * 30
      162. Q(1) = Q(1) + Bday
      163. Q(1) = Q(1) + 0.5
      164. 'Deklination
      165. Q(2) = Gradbogen * 360
      166. Q(3) = Q(1) + 10
      167. Q(4) = Q(2) * Q(3)
      168. Q(4) = Q(4) / 365
      169. Q(5) = Cos(q(4))
      170. Q(2) = -23.45 * Q(5)
      171. 'Zeitdiff
      172. Q(3) = Bmin / 60
      173. Q(4) = 15 - Longitude
      174. Q(4) = Q(4) / 15
      175. Q(5) = Bhour + Q(3)
      176. Q(5) = Q(5) - Q(4)
      177. Q(3) = Q(5) - 12
      178. Q(3) = Q(3) + 1 'neu
      179. Q(3) = Q(3) - Zeitzone 'neu
      180. 'x
      181. Q(4) = Gradbogen * Latitude
      182. Q(4) = Sin(q(4))
      183. Q(5) = Gradbogen * Q(2)
      184. Q(5) = Sin(q(5))
      185. Q(6) = Gradbogen * Latitude
      186. Q(6) = Cos(q(6))
      187. Q(7) = Gradbogen * Q(2)
      188. Q(7) = Cos(q(7))
      189. Q(8) = Gradbogen * 15
      190. Q(8) = Q(8) * Q(3)
      191. Q(8) = Cos(q(8))
      192. Q(9) = Q(4) * Q(5)
      193. Q(10) = Q(6) * Q(7)
      194. Q(10) = Q(10) * Q(8)
      195. Q(4) = Q(9) + Q(10)
      196. 'Sonnenhoehe
      197. Q(9) = Asin(q(4))
      198. Q(5) = Q(9) / Gradbogen
      199. Q(5) = Q(5) - 1 'neu
      200. Q(5) = Q(5) + Zeitzone 'neu
      201. Sonnenhoehe = Q(5)
      202. If Sonnenhoehe > Sonnenhoehe_max Then
      203. Sonnenhoehe_max = Sonnenhoehe
      204. Lsyssec_sonne_max = Lsyssec(3)
      205. End If
      206. Lsyssec(3) = Lsyssec(3) + 300
      207. Csec = Time(lsyssec(3))
      208. Cday = Date(lsyssec(3))
      209. Next Lsyssec(3)
      210. 'Sonnenhoehe_max
      211. Temp_string3 = Time(lsyssec_sonne_max)
      212. Sonnenhoehe_strtime = Left(temp_string3 , 5)
      213. 'Sonnenhoehe_strdate = Date(lsyssec_sonne_max)
      214. Mondphase_errechnen = 0
      215. If Sperren_2_funktion.0 = 0 Then Goto Mond_anzeige 'Nur in Ebene 1
      216. End If
      217. If Graph_funktion.1 = 0 And Sperren_2_funktion.0 = 0 Then
      218. Mond_anzeige:
      219. Set_font Font_mond
      220. Lcdtext_string = Chr(mondsymbol) ' Mondphasensymbol anzeigen
      221. Lcdtext Lcdtext_string , 113 , 151 , No_inverted , Rotate_0 'rüber - runter 62 17
      222. Set_font Font6x8_font
      223. Lcdtext_string = Sonnenaufgang
      224. Lcdtext Lcdtext_string , 113 , 137 , No_inverted , Rotate_0 'rüber - runter 62 17
      225. Lcdtext_string = Sonnenuntergang
      226. Lcdtext Lcdtext_string , 160 , 137 , No_inverted , Rotate_0 'rüber - runter 62 17
      227. 'Glcd_circ 125 , 163 , 14 , 0 'Kreis Zeichnen || x y Radius erase
      228. End If
      229. End Sub
      230. '-------------------------------------------------------------------------------
      Display All
      Das war alles!!
      Gruß Holger
      link zu mir..
      forum.auto-steuerung.de
      ___
    • BASCOM Source Code

      1. '--------------------[ Zeiten berechnen ]---------------------------------------
      2. Zeiten_berechnen:
      3. Q(1) = De(1) + De(2)
      4. Dem = Q(1) / 2 ' De Mittel
      5. Q(2) = Deg2rad(latitude)
      6. Q(2) = Sin(q(2))
      7. Q(3) = Cos(dem)
      8. Q(1) = Q(2) / Q(3)
      9. Q(1) = Acos(q(1)) ' Psi
      10. Q(1) = Sin(q(1))
      11. Select Case Korrektur
      12. Case 1
      13. Q(1) = 0.01449838 / Q(1) ' Korrektur Parallaxe, Refraktion und Sonnendurchmesser
      14. Q(1) = Asin(q(1))
      15. Q(1) = Q(1) / Q(3)
      16. Q(2) = Q(1) * Rad2h ' Delta t in Stunden
      17. Case 2
      18. Q(2) = 0 ' keine Korrektur für Dämmerung
      19. Case 3
      20. Q(2) = Mm(1) + Ec(1)
      21. Q(2) = Cos(q(2))
      22. Q(2) = Q(2) * 0.0549
      23. Q(2) = 1 + Q(2)
      24. Q(2) = 0.996986 / Q(2) ' p'
      25. Q(4) = 0.004521275 / Q(2) ' O/2
      26. Q(5) = 0.01659285 / Q(2) ' Pi
      27. Q(2) = Q(4) - Q(5)
      28. Q(2) = Q(2) + 0.009890199 ' Korrektur Parallaxe, Refraktion und Monddurchmesser
      29. Q(2) = Sin(q(2))
      30. Q(1) = Q(2) / Q(1)
      31. Q(1) = Asin(q(1))
      32. Q(1) = Q(1) / Q(3)
      33. Q(2) = Q(1) * Rad2h ' Delta t in Stunden
      34. End Select
      35. Q(1) = Gst(5) - Q(2)
      36. Q(1) = Q(1) - T00
      37. Q(1) = Q(1) * 0.9972696
      38. Q(1) = Q(1) + Zeitzone
      39. Select Case Q(1)
      40. Case Is < 0
      41. Q(1) = Q(1) + 24
      42. Case Is >= 24
      43. Q(1) = Q(1) - 24
      44. End Select
      45. Beginn = Q(1) * 3600 ' Aufgang
      46. Q(1) = Gst(6) + Q(2)
      47. Q(1) = Q(1) - T00
      48. Q(1) = Q(1) * 0.9972696
      49. Q(1) = Q(1) + Zeitzone
      50. Select Case Q(1)
      51. Case Is < 0
      52. Q(1) = Q(1) + 24
      53. Case Is >= 24
      54. Q(1) = Q(1) - 24
      55. End Select
      56. Ende = Q(1) * 3600 ' Untergang
      57. Return
      58. '-------------------------------------------------------------------------------
      Display All

      Das sind dann die Ergebnisse:


      BASCOM Source Code

      1. Gl_addr = Lcd_l6 + 2 : Msg = "Geogr. Laenge .......... :" : Gosub Gl_putmsg
      2. Gl_addr = Lcd_l6 + 29 : Msg = Fusing(latitude , "##.##") + " " + Chr(223) : Gosub Gl_putmsg
      3. Gl_addr = Lcd_l7 + 2 : Msg = "Geogr. Breite .......... :" : Gosub Gl_putmsg
      4. Gl_addr = Lcd_l7 + 29 : Msg = Fusing(longitude , "##.##") + " " + Chr(223) : Gosub Gl_putmsg
      5. 'Msg2 = Str(zeitzone)
      6. 'Msg2 = "Zeitzone ........... [" + Str(zeitzone)
      7. 'Msg2 = Msg2 + "] :"
      8. Gl_addr = Lcd_l8 + 2 : Msg = "Zeitzone ............... :" : Gosub Gl_putmsg
      9. If Zeitzone = 0 Then
      10. Gl_addr = Lcd_l8 + 29 : Msg = "valid DCF77" : Gosub Gl_putmsg
      11. End If
      12. If Zeitzone = 1 Then
      13. Gl_addr = Lcd_l8 + 29 : Msg = "MESZ [" + Str(zeitzone) + "] " : Gosub Gl_putmsg
      14. End If
      15. If Zeitzone = 2 Then
      16. Gl_addr = Lcd_l8 + 29 : Msg = "MEZ [" + Str(zeitzone) + "] " : Gosub Gl_putmsg
      17. End If
      18. Gl_addr = Lcd_l9 + 2 : Msg = "Sternzeit .............. :" : Gosub Gl_putmsg
      19. Gl_addr = Lcd_l9 + 29 : Msg = Sternzeit : Gosub Gl_putmsg
      20. Gl_addr = Lcd_l11 + 2 : Msg = "Mondphase .............. :" : Gosub Gl_putmsg
      21. Gl_addr = Lcd_l11 + 29 : Msg = Fusing(mondsymbol_prozent , "##.#") + " %" : Gosub Gl_putmsg
      22. If Mond_ab_zu = 1 Then
      23. Gl_addr = Lcd_l12 + 2 : Msg = "Mondphase ........ [<>] :" : Gosub Gl_putmsg
      24. Gl_addr = Lcd_l12 + 29 : Msg = "zunehmend" : Gosub Gl_putmsg
      25. 'Gl_addr = Lcd_l28 + 9 : Msg = "Zunehmend" : Gosub Gl_putmsg
      26. Else
      27. Gl_addr = Lcd_l12 + 2 : Msg = "Mondphase .............. :" : Gosub Gl_putmsg
      28. Gl_addr = Lcd_l12 + 29 : Msg = "abnehmend" : Gosub Gl_putmsg
      29. 'Gl_addr = Lcd_l28 + 9 : Msg = "Abnehmend" : Gosub Gl_putmsg
      30. End If
      31. Gl_addr = Lcd_l13 + 2 : Msg = "Mondalter ....... [Tage] :" : Gosub Gl_putmsg
      32. Gl_addr = Lcd_l13 + 29 : Msg = Mondsymbol_alter : Gosub Gl_putmsg 'Mondsymbol_alter
      33. Gl_addr = Lcd_l14 + 2 : Msg = "Mondaufgang ............ :" : Gosub Gl_putmsg
      34. Gl_addr = Lcd_l14 + 29 : Msg = Mondaufgang : Gosub Gl_putmsg
      35. Gl_addr = Lcd_l15 + 2 : Msg = "Monduntergang .......... :" : Gosub Gl_putmsg
      36. Gl_addr = Lcd_l15 + 29 : Msg = Monduntergang : Gosub Gl_putmsg
      37. Gl_addr = Lcd_l17 + 2 : Msg = "Azimut der Sonne ....... : " : Gosub Gl_putmsg
      38. Gl_addr = Lcd_l17 + 29 : Msg = Fusing(azimuth , "##.##") + " " + Chr(223) : Gosub Gl_putmsg
      39. Gl_addr = Lcd_l18 + 2 : Msg = "Hoehe d. Sonne a Horizont: " : Gosub Gl_putmsg
      40. Gl_addr = Lcd_l18 + 29 : Msg = Fusing(sonnenhoehe_ist , "##.##") + " " + Chr(223) : Gosub Gl_putmsg
      41. Gl_addr = Lcd_l19 + 2 : Msg = "Sonnenaufgang .......... :" : Gosub Gl_putmsg
      42. Gl_addr = Lcd_l19 + 29 : Msg = Sonnenaufgang : Gosub Gl_putmsg
      43. Gl_addr = Lcd_l20 + 2 : Msg = "Sonnenuntergang ........ :" : Gosub Gl_putmsg
      44. Gl_addr = Lcd_l20 + 29 : Msg = Sonnenuntergang : Gosub Gl_putmsg
      45. Msg2 = Fusing(sonnenhoehe_max , "##.#") + " " + Chr(223)
      46. Gl_addr = Lcd_l21 + 2 : Msg = "Sonnendurchgang :" : Gosub Gl_putmsg
      47. Gl_addr = Lcd_l21 + 19 : Msg = Msg2 : Gosub Gl_putmsg
      48. Gl_addr = Lcd_l21 + 29 : Msg = Sonnenhoehe_strtime : Gosub Gl_putmsg
      49. Gl_addr = Lcd_l22 + 2 : Msg = "Beginn voller Dunkelheit :" : Gosub Gl_putmsg
      50. Gl_addr = Lcd_l22 + 29 : Msg = Daemmerungsbeginn : Gosub Gl_putmsg
      51. Gl_addr = Lcd_l23 + 2 : Msg = "Ende voller Dunkelheit :" : Gosub Gl_putmsg
      52. Gl_addr = Lcd_l23 + 29 : Msg = Daemmerungsende : Gosub Gl_putmsg
      53. 'Gl_addr = Lcd_l26 + 9 : Msg = "Naechster Mondphase" : Gosub Gl_putmsg
      54. If Mond_ab_zu = 1 Then
      55. Gl_addr = Lcd_l26 + 9 : Msg = "Naechster Vollmond" : Gosub Gl_putmsg
      56. Else
      57. Gl_addr = Lcd_l26 + 9 : Msg = "Naechster Neumond" : Gosub Gl_putmsg
      58. End If
      Display All
      Gruß Holger
      link zu mir..
      forum.auto-steuerung.de
      ___