This an example of the HydroPowerModels package for solving a simple stochastic case with the following specifications:
3 Buses
3 Lines
2 Generators
1 Reservoir and Hydrogenerator
3 Scenarios
12 Stages
using Clp using HydroPowerModels
data = HydroPowerModels.parse_folder(joinpath(WEAVE_ARGS[:testcases_dir],"case3")) params = set_param( stages = 12, model_constructor_grid = DCPPowerModel, post_method = PowerModels.post_opf, solver = ClpSolver())
m = hydrothermaloperation(data, params);
status = solve(m, iteration_limit = 60);
--------------------------------------------------------------------------- ---- SDDP.jl © Oscar Dowson, 2017-2018 --------------------------------------------------------------------------- ---- Solver: Serial solver Model: Stages: 12 States: 1 Subproblems: 12 Value Function: Default --------------------------------------------------------------------------- ---- Objective | Cut Passes Simulations Total Simulation Bound % Gap | # Time # Time Time --------------------------------------------------------------------------- ---- 10.790K 6.759K | 1 1.6 0 0.0 1.6 11.329K 9.418K | 2 1.6 0 0.0 1.8 11.409K 9.999K | 3 1.6 0 0.0 1.8 13.200K 11.263K | 4 1.6 0 0.0 1.8 10.268K 11.271K | 5 1.6 0 0.0 1.8 10.811K 11.274K | 6 1.6 0 0.0 1.8 11.660K 11.276K | 7 1.6 0 0.0 1.8 11.000K 11.279K | 8 1.6 0 0.0 1.8 8.753K 11.279K | 9 1.6 0 0.0 1.9 9.854K 11.285K | 10 1.7 0 0.0 1.9 12.400K 11.290K | 11 1.7 0 0.0 1.9 9.200K 11.293K | 12 1.7 0 0.0 1.9 11.928K 11.293K | 13 1.7 0 0.0 1.9 11.653K 11.294K | 14 1.7 0 0.0 1.9 11.053K 11.294K | 15 1.7 0 0.0 1.9 10.000K 11.294K | 16 1.7 0 0.0 1.9 12.401K 11.295K | 17 1.7 0 0.0 1.9 11.800K 11.298K | 18 1.7 0 0.0 2.0 8.311K 11.298K | 19 1.7 0 0.0 2.0 10.900K 11.299K | 20 1.8 0 0.0 2.0 11.054K 11.299K | 21 1.8 0 0.0 2.0 9.800K 11.299K | 22 1.8 0 0.0 2.0 9.607K 11.299K | 23 1.8 0 0.0 2.0 11.900K 11.301K | 24 1.8 0 0.0 2.0 12.300K 11.301K | 25 1.8 0 0.0 2.0 11.002K 11.301K | 26 1.8 0 0.0 2.0 11.300K 11.301K | 27 1.8 0 0.0 2.1 13.800K 11.301K | 28 1.8 0 0.0 2.1 10.500K 11.301K | 29 1.9 0 0.0 2.1 11.053K 11.301K | 30 1.9 0 0.0 2.1 11.600K 11.301K | 31 1.9 0 0.0 2.1 12.600K 11.301K | 32 1.9 0 0.0 2.1 11.400K 11.301K | 33 1.9 0 0.0 2.1 12.913K 11.301K | 34 1.9 0 0.0 2.1 11.054K 11.301K | 35 1.9 0 0.0 2.1 11.700K 11.301K | 36 1.9 0 0.0 2.2 11.200K 11.301K | 37 1.9 0 0.0 2.2 10.000K 11.301K | 38 2.0 0 0.0 2.2 12.008K 11.301K | 39 2.0 0 0.0 2.2 11.947K 11.301K | 40 2.0 0 0.0 2.2 13.600K 11.301K | 41 2.0 0 0.0 2.2 12.700K 11.301K | 42 2.0 0 0.0 2.3 8.101K 11.301K | 43 2.0 0 0.0 2.3 9.400K 11.301K | 44 2.0 0 0.0 2.3 11.800K 11.301K | 45 2.0 0 0.0 2.3 11.600K 11.301K | 46 2.1 0 0.0 2.3 10.654K 11.301K | 47 2.1 0 0.0 2.3 12.616K 11.301K | 48 2.1 0 0.0 2.3 12.100K 11.301K | 49 2.1 0 0.0 2.3 12.302K 11.301K | 50 2.1 0 0.0 2.3 11.100K 11.301K | 51 2.1 0 0.0 2.4 13.510K 11.301K | 52 2.1 0 0.0 2.4 11.700K 11.301K | 53 2.1 0 0.0 2.4 9.604K 11.301K | 54 2.2 0 0.0 2.4 10.854K 11.301K | 55 2.2 0 0.0 2.4 10.300K 11.301K | 56 2.2 0 0.0 2.4 9.900K 11.301K | 57 2.2 0 0.0 2.4 11.054K 11.301K | 58 2.2 0 0.0 2.5 11.200K 11.301K | 59 2.2 0 0.0 2.5 10.000K 11.301K | 60 2.2 0 0.0 2.5 --------------------------------------------------------------------------- ---- Other Statistics: Iterations: 60 Termination Status: iteration_limit =========================================================================== ====
srand(1111) results = simulate_model(m, 100);
elapsed time: 3.84692969 seconds
Objective
using Base.Test @test isapprox(results["simulations"][1]["objective"], 12400.00, atol=1e-2)
Test Passed
Solution
@test results["simulations"][1]["solution"][1]["gen"]["4"]["pg"] == 0 @test isapprox(results["simulations"][1]["solution"][1]["gen"]["2"]["pg"],0.0, atol=1e-2) @test isapprox(results["simulations"][1]["solution"][1]["gen"]["3"]["pg"],0.65, atol=1e-2) @test isapprox(results["simulations"][1]["solution"][1]["gen"]["1"]["pg"],0.34, atol=1e-2)
Test Passed
if !isdefined(:plot_bool) plot_bool = true end if plot_bool == true plotresults(results) end