Skip to content

Commit

Permalink
Transmission targets (#994)
Browse files Browse the repository at this point in the history
Co-authored-by: AmyotJ <janie.amyot@ec.gc.ca>
  • Loading branch information
anamileva and Janie115 authored Mar 29, 2023
1 parent f33b795 commit 3ad07e7
Show file tree
Hide file tree
Showing 167 changed files with 4,537 additions and 569 deletions.
3 changes: 3 additions & 0 deletions db/csvs_test_examples/csv_data_master.csv
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ policy/energy_targets/period_targets,energy_target,period_energy_target_scenario
policy/energy_targets/period_targets,energy_target,period_energy_target_scenario_id,system_period_energy_target_load_zone_map,dir_aux,,0,0,load_zone_mapping.csv,,,
policy/energy_targets/horizon_targets,energy_target,horizon_energy_target_scenario_id,system_horizon_energy_targets,dir_main,,0,0,targets.csv,,,
policy/energy_targets/horizon_targets,energy_target,horizon_energy_target_scenario_id,system_horizon_energy_target_load_zone_map,dir_aux,,0,0,load_zone_mapping.csv,,,
policy/transmission_targets/zones,transmission_target,transmission_target_zone_scenario_id,geography_transmission_target_zones,simple,,0,0,,,,
policy/transmission_targets/tx_line_zones,transmission_target,tx_line_transmission_target_zone_scenario_id,tx_line_transmission_target_zones,simple,,0,0,,,,
policy/transmission_targets/period_targets,transmission_target,period_transmission_target_scenario_id,system_period_transmission_targets,simple,,0,0,,,,
policy/carbon_cap/geography_carbon_cap_zones,carbon_cap,carbon_cap_zone_scenario_id,geography_carbon_cap_zones,simple,,0,0,,,,
policy/carbon_cap/project_carbon_cap_zones,carbon_cap,project_carbon_cap_zone_scenario_id,project_carbon_cap_zones,simple,,0,0,,,,
policy/carbon_cap/system_carbon_cap_targets,carbon_cap,carbon_cap_target_scenario_id,system_carbon_cap_targets,simple,,0,0,,,,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
transmission_target_zone,subproblem_id,stage_id,period,transmission_target_positive_direction_mwh,transmission_target_negative_direction_mwh
TxTargetZone1,1,1,2020,,2
TxTargetZone1,1,1,2030,,2
TxTargetZone2,1,1,2020,2,
TxTargetZone2,1,1,2030,2,
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
transmission_line,transmission_target_zone
Tx1,TxTargetZone1
Tx2,TxTargetZone2
Tx3,TxTargetZone2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
transmission_target_zone,allow_violation,violation_penalty_per_mwh
TxTargetZone1,0,0
TxTargetZone2,0,0
230 changes: 117 additions & 113 deletions db/csvs_test_examples/scenarios.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
transmission_line,operational_type,tx_simple_loss_factor,reactance_ohms
Tx1,tx_simple_binary,,
Tx_new,tx_simple_binary,,
Tx2,tx_simple_binary,,
Tx3,tx_simple_binary,,
Tx2_new,tx_simple_binary,,
5 changes: 4 additions & 1 deletion db/data/mod_tx_operational_types.csv
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
operational_type,descriptiontx_simple,tx_dcopf,
operational_type,description
tx_simple,
tx_dcopf,
tx_simple_binary,
117 changes: 117 additions & 0 deletions db/db_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,27 @@ FOREIGN KEY (energy_target_zone_scenario_id) REFERENCES
subscenarios_geography_energy_target_zones (energy_target_zone_scenario_id)
);

-- Transmission target
-- This is the unit at which transmission target requirements are met in the model; it can be
-- different from the load zones
DROP TABLE IF EXISTS subscenarios_geography_transmission_target_zones;
CREATE TABLE subscenarios_geography_transmission_target_zones (
transmission_target_zone_scenario_id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(32),
description VARCHAR(128)
);

DROP TABLE IF EXISTS inputs_geography_transmission_target_zones;
CREATE TABLE inputs_geography_transmission_target_zones (
transmission_target_zone_scenario_id INTEGER,
transmission_target_zone VARCHAR(32),
allow_violation INTEGER DEFAULT 0, -- constraint is hard by default
violation_penalty_per_mwh FLOAT DEFAULT 0,
PRIMARY KEY (transmission_target_zone_scenario_id, transmission_target_zone),
FOREIGN KEY (transmission_target_zone_scenario_id) REFERENCES
subscenarios_geography_transmission_target_zones (transmission_target_zone_scenario_id)
);

-- Carbon cap
-- This is the unit at which the carbon cap is applied in the model; it can be
-- different from the load zones
Expand Down Expand Up @@ -1501,6 +1522,28 @@ FOREIGN KEY (project_energy_target_zone_scenario_id) REFERENCES
subscenarios_project_energy_target_zones (project_energy_target_zone_scenario_id)
);

-- Tx line transmission target zones
-- Which tx lines can contribute to transmission target requirements
-- Depends on how transmission target zones are specified
-- This table can include all tx line with NULLs for tx lines not
-- contributing or just the contributing tx lines
DROP TABLE IF EXISTS subscenarios_tx_line_transmission_target_zones;
CREATE TABLE subscenarios_tx_line_transmission_target_zones (
tx_line_transmission_target_zone_scenario_id INTEGER PRIMARY KEY,
name VARCHAR(32),
description VARCHAR(128)
);

DROP TABLE IF EXISTS inputs_tx_line_transmission_target_zones;
CREATE TABLE inputs_tx_line_transmission_target_zones (
tx_line_transmission_target_zone_scenario_id INTEGER,
transmission_line VARCHAR(64),
transmission_target_zone VARCHAR(32),
PRIMARY KEY (tx_line_transmission_target_zone_scenario_id, transmission_line),
FOREIGN KEY (tx_line_transmission_target_zone_scenario_id) REFERENCES
subscenarios_tx_line_transmission_target_zones (tx_line_transmission_target_zone_scenario_id)
);

-- Project carbon cap zones
-- Which projects count toward the carbon cap
-- Depends on carbon cap zone geography
Expand Down Expand Up @@ -2825,6 +2868,31 @@ PRIMARY KEY (horizon_energy_target_scenario_id, energy_target_zone, load_zone)
);


-- Transmission target requirements
-- By period
DROP TABLE IF EXISTS subscenarios_system_period_transmission_targets;
CREATE TABLE subscenarios_system_period_transmission_targets (
period_transmission_target_scenario_id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(32),
description VARCHAR(128)
);

-- Can include periods and zones other than the ones in a scenario, as correct
-- periods and zones will be pulled depending on temporal_scenario_id and
-- transmission_target_zone_scenario_id
DROP TABLE IF EXISTS inputs_system_period_transmission_targets;
CREATE TABLE inputs_system_period_transmission_targets (
period_transmission_target_scenario_id INTEGER,
transmission_target_zone VARCHAR(32),
subproblem_id INTEGER,
stage_id INTEGER,
period INTEGER,
transmission_target_positive_direction_mwh FLOAT,
transmission_target_negative_direction_mwh FLOAT,
PRIMARY KEY (period_transmission_target_scenario_id, transmission_target_zone,
subproblem_id, stage_id, period)
);

-- Carbon cap
DROP TABLE IF EXISTS subscenarios_system_carbon_cap_targets;
CREATE TABLE subscenarios_system_carbon_cap_targets (
Expand Down Expand Up @@ -3058,6 +3126,7 @@ of_frequency_response INTEGER,
of_spinning_reserves INTEGER,
of_period_energy_target INTEGER,
of_horizon_energy_target INTEGER,
of_period_transmission_target INTEGER,
of_carbon_cap INTEGER,
of_track_carbon_imports INTEGER,
of_carbon_tax INTEGER,
Expand All @@ -3080,6 +3149,7 @@ regulation_down_ba_scenario_id INTEGER,
frequency_response_ba_scenario_id INTEGER,
spinning_reserves_ba_scenario_id INTEGER,
energy_target_zone_scenario_id INTEGER,
transmission_target_zone_scenario_id INTEGER,
carbon_cap_zone_scenario_id INTEGER,
carbon_tax_zone_scenario_id INTEGER,
performance_standard_zone_scenario_id INTEGER,
Expand All @@ -3099,6 +3169,7 @@ project_regulation_down_ba_scenario_id INTEGER,
project_frequency_response_ba_scenario_id INTEGER,
project_spinning_reserves_ba_scenario_id INTEGER,
project_energy_target_zone_scenario_id INTEGER,
tx_line_transmission_target_zone_scenario_id INTEGER,
project_carbon_cap_zone_scenario_id INTEGER,
project_carbon_tax_zone_scenario_id INTEGER,
project_carbon_tax_allowance_scenario_id INTEGER,
Expand Down Expand Up @@ -3147,6 +3218,7 @@ frequency_response_scenario_id INTEGER,
spinning_reserves_scenario_id INTEGER,
period_energy_target_scenario_id INTEGER,
horizon_energy_target_scenario_id INTEGER,
period_transmission_target_scenario_id INTEGER,
carbon_cap_target_scenario_id INTEGER,
carbon_tax_scenario_id INTEGER,
performance_standard_scenario_id INTEGER,
Expand Down Expand Up @@ -3181,6 +3253,8 @@ FOREIGN KEY (spinning_reserves_ba_scenario_id) REFERENCES
subscenarios_geography_spinning_reserves_bas (spinning_reserves_ba_scenario_id),
FOREIGN KEY (energy_target_zone_scenario_id) REFERENCES
subscenarios_geography_energy_target_zones (energy_target_zone_scenario_id),
FOREIGN KEY (transmission_target_zone_scenario_id) REFERENCES
subscenarios_geography_transmission_target_zones (transmission_target_zone_scenario_id),
FOREIGN KEY (carbon_cap_zone_scenario_id) REFERENCES
subscenarios_geography_carbon_cap_zones (carbon_cap_zone_scenario_id),
FOREIGN KEY (carbon_tax_zone_scenario_id) REFERENCES
Expand Down Expand Up @@ -3229,6 +3303,9 @@ FOREIGN KEY (project_spinning_reserves_ba_scenario_id) REFERENCES
FOREIGN KEY (project_energy_target_zone_scenario_id) REFERENCES
subscenarios_project_energy_target_zones
(project_energy_target_zone_scenario_id),
FOREIGN KEY (tx_line_transmission_target_zone_scenario_id) REFERENCES
subscenarios_tx_line_transmission_target_zones
(tx_line_transmission_target_zone_scenario_id),
FOREIGN KEY (project_carbon_cap_zone_scenario_id) REFERENCES
subscenarios_project_carbon_cap_zones
(project_carbon_cap_zone_scenario_id),
Expand Down Expand Up @@ -3347,6 +3424,9 @@ FOREIGN KEY (period_energy_target_scenario_id) REFERENCES
FOREIGN KEY (horizon_energy_target_scenario_id) REFERENCES
subscenarios_system_horizon_energy_targets
(horizon_energy_target_scenario_id),
FOREIGN KEY (period_transmission_target_scenario_id) REFERENCES
subscenarios_system_period_transmission_targets
(period_transmission_target_scenario_id),
FOREIGN KEY (carbon_cap_target_scenario_id) REFERENCES
subscenarios_system_carbon_cap_targets (carbon_cap_target_scenario_id),
FOREIGN KEY (carbon_tax_scenario_id) REFERENCES
Expand Down Expand Up @@ -4001,6 +4081,21 @@ subhourly_curtailment_mw FLOAT,
PRIMARY KEY (scenario_id, project, subproblem_id, stage_id, timepoint)
);

CREATE TABLE results_tx_line_period_transmission_target (
scenario_id INTEGER,
transmission_line VARCHAR(64),
period INTEGER,
subproblem_id INTEGER,
stage_id INTEGER,
timepoint INTEGER,
timepoint_weight FLOAT,
number_of_hours_in_timepoint FLOAT,
transmission_target_zone VARCHAR(32),
transmission_target_energy_positive_direction_mw FLOAT,
transmission_target_energy_negative_direction_mw FLOAT,
PRIMARY KEY (scenario_id, transmission_line, subproblem_id, stage_id, timepoint)
);

DROP TABLE IF EXISTS results_transmission_capacity;
CREATE TABLE results_transmission_capacity (
scenario_id INTEGER,
Expand Down Expand Up @@ -4469,6 +4564,27 @@ PRIMARY KEY (scenario_id, energy_target_zone, subproblem_id, stage_id,
balancing_type_horizon, horizon)
);

-- Transmission target balance
DROP TABLE IF EXISTS results_system_period_transmission_target;
CREATE TABLE results_system_period_transmission_target (
scenario_id INTEGER,
transmission_target_zone VARCHAR(64),
subproblem_id INTEGER,
stage_id INTEGER,
period INTEGER,
discount_factor FLOAT,
number_years_represented FLOAT,
transmission_target_positive_direction_mwh FLOAT,
total_transmission_target_energy_positive_direction_mwh FLOAT,
fraction_of_transmission_target_positive_direction_met FLOAT,
transmission_target_shortage_positive_direction_mwh FLOAT,
transmission_target_negative_direction_mwh FLOAT,
total_transmission_target_energy_negative_direction_mwh FLOAT,
fraction_of_transmission_target_negative_direction_met FLOAT,
transmission_target_shortage_negative_direction_mwh FLOAT,
PRIMARY KEY (scenario_id, transmission_target_zone, period, subproblem_id, stage_id)
);

-- Fuel burn limits
DROP TABLE IF EXISTS results_system_fuel_burn_limits;
CREATE TABLE results_system_fuel_burn_limits (
Expand Down Expand Up @@ -4597,6 +4713,7 @@ Total_Carbon_Tax_Cost FLOAT,
Total_Performance_Standard_Balance_Penalty_Costs Float,
Total_Period_Energy_Target_Balance_Penalty_Costs FLOAT,
Total_Horizon_Energy_Target_Balance_Penalty_Costs FLOAT,
Total_Period_Transmission_Target_Balance_Penalty_Costs FLOAT,
Total_Dynamic_ELCC_Tuning_Cost Float,
Total_Import_Carbon_Tuning_Cost Float,
Total_Market_Net_Cost FLOAT,
Expand Down
4 changes: 4 additions & 0 deletions examples/2horizons/scenario_description.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ of_frequency_response,
of_spinning_reserves,
of_period_energy_target,
of_horizon_energy_target,
of_period_transmission_target,
of_carbon_cap,
of_track_carbon_imports,
of_carbon_tax,
Expand All @@ -33,6 +34,7 @@ regulation_down_ba_scenario_id,1
frequency_response_ba_scenario_id,NULL
spinning_reserves_ba_scenario_id,NULL
energy_target_zone_scenario_id,NULL
transmission_target_zone_scenario_id,NULL
carbon_cap_zone_scenario_id,NULL
carbon_tax_zone_scenario_id,NULL
performance_standard_zone_scenario_id,NULL
Expand All @@ -52,6 +54,7 @@ project_regulation_down_ba_scenario_id,1
project_frequency_response_ba_scenario_id,NULL
project_spinning_reserves_ba_scenario_id,NULL
project_energy_target_zone_scenario_id,NULL
tx_line_transmission_target_zone_scenario_id,NULL
project_carbon_cap_zone_scenario_id,NULL
project_carbon_tax_zone_scenario_id,NULL
project_carbon_tax_allowance_scenario_id,NULL
Expand Down Expand Up @@ -100,6 +103,7 @@ frequency_response_scenario_id,NULL
spinning_reserves_scenario_id,NULL
period_energy_target_scenario_id,NULL
horizon_energy_target_scenario_id,NULL
period_transmission_target_scenario_id,NULL
carbon_cap_target_scenario_id,NULL
carbon_tax_scenario_id,NULL
performance_standard_scenario_id,NULL
Expand Down
4 changes: 4 additions & 0 deletions examples/2horizons_w_hydro/scenario_description.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ of_frequency_response,
of_spinning_reserves,
of_period_energy_target,
of_horizon_energy_target,
of_period_transmission_target,
of_carbon_cap,
of_track_carbon_imports,
of_carbon_tax,
Expand All @@ -33,6 +34,7 @@ regulation_down_ba_scenario_id,1
frequency_response_ba_scenario_id,NULL
spinning_reserves_ba_scenario_id,NULL
energy_target_zone_scenario_id,NULL
transmission_target_zone_scenario_id,NULL
carbon_cap_zone_scenario_id,NULL
carbon_tax_zone_scenario_id,NULL
performance_standard_zone_scenario_id,NULL
Expand All @@ -52,6 +54,7 @@ project_regulation_down_ba_scenario_id,1
project_frequency_response_ba_scenario_id,NULL
project_spinning_reserves_ba_scenario_id,NULL
project_energy_target_zone_scenario_id,NULL
tx_line_transmission_target_zone_scenario_id,NULL
project_carbon_cap_zone_scenario_id,NULL
project_carbon_tax_zone_scenario_id,NULL
project_carbon_tax_allowance_scenario_id,NULL
Expand Down Expand Up @@ -100,6 +103,7 @@ frequency_response_scenario_id,NULL
spinning_reserves_scenario_id,NULL
period_energy_target_scenario_id,NULL
horizon_energy_target_scenario_id,NULL
period_transmission_target_scenario_id,NULL
carbon_cap_target_scenario_id,NULL
carbon_tax_scenario_id,NULL
performance_standard_scenario_id,NULL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ of_frequency_response,
of_spinning_reserves,
of_period_energy_target,
of_horizon_energy_target,
of_period_transmission_target,
of_carbon_cap,
of_track_carbon_imports,
of_carbon_tax,
Expand All @@ -33,6 +34,7 @@ regulation_down_ba_scenario_id,1
frequency_response_ba_scenario_id,NULL
spinning_reserves_ba_scenario_id,NULL
energy_target_zone_scenario_id,NULL
transmission_target_zone_scenario_id,NULL
carbon_cap_zone_scenario_id,NULL
carbon_tax_zone_scenario_id,NULL
performance_standard_zone_scenario_id,NULL
Expand All @@ -52,6 +54,7 @@ project_regulation_down_ba_scenario_id,1
project_frequency_response_ba_scenario_id,NULL
project_spinning_reserves_ba_scenario_id,NULL
project_energy_target_zone_scenario_id,NULL
tx_line_transmission_target_zone_scenario_id,NULL
project_carbon_cap_zone_scenario_id,NULL
project_carbon_tax_zone_scenario_id,NULL
project_carbon_tax_allowance_scenario_id,NULL
Expand Down Expand Up @@ -100,6 +103,7 @@ frequency_response_scenario_id,NULL
spinning_reserves_scenario_id,NULL
period_energy_target_scenario_id,NULL
horizon_energy_target_scenario_id,NULL
period_transmission_target_scenario_id,NULL
carbon_cap_target_scenario_id,NULL
carbon_tax_scenario_id,NULL
performance_standard_scenario_id,NULL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ of_frequency_response,
of_spinning_reserves,
of_period_energy_target,
of_horizon_energy_target,
of_period_transmission_target,
of_carbon_cap,
of_track_carbon_imports,
of_carbon_tax,
Expand All @@ -33,6 +34,7 @@ regulation_down_ba_scenario_id,1
frequency_response_ba_scenario_id,NULL
spinning_reserves_ba_scenario_id,NULL
energy_target_zone_scenario_id,NULL
transmission_target_zone_scenario_id,NULL
carbon_cap_zone_scenario_id,NULL
carbon_tax_zone_scenario_id,NULL
performance_standard_zone_scenario_id,NULL
Expand All @@ -52,6 +54,7 @@ project_regulation_down_ba_scenario_id,1
project_frequency_response_ba_scenario_id,NULL
project_spinning_reserves_ba_scenario_id,NULL
project_energy_target_zone_scenario_id,NULL
tx_line_transmission_target_zone_scenario_id,NULL
project_carbon_cap_zone_scenario_id,NULL
project_carbon_tax_zone_scenario_id,NULL
project_carbon_tax_allowance_scenario_id,NULL
Expand Down Expand Up @@ -100,6 +103,7 @@ frequency_response_scenario_id,NULL
spinning_reserves_scenario_id,NULL
period_energy_target_scenario_id,NULL
horizon_energy_target_scenario_id,NULL
period_transmission_target_scenario_id,NULL
carbon_cap_target_scenario_id,NULL
carbon_tax_scenario_id,NULL
performance_standard_scenario_id,NULL
Expand Down
Loading

0 comments on commit 3ad07e7

Please sign in to comment.