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
7
7
phase:: Float64 = 0.0
8
8
end
9
9
SolverStepClock
10
+ struct EventClock
11
+ id:: Symbol
12
+ end
10
13
end
11
14
12
15
# for backwards compatibility
13
16
const TimeDomain = Clocks. Type
14
- using . Clocks: ContinuousClock, PeriodicClock, SolverStepClock
17
+ using . Clocks: ContinuousClock, PeriodicClock, SolverStepClock, EventClock
15
18
const Continuous = ContinuousClock ()
16
19
(clock:: TimeDomain )() = clock
17
20
@@ -57,12 +60,18 @@ iscontinuous(c::TimeDomain) = @match c begin
57
60
_ => false
58
61
end
59
62
63
+ iseventclock (c:: TimeDomain ) = @match c begin
64
+ EventClock () => true
65
+ _ => false
66
+ end
67
+
60
68
is_discrete_time_domain (c:: TimeDomain ) = ! iscontinuous (c)
61
69
62
70
# workaround for https://github.com/Roger-luo/Moshi.jl/issues/43
63
71
isclock (:: Any ) = false
64
72
issolverstepclock (:: Any ) = false
65
73
iscontinuous (:: Any ) = false
74
+ iseventclock (:: Any ) = false
66
75
is_discrete_time_domain (:: Any ) = false
67
76
68
77
# public
@@ -71,6 +80,8 @@ function first_clock_tick_time(c, t0)
71
80
PeriodicClock (dt) => ceil (t0 / dt) * dt
72
81
SolverStepClock () => t0
73
82
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 " )
74
85
end
75
86
end
76
87
You can’t perform that action at this time.
0 commit comments