Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
mmutic and github-actions[bot] authored Jun 4, 2024
1 parent 27603f6 commit 9406c39
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
7 changes: 2 additions & 5 deletions src/time_domain_reduction/full_time_series_reconstruction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,14 @@ function full_time_series_reconstruction(
reconDF = DataFrame(recon, DFnames, makeunique = true)

#rename!(reconDF,names1)

# Insert rows that were above "t1" in the original DataFrame (e.g. "Zone" and "AnnualSum") if present
for i in range(1,t1-1)
insert!(reconDF,i,DFMatrix[i,1:end],promote=true)
end

# Repeat the last rows of the year to fill in the gap (should be 24 hours for non-leap year)
end_diff = WeightTotal - nrow(reconDF) + 1
new_rows = reconDF[(nrow(reconDF)-end_diff):nrow(reconDF),1:end]
new_rows[!,1] = ["t$t" for t in (WeightTotal-end_diff):WeightTotal]
new_rows = reconDF[(nrow(reconDF) - end_diff):nrow(reconDF), 1:end]
new_rows[!, 1] = ["t$t" for t in (WeightTotal - end_diff):WeightTotal]
reconDF = [reconDF; new_rows]

return reconDF
end
9 changes: 5 additions & 4 deletions src/write_outputs/transmission/write_transmission_flows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ function write_transmission_flows(path::AbstractString,
CSV.write(filepath, dftranspose(dfFlow, false), writeheader = false)

if setup["OutputFullTimeSeries"] == 1 & setup["TimeDomainReduction"] == 1
DFnames = ["Line","1","2"]
DFnames = ["Line", "1", "2"]
FullTimeSeriesFolder = setup["OutputFullTimeSeriesFolder"]
output_path = joinpath(path,FullTimeSeriesFolder)
dfOut_full = full_time_series_reconstruction(path,setup, dftranspose(dfFlow, false), DFnames)
CSV.write(joinpath(output_path,"flow.csv"), dfOut_full, header = false)
output_path = joinpath(path, FullTimeSeriesFolder)
dfOut_full = full_time_series_reconstruction(
path, setup, dftranspose(dfFlow, false), DFnames)
CSV.write(joinpath(output_path, "flow.csv"), dfOut_full, header = false)
println("Writing Full Time Series for Transmission Flows")
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function write_transmission_losses(path::AbstractString,
CSV.write(joinpath(output_path,"tlosses.csv"), dfOut_full, header = false)
println("Writing Full Time Series for Time Losses")
end

end
return nothing
end
10 changes: 5 additions & 5 deletions src/write_outputs/ucommit/write_commit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ function write_commit(path::AbstractString, inputs::Dict, setup::Dict, EP::Model
println("PATH = ", path)
println("-------------------------------")


if setup["OutputFullTimeSeries"] == 1 & setup["TimeDomainReduction"] == 1
DFMatrix = Matrix(dftranspose(dfCommit, true))
DFnames = DFMatrix[1,:]
DFnames = DFMatrix[1, :]
FullTimeSeriesFolder = setup["OutputFullTimeSeriesFolder"]
output_path = joinpath(path,FullTimeSeriesFolder)
dfOut_full = full_time_series_reconstruction(path,setup, dftranspose(dfCommit, false), DFnames)
CSV.write(joinpath(output_path,"commit.csv"), dfOut_full, header = false)
output_path = joinpath(path, FullTimeSeriesFolder)
dfOut_full = full_time_series_reconstruction(
path, setup, dftranspose(dfCommit, false), DFnames)
CSV.write(joinpath(output_path, "commit.csv"), dfOut_full, header = false)
println("Writing Full Time Series for Commitment")
end

Expand Down

0 comments on commit 9406c39

Please sign in to comment.