forked from GenXProject/GenX.jl
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flexible Output Writing (GenXProject#617)
This commit adds the option of deciding which files to write and which ones to skip. Also, among the time-series files, it gives users the option to choose between writing the hourly outputs versus annual values. It does so by adding a new settings parameter called "WriteOutputs" that can be set to annual or full and also introducing a new YAML file called output_settings.yml --------- Co-authored-by: Chakrabarti, Sambuddha (Sam) <[email protected]>
- Loading branch information
1 parent
744896c
commit 153d4f3
Showing
31 changed files
with
706 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Example_Systems/RealSystemExample/ISONE_Singlezone/Settings/output_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
WriteCosts: false | ||
WriteCapacity: false | ||
WriteCapacityValue: false | ||
WriteCapacityFactor: false | ||
WriteCharge: false | ||
WriteChargingCost: false | ||
WriteCO2: false | ||
WriteCO2Cap: false | ||
WriteCommit: false | ||
WriteCurtailment: false | ||
WriteEmissions: false | ||
WriteEnergyRevenue: false | ||
WriteESRPrices: false | ||
WriteESRRevenue: false | ||
WriteFuelConsumption: false | ||
WriteHourlyMatchingPrices: false | ||
WriteHydrogenPrices: false | ||
WriteMaintenance: false | ||
WriteMaxCapReq: false | ||
WriteMinCapReq: false | ||
WriteNetRevenue: false | ||
WriteNSE: false | ||
WriteNWExpansion: false | ||
WriteTransmissionFlows: false | ||
WriteTransmissionLosses: false | ||
WriteVirtualDischarge: false | ||
WriteVREStor: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
function write_reg(path::AbstractString, inputs::Dict, setup::Dict, EP::Model) | ||
gen = inputs["RESOURCES"] | ||
zones = zone_id.(gen) | ||
|
||
G = inputs["G"] # Number of resources (generators, storage, DR, and DERs) | ||
T = inputs["T"] # Number of time steps (hours) | ||
REG = inputs["REG"] | ||
scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1 | ||
|
||
resources = inputs["RESOURCE_NAMES"][REG] | ||
zones = inputs["R_ZONES"][REG] | ||
# Regulation contributions for each resource in each time step | ||
dfReg = DataFrame(Resource = inputs["RESOURCE_NAMES"], Zone = zones) | ||
reg = zeros(G,T) | ||
reg[REG, :] = value.(EP[:vREG][REG, :]) | ||
dfReg.AnnualSum = (reg*scale_factor) * inputs["omega"] | ||
dfReg = hcat(dfReg, DataFrame(reg*scale_factor, :auto)) | ||
auxNew_Names=[Symbol("Resource");Symbol("Zone");Symbol("AnnualSum");[Symbol("t$t") for t in 1:T]] | ||
rename!(dfReg,auxNew_Names) | ||
reg = value.(EP[:vREG][REG, :].data) * scale_factor | ||
|
||
dfReg = DataFrame(Resource = resources, Zone = zones) | ||
dfReg.AnnualSum = reg * inputs["omega"] | ||
|
||
total = DataFrame(["Total" 0 sum(dfReg.AnnualSum) fill(0.0, (1,T))], :auto) | ||
total[!, 4:T+3] .= sum(reg, dims = 1) | ||
rename!(total,auxNew_Names) | ||
dfReg = vcat(dfReg, total) | ||
CSV.write(joinpath(path, "reg.csv"), dftranspose(dfReg, false), header=false) | ||
filepath = joinpath(path, "reg.csv") | ||
if setup["WriteOutputs"] == "annual" | ||
write_annual(filepath, dfReg) | ||
else # setup["WriteOutputs"] == "full" | ||
write_fulltimeseries(filepath, reg, dfReg) | ||
end | ||
return nothing | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
function write_rsv(path::AbstractString, inputs::Dict, setup::Dict, EP::Model) | ||
gen = inputs["RESOURCES"] | ||
zones = zone_id.(gen) | ||
|
||
G = inputs["G"] # Number of resources (generators, storage, DR, and DERs) | ||
T = inputs["T"] # Number of time steps (hours) | ||
RSV = inputs["RSV"] | ||
scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1 | ||
dfRsv = DataFrame(Resource = inputs["RESOURCE_NAMES"], Zone = zones) | ||
rsv = zeros(G,T) | ||
unmet_vec = zeros(T) | ||
rsv[RSV, :] = value.(EP[:vRSV][RSV, :]) * scale_factor | ||
unmet_vec = value.(EP[:vUNMET_RSV]) * scale_factor | ||
total_unmet = sum(unmet_vec) | ||
|
||
resources = inputs["RESOURCE_NAMES"][RSV] | ||
zones = inputs["R_ZONES"][RSV] | ||
rsv = value.(EP[:vRSV][RSV, :].data) * scale_factor | ||
|
||
dfRsv = DataFrame(Resource = resources, Zone = zones) | ||
|
||
dfRsv.AnnualSum = rsv * inputs["omega"] | ||
dfRsv = hcat(dfRsv, DataFrame(rsv, :auto)) | ||
auxNew_Names=[Symbol("Resource");Symbol("Zone");Symbol("AnnualSum");[Symbol("t$t") for t in 1:T]] | ||
rename!(dfRsv,auxNew_Names) | ||
|
||
total = DataFrame(["Total" 0 sum(dfRsv.AnnualSum) zeros(1, T)], :auto) | ||
unmet = DataFrame(["unmet" 0 total_unmet zeros(1, T)], :auto) | ||
total[!, 4:T+3] .= sum(rsv, dims = 1) | ||
unmet[!, 4:T+3] .= transpose(unmet_vec) | ||
rename!(total,auxNew_Names) | ||
rename!(unmet,auxNew_Names) | ||
dfRsv = vcat(dfRsv, unmet, total) | ||
CSV.write(joinpath(path, "reg_dn.csv"), dftranspose(dfRsv, false), header=false) | ||
if setup["WriteOutputs"] == "annual" | ||
write_annual(joinpath(path, "reg_dn.csv"), dfRsv) | ||
else # setup["WriteOutputs"] == "full" | ||
unmet_vec = value.(EP[:vUNMET_RSV]) * scale_factor | ||
total_unmet = sum(unmet_vec) | ||
dfRsv = hcat(dfRsv, DataFrame(rsv, :auto)) | ||
auxNew_Names=[Symbol("Resource");Symbol("Zone");Symbol("AnnualSum");[Symbol("t$t") for t in 1:T]] | ||
rename!(dfRsv,auxNew_Names) | ||
|
||
total = DataFrame(["Total" 0 sum(dfRsv.AnnualSum) zeros(1, T)], :auto) | ||
unmet = DataFrame(["unmet" 0 total_unmet zeros(1, T)], :auto) | ||
total[!, 4:T+3] .= sum(rsv, dims = 1) | ||
unmet[!, 4:T+3] .= transpose(unmet_vec) | ||
rename!(total,auxNew_Names) | ||
rename!(unmet,auxNew_Names) | ||
dfRsv = vcat(dfRsv, unmet, total) | ||
CSV.write(joinpath(path, "reg_dn.csv"), dftranspose(dfRsv, false), writeheader=false) | ||
end | ||
end |
Oops, something went wrong.