Skip to content

Commit c94cf76

Browse files
committed
Rename: flow_cost => cost
1 parent 98dff8f commit c94cf76

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

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,coeff,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

schemas/input/process_flows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fields:
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/input/process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ mod tests {
307307
commodity: commodity_sed.into(),
308308
coeff: -10.0,
309309
kind: FlowType::Fixed,
310-
flow_cost: 1.0,
310+
cost: 1.0,
311311
is_pac: false,
312312
}},
313313
)])
@@ -321,7 +321,7 @@ mod tests {
321321
commodity: commodity_sed.into(),
322322
coeff: 10.0,
323323
kind: FlowType::Fixed,
324-
flow_cost: 1.0,
324+
cost: 1.0,
325325
is_pac: false,
326326
}},
327327
)])
@@ -382,7 +382,7 @@ mod tests {
382382
commodity: commodity_svd.into(),
383383
coeff: 10.0,
384384
kind: FlowType::Fixed,
385-
flow_cost: 1.0,
385+
cost: 1.0,
386386
is_pac: false,
387387
}},
388388
)]),

src/input/process/flow.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct ProcessFlowRaw {
2424
#[serde(default)]
2525
#[serde(rename = "type")]
2626
kind: FlowType,
27-
flow_cost: Option<f64>,
27+
cost: Option<f64>,
2828
is_pac: bool,
2929
}
3030

@@ -44,10 +44,10 @@ impl ProcessFlowRaw {
4444
);
4545

4646
// Check that flow cost is non-negative
47-
if let Some(flow_cost) = self.flow_cost {
47+
if let Some(cost) = self.cost {
4848
ensure!(
49-
(0.0..f64::INFINITY).contains(&flow_cost),
50-
"Invalid value for flow cost ({flow_cost}). Must be >=0."
49+
(0.0..f64::INFINITY).contains(&cost),
50+
"Invalid value for flow cost ({cost}). Must be >=0."
5151
)
5252
}
5353

@@ -111,7 +111,7 @@ where
111111
commodity: Rc::clone(commodity),
112112
coeff: record.coeff,
113113
kind: record.kind,
114-
flow_cost: record.flow_cost.unwrap_or(0.0),
114+
cost: record.cost.unwrap_or(0.0),
115115
is_pac: record.is_pac,
116116
};
117117

@@ -205,7 +205,7 @@ mod tests {
205205
fn create_process_flow_raw(
206206
coeff: f64,
207207
kind: FlowType,
208-
flow_cost: Option<f64>,
208+
cost: Option<f64>,
209209
is_pac: bool,
210210
) -> ProcessFlowRaw {
211211
ProcessFlowRaw {
@@ -215,7 +215,7 @@ mod tests {
215215
regions: "region".into(),
216216
coeff,
217217
kind,
218-
flow_cost,
218+
cost,
219219
is_pac,
220220
}
221221
}
@@ -250,7 +250,7 @@ mod tests {
250250
commodity,
251251
coeff,
252252
kind: FlowType::Fixed,
253-
flow_cost: 0.0,
253+
cost: 0.0,
254254
is_pac,
255255
}
256256
}

src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub struct ProcessFlow {
9393
/// For example, cost per unit of natural gas produced. The user can apply it to any specified
9494
/// flow, in contrast to [`ProcessParameter::variable_operating_cost`], which applies only to
9595
/// PAC flows.
96-
pub flow_cost: f64,
96+
pub cost: f64,
9797
/// Whether this flow represents a Primary Activity Commodity
9898
pub is_pac: bool,
9999
}

0 commit comments

Comments
 (0)