functionfromMatrices
Generate a DiscreteStateSpace data record from A, B, C and D matrices
Information
Syntax
dss = 'constructor'.fromMatrices(A, B, C, D) dss = 'constructor'.fromMatrices(A, B, C, D, Ts, B2, method)
Description
This function constructs a DiscreteStateSpace record dss with
dss.A = A; dss.B = B; dss.C = C; dss.D = D; dss.B2 = B2; dss.Ts = Ts; dss.method = method;
i.e. the input-matrices are the system matrices of the discrete system. The default values of sample time Ts and discretization method method are
Ts = 1
method = Modelica_LinearSystems2.Types.Method.Trapezoidal
respectively. See also fromMatrices2 where the inputs are the matrices of a continuous system which is to convert to discrete state space.
Example
import dss=Modelica_LinearSystems2.DiscreteStateSpace; Real A[1,1] = [1]; Real B[1,1] = [1]; Real C[1,1] = [1]; Real D[1,1] = [0]; public DiscreteStateSpace dss; algorithm dss := dss.'constructor'.fromMatrices(A, B, C, D) // or just: dss := dss(A, B, C, D, Ts=1, B2=[0], method=Modelica_LinearSystems2.Types.Method.Trapezoidal); // dss.A = [1] // dss.B = [1] // dss.C = [1] // dss.D = [0] // dss.B2 = [0] // dss.Ts = 1 // dss.method = Modelica_LinearSystems2.Types.Method.Trapezoidal
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[:,size(A, 1)] | A | ||
| Real[size(A, 1),:] | B | ||
| Real[:,size(A, 1)] | C | ||
| Real[size(C, 1),size(B, 2)] | D | ||
| Modelica.Units.SI.Time | Ts | 1 | Sample time |
| Real[:,:] | B2 | zeros(size(B, 1), size(B, 2)) | |
| Modelica_LinearSystems2.Utilities.Types.Method | method | Modelica_LinearSystems2.Utilities.Types.Method.Trapezoidal | Discretization methodDiscretization method |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| DiscreteStateSpace | result |