Skip to content
Draft
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ missing_panics_doc = "allow"
implicit_hasher = "allow"
cast_lossless = "allow"
return_self_not_must_use = "allow"
from_iter_instead_of_collect = "allow"

[[bench]]
name = "examples"
Expand Down
12 changes: 7 additions & 5 deletions benches/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ fn calculate_seed_prices(
candidates: &[AssetRef],
writer: &mut DataWriter,
) -> Prices {
let solution_existing = DispatchRun::new(model, base_year_assets, BASE_YEAR)
let market_demands = collect_preset_demands_for_year(&model.commodities, BASE_YEAR);
let solution_existing = DispatchRun::new(model, base_year_assets, BASE_YEAR, &market_demands)
.run("bench setup: without candidates", writer)
.expect("Dispatch without candidates failed");
let solution_with_candidates = DispatchRun::new(model, base_year_assets, BASE_YEAR)
.with_candidates(candidates)
.run("bench setup: with candidates", writer)
.expect("Dispatch with candidates failed");
let solution_with_candidates =
DispatchRun::new(model, base_year_assets, BASE_YEAR, &market_demands)
.with_candidates(candidates)
.run("bench setup: with candidates", writer)
.expect("Dispatch with candidates failed");

calculate_prices(
model,
Expand Down
38 changes: 19 additions & 19 deletions examples/circularity/processes.csv
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
id,description,regions,primary_output,start_year,end_year,capacity_to_activity
GASDRV,Dry gas extraction,GBR,GASPRD,2020,,1.0
OAGRSV,Oil and associated gas extraction,GBR,OILCRD,2020,,1.0
GASPRC,Gas processing,GBR,GASNAT,2020,,1.0
OILREF,Oil refinery,GBR,DIESEL,2020,,1.0
OILRF2,O2G refinery,GBR,GASOLI,2020,,1.0
WNDFRM,Wind farm,GBR,ELCTRI,2020,,31.54
GASCGT,Gas combined cycle turbine,GBR,ELCTRI,2020,,31.54
H2YGEN,H2 turbine,GBR,ELCTRI,2020,,31.54
H2YPRO,H2 electrolyer,GBR,H2YPRD,2020,,1.0
TPETCR,Petrol car,GBR,TPASKM,2020,,1.0
TDIECR,Diesel car,GBR,TPASKM,2020,,1.0
TELCCR,Electric car,GBR,TPASKM,2020,,1.0
THYBCR,Plug-in hybrid car,GBR,TPASKM,2020,,1.0
RGASBR,Gas boiler,GBR,RSHEAT,2020,,1.0
RELCHP,Heat pump,GBR,RSHEAT,2020,,1.0
BIOPRO,Biomass production,all,BIOPRD,2020,,1.0
BIOPLL,Biomass pelletiser,all,BIOPEL,2020,,1.0
RBIOBL,Biomass boiler,all,RSHEAT,2020,,1.0
id,description,regions,primary_output,start_year,end_year,capacity_to_activity,feedback_process
GASDRV,Dry gas extraction,GBR,GASPRD,2020,,1.0,
OAGRSV,Oil and associated gas extraction,GBR,OILCRD,2020,,1.0,
GASPRC,Gas processing,GBR,GASNAT,2020,,1.0,
OILREF,Oil refinery,GBR,DIESEL,2020,,1.0,
OILRF2,O2G refinery,GBR,GASOLI,2020,,1.0,
WNDFRM,Wind farm,GBR,ELCTRI,2020,,31.54,
GASCGT,Gas combined cycle turbine,GBR,ELCTRI,2020,,31.54,
H2YGEN,H2 turbine,GBR,ELCTRI,2020,,31.54,true
H2YPRO,H2 electrolyer,GBR,H2YPRD,2020,,1.0,true
TPETCR,Petrol car,GBR,TPASKM,2020,,1.0,
TDIECR,Diesel car,GBR,TPASKM,2020,,1.0,
TELCCR,Electric car,GBR,TPASKM,2020,,1.0,
THYBCR,Plug-in hybrid car,GBR,TPASKM,2020,,1.0,
RGASBR,Gas boiler,GBR,RSHEAT,2020,,1.0,
RELCHP,Heat pump,GBR,RSHEAT,2020,,1.0,
BIOPRO,Biomass production,all,BIOPRD,2020,,1.0,
BIOPLL,Biomass pelletiser,all,BIOPEL,2020,,1.0,
RBIOBL,Biomass boiler,all,RSHEAT,2020,,1.0,
4 changes: 0 additions & 4 deletions schemas/input/model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ properties:
type: integer
description: Number of iterations to perform when calculating prices for cyclically-dependent markets
default: 1
capacity_margin:
type: number
description: Slack proportion for assets selected during cycle balancing to absorb small demand shifts
default: 0.2
mothball_years:
type: integer
default: 0
Expand Down
1 change: 1 addition & 0 deletions src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ pub fn process(
capacity_to_activity: ActivityPerCapacity(1.0),
investment_constraints: process_investment_constraints,
tranche_size: None,
feedback_process: false,
}
}

Expand Down
31 changes: 24 additions & 7 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::io::Write as IoWrite;
use std::path::Path;
use std::sync::Arc;

pub mod feedback_suggest;
pub mod investment;
pub mod validate;

Expand Down Expand Up @@ -41,11 +42,21 @@ pub enum GraphNode {
/// An edge in the commodity graph
pub enum GraphEdge {
/// An edge representing a primary flow of a process
#[display("{_0}")]
Primary(ProcessID),
#[display("{process_id}")]
Primary {
/// The process responsible for the flow.
process_id: ProcessID,
/// Whether the process participates in a feedback conversion.
feedback: bool,
},
/// An edge representing a secondary (non-primary) flow of a process
#[display("{_0}")]
Secondary(ProcessID),
#[display("{process_id}")]
Secondary {
/// The process responsible for the flow.
process_id: ProcessID,
/// Whether the process participates in a feedback conversion.
feedback: bool,
},
/// An edge representing a service demand
#[display("DEMAND")]
Demand,
Expand Down Expand Up @@ -150,9 +161,15 @@ fn create_commodities_graph_for_region_year(
source_node_index,
target_node_index,
if is_primary {
GraphEdge::Primary(process.id.clone())
GraphEdge::Primary {
process_id: process.id.clone(),
feedback: process.feedback_process,
}
} else {
GraphEdge::Secondary(process.id.clone())
GraphEdge::Secondary {
process_id: process.id.clone(),
feedback: process.feedback_process,
}
},
);
}
Expand Down Expand Up @@ -181,7 +198,7 @@ pub fn build_commodity_graphs_for_model(
fn get_edge_attributes(_: &CommoditiesGraph, edge_ref: EdgeReference<GraphEdge>) -> String {
match edge_ref.weight() {
// Use dashed lines for secondary flows
GraphEdge::Secondary(_) => "style=dashed".to_string(),
GraphEdge::Secondary { .. } => "style=dashed".to_string(),
// Other edges use default attributes
_ => String::new(),
}
Expand Down
Loading
Loading