Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/discretedomain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ end
is_transparent_operator(::Type{Hold}) = true

(D::Hold)(x) = Term{symtype(x)}(D, Any[x])
(D::Hold)(x::Number) = x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this come up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fixpoint_sub when building MTKParameters. Hold(x) is stored as a parameter, so an initial value for x is an initial value for Hold(x).

(D::Hold)(x::Num) = Num(D(value(x)))
SymbolicUtils.promote_symtype(::Hold, x) = x
Base.nameof(::Hold) = :Hold
Expand Down
2 changes: 1 addition & 1 deletion src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,7 @@ function process_parameter_equations(sys::AbstractSystem)
eqs = equations(sys)
for (i, eq) in enumerate(eqs)
empty!(varsbuf)
vars!(varsbuf, eq; op = Union{Differential, Initial, Pre})
vars!(varsbuf, eq; op = Union{Differential, Initial, Pre, Hold, Sample})
# singular equations
isempty(varsbuf) && continue
if all(varsbuf) do sym
Expand Down
Loading