# MTK problem from tests fails

**URL:** <https://discourse.julialang.org/t/mtk-problem-from-tests-fails/135226>\
**Category:** Modelling & Simulations\
**Tags:** question, modelingtoolkit, mtk\
**Created:** [January 23, 2026, 3:24pm UTC](https://discourse.julialang.org/t/mtk-problem-from-tests-fails/135226 "2026-01-23T15:24:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [January 23, 2026, 3:24pm UTC](https://discourse.julialang.org/t/mtk-problem-from-tests-fails/135226/1 "2026-01-23T15:24:04Z")

</div>

I took the RC example from the tests of ModelingToolkitStandardLibrary.jl: [ModelingToolkitStandardLibrary.jl/test/Electrical/analog.jl at main · SciML/ModelingToolkitStandardLibrary.jl · GitHub](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/main/test/Electrical/analog.jl#L99-L119)

```julia-auto
using ModelingToolkitStandardLibrary.Electrical: Resistor, Capacitor, Voltage, Ground
using ModelingToolkitStandardLibrary.Blocks: Constant
using ModelingToolkitBase

@named source = Constant(; k=10.0)
@named voltage = Voltage()
@named resistor = Resistor(; R=1.0)
@named capacitor = Capacitor(; C=1.0, v=0.0)
@named ground = Ground()

connections = [
    connect(source.output, voltage.V)
    connect(voltage.p, resistor.p)
    connect(resistor.n, capacitor.p)
    connect(capacitor.n, voltage.n, ground.g)
]

@named model = System(connections, t; systems=[resistor, capacitor, source, voltage, ground])
sys = mtkcompile(model)
prob = ODEProblem(sys, Pair[], (0.0, 10.0))
sol = solve(prob, Tsit5())

```

but it fails

```julia
ERROR: Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map: 
voltage₊n₊i(t) => voltage₊n₊i(t)
ground₊g₊i(t) => ground₊g₊i(t)
capacitor₊p₊i(t) => capacitor₊p₊i(t)
capacitor₊i(t) => capacitor₊i(t)
resistor₊p₊v(t) => resistor₊p₊v(t)
voltage₊i(t) => voltage₊i(t)
voltage₊p₊v(t) => voltage₊p₊v(t)
resistor₊n₊v(t) => resistor₊n₊v(t)
voltage₊v(t) => voltage₊v(t)
resistor₊n₊i(t) => resistor₊n₊i(t)
voltage₊p₊i(t) => voltage₊p₊i(t)
resistor₊v(t) => resistor₊v(t)
resistor₊p₊i(t) => resistor₊p₊i(t)
capacitor₊p₊v(t) => capacitor₊p₊v(t)
voltage₊n₊v(t) => voltage₊n₊v(t)
resistor₊i(t) => resistor₊i(t)
capacitor₊n₊i(t) => capacitor₊n₊i(t)
In order to resolve this, please provide additional numeric guesses so that the chain can be resolved to assign numeric values to each variable. Alternatively, the `missing_guess_value` keyword can be used to set a fallback guess for all variables. The keyword must be passed an instance of the `MissingGuessValue` sum-type.

Stacktrace:
  [1] varmap_to_vars(varmap::ModelingToolkitBase.AtomicArrayDict{…}, vars::Vector{…}; tofloat::Bool, use_union::Bool, container_type::Type, buffer_eltype::Type, toterm::Function, check::Bool, allow_symbolic::Bool, is_initializeprob::Bool, substitution_limit::Int64, missing_values::ModelingToolkitBase.MissingGuessValue.var"typeof(MissingGuessValue)")
    @ ModelingToolkitBase C:\Users\vkais\.julia\packages\ModelingToolkitBase\lC2g8\src\systems\problem_utils.jl:359

```

Also, why does `equations(sys)` still have 19 equations?

Running this on:

```julia
[7771a370] ModelingToolkitBase v1.6.3
[16a59e39] ModelingToolkitStandardLibrary v2.26.0

```

---

<div class="post-metadata">

**Author:** ![johhell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johhell/32/46165_2.png) [@johhell](https://discourse.julialang.org/u/johhell)\
**Post date:** [January 25, 2026, 7:04pm UTC](https://discourse.julialang.org/t/mtk-problem-from-tests-fails/135226/2 "2026-01-25T19:04:47Z")

</div>

with modified `using/import` everything is fine.

```julia-auto
using ModelingToolkitStandardLibrary.Electrical: Resistor, Capacitor, Voltage, Ground
using ModelingToolkitStandardLibrary.Blocks: Constant
using ModelingToolkit
import ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations
...

```

```julia-auto
julia> sys
Model model:
Equations (1):
  1 standard: see equations(model)
Unknowns (1): see unknowns(model)
  capacitor₊v(t) [defaults to 0.0]
Parameters (5): see parameters(model)
  resistor₊R [defaults to 1.0]: Reference resistance
  resistor₊T_ref [defaults to 300.15]: Reference temperature
  resistor₊alpha [defaults to 0.0]: Temperature coefficient of resistance
  capacitor₊C [defaults to 1.0]: Capacitance
  source₊k [defaults to 10.0]: Constant output value of block
Observed (21): see observed(model)

```

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [January 25, 2026, 7:25pm UTC](https://discourse.julialang.org/t/mtk-problem-from-tests-fails/135226/3 "2026-01-25T19:25:02Z")

</div>

You added a dependency – `ModelingToolkit.jl`. So even this simple example is too much for base?

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [January 25, 2026, 8:02pm UTC](https://discourse.julialang.org/t/mtk-problem-from-tests-fails/135226/4 "2026-01-25T20:02:55Z")

</div>

Seems like it. But if this should be a very simple case to handle you could open an issue asking for the MTKBase library simplification code to handle this. I think that some level of simplified analysis there is considered ok/reasonable, but it will be far behind the components that were moved out of MTK base and into the JuliaHub hosted components.
