Skip to content

Commit 5c55065

Browse files
authored
Merge pull request #609 from EnergySystemsModellingLab/renaming-for-new-model
Renaming for new model
2 parents bbef385 + 5eb91cf commit 5c55065

14 files changed

Lines changed: 117 additions & 116 deletions

File tree

docs/generate_input_format_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"Regions": ["regions"],
1414
"Agents": ["agents", "agent_*"],
1515
"Assets": ["assets"],
16-
"Commodities": ["commodities", "commodity_costs", "demand", "demand_slicing"],
16+
"Commodities": ["commodities", "commodity_levies", "demand", "demand_slicing"],
1717
"Processes": ["processes", "process_*"],
1818
}
1919

docs/glossary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ capacity can produce 31.536 PJ energy output in a year.
4141
produced and/or consumed by *Process*es* in the model. A *Service Demand* is a type of commodity
4242
that is defined at the end point of the system.
4343

44-
**Commodity Cost:** Represents a tax, levy or other external cost on a commodity. Commodity costs
45-
can be applied to all commodity production (sum of output of all processes for that commodity), net
44+
**Commodity Levy:** Represents a tax, levy or other external cost on a commodity. Levies can be
45+
applied to all commodity production (sum of output of all processes for that commodity), net
4646
production (sum of output and input for all processes), or all consumption (sum of input for all
4747
processes). It can also be negative, indicating an incentive on commodity
4848
production/consumption/net.

examples/simple/process_flows.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
process_id,commodity_id,regions,years,flow,flow_type,flow_cost,is_pac
1+
process_id,commodity_id,regions,years,coeff,type,cost,is_pac
22
GASDRV,GASPRD,all,all,1.0,fixed,,true
33
GASPRC,GASPRD,all,all,-1.05,fixed,,false
44
GASPRC,GASNAT,all,all,1.0,fixed,,true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
title: Commodity costs
1+
title: Commodity levies
22
description: |
33
Defines levies for commodities (or, if `value` is negative, incentives).
44
@@ -31,4 +31,4 @@ fields:
3131
`net` (applies to consumption and production)
3232
- name: value
3333
type: number
34-
title: The value of the commodity cost
34+
title: The value of the levy/incentive

schemas/input/process_flows.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ fields:
2323
type: string
2424
title: The year(s) to which this entry applies
2525
description: One or more milestone years separated by semicolons or `all`
26-
- name: flow
26+
- name: coeff
2727
type: number
2828
title: The flow for this commodity
2929
description: |
3030
Can be <0, indicating an input flow, or >0, indicating an output flow. Cannot be zero.
31-
- name: flow_type
31+
- name: type
3232
type: string
3333
title: The type of commodity flow
3434
description: Currently this value must be `fixed`
35-
- name: flow_cost
35+
- name: cost
3636
type: number
3737
title: The cost per unit flow
3838
description: Optional. If present, must be >0.

src/commodity.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ define_id_type! {CommodityID}
1313
/// A map of [`Commodity`]s, keyed by commodity ID
1414
pub type CommodityMap = IndexMap<CommodityID, Rc<Commodity>>;
1515

16-
/// A map of [`CommodityCost`]s, keyed by region ID, year and time slice ID
17-
pub type CommodityCostMap = HashMap<(RegionID, u32, TimeSliceID), CommodityCost>;
16+
/// A map of [`CommodityLevy`]s, keyed by region ID, year and time slice ID
17+
pub type CommodityLevyMap = HashMap<(RegionID, u32, TimeSliceID), CommodityLevy>;
1818

1919
/// A map of demand values, keyed by region ID, year and time slice selection
2020
pub type DemandMap = HashMap<(RegionID, u32, TimeSliceSelection), f64>;
@@ -40,7 +40,7 @@ pub struct Commodity {
4040
/// every combination of parameters. Note that these values can be negative, indicating an
4141
/// incentive.
4242
#[serde(skip)]
43-
pub costs: CommodityCostMap,
43+
pub levies: CommodityLevyMap,
4444
/// Demand as defined in input files. Will be empty for non-service-demand commodities.
4545
///
4646
/// The [`TimeSliceSelection`] part of the key is always at the same [`TimeSliceLevel`] as the
@@ -67,9 +67,10 @@ pub enum BalanceType {
6767

6868
/// Represents a tax or other external cost on a commodity, as specified in input data.
6969
///
70-
/// For example, a CO2 price could be specified in input data to be applied to net CO2.
70+
/// For example, a CO2 price could be specified in input data to be applied to net CO2. Note that
71+
/// the value can also be negative, indicating an incentive.
7172
#[derive(PartialEq, Clone, Debug)]
72-
pub struct CommodityCost {
73+
pub struct CommodityLevy {
7374
/// Type of balance for application of cost
7475
pub balance_type: BalanceType,
7576
/// Cost per unit commodity
@@ -115,16 +116,16 @@ mod tests {
115116
}
116117

117118
#[test]
118-
fn test_commodity_cost_map() {
119+
fn test_commodity_levy_map() {
119120
let ts = TimeSliceID {
120121
season: "winter".into(),
121122
time_of_day: "day".into(),
122123
};
123-
let value = CommodityCost {
124+
let value = CommodityLevy {
124125
balance_type: BalanceType::Consumption,
125126
value: 0.5,
126127
};
127-
let mut map = CommodityCostMap::new();
128+
let mut map = CommodityLevyMap::new();
128129
assert!(map
129130
.insert(("GBR".into(), 2010, ts.clone()), value.clone())
130131
.is_none());

src/fixture.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::agent::{
55
AgentSearchSpaceMap, DecisionRule,
66
};
77
use crate::asset::{Asset, AssetPool};
8-
use crate::commodity::{Commodity, CommodityCostMap, CommodityID, CommodityType, DemandMap};
8+
use crate::commodity::{Commodity, CommodityID, CommodityLevyMap, CommodityType, DemandMap};
99
use crate::process::{
1010
Process, ProcessEnergyLimitsMap, ProcessFlowsMap, ProcessMap, ProcessParameter,
1111
ProcessParameterMap,
@@ -62,7 +62,7 @@ pub fn svd_commodity() -> Commodity {
6262
description: "".into(),
6363
kind: CommodityType::ServiceDemand,
6464
time_slice_level: TimeSliceLevel::DayNight,
65-
costs: CommodityCostMap::new(),
65+
levies: CommodityLevyMap::new(),
6666
demand: DemandMap::new(),
6767
}
6868
}

src/input/agent/commodity_portion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ mod tests {
194194
use crate::agent::{
195195
Agent, AgentCostLimitsMap, AgentObjectiveMap, AgentSearchSpaceMap, DecisionRule,
196196
};
197-
use crate::commodity::{Commodity, CommodityCostMap, CommodityID, CommodityType, DemandMap};
197+
use crate::commodity::{Commodity, CommodityID, CommodityLevyMap, CommodityType, DemandMap};
198198
use crate::time_slice::TimeSliceLevel;
199199
use std::rc::Rc;
200200

@@ -222,7 +222,7 @@ mod tests {
222222
description: "A commodity".into(),
223223
kind: CommodityType::SupplyEqualsDemand,
224224
time_slice_level: TimeSliceLevel::Annual,
225-
costs: CommodityCostMap::new(),
225+
levies: CommodityLevyMap::new(),
226226
demand: DemandMap::new(),
227227
}),
228228
)]);
@@ -261,7 +261,7 @@ mod tests {
261261
description: "Another commodity".into(),
262262
kind: CommodityType::SupplyEqualsDemand,
263263
time_slice_level: TimeSliceLevel::Annual,
264-
costs: CommodityCostMap::new(),
264+
levies: CommodityLevyMap::new(),
265265
demand: DemandMap::new(),
266266
}),
267267
);

src/input/commodity.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use anyhow::Result;
77
use std::collections::HashSet;
88
use std::path::Path;
99

10-
mod cost;
11-
use cost::read_commodity_costs;
10+
mod levy;
11+
use levy::read_commodity_levies;
1212
mod demand;
1313
use demand::read_demand;
1414
mod demand_slicing;
@@ -36,7 +36,7 @@ pub fn read_commodities(
3636
let commodities =
3737
read_csv_id_file::<Commodity, CommodityID>(&model_dir.join(COMMODITY_FILE_NAME))?;
3838
let commodity_ids = commodities.keys().cloned().collect();
39-
let mut costs = read_commodity_costs(
39+
let mut costs = read_commodity_levies(
4040
model_dir,
4141
&commodity_ids,
4242
region_ids,
@@ -57,7 +57,7 @@ pub fn read_commodities(
5757
.into_iter()
5858
.map(|(id, mut commodity)| {
5959
if let Some(costs) = costs.remove(&id) {
60-
commodity.costs = costs;
60+
commodity.levies = costs;
6161
}
6262
if let Some(demand) = demand.remove(&id) {
6363
commodity.demand = demand;

0 commit comments

Comments
 (0)