created by Carl Sabanski
Dialling with QBASIC - David WilliamsDavid Williams has created a number of QBASIC programs that would be of interest to diallists. These were discovered on some message boards where David posted them as text in his message and offered them to anyone who might find them useful. You can get them here.
"Shows Equation of Time and Solar Declination calculations (performed in function ET.Dec) and compares their results graphically with published values, showing close agreement.
These calculations can be used in the programs of computer-controlled solar-energy equipment, such as sun trackers and "heliostats.
Equation of Time is difference between Solar Time and Mean Time. Sundials show solar time. Clocks show mean time. The Equation of Time is related to solar longitude, relative to its mean value (the value it would have if the sun's apparent motion were at uniform speed). One degree westward of solar longitude corresponds to four minutes in positive direction in the Equation of Time.
Solar Declination is latitude of sun in celestial coordinates.
These calculations of Equation of Time and Solar Declination are simplified and approximate. However, they are quite good. All differences between calculated and published values of the solar declination are small compared with the angular size of the sun in the sky. Similarly, differences between calculated and published values of the Equation of Time are small compared with the time the sun takes to traverse its own diameter as it moves across the sky. The non-zero size of the sun, rather than any inaccuracies of calculation, is the limiting factor on how accurately the sun can be tracked in solar energy applications, using this routine.
The Equation of Time is treated here as the correction to be subtracted from a sundial reading to get local mean (clock) time. It is therefore positive when sundial is ahead of clock. This is the usual sign convention, but the opposite usage is sometimes found. Take care when comparing values of the Equation of Time from different sources.
Note that atmospheric refraction of light affects the apparent position of the sun in the sky when it is close to the horizon. Sunlight is then too weak to be used for most solar-energy applications, so refraction is not usually included in calculations related to solar energy. This program does not take account of refraction."
When the program is run the screen shown in Figure 1 is displayed and 4 options are available for selection.
1. Find Equation of Time and Solar
Declination on a given date
Figure 1: ETIMSDEC Options
As show in Figure 1, when option 1 is selected the program asks for a date. The date is entered as two numbers separated by a comma. The first is for the month and the second the day. The program returns values for the Equation of Time and Solar Declination for that date.
When option 2 is selected the graph of the Equation of Time is drawn on the screen as shown in Figure 2.
Figure 2: Equation of Time Graph
When option 3 is selected the graph of the Declination of the Sun is drawn on the screen as shown in Figure 3.
Figure 3: Declination of Sun Graph
"Calculates position of sun in sky, as azimuth (compass bearing measured clockwise from True North) and angle of elevation, as seen from any place on earth, on any date and any time. Also calculates alignment of a heliostat mirror."
When the program is run the screen shown in Figure 4 is displayed and 4 options are available for selection.
1. Calculate sun's position
Figure 4: SunAlign Options
Figure 5 shows the dialogue and output when option 3 is selected. Enter negative values for southern latitudes and eastern longitudes.
Figure 5: SunAlign Output
"This program designs a horizontal sundial, for use at any location. Three diagrams are produced. The first is the horizontal plate, showing the hour lines. This should be mounted so the north-south line shown on the design is aligned true north-south, pointing away from the nearer pole (so the line should point southward in the northern hemisphere).
The second diagram is a template for the sundial's gnomon. This should be mounted in a north-south vertical plane, in a line with the north-south line on the horizontal plate. The left end of the base of the gnomon should be at the point where all the hour-lines intersect. The sloping edge of the gnomon will be pointing at the nearer celestial pole, i.e. at the Pole Star in the northern hemisphere.
The third diagram is produced only if you have selected that the dial show clock time. It is a graph that shows the number of minutes that must be subtracted from the dial reading to make it agree with a clock.
When the program pauses at any point (such as right now), press any key to continue.
You can select whether to have the diagrams appear only on the screen, or if they should also be printed by an Epson-type printer, and/or saved to disk for later printing by some other utility. If you select to save them to disk, you will be asked for a filename. Suppose you select FNAME. The three files on disk will be named FNAME.DG1, FNAME.DG2 and FNAME.DG3. The files are BSAVEd (check QBASIC Help if interested) from screen memory. The first seven bytes of each file contain addresses, etc.. The rest is a string of bytes that are the bytes in memory representing the SCREEN 11 image."
Figure 6 shows the dialogue when the program is run. The example chosen is for a sundial that shows clock time. Enter negative values for southern latitudes and eastern longitudes. If the screens are to be saved to file the files will be written to the directory where the QBASIC program is located.
Figure 6: SUNDIAL Dialogue
Figure 7 shows the sundial drawn on the screen. The hour lines are corrected for the Equation of Time.
Figure 7: Screen Drawing of Sundial
Figure 8 shows the gnomon drawn on the screen.
Figure 8: Screen Drawing of Gnomon
Because the sundial is intended to show clock time the third drawing that appears on the screen is a graph of the Equation of Time. This is shown in Figure 9.
Figure 9: Screen Drawing of the Equation of Time