SolarNoaa (FB)

FUNCTION_BLOCK SolarNoaa EXTENDS AbbLConCA

This function block calculates the position of the sun, elevation and azimuth, according to: date, time and location, with an azimuth error = ± 0.01° and elevation error = ±0.03°. This function embeds the SOLAR_NOAAs algorithm. Output parameters are solar elevation and solar azimuth. These outputs are the topocentric coordinates of the sun which use the observer’s location as a centre of the coordinate system.

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

Enable

BOOL

FALSE

A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConCA

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConCA

Error

BOOL

FALSE

Operation is stopped with error (while output Busy is FALSE). This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ErrorID gives more details about the error.

AbbLConCA

Input

Year

INT

2022

2: Year min 2000 max 6000

Mon

INT

6

3: Month min 1 max 12

Day

INT

1

4: Day min 1 max 31

Hour

INT

10

5: Hour min 0 max 59

Minute

INT

10

6: Minute min 0 max 59

Sec

INT

25

7: Second min 0 max 59

TimeZone

LREAL

0

8: Observer time zone in hours max 12

Latitude

LREAL

0

9: Observer latitude in degrees max 90

Longitude

LREAL

0

10: Observer longitude in degrees max 180

Output

ErrorID

ERROR_ID

3: error code

Azimuth

LREAL

0

4: sun azimuth (0°=360°=north, 90° = east, 180° = south, 270° = west)

ElevationUncorrected

LREAL

0

5: sun elevation (0° sun rise, max 90° zenith)

ElevationCorrected

LREAL

0

6: sun elevation including refraction correction (0° sun rise, max 90° zenith)

Methods:

D_AbortAction

A_StartAction

B_CyclicAction

C_CleaningAction

E_ResetAction

Structure: