SolarNrel (FB)

FUNCTION_BLOCK SolarNrel EXTENDS AbbLConC3

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 which can be found on the NERLs website: https://midcdmz.nrel.gov/spa/

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: https://www.nrel.gov/

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. Execution will continue forever until a falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConC3

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConC3

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.

AbbLConC3

Input

Year

INT

2022

2: Year. Range 2000 to 6000

Mon

INT

6

3: Month. Range 1 to 12

Day

INT

1

4: Day. Range 1 to 31

Hour

INT

10

5: Hour. Range 0 to 23

Minute

INT

10

6: Minute. Range 0 to 59

Sec

INT

25

7: Second. Range 0 to 59

TimeZone

LREAL

0

8: Observer time zone(negative west of Greenwich) in hours. Timezone = Standard Time - Universal Time. Maximum value 12

DeltaTime

LREAL

0

9: Difference between the earth rotation time and terrestrial time. It is derived from observation only and it is reported in this bulletin, where _T = 32.184 + (TAI-UTC) + _UT1

DeltaTime = Terrestrial Time (TT) - Universal Time (UT). [Range -8000 to 8000, Unit: Seconds]

Latitude

LREAL

0

10: Observer latitude. Negative south of equator. [Range: -90 to 90. Unit: Degress]

Longitude

LREAL

0

11: Observer longitude Nnegative west of Greenwich. [Range: -180 to 180. Unit: Degress]

Altitude

LREAL

0

12: Observer elevation or Altitude. [Range: -5000 to 5000. Unit: Meters]

Pressure

LREAL

0

13: Local pressure. [Range: 0 to 5000. Unit: Millibars]

Temperature

LREAL

0

14: Local temperature. [Range: -273 to 6000. Unit: Celsius]

AtmosRefraction

LREAL

0

15: Atmospheric refraction at sunrise & sunset. Typical:0.5667. [Range: -5 to 5. Unit: Degress]

Output

ErrorID

ERROR_ID

3 : Error code which indicates which input is erroneous

Azimuth

LREAL

0

4 : Topocentric azimuth angle. Eastward from north. [Range of values 0 to 360. Unit: Degrees]

ElevationUncorrected

LREAL

0

5 : Topocentric elevation angle.(uncorrected) [Range of values -90 to 90. Unit: Degrees]. Error: ±0.0004°

ElevationCorrected

LREAL

0

6 : Topocentric elevation angle.(corrected) [Range of values -90 to 90. Unit: Degrees]. Error: ±0.0004°

Methods:

A_StartAction

B_CyclicAction

C_CleaningAction

D_AbortAction

E_ResetAction

Structure: