0 1 1 633885549973058962 0 6 19 true true Shaded solarPos.ghx 633885387930800675 0 229 112 0.640000045 0 9 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Latitude fe3076ee-2135-48bc-b53a-a4a2e0c68035 true true 0 127 141 214 20 127 141 52 20 126.8125 140.7708 false true 38 -90 90 4 0 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Longitude 2934a6f2-2336-4c5c-a145-5d267a8ae403 true true 0 127 101 214 20 127 101 62 20 126.9375 101.1875 false true 50 -180 180 4 0 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Timezone 24c4467a-c6f7-4ede-a7f8-b580f8c6ce4f true true 0 127 180 214 20 127 180 62 20 127 179.6667 false true 4 -12 12 4 1 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Month 979e9c75-66d0-4242-b999-f115dede8836 true true 0 127 219 214 20 127 219 44 20 127 219 false true 5 1 12 4 1 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Day a3cfaea9-5317-4b36-83c5-26e59b301527 true true 0 127 258 214 20 127 258 33 20 127 258.3333 false true 11 1 31 4 1 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Hour 7f071bc9-5468-4d74-8577-c9bed86383b6 true true 0 127 298 214 20 127 298 37 20 127 297.6667 false true 12 0 23 4 1 57da07bd-ecab-415d-9d86-af36d7073abc Number Slider Minutes 80f11eef-c9d0-4884-ad26-8e179cb40919 true true 0 127 337 214 20 127 337 52 20 127 337 false true 32 0 59 4 1 fb6aba99-fead-4e42-b5d8-c6de5ff90ea6 DotNET VB Script 'declare variables Dim lat, lon, timezone_rad, fLocalTime, fSunrise, fSunset, Hour_Angle As Double Dim Julian, t, m As Int32 Dim fSolarTime(3) As Double Dim sMinute, sHour As String ' convert latitude, longitude and timezone to radians lat = Radian(Latitude) lon = Radian(Longitude) timezone_rad = Radian(Timezone * 15) ' get Julian Day Julian = J_Day(Month, Day) 'get Declination fDeclination = Dec(Julian) 'get equation of time fEquation = EquationOfTime(Julian) 'get local time fLocalTime = Local_Time(Hour, Minute) 'get SolarTime fSolarTime = Solar_Time(lon, lat, timezone_rad, fLocalTime, fEquation, fDeclination) fSunrise = fSolarTime(1) fSunset = fSolarTime(2) ' get hour angle Hour_Angle = H_Ang(fSolarTime(0)) 'get altitude fAltitude = Alt(lat, fDeclination, Hour_Angle) 'get Azimuth fAzimuth = Azimuth(lat, fAltitude, fDeclination, Hour_Angle, fLocalTime) ''PREPARE OUTPUT VALUES 'Output declination fDeclination = Degree(fDeclination) 'Output equation of time fEquation = fEquation * 60 'Output altitude value fAltitude = Degree(fAltitude) 'Output azimuth value fAzimuth = Degree(fAzimuth) ' Output solar time. t = CInt(Math.Floor(fSolarTime(0))) m = CInt(Math.Floor((fSolarTime(0) - t) * 60.0)) If (m < 10) Then sMinute = "0" + CStr(m) Else sMinute = CStr(m) End If If (t < 10) Then sHour = "0" + CStr(t) Else sHour = CStr(t) End If sSolarTime = sHour + ":" + sMinute 'Output Sunrise time Print("sunrise returned = " & fSunrise) t = CInt(Math.Floor(fSunrise)) m = CInt(Math.Floor((fSunrise - t) * 60.0)) Print(t) Print(m) If (m < 10) Then sMinute = "0" + CStr(m) Else sMinute = CStr(m) End If Print(sMinute) If (t < 10) Then sHour = "0" + CStr(t) Else sHour = CStr(t) End If sSunrise = sHour + ":" + sMinute 'Output Sunset time t = CInt(Math.Floor(fSunset)) m = CInt(Math.Floor((fSunset - t) * 60.0)) If (m < 10) Then sMinute = "0" + CStr(m) Else sMinute = CStr(m) End If If (t < 10) Then sHour = "0" + CStr(t) Else sHour = CStr(t) End If sSunset = sHour + ":" + sMinute Function Radian(ByVal degree As Double) As Double 'convert from degree to radian Return (Math.PI / 180.0) * degree End Function Function Degree(ByVal radian As Double) As Double Return radian * 180.0 / Math.PI End Function Function J_Day(ByVal Month As Object, ByVal Day As Object) As Int32 'declare day as an int variable Dim jday As Int32 = 0 'analyze the value of month (x) and day (y) Select Case Month Case 1 jday = 0 + Day Case 2 jday = 31 + Day Case 3 jday = 59 + Day Case 4 jday = 90 + Day Case 5 jday = 120 + Day Case 6 jday = 151 + Day Case 7 jday = 181 + Day Case 8 jday = 212 + Day Case 9 jday = 243 + Day Case 10 jday = 273 + Day Case 11 jday = 304 + Day Case 12 jday = 334 + Day End Select Return jday End Function Function Dec(ByVal J_Day As Object) As Double Dim t As Double Dim fdec As Double t = 2 * Math.PI * ((J_Day - 1) / 365.0) fdec = 0.322003 - 22.971 * Math.Cos(t) - 0.357898 * Math.Cos(2 * t) - 0.14398 * Math.Cos(3 * t) + 3.94638 * Math.Sin(t) + 0.019334 * Math.Sin(2 * t) + 0.05928 * Math.Sin(3 * t) 'Convert degrees to radians If fdec > 89.9 Then fdec = 89.9 Else If dec < -89.9 Then fdec = -89.9 End If fdec = fdec * Math.PI / 180 'return the value of dec Return fdec End Function Function EquationOfTime(ByVal J_Day As Object) As Double Dim t As Double Dim fEquation As Double t = (279.134 + 0.985647 * J_Day) * (Math.PI / 180.0) fEquation = 5.0323 - 100.976 * Math.Sin(t) + 595.275 * Math.Sin(2 * t) + 3.6858 * Math.Sin(3 * t) - 12.47 * Math.Sin(4 * t) - 430.847 * Math.Cos(t) + 12.5024 * Math.Cos(2 * t) + 18.25 * Math.Cos(3 * t) 'convert seconds to hours fEquation = fEquation / 3600.00 Return fEquation End Function Function Local_Time(ByVal Hour As Object, ByVal Minute As Object) As Double Return Hour + (Minute / 60.0) End Function Function H_Ang(ByVal solartime As Object) As Double Return (15 * (solartime - 12) * (Math.PI / 180.0)) End Function Function Alt(ByVal fLatitude As Object, ByVal fDeclination As Object, ByVal fHourAngle As Object) As Double Dim t As Double t = Math.Sin(fDeclination) * Math.Sin(fLatitude) + Math.Cos(fDeclination) * Math.Cos(fLatitude) * Math.Cos(fHourAngle) Return Math.Asin(t) End Function Function Azimuth(ByVal fLatitude As Object, ByVal fAltitude As Object, ByVal fDeclination As Object, ByVal fHourAngle As Object, ByVal fLocalTime As Object) As Double Dim t, sin1, cos2, fAzimuth As Double t = (Math.Cos(fLatitude) * Math.Sin(fDeclination)) - (Math.Cos(fDeclination) * Math.Sin(fLatitude) * Math.Cos(fHourAngle)) Print("t = " & t) ' Avoid division by zero Error. If (fAltitude < (Math.PI / 2.0)) Then sin1 = (-Math.Cos(fDeclination) * Math.Sin(fHourAngle)) / Math.Cos(fAltitude) cos2 = t / Math.Cos(fAltitude) Else sin1 = 0.0 cos2 = 0.0 End If Print("sin1 = " & sin1) Print("cos2 = " & cos2) 'Some range checking. If sin1 > 1.0 Then sin1 = 1.0 If sin1 < -1.0 Then sin1 = -1.0 If cos2 < -1.0 Then cos2 = -1.0 If cos2 > 1.0 Then cos2 = 1.0 Print("sin1 = " & sin1) Print("cos2 = " & cos2) ' Calculate azimuth subject To quadrant. If (sin1 < -0.99999) Then fAzimuth = Math.Asin(sin1) Else If (sin1 > 0.0) And (cos2 < 0.0) Then If sin1 >= 1.0 Then fAzimuth = -(Math.PI / 2.0) Else fAzimuth = (Math.PI / 2.0) + ((Math.PI / 2.0) - Math.Asin(sin1)) End If Else If (sin1 < 0.0) And (cos2 < 0.0) Then If (sin1 <= -1.0) Then fAzimuth = (Math.PI / 2.0) Else fAzimuth = -(Math.PI / 2.0) - ((Math.PI / 2.0) + Math.Asin(sin1)) End If Else fAzimuth = Math.Asin(sin1) End If ' A little last-ditch range check. If (fAzimuth < 0.0) And (fLocalTime < 10.0) Then fAzimuth = -fAzimuth End If Return fAzimuth End Function Function Solar_Time(ByVal fLongitude As Object, ByVal fLatitude As Object, ByVal fTimeZone As Object, ByVal fLocalTime As Object, ByVal fEquation As Object, ByVal fDeclination As Object) As Double() Dim fDifference, local_noon, test, t, fSunrise, fSunset, fSolarTime As Double Dim solartime(3) As Double Print("Current values:") Print(" fLatitude = " & fLatitude) Print(" fLongitude = " & fLongitude) Print(" fTimeZone = " & fTimeZone) Print(" fLocaltime = " & fLocaltime) Print(" fEquation = " & fEquation) Print(" fDeclination = " & fDeclination) Print("----") 'Calculate difference (in minutes) from reference longitude. fDifference = ((fLongitude - fTimeZone) * 180 / Math.PI) * 4 / 60.0 Print("Data produced in the function:") Print(" fDifference = " & fDifference) 'Convert solar noon to local noon. local_noon = 12.0 - fEquation - fDifference Print(" local_noon = " & local_noon) 'Calculate angle normal to meridian plane. If fLatitude > (0.99 * (Math.PI / 2.0)) Then fLatitude = (0.99 * (Math.PI / 2.0)) Else If fLatitude < -(0.99 * (Math.PI / 2.0)) Then fLatitude = -(0.99 * (Math.PI / 2.0)) End If test = -Math.Tan(fLatitude) * Math.Tan(fDeclination) Print(" test = " & test) If test < -1 Then t = Math.Acos(-1.0) / (15 * (Math.PI / 180.0) ) Else If test > 1 Then t = Math.Acos(1.0) / (15 * (Math.PI / 180.0) ) Else t = Math.Acos(test) / (15 * (Math.PI / 180.0) ) End If Print(" t = " & t) 'Sunrise and sunset fSunrise = local_noon - t fSunset = local_noon + t 'Check validity Of local time. If fLocalTime > fSunset Then fLocalTime = fSunset If fLocalTime < fSunrise Then fLocalTime = fSunrise If fLocalTime > 24.0 Then fLocalTime = 24.0 If fLocalTime < 0.0 Then fLocalTime = 0.0 'Calculate solar time. fSolarTime = fLocalTime + fEquation + fDifference Print("----") Print("Output data:") Print(" fSunset = " & fSunset) Print(" fSunrise = " & fSunrise) Print(" fSolarTime = " & fSolarTime) solartime(0) = fSolarTime solartime(1) = fSunrise solartime(2) = fSunset Return solartime End Function 0 Solar Position 205da3a3-8c62-4a62-bd55-1d071ae9b513 true true longest_list 497 141 153 164 557 143 24 160 569.3749 222.9999 false true 7 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Longitude Script Variable Longitude true true 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Latitude Script Variable Latitude true true 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Timezone Script Variable Timezone true true 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Month Script Variable Month true true 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Day Script Variable Day true true 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Hour Script Variable Hour true true 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2 Variable Minute Script Variable Minute true true 8 3ede854e-c753-40eb-84cb-b48008f14fd4 Output Print, Reflect and Error streams true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result fDeclination Output parameter fDeclination true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result fEquation Output parameter fEquation true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result fAzimuth Output parameter fAzimuth true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result fAltitude Output parameter fAltitude true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result sSolarTime Output parameter sSolarTime true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result sSunrise Output parameter sSunrise true false 8ec86459-bf01-4409-baee-174d0d2b13d0 Result sSunset Output parameter sSunset true false Longitude 3210e001-4242-425f-a73f-834348ebe5dc true true 1 2934a6f2-2336-4c5c-a145-5d267a8ae403 true 499 143 58 23 499 143 58 23 528 154.4286 false true Latitude 57c324b1-df1a-43b3-8fe5-fa07c5a0062c true true 1 fe3076ee-2135-48bc-b53a-a4a2e0c68035 true 499 166 58 23 499 166 58 23 528 177.2857 false true Timezone 995d6e66-40ed-4cc7-aa2e-28ed766225e6 true true 1 24c4467a-c6f7-4ede-a7f8-b580f8c6ce4f true 499 189 58 23 499 189 58 23 528 200.1429 false true Month cac4365a-16d8-41ba-ab9e-10687893c210 true true 1 979e9c75-66d0-4242-b999-f115dede8836 true 499 212 58 22 499 212 58 22 528 223 false true Day c67110d4-83eb-4725-9875-bde9f8a588f9 true true 1 a3cfaea9-5317-4b36-83c5-26e59b301527 true 499 234 58 23 499 234 58 23 528 245.8571 false true Hour 834c3b62-04a9-4e77-b683-8e0f5cfcb920 true true 1 7f071bc9-5468-4d74-8577-c9bed86383b6 true 499 257 58 23 499 257 58 23 528 268.7143 false true Minute a171edc4-cd85-4bf4-857b-f7d1b86cb6a1 true true 1 80f11eef-c9d0-4884-ad26-8e179cb40919 true 499 280 58 23 499 280 58 23 528 291.5714 false true out 0583c99b-afb9-4576-a237-2ff606dc90dd true true 0 0 581 143 67 20 581 143 67 20 614.5 153 false true fDeclination 82b14354-6a43-4167-83c4-8dd07b3434bd true true 0 581 163 67 20 581 163 67 20 614.5 173 false true fEquation 5b219bd7-9c35-43ef-aa4d-e6c3233fa63e true true 0 581 183 67 20 581 183 67 20 614.5 193 false true fAzimuth 4e2966ce-59e9-4da8-b5ad-310f42fb2785 true true 0 581 203 67 20 581 203 67 20 614.5 213 false true fAltitude 71592c28-1678-4aa3-b435-0468ff6fc1c1 true true 0 581 223 67 20 581 223 67 20 614.5 233 false true sSolarTime d1f7b117-02ba-4aa4-98a8-392b8df5d5c1 true true 0 581 243 67 20 581 243 67 20 614.5 253 false true sSunrise 3ed5f23f-ecc6-4db7-b45a-0ba62e82fb6b true true 0 581 263 67 20 581 263 67 20 614.5 273 false true sSunset 6ee0f5fe-fdcc-4340-b8ba-859e61377ed1 true true 0 581 283 67 20 581 283 67 20 614.5 293 false true 59e0b89a-e487-49f8-bab8-b5bab16be14c Panel 10fb40f3-d8c4-4059-b186-965cadc5b90d true true 7 82b14354-6a43-4167-83c4-8dd07b3434bd 5b219bd7-9c35-43ef-aa4d-e6c3233fa63e 4e2966ce-59e9-4da8-b5ad-310f42fb2785 71592c28-1678-4aa3-b435-0468ff6fc1c1 d1f7b117-02ba-4aa4-98a8-392b8df5d5c1 3ed5f23f-ecc6-4db7-b45a-0ba62e82fb6b 6ee0f5fe-fdcc-4340-b8ba-859e61377ed1 Double click to edit panel content… true true true 0 false 0 0 0 255 255 250 90 255 831 153 160 140 831 153 160 140 830.6248 152.9035 false true