-
-
Couldn't load subscription status.
- Fork 233
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
It is not possible to use and operation over Boolean Inputs . The basic And Block was not functioning well and throwing error.
Expected behavior
I should be able to use the and operation and het correct result
Minimal Reproducible Example π
@component function And_base(; name)
### Symbolic Parameters
__params = Any[]
### Variables
__vars = Any[]
append!(__vars, @variables u1(t)::Bool, [input = true])
append!(__vars, @variables y(t)::Bool, [output = true])
append!(__vars, @variables u2(t)::Bool, [input = true])
### Constants
__constants = Any[]
### Components
__systems = ODESystem[]
### Defaults
__defaults = Dict()
### Initialization Equations
__initialization_eqs = []
### Equations
__eqs = Equation[]
push!(__eqs, y ~ (u1) & (u2))
# Return completely constructed ODESystem
return ODESystem(__eqs, t, __vars, __params; systems=__systems, defaults=__defaults, name, initialization_eqs=__initialization_eqs)
end
and the Test Case
@component function Test_And_Base(; name)
### Symbolic Parameters
__params = Any[]
### Variables
__vars = Any[]
### Constants
__constants = Any[]
### Components
__systems = ODESystem[]
push!(__systems, @named and_base = And_base())
### Defaults
__defaults = Dict()
### Initialization Equations
__initialization_eqs = []
### Equations
__eqs = Equation[]
push!(__eqs, and_base.u1 ~ true)
push!(__eqs, and_base.u2 ~ true)
# Return completely constructed ODESystem
return ODESystem(__eqs, t, __vars, __params; systems=__systems, defaults=__defaults, name, initialization_eqs=__initialization_eqs)
end
Error & Stacktrace
ERROR: MethodError: no method matching &(::Float64, ::Float64)
The function `&` exists, but no method is defined for this combination of argument types.
Closest candidates are:
&(::Any, ::Any, ::Any, ::Any...)
@ Base operators.jl:596
&(::DomainSets.AnyDomain, ::Any)
@ DomainSets deprecated.jl:103
&(::Any, ::DomainSets.AnyDomain)
@ DomainSets deprecated.jl:103
...
Stacktrace:
[1] macro expansion
@ C:\Users\ahhar\.julia\packages\SymbolicUtils\0GKgW\src\code.jl:411 [inlined]
[2] macro expansion
@ C:\Users\ahhar\.julia\packages\Symbolics\JCopU\src\build_function.jl:366 [inlined]
[3] macro expansion
@ C:\Users\ahhar\.julia\packages\RuntimeGeneratedFunctions\RrXEW\src\RuntimeGeneratedFunctions.jl:161 [inlined]
[4] macro expansion
@ .\none:0 [inlined]
[5] generated_callfunc
@ .\none:0 [inlined]
[6] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{β¦})(::Nothing, ::MTKParameters{β¦})
@ RuntimeGeneratedFunctions C:\Users\ahhar\.julia\packages\RuntimeGeneratedFunctions\RrXEW\src\RuntimeGeneratedFunctions.jl:148
[7] macro expansion
@ C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\codegen_utils.jl:0 [inlined]
[8] _generated_call(::ModelingToolkit.GeneratedFunctionWrapper{β¦}, ::Nothing, ::MTKParameters{β¦})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\codegen_utils.jl:262
[9] (::ModelingToolkit.GeneratedFunctionWrapper{β¦})(::Nothing, ::Vararg{β¦})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\codegen_utils.jl:259
[10] (::ModelingToolkit.ObservedWrapper{β¦})(prob::NonlinearProblem{β¦})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\problem_utils.jl:640
[11] call_composed(fs::Tuple{ModelingToolkit.ObservedWrapper{β¦}}, x::Tuple{NonlinearProblem{β¦}}, kw::@Kwargs{})
@ Base .\operators.jl:1054
[12] call_composed
@ .\operators.jl:1053 [inlined]
[13] (::ComposedFunction{β¦})(x::NonlinearProblem{β¦}; kw::@Kwargs{})
@ Base .\operators.jl:1050
[14] (::ModelingToolkit.var"#_getter#802"{β¦})(valp::NonlinearProblem{β¦}, initprob::ODEProblem{β¦})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\problem_utils.jl:782
[15] (::ModelingToolkit.var"#initprobpmap_split#806"{β¦})(prob::ODEProblem{β¦}, initsol::NonlinearProblem{β¦})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\problem_utils.jl:879
[16] get_initial_values(prob::ODEProblem{β¦}, valp::ODEProblem{β¦}, f::Function, alg::SciMLBase.OverrideInit{β¦}, iip::Val{β¦}; nlsolve_alg::Nothing, abstol::Nothing, reltol::Nothing, kwargs::@Kwargs{})
@ SciMLBase C:\Users\ahhar\.julia\packages\SciMLBase\Ha7rZ\src\initialization.jl:301
[17] get_initial_values(prob::ODEProblem{β¦}, valp::ODEProblem{β¦}, f::Function, alg::SciMLBase.OverrideInit{β¦}, iip::Val{β¦})
@ SciMLBase C:\Users\ahhar\.julia\packages\SciMLBase\Ha7rZ\src\initialization.jl:242
[18] maybe_eager_initialize_problem(prob::ODEProblem{β¦}, initialization_data::SciMLBase.OverrideInitData{β¦}, lazy_initialization::Nothing)
@ SciMLBase C:\Users\ahhar\.julia\packages\SciMLBase\Ha7rZ\src\remake.jl:1211
[19] remake(prob::ODEProblem{β¦}; f::Missing, u0::Missing, tspan::Missing, p::Missing, kwargs::Missing, interpret_symbolicmap::Bool, build_initializeprob::Type, use_defaults::Bool, lazy_initialization::Nothing, _kwargs::@Kwargs{})
@ SciMLBase C:\Users\ahhar\.julia\packages\SciMLBase\Ha7rZ\src\remake.jl:266
[20] remake(prob::ODEProblem{β¦})
@ SciMLBase C:\Users\ahhar\.julia\packages\SciMLBase\Ha7rZ\src\remake.jl:214
[21] (ODEProblem{β¦})(sys::ODESystem, u0map::Vector{β¦}, tspan::Tuple{β¦}, parammap::SciMLBase.NullParameters; allow_cost::Bool, callback::Nothing, check_length::Bool, warn_initialize_determined::Bool, eval_expression::Bool, eval_module::Module, kwargs::@Kwargs{})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:825
[22] ODEProblem
@ C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:781 [inlined]
[23] (ODEProblem{true, SciMLBase.AutoSpecialize})(sys::ODESystem, u0map::Vector{Any}, tspan::Tuple{Int64, Int64})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:781
[24] (ODEProblem{true})(::ODESystem, ::Vector{Any}, ::Vararg{Any}; kwargs::@Kwargs{})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:774
[25] (ODEProblem{true})(::ODESystem, ::Vector{Any}, ::Vararg{Any})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:773
[26] ODEProblem(::ODESystem, ::Vector{Any}, ::Vararg{Any}; kwargs::@Kwargs{})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:763
[27] ODEProblem(::ODESystem, ::Vector{Any}, ::Vararg{Any})
@ ModelingToolkit C:\Users\ahhar\.julia\packages\ModelingToolkit\Z9mEq\src\systems\diffeqs\abstractodesystem.jl:762
[28] top-level scope
@ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.
- Output of
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
[1ef5d832] BlockComponents v2.4.4
[7bc808db] DyadEcosystemDependencies v0.9.4
β
[99806f68] DyadInterface v4.3.4
β
[961ee093] ModelingToolkit v9.80.5
β
[50262376] OrdinaryDiffEqDefault v1.4.0
β
[aea7be01] PrecompileTools v1.2.1
β [7e49a35a] RuntimeGeneratedFunctions v0.5.14
[d6f4376e] Markdown v1.11.0
- Output of
versioninfo()
Julia Version 1.11.3
Commit d63adeda50 (2025-01-21 19:42 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 14 Γ Intel(R) Core(TM) Ultra 7 155U
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 14 virtual cores)
Environment:
JULIA_EDITOR = code
JULIA_VSCODE_REPL = 1
JULIA_PKG_SERVER = https://juliahub.com
Additional context
From what I understood this could be because of the having discrete variables in a continuous system, then itβs not a pure ODE/DAE anymore and we need a synchronous backend to handle the discrete variables. The fix is the synchronous systems work that has been ongoing .
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working