Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions db/db_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6715,27 +6715,36 @@ CREATE TABLE results_project_carbon_emissions_by_technology_period
);


DROP TABLE IF EXISTS results_project_summary;
CREATE TABLE results_project_summary
DROP TABLE IF EXISTS results_project_period_summary;
CREATE TABLE results_project_period_summary
(
scenario_id INTEGER,
project VARCHAR(64),
weather_iteration INTEGER,
hydro_iteration INTEGER,
availability_iteration INTEGER,
subproblem_id INTEGER,
stage_id INTEGER,
capacity_type VARCHAR(64),
availability_type VARCHAR(64),
operational_type VARCHAR(64),
technology VARCHAR(32),
load_zone VARCHAR(32),
total_delivered_power FLOAT,
PRIMARY KEY (scenario_id, project, weather_iteration, hydro_iteration,
availability_iteration, subproblem_id, stage_id)
scenario_id INTEGER,
project VARCHAR(64),
period INTEGER,
weather_iteration INTEGER,
hydro_iteration INTEGER,
availability_iteration INTEGER,
subproblem_id INTEGER,
stage_id INTEGER,
capacity_type VARCHAR(64),
operational_type VARCHAR(64),
technology VARCHAR(32),
load_zone VARCHAR(32),
total_delivered_bulk_power_mwh FLOAT,
cap_factor_equivalent FLOAT,
capacity_mw FLOAT,
energy_mwh FLOAT,
hyb_gen_capacity_mw FLOAT,
hyb_stor_capacity_mw FLOAT,
stor_energy_capacity_mwh FLOAT,
fuel_prod_capacity_fuelunitperhour FLOAT,
fuel_rel_capacity_fuelunitperhour FLOAT,
fuel_stor_capacity_fuelunit FLOAT,
PRIMARY KEY (scenario_id, project, period, weather_iteration,
hydro_iteration, availability_iteration, subproblem_id,
stage_id)
);


DROP TABLE IF EXISTS results_transmission_period;
CREATE TABLE results_transmission_period
(
Expand Down
58 changes: 46 additions & 12 deletions gridpath/project/summary_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,72 @@ def export_summary_results(
m,
d,
):
"""
Export all results from the PROJECT_CAPACITY_DF and PROJECT_OPERATIONS_DF
that various modules have added to
"""
""" """

project_summary_df = pd.DataFrame(
columns=[
"project",
"period",
"capacity_type",
"availability_type",
"operational_type",
"technology",
"load_zone",
"total_delivered_power",
"total_delivered_bulk_power_mwh",
"cap_factor_equivalent",
"capacity_mw",
"energy_mwh",
"hyb_gen_capacity_mw",
"hyb_stor_capacity_mw",
"stor_energy_capacity_mwh",
"fuel_prod_capacity_fuelunitperhour",
"fuel_rel_capacity_fuelunitperhour",
"fuel_stor_capacity_fuelunit",
],
data=[
[
prj,
prd,
m.capacity_type[prj],
m.availability_type[prj],
m.operational_type[prj],
m.technology[prj],
m.load_zone[prj],
sum(
value(m.Bulk_Power_Provision_MW[_prj, tmp])
* m.hrs_in_tmp[tmp]
* m.tmp_weight[tmp]
for (_prj, tmp) in m.PRJ_OPR_TMPS
if _prj == prj
if _prj == prj and m.period[tmp] == prd
),
(
sum(
(
value(m.Bulk_Power_Provision_MW[_prj, tmp])
/ value(m.Capacity_MW[prj, prd])
)
* m.hrs_in_tmp[tmp]
* m.tmp_weight[tmp]
for (_prj, tmp) in m.PRJ_OPR_TMPS
if _prj == prj and m.period[tmp] == prd
)
/ sum(
m.hrs_in_tmp[tmp] * m.tmp_weight[tmp]
for tmp in m.TMPS_IN_PRD[prd]
)
if value(m.Capacity_MW[prj, prd]) > 0
else None
),
value(m.Capacity_MW[prj, prd]),
value(m.Energy_MWh[prj, prd]),
value(m.Hyb_Gen_Capacity_MW[prj, prd]),
value(m.Hyb_Stor_Capacity_MW[prj, prd]),
value(m.Energy_Storage_Capacity_MWh[prj, prd]),
value(m.Fuel_Production_Capacity_FuelUnitPerHour[prj, prd]),
value(m.Fuel_Release_Capacity_FuelUnitPerHour[prj, prd]),
value(m.Fuel_Storage_Capacity_FuelUnit[prj, prd]),
]
for prj in m.PROJECTS
for (prj, prd) in m.PRJ_OPR_PRDS
],
).set_index(["project"])
).set_index(["project", "period"])

project_summary_df.sort_index(inplace=True)

Expand All @@ -75,7 +109,7 @@ def export_summary_results(
subproblem,
stage,
"results",
"project_summary.csv",
"project_period_summary.csv",
),
sep=",",
index=True,
Expand Down Expand Up @@ -114,5 +148,5 @@ def import_results_into_database(
stage=stage,
quiet=quiet,
results_directory=results_directory,
which_results="project_summary",
which_results="project_period_summary",
)
Loading