Knowledge Base
cancel
Showing results for 
Search instead for 
Did you mean: 

Sigma - Program to calculate the Sunrise time / Sunset time in Sheffield.

Issue

Program to calculate the Sunrise time / Sunset time

Environment

Programmable Object

Sunrise

Sunset

Cause

Customer needs a program to calculate the Sunrise / Sunset times in Sheffield.

Resolution

To review the Sunrise / Sunset times for the required area, please click HERE.

When connected to the site, proceed as follows;

  • "Find a Location" enter the required location and select GO.
  • Choose "Almanac"
  • Choose "Sunrise / Sunset"
  • Select the month you require.

The required programmable Objects are shown below, or to upload the objects and lookup table details, please click HERE.

Day of the Year.

Object 1

  • 10 XInt = DAY
  • 20 IF MONTH >= 2 THEN XInt = XInt + 31
  • 30 XFlo = FLOAT ( YEAR )
  • 40 XFlo = XFlo / 4.00000
  • 50 XFlo = FRAC ( XFlo )
  • 60 IF XFlo = 0.000000 THEN YInt = 1 ELSE YInt = 0
  • 70 IF YInt = 0 AND MONTH >= 3 THEN XInt = XInt + 28
  • 80 IF YInt = 1 AND MONTH >= 3 THEN XInt = XInt + 29
  • 90 IF MONTH >= 4 THEN XInt = XInt + 31
  • 100 IF MONTH >= 5 THEN XInt = XInt + 30
  • 110 IF MONTH >= 6 THEN XInt = XInt + 31
  • 120 IF MONTH >= 7 THEN XInt = XInt + 30
  • 130 IF MONTH >= 8 THEN XInt = XInt + 31
  • 140 IF MONTH >= 9 THEN XInt = XInt + 31
  • 150 IF MONTH >= 10 THEN XInt = XInt + 30
  • 160 IF MONTH >= 11 THEN XInt = XInt + 31
  • 170 IF MONTH >= 12 THEN XInt = XInt + 30
  • 180 RETURN VIA TEXT 200 VALUE XInt

 Sunrise Time Calc.

 Object 2

  • 10 XFlo = POINT 0|1
  • 20 YFlo = FLOAT ( YEAR )
  • 30 YFlo = YFlo / 4.00000
  • 40 YFlo = FRAC ( YFlo )
  • 50 IF YFlo = 0.000000 THEN YInt = 1 ELSE YInt = 0
  • 60 IF YInt = 1 AND MONTH >= 3 THEN XFlo = XFlo - 1.00000
  • 70 ZFlo = LOOKUP ( 1001 , XFlo )
  • 80 ZFlo = ZFlo / 60.0000
  • 90 YFlo = FRAC ( ZFlo )
  • 100 ZFlo = ZFlo - YFlo
  • 110 YFlo = YFlo * 60.0000
  • 120 YFlo = YFlo / 100.000
  • 130 ZFlo = ZFlo + YFlo
  • 140 RETURN VIA TEXT 203 VALUE ZFlo

 Sunset Time Calc.

 Object 3

  • 10 XFlo = POINT 0|1
  • 20 YFlo = FLOAT ( YEAR )
  • 30 YFlo = YFlo / 4.00000
  • 40 YFlo = FRAC ( YFlo )
  • 50 IF YFlo = 0.000000 THEN YInt = 1 ELSE YInt = 0
  • 60 IF YInt = 1 AND MONTH >= 3 THEN XFlo = XFlo - 1.00000
  • 70 ZFlo = LOOKUP ( 1001 , XFlo )
  • 80 ZFlo = ZFlo / 60.0000
  • 90 YFlo = FRAC ( ZFlo )
  • 100 ZFlo = ZFlo - YFlo
  • 110 YFlo = YFlo * 60.0000
  • 120 YFlo = YFlo / 100.000
  • 130 ZFlo = ZFlo + YFlo
  • 140 RETURN VIA TEXT 203 VALUE ZFlo

 Sunrise/Sunset Interlock.

 Object 4

  • 10 XFlo = POINT 0|2
  • 20 YFlo = FRAC ( XFlo )
  • 30 XFlo = XFlo - YFlo
  • 40 YFlo = YFlo * 100.000
  • 50 IF HOUR >= INT ( XFlo + 1.00000 ) THEN GOTO 90
  • 60 IF HOUR = INT ( XFlo ) THEN GOTO 100
  • 70 XInt = 0
  • 80 RETURN FALSE "Plant Off"
  • 90 XInt = 1
  • 100 IF MINUTE >= INT ( YFlo ) THEN XInt = 1
  • 110 XFlo = POINT 0|3
  • 120 YFlo = FRAC ( XFlo )
  • 130 XFlo = XFlo - YFlo
  • 140 YFlo = YFlo * 100.000
  • 150 IF HOUR >= INT ( XFlo ) THEN GOTO 170
  • 160 GOTO 180
  • 170 IF HOUR >= INT ( XFlo + 1.00000 ) OR MINUTE >= INT ( YFlo ) THEN XInt = 0
  • 180 IF XInt = 1 THEN RETURN TRUE "Plant On"
  • 190 RETURN FALSE "Plant Off"
Tags (1)
Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎2018-09-10 10:43 PM
Updated by: