Open
Description
Hello,
I am testing the interconnect
function to integrate it within nodedge editor, but I don't understand the behavior in the example_with_connections
.
In particular, I have the following warning:
UserWarning: Unused input(s) in InterconnectedSystem: (0, 1)=sum.p.y[0]
And the step response is not the same as for the example_with_explicit_signals
.
Can you please explain me what I am doing wrong?
Best regards.
Anthony.
import control as ct
import numpy as np
def example_with_explicit_signals():
P = ct.tf2io([1], [1, 1], inputs="u", outputs="y")
C = ct.tf2io([1], [1, 0], inputs="e", outputs="u")
sumblk = ct.summing_junction(inputs=["ref", "-y"], output="e", name="sum")
io_closed = ct.interconnect([sumblk, C, P], inplist=["ref"], outlist="y")
print(io_closed)
time = np.linspace(0, 10, 100)
t, y = ct.input_output_response(io_closed, time, U=30, X0=[0, 15])
print(y)
return y
def example_with_connections():
P = ct.tf2io([1], [1, 1], name="p", inputs=1, outputs=1, states="X0")
C = ct.tf2io([1], [1, 0], name="c", inputs=1, outputs=1, states="X1")
sumblk = ct.summing_junction(inputs=["ref", "p.y[0]"], output="e", name="sum")
io_closed = ct.interconnect(
[sumblk, C, P],
inplist=["ref"],
outlist="p.y[0]",
connections=[
("p.u[0]", "c.y[0]"),
("c.u[0]", "sum.e"),
],
)
print(io_closed)
time = np.linspace(0, 10, 100)
t, y = ct.input_output_response(io_closed, time, U=30, X0=[0, 15])
print(y)
return y
if __name__ == "__main__":
np.testing.assert_array_equal(
example_with_explicit_signals(), example_with_connections()
)