NINA Assistant Plugin Design


Assistant Design documentation home

Planning Engine

The Planning Engine executes at the request of the Assistant Sequence Instruction. Based on the current time, location, and the state of the projects/targets/preferences in the plugin database (which is per profile), the engine executes and determines the best target to image at that point. When imaging for one target ends, the Sequence Instruction again invokes the Planning Engine to select the next target. The current target (or null) is passed in so that the engine knows the current state.

Engine execution consists of a number of passes that refine the set of potential targets, ultimately selecting one and determining the best sequence of filters/exposures.

Pass 1

Pass 1 determines the set of targets that could potentially be imaged at the current time. An active target is one that is incomplete, is in the Active state, and the current date is within the project begin/end dates.

Potential targets have hard start/stop times determined by twilight or horizon.

Pass 2

Pass 2 applies the Moon Avoidance formula for each filter of each potential target, removing those filter plans that fail the check.

If all filter plans for a target were culled, remove it from the potential targets list. Revise the hard start/stop times based on the final set of filter plans since it may shift with different twilight preferences per remaining filters.

Pass 3

Pass 3 determines the best single target to image at the current time.

Each rule will have an associated weight maintained in the preferences. The final score for a target is just the sum of the weighted rule scores, with the highest scoring target winning. It should be straightforward to add additional rules in the future with this approach. Plus, the weighting system makes it easy to completely disable a rule by setting its weight to zero.

Setting the Hard Stop Time

Regardless of whether only a single target was available or whether it was selected by scoring, the hard stop time of that target must be set - in essence, determining the time that the engine will be called again to select the next target. The only way to properly do this is to continue the selection process:

It’s important to note that the cost of engine invocation is low (performance-wise). Also, if the engine selects the same target again, the slew/center would be skipped so there’s really no penalty in letting the engine decide again. And at that future decision point, it may well select different exposure plans based on what was previously acquired.

Another consideration for hard stop time is a twilight change event which might change the filter plans possible.

Pass 4

Pass 4 refines the order of filters/exposures for the selected target:

The final planning engine output consists of the selected target with associated ordered filter plans. The target as a whole and each filter plan has a hard start time and a hard stop time. These are used by the Assistant Sequence Instruction to establish the time limits for imaging the target:

Potential Issues