-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jd/move energy limit ff out #1014
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 | ||
---|---|---|---|---|
|
@@ -202,42 +202,6 @@ function has_semicontinuous_feedforward( | |||
return has_semicontinuous_feedforward(model, ActivePowerVariable) | ||||
end | ||||
|
||||
""" | ||||
Adds a constraint to limit the sum of a variable over the number of periods to the source value | ||||
""" | ||||
struct EnergyLimitFeedforward <: AbstractAffectFeedforward | ||||
optimization_container_key::OptimizationContainerKey | ||||
affected_values::Vector{<:OptimizationContainerKey} | ||||
number_of_periods::Int | ||||
function EnergyLimitFeedforward(; | ||||
component_type::Type{<:PSY.Component}, | ||||
source::Type{T}, | ||||
affected_values::Vector{DataType}, | ||||
number_of_periods::Int, | ||||
meta = CONTAINER_KEY_EMPTY_META, | ||||
) where {T} | ||||
values_vector = Vector{VariableKey}(undef, length(affected_values)) | ||||
for (ix, v) in enumerate(affected_values) | ||||
if v <: VariableType | ||||
values_vector[ix] = | ||||
get_optimization_container_key(v(), component_type, meta) | ||||
else | ||||
error( | ||||
"EnergyLimitFeedforward is only compatible with VariableType or ParamterType affected values", | ||||
) | ||||
end | ||||
end | ||||
new( | ||||
get_optimization_container_key(T(), component_type, meta), | ||||
values_vector, | ||||
number_of_periods, | ||||
) | ||||
end | ||||
end | ||||
|
||||
get_default_parameter_type(::EnergyLimitFeedforward, _) = EnergyLimitParameter | ||||
get_optimization_container_key(ff) = ff.optimization_container_key | ||||
get_number_of_periods(ff) = ff.number_of_periods | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
""" | ||||
Fixes a Variable or Parameter Value in the model. Is the only Feed Forward that can be used | ||||
|
@@ -269,42 +233,3 @@ end | |||
|
||||
get_default_parameter_type(::FixValueFeedforward, _) = FixValueParameter | ||||
get_optimization_container_key(ff::FixValueFeedforward) = ff.optimization_container_key | ||||
|
||||
""" | ||||
Adds a constraint to enforce a minimum energy level target with a slack variable associated witha penalty term. | ||||
""" | ||||
struct EnergyTargetFeedforward <: AbstractAffectFeedforward | ||||
optimization_container_key::OptimizationContainerKey | ||||
affected_values::Vector{<:OptimizationContainerKey} | ||||
target_period::Int | ||||
penalty_cost::Float64 | ||||
function EnergyTargetFeedforward(; | ||||
component_type::Type{<:PSY.Component}, | ||||
source::Type{T}, | ||||
affected_values::Vector{DataType}, | ||||
target_period::Int, | ||||
penalty_cost::Float64, | ||||
meta = CONTAINER_KEY_EMPTY_META, | ||||
) where {T} | ||||
values_vector = Vector{VariableKey}(undef, length(affected_values)) | ||||
for (ix, v) in enumerate(affected_values) | ||||
if v <: VariableType | ||||
values_vector[ix] = | ||||
get_optimization_container_key(v(), component_type, meta) | ||||
else | ||||
error( | ||||
"EnergyTargetFeedforward is only compatible with VariableType or ParamterType affected values", | ||||
) | ||||
end | ||||
end | ||||
new( | ||||
get_optimization_container_key(T(), component_type, meta), | ||||
values_vector, | ||||
target_period, | ||||
penalty_cost, | ||||
) | ||||
end | ||||
end | ||||
|
||||
get_default_parameter_type(::EnergyTargetFeedforward, _) = EnergyTargetParameter | ||||
get_optimization_container_key(ff::EnergyTargetFeedforward) = ff.optimization_container_key |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶