-
Notifications
You must be signed in to change notification settings - Fork 2
Add units column to commodities input file #1110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
19ac296
0325482
1b26880
08bd1f8
d5b1e6b
cffbc30
1053518
7c7e19c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| id,description,type,time_slice_level | ||
| OILCRD,Crude oil,sed,season | ||
| GASPRD,Gas produced,sed,season | ||
| GASOLI,Gasoline,sed,season | ||
| DIESEL,Diesel,sed,season | ||
| GASNAT,Natural gas,sed,season | ||
| ELCTRI,Electricity,sed,daynight | ||
| H2YPRD,Hydrogen,sed,season | ||
| TPASKM,Passenger kms,svd,daynight | ||
| RSHEAT,Residential heating,svd,daynight | ||
| CO2EMT,CO2 emitted,oth,annual | ||
| BIOPRD,Biomass produced,sed,season | ||
| BIOPEL,Biomass pellets,sed,season | ||
| id,description,type,time_slice_level,units | ||
| OILCRD,Crude oil,sed,season,NOUNIT | ||
| GASPRD,Gas produced,sed,season,NOUNIT | ||
| GASOLI,Gasoline,sed,season,NOUNIT | ||
| DIESEL,Diesel,sed,season,NOUNIT | ||
| GASNAT,Natural gas,sed,season,NOUNIT | ||
| ELCTRI,Electricity,sed,daynight,NOUNIT | ||
| H2YPRD,Hydrogen,sed,season,NOUNIT | ||
| TPASKM,Passenger kms,svd,daynight,NOUNIT | ||
| RSHEAT,Residential heating,svd,daynight,NOUNIT | ||
| CO2EMT,CO2 emitted,oth,annual,NOUNIT | ||
| BIOPRD,Biomass produced,sed,season,NOUNIT | ||
| BIOPEL,Biomass pellets,sed,season,NOUNIT | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| id,description,type,time_slice_level | ||
| GASPRD,Gas produced,sed,season | ||
| GASNAT,Natural gas,sed,season | ||
| BIOPRD,Biomass produced,sed,season | ||
| BIOPEL,Biomass pellets,sed,season | ||
| ELCTRI,Electricity,sed,daynight | ||
| RSHEAT,Residential heating,svd,daynight | ||
| CO2EMT,CO2 emitted,oth,annual | ||
| id,description,type,time_slice_level,units | ||
| GASPRD,Gas produced,sed,season,NOUNIT | ||
| GASNAT,Natural gas,sed,season,NOUNIT | ||
| BIOPRD,Biomass produced,sed,season,NOUNIT | ||
| BIOPEL,Biomass pellets,sed,season,NOUNIT | ||
| ELCTRI,Electricity,sed,daynight,NOUNIT | ||
| RSHEAT,Residential heating,svd,daynight,NOUNIT | ||
| CO2EMT,CO2 emitted,oth,annual,NOUNIT |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| id,description,type,time_slice_level | ||
| electricity,Electricity,sed,daynight | ||
| gas,Gas,sed,daynight | ||
| heat,Heat,svd,daynight | ||
| wind,Wind,oth,daynight | ||
| CO2f,Carbon dioxide,oth,daynight | ||
| id,description,type,time_slice_level,units | ||
| electricity,Electricity,sed,daynight,PJ | ||
| gas,Gas,sed,daynight,PJ | ||
| heat,Heat,svd,daynight,PJ | ||
| wind,Wind,oth,daynight,PJ | ||
| CO2f,Carbon dioxide,oth,daynight,kt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| id,description,type,time_slice_level | ||
| GASPRD,Gas produced,sed,season | ||
| GASNAT,Natural gas,sed,season | ||
| ELCTRI,Electricity,sed,daynight | ||
| RSHEAT,Residential heating,svd,daynight | ||
| CO2EMT,CO2 emitted,oth,annual | ||
| id,description,type,time_slice_level,units | ||
| GASPRD,Gas produced,sed,season,NOUNIT | ||
| GASNAT,Natural gas,sed,season,NOUNIT | ||
| ELCTRI,Electricity,sed,daynight,NOUNIT | ||
| RSHEAT,Residential heating,svd,daynight,NOUNIT | ||
| CO2EMT,CO2 emitted,oth,annual,NOUNIT |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| id,description,type,time_slice_level | ||
| OILCRD,Crude oil,sed,season | ||
| GASPRD,Gas produced,sed,season | ||
| GASOLI,Gasoline,sed,season | ||
| DIESEL,Diesel,sed,season | ||
| GASNAT,Natural gas,sed,season | ||
| ELCTRI,Electricity,sed,daynight | ||
| TPASKM,Passenger kms,svd,daynight | ||
| RSHEAT,Residential heating,svd,daynight | ||
| CO2EMT,CO2 emitted,oth,annual | ||
| BIOPRD,Biomass produced,sed,season | ||
| BIOPEL,Biomass pellets,sed,season | ||
| id,description,type,time_slice_level,units | ||
| OILCRD,Crude oil,sed,season,NOUNIT | ||
| GASPRD,Gas produced,sed,season,NOUNIT | ||
| GASOLI,Gasoline,sed,season,NOUNIT | ||
| DIESEL,Diesel,sed,season,NOUNIT | ||
| GASNAT,Natural gas,sed,season,NOUNIT | ||
| ELCTRI,Electricity,sed,daynight,NOUNIT | ||
| TPASKM,Passenger kms,svd,daynight,NOUNIT | ||
| RSHEAT,Residential heating,svd,daynight,NOUNIT | ||
| CO2EMT,CO2 emitted,oth,annual,NOUNIT | ||
| BIOPRD,Biomass produced,sed,season,NOUNIT | ||
| BIOPEL,Biomass pellets,sed,season,NOUNIT |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| id,description,type,time_slice_level | ||
| electricity,Electricity,sed,daynight | ||
| gas,Gas,sed,daynight | ||
| heat,Heat,svd,daynight | ||
| wind,Wind,oth,daynight | ||
| CO2f,Carbon dioxide,oth,daynight | ||
| id,description,type,time_slice_level,units | ||
| electricity,Electricity,sed,daynight,PJ | ||
| gas,Gas,sed,daynight,PJ | ||
| heat,Heat,svd,daynight,PJ | ||
| wind,Wind,oth,daynight,PJ | ||
| CO2f,Carbon dioxide,oth,daynight,kt |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,3 +42,11 @@ fields: | |||||
|
|
||||||
| If unspecified, the commodity will use the default pricing strategy according to the commodity | ||||||
| type: `shadow` for `svd` and `sed` commodities, and `unpriced` for `oth` commodities. | ||||||
| - name: units | ||||||
| type: string | ||||||
| description: The units of measurement for this commodity | ||||||
| notes: | | ||||||
| This field is used for validation only and is not used for internal unit conversions. MUSE | ||||||
| will validate that all SED/SVD output flows from the same process have the same units, | ||||||
| as the annual fixed costs are distributed proportionally between outputs based on flow coefficients. | ||||||
| E.g. `Petajoules`, `Tonnes`. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd give the abbreviations because that's what users will probably do:
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,6 +150,7 @@ pub fn svd_commodity() -> Commodity { | |
| levies_prod: CommodityLevyMap::new(), | ||
| levies_cons: CommodityLevyMap::new(), | ||
| demand: DemandMap::new(), | ||
| units: "PJ".into(), | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -164,6 +165,7 @@ pub fn sed_commodity() -> Commodity { | |
| levies_prod: CommodityLevyMap::new(), | ||
| levies_cons: CommodityLevyMap::new(), | ||
| demand: DemandMap::new(), | ||
| units: "PJ".into(), | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -178,6 +180,37 @@ pub fn other_commodity() -> Commodity { | |
| levies_prod: CommodityLevyMap::new(), | ||
| levies_cons: CommodityLevyMap::new(), | ||
| demand: DemandMap::new(), | ||
| units: "PJ".into(), | ||
| } | ||
| } | ||
|
|
||
| #[fixture] | ||
| pub fn sed_commodity_pj() -> Commodity { | ||
| Commodity { | ||
| id: "sed_pj".into(), | ||
| description: "Test SED commodity (PJ)".into(), | ||
| kind: CommodityType::SupplyEqualsDemand, | ||
| time_slice_level: TimeSliceLevel::DayNight, | ||
| pricing_strategy: PricingStrategy::Shadow, | ||
| levies_prod: CommodityLevyMap::new(), | ||
| levies_cons: CommodityLevyMap::new(), | ||
| demand: DemandMap::new(), | ||
| units: "PJ".into(), | ||
| } | ||
| } | ||
|
|
||
| #[fixture] | ||
| pub fn sed_commodity_tonnes() -> Commodity { | ||
| Commodity { | ||
| id: "sed_tonnes".into(), | ||
| description: "Test SED commodity (tonnes)".into(), | ||
| kind: CommodityType::SupplyEqualsDemand, | ||
| time_slice_level: TimeSliceLevel::DayNight, | ||
| pricing_strategy: PricingStrategy::Shadow, | ||
| levies_prod: CommodityLevyMap::new(), | ||
| levies_cons: CommodityLevyMap::new(), | ||
| demand: DemandMap::new(), | ||
| units: "tonnes".into(), | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we probs won't want these fixtures anywhere outside of |
||
|
|
||
|
|
@@ -415,14 +448,14 @@ mod tests { | |
| #[test] | ||
| fn patch_and_validate_simple_fail() { | ||
| let patch = FilePatch::new("commodities.csv") | ||
| .with_deletion("RSHEAT,Residential heating,svd,daynight"); | ||
| .with_deletion("RSHEAT,Residential heating,svd,daynight,NOUNIT"); | ||
| assert!(patch_and_validate_simple!(vec![patch]).is_err()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn patch_and_run_simple_fail() { | ||
| let patch = FilePatch::new("commodities.csv") | ||
| .with_deletion("RSHEAT,Residential heating,svd,daynight"); | ||
| .with_deletion("RSHEAT,Residential heating,svd,daynight,NOUNIT"); | ||
| assert!(patch_and_run_simple!(vec![patch]).is_err()); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably the unit of this one is
km😄