'------------------------------------------------------------ ' geoLib Test Code '------------------------------------------------------------ ' This series of subroutines test various aspects of the ' geoLib. '------------------------------------------------------------ ' testGeoSun() ' This routine tests the functions of the solar position routines '------------------------------------------------------------ Sub testGeoSun() Dim loc As GEO_LOCATION Dim retval, sunError As Long Dim az, el, az2, el2 As Double Dim t As tm '-- Init the structure with the coordinates retval = geoInitLocation(loc, GEO_TEST_LAT, GEO_TEST_LON, GEO_TEST_HGT, GEO_TEST_DATUM, "Point Bravo") 'retval = geoInitLocation(loc, 36.534358, -115.563083, 973.80509, GEO_TEST_DATUM, "Point Charley") ' First make sure the data filled the structure OK MsgBox " Lat = " & FormatNumber(loc.lat, 3) & _ " Lon = " & FormatNumber(loc.lon, 3) & _ " Hgt = " & FormatNumber(loc.hgt, 1) & _ " MagDec= " & FormatNumber(loc.Declination, 2) & _ " " & loc.name, 0, "Structure Checkout" 'MsgBox loc.name & " E= " & loc.e & " F= " & loc.f & " G= " & loc.g '------------------------------------------------------------ ' -- Get the sun's position right now '------------------------------------------------------------ retval = geoSunAzElNow(loc, az, el) sunError = geoGetSunError() If sunError <> 0 Then MsgBox "2 sunError= " & sunError '- print the sun position at this time MsgBox " AZ = " & FormatNumber(az, 2) & _ " EL " & FormatNumber(el, 2), 0, "Current Sun Position" '------------------------------------------------------------ ' -- print the sun position at noon on 6/1/2004 '------------------------------------------------------------ t.tm_hour = 12 + 6 t.tm_sec = 0 t.tm_min = 0 t.tm_year = 104 ' - year - 1900 = 104 t.tm_mon = 5 ' - 5=June [Legal Values = [0..11]] t.tm_mday = 1 ' - Day of the month retval = geoSunAzEltm(loc, az, el, t) sunError = geoGetSunError() If sunError <> 0 Then MsgBox "3 sunError= " & sunError '- print the sun position at noon 6/1/04 MsgBox " AZ = " & FormatNumber(az, 2) & _ " EL " & FormatNumber(el, 2), 0, _ " Sun Position at noon on " & t.tm_mon + 1 & "/" & t.tm_mday & "/" & t.tm_year + 1900 End Sub '------------------------------------------------------------ ' testXyz2Rae() ' This routines simply tests the conversion from simple ' X, Y, Z coordinates to polar coordinates of Azimuth, Elevation, ' and Range and then back again ' - XYZ are all 10000 meters ' - Azimuth should be at 45 degrees ' - Elevation should be at 35.264 degrees ' - Range should be 17,320 meters '------------------------------------------------------------ Sub testXyz2Rae() Dim xyz(0 To 2) As Double Dim aer(0 To 2) As Double ' --- initialize coordinates xyz(GEO_X) = 10000# xyz(GEO_Y) = 10000# xyz(GEO_Z) = 10000# ' -- Convert to RAE Call geoXyz2Rae(xyz(0), aer(0)) MsgBox "RANGE=" & FormatNumber(aer(GEO_RNG), 1) & _ " AZ=" & FormatNumber(RAD_TO_DEG * aer(GEO_AZ), 1) & _ " EL=" & FormatNumber(RAD_TO_DEG * aer(GEO_EL), 3) ' -- Convert back to XYZ Call geoRae2Xyz(aer(0), xyz(0)) MsgBox " X=" & FormatNumber(xyz(GEO_X), 1) & _ " Y=" & FormatNumber(xyz(GEO_Y), 1) & _ " Z=" & FormatNumber(xyz(GEO_Z), 1) End Sub