Operator Reference

update_kalmanT_update_kalmanUpdateKalmanUpdateKalmanupdate_kalman (Operator)

update_kalmanT_update_kalmanUpdateKalmanUpdateKalmanupdate_kalman — Read an update file of a Kalman filter.

Warning

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

Signature

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

void UpdateKalman(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)

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]]

Description

The operator update_kalmanupdate_kalmanUpdateKalmanUpdateKalmanupdate_kalman reads the update file FileNameFileNameFileNamefileNamefile_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 , control matrix including the controller output and the measurement matrix

Model stochastic:

system-error covariance matrix , system-error - measurement-error covariance matrix and measurement-error covariance matrix

Measurement vector:

History of the system:

extrapolation vector and extrapolation-error covariance matrix

Many systems do not need entries “from outside” and therefore and can be dropped. Further, system errors and measurement errors are normally not correlated ( is dropped). Some of the characteristics mentioned above may change dynamically (from one iteration to the next). The operator update_kalmanupdate_kalmanUpdateKalmanUpdateKalmanupdate_kalman serves to modify parts of the system according to an update file (ASCII) with the following structure (see also read_kalmanread_kalmanReadKalmanReadKalmanread_kalman): 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 = <integer> m = <integer> p = <integer> 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 DimensionInDimensionInDimensionIndimensionIndimension_in / DimensionOutDimensionOutDimensionOutdimensionOutdimension_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: A*C*Q*G*u*L*R* and describes the further content of the file. Instead of , '+' (= parameter is available) respectively '-' (= parameter is missing) has to be set. In contrast to description files for read_kalmanread_kalmanReadKalmanReadKalmanread_kalman, 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.

matrices will be stored in row-major order in the following form: (the spaces/line feed characters can be chosen at will),

vectors will be stored correspondingly in the following form: The following parameter values of the operator read_kalmanread_kalmanReadKalmanReadKalmanread_kalman will be changed:

DimensionInDimensionInDimensionIndimensionIndimension_in / DimensionOutDimensionOutDimensionOutdimensionOutdimension_out:

These parameters include the dimensions of the state vector, measurement vector and controller vector and therefore are vectors , whereby indicates the number of the state variables, the number of the measurement values and the number of the controller members. and 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” = 0.

ModelInModelInModelInmodelInmodel_in / ModelOutModelOutModelOutmodelOutmodel_out:

These parameters include the lined up matrices (vectors) and if necessary which have been stored in row-major order. ModelInModelInModelInmodelInmodel_in / ModelOutModelOutModelOutmodelOutmodel_out therefore are vectors of the length . The last summand is dropped if system errors and measurement errors are not correlated, i.e. no value has been set for .

MeasurementInMeasurementInMeasurementInmeasurementInmeasurement_in / MeasurementOutMeasurementOutMeasurementOutmeasurementOutmeasurement_out:

These parameters include the matrix stored in row-major order, and therefore are vectors of the dimension .

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

FileNameFileNameFileNamefileNamefile_name (input_control)  filename.read HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Update file for a Kalman filter.

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

DimensionInDimensionInDimensionIndimensionIndimension_in (input_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

Default: [3,1,0]

Value range: 0 ≤ DimensionIn DimensionIn DimensionIn dimensionIn dimension_in ≤ 30

ModelInModelInModelInmodelInmodel_in (input_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (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]

Value range: 0.0 ≤ ModelIn ModelIn ModelIn modelIn model_in ≤ 10000.0

MeasurementInMeasurementInMeasurementInmeasurementInmeasurement_in (input_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

The matrix R stored in row-major order.

Default: [1,2]

Value range: 0.0 ≤ MeasurementIn MeasurementIn MeasurementIn measurementIn measurement_in ≤ 10000.0

DimensionOutDimensionOutDimensionOutdimensionOutdimension_out (output_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

ModelOutModelOutModelOutmodelOutmodel_out (output_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (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.

MeasurementOutMeasurementOutMeasurementOutmeasurementOutmeasurement_out (output_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (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]

Example (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]                                               */

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]

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]

Result

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

Possible Successors

filter_kalmanfilter_kalmanFilterKalmanFilterKalmanfilter_kalman

See also

read_kalmanread_kalmanReadKalmanReadKalmanread_kalman, filter_kalmanfilter_kalmanFilterKalmanFilterKalmanfilter_kalman

Module

Foundation