state_space Interface

public interface state_space

Contents


Module Procedures

private pure function state_space_init(m, b, k, n_out) result(rst)

Initializes the state space model. For the second-order mechanical system the state satisfies

The output matrix is initialized to one, and the feedthrough matrix is initialized to zero.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:,:) :: m

The N-by-N mass matrix.

real(kind=real64), intent(in), dimension(size(m, 1), size(m, 2)) :: b

The N-by-N damping matrix.

real(kind=real64), intent(in), dimension(size(m, 1), size(m, 2)) :: k

The N-by-N stiffness matrix.

integer(kind=int32), intent(in), optional :: n_out

The number of outputs. The default is 1.

Return Value type(state_space)

The [[state_space]] model.

private pure function state_space_init_scalar(m, b, k) result(rst)

Initializes the state space model. The scalar realization corresponds to

The output matrix is initialized to one, and the feedthrough matrix is initialized to zero.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: m

The mass.

real(kind=real64), intent(in) :: b

The damping.

real(kind=real64), intent(in) :: k

The stiffness.

Return Value type(state_space)

The [[state_space]] model.

private pure function state_space_init_matrices(a, b, c, d) result(rst)

Initializes the state space model. The stored realization uses the continuous-time equations

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:,:) :: a

The N-by-N dynamics matrix.

real(kind=real64), intent(in), dimension(:,:) :: b

The N-by-M input matrix.

real(kind=real64), intent(in), dimension(:,:) :: c

The P-by-N output matrix.

real(kind=real64), intent(in), dimension(:,:) :: d

The P-by-M feedthrough matrix.

Return Value type(state_space)

The resulting [[state_space]] object.

private pure function state_space_init_pid(kp, ki, kd, tau, a, b, c, d) result(rst)

Initializes a state-space model that employs a closed-loop PID controller.

The PID model is augmented into the plant model as follows.

Where the augmented matrices are as follows.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: kp

The proportional gain term.

real(kind=real64), intent(in) :: ki

The integral gain term.

real(kind=real64), intent(in) :: kd

The derivative gain term.

real(kind=real64), intent(in) :: tau

The time constant of the first order derivative filter .

real(kind=real64), intent(in), dimension(:,:) :: a

The N-by-N dynamics matrix for the plant.

real(kind=real64), intent(in), dimension(size(a, 1), 1) :: b

The N-by-1 input matrix for the plant.

real(kind=real64), intent(in), dimension(1, size(a, 1)) :: c

The 1-by-N output matrix for the plant.

real(kind=real64), intent(in), dimension(1, 1) :: d

The 1-by-1 feedthrough matrix for the plant.

Return Value type(state_space)

The resulting [[state_space]] object.

private pure function state_space_init_pid_plant(kp, ki, kd, tau, plant) result(rst)

Initializes a state-space model that employs a closed-loop PID controller.

The PID model is augmented into the plant model as follows.

Where the augmented matrices are as follows.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: kp

The proportional gain term.

real(kind=real64), intent(in) :: ki

The integral gain term.

real(kind=real64), intent(in) :: kd

The derivative gain term.

real(kind=real64), intent(in) :: tau

The time constant of the first order derivative filter .

class(state_space), intent(in) :: plant

The plant model.

Return Value type(state_space)

The resulting [[state_space]] object.