Skip to content

in v10.2.0 @constants errors "ArgumentError: c is present in the system but c is not an unknown." #3712

@RobbesU

Description

@RobbesU

Describe the bug 🐞

The use of @constants in System under 10.2 throws mtkcompile error. Setting the same value as a parameter works as expected. @constants works fine under v9.80.5.

Minimal Reproducible Example 👇

@component function TestSys(;name, a=1.0)
	pars = @parameters a=a # c=π  # <--- setting c as param works as expected
	vars = @variables x(t) 
	
	@constants c = π   # having c as constant no longer works (did under 9v9.80.5 and below)
	
	eqs = [D(x) ~ a*x + c]		  ]
	return ODESystem(eqs,t,vars,pars; name)
end

@named sys0 = TestSys()

sys = mtkcompile(sys0)

(## edited to remove the unnecessary stack & environment details)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions