@@ -14,8 +14,11 @@ struct LinModel{NT<:Real} <: SimModel{NT}
1414 yop:: Vector{NT}
1515 dop:: Vector{NT}
1616 function LinModel {NT} (A, Bu, C, Bd, Dd, Ts) where {NT<: Real }
17- A, Bu, C, Bd, Dd = to_mat (A), to_mat (Bu), to_mat (C), to_mat (Bd), to_mat (Dd)
18- nu, nx, ny, nd = size (Bu,2 ), size (A,2 ), size (C,1 ), size (Bd,2 )
17+ A, Bu, C = to_mat (A, 1 , 1 ), to_mat (Bu, 1 , 1 ), to_mat (C, 1 , 1 )
18+ nu, nx, ny = size (Bu, 2 ), size (A, 2 ), size (C, 1 )
19+ Bd = to_mat (Bd, nx, Bd ≠ 0 )
20+ nd = size (Bd, 2 )
21+ Dd = to_mat (Dd, ny, nd)
1922 size (A) == (nx,nx) || error (" A size must be $((nx,nx)) " )
2023 size (Bu) == (nx,nu) || error (" Bu size must be $((nx,nu)) " )
2124 size (C) == (ny,nx) || error (" C size must be $((ny,nx)) " )
@@ -188,31 +191,14 @@ end
188191
189192Construct the model from the discrete state-space matrices `A, Bu, C, Bd, Dd` directly.
190193
191- See [`LinModel(::StateSpace)`](@ref) Extended Help for the meaning of the matrices. This
194+ See [`LinModel(::StateSpace)`](@ref) Extended Help for the meaning of the matrices. The
195+ arguments `Bd` and `Dd` can be the scalar `0` is there is no measured disturbances. This
192196syntax do not modify the state-space representation provided in argument (`minreal` is not
193- called). Care must be taken to ensure that the model is controllable and observable. The
194- optional parameter `NT` explicitly specifies the number type of the matrices .
197+ called). Care must be taken to ensure that the model is controllable and observable. The
198+ optional parameter `NT` explicitly set the number type of vectors (default to `Float64`) .
195199"""
196200LinModel {NT} (A, Bu, C, Bd, Dd, Ts) where NT<: Real
197-
198- function LinModel (
199- A:: Array{NT} , Bu:: Array{NT} , C:: Array{NT} , Bd:: Array{NT} , Dd:: Array{NT} , Ts:: Real
200- ) where {NT<: Real }
201- return LinModel {NT} (A, Bu, C, Bd, Dd, Ts)
202- end
203-
204- function LinModel (
205- A:: Array{<:Real} ,
206- Bu:: Array{<:Real} ,
207- C:: Array{<:Real} ,
208- Bd:: Array{<:Real} ,
209- Dd:: Array{<:Real} ,
210- Ts:: Real
211- )
212- A, Bu, C, Bd, Dd = to_mat (A), to_mat (Bu), to_mat (C), to_mat (Bd), to_mat (Dd)
213- A, Bu, C, Bd, Dd = promote (A, Bu, C, Bd, Dd)
214- return LinModel (A, Bu, C, Bd, Dd, Ts)
215- end
201+ LinModel (A, Bu, C, Bd, Dd, Ts) = LinModel {Float64} (A, Bu, C, Bd, Dd, Ts)
216202
217203@doc raw """
218204 steadystate!(model::LinModel, u, d)
0 commit comments