Solution Selection
The database holds many solutions for the same station and channel: every sweep
adds another. A read does
not name a row, it asks for a station and a channel, so something has to decide
which of the candidates to return. That decision belongs to
MccsCalibrationStore rather than to the caller, and it is made by a selection
policy, which the store turns into the SQL the query runs.
Asking for a specific job
Selection can be bypassed. A read that carries a calibration_id, which is the
unique name of a calibration job, returns that job’s solution for the channel and
no policy is consulted.
This is for working deliberately with one particular calibration set, such as reproducing an earlier configuration or comparing one job against another while investigating a problem.
Everything below applies only to reads that do not name a job.
The policies
Two policies are available, and both are limited to the station asked for, allow the channel to differ by up to a frequency tolerance, and return at most one solution, the most recently created of the candidates.
preferredThe most recent solution whose job has been marked as preferred. The mark is how a solution is declared good and put into service: a job is marked with
MarkCalibrationJobPreferred, described in Storing a Solution, and from then on it is what reads return. If no job is marked, nothing is returned. A solution stored without a job falls back to the preferred flag on the solution itself.closest_in_rangeThe most recent solution, whether or not anything has been marked as preferred.
Under preferred, a new sweep changes nothing until somebody judges its
solutions and marks the job, so what the array runs on only ever changes
by a deliberate act. Under closest_in_range, the newest solution
will be chosen as soon as it is stored.
Frequency tolerance
The tolerance is given in channels, and a tolerance of zero means only a solution for exactly the channel asked for will do. Widening it lets a neighbouring channel’s solution serve a channel that was never solved, which is what makes a channel skipped for interference usable at all. It is a blunt instrument: the wider it is, the further the returned solution may be from the frequency it is being applied at.
Fitted reads
A read of fitted solutions selects at the level of the job rather than the
channel. Without an explicit calibration_id, fitted reads are supported only
by the preferred policy, which chooses the preferred job’s phase fit. The
gains for every requested channel are reconstructed from that single fit. See
Application of Solutions.
closest_in_range has no equivalent for the phase fit, so a fitted read under
that policy returns nothing and the station falls back to unit calibration. A
station configured that way needs its solutions read as raw per-channel
solutions, or the job named explicitly.
Configuring the policy
The policy a store starts with comes from its device configuration, and is
preferred unless it is set otherwise. UpdateSelectionPolicy changes it at
runtime, taking the policy name and its tolerance. The change is not persisted, so
a restarted device returns to its configured policy.
The policy in force can be read back at any time. selectionPolicy reports its
configuration and selectionPolicyDescription describes what it does, including
the tolerances in use. A read attempted with no policy configured and no
calibration_id returns no solution, causing the station to apply a unit
calibration.
When selection returns nothing at all, a unit calibration is applied, see Application of Solutions.