Skip to content

Commit 40ee33d

Browse files
authored
Merge pull request #144 from JuliaControl/cleanup
removing commented out code
2 parents 9c3c3c6 + 91c8883 commit 40ee33d

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/model/linearization.jl

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,36 +136,24 @@ julia> linearize!(linmodel, model, x=[20.0], u=[0.0]); linmodel.A
136136
```
137137
"""
138138
function linearize!(
139-
linmodel::LinModel{NT}, model::SM; x=model.x0+model.xop, u=model.uop, d=model.dop
140-
) where {NT<:Real, SM<:SimModel{NT}}
139+
linmodel::LinModel, model::SimModel; x=model.x0+model.xop, u=model.uop, d=model.dop
140+
)
141141
nonlinmodel = model
142142
buffer = nonlinmodel.buffer
143143
# --- remove the operating points of the nonlinear model (typically zeros) ---
144-
x0::Vector{NT}, u0::Vector{NT}, d0::Vector{NT} = buffer.x, buffer.u, buffer.d
144+
x0, u0, d0 = buffer.x, buffer.u, buffer.d
145145
u0 .= u .- nonlinmodel.uop
146146
d0 .= d .- nonlinmodel.dop
147147
x0 .= x .- nonlinmodel.xop
148148
# --- compute the Jacobians at linearization points ---
149-
#A::Matrix{NT}, Bu::Matrix{NT}, Bd::Matrix{NT} = linmodel.A, linmodel.Bu, linmodel.Bd
150-
#C::Matrix{NT}, Dd::Matrix{NT} = linmodel.C, linmodel.Dd
151-
xnext0::Vector{NT}, y0::Vector{NT} = linmodel.buffer.x, linmodel.buffer.y
152-
#myf_x0!(xnext0, x0) = f!(xnext0, nonlinmodel, x0, u0, d0, model.p)
153-
#myf_u0!(xnext0, u0) = f!(xnext0, nonlinmodel, x0, u0, d0, model.p)
154-
#myf_d0!(xnext0, d0) = f!(xnext0, nonlinmodel, x0, u0, d0, model.p)
155-
#myh_x0!(y0, x0) = h!(y0, nonlinmodel, x0, d0, model.p)
156-
#myh_d0!(y0, d0) = h!(y0, nonlinmodel, x0, d0, model.p)
157-
#ForwardDiff.jacobian!(A, myf_x0!, xnext0, x0)
158-
#ForwardDiff.jacobian!(Bu, myf_u0!, xnext0, u0)
159-
#ForwardDiff.jacobian!(Bd, myf_d0!, xnext0, d0)
160-
#ForwardDiff.jacobian!(C, myh_x0!, y0, x0)
161-
#ForwardDiff.jacobian!(Dd, myh_d0!, y0, d0)
162149
jb = nonlinmodel.buffer.jacobian
163150
jacobianA!(linmodel.A, jb, nonlinmodel, x0, u0, d0)
164151
jacobianBu!(linmodel.Bu, jb, nonlinmodel, x0, u0, d0)
165152
jacobianBd!(linmodel.Bd, jb, nonlinmodel, x0, u0, d0)
166153
jacobianC!(linmodel.C, jb, nonlinmodel, x0, d0)
167154
jacobianDd!(linmodel.Dd, jb, nonlinmodel, x0, d0)
168155
# --- compute the nonlinear model output at operating points ---
156+
xnext0, y0 = linmodel.buffer.x, linmodel.buffer.y
169157
h!(y0, nonlinmodel, x0, d0, model.p)
170158
y = y0
171159
y .= y0 .+ nonlinmodel.yop

0 commit comments

Comments
 (0)