This module contains the CalibrationManager class, which is responsible for calibrating the production system.
To start the calibration procedure, it is sufficient to create a calibration manager instance and call its startCalibration() method. The ProductionSystem that is to be calibrated and a list of heating currents that are to be used are passed to the constructor.
The calibration manager sends a CalibrationStarted event when the procedure is started, and a CalibrationOver event when it terminates. The production system is locked for the duration of the procedure.
The calibration procedure itself consists of a number of calibration stages. During the first stage, the system’s heater is moved to its foremost position. Subsequent stages are heating stages, which each use one of the heating currents that are passed to the calibration manager’s constructor. At the end of each heating stage, when the temperature sensor voltage has become reasonably stable, the user needs to take a temperature measurement. When a measurement is needed, the calibration manager sends a TemperatureRequested event.
The client is responsible for ensuring that some GUI component (most likely a TemperatureEntryHandler) is listening for these events, asks the user to take a measurement, and reports the result using the callback function that is sent along with the event. When a measurement has been reported, a TemperatureRequestOver event is sent.
The data that is collected during calibration is automatically added to the CalibrationData object of the production system that is being calibrated. If the object already has data for a given heating current, they are replaced with the new data gathered for that current, but data for heating currents that are not used during the ongoing calibration are retained, so that the calibration of a system can be refined with subsequent calibration procedures.
The calibration data object uses the data to fit a number of estimation functions, which are used to estimate the heating temperature that corresponds to a given temperature sensor voltage, and the heating current that results in the heating temperature reaching, but not exceeding, a given target temperature. About twelve heating currents should be used during calibration so that these functions can be properly fitted.
If a reasonable number of heating stages are used, the calibration procedure may take several hours. The calibration manager provides a number of methods (most notably getExtendedProgress()) that estimate the procedure’s progress and remaining duration, so that the user can receive some feedback about the state of the procure while it is running. The classes in the gui.calibration.progress module can be used to present this information to the user.
The calibration procedure may end prematurely if it is aborted by a client, or if the production system’s safe mode is triggered. The data that have already been collected are used nevertheless.
Creates a new instance of this class, using the arguments to set system and currents. currents is sorted first, and duplicate heating currents are removed.
Heating currents in currents that exceed the system‘s maxHeatingCurrent are skipped during calibration. In that case, the calibration procedure’s exit status will be STATUS_INVALID_CURRENT.
Returns a named tuple with the following attributes:
If the calibration procedure’s state is STATE_NOT_YET_STARTED or STATE_DONE, the tuples (0.0, None, 0.0, None) and (1.0, None, 1.0, None) are returned, respectively.