# Documentation

## Solar Calculator (T40)

### Function name

T40_SOLARCALCULATOR

### ST call

`PROGRAM TEST_T40	VAR   		DT1,DT2,DT3: DT;  		REAL1,REAL2,REAL3,REAL4: REAL;  		BOOL1: BOOL;  		FB: LIB.HVAC.V1_0.T40_SOLARCALCULATOR;	END_VAR	FB(DATETIME:= DT1, LATITUDE:= REAL1, LONGITUDE:= REAL2, SUNSHINE=> BOOL1, AZIMUTH=> REAL3, ALTITUDE=> REAL4, SUNRISE=> DT2, SUNSET=> DT3);	END_PROGRAM`

LIB\HVAC

V1.0

### Description

The function calculates the position of the Sun for given geographical coordinates and time. It provides information on the position of the Sun against the horizon, and time of sunrise and sunset for a particular day. It is used to control blinds, and in photovoltaic plants monitoring systems.

### Inputs

 Input Type Description Default value DATETIME DT Time and date for which the Sun position has to be calculated 0001-01-01-00:00:00 LATITUDE REAL Latitude in degrees (°) as a decimal number 50 LONGITUDE REAL Longitude in degrees (°) as a decimal number 14,3999996185303

### Outputs

Output Type Description
SUNSHINE BOOL True, if the Sun is above the horizon
AZIMUTH REAL Horizontal angle (in degrees) which the Sun shows according to the observer
ALTITUDE REAL Vertical angle (in degrees) which the Sun shows according to the observer
SUNRISE DT Date and time of sunrise in the given day
SUNSET DT Date and time of sunset in the given day

### Function

The Solar calculator uses equations for description of relative movement of the Sun against the Earth. The lattitude and longitude will most probably be constants: the calculation is performed for the place where the PLC is installed.

### Application example

The ALARMS_ENABLED variable is used to unblock all performance-based alarms of a photovoltaic plant. The alarms may be active only if they are enabled by a global variable  ENABLE_ALARMS, if the Sun is above the horizon (the output SUNSHINE of the block T40 is TRUE), and the irradiance sensor shows value higher than approximately 300 W/m2.

## Solar calculator - Astronomical clock

### Function name

T40_SOLARCALCULATOR

### ST call

`PROGRAM TEST_T40	VAR   		DT1,DT2,DT3: DT;  		REAL1,REAL2,REAL3,REAL4: REAL;  		BOOL1: BOOL;  		FB: LIB.HVAC.V1_0.T40_SOLARCALCULATOR;	END_VAR	FB(DATETIME:= DT1, LATITUDE:= REAL1, LONGITUDE:= REAL2, SUNSHINE=> BOOL1, AZIMUTH=> REAL3, ALTITUDE=> REAL4, SUNRISE=> DT2, SUNSET=> DT3);	END_PROGRAM`

LIB\HVAC

V1.0

### Description

The function calculates the position of the Sun for given geographical coordinates and time. It provides information on the position of the Sun against the horizon, and time of sunrise and sunset for a particular day. It is used to control blinds, and in photovoltaic plants monitoring systems.

### Inputs

 Input Type Description Default value DATETIME DT Time and date for which the Sun position has to be calculated 0001-01-01-00:00:00 LATITUDE REAL Latitude in degrees (°) as a decimal number 50 LONGITUDE REAL Longitude in degrees (°) as a decimal number 14,3999996185303

### Outputs

Output Type Description
SUNSHINE BOOL True, if the Sun is above the horizon
AZIMUTH REAL Horizontal angle (in degrees) which the Sun shows according to the observer
ALTITUDE REAL Vertical angle (in degrees) which the Sun shows according to the observer
SUNRISE DT Date and time of sunrise in the given day
SUNSET DT Date and time of sunset in the given day

### Function

The Solar calculator uses equations for description of relative movement of the Sun against the Earth. The lattitude and longitude will most probably be constants: the calculation is performed for the place where the PLC is installed.

### Application example

The ALARMS_ENABLED variable is used to unblock all performance-based alarms of a photovoltaic plant. The alarms may be active only if they are enabled by a global variable  ENABLE_ALARMS, if the Sun is above the horizon (the output SUNSHINE of the block T40 is TRUE), and the irradiance sensor shows value higher than approximately 300 W/m2.