Sun position
Sun position algorithm
|
This program calls two demo routines to calculate the Sun's position. The first (called demo1()) calculates it using the NREL SPA algorithm (see reference), but implemented in rectangular coordinates. The second (called demo2()) runs a loop to repeatedly calculate the position, but using interpolation between two previously calculated positions.
The interpolation will introduce a very small error in position. For the value of 720 minutes supplied to routine skyfast_init(), the maximum error that is introduced is less than 0.075 arcseconds. Given that the NREL-SPA algorithm itself is only accurate to approximately 1 arcsecond, this is pretty good.
This demo shows some of the use of the routines in sky.h and sun.h, and for interpolation, skyfast.h.
Copyright (c) 2020, David Hoadley vcrum All rights reserved. ble@ westn et.c om.au
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.