File size: 1,115 Bytes
43c68a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.

function _add_profiled_unit!(
    model::JuMP.Model,
    pu::ProfiledUnit,
    sc::UnitCommitmentScenario,
)::Nothing
    punits = _init(model, :prod_profiled)
    net_injection = _init(model, :expr_net_injection)
    for t in 1:model[:instance].time
        # Decision variable
        punits[sc.name, pu.name, t] = @variable(
            model,
            lower_bound = pu.min_power[t],
            upper_bound = pu.max_power[t],
            base_name =  "prod_profiled_$(sc.name)_$(pu.name)_$(t)",
        )

        # Objective function terms
        add_to_expression!(
            model[:obj],
            punits[sc.name, pu.name, t],
            pu.cost[t] * sc.probability,
        )

        # Net injection
        add_to_expression!(
            net_injection[sc.name, pu.bus.name, t],
            punits[sc.name, pu.name, t],
            1.0,
        )
    end
    return
end