From 1085b0dfb8a8889a8dd3bca5bae930305ac0e37e Mon Sep 17 00:00:00 2001 From: sourabhdalvi Date: Tue, 15 Feb 2022 09:04:37 -0700 Subject: [PATCH 1/4] adding formatter changes --- src/models/static_injection_subsystem.jl | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/models/static_injection_subsystem.jl b/src/models/static_injection_subsystem.jl index 5a1596f8f1..974410ae77 100644 --- a/src/models/static_injection_subsystem.jl +++ b/src/models/static_injection_subsystem.jl @@ -16,25 +16,37 @@ function copy_subcomponent_time_series!( subsystem::StaticInjectionSubsystem, subcomponent::Component, ) - existing_ts = Set((typeof(x), get_name(x)) for x in get_time_series_multiple(subsystem)) - name_mapping = Dict{String, String}() + existing_ts = Set( + (typeof(ts), get_name(ts_m)) for + (ts, ts_m) in IS.get_time_series_with_metadata_multiple(subsystem) + ) + name_mapping = Dict{Tuple{String, String}, String}() + device_name = get_name(subcomponent) for ts in get_time_series_multiple(subcomponent) name = get_name(ts) key = (typeof(ts), name) if !(key in existing_ts) new_name = make_subsystem_time_series_name(subcomponent, ts) if name in keys(name_mapping) - IS.@assert_op new_name == name_mapping[name] + IS.@assert_op new_name == name_mapping[(device_name, name)] continue end - name_mapping[name] = new_name + name_mapping[(device_name, name)] = new_name end end - copy_time_series!(subsystem, subcomponent, name_mapping = name_mapping) + IS.copy_time_series!(subsystem, subcomponent, name_mapping = name_mapping) @info "Copied time series from $(summary(subcomponent)) to $(summary(subsystem))" end function make_subsystem_time_series_name(subcomponent::Component, ts::TimeSeriesData) - return IS.strip_module_name(typeof(subcomponent)) * "__" * get_name(ts) + return make_subsystem_time_series_name(typeof(subcomponent), get_name(ts)) +end + +function make_subsystem_time_series_name(subcomponent::Component, label::String) + return make_subsystem_time_series_name(typeof(subcomponent), label) +end + +function make_subsystem_time_series_name(subcomponent::Type{<:Component}, label::String) + return IS.strip_module_name(subcomponent) * "__" * label end From 3b28f25eb8d1487965c11d762b1dba98b5833a9d Mon Sep 17 00:00:00 2001 From: sourabhdalvi Date: Tue, 15 Feb 2022 12:38:17 -0700 Subject: [PATCH 2/4] adding comment on possible future issue --- src/models/static_injection_subsystem.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/models/static_injection_subsystem.jl b/src/models/static_injection_subsystem.jl index 974410ae77..b695d28ac8 100644 --- a/src/models/static_injection_subsystem.jl +++ b/src/models/static_injection_subsystem.jl @@ -16,6 +16,9 @@ function copy_subcomponent_time_series!( subsystem::StaticInjectionSubsystem, subcomponent::Component, ) + # the existing_ts can remove entreis from the set if the Subsystem has two device of + # the same type with the same time series type and label. Currently in the HybridSystem + # use case there can only be one devoe of each type. existing_ts = Set( (typeof(ts), get_name(ts_m)) for (ts, ts_m) in IS.get_time_series_with_metadata_multiple(subsystem) From 6523ec133aed0e20cea9c7c3094902068be40d05 Mon Sep 17 00:00:00 2001 From: sourabhdalvi Date: Tue, 15 Feb 2022 12:50:49 -0700 Subject: [PATCH 3/4] increasing the compact version of IS --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 10a5cff298..049e468ce0 100644 --- a/Project.toml +++ b/Project.toml @@ -24,7 +24,7 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" CSV = "~0.9, 0.10" DataFrames = "1" DocStringExtensions = "~0.8.2" -InfrastructureSystems = "^1.16" +InfrastructureSystems = "^1.17" JSON3 = "1" NLsolve = "4" PrettyTables = "1.2" From c0f8fea53dd9d00fce28b8d410eff5ab3b58fdfd Mon Sep 17 00:00:00 2001 From: sourabhdalvi Date: Wed, 16 Feb 2022 11:04:09 -0700 Subject: [PATCH 4/4] fixing a typo --- src/models/static_injection_subsystem.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/static_injection_subsystem.jl b/src/models/static_injection_subsystem.jl index b695d28ac8..8d1e9a5541 100644 --- a/src/models/static_injection_subsystem.jl +++ b/src/models/static_injection_subsystem.jl @@ -16,7 +16,7 @@ function copy_subcomponent_time_series!( subsystem::StaticInjectionSubsystem, subcomponent::Component, ) - # the existing_ts can remove entreis from the set if the Subsystem has two device of + # the existing_ts can remove entries from the set if the Subsystem has two device of # the same type with the same time series type and label. Currently in the HybridSystem # use case there can only be one devoe of each type. existing_ts = Set(