Allow user to specify product acquisition costs

This commit is contained in:
2023-02-16 11:23:54 -06:00
parent 2f0228e9ca
commit 78128bd79b
15 changed files with 495 additions and 568 deletions

View File

@@ -118,9 +118,17 @@ const ProductBlock = (props) => {
/>
<h1 style={{ display: nCenters == 0 ? "none" : "block" }}>
Disposal
Acquisition & disposal
</h1>
<div style={{ display: nCenters == 0 ? "none" : "block" }}>
<TextInputRow
label="Acquisition cost"
unit="$/tonne"
tooltip="Cost of acquiring one tonne of this product at a collection center."
value={props.value["acquisition cost ($/tonne)"]}
onChange={(v) => onChange("acquisition cost ($/tonne)", v)}
validate="floatList"
/>
<TextInputRow
label="Disposal cost"
unit="$/tonne"

View File

@@ -1,5 +1,6 @@
export const defaultProduct = {
"initial amounts": {},
"acquisition cost ($/tonne)": "0",
"disposal cost ($/tonne)": "0",
"disposal limit (tonne)": "0",
"disposal limit (%)": "",

View File

@@ -139,12 +139,14 @@ export const exportProduct = (original, parameters) => {
);
// Copy cost time series (with inflation)
["disposal cost ($/tonne)", "transportation cost ($/km/tonne)"].forEach(
(key) => {
const v = exportValue(original[key], T, R);
if (v.length > 0) result[key] = v;
}
);
[
"disposal cost ($/tonne)",
"acquisition cost ($/tonne)",
"transportation cost ($/km/tonne)",
].forEach((key) => {
const v = exportValue(original[key], T, R);
if (v.length > 0) result[key] = v;
});
// Copy dictionaries
["transportation emissions (tonne/km/tonne)"].forEach((key) => {
@@ -344,16 +346,19 @@ export const importProduct = (original) => {
const [R, T] = computeInflationAndTimeHorizon(original, [
"transportation cost ($/km/tonne)",
"disposal cost ($/tonne)",
"acquisition cost ($/tonne)",
]);
parameters["inflation rate (%)"] = String((R - 1) * 100);
parameters["time horizon (years)"] = String(T);
// Import cost lists
["transportation cost ($/km/tonne)", "disposal cost ($/tonne)"].forEach(
(key) => {
prod[key] = importList(original[key], R);
}
);
[
"transportation cost ($/km/tonne)",
"disposal cost ($/tonne)",
"acquisition cost ($/tonne)",
].forEach((key) => {
prod[key] = importList(original[key], R);
});
// Import dicts
["transportation emissions (tonne/km/tonne)"].forEach((key) => {

View File

@@ -27,6 +27,7 @@ const sampleProductsOriginal = [
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": "4",
"disposal cost ($/tonne)": "50",
"disposal limit (tonne)": "30",
"disposal limit (%)": "",
@@ -57,6 +58,7 @@ const sampleProductsOriginal = [
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": "4",
"disposal cost ($/tonne)": "50",
"disposal limit (tonne)": "",
"disposal limit (%)": "10",
@@ -87,6 +89,7 @@ const sampleProductsOriginal = [
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": "4",
"disposal cost ($/tonne)": "50",
"disposal limit (tonne)": "",
"disposal limit (%)": "",
@@ -118,6 +121,7 @@ const sampleProductsExported = [
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": [4, 8, 16],
"disposal cost ($/tonne)": [50, 100, 200],
"disposal limit (tonne)": [30, 30, 30],
"transportation cost ($/km/tonne)": [0, 0, 0],
@@ -145,6 +149,7 @@ const sampleProductsExported = [
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": [4, 4, 4],
"disposal cost ($/tonne)": [50, 50, 50],
"disposal limit (tonne)": [30, 60, 90],
"transportation cost ($/km/tonne)": [5, 5, 5],
@@ -172,6 +177,7 @@ const sampleProductsExported = [
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": [4, 4, 4],
"disposal cost ($/tonne)": [50, 50, 50],
"transportation cost ($/km/tonne)": [5, 5, 5],
},