|
712 | 712 | end
|
713 | 713 | end
|
714 | 714 |
|
| 715 | +@testset "2 Areas AreaBalance PowerModel - with slacks" begin |
| 716 | + c_sys = build_system(PSITestSystems, "c_sys5_uc") |
| 717 | + # Extend the system with two areas |
| 718 | + areas = [Area("Area_1", 0, 0, 0), Area("Area_2", 0, 0, 0)] |
| 719 | + add_components!(c_sys, areas) |
| 720 | + for (i, comp) in enumerate(get_components(ACBus, c_sys)) |
| 721 | + (i < 3) ? set_area!(comp, areas[1]) : set_area!(comp, areas[2]) |
| 722 | + end |
| 723 | + # Deactivate generators on Area 1: as there is no area interchange defined, |
| 724 | + # slacks will be required for feasibility |
| 725 | + for gen in get_components(x -> (get_area(get_bus(x)) == areas[1]), Generator, c_sys) |
| 726 | + set_available!(gen, false) |
| 727 | + end |
| 728 | + |
| 729 | + template = get_thermal_dispatch_template_network( |
| 730 | + NetworkModel(AreaBalancePowerModel, use_slacks=true) |
| 731 | + ) |
| 732 | + ps_model = DecisionModel(template, c_sys; optimizer = HiGHS_optimizer) |
| 733 | + |
| 734 | + @test build!(ps_model; output_dir = mktempdir(; cleanup = true)) == |
| 735 | + PSI.ModelBuildStatus.BUILT |
| 736 | + @test solve!(ps_model) == PSI.RunStatus.SUCCESSFULLY_FINALIZED |
| 737 | + |
| 738 | + opt_container = PSI.get_optimization_container(ps_model) |
| 739 | + copper_plate_constraints = |
| 740 | + PSI.get_constraint(opt_container, CopperPlateBalanceConstraint(), PSY.Area) |
| 741 | + @test size(copper_plate_constraints) == (2, 24) |
| 742 | + |
| 743 | + results = OptimizationProblemResults(ps_model) |
| 744 | + slacks_up = read_variable(results, "SystemBalanceSlackUp__Area") |
| 745 | + @test all(slacks_up[!, "Area_1"] .> 0.) |
| 746 | + @test all(slacks_up[!, "Area_2"] .≈ 0.) |
| 747 | +end |
| 748 | + |
715 | 749 | @testset "2 Areas AreaBalance PowerModel" begin
|
716 | 750 | c_sys = PSB.build_system(PSISystems, "two_area_pjm_DA")
|
717 | 751 | transform_single_time_series!(c_sys, Hour(24), Hour(1))
|
|
0 commit comments