-
Notifications
You must be signed in to change notification settings - Fork 57
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
Market bid cost with pwl cost curve #1182
Open
purboday
wants to merge
10
commits into
NREL-Sienna:main
Choose a base branch
from
purboday:market-bid-cost-with-pwl-cost-curve
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cc627b1
added _add_vom_cost_to_objective! to market_bid.jl
purboday a241db0
fixed test
purboday 8dd0f79
formatter
rodrigomha a631516
Delete test/run_market_bid_cost.jl
purboday 4d40be9
formatter
rodrigomha 6836f7d
more formats
rodrigomha c3c27c2
formatter vom
rodrigomha d8bdcc7
fix typo
rodrigomha c965a3d
formatter again
rodrigomha 70b0f02
formatter once more time
rodrigomha 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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using Pkg | ||
Pkg.activate("test") | ||
Pkg.instantiate() | ||
|
||
using Revise | ||
using PowerSystems | ||
using PowerSystemCaseBuilder | ||
using PowerSimulations | ||
using StorageSystemsSimulations | ||
using HydroPowerSimulations | ||
using Xpress | ||
using Logging | ||
# using PlotlyJS | ||
using Dates | ||
using JuMP | ||
using InfrastructureSystems | ||
using DataStructures | ||
using TimeSeries | ||
const PSY = PowerSystems | ||
const PSI = PowerSimulations | ||
const PSB = PowerSystemCaseBuilder | ||
const PM = PSI.PowerModels | ||
|
||
################################## | ||
### Load Test Function Helpers ### | ||
################################## | ||
|
||
include("test_utils/solver_definitions.jl") | ||
include("test_utils/operations_problem_templates.jl") | ||
|
||
sys = PSB.build_system(PSITestSystems, "c_sys5_re") | ||
|
||
show_components(sys, ThermalStandard, [:active_power]) | ||
show_components(sys, RenewableDispatch, [:active_power]) | ||
|
||
th_solitude = get_component(ThermalStandard, sys, "Solitude") | ||
th_brighton = get_component(ThermalStandard, sys, "Brighton") | ||
re_A = get_component(RenewableDispatch, sys, "WindBusA") | ||
get_bus(th_solitude) | ||
|
||
#### Add MarketBidCost | ||
|
||
proposed_offer_curve = make_market_bid_curve( | ||
[0.0, 100.0, 200.0, 300.0, 400.0, 500.0, 600.0], | ||
[25.0, 25.5, 26.0, 27.0, 28.0, 30.0], | ||
10.0 | ||
) | ||
|
||
set_operation_cost!( | ||
th_solitude, | ||
MarketBidCost(; | ||
no_load_cost=0.0, | ||
start_up = (hot=3.0, warm=0.0, cold=0.0), | ||
shut_down = 1.5, | ||
incremental_offer_curves = proposed_offer_curve | ||
) | ||
) | ||
|
||
#### PowerSimulations Stuff ### | ||
|
||
template = ProblemTemplate( | ||
NetworkModel( | ||
CopperPlatePowerModel; | ||
duals = [CopperPlateBalanceConstraint], | ||
), | ||
) | ||
set_device_model!(template, ThermalStandard, ThermalBasicUnitCommitment) | ||
#set_device_model!(template, ThermalStandard, ThermalDispatchNoMin) | ||
set_device_model!(template, PowerLoad, StaticPowerLoad) | ||
set_device_model!(template, RenewableDispatch, RenewableFullDispatch) | ||
|
||
model = DecisionModel( | ||
template, | ||
sys; | ||
name = "UC", | ||
optimizer = optimizer_with_attributes(Xpress.Optimizer, "MIPRELSTOP" => 1e-3), | ||
system_to_file = false, | ||
store_variable_names = true, | ||
calculate_conflict = true, | ||
optimizer_solve_log_print = true, | ||
) | ||
|
||
build!(model; output_dir = mktempdir(; cleanup = true)) | ||
|
||
vars = model.internal.container.variables | ||
cons = model.internal.container.constraints | ||
|
||
power_balance = | ||
cons[PowerSimulations.ConstraintKey{CopperPlateBalanceConstraint, System}("")] | ||
lb_thermal = cons[PowerSimulations.ConstraintKey{ | ||
ActivePowerVariableLimitsConstraint, | ||
ThermalStandard, | ||
}( | ||
"lb", | ||
)] | ||
|
||
solve!(model) | ||
|
||
res = OptimizationProblemResults(model) | ||
|
||
p_th = read_variable(res, "ActivePowerVariable__ThermalStandard") | ||
|
||
param_re = read_parameter(res, "ActivePowerTimeSeriesParameter__RenewableDispatch") | ||
p_re = read_variable(res, "ActivePowerVariable__RenewableDispatch") | ||
|
||
# $/(per-unit MW) = $/(100 MW) = 0.01 $/MW | ||
price = read_dual(res, "CopperPlateBalanceConstraint__System") |
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.
This file is useful but it shouldn't be checked out into the repo. I'd like the original test to be fixed.
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.
Deleted the file.