Skip to content
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
2 changes: 1 addition & 1 deletion PRASCore.jl/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
"Srihari Sundar <Hari.Sundar@nrel.gov>",
"Julian Florez <Julian.Florez@nrel.gov"
]
version = "0.8.0"
version = "0.8.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
25 changes: 23 additions & 2 deletions PRASCore.jl/src/Results/Shortfall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,33 @@ EUE(x::ShortfallResult{N,L,T,E}, r::AbstractString, t::ZonedDateTime) where {N,L
EUE{1,L,T,E}(MeanEstimate(x[r, t]..., x.nsamples))

function NEUE(x::ShortfallResult)
return NEUE(div(MeanEstimate(x[]..., x.nsamples),(sum(x.regions.load)/1e6)))

demand = sum(x.regions.load)

estimate = if demand > 0
div(MeanEstimate(x[]..., x.nsamples), demand/1e6)
else
MeanEstimate(0.)
end

return NEUE(estimate)

end

function NEUE(x::ShortfallResult, r::AbstractString)

i_r = findfirstunique(x.regions.names, r)
return NEUE(div(MeanEstimate(x[r]..., x.nsamples),(sum(x.regions.load[i_r,:])/1e6)))

demand = sum(x.regions.load[i_r, :])

estimate = if demand > 0
div(MeanEstimate(x[r]..., x.nsamples), demand/1e6)
else
MeanEstimate(0.)
end

return NEUE(estimate)

end

function finalize(
Expand Down
29 changes: 25 additions & 4 deletions PRASCore.jl/src/Results/ShortfallSamples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,34 @@ EUE(x::ShortfallSamplesResult{N,L,T,P,E}, t::ZonedDateTime) where {N,L,T,P,E} =
EUE(x::ShortfallSamplesResult{N,L,T,P,E}, r::AbstractString, t::ZonedDateTime) where {N,L,T,P,E} =
EUE{1,L,T,E}(MeanEstimate(x[r, t]))

function NEUE(x::ShortfallSamplesResult{N,L,T,P,E}) where {N,L,T,P,E}
return NEUE(div(MeanEstimate(x[]),(sum(x.regions.load)/1e6)))
function NEUE(x::ShortfallSamplesResult)

demand = sum(x.regions.load)

estimate = if demand > 0
div(MeanEstimate(x[]), demand/1e6)
else
MeanEstimate(0.)
end

return NEUE(estimate)

end

function NEUE(x::ShortfallSamplesResult{N,L,T,P,E}, r::AbstractString) where {N,L,T,P,E}
function NEUE(x::ShortfallSamplesResult, r::AbstractString)

i_r = findfirstunique(x.regions.names, r)
return NEUE(div(MeanEstimate(x[r]),(sum(x.regions.load[i_r,:])/1e6)))

demand = sum(x.regions.load[i_r, :])

estimate = if demand > 0
div(MeanEstimate(x[r]), demand/1e6)
else
MeanEstimate(0.)
end

return NEUE(estimate)

end

function finalize(
Expand Down
Loading