Skip to content
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

begin blocks in @variables macro not working consistently #1280

Closed
isaacsas opened this issue Sep 19, 2024 · 1 comment
Closed

begin blocks in @variables macro not working consistently #1280

isaacsas opened this issue Sep 19, 2024 · 1 comment

Comments

@isaacsas
Copy link
Contributor

It seems like _parse_vars isn't working quite right when combining metadata, functional symbolics (i.e. u(t)), and initial values. These all work

using ModelingToolkit
t = ModelingToolkit.t_nounits
@variables u(t)=1 [input = true, disturbance = true]
@variables begin
    u(t) = 1 
end
@parameters  begin
    a = 1
end
@parameters  begin
           a = 1, [input = true, description = "true"]
end

but this errors

julia> @variables begin
           u(t) = 1, [input = true]
       end
ERROR: syntax: misplaced assignment statement in "[input = true]" around REPL[37]:1
Stacktrace:
 [1] top-level scope
   @ REPL[37]:1

and this errors

julia> @parameters begin
                  u(t) = 1, [input = true]
              end
ERROR: syntax: misplaced assignment statement in "[input = true]" around REPL[52]:1
Stacktrace:
 [1] top-level scope
   @ REPL[52]:1
@isaacsas
Copy link
Contributor Author

isaacsas commented Sep 30, 2024

This seems fixed on the latest Symbolics / MTK versions so I will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant