Skip to content

update_kalmanUpdateKalmanUpdateKalmanupdate_kalmanT_update_kalmanπŸ”—

Short descriptionπŸ”—

update_kalmanUpdateKalmanUpdateKalmanupdate_kalmanT_update_kalman β€” Read an update file of a Kalman filter.

WarningπŸ”—

update_kalmanUpdateKalman is obsolete and is only provided for reasons of backward compatibility.

SignatureπŸ”—

update_kalman( filename.read FileName, integer DimensionIn, real ModelIn, real MeasurementIn, out integer DimensionOut, out real ModelOut, out real MeasurementOut )void UpdateKalman( const HTuple& FileName, const HTuple& DimensionIn, const HTuple& ModelIn, const HTuple& MeasurementIn, HTuple* DimensionOut, HTuple* ModelOut, HTuple* MeasurementOut )static void HOperatorSet.UpdateKalman( HTuple fileName, HTuple dimensionIn, HTuple modelIn, HTuple measurementIn, out HTuple dimensionOut, out HTuple modelOut, out HTuple measurementOut )def update_kalman( file_name: str, dimension_in: Sequence[int], model_in: Sequence[float], measurement_in: Sequence[float] ) -> Tuple[Sequence[int], Sequence[float], Sequence[float]]

Herror T_update_kalman( const Htuple FileName, const Htuple DimensionIn, const Htuple ModelIn, const Htuple MeasurementIn, Htuple* DimensionOut, Htuple* ModelOut, Htuple* MeasurementOut )

static HTuple HMisc::UpdateKalman( const HString& FileName, const HTuple& DimensionIn, const HTuple& ModelIn, const HTuple& MeasurementIn, HTuple* ModelOut, HTuple* MeasurementOut )

static HTuple HMisc::UpdateKalman( const char* FileName, const HTuple& DimensionIn, const HTuple& ModelIn, const HTuple& MeasurementIn, HTuple* ModelOut, HTuple* MeasurementOut )

static HTuple HMisc::UpdateKalman( const wchar_t* FileName, const HTuple& DimensionIn, const HTuple& ModelIn, const HTuple& MeasurementIn, HTuple* ModelOut, HTuple* MeasurementOut ) (Windows only)

static HTuple HMisc.UpdateKalman( string fileName, HTuple dimensionIn, HTuple modelIn, HTuple measurementIn, out HTuple modelOut, out HTuple measurementOut )

DescriptionπŸ”—

The operator update_kalmanUpdateKalman reads the update file FileNamefileNamefile_name of a Kalman filter. Kalman filters return an estimate of the current state (or even the prediction of a future state) of a discrete, stochastically disturbed, linear system.

A Kalman filtering is based on a mathematical model of the system to be examined which at any point in time has the following characteristics:

  • Model parameter: transition matrix \(A\), control matrix \(G\) including the controller output \(u\) and the measurement matrix \(C\)

  • Model stochastic: system-error covariance matrix \(Q\), system-error - measurement-error covariance matrix \(L\) and measurement-error covariance matrix \(R\)

  • Measurement vector: \(y\)

  • History of the system: extrapolation vector \(\hat{x}\) and extrapolation-error covariance matrix \(\hat{P}\)

Many systems do not need entries β€œfrom outside” and therefore \(G\) and \(u\) can be dropped. Further, system errors and measurement errors are normally not correlated (\(L\) is dropped). Some of the characteristics mentioned above may change dynamically (from one iteration to the next). The operator update_kalmanUpdateKalman serves to modify parts of the system according to an update file (ASCII) with the following structure (see also read_kalmanReadKalman):

        Dimension row
        + content row
        + matrix A
        + matrix C
        + matrix Q
        + matrix G + vector u
        + matrix L
        + matrix R

The dimension row thereby has the following form: n = m = p = whereby n indicates the number of the state variables, m the number of the measurement values and p the number of the controller members (see also DimensionIndimensionIndimension_in / DimensionOutdimensionOutdimension_out). The maximal dimension will hereby be limited by a system constant (= 30 for the time being). As in this case changes should take effect at a valid model, the dimensions \(n\) and \(m\) are invariant (and will only be indicated for purposes of control).

The content row has the following form: ACQGuLR* and describes the further content of the file. Instead of \(\ast\)’, β€˜+’ (= parameter is available) respectively β€˜-’ (= parameter is missing) has to be set. In contrast to description files for read_kalmanReadKalman, the system description needs not be complete in this case. Only those parts of the system which are changed must be indicated. The indication of estimated values is unnecessary, as these values must stem from the latest filtering according to the structure of the filter.

\((r \times s)\) matrices will be stored in row-major order in the following form:

\[\begin{eqnarray*} \begin{array}{cccc} & {<comment, i.e.\ string>} \\ <a_{11}> & <a_{12}> & \cdots & <a_{1s}> \\ \vdots & & \ddots & \vdots \\ <a_{r1}> & <a_{r2}> & \cdots & <a_{rs}> \end{array} \end{eqnarray*}\]

(the spaces/line feed characters can be chosen at will),

vectors will be stored correspondingly in the following form:

\[\begin{eqnarray*} \begin{array}{ccc} & {<comment, i.e.\ string>} \\ <a_{1}> & \cdots & <a_{k}> \\ \end{array} \end{eqnarray*}\]

The following parameter values of the operator read_kalmanReadKalman will be changed:

  • DimensionIndimensionIndimension_in / DimensionOutdimensionOutdimension_out: These parameters include the dimensions of the state vector, measurement vector and controller vector and therefore are vectors \([n,m,p]\), whereby \(n\) indicates the number of the state variables, \(m\) the number of the measurement values and \(p\) the number of the controller members. \(n\) and \(m\) are invariant for a given system, i.e.Β they must not differ from corresponding input values of the update file. For a system without without influence β€œfrom outside” \(p\) = 00.

  • ModelInmodelInmodel_in / ModelOutmodelOutmodel_out: These parameters include the lined up matrices (vectors) \(A, C, Q, G, u\) and if necessary \(L\) which have been stored in row-major order. ModelInmodelInmodel_in / ModelOutmodelOutmodel_out therefore are vectors of the length \(n \times n + n \times m + n \times n + n \times p + p [+ n \times m]\). The last summand is dropped if system errors and measurement errors are not correlated, i.e.Β no value has been set for \(L\).

  • MeasurementInmeasurementInmeasurement_in / MeasurementOutmeasurementOutmeasurement_out: These parameters include the matrix \(R\) stored in row-major order, and therefore are vectors of the dimension \(m \times m\).

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

FileNamefileNamefile_name (input_control) filename.read β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Update file for a Kalman filter.

Default: 'kalman.updt'"kalman.updt"

DimensionIndimensionIndimension_in (input_control) integer-array β†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

The dimensions of the state vector, measurement vector and controller vector.

Default: [3, 1, 0][3, 1, 0]
Value range: 0 ≀ DimensionIn ≀ 30

ModelInmodelInmodel_in (input_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

The lined up matrices A,C,Q, possibly G and u, and if necessary L which all have been stored in row-major order.

Default: [1.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 54.3, 37.9, 48.0, 37.9, 34.3, 42.5, 48.0, 42.5, 43.7][1.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 54.3, 37.9, 48.0, 37.9, 34.3, 42.5, 48.0, 42.5, 43.7]
Value range: 0.0 ≀ ModelIn ≀ 10000.0

MeasurementInmeasurementInmeasurement_in (input_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

The matrix R stored in row-major order.

Default: [1, 2][1, 2]
Value range: 0.0 ≀ MeasurementIn ≀ 10000.0

DimensionOutdimensionOutdimension_out (output_control) integer-array β†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

The dimensions of the state vector, measurement vector and controller vector.

ModelOutmodelOutmodel_out (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

The lined up matrices A,C,Q, possibly G and u, and if necessary L which all have been stored in row-major order.

MeasurementOutmeasurementOutmeasurement_out (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

The matrix R stored in row-major order.

ExampleπŸ”—

(HDevelop)

* The following values are describing the system
*
* DimensionIn   = [3,1,0]
* ModelIn       = [1.0,1.0,0.5,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,
*                       54.3,37.9,48.0,37.9,34.3,42.5,48.0,42.5,43.7]
* MeasurementIn = [1,2]
*
* An example of the Updatefile:
*
* n=3 m=1 p=0
* A+C-Q-G-u-L-R-
* transitions at time t=15:
* 2 1 1
* 0 2 2
* 0 0 2
*
* the results of update_kalman:
*
* DimensionOut   = [3,1,0]
* ModelOut       = [2.0,1.0,1.0,0.0,2.0,2.0,0.0,0.0,2.0,1.0,0.0,0.0,
*                        54.3,37.9,48.0,37.9,34.3,42.5,48.0,42.5,43.7]
* MeasurementOut = [1.2]
(C)
/* The following values are describing the system                      */
/*                                                                     */
/*DimensionIn   = [3,1,0]                                              */
/*ModelIn       = [1.0,1.0,0.5,0.0,1.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,    */
/*                      54.3,37.9,48.0,37.9,34.3,42.5,48.0,42.5,43.7]  */
/*MeasurementIn = [1,2]                                                */
/*                                                                     */
/*An example of the Updatefile:                                        */
/*                                                                     */
/*n=3 m=1 p=0                                                          */
/*A+C-Q-G-u-L-R-                                                       */
/*transitions at time t=15:                                            */
/*2 1 1                                                                */
/*0 2 2                                                                */
/*0 0 2                                                                */
/*                                                                     */
/*the results of update_kalman:                                        */
/*                                                                     */
/*DimensionOut   = [3,1,0]                                             */
/*ModelOut       = [2.0,1.0,1.0,0.0,2.0,2.0,0.0,0.0,2.0,1.0,0.0,0.0,   */
/*                       54.3,37.9,48.0,37.9,34.3,42.5,48.0,42.5,43.7] */
/*MeasurementOut = [1.2]                                               */

ResultπŸ”—

If the update file is readable and correct, the operator update_kalmanUpdateKalman returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible successors

filter_kalmanFilterKalman

See also

read_kalmanReadKalman, filter_kalmanFilterKalman

ModuleπŸ”—

Foundation