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

post processing functions return Vector{Float64} #368

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/base/simulation_results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ function _post_proc_state_series(solution, ix::Int, dt::Nothing)
end

function _post_proc_state_series(solution, ix::Int, dt::Float64)
ts = range(0; stop = solution.t[end], step = dt)
ts = collect(range(0; stop = solution.t[end], step = dt))
m-bossart marked this conversation as resolved.
Show resolved Hide resolved
state = solution(collect(ts); idxs = ix)
return ts, state
return ts, state.u
end

function _post_proc_state_series(solution, ix::Int, dt::Vector{Float64})
state = solution(dt; idxs = ix)
return dt, state
return dt, state.u
end

"""
Expand Down
4 changes: 4 additions & 0 deletions test/test_base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,14 @@ end
series = get_state_series(results, ("generator-102-1", :δ); dt = 0.01)
t = series[1]
δ = series[2]
@test typeof(t) == Vector{Float64}
@test typeof(δ) == Vector{Float64}
@test t[2] - t[1] == 0.01
series = get_state_series(results, ("generator-102-1", :δ); dt = [0.02, 0.05])
t = series[1]
δ = series[2]
@test typeof(t) == Vector{Float64}
@test typeof(δ) == Vector{Float64}
@test t[1] == 0.02
finally
@info("removing test files")
Expand Down
Loading