diff --git a/scripts/portfolio_test.jl b/scripts/portfolio_test.jl index a14020c..880c5ae 100644 --- a/scripts/portfolio_test.jl +++ b/scripts/portfolio_test.jl @@ -42,3 +42,4 @@ t = SupplyTechnology{ThermalStandard}( ) PSIP.add_technology!(p, t) +PSIP.remove_technology!(SupplyTechnology{ThermalStandard}, p, "thermal_tech") diff --git a/src/portfolio.jl b/src/portfolio.jl index 7b06a69..a783658 100644 --- a/src/portfolio.jl +++ b/src/portfolio.jl @@ -427,6 +427,21 @@ function remove_technology!(portfolio::Portfolio, technology::T) where {T <: Tec return end +""" +Remove a technology from the portfolio by its name. + +Throws ArgumentError if the component is not stored. +""" +function remove_technology!( + ::Type{T}, + portfolio::Portfolio, + name::AbstractString, +) where {T <: Technology} + tech = IS.remove_component!(T, portfolio.data, name) + handle_technology_removal!(portfolio, tech) + return +end + """ Throws ArgumentError if a PowerSystemsInvestmentPorfol rule blocks removal from the system. """