Skip to content

Commit

Permalink
other error found 4
Browse files Browse the repository at this point in the history
  • Loading branch information
alefcastelli committed Aug 1, 2023
1 parent 4a07e6b commit 9a9255a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ptdf_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ function _calculate_PTDF_matrix_KLU(
else
error("Distributed bus specification doesn't match the number of buses.")
end

return
end

"""
Expand Down Expand Up @@ -260,7 +262,7 @@ function _calculate_PTDF_matrix_DENSE(
error("Distributed bus specification doesn't match the number of buses.")
end

return PTDFm_t
return
end

"""
Expand Down Expand Up @@ -333,17 +335,18 @@ function _calculate_PTDF_matrix_MKLPardiso(
)
elseif isempty(dist_slack) && length(ref_bus_positions) < buscount
PTDFm_t[row_idx, :] = ABA_inv * @view BA[row_idx, :]
return PTDFm_t
elseif length(dist_slack) == buscount
@info "Distributed bus"
PTDFm_t[row_idx, :] = ABA_inv * @view BA[row_idx, :]
slack_array = dist_slack / sum(dist_slack)
slack_array = reshape(slack_array, buscount, 1)
PTDFm_t = PTDFm_t - (PTDFm_t * slack_array) * ones(1, buscount)
return PTDFm_t - ones(buscount, 1) * (slack_array * PTDFm_t)
else
error("Distributed bus specification doesn't match the number of buses.")
end

return PTDFm_t
return
end

"""
Expand Down

0 comments on commit 9a9255a

Please sign in to comment.