Modeling Toolkit: Vector equations and register symbolic interaction

Hi,

I am trying to build a model within modeling toolkit where it is built on a grid, therefore defining variables as vectors, but inside the equations is an integral over the whole vector and it doesn’t seem to be working as there is an internal error stating that the equations are zero for some reason. Below is an MWE of a simple model that hits all the same notes with the use of integrals over splines etc. The real integrals are not analytical so have to be performed this way.

using ModelingToolkit,DifferentialEquations,Integrals,Dierckx
using ModelingToolkit: t_nounits as t, D_nounits as D

function test_equation(;name)
    @variables a(t)[1:100] b(t)[1:100]
    @parameters grid[1:100] 
    
    eqs = [D(a) ~ (6*a .+ b)./a_integral(a,grid),
           b ~ (grid*t).^2]
    
    ODESystem(eqs,t;name)
end

function a_integral(a,grid)
    A=Spline1D(grid,a,bc="nearest")
    int(u,p) = A(u)
    prob=IntegralProblem(int,(grid[1],grid[end]))
    sol = solve(prob,HCubatureJL(),reltol=1e-3,abstol=1e-3)
    return sol.u
end
@register_symbolic a_integral(a::AbstractVector,grid::AbstractVector)::Real

@named test_ODE = test_equation()
test_eq = structural_simplify(test_ODE)
xaxis = range(1,100,step=1)
u0=[test_ODE.a=>ones(length(xaxis)),test_ODE.b=>zeros(length(xaxis))]
p=[test_ODE.grid=>xaxis]
tspan=(0,10)
prob=ODEProblem(test_eq,u0,p)
sol=solve(prob,Tsit5();abstol=1e-3,reltol=1e-3)

Any help is appreciated