Skip to content

Commit 79af13e

Browse files
authored
Merge pull request #1856 from SciML/fb/dist_name
add name to disturbance model
2 parents 0325d7b + 4cc7865 commit 79af13e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/inputoutput.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ The structure represents a model of a disturbance, along with the input variable
332332
struct DisturbanceModel{M}
333333
input::Any
334334
model::M
335+
name::Symbol
335336
end
337+
DisturbanceModel(input, model; name) = DisturbanceModel(input, model, name)
336338

337339
# Point of overloading for libraries, e.g., to be able to support disturbance models from ControlSystemsBase
338340
function get_disturbance_system(dist::DisturbanceModel{<:ODESystem})

test/input_output_handling.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ model_outputs = [model.inertia1.w, model.inertia2.w, model.inertia1.phi, model.i
244244

245245
@named dmodel = Blocks.StateSpace([0.0], [1.0], [1.0], [0.0]) # An integrating disturbance
246246

247-
dist = ModelingToolkit.DisturbanceModel(model.torque.tau.u, dmodel)
247+
@named dist = ModelingToolkit.DisturbanceModel(model.torque.tau.u, dmodel)
248248
(f_oop, f_ip), outersys, dvs, p = ModelingToolkit.add_input_disturbance(model, dist)
249249

250250
@unpack u, d = outersys

0 commit comments

Comments
 (0)