diff --git a/src/component_functions.jl b/src/component_functions.jl index 38ba8a68..06751882 100644 --- a/src/component_functions.jl +++ b/src/component_functions.jl @@ -964,7 +964,7 @@ function _fill_defaults(T, @nospecialize(kwargs)) #### External Inputs #### if haskey(dict, :extin) - @assert dict[:extin] isa Vector{<:SymbolicIndex} + @assert dict[:extin] isa Union{Nothing, Vector{<:SymbolicIndex}} else dict[:extin] = nothing end diff --git a/src/external_inputs.jl b/src/external_inputs.jl index 4f65ced8..c4afda48 100644 --- a/src/external_inputs.jl +++ b/src/external_inputs.jl @@ -13,11 +13,13 @@ function ExtMap(im::IndexManager) isempty(map) && error("There are no external inputs.") for (vi, vm) in pairs(im.vertexm) + has_external_input(vm) || continue for (i, si) in pairs(vm.extin) map[im.v_ext[vi][i]] = _symidx_to_extidx(im, si) end end for (ei, em) in pairs(im.edgem) + has_external_input(em) || continue for (i, si) in pairs(em.extin) map[im.e_ext[ei][i]] = _symidx_to_extidx(im, si) end diff --git a/src/symbolicindexing.jl b/src/symbolicindexing.jl index 8adb8d30..f5b46bcd 100644 --- a/src/symbolicindexing.jl +++ b/src/symbolicindexing.jl @@ -514,7 +514,7 @@ function _get_observed_f(nw::Network, cf::EdgeModel, eidx) @closure (u, outbuf, aggbuf, extbuf, p, t) -> begin ins = (view(outbuf, esrcr), view(outbuf, edstr)) if has_external_input(cf) - (ins..., view(aggbuf, aggr), view(extbuf, extr)) + (ins..., view(extbuf, extr)) end cf.obsf(ret, view(u, ur), ins..., view(p, pr), t) ret