diff --git a/src/inputoutput.jl b/src/inputoutput.jl index 1be1fbb8dd..db3a7a926c 100644 --- a/src/inputoutput.jl +++ b/src/inputoutput.jl @@ -252,10 +252,10 @@ function generate_control_function(sys::AbstractODESystem, inputs = unbound_inpu process = get_postprocess_fbody(sys) wrapped_arrays_vars = disturbance_argument ? wrap_array_vars( - sys, rhss; dvs, ps, inputs, cachesyms = (disturbance_inputs,)) : + sys, rhss; dvs, ps, inputs, extra_args = (disturbance_inputs,)) : wrap_array_vars(sys, rhss; dvs, ps, inputs) f = build_function(rhss, args...; postprocess_fbody = process, - expression = Val{true}, wrap_code = wrap_mtkparameters(sys, false, 3) .∘ + expression = Val{true}, wrap_code = wrap_mtkparameters(sys, false, 3, Int(disturbance_argument) + 1) .∘ wrapped_arrays_vars .∘ wrap_parameter_dependencies(sys, false), kwargs...)