Skip to content

Running a simulation of a toy problem does not terminate #20

@freemin7

Description

@freemin7

Hello,

i tried to port a toy problem from Simulink to this framework.


Cf = 0.03
Lf = 0.0003
RLF = 2.0

model = Model(clock=Clock(0,0.01,4.))

konstLaststrom = StepGenerator(;amplitude=0, delay=0.001, offset=1)

divide = Multiplier((*, /))
iAdd = Adder((+, -))

Intuc = ODESystem((dx,x,u,t)->(dx[1]=u[1](t)/Cf), (x,u,t) -> x, [99.99], 0., Inport(), Outport())

Uq = StepGenerator(;amplitude=100, delay=0.0001, offset=0)
uAdd = Adder((-, -, +))

IntiLf = ODESystem((dx,x,u,t)->(dx[1]=u[1](t)/Lf), (x,u,t) -> x, [1.0], 0., Inport(), Outport())

uRf = Gain(gain=RLF)

addnode(model, konstLaststrom, label=:konstLaststrom)
addnode(model, divide, label=:divide)
addnode(model, iAdd, label=:iAdd)
addnode(model, Intuc, label=:Intuc)
addnode(model, Uq, label=:Uq)
addnode(model, uAdd, label=:uAdd)
addnode(model, IntiLf, label=:IntiLf)
addnode(model, uRf, label=:uRf)

addnode(model, Writer(Inport(5)), label=:writer)

addbranch(model, :Intuc => :divide, 1 => 2)
addbranch(model, :konstLaststrom => :divide, 1 => 1)
addbranch(model, :divide => :iAdd, 1 => 2)
addbranch(model, :IntiLf => :iAdd, 1 => 1)
addbranch(model, :iAdd => :Intuc, 1 => 1)
addbranch(model, :Intuc => :iAdd, 1 => 1)

addbranch(model, :Uq => :uAdd, 1 => 3)
addbranch(model, :Intuc => :uAdd, 1 => 2)
addbranch(model, :uRf => :uAdd, 1 => 1)
addbranch(model, :uAdd => :IntiLf, 1 => 1)
addbranch(model, :IntiLf => :uRf, 1 => 1)

addbranch(model, :Uq => :writer, 1 => 1)
addbranch(model, :Intuc => :writer, 1 => 2)
addbranch(model, :IntiLf => :writer, 1 => 3)
addbranch(model, :divide => :writer, 1 => 4)
addbranch(model, :iAdd => :writer, 1 => 5)

sim = simulate(model)

However the program is stuck on:

[ Info: 2020-05-11T20:31:55.632 Inspecting model...
┌ Info:     The model has algebraic loops:Array{Int64,1}[[2, 3, 4], [3, 4], [3, 4, 6, 7], [6, 7, 8]]
└       Trying to break these loops...
[ Info:     Loop [2, 3, 4] is broken
[ Info:     Loop [3, 4] is broken
[ Info:     Loop [3, 4, 6, 7] is broken
[ Info:     Loop [6, 7, 8] is broken
[ Info: 2020-05-11T20:31:56.43 Done.
[ Info: 2020-05-11T20:31:56.43 Initializing the model...
[ Info: 2020-05-11T20:32:00.388 Done...
[ Info: 2020-05-11T20:32:00.388 Running the simulation...

I also found no way to check whether i missed to add some branch, other than manually where i spotted nothing wrong. I also see not CPU utilization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions