Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jd/add thermal time series #1162

Merged
merged 37 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9e4de69
change file name to avoid confussion
jd-lara Oct 13, 2024
2e4b706
add ts parameter calls in constructor
jd-lara Oct 13, 2024
94e0ec3
add constraint call
jd-lara Oct 13, 2024
d35233d
add checks for ts property
jd-lara Oct 13, 2024
c1231d6
improve error print
jd-lara Oct 13, 2024
a9e2966
add multiplier function
jd-lara Oct 13, 2024
1a5774f
another time series check
jd-lara Oct 13, 2024
e47f4e6
add constructor test
jd-lara Oct 13, 2024
2125117
fix test
jd-lara Oct 13, 2024
444afb2
comment out unrelated broken method
jd-lara Oct 13, 2024
fc6fc96
add missing ts check
jd-lara Oct 13, 2024
88c2e08
Update README with docs link
rodrigomha Oct 21, 2024
59ee821
Merge pull request #1166 from NREL-Sienna/rodrigomha-update-readme
jd-lara Oct 28, 2024
1bbe274
Use cached time series UUID
daniel-thom Oct 30, 2024
01a1bc6
Merge pull request #1169 from NREL-Sienna/is-issue-409
jd-lara Oct 31, 2024
75d6017
use service name in meta
jd-lara Nov 8, 2024
22254f0
Merge pull request #1172 from NREL-Sienna/jd/fix_service_meta
rodrigomha Nov 8, 2024
7fba689
Update Project.toml
jd-lara Nov 11, 2024
46c184f
Update Project.toml
jd-lara Nov 14, 2024
cfc1f52
Merge pull request #1176 from NREL-Sienna/jd-lara-patch-1
jd-lara Nov 14, 2024
1eeccb9
fix component bug
rodrigomha Nov 21, 2024
46a5abf
change file name to avoid confussion
jd-lara Oct 13, 2024
c3fe201
add ts parameter calls in constructor
jd-lara Oct 13, 2024
92064cc
add constraint call
jd-lara Oct 13, 2024
bfbb73d
add checks for ts property
jd-lara Oct 13, 2024
f820420
improve error print
jd-lara Oct 13, 2024
f585794
add multiplier function
jd-lara Oct 13, 2024
4faa5cb
another time series check
jd-lara Oct 13, 2024
d7d865f
add constructor test
jd-lara Oct 13, 2024
a3ca5a0
fix test
jd-lara Oct 13, 2024
ff9cbaa
comment out unrelated broken method
jd-lara Oct 13, 2024
40ce34a
add missing ts check
jd-lara Oct 13, 2024
23e9137
fix component bug
rodrigomha Nov 21, 2024
f252a68
Merge branch 'jd/add_thermal_time_series' of https://github.com/NREL-…
jd-lara Nov 29, 2024
5510a92
add method to get correct time_series_type
jd-lara Nov 29, 2024
1e56416
implement has_time_series with type and name
jd-lara Nov 29, 2024
ea672b6
remove left over @show
jd-lara Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PowerSimulations"
uuid = "e690365d-45e2-57bb-ac84-44ba829e73c4"
authors = ["Jose Daniel Lara", "Clayton Barrows", "Daniel Thom", "Dheepak Krishnamurthy", "Sourabh Dalvi"]
version = "0.28.3"
version = "0.29.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ using PowerSimulations
using PowerSystems
```

For information on using the package, see the [stable documentation](https://nrel-sienna.github.io/PowerSimulations.jl/stable/). Use the [in-development documentation](https://nrel-sienna.github.io/PowerSimulations.jl/dev/) for the version of the documentation which contains the unreleased features.

## Development

Contributions to the development and enhancement of PowerSimulations is welcome. Please see [CONTRIBUTING.md](https://github.com/NREL-Sienna/PowerSimulations.jl/blob/main/CONTRIBUTING.md) for code contribution guidelines.
Expand Down
2 changes: 1 addition & 1 deletion src/PowerSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ include("devices_models/devices/common/duration_constraints.jl")
include("devices_models/devices/common/get_time_series.jl")

# Device Modeling components
include("devices_models/devices/interfaces.jl")
include("devices_models/devices/default_interface_methods.jl")
include("devices_models/devices/common/add_to_expression.jl")
include("devices_models/devices/common/set_expression.jl")
include("devices_models/devices/renewable_generation.jl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ function construct_device!(

initial_conditions!(container, devices, D())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -135,6 +139,17 @@ function construct_device!(
add_constraints!(container, RampConstraint, devices, model, network_model)
add_constraints!(container, DurationConstraint, devices, model, network_model)

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

objective_function!(container, devices, model, get_network_formulation(network_model))
Expand Down Expand Up @@ -164,6 +179,10 @@ function construct_device!(

initial_conditions!(container, devices, D())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -227,6 +246,16 @@ function construct_device!(
add_constraints!(container, CommitmentConstraint, devices, model, network_model)
add_constraints!(container, RampConstraint, devices, model, network_model)
add_constraints!(container, DurationConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -256,6 +285,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalBasicUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -335,6 +368,17 @@ function construct_device!(
)
add_constraints!(container, CommitmentConstraint, devices, model, network_model)

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

objective_function!(container, devices, model, get_network_formulation(network_model))
Expand All @@ -361,6 +405,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalBasicUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -423,6 +471,16 @@ function construct_device!(
)

add_constraints!(container, CommitmentConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -829,6 +887,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalMultiStartUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -931,6 +993,16 @@ function construct_device!(
network_model,
)
add_constraints!(container, ActiveRangeICConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -965,6 +1037,10 @@ function construct_device!(
add_variables!(container, TimeDurationOff, devices, ThermalMultiStartUnitCommitment())
add_variables!(container, PowerOutput, devices, ThermalMultiStartUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -1053,6 +1129,16 @@ function construct_device!(
network_model,
)
add_constraints!(container, ActiveRangeICConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -1092,6 +1178,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalCompactUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -1169,6 +1259,16 @@ function construct_device!(
add_constraints!(container, CommitmentConstraint, devices, model, network_model)
add_constraints!(container, RampConstraint, devices, model, network_model)
add_constraints!(container, DurationConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -1202,6 +1302,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalCompactUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -1270,6 +1374,16 @@ function construct_device!(
add_constraints!(container, CommitmentConstraint, devices, model, network_model)
add_constraints!(container, RampConstraint, devices, model, network_model)
add_constraints!(container, DurationConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -1307,6 +1421,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalBasicCompactUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -1382,6 +1500,16 @@ function construct_device!(
network_model,
)
add_constraints!(container, CommitmentConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down Expand Up @@ -1413,6 +1541,10 @@ function construct_device!(

initial_conditions!(container, devices, ThermalBasicCompactUnitCommitment())

if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
end

add_to_expression!(
container,
ActivePowerBalance,
Expand Down Expand Up @@ -1479,6 +1611,16 @@ function construct_device!(
)

add_constraints!(container, CommitmentConstraint, devices, model, network_model)
if haskey(get_time_series_names(model), ActivePowerTimeSeriesParameter)
add_constraints!(
container,
ActivePowerVariableTimeSeriesLimitsConstraint,
ActivePowerRangeExpressionUB,
devices,
model,
network_model,
)
end

add_feedforward_constraints!(container, model, devices)

Expand Down
2 changes: 1 addition & 1 deletion src/devices_models/devices/common/add_to_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function add_expressions!(
D,
PSY.get_name.(devices),
time_steps;
meta = PSY.get_name(first(devices)),
meta = get_service_name(model),
)
return
end
Expand Down
10 changes: 8 additions & 2 deletions src/devices_models/devices/common/objective_function/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ function _add_vom_cost_to_objective!(
)
for t in get_time_steps(container)
exp =
_add_proportional_term!(container, T(), d, cost_term_normalized * multiplier, t)
add_to_expression!(container, ProductionCostExpression, exp, d, t)
_add_proportional_term!(
container,
T(),
component,
cost_term_normalized * multiplier,
t,
)
add_to_expression!(container, ProductionCostExpression, exp, component, t)
end
return
end
Expand Down
29 changes: 25 additions & 4 deletions src/devices_models/devices/common/range_constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,12 @@ function lower_bound_range_with_parameter!(
mult = get_multiplier_array(param_container)
jump_model = get_jump_model(container)
time_steps = axes(constraint_container)[2]
ts_name = get_time_series_names(model)[P]
ts_type = get_default_time_series_type(container)
for device in devices
if !(PSY.has_time_series(device, ts_type, ts_name))
continue
end
name = PSY.get_name(device)
param = get_parameter_column_refs(param_container, name)
for t in time_steps
Expand All @@ -730,8 +735,13 @@ function _add_parameterized_lower_bound_range_constraints_impl!(
W <: AbstractDeviceFormulation,
}
time_steps = get_time_steps(container)
names = [PSY.get_name(d) for d in devices]

ts_name = get_time_series_names(model)[U]
ts_type = get_default_time_series_type(container)
names = [PSY.get_name(d) for d in devices if PSY.has_time_series(d, ts_type, ts_name)]
if isempty(names)
@debug "There are no $V devices with time series data"
return
end
constraint =
add_constraints_container!(container, T(), V, names, time_steps; meta = "lb")

Expand Down Expand Up @@ -834,14 +844,19 @@ function upper_bound_range_with_parameter!(
lhs_array,
param::P,
devices::IS.FlattenIteratorWrapper{V},
::DeviceModel{V, W},
model::DeviceModel{V, W},
) where {P <: TimeSeriesParameter, V <: PSY.Component, W <: AbstractDeviceFormulation}
param_container = get_parameter(container, param, V)
mult = get_multiplier_array(param_container)
jump_model = get_jump_model(container)
time_steps = axes(constraint_container)[2]
ts_name = get_time_series_names(model)[P]
ts_type = get_default_time_series_type(container)
for device in devices
name = PSY.get_name(device)
if !(PSY.has_time_series(device, ts_type, ts_name))
continue
end
param = get_parameter_column_refs(param_container, name)
for t in time_steps
constraint_container[name, t] =
Expand All @@ -865,7 +880,13 @@ function _add_parameterized_upper_bound_range_constraints_impl!(
W <: AbstractDeviceFormulation,
}
time_steps = get_time_steps(container)
names = [PSY.get_name(d) for d in devices]
ts_name = get_time_series_names(model)[P]
ts_type = get_default_time_series_type(container)
names = [PSY.get_name(d) for d in devices if PSY.has_time_series(d, ts_type, ts_name)]
if isempty(names)
@debug "There are no $V devices with time series data $ts_type, $ts_name"
return
end

constraint =
add_constraints_container!(container, T(), V, names, time_steps; meta = "ub")
Expand Down
Loading
Loading