-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for component array in @mtkmodel
#2368
Conversation
71ecbf4
to
3335751
Compare
test/model_parsing.jl
Outdated
module GetParentModule | ||
|
||
using ModelingToolkit | ||
|
||
@mtkmodel Component begin end | ||
|
||
end | ||
|
||
@testset "Parent module of Models" begin | ||
@test parentmodule(GetParentModule.Component) == GetParentModule | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: As of ce7eed0, we have a MyMockModule
module (with a component in it) defined, which could be used for this test.
ModelingToolkit.jl/test/model_parsing.jl
Lines 11 to 32 in ce7eed0
module MyMockModule | |
using ..ModelingToolkit, ..Unitful | |
export Pin | |
@connector Pin begin | |
v(t), [unit = u"V"] # Potential at the pin [V] | |
i(t), [connect = Flow, unit = u"A"] # Current flowing into the pin [A] | |
@icon "pin.png" | |
end | |
@mtkmodel Ground begin | |
@components begin | |
g = Pin() | |
end | |
@icon read(abspath(ENV["MTK_ICONS_DIR"], "ground.svg"), String) | |
@equations begin | |
g.v ~ 0 | |
end | |
end | |
end | |
using .MyMockModule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I noticed that PR got merged. Will be using that while rebasing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved: a4a79ce
3335751
to
46df8a4
Compare
46df8a4
to
7bc67ba
Compare
7bc67ba
to
a9991dd
Compare
@YingboMa I've rebased to post v9 main. |
Rebase? |
- for loop or a list comprehension can be used to declare component arrays
a9991dd
to
763f6df
Compare
763f6df
to
e324633
Compare
In addition to above mentioned details, new tests are added to check that conditionally component arrays can be defined: e324633. |
@ChrisRackauckas this PR is ready. Model Parsing test has passed: https://github.com/SciML/ModelingToolkit.jl/actions/runs/8136794559/job/22233824699?pr=2368#step:6:1309 Docs build successfully: https://github.com/SciML/ModelingToolkit.jl/actions/runs/8136794562/job/22233803317?pr=2368 |
Checklist
contributor guidelines, in particular the ScioML Style Guide and
COLPRAC.
Additional context
for
loop or a list comprehension can be used to declare component arraysBase.parentmodule
forModel