Skip to content

Commit db21e19

Browse files
committed
feat: add discrete_parameters
1 parent b9fc098 commit db21e19

File tree

2 files changed

+462
-459
lines changed

2 files changed

+462
-459
lines changed

src/systems/callbacks.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ make_affect(affect::Affect; kwargs...) = affect
241241
function make_affect(affect::Vector{Equation}; discrete_parameters::AbstractVector = Any[], iv = nothing, algeeqs::Vector{Equation} = Equation[])
242242
isempty(affect) && return nothing
243243
isempty(algeeqs) && @warn "No algebraic equations were found for the callback defined by $(join(affect, ", ")). If the system has no algebraic equations, this can be disregarded. Otherwise pass in `algeeqs` to the SymbolicContinuousCallback constructor."
244-
isnothing(iv) && error("Must specify iv.")
244+
if isnothing(iv)
245+
iv = t_nounits
246+
@warn "No independent variable specified. Defaulting to t_nounits."
247+
end
245248

246249
for p in discrete_parameters
247250
occursin(unwrap(iv), unwrap(p)) || error("Non-time dependent parameter $p passed in as a discrete. Must be declared as @parameters $p(t).")

0 commit comments

Comments
 (0)