Skip to content

Commit

Permalink
Merge pull request #520 from NREL-SIIP/cb/handle-origin-costs
Browse files Browse the repository at this point in the history
pwl-origin-cost
  • Loading branch information
claytonpbarrows authored Jun 19, 2020
2 parents c1318a5 + 639d02c commit bc15370
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/operational_cost.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ end
"""
get_slopes(vc::VariableCost{Vector{NTuple{2, Float64}}})
Calculates the slopes for the variable cost represented as a piece wise linear cost function. This function returns n - slopes for n - piecewise linear elements in the function. The first element of the return array corresponds to the average cost at the minimum operating point. If your formulation uses n -1 slopes, you can disregard the first component of the array.
Calculates the slopes for the variable cost represented as a piece wise linear cost function. This function returns n - slopes for n - piecewise linear elements in the function. The first element of the return array corresponds to the average cost at the minimum operating point. If your formulation uses n -1 slopes, you can disregard the first component of the array. If the first point in the variable cost has a quantity of 0.0, the first slope returned will be 0.0, otherwise, the first slope represents the trajectory to get from the origin to the first point in the variable cost.
"""
function get_slopes(vc::VariableCost{Vector{NTuple{2, Float64}}})
Expand All @@ -55,7 +55,7 @@ function get_slopes(vc::Vector{NTuple{2, Float64}})
previous = (0.0, 0.0)
for (ix, component) in enumerate(vc)
if ix == 1
slopes[ix] = component[1] / component[2]
slopes[ix] = component[2] == 0.0 ? 0.0 : component[1] / component[2] # if the cost component starts at the y-origin make the first slope 0.0
previous = component
continue
end
Expand Down

0 comments on commit bc15370

Please sign in to comment.