Thanks to visit codestin.com
Credit goes to github.com

Skip to content

InterconnectedSystem changing the system name if signal is mistyped #897

Closed
@joaoantoniocardoso

Description

@joaoantoniocardoso

Let's say I have an InterconnectedSystem as follows:

ct.interconnect(
    [
        ct.rss(name='a', inputs=('u0'), outputs=('y0'), strictly_proper=True),
        ct.rss(name='b', inputs=('u0','u1'), outputs=('y0','y1'), strictly_proper=True),
    ],
    name='ab',
    connections=(
        ['b.u0', 'a.y0'],
    ),
    inputs=(
        'b.u0', 'b.u1',
    ),
    outputs=(
        'b.y0','b.y1',
    )
)

Its .__dict__ is:

{'name': 'ab',  # <<<<< Note the correct name here
 'ninputs': 2,
 'input_index': {'a.u0': 0, 'b.u1': 1},
 'noutputs': 2,
 'output_index': {'b.y0': 0, 'b.y1': 1},
 'nstates': 2,
 'state_index': {'a_x[0]': 0, 'b_x[0]': 1},
 'dt': 0,
 'params': {},
 'syslist': [<LinearIOSystem:a:['u0']->['y0']>,
  <LinearIOSystem:b:['u0', 'u1']->['y0', 'y1']>],
 'syslist_index': {'a': 0, 'b': 1},
 'state_offset': [0, 1],
 'input_offset': [0, 1],
 'output_offset': [0, 1],
 'connect_map': array([[0., 0., 0.],
        [1., 0., 0.],
        [0., 0., 0.]]),
 'input_map': array([[1., 0.],
        [1., 0.],
        [0., 1.]]),
 'output_map': array([[0., 1., 0., 0., 0., 0.],
        [0., 0., 1., 0., 0., 0.]]),
 'A': array([[-0.52126004,  0.        ],
        [ 0.        , -1.05433024]]),
 'B': array([[-0.88399486,  0.        ],
        [ 0.        ,  0.64167349]]),
 'C': array([[0.       , 0.       ],
        [0.       , 0.7629647]]),
 'D': array([[0., 0.],
        [0., 0.]])}

If I mistype an input, say a.a0 to a0, it weirdly changes the name of the resulting InterconnectedSystem to a0, which sounds like a bug:

{'name': 'u0',  # <<<<< Now, the name is wrong!
 'ninputs': 2,
 'input_index': {'u0': 0, 'b.u1': 1},
 'noutputs': 2,
 'output_index': {'b.y0': 0, 'b.y1': 1},
 'nstates': 2,
 'state_index': {'a_x[0]': 0, 'b_x[0]': 1},
 'dt': 0,
 'params': {},
 'syslist': [<LinearIOSystem:a:['u0']->['y0']>,
  <LinearIOSystem:b:['u0', 'u1']->['y0', 'y1']>],
 'syslist_index': {'a': 0, 'b': 1},
 'state_offset': [0, 1],
 'input_offset': [0, 1],
 'output_offset': [0, 1],
 'connect_map': array([[0., 0., 0.],
        [1., 0., 0.],
        [0., 0., 0.]]),
 'input_map': array([[1., 0.],
        [1., 0.],
        [0., 1.]]),
 'output_map': array([[0., 1., 0., 0., 0., 0.],
        [0., 0., 1., 0., 0., 0.]]),
 'A': array([[-0.52126004,  0.        ],
        [ 0.        , -1.05433024]]),
 'B': array([[-0.88399486,  0.        ],
        [ 0.        ,  0.64167349]]),
 'C': array([[0.       , 0.       ],
        [0.       , 0.7629647]]),
 'D': array([[0., 0.],
        [0., 0.]])}

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions