Using the Integrator block from ModelingToolkitStandardLibrary with vector input

Hi,
I’m trying to build a multi-input multi-output control system using ModelingToolkit and the ModelingToolkitStandardLibrary. I’ve come to the Integrator block and I can’t figure out how to configure it for a vector input.
For a minimum example (size 2, although later on I’ll be using larger size), you can see the code below:

using ModelingToolkit, DifferentialEquations, Plots
using ModelingToolkit: t_nounits as t, D_nounits as D
using ModelingToolkitStandardLibrary.Blocks: MatrixGain, Add, StateSpace, Integrator
using LinearAlgebra

@named int = Integrator(k=1.0I(2),x = [0.0, 0.0])
@named p = StateSpace(A = -1.0I(2), B=1.0I(2), C=1.0I(2), D = zeros(2,2))
@named Kfb = MatrixGain(K=zeros(2,4))
@named add1 = Add()

connections = [
    [Kfb.input.u[i] ~ p.x[i] for i in 1:2]
    [Kfb.input.u[i+2] ~ int.y[i] for i in 1:2]
    [p.u[i] ~ Kfb.output.u[i] for i in 1:2]
    [int.u[i] ~ 1-p.y[i] for i in 1:2]
]

But i get an error: ERROR: TypeError: in keyword argument x, expected Union{Nothing, Real}, got a value of type Vector{Float64}
Can somebody help me out?
Thank you!

The integrator block does not accept vectors, your options are

  • Use multiple integrator blocks
  • Use an integrating statespace system where the A matrix is all zeros and the B and C matrices are identity. This effectively creates a MIMO integrator.

Thank you, @baggepinnen !