Posted by GeekBoy on April 30, 2007, 3:29 am
got itin C++? ;-)
> Many years ago, I built a computer-controlled heliostat that I used for
> daytime illumination of a dark room in my house. (Unfortunately, since
> then, a tree in my neighbour's yard has grown so it shades the
> heliostat...) I made the hardware as simple and cheap as possible, and
> did as much as I could with the computer software, which I wrote myself.
> So, for example, there were no sensors to find the position of the sun
> in the sky. The computer calculated where the sun must be, using the
> parameters of the earth's orbital and rotational motions and the
> current date and time. It figured out the direction in which the mirror
> should be pointed so as reflect sunlight in the desired direction, and
> sent signals to the stepping motors that rotated the mirror. The thing
> worked very well, for many years.
> The astronomical calculation of the position of the sun is not really
> very difficult. It can be expressed as latitude (which is usually
> called "declination" by astronomers) and longitude relative to its
> "mean" value, which would be the one it would have if its apparent
> motion across the sky were at exactly uniform speed. In reality, the
> speed is not quite constant, partly because the earth's axis is tilted,
> and partly because its orbit is elliptical, not circular. This is why
> sundials do not keep good time, as measured by clocks. A quantity
> called the "equation of time" shows the difference between sundial and
> clock time. The equation is closely related to the solar longitude. One
> degree of longitude corresponds to four minutes in the equation of
> time.
> I'll append a little QBasic program below that calculates the sun's
> declination and the equation of time on any date of the year. The
> coding that does the calculation is in a function called ET.Dec. It
> should be easy to translate to any other programming language, if
> required.
> If anyone here is interested in making a sun-tracker or heliostat, this
> coding should be useful.
> Have fun...
> dow
> ----------------------------------------
> ' ETimDec.BAS
> DECLARE FUNCTION ET.Dec (D, F%)
> DECLARE FUNCTION ROff$ (X)
> CLS
> PRINT "This program shows Equation of Time and Solar Declination"
> PRINT "calculations, performed in the function ET.Dec."
> PRINT
> PRINT "These calculations can be used in the programs of computer-"
> PRINT "controlled solar-energy equipment, such as sun trackers and"
> PRINT "heliostats."
> PRINT
> PRINT "Equation of Time is difference between Solar Time and Mean"
> PRINT "Time. Sundials show solar time. Clocks show mean time. The"
> PRINT "Equation of Time is related to solar longitude, relative to"
> PRINT "its mean value (the value it would have if the sun's apparent"
> PRINT "motion were at uniform speed). One degree westward of solar"
> PRINT "longitude corresponds to four minutes in positive direction in"
> PRINT "the Equation of Time."
> PRINT
> PRINT "Solar Declination is latitude of sun in celestial coordinates."
> Menu:
> PRINT
> PRINT "*************************************************************"
> PRINT "1. Find Equation of Time and Solar Declination on given date"
> PRINT "2. Quit program"
> PRINT
> PRINT "Which (1 - 2)? ";
> WHILE INKEY$ <> "": WEND
> DO
> K$ = INKEY$
> LOOP UNTIL K$ >= "1" AND K$ <= "2"
> PRINT K$
> PRINT "*************************************************************"
> PRINT
> IF K$ = "2" THEN GOTO WayOut
> DO
> INPUT "Date (M#,D#)"; Mth%, Day%
> LOOP UNTIL Mth% > 0 AND Mth% < 13 AND Day% > 0 AND Day% < 32
> PRINT
> D = INT(30.6 * ((Mth% + 9) MOD 12) + 58.5 + Day%) MOD 365
> PRINT "Day number"; D; "of year. (Jan 1 = 0. Dec 31 = 364)"
> ET = ET.Dec(D, 1) ' Equation of Time
> DC = ET.Dec(D, 0) ' Declination
> PRINT
> PRINT "Equation of Time: "; ROff$(ET); " minutes"
> PRINT "Solar Declination: "; ROff$(DC); " degrees"
> GOTO Menu
> WayOut:
> PRINT "These calculations of Equation of Time and Solar Declination"
> PRINT "are simplified and approximate. However, they are quite good."
> PRINT "All differences between calculated values and published ones"
> PRINT "of the solar declination are small compared with the angular"
> PRINT "diameter of the sun in the sky (0.5 degrees). Similarly,"
> PRINT "differences between calculated and published values of the"
> PRINT "equation of time are small compared with the time the sun"
> PRINT "takes to traverse its own diameter as it moves across the sky"
> PRINT "(2 minutes). The non-zero size of the sun, rather than any"
> PRINT "inaccuracies of calculation, is the limiting factor on how"
> PRINT "accurately the sun can be tracked in solar energy"
> PRINT "applications, using this routine."
> PRINT
> PRINT
> PRINT "Press any key to continue";
> WHILE INKEY$ <> "": WEND
> WHILE INKEY$ = "": WEND
> CLS
> PRINT "The Equation of Time is treated here as the correction to be"
> PRINT "subtracted from a sundial reading to get local mean (clock)"
> PRINT "time. It is therefore positive when sundial is ahead of clock."
> PRINT "This is the usual sign convention, but the opposite usage is"
> PRINT "sometimes found. Take care when comparing values of the"
> PRINT "Equation of Time from different sources."
> PRINT
> PRINT "Note that atmospheric refraction of light affects the apparent"
> PRINT "position of the sun in the sky when it is close to the"
> PRINT "horizon. Sunlight is then too weak to be used for most"
> PRINT "solar-energy applications, so refraction is not usually"
> PRINT "included in calculations related to solar energy. This program"
> PRINT "does not take account of refraction."
> END
> FUNCTION ET.Dec (D, F%) STATIC
> ' Calculates equation of time, in minutes, or solar declination,
> ' in degrees, on day number D of year. (D = 0 on January 1.)
> ' F% selects function: True (non-zero) for Equation of Time,
> ' False (zero) for Declination.
> ' STATIC means variables are preserved between calls of function
> IF PI = 0 THEN ' first call, initialize constants
> PI = 4 * ATN(1) ' ATN = arctangent
> W = PI / 182.5'earth's mean orbital angular speed in radians per day
> DR = 180 / PI ' degree/radian factor
> C = -23.45 / DR ' reverse angle of earth's axial tilt
> ST = SIN(C) ' sine of reverse tilt
> CT = COS(C) ' cosine of reverse tilt
> E2 = 2 * .0167 ' twice earth's orbital eccentricity
> ZI = 12 * W ' 12 days from solstice to perihelion
> D1 = -1 ' holds last D. Saves time if D repeated for both functions
> END IF
> IF D <> D1 THEN ' new value of D
> A = W * (D + 10) ' Solstice 10 days before Jan 1
> B = A + E2 * SIN(A - ZI)
> D1 = D
> END IF
> IF F% THEN ' equation of time calculation
> C = (A - ATN(TAN(B) / CT)) / PI
> ET.Dec = 720 * (C - INT(C + .5))
> ' in 720 minutes, earth rotates PI radians
> ELSE ' declination calculation
> C = ST * COS(B)
> ET.Dec = ATN(C / SQR(1 - C * C)) * DR
> ' arcsine of C in degrees. ASN not directly available in QBasic
> END IF
> END FUNCTION
> FUNCTION ROff$ (X)
> ' neatly rounds number to one place of decimals
> S$ = LTRIM$(STR$(INT(10 * ABS(X) + .5)))
> IF LEN(S$) = 1 THEN S$ = "0" + S$
> IF VAL(S$) THEN S$ = MID$("-x+", SGN(X) + 2, 1) + S$
> ROff$ = LEFT$(S$, LEN(S$) - 1) + "." + RIGHT$(S$, 1)
> END FUNCTION
> ----------------------------------------
Posted by Eric Sears on April 30, 2007, 4:30 am
On Sat, 28 Apr 2007 18:31:43 -0500, david.williams@bayman.org (David
Williams) wrote:
>Many years ago, I built a computer-controlled heliostat that I used for
>daytime illumination of a dark room in my house. (Unfortunately, since
>then, a tree in my neighbour's yard has grown so it shades the
>heliostat...) I made the hardware as simple and cheap as possible, and
>did as much as I could with the computer software, which I wrote myself.
Thank you for the prog David. It took me a while to remember how to
get programmes working in QBasic, but once I cut & pasted it, it ran!
Eric Sears
Posted by nicksanspam on April 30, 2007, 7:59 pm
>-> got itin C++? ;-)
>
>Nope. Actually, my heliostat used a Commodore VIC 20 computer...
This could be a good reuse of antique computers, if they don't use
too much power. Somebody just gave me a working Thinkpad... Duane
Johnson would like to move heliostats with computers, but worries
about the expense of FCC certificattion, above a certain clock rate.
He's also talked about creating a large ROM with sun positions and
a clock and some interpolation. ROMs and picture cards and sticks
and thumb drives are getting cheaper and cheaper, eg $50 for 2 GB.
Maybe that's the way to go.
Nick
Posted by Eric Sears on May 1, 2007, 5:51 pm
On Mon, 30 Apr 2007 22:17:10 -0500, david.williams@bayman.org (David
Williams) wrote:
>-> >Nope. Actually, my heliostat used a Commodore VIC 20 computer...
>
>The VIC was only a few years old when I built the heliostat. But I did
>get it very cheaply. Someone has "upgraded" to a Commodore 64, and
>wanted to get rid of the VIC. For my purpose, it was ideal. I wired a
>huge capacitor into its power supply, which allowed it to keep running
>for several seconds if the power blinked off. Power outages longer than
>that are extremely rare around here.
> dow
David - I suppose you don't have any use for more Vic 20s ? I have a
least a couple around here (working when last used) and 2 or three
C64's, that are going to the dump soon.
(I have a plug-in board which has a dedicated packet radio programme
on chip, which I built for one of them. The chip was programmed in
Australia, and allows the use of a simple 1200baud modem. All that
work (sigh!). Not used for 15 years.)
I seems a pity to dump them, but the "electronics/computer/junk"
garage is absolutely full. But I expect they would be a bit pricey to
post out of NZ.
Still, if there's anyone that wants them, let me know before they go
"thataway".
Cheers
Eric Sears.
Posted by daestrom on May 1, 2007, 6:21 pm
Thanks for sharing.
I found another good place to look for this sort of calculation is celestial
navigation like what was used on board ships.
daestrom
> daytime illumination of a dark room in my house. (Unfortunately, since
> then, a tree in my neighbour's yard has grown so it shades the
> heliostat...) I made the hardware as simple and cheap as possible, and
> did as much as I could with the computer software, which I wrote myself.
> So, for example, there were no sensors to find the position of the sun
> in the sky. The computer calculated where the sun must be, using the
> parameters of the earth's orbital and rotational motions and the
> current date and time. It figured out the direction in which the mirror
> should be pointed so as reflect sunlight in the desired direction, and
> sent signals to the stepping motors that rotated the mirror. The thing
> worked very well, for many years.
> The astronomical calculation of the position of the sun is not really
> very difficult. It can be expressed as latitude (which is usually
> called "declination" by astronomers) and longitude relative to its
> "mean" value, which would be the one it would have if its apparent
> motion across the sky were at exactly uniform speed. In reality, the
> speed is not quite constant, partly because the earth's axis is tilted,
> and partly because its orbit is elliptical, not circular. This is why
> sundials do not keep good time, as measured by clocks. A quantity
> called the "equation of time" shows the difference between sundial and
> clock time. The equation is closely related to the solar longitude. One
> degree of longitude corresponds to four minutes in the equation of
> time.
> I'll append a little QBasic program below that calculates the sun's
> declination and the equation of time on any date of the year. The
> coding that does the calculation is in a function called ET.Dec. It
> should be easy to translate to any other programming language, if
> required.
> If anyone here is interested in making a sun-tracker or heliostat, this
> coding should be useful.
> Have fun...
> dow
> ----------------------------------------
> ' ETimDec.BAS
> DECLARE FUNCTION ET.Dec (D, F%)
> DECLARE FUNCTION ROff$ (X)
> CLS
> PRINT "This program shows Equation of Time and Solar Declination"
> PRINT "calculations, performed in the function ET.Dec."
> PRINT
> PRINT "These calculations can be used in the programs of computer-"
> PRINT "controlled solar-energy equipment, such as sun trackers and"
> PRINT "heliostats."
> PRINT
> PRINT "Equation of Time is difference between Solar Time and Mean"
> PRINT "Time. Sundials show solar time. Clocks show mean time. The"
> PRINT "Equation of Time is related to solar longitude, relative to"
> PRINT "its mean value (the value it would have if the sun's apparent"
> PRINT "motion were at uniform speed). One degree westward of solar"
> PRINT "longitude corresponds to four minutes in positive direction in"
> PRINT "the Equation of Time."
> PRINT
> PRINT "Solar Declination is latitude of sun in celestial coordinates."
> Menu:
> PRINT
> PRINT "*************************************************************"
> PRINT "1. Find Equation of Time and Solar Declination on given date"
> PRINT "2. Quit program"
> PRINT
> PRINT "Which (1 - 2)? ";
> WHILE INKEY$ <> "": WEND
> DO
> K$ = INKEY$
> LOOP UNTIL K$ >= "1" AND K$ <= "2"
> PRINT K$
> PRINT "*************************************************************"
> PRINT
> IF K$ = "2" THEN GOTO WayOut
> DO
> INPUT "Date (M#,D#)"; Mth%, Day%
> LOOP UNTIL Mth% > 0 AND Mth% < 13 AND Day% > 0 AND Day% < 32
> PRINT
> D = INT(30.6 * ((Mth% + 9) MOD 12) + 58.5 + Day%) MOD 365
> PRINT "Day number"; D; "of year. (Jan 1 = 0. Dec 31 = 364)"
> ET = ET.Dec(D, 1) ' Equation of Time
> DC = ET.Dec(D, 0) ' Declination
> PRINT
> PRINT "Equation of Time: "; ROff$(ET); " minutes"
> PRINT "Solar Declination: "; ROff$(DC); " degrees"
> GOTO Menu
> WayOut:
> PRINT "These calculations of Equation of Time and Solar Declination"
> PRINT "are simplified and approximate. However, they are quite good."
> PRINT "All differences between calculated values and published ones"
> PRINT "of the solar declination are small compared with the angular"
> PRINT "diameter of the sun in the sky (0.5 degrees). Similarly,"
> PRINT "differences between calculated and published values of the"
> PRINT "equation of time are small compared with the time the sun"
> PRINT "takes to traverse its own diameter as it moves across the sky"
> PRINT "(2 minutes). The non-zero size of the sun, rather than any"
> PRINT "inaccuracies of calculation, is the limiting factor on how"
> PRINT "accurately the sun can be tracked in solar energy"
> PRINT "applications, using this routine."
> PRINT
> PRINT
> PRINT "Press any key to continue";
> WHILE INKEY$ <> "": WEND
> WHILE INKEY$ = "": WEND
> CLS
> PRINT "The Equation of Time is treated here as the correction to be"
> PRINT "subtracted from a sundial reading to get local mean (clock)"
> PRINT "time. It is therefore positive when sundial is ahead of clock."
> PRINT "This is the usual sign convention, but the opposite usage is"
> PRINT "sometimes found. Take care when comparing values of the"
> PRINT "Equation of Time from different sources."
> PRINT
> PRINT "Note that atmospheric refraction of light affects the apparent"
> PRINT "position of the sun in the sky when it is close to the"
> PRINT "horizon. Sunlight is then too weak to be used for most"
> PRINT "solar-energy applications, so refraction is not usually"
> PRINT "included in calculations related to solar energy. This program"
> PRINT "does not take account of refraction."
> END
> FUNCTION ET.Dec (D, F%) STATIC
> ' Calculates equation of time, in minutes, or solar declination,
> ' in degrees, on day number D of year. (D = 0 on January 1.)
> ' F% selects function: True (non-zero) for Equation of Time,
> ' False (zero) for Declination.
> ' STATIC means variables are preserved between calls of function
> IF PI = 0 THEN ' first call, initialize constants
> PI = 4 * ATN(1) ' ATN = arctangent
> W = PI / 182.5'earth's mean orbital angular speed in radians per day
> DR = 180 / PI ' degree/radian factor
> C = -23.45 / DR ' reverse angle of earth's axial tilt
> ST = SIN(C) ' sine of reverse tilt
> CT = COS(C) ' cosine of reverse tilt
> E2 = 2 * .0167 ' twice earth's orbital eccentricity
> ZI = 12 * W ' 12 days from solstice to perihelion
> D1 = -1 ' holds last D. Saves time if D repeated for both functions
> END IF
> IF D <> D1 THEN ' new value of D
> A = W * (D + 10) ' Solstice 10 days before Jan 1
> B = A + E2 * SIN(A - ZI)
> D1 = D
> END IF
> IF F% THEN ' equation of time calculation
> C = (A - ATN(TAN(B) / CT)) / PI
> ET.Dec = 720 * (C - INT(C + .5))
> ' in 720 minutes, earth rotates PI radians
> ELSE ' declination calculation
> C = ST * COS(B)
> ET.Dec = ATN(C / SQR(1 - C * C)) * DR
> ' arcsine of C in degrees. ASN not directly available in QBasic
> END IF
> END FUNCTION
> FUNCTION ROff$ (X)
> ' neatly rounds number to one place of decimals
> S$ = LTRIM$(STR$(INT(10 * ABS(X) + .5)))
> IF LEN(S$) = 1 THEN S$ = "0" + S$
> IF VAL(S$) THEN S$ = MID$("-x+", SGN(X) + 2, 1) + S$
> ROff$ = LEFT$(S$, LEN(S$) - 1) + "." + RIGHT$(S$, 1)
> END FUNCTION
> ----------------------------------------