using Causal
# Define the model
@defmodel model begin
@nodes begin
gen = SinewaveGenerator()
mem = Memory(delay=1.)
writer = Writer(input=Inport(2))
end
@branches begin
gen => mem
gen[1] => writer[1]
mem[1] => writer[2]
end
end
# Simulate the model
sim = simulate!(model, 0, 0.01, 5.)
In the model, both gen and mem are connected to writer. When the model is tried to be simulated, the simulation gets stuck.
However, when gen and mem are connected to different writers, the simulation is carried out without being blocked. Here is the latter case.
using Causal
using Plots
# Define the model
@defmodel model begin
@nodes begin
gen = SinewaveGenerator()
mem = Memory(delay=1.)
writer1 = Writer(input=Inport())
writer2 = Writer(input=Inport())
end
@branches begin
gen => mem
gen=> writer1
mem => writer2
end
end
# Simulate the model
sim = simulate!(model, 0, 0.01, 5.)
Consider the following model
In the model, both
gen
andmem
are connected towriter
. When the model is tried to be simulated, the simulation gets stuck.However, when
gen
andmem
are connected to different writers, the simulation is carried out without being blocked. Here is the latter case.