update_kalmanT_update_kalmanUpdateKalmanUpdateKalmanupdate_kalman (算子)

名称

update_kalmanT_update_kalmanUpdateKalmanUpdateKalmanupdate_kalman — 读取卡尔曼(Kalman)滤波器的更新文件。

警告

update_kalmanupdate_kalmanUpdateKalmanUpdateKalmanUpdateKalmanupdate_kalman 已过时,仅出于向后兼容性考虑而保留。

签名

update_kalman( : : FileName, DimensionIn, ModelIn, MeasurementIn : DimensionOut, ModelOut, MeasurementOut)

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)

static void HOperatorSet.UpdateKalman(HTuple fileName, HTuple dimensionIn, HTuple modelIn, HTuple measurementIn, out HTuple dimensionOut, out HTuple modelOut, out HTuple measurementOut)

static HTuple HMisc.UpdateKalman(string fileName, HTuple dimensionIn, HTuple modelIn, HTuple measurementIn, 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]]

描述

算子 update_kalmanupdate_kalmanUpdateKalmanUpdateKalmanUpdateKalmanupdate_kalman reads the update file FileNameFileNameFileNameFileNamefileNamefile_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 and extrapolation-error covariance matrix

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_kalmanupdate_kalmanUpdateKalmanUpdateKalmanUpdateKalmanupdate_kalman serves to modify parts of the system according to an update file (ASCII) with the following structure (see also read_kalmanread_kalmanReadKalmanReadKalmanReadKalmanread_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 DimensionInDimensionInDimensionInDimensionIndimensionIndimension_in / DimensionOutDimensionOutDimensionOutDimensionOutdimensionOutdimension_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_kalmanReadKalmanReadKalmanReadKalmanread_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.

(r x s) 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_kalmanReadKalmanReadKalmanReadKalmanread_kalman will be changed:

DimensionInDimensionInDimensionInDimensionIndimensionIndimension_in / DimensionOutDimensionOutDimensionOutDimensionOutdimensionOutdimension_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'"p""p""p""p""p" = 0.

ModelInModelInModelInModelInmodelInmodel_in / ModelOutModelOutModelOutModelOutmodelOutmodel_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. ModelInModelInModelInModelInmodelInmodel_in / ModelOutModelOutModelOutModelOutmodelOutmodel_out therefore are vectors of the length n*n + n*m + n*n + n*p + p [+ n*m]. The last summand is dropped if system errors and measurement errors are not correlated, i.e. no value has been set for L.

MeasurementInMeasurementInMeasurementInMeasurementInmeasurementInmeasurement_in / MeasurementOutMeasurementOutMeasurementOutMeasurementOutmeasurementOutmeasurement_out

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

执行信息

参数

FileNameFileNameFileNameFileNamefileNamefile_name (输入控制)  filename.read HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Update file for a Kalman filter.

默认值: 'kalman.updt' "kalman.updt" "kalman.updt" "kalman.updt" "kalman.updt" "kalman.updt"

DimensionInDimensionInDimensionInDimensionIndimensionIndimension_in (输入控制)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

默认值: [3,1,0]

值范围: 0 ≤ DimensionIn DimensionIn DimensionIn DimensionIn dimensionIn dimension_in ≤ 30

ModelInModelInModelInModelInmodelInmodel_in (输入控制)  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.

默认值: [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]

值范围: 0.0 ≤ ModelIn ModelIn ModelIn ModelIn modelIn model_in ≤ 10000.0

MeasurementInMeasurementInMeasurementInMeasurementInmeasurementInmeasurement_in (输入控制)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

The matrix R stored in row-major order.

默认值: [1,2]

值范围: 0.0 ≤ MeasurementIn MeasurementIn MeasurementIn MeasurementIn measurementIn measurement_in ≤ 10000.0

DimensionOutDimensionOutDimensionOutDimensionOutdimensionOutdimension_out (输出控制)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

ModelOutModelOutModelOutModelOutmodelOutmodel_out (输出控制)  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.

MeasurementOutMeasurementOutMeasurementOutMeasurementOutmeasurementOutmeasurement_out (输出控制)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

The matrix R stored in row-major order.

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

示例(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]

示例(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]

示例(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]

结果

If the update file is readable and correct, the operator update_kalmanupdate_kalmanUpdateKalmanUpdateKalmanUpdateKalmanupdate_kalman 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。

可能的后继

filter_kalmanfilter_kalmanFilterKalmanFilterKalmanFilterKalmanfilter_kalman

另见

read_kalmanread_kalmanReadKalmanReadKalmanReadKalmanread_kalman, filter_kalmanfilter_kalmanFilterKalmanFilterKalmanFilterKalmanfilter_kalman

模块

基础