Skip to main content
Bookmark and Share Printable Version

Algorithm Positions Solar Trackers, Movie Stars

March 30, 2011

In a photo, two scientists stand front of a writing board with their shadows reflected on an adjacent wall. On the board are mathematical equations that represent a part of the Solar Position Algorithm. Enlarge image

NREL Senior Scientist Ibrahim Reda and NREL Senior Scientist Afshin Andreas developed the Solar Position Algorithm now used by solar trackers, orchard growers and movie-camera makers, among others. The algorithm used in the SPA appears in the shadow.
Credit: Dennis Schroeder

Math and programming experts at a federal laboratory took an algorithm used to track the stars and rewrote its code to precisely follow the sun, even taking into consideration the vagaries of the occasional leap second.

Now, the algorithm and its software are helping solar power manufacturers build more precise trackers, orchards to keep their apples spotless and movie makers to keep the shadows off movie stars.

The Solar Position Algorithm (SPA) was developed at the U.S. Department of Energy's National Renewable Energy Laboratory to calculate the sun's position with unmatched low uncertainty of +/- 0.0003 degrees at vertex, in the period of years from -2000 to 6000 (or 2001 B.C. until just short of 4,000 years from now). That's more than 30 times more precise than the uncertainty levels for all other algorithms used in solar energy applications, which claim no better than +/- 0.01 degrees, and are only valid for a maximum of 50 years. And those uncertainty claims cannot be validated because of the need to add an occasional leap second because of the randomly increasing length of the mean solar day. The SPA does account for the leap second.

That difference in uncertainty levels is no small change, because an error of .01 degrees at noon can throw calculations off by 2 or 3 percent at sunrise or sunset, said NREL Senior Scientist Ibrahim Reda, the leader on the project. "Every uncertainty of 1 percent in the energy budget is millions of dollars uncertainty for utility companies and bankers," Reda said. "Accuracy is translated into dollars. When you can be more accurate, you save a lot of money."

"Siemens Industry Inc. uses NREL's SPA in its newest and smallest S7-1200 compact controller," says Paul Ruland of Siemens Industry, Inc. "Siemens took that very complex calculation, systemized it into our code and made a usable function block that its customers can use with their particular technologies to track the sun in the most efficient way. The end result is a 30 percent increase in accuracy compared to other technologies."

Science, Engineering and Math All Add to Breakthroughs

An algorithm is a set of rules for solving a mathematical problem in a finite number of steps, even though those steps can number in the hundreds or thousands.

NREL is known more for its solar, wind, and biofuel researchers than for its work in advanced math. But algorithms are key to so many scientific and technological breakthroughs today that a scientist well-versed in the math of algorithms is behind many of NREL's big innovations.

Since SPA was published on NREL's website, more than 4,000 users from around the world have downloaded it. In the European Union, for the past three years, it has been the reference algorithm to calculate the sun's position both for solar energy and atmospheric science applications. It has been licensed to, and downloaded by, major U.S. manufacturers of sun trackers, military equipment and cell phones. It has been used to boost agriculture and to help forecast the weather. Archaeologists, universities and religious organizations have employed SPA, as have other national laboratories.

Fewer Dropped Cell-Phone Calls

Billions of cell-phone calls are made each day, and they stay connected only because algorithms help determine exactly when to switch signals from one satellite to another.

Cell-phone companies can use the SPA to know exactly the moments when the phone, satellite, and the bothersome sun are in the same alignment, vulnerable to disconnections or lost calls. "The cell phone guys use SPA to know the specific moment to switch to another satellite so you're not disconnected," said Reda, who has a master's degree in electrical engineering/measurement from the University of Colorado. "Think of how many millions of people would be disconnected if there's too much uncertainty about the sun's position."

From a Tool for Solar Scientists to Widespread Uses

In this photo, Reda poses between two rows of solar trackers, each of which has a glass bubble top. Enlarge image

NREL Senior scientist Ibrahim Reda smiles in front of solar instruments on the deck of the Solar Radiation Research Laboratory at NREL in Golden, Colo. Reda pioneered an algorithm that tracks the position of the sun within .0003 degrees of accuracy through the year 6000.
Credit: Dennis Schroeder

SPA sprang from NREL's need to calibrate solar measuring instruments at its Solar Radiation Research Laboratory. "We characterize the instruments based on the solar angle," Reda said. "It's vital that instruments get a precise read on the amount of energy they are getting from the sun at precise solar angle."

That will become even more critical in the future when utilities add more energy garnered from the sun to the smart grid. "The smart grid has to know precisely what your budget is for each resource you are using — oil, coal, solar, wind," Reda said.

Making an Astronomy Algorithm One for the Sun

Reda borrowed from the "Astronomical Algorithms," which is based on the Variations Sèculaires des Orbites Planètaires Theory (VSOP87) developed in 1982 then modified in 1987. Astronomers trust it to let them know exactly where to point their telescopes to get the best views of Jupiter, Alpha Centauri, the Magellan galaxy or whatever celestial bodies they are studying. "We were able to separate and modify that global astronomical algorithm and apply it just to solar energy, while making it less complex and easy to implement," said Reda, highlighting the role of his colleague, Afshin Andreas, who has a degree in engineering physics from the Colorado School of Mines, as well as expertise in computer programming.

They spent an intense three or four weeks of programming to make sure the equations were accurate before distributing the 1,100 lines of code, Andreas said.

They used almanacs and historical data to ensure that what the algorithm was calculating agreed with what observers from previous generations said about the sun's position on a particular day. "We did spot checks so we would have a good comfort level that the future projections are accurate," Reda said.

"We used our independent math and programming skills to make sure that our results agreed, Reda said.

Available for Licensing, Free Public Use

The new SPA algorithm simply served the needs of NREL scientists, until the day it was put on NREL's public website.

"A lot of people started downloading it," so NREL established some rules of use, Reda said. Individuals and universities could use SPA free of charge, but companies with commercial interests would have to pay for the software.

Factoring in Leap Seconds Improves Accuracy

This photo shows a close-up of a solar tracker that is gray and cubical. Enlarge image

NREL's Solar Positioning Algorithm is being used in products such as this Siemens Inc. ST-2700 Solar Tracker.
Courtesy of Siemens, Inc.

NREL's SPA knows the position of the sun in the sky over an 8,000 year period partly because it has learned when to add those confounding leap seconds. Solar positioners that don't factor in the leap second only can calculate a few years or a few decades.

The length of an Earth day isn't determined by an expensive watch, but by the actual rotation of the Earth.

Almost immeasurably, the Earth's rotation is slowing down, meaning the solar day is getting just a tiny bit longer. But it's not doing so at a constant rate. "It happens in unpredictable ways," Reda said. Sometimes a leap second is added every year; sometimes there isn't a need for another leap second for three or four years. For example, the International Earth Rotation and Reference Systems Service (IERS) added six leap seconds over the course of seven years between 1992 and 1998, but has added just one extra second since 2006.

The algorithm calculates exactly when to add a leap second because included in its equations are rapid, monthly, and long-term data on the solar day provided by IERS, Reda and Andreas said.

"IERS receives the data from many observatories around the world," Reda added. "Each observatory has its own measuring instruments to measure the Earth's rotation. A consensus correction is then calculated for the fraction of second. As long as we know the time, and how much the Earth's rotation has slowed, we know the sun's position precisely."

That precision has proved useful in unexpected fields.

Practical Uses in Agriculture, Movie Making

One person who bought a license for the SPA software has an apple orchard, and wanted to keep the black spots off the apples that turn off finicky consumers, thus making wholesale buyers hesitate, Reda said.

The black spots appear when too much sun hits a particular apple, a particular tree or a particular row of trees in an orchard.

The spots can be prevented by showering the apples with water, but growers don't want to use more water than necessary.

SPA's precise tracking of the sun tells the grower exactly when the automatic sprinkler should spray for a few moments on a particular set of trees, and when it's OK to shut off that sprayer and turn on the next one. SPA communicates with the sprinkler system so, "instead of spraying the whole orchard, the spray moves minute by minute," Reda said. "He takes our tool and plugs it into the software that controls the sprinkler system. And he saves a lot of water."

Religious groups with traditions of praying at a particular time of day even have turned to SPA to help with precision.

A movie-camera manufacturer has purchased the SPA software to help cinematographers combat the precious waste of money when shadows disrupt outdoor shooting.

"They have cameras on those big cranes and booms, and typically they'd have to manually change them based on the shadows," Reda said. "This company that bought it has an automatic camera positioner."

Combining the positioner with the SPA's calculations, the camera can tell the precise moment when the sun will, say, peak above the tall buildings of an outdoor set. "They don't have to make so many judgments on their own about where the camera should be positioned," Reda said. "It gives them a clearer picture."

Learn more about NREL's solar radiation research and the Electricity, Resources, and Building Systems Integration Center.

— Bill Scanlon