Skip to content

Commit

Permalink
add checks for ts property
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Oct 13, 2024
1 parent 94e0ec3 commit d35233d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src/devices_models/devices/common/range_constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,9 @@ function lower_bound_range_with_parameter!(
jump_model = get_jump_model(container)
time_steps = axes(constraint_container)[2]
for device in devices
if !(PSY.has_time_series(device))
continue
end
name = PSY.get_name(device)
param = get_parameter_column_refs(param_container, name)
for t in time_steps
Expand All @@ -730,8 +733,11 @@ 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]

names = [PSY.get_name(d) for d in devices if PSY.has_time_series(d)]
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 @@ -842,6 +848,9 @@ function upper_bound_range_with_parameter!(
time_steps = axes(constraint_container)[2]
for device in devices
name = PSY.get_name(device)
if !(PSY.has_time_series(device))
continue
end
param = get_parameter_column_refs(param_container, name)
for t in time_steps
constraint_container[name, t] =
Expand All @@ -865,7 +874,11 @@ 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]
names = [PSY.get_name(d) for d in devices if PSY.has_time_series(d)]
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 = "ub")
Expand Down
3 changes: 3 additions & 0 deletions src/parameters/add_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ function _add_time_series_parameters!(
device_names = String[]
initial_values = Dict{String, AbstractArray}()
for device in devices
if !PSY.has_time_series(device)
continue
end
push!(device_names, PSY.get_name(device))
ts_uuid = string(IS.get_time_series_uuid(ts_type, device, ts_name))
if !(ts_uuid in keys(initial_values))
Expand Down
2 changes: 1 addition & 1 deletion src/services_models/services_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ function construct_service!(
PSY.get_name.(interfaces),
get_time_steps(container),
)
#add_feedforward_arguments!(container, model, service)
add_feedforward_arguments!(container, model, service)
return
end

Expand Down

0 comments on commit d35233d

Please sign in to comment.