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
60 Stages
using Clp using HydroPowerModels
data = HydroPowerModels.parse_folder(joinpath(WEAVE_ARGS[:testcases_dir],"case3")) params = set_param( stages = 12*5, 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: 60 States: 1 Subproblems: 60 Value Function: Default --------------------------------------------------------------------------- ---- Objective | Cut Passes Simulations Total Simulation Bound % Gap | # Time # Time Time --------------------------------------------------------------------------- ---- 58.502K 32.712K | 1 0.1 0 0.0 0.1 74.816K 34.301K | 2 0.1 0 0.0 0.1 70.529K 37.558K | 3 0.2 0 0.0 0.2 57.714K 40.561K | 4 0.2 0 0.0 0.2 54.587K 41.365K | 5 0.2 0 0.0 0.2 60.844K 50.991K | 6 0.3 0 0.0 0.3 69.159K 52.041K | 7 0.3 0 0.0 0.3 58.704K 59.079K | 8 0.4 0 0.0 0.4 58.541K 59.079K | 9 0.4 0 0.0 0.4 62.904K 59.085K | 10 0.5 0 0.0 0.5 57.093K 59.085K | 11 0.5 0 0.0 0.5 61.471K 59.169K | 12 0.6 0 0.0 0.6 69.172K 59.169K | 13 0.6 0 0.0 0.6 60.852K 59.169K | 14 0.7 0 0.0 0.7 61.649K 59.169K | 15 0.7 0 0.0 0.7 61.098K 59.175K | 16 0.8 0 0.0 0.8 65.202K 59.176K | 17 0.9 0 0.0 0.9 60.048K 59.176K | 18 0.9 0 0.0 0.9 54.802K 59.176K | 19 1.0 0 0.0 1.0 55.200K 59.177K | 20 1.0 0 0.0 1.0 58.653K 59.194K | 21 1.1 0 0.0 1.1 58.500K 59.200K | 22 1.1 0 0.0 1.1 62.203K 59.201K | 23 1.2 0 0.0 1.2 62.609K 59.201K | 24 1.2 0 0.0 1.3 61.297K 59.206K | 25 1.3 0 0.0 1.3 58.854K 59.210K | 26 1.4 0 0.0 1.4 50.601K 59.297K | 27 1.4 0 0.0 1.4 63.101K 59.301K | 28 1.5 0 0.0 1.5 56.372K 59.301K | 29 1.5 0 0.0 1.5 59.847K 59.304K | 30 1.6 0 0.0 1.6 61.141K 59.305K | 31 1.7 0 0.0 1.7 59.302K 59.306K | 32 1.7 0 0.0 1.7 56.353K 59.306K | 33 1.8 0 0.0 1.8 60.453K 59.306K | 34 1.8 0 0.0 1.8 54.300K 59.306K | 35 1.9 0 0.0 1.9 61.440K 59.306K | 36 2.0 0 0.0 2.0 56.800K 59.308K | 37 2.0 0 0.0 2.0 63.100K 59.308K | 38 2.1 0 0.0 2.1 58.900K 59.309K | 39 2.1 0 0.0 2.1 58.153K 59.309K | 40 2.2 0 0.0 2.2 61.900K 59.310K | 41 2.3 0 0.0 2.3 61.253K 59.311K | 42 2.3 0 0.0 2.3 63.909K 59.311K | 43 2.4 0 0.0 2.4 61.000K 59.311K | 44 2.5 0 0.0 2.5 56.400K 59.315K | 45 2.5 0 0.0 2.5 66.471K 59.316K | 46 2.6 0 0.0 2.6 60.502K 59.316K | 47 2.6 0 0.0 2.7 61.053K 59.317K | 48 2.7 0 0.0 2.7 64.532K 59.317K | 49 2.8 0 0.0 2.8 57.700K 59.318K | 50 2.8 0 0.0 2.9 55.611K 59.318K | 51 2.9 0 0.0 2.9 63.500K 59.318K | 52 3.0 0 0.0 3.0 62.355K 59.318K | 53 3.0 0 0.0 3.0 61.319K 59.319K | 54 3.1 0 0.0 3.1 56.400K 59.319K | 55 3.2 0 0.0 3.2 61.103K 59.320K | 56 3.2 0 0.0 3.2 61.100K 59.320K | 57 3.3 0 0.0 3.3 64.418K 59.320K | 58 3.4 0 0.0 3.4 57.231K 59.321K | 59 3.4 0 0.0 3.4 58.357K 59.321K | 60 3.5 0 0.0 3.5 --------------------------------------------------------------------------- ---- Other Statistics: Iterations: 60 Termination Status: iteration_limit =========================================================================== ====
srand(1111); results = simulate_model(m, 100);
elapsed time: 6.944497238 seconds
Objective
using Base.Test @test isapprox(results["simulations"][1]["objective"], 59800.0, atol=1e-2)
Test Passed
Solution
@test results["simulations"][1]["solution"][50]["gen"]["4"]["pg"] == 0 @test isapprox(results["simulations"][1]["solution"][50]["gen"]["2"]["pg"],0.0, atol=1e-2) @test isapprox(results["simulations"][1]["solution"][50]["gen"]["3"]["pg"],0.74, atol=1e-2) @test isapprox(results["simulations"][1]["solution"][50]["gen"]["1"]["pg"],0.25, atol=1e-2)
Test Passed
if !isdefined(:plot_bool) plot_bool = true end if plot_bool == true plotresults(results) end