[Dyad] “Cyclic guesses detected” in Dyad from non-ideal RLC

Hi everyone,

I’ve been experimenting with Dyad using the RLC circuit example from the documentation, except I made it a bit less ideal by adding:

  • coil series resistance ( RL )
  • capacitor ESR (Rc

When I add the capacitor ESR, I get one warning and one error.

Warning:

┌ Warning: Initialization system is overdetermined. 3 equations for 1 unknowns. Initialization will default to using least squares. `SCCNonlinearProblem` can only be used for initialization of fully determined systems and hence will not be used here. To suppress this warning pass warn_initialize_determined = false. To make this warning into an error, pass fully_determined = true
└

Error:

ERROR: Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map:
Rc₊v(t)  => (150RLoad₊v(t)) / RLoad₊R
In order to resolve this, please provide additional numeric guesses so that the chain can be resolved to assign numeric values to each variable.

From what I understand, the issue comes from initialization: there isn’t enough numeric information at t=0, so the solver can’t resolve the system.

However, when I try to add the problematic variable to the initial conditions, the initialization system becomes “weird” (effectively no unknowns), and the result ends up being 0, with a warning like:

┌ Warning: Initialization system is overdetermined. 2 equations for 0 unknowns. Initialization will default to using least squares. `SCCNonlinearProblem` can only be used for initialization of fully determined systems and hence will not be used here. To suppress this warning pass warn_initialize_determined = false. To make this warning into an error, pass fully_determined = true
└

Questions

In Julia / ModelingToolkit, you can include “soft constraints” via guesses, e.g.:

    prob = ODEProblem(sys; defaults, tspan;   guesses = [cvar=> 500.0])

Is there an equivalent way to provide numeric guesses in Dyad?

If not, what’s the recommended approach in Dyad to resolve cyclic guesses during initialization?

Thanks a lot!

Code (minimal example):

  • dyad : (Note: all the other components are the same as in the tutorial.)
component RLC_non_ideal
  RL = Resistor(R=0.1)
  Rc = Resistor(R=0.01)
  RLoad = Resistor(R=150.0)
  capacitor = Capacitor(C=1e-6)
  inductor = Inductor(L= 3e-3)
  source = StepVoltage()
  ground = Ground()
relations
  initial inductor.i = 0.0
  initial capacitor.v = 0.0
  initial Rc.v = 0.0 # added after warning
  connect(source.p, inductor.p)
  connect(inductor.n, RL.p)
  connect(RL.n, capacitor.p, RLoad.p)
  connect(Rc.p, capacitor.n, RLoad.p)
  connect(RLoad.n, Rc.n, source.n, ground.g)
end

analysis SimBoostModel
  extends TransientAnalysis(stop=0.5, abstol=1m, reltol=1m )
  model = BoostModel()
end
  • Julia:
result = SimBoostModel()

Hey, to directly address the question there is a guess relation in Dyad with the same syntax as initial. If it’s not in the docs, will add it on Monday!

1 Like

The problem here is probably not lack of information, I think it’s the opposite, two initial conditions too much. You can ask MTK for initial_conditions(model) and see if there are more specified than expected. Have a look at the dimension of the state after mtkcompile, and make sure you have specified the same number of initial conditions. If you do not, you’ll have an under or over determined system and initialization will be a bit harder.

1 Like

Check the connections: RLoad.p is connected with both ends of capacitor resulting in a short-circuit.

1 Like

You’re right ! thanks for pointing that out.

It was a copy/paste mistake, but even with the correct configuration I’m still seeing the same issue.

  connect(source.p, inductor.p)
  connect(inductor.n, RL.p)
  connect(RL.n, capacitor.p, RLoad.p)
  connect(Rc.p, capacitor.n)
  connect(RLoad.n, Rc.n, source.n, ground.g)

Here’s the output I’m getting:

┌ Warning: Did not converge after `maxiters = 100` substitutions. Either there is a cycle in the rules or `maxiters` needs to be higher.

ERROR: Cyclic guesses detected in the system. Symbolic values were found for the following variables/parameters in the map:
RLoad₊v(t)  => 599.96 + 0.01capacitor₊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.

Although it’s true that the symbolic values detected this time are different.

Thanks everyone for the help!

I tried what @asinghvi17 suggested using the corrected model (thanks again @johhell), and this time it worked :slightly_smiling_face:.

Here’s the corrected code, plus the extra guess added for the variable mentioned in the Error:

component BoostModel
  RL = Resistor(R=0.1)
  Rc = Resistor(R=0.01)
  RLoad = Resistor(R=150.0)
  capacitor = Capacitor(C=1e-6)
  inductor = Inductor(L= 3e-3)
  source = StepVoltage()
  ground = Ground()
relations
  initial inductor.i = 0.0
  initial capacitor.v = 0.0
  guess capacitor.i = 0.0 # added 
  connect(source.p, inductor.p)
  connect(inductor.n, RL.p)
  connect(RL.n, capacitor.p, RLoad.p)
  connect(Rc.p, capacitor.n)
  connect(RLoad.n, Rc.n, source.n, ground.g)
end

@baggepinnen thanks for the recommendation. It’ll be useful later for more complex applications.