Closed zekeriyasari closed 3 years ago
Example script
using Causal
# Construct model
@defmodel model begin
@nodes begin
gen = SinewaveGenerator()
ds = ContinuousLinearSystem(
A = fill(-1., 1, 1),
B = fill(1., 1, 1),
C = fill(-1., 1, 1),
D = fill(0., 1, 1),
state = [1.],
t = 0.,
input = Inport(),
output = Outport()
)
writer = Writer(buflen = 1) # Single-length buffer
end
@branches begin
gen => ds
ds => writer
end
end
# Simulate model
clk = Clock(1)
sim = simulate!(model, clk)
# Read simulation data
t, x = getcomponent(model, :writer) |> read
@show t, x;
Single-step size simulation should be possible. This can be achieved by updating the buffer sizes of the sink components in the model.