You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
State-machine query operators in ModelingToolkitTearing throw UndefVarError for wrap #170
I am adding Modelica-style state machines to SynchToolkit (JuliaComputing/SynchToolkit.jl#252). The state machines are declared with the operators in lib/ModelingToolkitTearing/src/clock_inference/state_machines.jl. Transition conditions and equations refer to the state of a machine through the query operators activeState, ticksInState, timeInState and entry.
What fails
Every method of these four operators throws on ModelingToolkitTearing 1.20.7, and the code on main is the same:
using ModelingToolkit
using ModelingToolkit: t_nounits as t
import ModelingToolkit.MTKTearing as MTKT
@named s1 =System(Equation[], t, [], [])
MTKT.activeState(s1)
ERROR: UndefVarError: `wrap` not defined in `ModelingToolkitTearing`
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name also exists in Symbolics.
Stacktrace:
[1] activeState(x::System)
@ ModelingToolkitTearing ~/.julia/packages/ModelingToolkitTearing/gRDNi/src/clock_inference/state_machines.jl:77
The zero-argument methods (ticksInState(), timeInState(), entry()) fail in the same way. transition and initial_state work.
The methods are generated by the loop at state_machines.jl:71-83 and call wrap(term($s, x)). wrap is not exported by Symbolics 7. The file does not appear to be covered by tests.
Workaround
SynchToolkit defines its own activeState, ticksInState, timeInState and entry, which construct the terms with Symbolics.wrap(SymbolicUtils.term(f, s; type, shape)).
Activity