JuliaSimCompiler + symbolic arrays?

Hello!

Is JuliaSimCompiler currently meant to work with arrays? I would like to create a symbolic model that does the same thing a bunch of different times (eventually with different data inputs). I am aware of EnsembleProblems etc., but let’s assume those options won’t work in this case. Here the the problem:

using ModelingToolkit, OrdinaryDiffEq, DomainSets
using BenchmarkTools
using JuliaSimCompiler
using Plots

N = 5
@parameters x[1:N] = ones(N)
@parameters t
@variables C(t)[1:N] = ones(N)
Dt = Differential(t)

eq = Dt(C[1]) ~ C[1]

eqs = [substitute(eq, Dict(x[1] => x[i], C[1] => C[i])) for i in 1:N]

@named sys = ODESystem(eqs, t, [C], collect(x), tspan=(0.0, 1.0))


# Try the normal way to show that it works:
prob = ODEProblem(structural_simplify(sys), [], (0, 1.0))
sol = solve(prob)
plot(sol)

The code above works fine, however the compile time will presumably scale quadraticly with the number of equations, which my understanding is a problem JuliaSimCompiler is meant to fix:

# Try with JuliaSimCompiler
isys = IRSystem(sys)

iisys = structural_simplify(isys)

ODEProblem(iisys, [], (0, 1.0))

The above code, however, gives the error ArgumentError: Collection has multiple elements, must contain exactly 1 element.

So my question is, is this something that should work but I’m maybe doing it wrong, or this type of workflow not supported yet? Thanks for any help!

Array variable support is still somewhat experimental. I have just fixed JuliaSimCompiler on this example. Hopefully, you can get the new release in a couple hours.

That works, thanks!