Skip to content

Commit

Permalink
Change name of set for air quality components in strategic model to a…
Browse files Browse the repository at this point in the history
…void name conflict with s_A for production tanks in operational model
  • Loading branch information
tarnold17 committed Sep 18, 2024
1 parent 8ffbc91 commit 0446248
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ def init_arc_param(arctype):
)

model.p_eta_TruckingEmissionsCoefficient = Param(
model.s_A,
model.s_AC,
default=0,
initialize={
a: pyunits.convert_value(
Expand All @@ -2103,7 +2103,7 @@ def init_arc_param(arctype):
)

model.p_eta_PipelineOperationsEmissionsCoefficient = Param(
model.s_A,
model.s_AC,
default=0,
initialize={
a: pyunits.convert_value(
Expand All @@ -2126,7 +2126,7 @@ def init_arc_param(arctype):
)

model.p_eta_PipelineInstallationEmissionsCoefficient = Param(
model.s_A,
model.s_AC,
default=0,
initialize={
a: pyunits.convert_value(
Expand All @@ -2143,7 +2143,7 @@ def init_arc_param(arctype):
)

model.p_eta_DisposalEmissionsCoefficient = Param(
model.s_A,
model.s_AC,
default=0,
initialize={
a: pyunits.convert_value(
Expand All @@ -2160,7 +2160,7 @@ def init_arc_param(arctype):
)

model.p_eta_StorageEmissionsCoefficient = Param(
model.s_A,
model.s_AC,
default=0,
initialize={
a: pyunits.convert_value(
Expand All @@ -2183,7 +2183,7 @@ def init_arc_param(arctype):
)
model.p_eta_TreatmentEmissionsCoefficient = Param(
model.s_WT,
model.s_A,
model.s_AC,
default=0,
initialize={
key: pyunits.convert_value(
Expand Down Expand Up @@ -2222,7 +2222,7 @@ def TotalTruckingEmissionsRule(model, a):
)

model.e_TotalTruckingEmissions = Expression(
model.s_A, rule=TotalTruckingEmissionsRule, doc="Total trucking emissions"
model.s_AC, rule=TotalTruckingEmissionsRule, doc="Total trucking emissions"
)

def TotalPipelineOperationsEmissionsRule(model, a):
Expand All @@ -2244,7 +2244,7 @@ def TotalPipelineOperationsEmissionsRule(model, a):
)

model.e_TotalPipeOperationsEmissions = Expression(
model.s_A,
model.s_AC,
rule=TotalPipelineOperationsEmissionsRule,
doc="Total pipeline operations emissions",
)
Expand All @@ -2262,7 +2262,7 @@ def TotalPipelineInstallationEmissionsRule(model, a):
)

model.e_TotalPipeInstallEmissions = Expression(
model.s_A,
model.s_AC,
rule=TotalPipelineInstallationEmissionsRule,
doc="Total pipeline installation emissions",
)
Expand All @@ -2271,7 +2271,7 @@ def TotalDisposalEmissionsRule(model, a):
return model.v_F_TotalDisposed * model.p_eta_DisposalEmissionsCoefficient[a]

model.e_TotalDisposalEmissions = Expression(
model.s_A, rule=TotalDisposalEmissionsRule, doc="Total disposal emissions"
model.s_AC, rule=TotalDisposalEmissionsRule, doc="Total disposal emissions"
)

def TotalStorageEmissionsRule(model, a):
Expand All @@ -2287,7 +2287,7 @@ def TotalStorageEmissionsRule(model, a):
)

model.e_TotalStorageEmissions = Expression(
model.s_A, rule=TotalStorageEmissionsRule, doc="Total storage emissions"
model.s_AC, rule=TotalStorageEmissionsRule, doc="Total storage emissions"
)

def TotalTreatmentEmissionsRule(model, a):
Expand All @@ -2307,7 +2307,7 @@ def TotalTreatmentEmissionsRule(model, a):
)

model.e_TotalTreatmentEmissions = Expression(
model.s_A, rule=TotalTreatmentEmissionsRule, doc="Total treatment emissions"
model.s_AC, rule=TotalTreatmentEmissionsRule, doc="Total treatment emissions"
)

def TotalEmissionsByComponentRule(model, a):
Expand All @@ -2321,13 +2321,13 @@ def TotalEmissionsByComponentRule(model, a):
)

model.e_TotalEmissionsByComponent = Expression(
model.s_A,
model.s_AC,
rule=TotalEmissionsByComponentRule,
doc="Total emissions by component",
)

model.e_TotalEmissions = Expression(
expr=sum(model.e_TotalEmissionsByComponent[a] for a in model.s_A),
expr=sum(model.e_TotalEmissionsByComponent[a] for a in model.s_AC),
doc="Total emissions [mass]",
)

Expand Down
4 changes: 2 additions & 2 deletions pareto/utilities/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def define_sets(model):
initialize=model.df_sets["TreatmentTechnologies"],
doc="Treatment Technologies",
)
model.s_A = Set(
model.s_AC = Set(
initialize=model.df_sets["AirEmissionsComponents"],
doc="Air emission components",
) # TODO change s_A to something else in strategic model to avoid name clash with production tanks in operational model
)

# Build dictionary of all specified piping arcs
piping_arc_types = get_valid_piping_arc_list(model.type)
Expand Down
2 changes: 1 addition & 1 deletion pareto/utilities/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def get_data(
Similarly, the Set for Water Quality Index "model.s_QC" is derived by the method based
on the input tab: PadWaterQuality which is indexed by QC and the Set for Air Quality Index
"model.s_AQ" is derived by the method based on the input tab AirEmissionCoefficients.
"model.s_AC" is derived by the method based on the input tab AirEmissionCoefficients.
"""
# Call _read_data with the correct model type
if model_type in ["strategic", "operational", "critical_mineral", "none"]:
Expand Down

0 comments on commit 0446248

Please sign in to comment.