Closed jonathanfischer97 closed 1 day ago
This seems to actually be a Symbolics.jl bug. These 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
as does
julia> @parameters begin
u(t)=1, [input=true]
end
ERROR: syntax: misplaced assignment statement in "[input = true]" around REPL[61]:1
Stacktrace:
[1] top-level scope
@ REPL[61]:1
This requires someone to update _parse_vars
in Symbolics.jl I think. See https://github.com/JuliaSymbolics/Symbolics.jl/issues/1280
@jonathanfischer97 these seem fixed if you use ModelingToolkit master now. Can you double check on your end?
This now works for me using the latest Catalyst, MTK, and Symbolics releases, so I am going to close this. Feel free to reopen if that is not the case for you.
Thank you guys!
Can't assign default value AND include species metadata within
@species
begin
blockTrying to define this reaction network, where
begin ... end
block syntaxE(t)
is given a default value as well as metadata (description, tunable)will generate the following error:
Combination of
begin
block, default species assignment, and extra metadata produce the errorIt seems this is a problem with how the DSL is parsing the new
begin
block syntax.Using this syntax and giving a default value, OR metadata, doesn't seem to produce an error. Only the combination of these two specie specifications within a
begin
block produces the error.Additionally, it only affects the
@species
block, not@parameters
species
, and uses both for the@parameters
, doesn't error.Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()