beckhoff TS3900 — 9 Example

Example fbSPA.stTime.iMinute := 27; fbSPA.fTimezone := 2; fbSPA.fLongitude := 31.134; fbSPA.fLatitude := 29.979; fbSPA.fElevation := 70; fbSPA.fTemperature := 21.7; fbSPA.eFunction := eSPA_ZA_RTS; IF bExecute THEN fbSPA(); eErrorCode := fbSPA.iErrorCode; fSunZenith := fbSPA.fZenith; fSunAzimuth := fbSPA.fAzimuth; tSunrise := LREAL_TO_TIME(fbSPA.fSunrise*60*60*1000); tSunset := LREAL_TO_TIME(fbSPA.fSunset*60*60*1000); END_IF You can add the visualisation included in the library to your project as described in section Visualisation [ } 20] . The previously declared variables are assigned to the placeholder as shown in the screenshot. 3. Test Compile the created PLC program.

Make sure that TwinCAT is in the Run mode on the desired system. Login to the desired run-time system from TwinCAT PLC Control. Start the PLC program. The calculation is executed by setting the local variable bExecute to TRUE. This can be done via 'online write' or the corresponding button in the visualisation, for example. The visualisation should now present the following results: TS3900 24 Version: 1.1