w w w . P r o v a t o S y s . c o m
M i c h a e l   C a t a l a n i
9 0 1 . 5 8 1 . 8 7 9 1

 

               


DOWNLOAD THE SOLARTIME LIBRARY!

Download Video

Download Steps For SolarTime Library  (V5R3M0 or Later)

  1. Download the following file (SOLARTIME.SAVF) by clicking HERE
     
  2. When prompted as to whether to save or open the file, specify to save it.
     
  3. Specify where on your pc you would like to save the file.  
     
  4. Create a savefile on your AS400 / iSeries.  I suggest a save file called SOLARTIME in QGPL.
    CRTSAVF QGPL/SOLARTIME
     
  5. Get a command box on your pc by using
    START / RUN / COMMAND
     
  6. At the prompt, key in
    FTP {system name}
    where system name is the name or ip address of your AS400 / iSeries.
     
  7. When prompted, enter your User Profile
     
  8. When Prompted, enter your password
     
  9.  Type in BIN
     You will be told that the representation type is binary.
     
  10. Type in PUT
     
  11. The system will prompt you for the local file, which is where you saved the SOLARTIME.SAV during the download step. For example, if you saved the file to the root directory on the c: drive, then enter
    c:\solartime.savf
     
  12. You will be prompted for the remote file. This is the path and file for the save file on your system. If you used QGPL/SOLARTIME for the save file in step 4 above, then key in
    /QSYS.LIB/QGPL.LIB/SOLARTIME.SAVF
     
  13. The Solar_s service program and sample programs are in a library called SOLARTIME. Restore the SOLARTIME library. If you want to rename the SOLARTIME library, then change the  RSTLIB keyword to the new library name.
    RSTLIB SAVLIB(SOLARTIME) DEV(*SAVF) SAVF(QGPL/SOLARTIME)
     
  14. Add the SOLARTIME library to your library list (or the library you specified on the RSTLIB command).
     
  15. On the command line, enter
    CALL SOLARTIME

 

 

 

Get the Sunrise, Sunset, and Solar Noon times for any given day for practically any place on Earth!

The Solar_s service program will calculate the sunrise, sunset, and solar noon times for any given day for practically any place on Earth.  ( Places that reside above 70degrees latitude or below -70degrees latitude will not be accurate.)  The service program can also calculate the length of the day for a given date.

The following is a sample call to calculate the sunrise time:

        SunRiseTime = Solar_GetSunriseTime(  SunRiseDate
                                                                        : Latitude
                                                                        : Longitude
                                                                        : HourOffset
                                                                        : DayLightSavings );

 

The sunrise and sunset functions require 5 parameters.

SunRiseDate:    The date to calculate the sunrise for.

Latitude:     The latitude of the location in decimal form.  ( If your latitude is specified in degrees, minutes, and seconds, then do the following to convert it to decimal form. The degrees will be the whole number portion, and the minutes divided by 60 will be the decimal portion.  For example, if you latitude is 45 degrees, 24 minutes, then the decimal form of your latitude would be 45 . 24/60  or 45. 4.  

Longitude:   The longitude of the location in decimal form.  See the latitiude section above on how to convert a longitude in degrees and minutes into decimal form.

HourOffset:    This is the value, in hours, of the difference between the local time and Greenwich Mean Time. For example, the HourOffset for New York City is 5. For Beijing, China, it is -8. For London, England it is Zero.

DayLightSavings:  This parameter states whether or not daylight savings time is in effect.  The default is no.  If daylight savings time is in effect for the area you are calculating, then set the DayLightSavings field to *on.

The solar functions will not be accurate for the polar regions. (ie latitudes greater than or +70 or less than -70 degrees.)  This is because I wanted these functions to return only a time.  In the polar regions, some days will not have a sunrise, and some days will not have a sunset.  For example, on June 10th, 2009, sunrise for the location of +80 latitude and +90 longitude does not occur on June  10th.  In fact, sunrise would have occurred all the way back on April 12th.  Sunset will not occur until August 30th.   If we change the date to December 10th, 2009, then sunrise will occur on Feb 20, 2010.  Sunset will not occur again until late August, 2010.  The prior sunset for this date was October 20th, 2009. Therefore, these functions would need to return a timestamp in order to reflect the actual sunrise and sunset times for a given date in the polar regions. (The calculations would also need to be modified a bit as well.) Since I only wanted to return a time value, and since I really don't need the sunrise and sunset times for polar regions, I have set up these functions so that they are accurate only to +-70 degrees latitude or so.

 

If you execute the SolarTime program, you will receive a screen that looks similar to the one below. ( Use the download steps on the left hand side of this page.  Add the SolarTime library to your library  list, then CALL SOLARTIME

If you want to see the sunrise and sunset times for your local area, then lookup the latitude and longitude values for your area.  Remember that these value must be in decimal form.  Also, you will need to find the Time Offset from the Greenwich meant time for you area.  The eastern time zone for the US is typically 5, the central time zone is 6, the mountain time zone is 7, and the pacific time zone is 8.

 

Functions In This Service Program

The Solar_s service program contains the following functions:

Solar_GetSunRiseTime Returns a time field containing the sunrise time
Solar_GetSunSetTime Returns a time field containing the sunset time
Solar_GetSolarNoonTime Returns a time field containing the time when the sun is at it's highest peak in the sky
Solar_GetLengthOfDay Returns the length of the day in seconds