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
# The total number of steps to end the simulation
sol.totalSteps
498# The number of simultaneous steps during the simulation
sol.simulStepCount
132# The total number of events during the simulation
sol.evCount
53# The actual data is stored in two vectors:
sol.savedTimes
sol.savedVars
It should be matching the interface, i.e. sol(0.0005, idxs = 2)
Those would be designed to be in the sol.stats
Noted. I will add these.
Is there a reason why this isn't able to take a standard ODEProblem?
At a time step, the QSS method does not update all variables (it needs to decide which variables to update). So, it uses some dependency matrices (Vector{Vector{Int}} in code) and a personalized function that holds the differential equations and events in a special format**. These datastructures are stored in a NLODEProblem{PRTYPE,T,Z,D,CS} wich is different from a standard ODEProblem. However, we can have it as a subtype then make the solve function dispatch on the QSS algorithm and NLODEProblem.
** The QSS solver uses variables of type "Taylor" from the TaylorSeries.jl for approximation to make calculation easier and cheaper. But all operations from the TaylorSeries.jl allocate, so I redid internally this package with added cache to every operation. To exploit this, I had to change the AST of the differential equations upfront to obtain the personalized function.
Example:
du[1] = t
for k in 2:5
du[k]=discrete[1]*(u[k]-u[k-1]) ;
end
if t-5.0>0.0
discrete[1]=0.0
end
Becomes
RuntimeGeneratedFunction{(:i, :zc, :ev, :q, :d, :t, :cache)
if i == 1
createT(t, cache[1])
elseif 2 <= i <= 5
mulT(d[1], subT(q[i], q[i - 1], cache[2]), cache[1])
end
if zc == 1
subT(t, 5.0, cache[1])
end
if ev == 1
d[1] = 0.0
end
return nothing
Could the codegen to QSS be handled automatically in ModelingToolkit?
As mentioned above, QSS needs the datastructures stored in the NLODEProblem. So if ModelingToolkit can transform a set of differential equations with events (if-statements) to a NLODEProblem{PRTYPE,T,Z,D,CS} then YES.
@sergio-dorado No, there have been no attempts yet to integrate this package into SciML. So far, only bug fixes and new features have been introduced. Once the package is mature enough and free of major bugs, I could create a wrapper to enable integration with SciML
Activity
ChrisRackauckas commentedon Jul 11, 2024
Those would be designed to be in the sol.stats
ChrisRackauckas commentedon Jul 11, 2024
Is there a reason why this isn't able to take a standard ODEProblem? Could the codegen to QSS be handled automatically in ModelingToolkit?
mongibellili commentedon Jul 11, 2024
Noted. I will add these.
At a time step, the QSS method does not update all variables (it needs to decide which variables to update). So, it uses some dependency matrices (Vector{Vector{Int}} in code) and a personalized function that holds the differential equations and events in a special format**. These datastructures are stored in a NLODEProblem{PRTYPE,T,Z,D,CS} wich is different from a standard ODEProblem. However, we can have it as a subtype then make the solve function dispatch on the QSS algorithm and NLODEProblem.
** The QSS solver uses variables of type "Taylor" from the TaylorSeries.jl for approximation to make calculation easier and cheaper. But all operations from the TaylorSeries.jl allocate, so I redid internally this package with added cache to every operation. To exploit this, I had to change the AST of the differential equations upfront to obtain the personalized function.
Example:
Becomes
As mentioned above, QSS needs the datastructures stored in the NLODEProblem. So if ModelingToolkit can transform a set of differential equations with events (if-statements) to a NLODEProblem{PRTYPE,T,Z,D,CS} then YES.
mongibellili commentedon Dec 10, 2024
an attempt to match the sciml interface is made in version 1.0.2
sergio-dorado commentedon Mar 9, 2026
Hi. Thanks for your great work and valuable contribution.
Just out of curiosity, has there been any update on this with the latest releases?
mongibellili commentedon Mar 11, 2026
@sergio-dorado No, there have been no attempts yet to integrate this package into SciML. So far, only bug fixes and new features have been introduced. Once the package is mature enough and free of major bugs, I could create a wrapper to enable integration with SciML