Skip to content

Commit

Permalink
Intermediateresults (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
jClugstor authored Sep 18, 2023
1 parent c2c95b7 commit 1d4c836
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SimulationService.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import JSON3
import JSONSchema
import LinearAlgebra: norm
import MathML
import ModelingToolkit: @parameters, substitute, Differential, Num, @variables, ODESystem, ODEProblem, ODESolution, structural_simplify, states, observed
import ModelingToolkit: @parameters, substitute, Differential, Num, @variables, ODESystem, ODEProblem, ODESolution, structural_simplify, states, observed, parameters
import OpenAPI
import Oxygen
import Pkg
Expand Down
8 changes: 6 additions & 2 deletions src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ end
function (o::IntermediateResults)(integrator)
if o.last_callback + o.every Dates.now()
o.last_callback = Dates.now()
(; iter, t, u, uprev) = integrator
publish_to_rabbitmq(; iter=iter, time=t, params=u, abserr=norm(u - uprev), id=o.id,
(; iter, f, t, u, p) = integrator

state_dict = Dict(states(f.sys) .=> u)
param_dict = Dict(parameters(f.sys) .=> p)

publish_to_rabbitmq(; iter=iter, time=t, state=state_dict, params = param_dict, id=o.id,
retcode=SciMLBase.check_error(integrator))
end
EasyModelAnalysis.DifferentialEquations.u_modified!(integrator, false)
Expand Down

0 comments on commit 1d4c836

Please sign in to comment.