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

Array of components

Open B-LIE opened this issue 10 months ago • 0 comments

Is there an example of how to use arrays of components in the documentation❓

image

From a presentation, I've seen the the syntax:

@components begin
    resistor[1:n] = Resistor()
end

I don't know if this is a standard notation or not. I've tried to use it, but have problems when I add equations where the instances have fields, such...

@equations begin
    resistor[1].R ~ 3 
end

would not work.

However,

@components begin
    resistor_1 = Resistor()
end
#
@equations begin
    resistor_1.R ~ 3
end

would work.

B-LIE avatar Apr 27 '24 14:04 B-LIE