@@ -88,6 +88,11 @@ struct JumpSystem{U <: ArrayPartition} <: AbstractTimeDependentSystem
8888    """  
8989    connector_type:: Any 
9090    """ 
91+     A `Vector{SymbolicContinuousCallback}` that model events. 
92+     The integrator will use root finding to guarantee that it steps at each zero crossing. 
93+     """  
94+     continuous_events:: Vector{SymbolicContinuousCallback} 
95+     """ 
9196    A `Vector{SymbolicDiscreteCallback}` that models events. Symbolic 
9297    analog to `SciMLBase.DiscreteCallback` that executes an affect when a given condition is 
9398    true at the end of an integration step. Note, one must make sure to call 
@@ -120,8 +125,7 @@ struct JumpSystem{U <: ArrayPartition} <: AbstractTimeDependentSystem
120125
121126    function  JumpSystem {U} (
122127            tag, ap:: U , iv, unknowns, ps, var_to_name, observed, name, description,
123-             systems,
124-             defaults, connector_type, devents, parameter_dependencies,
128+             systems, defaults, connector_type, cevents, devents, parameter_dependencies,
125129            metadata =  nothing , gui_metadata =  nothing ,
126130            complete =  false , index_cache =  nothing , isscheduled =  false ;
127131            checks:: Union{Bool, Int}  =  true ) where  {U <:  ArrayPartition }
@@ -136,8 +140,8 @@ struct JumpSystem{U <: ArrayPartition} <: AbstractTimeDependentSystem
136140        end 
137141        new {U} (tag, ap, iv, unknowns, ps, var_to_name,
138142            observed, name, description, systems, defaults,
139-             connector_type, devents, parameter_dependencies, metadata, gui_metadata, 
140-             complete, index_cache, isscheduled)
143+             connector_type, cevents,  devents, parameter_dependencies, metadata, 
144+             gui_metadata,  complete, index_cache, isscheduled)
141145    end 
142146end 
143147function  JumpSystem (tag, ap, iv, states, ps, var_to_name, args... ; kwargs... )
@@ -210,13 +214,12 @@ function JumpSystem(eqs, iv, unknowns, ps;
210214        end 
211215    end 
212216
213-     (continuous_events ===  nothing ) || 
214-         error (" JumpSystems currently only support discrete events."  )
217+     cont_callbacks =  SymbolicContinuousCallbacks (continuous_events)
215218    disc_callbacks =  SymbolicDiscreteCallbacks (discrete_events)
216219
217220    JumpSystem {typeof(ap)} (Threads. atomic_add! (SYSTEM_COUNT, UInt (1 )),
218221        ap, iv′, us′, ps′, var_to_name, observed, name, description, systems,
219-         defaults, connector_type, disc_callbacks, parameter_dependencies,
222+         defaults, connector_type, cont_callbacks,  disc_callbacks, parameter_dependencies,
220223        metadata, gui_metadata, checks =  checks)
221224end 
222225
@@ -399,6 +402,10 @@ function DiffEqBase.DiscreteProblem(sys::JumpSystem, u0map, tspan::Union{Tuple,
399402        error (" The passed in JumpSystem contains `Equations`, please use a problem type that supports equations such as such as ODEProblem."  )
400403    end 
401404
405+     if  ! isempty (continuous_events (sys))
406+         error (" The passed in JumpSystem contains `ContinuousEvents`, please use a problem type that supports continuous events such as such as ODEProblem."  )
407+     end 
408+ 
402409    _, u0, p =  process_SciMLProblem (EmptySciMLFunction, sys, u0map, parammap;
403410        t =  tspan ===  nothing  ?  nothing  :  tspan[1 ], use_union, tofloat =  false , check_length =  false )
404411    f =  DiffEqBase. DISCRETE_INPLACE_DEFAULT
@@ -488,12 +495,12 @@ function DiffEqBase.ODEProblem(sys::JumpSystem, u0map, tspan::Union{Tuple, Nothi
488495        error (" A completed `JumpSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `DiscreteProblem`"  )
489496    end 
490497
491-     #  forward everything to be an ODESystem but the jumps
498+     #  forward everything to be an ODESystem but the jumps and discrete events 
492499    if  has_equations (sys)
493500        osys =  ODESystem (equations (sys). x[4 ], get_iv (sys), unknowns (sys), parameters (sys);
494501            observed =  observed (sys), name =  nameof (sys), description =  description (sys),
495502            systems =  get_systems (sys), defaults =  defaults (sys), 
496-             discrete_events  =  discrete_events (sys),  
503+             continuous_events  =  continuous_events (sys),
497504            parameter_dependencies =  parameter_dependencies (sys),
498505            metadata =  get_metadata (sys), gui_metadata =  get_gui_metadata (sys))
499506        osys =  complete (osys)
@@ -542,8 +549,11 @@ function JumpProcesses.JumpProblem(js::JumpSystem, prob,
542549                            for  j in  eqs. x[2 ]]
543550    vrjs =  VariableRateJump[assemble_vrj (js, j, unknowntoid; eval_expression, eval_module)
544551                            for  j in  eqs. x[3 ]]
545-     ((prob isa  DiscreteProblem) &&  (! isempty (vrjs) ||  has_equations (js))) && 
546-         error (" Use continuous problems such as an ODEProblem or a SDEProblem with VariableRateJumps and/or coupled differential equations."  )
552+     if  prob isa  DiscreteProblem
553+         if  (! isempty (vrjs) ||  has_equations (js) ||  ! isempty (continous_events (js)))
554+             error (" Use continuous problems such as an ODEProblem or a SDEProblem with VariableRateJumps, coupled differential equations, or continuous events."  )
555+         end 
556+     end 
547557    jset =  JumpSet (Tuple (vrjs), Tuple (crjs), nothing , majs)
548558
549559    #  dep graphs are only for constant rate jumps
0 commit comments