I am running a script where I’m calculating some values using ModelingToolkit with some code that I’ve developed. I register my functions using the @register_symbolic macro, and these functions work on their own through regular use and test. But when I run the following line to create an equation for ModelingToolkit, I get this error:
julia> eqs = [stream_enthalpy(stream1; T=Tval) - stream_enthalpy(stream1) ~ stream_delta_heat_capacity(stream1, Tval)]
ERROR: MethodError: no method matching kronrod(::Type{Num}, ::Int64)
The function kronrod
exists, but no method is defined for this combination of argument types.
Closest candidates are:
kronrod(::Any, ::Integer, ::Real, ::Real; rtol, quad)
@ QuadGK ~/.julia/packages/QuadGK/7rND3/src/weightedgauss.jl:90
kronrod(::Type{T}, ::Integer) where T<:AbstractFloat
@ QuadGK ~/.julia/packages/QuadGK/7rND3/src/gausskronrod.jl:337
kronrod(::AbstractMatrix{<:Real}, ::Integer, ::Real, ::Pair{<:Tuple{Real, Real}, <:Tuple{Real, Real}})
@ QuadGK ~/.julia/packages/QuadGK/7rND3/src/gausskronrod.jl:411
…
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/QuadGK/7rND3/src/gausskronrod.jl:618 [inlined]
[2] _cachedrule(::Type{Num}, n::Int64)
@ QuadGK ~/.julia/packages/QuadGK/7rND3/src/gausskronrod.jl:618
[3] cachedrule(::Type{Num}, n::Int64)
@ QuadGK ~/.julia/packages/QuadGK/7rND3/src/gausskronrod.jl:626
[4] do_quadgk(f::ProcessCalc.var"#39#43"{…}, s::Tuple{…}, n::Int64, atol::Nothing, rtol::Nothing, maxevals::Int64, nrm::typeof(LinearAlgebra.norm), _segbuf::Nothing, eval_segbuf::Nothing)
@ QuadGK ~/.julia/packages/QuadGK/7rND3/src/adapt.jl:19
[5] #50
@ ~/.julia/packages/QuadGK/7rND3/src/api.jl:83 [inlined]
[6] handle_infinities
@ ~/.julia/packages/QuadGK/7rND3/src/adapt.jl:189 [inlined]
[7] quadgk#49
@ ~/.julia/packages/QuadGK/7rND3/src/api.jl:82 [inlined]
[8] quadgk
@ ~/.julia/packages/QuadGK/7rND3/src/api.jl:80 [inlined]
[9] quadgk
@ ~/.julia/packages/QuadGK/7rND3/src/api.jl:77 [inlined]
[10] stream_delta_heat_capacity(stream::FlowStream{RK{…}, Nothing}, outlet_temperature::Num)
@ ProcessCalc ~/.julia/dev/ProcessCalc/src/base/streams.jl:359
[11] top-level scope
@ REPL[23]:1
Some type information was truncated. Use show(err)
to see complete types.
Does anyone have any ideas? It doesn’t seem like the error is coming from my code.