Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork234
fix: array parameters in nested @mtkmodel components#3944
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
github-actionsbot commentedSep 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Benchmark Results (Julia vlts)Time benchmarks
Memory benchmarks
|
github-actionsbot commentedSep 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
| for varin expr_vars | ||
| var_unwrapped=unwrap(var) | ||
| # If any variable in the expression is from parent scope, don't namespace | ||
| ifisparameter(var_unwrapped)&&!(var_unwrappedin sys_params|| var_unwrappedin sys_unknowns) |
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.
[JuliaFormatter]reported byreviewdog 🐶
| ifisparameter(var_unwrapped)&&!(var_unwrappedin sys_params|| var_unwrappedin sys_unknowns) | |
| ifisparameter(var_unwrapped)&& | |
| !(var_unwrappedin sys_params|| var_unwrappedin sys_unknowns) |
| Dict((isparameter(k)?parameters(sys, k):unknowns(sys, k))=> | ||
| (should_namespace(v)?namespace_expr(v, sys): v) |
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.
[JuliaFormatter]reported byreviewdog 🐶
| Dict((isparameter(k)?parameters(sys, k):unknowns(sys, k))=> | |
| (should_namespace(v)?namespace_expr(v, sys): v) | |
| Dict((isparameter(k)?parameters(sys, k) : | |
| unknowns(sys, k))=>(should_namespace(v)?namespace_expr(v, sys): v) |
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.
Tests fail
I don't think I have sufficient insight into the internals to make everything pass. This was enough to allow me to move forward on a time critical problem, so I'll probably leave it here for now |
Makes sense, I'll try and take a look when I can. |
Here's another test case that fails both on latest release and this PR branch, wrong number of defaults generated using ModelingToolkitusing ModelingToolkit: t_nounits as t, D_nounits as D@mtkmodel inner2begin@parametersbegin a[1:2]= aend@variablesbeginx(t)[1:2]=zeros(2)end@equationsbeginD(x)~ aendend@mtkmodel outer2begin@parametersbegin a1=1 a2=1end@componentsbegin i=inner2(a=[a1,a2])end@variablesbeginy(t)[1:2]=zeros(2)dy(t)[1:2]end@equationsbeginD(y)~ dy dy~ [a1, a2]endend@named o=outer2()o=complete(o)ssys=mtkcompile(o)varmap= []prob=ODEProblem(ssys, varmap, (0,1)) This looks fishy julia> MTK=ModelingToolkit;filter(kvp->!MTK.isinitial(kvp[1])&&!MTK.isparameter(kvp[1]),defaults(ssys))Dict{Any, Any} with6 entries: (i₊x(t))[2]=>0.0 (i₊x(t))[1]=>0.0 (y(t))[2]=>0.0 (y(t))[1]=>0.0 (dy(t))[2]=>NoValue() (dy(t))[1]=>NoValue() |
Uh oh!
There was an error while loading.Please reload this page.
attempt toclose#2813
This only handles defaults that are a single Num, liker=r_def, it does not yet handler_defbeing an expression with multiple variables