Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
StartTime with astronomical timer
#5
Here are some thoughts on a sunrise based plugin.


SIP includes the blinker module which broadcasts signals when certain events occur. One such signal is broadcast just past midnight, i.e. when a new day begins. That signal can be used by a plugin to calculate sunrise time for that day.

Irrigation program data is stored in SIP/data/programData.json and also kept in memory in the variable gv.pd. The data in memory is in a Python list of dictionaries.

The data for each irrigation program includes the following elements that would be useful for adjusting the program according to sunrise time:
start_min - The start time for the program in minutes past midnight
duration_secs - The amount if time in seconds the program is scheduled to run. When SIP is set for individual durations a list of durations, one for each station in the program, is included.
end_min - The time in minutes past midnight that the program run will be finished. This takes into account the duration or sum of durations in the case of individual durations.

If the goal is to have irrigation completed before sunrise, the end_min value and sunrise time (in minutes past midnight) could be used to calculate a time offset that could then be applied to the start_min value in gv.pd.

Adding a checkbox to the program page in SIP's UI would be problematic. It would require not only modifying the page but also how the newly added setting is handled when the program is saved.
It would be better to keep all plugin related settings on the plugin's setup page. The setup page could display a list of programs with a check box for each to enable sunrise time adjustments. This data could be stored in a  file specific to that plugin.

When a new day begins the plugin could adjust the start times for the programs that have the adjustment option enabled.

As far as modifying the timeline display on the SIP home page goes, the display would automatically show the modified start time for the current day. If a user moves to a future date it would be difficult to have the sunrise time for the future date calculated without extensive modification to the JavaScript code. Also, when moving one or two days ahead the difference in sunrise time is only one minute per day or in some cases there is no difference. An hour on the timeline display is only about 30 pixels wide (Or less depending on the device it is being viewed on.) this means that a one minute difference in time would translate to 0.5px which would not make a noticeable difference on the display.


Dan
<p><br></p>
Reply


Messages In This Thread
StartTime with astronomical timer - by magrigian - 2016 Sep 05, 01:15 PM
RE: StartTime with astronomical timer - by dan - 2016 Sep 05, 04:23 PM
RE: StartTime with astronomical timer - by dan - 2021 May 04, 09:52 PM
RE: StartTime with astronomical timer - by dan - 2021 May 06, 03:53 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)