… und kann ebenfalls mit ganz o.a. Script realisiert werden. Sieht dann so aus:
<?
// Quelle: http://www.ip-symcon.de/forum/f52/sonnenstand-berechnen-azimut-elevation-14925/
// Coordinates format is the pair of latitude and longitude, with sign minus (-) for the direction south latitude and west longitude separate by comma simbol (,), here some example:
// 52.5163 , 13.3779
// 40.7682 , -73.9816
// -22.9708 , -43.1830
//function calcSunPos( $iYear, $iMonth, $iDay, $dHours, $dMinutes, $dSeconds, $dLongitude, $dLatitude)
$long = getValue(49362 /*[Astro, Geo, Sommerzeit\Standortdaten\Longitude]*/ ); // Längengrad
$lat = getValue(15067 /*[Astro, Geo, Sommerzeit\Standortdaten\Latitude]*/ ); // Breitengrad
calcSunPos( gmdate("y"), gmdate("m"), gmdate("d"), gmdate("H"), gmdate("i"), 0, $long, $lat); // location Hamburg Öjendorf, Germany
//function calcSunPos( int iYear,int iMonth,int iDay,double dHours, double dMinutes,double dSeconds, double dLongitude, double dLatitude)
function calcSunPos( $iYear, $iMonth, $iDay, $dHours, $dMinutes, $dSeconds, $dLongitude, $dLatitude)
{
$pi = 3.14159265358979323846;
$twopi = (2*$pi);
$rad = ($pi/180);
$dEarthMeanRadius = 6371.01; // In km
$dAstronomicalUnit = 149597890; // In km
// Calculate difference in days between the current Julian Day
// and JD 2451545.0, which is noon 1 January 2000 Universal Time
// Calculate time of the day in UT decimal hours
$dDecimalHours = floatval($dHours) + (floatval($dMinutes) + floatval($dSeconds) / 60.0 ) / 60.0;
// Calculate current Julian Day
$iYfrom2000 = $iYear;//expects now as YY ;
$iA= (14 - ($iMonth)) / 12;
$iM= ($iMonth) + 12 * $iA -3;
$liAux3=(153 * $iM + 2)/5;
$liAux4= 365 * ($iYfrom2000 - $iA);
$liAux5= ( $iYfrom2000 - $iA)/4;
$dElapsedJulianDays= floatval(($iDay + $liAux3 + $liAux4 + $liAux5 + 59)+ -0.5 + $dDecimalHours/24.0);
// Calculate ecliptic coordinates (ecliptic longitude and obliquity of the
// ecliptic in radians but without limiting the angle to be less than 2*Pi
// (i.e., the result may be greater than 2*Pi)
$dOmega= 2.1429 - 0.0010394594 * $dElapsedJulianDays;
$dMeanLongitude = 4.8950630 + 0.017202791698 * $dElapsedJulianDays; // Radians
$dMeanAnomaly = 6.2400600 + 0.0172019699 * $dElapsedJulianDays;
$dEclipticLongitude = $dMeanLongitude + 0.03341607 * sin( $dMeanAnomaly ) + 0.00034894 * sin( 2 * $dMeanAnomaly ) -0.0001134 -0.0000203 * sin($dOmega);
$dEclipticObliquity = 0.4090928 - 6.2140e-9 * $dElapsedJulianDays +0.0000396 * cos($dOmega);
// Calculate celestial coordinates ( right ascension and declination ) in radians
// but without limiting the angle to be less than 2*Pi (i.e., the result may be
// greater than 2*Pi)
$dSin_EclipticLongitude = sin( $dEclipticLongitude );
$dY1 = cos( $dEclipticObliquity ) * $dSin_EclipticLongitude;
$dX1 = cos( $dEclipticLongitude );
$dRightAscension = atan2( $dY1,$dX1 );
if( $dRightAscension < 0.0 ) $dRightAscension = $dRightAscension + $twopi;
$dDeclination = asin( sin( $dEclipticObliquity )* $dSin_EclipticLongitude );
// Calculate local coordinates ( azimuth and zenith angle ) in degrees
$dGreenwichMeanSiderealTime = 6.6974243242 + 0.0657098283 * $dElapsedJulianDays + $dDecimalHours;
$dLocalMeanSiderealTime = ($dGreenwichMeanSiderealTime*15 + $dLongitude)* $rad;
$dHourAngle = $dLocalMeanSiderealTime - $dRightAscension;
$dLatitudeInRadians = $dLatitude * $rad;
$dCos_Latitude = cos( $dLatitudeInRadians );
$dSin_Latitude = sin( $dLatitudeInRadians );
$dCos_HourAngle= cos( $dHourAngle );
$dZenithAngle = (acos( $dCos_Latitude * $dCos_HourAngle * cos($dDeclination) + sin( $dDeclination )* $dSin_Latitude));
$dY = -sin( $dHourAngle );
$dX = tan( $dDeclination )* $dCos_Latitude - $dSin_Latitude * $dCos_HourAngle;
$dAzimuth = atan2( $dY, $dX );
if ( $dAzimuth < 0.0 )
$dAzimuth = $dAzimuth + $twopi;
$dAzimuth = $dAzimuth / $rad;
// Parallax Correction
$dParallax = ($dEarthMeanRadius / $dAstronomicalUnit) * sin( $dZenithAngle);
$dZenithAngle = ($dZenithAngle + $dParallax) / $rad;
$dElevation = 90 - $dZenithAngle;
// IP Symcon -> Create and take your own variables
// Save Azimuth and Elevation as Float values
SetValueFloat(18004 /*[Astro, Geo, Sommerzeit\Sonnenstand\Sonnenstand\Azimut]*/ , $dAzimuth);
SetValueFloat(38123 /*[Astro, Geo, Sommerzeit\Sonnenstand\Sonnenstand\Elevation]*/ , $dElevation);
}
// Funktion zur Berechnung des Sommerzeit-Startdatums
function dst_start($year) {
return mktime(2,0,0,3,31 - date('w', mktime(2,0,0,3,31,$year)),$year);
}
// Funktion zur Berechnung des Sommerzeit-Enddatums
function dst_end($year) {
return mktime(2,0,0,10,31 - date('w', mktime(2,0,0,10,31,$year)),$year);
}
?>