Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.

### Sunshine hours per day

osvaldojose Jul 18, 2019 12:18 PM

Hi there!

I need a help.

is that possible to add sushine per day to a program via CRBasic?

If yess how to do? Please send an example.

Thank you

Regards

OJ

Karl Dec 27, 2019 02:12 PM

Hello OJ,

I apologize for not getting back with you a few months ago, but the answer to your question is yes.  Do you still need an example program?

Best,

Karl Dec 27, 2019 02:38 PM

OJ,

Check out ShortCut it has an option to write code for sunshine hours.  The option is located under the 'Calculations' section.

Best,

osvaldojose Apr 22, 2021 04:30 AM

Thank you Karl.

maurixio Apr 23, 2021 05:07 PM

i did it through a crbasic code, do you still need it?

Karl Apr 24, 2021 01:45 PM

You can use ShortCut or CRBasic, either works.  I would test the code to make sure it is working as expected - sometimes testing extremes are good tests.

osvaldojose Apr 25, 2021 09:48 AM

Yes I do need it.

do you have a step by step or video showing how to add this functionality to a working program?

Thank you

regards

OJ

Makada Apr 26, 2021 03:42 AM

Hi,

Here you have an example:

RealTime(RTime(1))
'Calculate solar position
'Calculate potential radiation for time & position (multiply sine of solar elevation angle by solar constant 1373)
PotSlrW=SIN(SunElevation)*1373
If PotSlrW<0 Then PotSlrW=0
'If the measured value (W/m^2) is greater than 0.4 * the potential solar radiation (W/m^2)
'and the sine of the sun elevation angle (degrees) is great than 0.1 (elevation angle of 6 degrees)
'than it has been sunny for the current scan.
If SlrW>0.4*PotSlrW And SIN(SunElevation)>0.1 Then
'Calculate sun hours for scan time in seconds
SunHrs=1/3600
Else
'Set sun hours for scan time in seconds to 0
SunHrs=0
EndIf

osvaldojose Apr 26, 2021 03:56 AM

cool, this is it.

Thank Dear Makada for the help.

regards

Osvaldo José

maurixio May 13, 2021 12:48 PM

The sunelevation parameter will depend on the latitude , longitude and the season of the year right?

Makada May 13, 2021 11:32 PM

See:

Public solar_information(5)
Alias solar_information(1) = solar_azimuth
Alias solar_information(2) = sun_elevation
Alias solar_information(3) = hour_angle
Alias solar_information(4) = declination
Alias solar_information(5) = air_mass

Makada May 14, 2021 12:00 PM

No, i just used the instruction from CS Shortcut.

Calculations

Sunshine Hours

Heres a short description from the Sunshine hours instruction from CS Shortcut:

Sunshine HoursUnits for Sunshine Hours: Hours
Estimates if current weather is sunny by checking if current global radiation is higher than 0.4 times the current potential solar radiation outside the earth's atmosphere.
Sunshine Hours holds the hours of sunshine since the last scan. Totalise this value to give the total number of sunshine hours over any given period.
A solar radiation measurement (flux density) is required for this calculation, therefore, a solar radiation sensor must be selected and configured prior to selecting and configuring this calculation. The datalogger clock must be set to standard time, not daylight savings time.
You must specify latitude and longitude in decimal degrees. The range for Latitude is 0 to +90 (a positive value for the Northern hemisphere and a negative value for the Southern hemisphere). Longitude is also expressed in decimal degrees east of the Greenwich meridian. For longitudes measured going west from the Greenwich meridian, a negative value can be entered or a corrected value (e.g., 360 - West Degrees) can be used. For example, Tokyo, Japan has a longitude of 220.3 when measured going west which could be entered as -220.3 or the corrected longitude value of 139.7 degrees East could be used.
TimeOffset is the local time offset, in hours, from UTC. If the datalogger setting "UTC Offset" is a value other than -1 (disabled), this offset will be ignored and the UTC Offset value from the datalogger will be used. (Note that UTC Offset is found in the datalogger's Settings table and is in seconds.

Or other posts about the subject: