Defines a state-space representation of a dynamic system. This implementation takes the form:
Where:
denotes time.
is the state vector.
is the input vector.
is the output vector.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public, | allocatable, dimension(:,:) | :: | A |
The N-by-N dynamics matrix, where N is the number of state variables. |
||
| real(kind=real64), | public, | allocatable, dimension(:,:) | :: | B |
The N-by-M input matrix, where M is the number of inputs. |
||
| real(kind=real64), | public, | allocatable, dimension(:,:) | :: | C |
The P-by-N output matrix, where P is the number of outputs. |
||
| real(kind=real64), | public, | allocatable, dimension(:,:) | :: | D |
The P-by-M feedthrough matrix. |
Initializes the state space model.
The output matrix is initialized to one, and the feedthrough matrix is initialized to zero.
| Type | Intent | Optional | 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. |
The [[state_space]] model.
Initializes the state space model.
The output matrix is initialized to one, and the feedthrough matrix is initialized to zero.
| Type | Intent | Optional | 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. |
The [[state_space]] model.
Initializes the state space model.
| Type | Intent | Optional | 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. |
The resulting [[state_space]] object.
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.
| Type | Intent | Optional | 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. |
The resulting [[state_space]] object.
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.
| Type | Intent | Optional | 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. |
The resulting [[state_space]] object.
Evaluates the state time derivative .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| real(kind=real64), | intent(in), | dimension(:) | :: | u |
The M-element input array. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | x |
The N-element state array. |
The N-element state time derivative vector.
Evaluates the output vector .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| real(kind=real64), | intent(in), | dimension(:) | :: | u |
The M-element input array. |
|
| real(kind=real64), | intent(in), | dimension(:) | :: | x |
The N-element state array. |
The P-element output array.
Computes the poles of the state space model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| class(errors), | intent(inout), | optional, | target | :: | err |
An error handling object. |
The poles of the model.
Evaluates the transfer functions for the model at the parameter .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| complex(kind=real64), | intent(in) | :: | s |
The frequency at which to evaluate the transfer functions. |
The resulting transfer functions.
Evaluates the transfer functions for the model at frequency .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| real(kind=real64), | intent(in) | :: | omega |
The frequency at which to evaluate the transfer functions. |
The resulting transfer functions.
Evaluates the transfer functions for the model at the frequencies given in the array .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| complex(kind=real64), | intent(in), | dimension(:) | :: | s |
The frequencies at which to evaluate the transfer functions. |
The resulting transfer functions, with each page of the array containing the transfer functions for a specific frequency.
Evaluates the transfer functions for the model at the frequencies given in the array .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| real(kind=real64), | intent(in), | dimension(:) | :: | omega |
The frequencies at which to evaluate the transfer functions. |
The resulting transfer functions, with each page of the array containing the transfer functions for a specific frequency.
Computes the zeros of the state space model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(state_space), | intent(in) | :: | this |
The state_space object. |
||
| class(errors), | intent(inout), | optional, | target | :: | err |
An error handling object. |
The zeros of the model.