Skip to content

Commit 2e471b2

Browse files
committed
More robust clock inference
1 parent b20cee5 commit 2e471b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/systems/clock_inference.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ end
2323

2424
function infer_clocks!(ci::ClockInference)
2525
@unpack ts, eq_domain, var_domain, inferred = ci
26-
@unpack graph = ts.structure
26+
@unpack var_to_diff, graph = ts.structure
2727
fullvars = get_fullvars(ts)
2828
isempty(inferred) && return ci
2929
# TODO: add a graph type to do this lazily
@@ -37,6 +37,11 @@ function infer_clocks!(ci::ClockInference)
3737
end
3838
end
3939
end
40+
for v in vertices(var_to_diff)
41+
if (v′ = var_to_diff[v]) !== nothing
42+
add_edge!(var_graph, v, v′)
43+
end
44+
end
4045
cc = connected_components(var_graph)
4146
for c′ in cc
4247
c = BitSet(c′)
@@ -160,8 +165,6 @@ function generate_discrete_affect(syss, inputs, continuous_id, id_to_clock;
160165
for s in states(sys)
161166
push!(fullvars, s)
162167
end
163-
@show needed_cont_to_disc_obs, fullvars
164-
@show inputs[continuous_id]
165168
needed_disc_to_cont_obs = []
166169
disc_to_cont_idxs = Int[]
167170
for v in inputs[continuous_id]

0 commit comments

Comments
 (0)