ModelingToolkit.jl icon indicating copy to clipboard operation
ModelingToolkit.jl copied to clipboard

Array parameters/variables with `@mtkmodel`

Open ThiagoReschutzegger opened this issue 2 years ago • 1 comments

With @mtkmodel, array parameters and variables doesn't seem to work

This works:

@mtkmodel AnyModel begin
    @parameters begin
        k₁
        k₂
    end
    @variables begin
        A(t)
    end
    @equations begin
        ∂(A) ~ -k₁ * A + k₂
    end
end

This doesn't:

@mtkmodel AnyModel begin
    @parameters begin
        k[1:2]
    end
    @variables begin
        A(t)
    end
    @equations begin
        ∂(A) ~ -k[1] * A + k[2]
    end
end

Any idea why this is the case?

ThiagoReschutzegger avatar Sep 18 '23 00:09 ThiagoReschutzegger

We haven't added array support yet, but we will.

YingboMa avatar Sep 18 '23 17:09 YingboMa

This got added IIUC, @ven-k correct me if I'm wrong.

ChrisRackauckas avatar Feb 22 '24 13:02 ChrisRackauckas

Yes. This is already added; except that array length can't be specified. But that is tracked by

  • https://github.com/SciML/ModelingToolkit.jl/issues/2453

ven-k avatar Feb 22 '24 13:02 ven-k