-
Notifications
You must be signed in to change notification settings - Fork 122
/
write_esr_prices.jl
21 lines (19 loc) · 1.01 KB
/
write_esr_prices.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function write_esr_prices(path::AbstractString, inputs::Dict, setup::Dict, EP::Model)
dfESR = DataFrame(ESR_Price = convert(Array{Float64}, dual.(EP[:cESRShare])))
if setup["ParameterScale"] == 1
dfESR[!, :ESR_Price] = dfESR[!, :ESR_Price] * ModelScalingFactor # Converting MillionUS$/GWh to US$/MWh
end
if haskey(inputs, "dfESR_slack")
dfESR[!, :ESR_AnnualSlack] = convert(Array{Float64}, value.(EP[:vESR_slack]))
dfESR[!, :ESR_AnnualPenalty] = convert(Array{Float64}, value.(EP[:eCESRSlack]))
if setup["ParameterScale"] == 1
dfESR[!, :ESR_AnnualSlack] *= ModelScalingFactor # Converting GWh to MWh
dfESR[!, :ESR_AnnualPenalty] *= (ModelScalingFactor^2) # Converting MillionUSD to USD
end
end
write_output_file(joinpath(path, setup["WriteResultsNamesDict"]["esr_prices_and_penalties"]),
dfESR,
filetype = setup["ResultsFileType"],
compression = setup["ResultsCompressionType"])
return dfESR
end