control_traj {netcontrol}R Documentation

Calculate the trajectory of a discrete linear time invariant system under a given control scheme

Description

This function is designed to work with control_scheme objects generated by control_scheme_DLI_freestate In future versions of netcontrol this function will be used to simulate any control trajectory. For general details on control theory trajectories, see (Lewis et al. 2012).

Usage

control_traj(t_max, x_0, A, B, theta = NA, gamma = NA, control_scheme,
  delta = NA, d_nosign = F, d_toggle = F, upper_bounds = NA,
  lower_bounds = NA, u_pos = F)

Arguments

t_max

Required. An integer total number of time points to determine the trajectory over

x_0

Required. A p length numeric vector of starting values

A

Required. A p x p matrix of system coefficients

B

Required. A p x q matrix of control weights

theta

Optional. A p x p covariance matrix for state errors. If NA, state mechanics will be deterministic

gamma

Optional. A p x p covariance matrix for observation errors. If NA, no observation/measurement error will be modelled.

control_scheme

Required. A list containing an entry labeled gain_seq containing either 1 or t_max - 1 Kalman gain matrices and an entry labeled cost_func which contains an appropriately constructed cost function

delta

Optional. A vector of length 2, where the first entry contains the point of saturation for control inputs, and the second entry contains the saturation value for control inputs.

d_nosign

Optional. Boolean. If TRUE and delta is not NA, control inputs are forced to be positive.

d_toggle

Optional. Boolean. If TRUE and delta is not NA, control inputs are either 0 or the saturation value.

upper_bounds

Optional. A p length vector of upper bounds on state values.

lower_bounds

Optional. A p length vector of lower bounds on state values.

u_pos

Optional. Boolean. If TRUE restricts control inputs to be positive,

Details

CAUTION: Use of saturation parameters and/or bound parameters delta, d_nosign, d_toggle, upper.bound, lower.bound, u.pos leads to estimates of the optimal trajectory to be sub-optimal, as the Kalman gain calculations do not take any of those restrictions into account. This functionality will be added later, and this caution statement removed at that time.

Value

A list containing 4 entries: a 't_max x p' state value matrix, a 't_max x p' observation matrix, a 't_max-1 x q' matrix of control inputs and a 't_max' length vector of cost function values.

References

Lewis FL, Vrabie DL, Syrmos VL (2012). Optimal Control, 3rd ed edition. Wiley, Hoboken. ISBN 978-0-470-63349-6..

Examples


A = matrix(c(0,-3,-2,2,-2,1,-1,2,-1), 3,3)

#Normalize rows to sum to 1
A = solve(diag(rowSums(A))) %*% A

B = S = Q_seq = R_seq = diag(3)

CS = control_scheme_DLI_freestate(100, A, B, S, Q_seq, R_seq)

traj = control_traj(100, rep(100,3), A, B, control_scheme = CS)

#First 5 control inputs
print(head(traj[[3]]))

[Package netcontrol version 0.1 Index]