From 5510a92d2d36ff2d34f74c2cd4bf0b69de68347b Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Fri, 29 Nov 2024 14:00:19 -0700 Subject: [PATCH] add method to get correct time_series_type --- src/utils/powersystems_utils.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/utils/powersystems_utils.jl b/src/utils/powersystems_utils.jl index 0d846a9e05..5d7fedf437 100644 --- a/src/utils/powersystems_utils.jl +++ b/src/utils/powersystems_utils.jl @@ -337,3 +337,22 @@ function _get_piecewise_incrementalcurve_per_system_unit( y_coords_normalized = y_coords .* system_base_power return PSY.PiecewiseStepData(x_coords_normalized, y_coords_normalized) end + +function get_deterministic_time_series_type(sys::PSY.System) + time_series_types = IS.get_time_series_counts_by_type(sys.data) + @show existing_types = Set(d["type"] for d in time_series_types) + if Set(["Deterministic", "DeterministicSingleTimeSeries"]) ∈ existing_types + error( + "The System contains a combination of forecast data and transformed time series data. Currently this is not supported.", + ) + end + if "Deterministic" ∈ existing_types + return PSY.Deterministic + elseif "DeterministicSingleTimeSeries" ∈ existing_types + return PSY.DeterministicSingleTimeSeries + else + error( + "The System does not contain any forecast data or transformed time series data.", + ) + end +end