You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you add a complex equation in the @equations block you get a ERROR: MethodError: Cannot convert an object of type Vector{Equation} to an object of type Equation exception. Probably because the complex equation returns as a Vector{Equation} and the macro can't handle it.
Expected behavior
No error
Minimal Reproducible Example 👇
using Pkg
pkg"activate --temp"pkg"add ModelingToolkit"using ModelingToolkit
@mtkmodel ComplexModel begin@variablesbeginx(t)
y(t)
z(t)::Complexend@equationsbegin
z ~ x + im*y
endend@named mixed =ComplexModel()
@variables t x(t) y(t) z(t)::Complex
z ~ x + im*y # returns vector of equations rather than equation
Error & Stacktrace ⚠️
julia>@named mixed =ComplexModel()
ERROR: MethodError: Cannot `convert` an object of type Vector{Equation} to an object of type Equation
The function`convert` exists, but no method is defined for this combination of argument types.
Closest candidates are:Equation(::Any, ::Any)
@ Symbolics ~/.julia/packages/Symbolics/f5Y9e/src/equations.jl:115convert(::Type{T}, ::T) where T
@ Base Base.jl:126
Stacktrace:
[1] push!
@ ./array.jl:1244
[2] __ComplexModel__(; name::Symbol, x::Nothing, y::Nothing, z::Nothing)
@ Main ~/.julia/packages/ModelingToolkit/3AmNp/src/systems/model_parsing.jl:620
[3] (::ModelingToolkit.Model{typeof(__ComplexModel__), Dict{Symbol, Any}})(; kw::@Kwargs{name::Symbol})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/3AmNp/src/systems/model_parsing.jl:25
[4] top-level scope
@ ~/.julia/packages/ModelingToolkit/3AmNp/src/systems/abstractsystem.jl:1683
[5] top-level scope
@ none:1
Environment (please complete the following information):
Output of using Pkg; Pkg.status()
julia> Pkg.status()
Status `/tmp/jl_7mhDTa/Project.toml`
[961ee093] ModelingToolkit v9.26.0
Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Describe the bug 🐞
If you add a complex equation in the
@equations
block you get aERROR: MethodError: Cannot convert an object of type Vector{Equation} to an object of type Equation
exception. Probably because the complex equation returns as aVector{Equation}
and the macro can't handle it.Expected behavior
No error
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: