File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,14 @@ abstract type AbstractClock end
77 phase:: Float64 = 0.0
88 end
99 SolverStepClock
10+ struct EventClock
11+ id:: Symbol
12+ end
1013end
1114
1215# for backwards compatibility
1316const TimeDomain = Clocks. Type
14- using . Clocks: ContinuousClock, PeriodicClock, SolverStepClock
17+ using . Clocks: ContinuousClock, PeriodicClock, SolverStepClock, EventClock
1518const Continuous = ContinuousClock ()
1619(clock:: TimeDomain )() = clock
1720
@@ -57,12 +60,18 @@ iscontinuous(c::TimeDomain) = @match c begin
5760 _ => false
5861end
5962
63+ iseventclock (c:: TimeDomain ) = @match c begin
64+ EventClock () => true
65+ _ => false
66+ end
67+
6068is_discrete_time_domain (c:: TimeDomain ) = ! iscontinuous (c)
6169
6270# workaround for https://github.com/Roger-luo/Moshi.jl/issues/43
6371isclock (:: Any ) = false
6472issolverstepclock (:: Any ) = false
6573iscontinuous (:: Any ) = false
74+ iseventclock (:: Any ) = false
6675is_discrete_time_domain (:: Any ) = false
6776
6877# public
@@ -71,6 +80,8 @@ function first_clock_tick_time(c, t0)
7180 PeriodicClock (dt) => ceil (t0 / dt) * dt
7281 SolverStepClock () => t0
7382 ContinuousClock () => error (" ContinuousClock() is not a discrete clock" )
83+ EventClock () => error (" Event clocks do not have a defined first tick time." )
84+ _ => error (" Unimplemented for clock $c " )
7485 end
7586end
7687
You can’t perform that action at this time.
0 commit comments