Git Product home page Git Product logo

solarcalculator's People

Contributors

jpb10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

solarcalculator's Issues

Not Upgrade PlatformIO

hello
platformIO tells me that the upgrade is not compatible with version 2.0.0
I am on mega 2560 V3, there is an incompatibility?
my version 1.03 works perfectly thanks to you.

Different sun angle values at 90°S (and north, so at the poles?)

The accuracy of the azimuth value is fine, but it isn't for the altitude, and this problem seems to only occur at the poles or so.

Location is 90°S and 0°E.
Time is 23:53:46 UTC on March 22, 2023 (1679529226)

#include <iostream>

#include "SolarCalculator.h"

int main() {
    double az, el;

    time_t time = 1679529226;
    calcHorizontalCoordinates(time, -90.0, 0.0, az, el);
    std::cout << "Azimuth: " << az << "\nElevation: " << el << '\n';

    return 0;
}

Program output
image

timeanddate.com (https://www.timeanddate.com/astronomy/night/@-90,0) (displayed time is UTC+13)
image

Civil, Nautical, Astronomical Twilight wonky?

I am getting incorrect values for Astronomical dawn, and for both Civil and Nautical dusk. The following values are for location 33.386854212167975, -111.64819464040542 on date 3/9/2023.

Astr 5:51 (should start about 5:23, and notice it's the same as Naut)
Naut 5:51
Civil 6:20

Sunrise 6:44
Transit 12:37
Sunset 18:29

Civil 18:54 (should start about 18:30, obviously)
Naut 19:23 (should start 18:55, and notice it's the same as Astr)
Astr 19:23

Everything else above is within round-off allowance. So, very good!

The code can be viewed/run here:
https://wokwi.com/projects/358710780536496129

Wildly wrong numbers

Could you please run your example code SunriseSunset.ino with the following numbers and see why it is giving such odd numbers?

// Date
int year = 2022;
int month = 1;
int day = 15;

// Location
double latitude  = 18.19;
double longitude = 120.55;
int time_zone    = -8;

With those figures, I get:

Date: 2022-1-15
Latitude: 18.190 Longitude: 120.550
UTC offset: -8
--
Sunrise: 0-9:0-28
Transit: 0-3:0-53
Sunset:  01:42
Civil dawn: 0-9:0-51
Civil dusk: 02:05

ESP32. Arduino IDE. Nothing changed in the library or example code except the lat/long and date values at the top.

[Suggestion] More UTC timestamps

For example, could the function calcSunriseSunset(...), and some others, make the values in UTC timestamps instead of hours of the day?

Sunset (and probably sunrise) calculations for next day

In this program, the UTC day is Nov 11, 2022, but my local date is Nov 10, 2022. When the program calculates the sunset time using the unix epoch (using my utc_now variable), it calculates the sunset at my location for the next day, not for the current date.

unsigned long utc_now = 1668127050;
calcSunriseSunset(utc_now, LATITUDE, LONGITUDE, transit, sunrise, sunset);

// Printed as seconds after midnight.
std::cout << utc_now % 86400 << '\n';
std::cout << sunset * 3600 - 86400 << '\n';

// My correction
if (sunset > 24) {
    utc_now -= 86400;
    calcSunriseSunset(utc_now, LATITUDE, LONGITUDE, transit, sunrise, sunset);

    // Printed as seconds after midnight.
    std::cout << utc_now % 86400 << '\n';
    std::cout << sunset * 3600 - 86400 << '\n';
}

Solar midnight.

Hello!

I analyzed the code and found that this line:

m[0] = jd.m + wrapTo180(ra - longitude - GMST) / 360;

Is used to calculate the transit [solar noon]. I tried adjusting it to return solar midnight , but without succes. I would add m[4] for solar midnight, but my astronomy know how is too limited for this.

Could you please tell me how to get it to return the solar midnight?

Thank you .

Best regards, Marius.

[Suggestion] Option to show in radians

Looking at the source code, it does appear to show the values being converted from radians to degrees. The suggestion is to define an optional bool parameter to return the values in radians instead of degrees (not sure if this feature is necessary, but I wonder about losing decimal places for rad -> deg -> rad, like converting the returned double values back into radians, due to floating-point problems).

not getting same elevation and azimuth as NOAA

Hi, I've made some simple ports of this to Linux which are mostly printf instead of Serial.print and adding <math.h> and <stdio.h> but what I'm getting is off from what NOAA states for San Diego CA. https://gml.noaa.gov/grad/solcalc/

NOAA would say my solar elevation is 43.61 but the library calculation gives me 19.7
NOAA would say my solar azimuth is 236.3 but the library calculation gives me 100.6

The calculated sunrise and sunset are off by 2 minutes and 3 minutes compared to NOAA so pretty close.

I'm using Lat long in the library as obtained from the NOAA web page when the marker is placed at the airport on the road to Harbor Island Dr:
double latitude = 32.727219;
double longitude = -117.19665;

Any ideas on what could be causing this elevation and azimuth discrepancy?

Incorrect rise/set times for Fiji, Nadi and other locations.

Hello!

I have found a systematic issue:

double lat = -17.803; // fiji, nadi
double lon = 177.416;// fiji, nadi
int y = 2022;
int m = 9;
int d = 27;
calcSunriseSunset(y, m, d, lat, lon, transit, sunrise, sunset, SUNRISESET_STD_ALTITUDE, 2);

The function returns sunrise = -6.062. This is correct. However , if we set m = 10, the next month, the sunrise value jumps to 17.560. If I feed it UTC time, the date differs when the «jump» to a sunrise at 17h occurs. I tried the function with different iteration levels: 1, 5, 10... Nothing helped.

I found a similar thing happens for other locations in Fiji, and in Funafuti [Tuvalu], Apia [Samoa], Nuku'alofa [Tonga] and others. But, at different dates.

Please let me know if you can confirm the bug. Thank you .

Best regards, Marius.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.