SolarNrel (FB)

FUNCTION_BLOCK SolarNrel EXTENDS AbbLConCA

This function block calculates the position of the sun depending on the date, time, and localization. It also includes a function that corrects the value of the elevation thanks to the local pressure, temperature and refraction of atmosphere at sunrise and sunset. This function embeds the NREL’s algorithm. The limitation of this function is the number of outputs which are the azimuth, elevation (uncorrected) and corrected elevation. These outputs are the topocentric coordinates of the sun which use the observer’s location as the center of the coordinate system. Any additional information about the algorithm can be found on the NREL website

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 [2000..6000]

Mon

INT

6

3 : Month [1..12]

Day

INT

1

4 : Day [1..31]

Hour

INT

10

5 : Hour [0..24]

Minute

INT

10

6 : Minute [0..59]

Sec

INT

25

7 : Second [0..59]

Timezone

LREAL

0

8 : Observer time zone (negative west of Greenwich) [-12..12] (degrees)

DeltaTime

LREAL

0

9 : DeltaT = Terrestrial Time (TT) - Universal Time (UT) [-8000..8000] (seconds)

Latitude

LREAL

0

10 : Observer latitude (negative south of equator) [-90..90] (degrees)

Longitude

LREAL

0

11 : Observer longitude (negative west of Greenwich) [-180..180] (degrees)

Altitude

LREAL

0

12 : Observer elevation / Altitude [-5000 .. 5000] (meters)

Pressure

LREAL

0

13 : Local pressure [0..5000] (millibars)

Temperature

LREAL

0

14 : Local temperature [-273..6000] (degrees Celsius)

AtmosRefraction

LREAL

0

15 : Atmospheric refraction at sunrise & sunset (typical:0.5667) [-5..5] degrees)

Output

ErrorID

ERROR_ID

3 : Error code which indicates which input is erroneous

Azimuth

LREAL

0

4 : Topocentric azimuth angle (eastward from north) [ 0..360] (degrees)

ElevationUncorrected

LREAL

0

5 : Topocentric elevation angle (uncorrected) (degrees)

ElevationCorrected

LREAL

0

6 : Topocentric elevation angle (corrected) (degrees)

Methods:

A_StartAction

B_CyclicAction

C_CleaningAction

D_AbortAction

E_ResetAction

Structure: