Page 6 of 6

Re: Sun Plot

Posted: Sun 03 Jan 2021 1:19 pm
by beteljuice
I think there maybe other errors in your script ??

Yes - without sunshine you get a daylight graph, but whilst nighttime is a nice curve, daytime is a sharp triangle.

Re: Sun Plot

Posted: Mon 04 Jan 2021 8:26 am
by Matt.j5b
Maybe the script doesn't like my latitude at 27 S., because if I try the script with a higher latitude it has a nicer curve to it. I am not seeing any php error. The peak solar elevation at this time of year is about 85 degrees, so the solar elevation increases pretty quickly during the day. The sharp triangle is not far off from reality however.

Regarding the sunshine, I have sunshine data available in the MySql realtime table and we been getting sunshine. But when I enable the plotting of this sunshine the image won't render at all. The script works fine if I don't enable the plotting of sunshine, as I have on the website homepage.

Re: Sun Plot

Posted: Mon 04 Jan 2021 2:32 pm
by mcrossley
If you run this query against your realtime SQL tabe, what do you get?...

Code: Select all

SELECT DATE_FORMAT(LogDateTime, '%H%i'), IsSunny
FROM Realtime
WHERE LogDateTime >= CURRENT_DATE() AND IsSunny = 1
ORDER BY LogDateTime ASC

Re: Sun Plot

Posted: Mon 04 Jan 2021 2:35 pm
by mcrossley
Ah! I just spotted in my copy of the script, at line 60...

Code: Select all

$blEnabled = true;
That should only be set if you are using a Blake-Larsen sun recorder file.

EDIT: The download copy has it set to false - panic over!

Re: Sun Plot

Posted: Mon 04 Jan 2021 2:45 pm
by mcrossley
I just set a copy of the script on my server to be 27.5 South. Here is the result...
sunplot-27.jpg
It plots the sunshine OK, but as the beteljuice pointed out the curve is all wrong :(

Re: Sun Plot

Posted: Mon 04 Jan 2021 2:53 pm
by Matt.j5b
I get no data from that query because the sun hasn't risen yet here yet.

If I instead run to grab yesterday numbers:

Code: Select all

SELECT DATE_FORMAT(LogDateTime, '%H%i'), IsSunny
FROM Realtime
WHERE LogDateTime >= DATE_ADD(CURDATE(), INTERVAL -1 DAY) AND IsSunny = 1
ORDER BY LogDateTime ASC
I get:

Code: Select all

0734	1
0735	1
0736	1
0737	1
0740	1
0741	1
0743	1
0743	1
0744	1
0745	1
0746	1
0747	1
0748	1
0749	1
0750	1
0926	1
0934	1
0935	1
0936	1
0937	1
0954	1
0955	1
0956	1
0957	1
1005	1
1006	1
1007	1
1008	1
1009	1
1010	1
1011	1
1012	1
1013	1
1014	1
1015	1
1016	1
1017	1
1018	1
1019	1
1020	1
1021	1
1022	1
1023	1
1024	1
1025	1
1026	1
1027	1
1028	1
1029	1
1030	1
1031	1
1032	1
1033	1
1034	1
1035	1
1036	1
1037	1
1038	1
1039	1
1040	1
1041	1
1042	1
1043	1
1044	1
1045	1
1046	1
1047	1
1048	1
1049	1
1050	1
1051	1
1057	1
1058	1
1059	1
1100	1
1101	1
1102	1
1103	1
1104	1
1105	1
1106	1
1107	1
1108	1
1230	1
1231	1
1232	1
1233	1
1234	1
1235	1
1400	1
1401	1
1402	1
1403	1
1404	1
1405	1
1406	1
1407	1
1439	1
1440	1
1441	1
1442	1
1443	1
1444	1
1445	1
1446	1
1447	1
1448	1
1620	1
1621	1
1622	1
1708	1
1709	1
1714	1
1803	1
1804	1

Re: Sun Plot

Posted: Sat 09 Jan 2021 2:08 pm
by Matt.j5b
Mark, Just wondering but does that SQL output I provided help with working out why the script doesn't work for me?

Re: Sun Plot

Posted: Tue 12 Jan 2021 6:29 pm
by mcrossley
Sorry for the late reply - but no it doesn't, that is what I expected :(

Re: Sun Plot

Posted: Tue 12 Jan 2021 6:31 pm
by mcrossley
The plot is going wrong in the southern hemisphere though, but only during daylight hours! I can't see why at the moment.

Re: Sun Plot

Posted: Wed 13 Jan 2021 11:02 am
by Matt.j5b
Thanks for the update anyway.

Let me know if you need anything else or if you want any testing, if you manage to figure out what happening here.

Re: Sun Plot

Posted: Wed 13 Jan 2021 6:00 pm
by mcrossley
I don't have a lot of time to look at this at the moment. But it appears to be a problem in astro calculation.

What the problem with the sunshine plot is, I have no idea at the moment.

Re: Sun Plot

Posted: Thu 14 Jan 2021 11:58 am
by Matt.j5b
Thanks Mark.

For me, showing the sunshine on the plot is more of a nice to have.

So I am fine with whenever you may get the time to figure this one out, hopefully.:)