Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Tuple for parameters instead of Array #188

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/FMI2/sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ end
function fx(c::FMU2Component,
dx::AbstractArray{<:Real},
x::AbstractArray{<:Real},
p::AbstractArray,
p::Tuple,
t::Real)

c.solution.evals_fx_inplace += 1
Expand All @@ -253,7 +253,7 @@ end

function fx(c::FMU2Component,
x::AbstractArray{<:Real},
p::AbstractArray,
p::Tuple,
t::Real)

c.solution.evals_fx_outofplace += 1
Expand All @@ -275,7 +275,7 @@ function fmi2SimulateME(c::FMU2Component, tspan::Union{Tuple{Float64, Float64},
end

# sets up the ODEProblem for simulating a ME-FMU
function setupODEProblem(c::FMU2Component, x0::AbstractArray{fmi2Real}, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; p=[], customFx=nothing)
function setupODEProblem(c::FMU2Component, x0::AbstractArray{fmi2Real}, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; p=(), customFx=nothing)

if c.fmu.executionConfig.inPlace
if customFx === nothing
Expand Down
6 changes: 3 additions & 3 deletions src/FMI3/sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ end
function fx(c::FMU3Instance,
dx::AbstractArray{<:Real},
x::AbstractArray{<:Real},
p::AbstractArray,
p::Tuple,
t::Real)

# if isa(t, ForwardDiff.Dual)
Expand Down Expand Up @@ -657,12 +657,12 @@ function fmi3SimulateME(c::FMU3Instance, t_start::Union{Real, Nothing} = nothing
end

# sets up the ODEProblem for simulating a ME-FMU
function setupODEProblem(c::FMU3Instance, x0::AbstractArray{fmi3Float64}, t_start::fmi3Float64, t_stop::fmi3Float64; p=[], customFx=nothing)
function setupODEProblem(c::FMU3Instance, x0::AbstractArray{fmi3Float64}, t_start::fmi3Float64, t_stop::fmi3Float64; p=(), customFx=nothing)
if customFx === nothing
customFx = (dx, x, p, t) -> fx(c, dx, x, p, t)
end

p = []
p = ()
c.problem = ODEProblem(customFx, x0, (t_start, t_stop), p,)

return c.problem
Expand Down
Loading