Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Sep 16, 2024
1 parent 1ae085b commit 7d916a4
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 367 deletions.
10 changes: 5 additions & 5 deletions src/PowerSystemsInvestments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ include("utils/mpi_utils.jl")
include("base/definitions.jl")

include("base/abstract_formulation_types.jl")
include("capital/capital_formulations.jl")
include("operation/operation_formulations.jl")
include("feasibility/feasibility_formulations.jl")
include("capital/technology_capital_formulations.jl")
include("capital/capital_models.jl")
include("operation/technology_operation_formulations.jl")
include("operation/feasibility_model.jl")
include("operation/operation_model.jl")
include("base/transport_model.jl")
include("base/constraints.jl")
include("base/variables.jl")
include("base/expressions.jl")
include("base/parameters.jl")
include("base/settings.jl")
include("base/solution_algorithms.jl")
#include("base/operation_model.jl")
#include("base/feasibility_model.jl")
include("base/technology_model.jl")
include("base/investment_model_template.jl")

Expand Down
4 changes: 2 additions & 2 deletions src/base/abstract_formulation_types.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
abstract type AbstractTechnologyFormulation end

abstract type InvestmentTechnologyFormulation <: AbstractTechnologyFormulation end
abstract type TechnologyOperationsFormulation <: AbstractTechnologyFormulation end
abstract type TechnologyFeasibilityFormulation <: AbstractTechnologyFormulation end
abstract type OperationsTechnologyFormulation <: AbstractTechnologyFormulation end
abstract type FeasibilityTechnologyFormulation <: AbstractTechnologyFormulation end
13 changes: 10 additions & 3 deletions src/base/investment_model_template.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ mutable struct InvestmentModelTemplate <: AbstractInvestmentModelTemplate
capital_model::CapitalCostModel
operation_model::OperationCostModel
transport_model::TransportModel{<:AbstractTransportModel}
technology_models::TechnologiesModelContainer
technology_models::Dict # Type to be refined later

function InvestmentModelTemplate(
transport::TransportModel{T},
capital_model::CapitalCostModel,
operation_model::OperationCostModel,
transport_model::TransportModel{T}
) where {T <: AbstractTransportModel}
new(transport, TechnologiesModelContainer())
new(
capital_model,
operation_model,
transport_model,
Dict()
)
end
end

Expand Down
304 changes: 2 additions & 302 deletions src/base/technology_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,310 +91,10 @@ function TechnologyModel(
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.ThermalStandard},
D <: PSIP.SupplyTechnology{T},
B <: ContinuousInvestment,
C <: BasicDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.ThermalStandard},
B <: IntegerInvestment,
C <: BasicDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.RenewableDispatch},
B <: ContinuousInvestment,
C <: BasicDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.RenewableDispatch},
B <: IntegerInvestment,
C <: BasicDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.ThermalStandard},
B <: ContinuousInvestment,
C <: ThermalNoDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.ThermalStandard},
B <: IntegerInvestment,
C <: ThermalNoDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.RenewableDispatch},
B <: ContinuousInvestment,
C <: RenewableNoDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.SupplyTechnology{PSY.RenewableDispatch},
B <: IntegerInvestment,
C <: RenewableNoDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

#Move to different file later
function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.DemandRequirement{PSY.PowerLoad},
B <: StaticLoadInvestment,
C <: BasicDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
duals=Vector{DataType}(),
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.StorageTechnology{PSY.EnergyReservoirStorage},
B <: ContinuousInvestment,
C <: BasicDispatch,
}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
end

_check_technology_formulation(D, B, C)
#TODO: new is only defined for inner constructors, replace for now but we might want to reorganize this file later
#new{D, B, C}(use_slacks, duals, time_series_names, attributes_, nothing)
return TechnologyModel{D, B, C}(
use_slacks,
duals,
time_series_names,
attributes_,
nothing,
)
end

function TechnologyModel(
::Type{D},
::Type{B},
::Type{C};
use_slacks=false,
time_series_names=get_default_time_series_names(D, B, C),
attributes=Dict{String, Any}(),
) where {
D <: PSIP.StorageTechnology{PSY.EnergyReservoirStorage},
B <: IntegerInvestment,
C <: BasicDispatch,
}
} where {T <: PSY.StaticInjection}
attributes_ = get_default_attributes(D, B, C)
for (k, v) in attributes
attributes_[k] = v
Expand Down
27 changes: 1 addition & 26 deletions src/investment_model/investment_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,5 @@ function InvestmentModel(
check_numerical_bounds=check_numerical_bounds,
store_variable_names=store_variable_names,
)
return DecisionModel(template, sys, settings, jump_model; name=name)
end

function InvestmentModel(
::Type{I},
::Type{S},
template::AbstractInvestmentModelTemplate,
portfolio::PSIP.Portfolio,
jump_model::Union{Nothing, JuMP.Model}=nothing;
kwargs...,
) where {I <: InvestmentModel, S <: SolutionAlgorithm}
return InvestmentModel{I, S}(template, portfolio, jump_model; kwargs...)
end

function InvestmentModel(
template::AbstractInvestmentModelTemplate,
portfolio::PSIP.Portfolio,
jump_model::Union{Nothing, JuMP.Model}=nothing;
kwargs...,
)
return InvestmentModel{GenericCapacityExpansion, SingleInstanceSolve}(
template,
portfolio,
jump_model;
kwargs...,
)
return InvestmentModel(template, sys, settings, jump_model; name=name)
end
File renamed without changes.
Loading

0 comments on commit 7d916a4

Please sign in to comment.