Skip to content

Commit

Permalink
Use cached time series UUID
Browse files Browse the repository at this point in the history
This code was consuming a lot of time to lookup time series UUIDs when
those values are already cached.
  • Loading branch information
daniel-thom committed Oct 30, 2024
1 parent 59ee821 commit 1bbe274
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/parameters/update_container_parameter_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function _update_parameter_values!(
components = get_available_components(device_model, get_system(model))
ts_uuids = Set{String}()
for component in components
ts_uuid = string(IS.get_time_series_uuid(U, component, ts_name))
ts_uuid = _get_ts_uuid(attributes, PSY.get_name(component))
if !(ts_uuid in ts_uuids)
ts_vector = get_time_series_values!(
U,
Expand Down Expand Up @@ -87,7 +87,7 @@ function _update_parameter_values!(
initial_forecast_time = get_current_time(model) # Function not well defined for DecisionModels
horizon = get_time_steps(get_optimization_container(model))[end]
ts_name = get_time_series_name(attributes)
ts_uuid = string(IS.get_time_series_uuid(U, service, ts_name))
ts_uuid = _get_ts_uuid(attributes, PSY.get_name(service))

Check warning on line 90 in src/parameters/update_container_parameter_values.jl

View check run for this annotation

Codecov / codecov/patch

src/parameters/update_container_parameter_values.jl#L90

Added line #L90 was not covered by tests
ts_vector = get_time_series_values!(
U,
model,
Expand Down Expand Up @@ -120,7 +120,7 @@ function _update_parameter_values!(
ts_name = get_time_series_name(attributes)
ts_uuids = Set{String}()
for component in components
ts_uuid = string(IS.get_time_series_uuid(U, component, ts_name))
ts_uuid = _get_ts_uuid(attributes, PSY.get_name(component))
if !(ts_uuid in ts_uuids)
# Note: This interface reads one single value per component at a time.
value = get_time_series_values!(
Expand Down

0 comments on commit 1bbe274

Please sign in to comment.