From 33f8ec26d50e69f932a93f75c0e6763018b1d4f2 Mon Sep 17 00:00:00 2001 From: Jun He Date: Fri, 5 May 2023 14:48:15 -0400 Subject: [PATCH] renamed capacity to max_power --- src/instance/structs.jl | 2 +- src/model/formulations/base/punit.jl | 2 +- src/transform/initcond.jl | 2 +- src/validation/validate.jl | 4 ++-- test/instance/read_test.jl | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/instance/structs.jl b/src/instance/structs.jl index 15dfef4..8323a15 100644 --- a/src/instance/structs.jl +++ b/src/instance/structs.jl @@ -79,7 +79,7 @@ mutable struct ProfiledUnit name::String bus::Bus min_power::Vector{Float64} - capacity::Vector{Float64} + max_power::Vector{Float64} cost::Vector{Float64} end diff --git a/src/model/formulations/base/punit.jl b/src/model/formulations/base/punit.jl index 22b53ce..b3d3362 100644 --- a/src/model/formulations/base/punit.jl +++ b/src/model/formulations/base/punit.jl @@ -14,7 +14,7 @@ function _add_profiled_unit!( punits[sc.name, pu.name, t] = @variable( model, lower_bound = pu.min_power[t], - upper_bound = pu.capacity[t] + upper_bound = pu.max_power[t] ) # Objective function terms diff --git a/src/transform/initcond.jl b/src/transform/initcond.jl index d0e2954..9e2e178 100644 --- a/src/transform/initcond.jl +++ b/src/transform/initcond.jl @@ -32,7 +32,7 @@ function generate_initial_conditions!( # Constraint: Maximum power @constraint(mip, max_power[g in G], p[g] <= g.max_power[t] * x[g]) - @constraint(mip, pu_max_power[k in PU], pu[k] <= k.capacity[t]) + @constraint(mip, pu_max_power[k in PU], pu[k] <= k.max_power[t]) # Constraint: Production equals demand @constraint( diff --git a/src/validation/validate.jl b/src/validation/validate.jl index 46c049a..863b675 100644 --- a/src/validation/validate.jl +++ b/src/validation/validate.jl @@ -322,13 +322,13 @@ function _validate_units(instance::UnitCommitmentInstance, solution; tol = 0.01) end # Unit must produce at most its maximum power - if production[t] > pu.capacity[t] + tol + if production[t] > pu.max_power[t] + tol @error @sprintf( "Profiled unit %s produces above its maximum limit at time %d (%.2f > %.2f)", pu.name, t, production[t], - pu.capacity[t] + pu.max_power[t] ) err_count += 1 end diff --git a/test/instance/read_test.jl b/test/instance/read_test.jl index ccde032..1ad347b 100644 --- a/test/instance/read_test.jl +++ b/test/instance/read_test.jl @@ -142,7 +142,7 @@ end @test first_pu.bus.name == "b4" @test first_pu.cost == [100.0 for t in 1:4] @test first_pu.min_power == [60.0 for t in 1:4] - @test first_pu.capacity == [100.0 for t in 1:4] + @test first_pu.max_power == [100.0 for t in 1:4] @test sc.profiled_units_by_name["g7"].name == "g7" second_pu = sc.profiled_units[2] @@ -150,7 +150,7 @@ end @test second_pu.bus.name == "b5" @test second_pu.cost == [50.0 for t in 1:4] @test second_pu.min_power == [0.0 for t in 1:4] - @test second_pu.capacity == [120.0 for t in 1:4] + @test second_pu.max_power == [120.0 for t in 1:4] @test sc.profiled_units_by_name["g8"].name == "g8" end