From f292472bf65092aa03846912762398b455713330 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Mon, 22 Apr 2024 14:58:04 +0200 Subject: [PATCH 01/12] Add new pre-treatment process, update bleaching formula. --- public/data/textile/processes.json | 166 ++++- public/data/textile/processes_impacts.json | 206 +++++- .../data/textile/processes_impacts_fake.json | 166 ++++- src/Data/Textile/Formula.elm | 22 +- src/Data/Textile/Simulator.elm | 4 +- src/Data/Textile/WellKnown.elm | 16 + src/Views/Textile/Step.elm | 2 + tests/Data/Textile/SimulatorTest.elm | 2 +- tests/e2e-textile.json | 630 +++++++++--------- 9 files changed, 846 insertions(+), 368 deletions(-) diff --git a/public/data/textile/processes.json b/public/data/textile/processes.json index 23a58e60e..faa12c52c 100644 --- a/public/data/textile/processes.json +++ b/public/data/textile/processes.json @@ -2923,13 +2923,13 @@ "alias": "dyeing-cellulosic-fiber" }, { - "name": "Blanchiment", - "info": "Textile > Ennoblissement > Blanchiment", + "name": "Blanchiment (pré-traitement)", + "info": "Textile > Ennoblissement > Pré-traitement", "unit": "kg", - "source": "Ecoinvent 3.9.1", - "correctif": "", + "source": "Ecobalyse", + "correctif": "non applicable", "step_usage": "Ennoblissement", - "uuid": "blanchiment", + "uuid": "6976b6c6-e644-4e48-8ef8-705f281e3165", "impacts": { "acd": 0, "cch": 0, @@ -2950,15 +2950,163 @@ "swe": 0, "tre": 0, "wtu": 0, - "ecs": 11.066608295453653, - "pef": 12.122376319214194 + "ecs": 0, + "pef": 0 }, - "heat_MJ": 10.74, + "heat_MJ": 5.4, "elec_pppm": 0, - "elec_MJ": 1.61, + "elec_MJ": 0.72, "waste": 0, "alias": "bleaching" }, + { + "name": "Dégraissage/Débouillissage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "b3daab52-469f-4f44-9bcc-3cd26f03a464", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 13.5, + "elec_pppm": 0, + "elec_MJ": 1.08, + "waste": 0, + "alias": "scouring" + }, + { + "name": "Mercerisage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "cd2d67be-bb9d-4e2f-b630-c29202d11c7d", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 2.7, + "elec_pppm": 0, + "elec_MJ": 0.36, + "waste": 0, + "alias": "mercerising" + }, + { + "name": "Lavage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "4502296d-a860-470b-8934-8714d43506d5", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 10.8, + "elec_pppm": 0, + "elec_MJ": 0.72, + "waste": 0, + "alias": "washing" + }, + { + "name": "Désencollage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "c0fc6425-9c6f-4418-94f3-e9f1e40bbc90", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 3.2, + "elec_pppm": 0, + "elec_MJ": 0.36, + "waste": 0, + "alias": "desizing" + }, { "name": "Impression (pigmentaire)", "info": "Textile > Ennoblissement > Impression", diff --git a/public/data/textile/processes_impacts.json b/public/data/textile/processes_impacts.json index 5b37fcd02..ad118d4fc 100644 --- a/public/data/textile/processes_impacts.json +++ b/public/data/textile/processes_impacts.json @@ -2923,42 +2923,190 @@ "alias": "dyeing-cellulosic-fiber" }, { - "name": "Blanchiment", - "info": "Textile > Ennoblissement > Blanchiment", + "name": "Blanchiment (pré-traitement)", + "info": "Textile > Ennoblissement > Pré-traitement", "unit": "kg", - "source": "Ecoinvent 3.9.1", - "correctif": "", + "source": "Ecobalyse", + "correctif": "non applicable", "step_usage": "Ennoblissement", - "uuid": "blanchiment", - "impacts": { - "acd": 0.00068843232, - "cch": 0.091181439, - "etf": 0.47605087, - "etf-c": 0.50495467682, - "fru": 1.3549756, - "fwe": 0.0000296, - "htc": 1.63e-11, - "htc-c": 3.2666424e-11, - "htn": 4.95e-11, - "htn-c": 9.355226e-11, - "ior": 0.01148789, - "ldu": 0.29904934, - "mru": 0.00000139, - "ozd": 1.82e-8, - "pco": 0.00055799816, - "pma": 3.51e-9, - "swe": 0.00019057431, - "tre": 0.0020518148, - "wtu": 0.35537349, - "ecs": 11.066608295453653, - "pef": 12.122376319214194 + "uuid": "6976b6c6-e644-4e48-8ef8-705f281e3165", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 }, - "heat_MJ": 10.74, + "heat_MJ": 5.4, "elec_pppm": 0, - "elec_MJ": 1.61, + "elec_MJ": 0.72, "waste": 0, "alias": "bleaching" }, + { + "name": "Dégraissage/Débouillissage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "b3daab52-469f-4f44-9bcc-3cd26f03a464", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 13.5, + "elec_pppm": 0, + "elec_MJ": 1.08, + "waste": 0, + "alias": "scouring" + }, + { + "name": "Mercerisage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "cd2d67be-bb9d-4e2f-b630-c29202d11c7d", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 2.7, + "elec_pppm": 0, + "elec_MJ": 0.36, + "waste": 0, + "alias": "mercerising" + }, + { + "name": "Lavage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "4502296d-a860-470b-8934-8714d43506d5", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 10.8, + "elec_pppm": 0, + "elec_MJ": 0.72, + "waste": 0, + "alias": "washing" + }, + { + "name": "Désencollage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "c0fc6425-9c6f-4418-94f3-e9f1e40bbc90", + "impacts": { + "acd": 0, + "cch": 0, + "etf": 0, + "etf-c": 0, + "fru": 0, + "fwe": 0, + "htc": 0, + "htc-c": 0, + "htn": 0, + "htn-c": 0, + "ior": 0, + "ldu": 0, + "mru": 0, + "ozd": 0, + "pco": 0, + "pma": 0, + "swe": 0, + "tre": 0, + "wtu": 0, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 3.2, + "elec_pppm": 0, + "elec_MJ": 0.36, + "waste": 0, + "alias": "desizing" + }, { "name": "Impression (pigmentaire)", "info": "Textile > Ennoblissement > Impression", diff --git a/public/data/textile/processes_impacts_fake.json b/public/data/textile/processes_impacts_fake.json index 92fc34645..83b8cde06 100644 --- a/public/data/textile/processes_impacts_fake.json +++ b/public/data/textile/processes_impacts_fake.json @@ -2923,13 +2923,13 @@ "alias": "dyeing-cellulosic-fiber" }, { - "name": "Blanchiment", - "info": "Textile > Ennoblissement > Blanchiment", + "name": "Blanchiment (pré-traitement)", + "info": "Textile > Ennoblissement > Pré-traitement", "unit": "kg", - "source": "Ecoinvent 3.9.1", - "correctif": "", + "source": "Ecobalyse", + "correctif": "non applicable", "step_usage": "Ennoblissement", - "uuid": "blanchiment", + "uuid": "6976b6c6-e644-4e48-8ef8-705f281e3165", "impacts": { "acd": 1.2, "cch": 1.2, @@ -2950,15 +2950,163 @@ "swe": 1.2, "tre": 1.2, "wtu": 1.2, - "ecs": 11.066608295453653, - "pef": 12.122376319214194 + "ecs": 0, + "pef": 0 }, - "heat_MJ": 10.74, + "heat_MJ": 5.4, "elec_pppm": 0, - "elec_MJ": 1.61, + "elec_MJ": 0.72, "waste": 0, "alias": "bleaching" }, + { + "name": "Dégraissage/Débouillissage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "b3daab52-469f-4f44-9bcc-3cd26f03a464", + "impacts": { + "acd": 1.2, + "cch": 1.2, + "etf": 1.2, + "etf-c": 1.2, + "fru": 1.2, + "fwe": 1.2, + "htc": 1.2, + "htc-c": 1.2, + "htn": 1.2, + "htn-c": 1.2, + "ior": 1.2, + "ldu": 1.2, + "mru": 1.2, + "ozd": 1.2, + "pco": 1.2, + "pma": 1.2, + "swe": 1.2, + "tre": 1.2, + "wtu": 1.2, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 13.5, + "elec_pppm": 0, + "elec_MJ": 1.08, + "waste": 0, + "alias": "scouring" + }, + { + "name": "Mercerisage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "cd2d67be-bb9d-4e2f-b630-c29202d11c7d", + "impacts": { + "acd": 1.2, + "cch": 1.2, + "etf": 1.2, + "etf-c": 1.2, + "fru": 1.2, + "fwe": 1.2, + "htc": 1.2, + "htc-c": 1.2, + "htn": 1.2, + "htn-c": 1.2, + "ior": 1.2, + "ldu": 1.2, + "mru": 1.2, + "ozd": 1.2, + "pco": 1.2, + "pma": 1.2, + "swe": 1.2, + "tre": 1.2, + "wtu": 1.2, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 2.7, + "elec_pppm": 0, + "elec_MJ": 0.36, + "waste": 0, + "alias": "mercerising" + }, + { + "name": "Lavage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "4502296d-a860-470b-8934-8714d43506d5", + "impacts": { + "acd": 1.2, + "cch": 1.2, + "etf": 1.2, + "etf-c": 1.2, + "fru": 1.2, + "fwe": 1.2, + "htc": 1.2, + "htc-c": 1.2, + "htn": 1.2, + "htn-c": 1.2, + "ior": 1.2, + "ldu": 1.2, + "mru": 1.2, + "ozd": 1.2, + "pco": 1.2, + "pma": 1.2, + "swe": 1.2, + "tre": 1.2, + "wtu": 1.2, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 10.8, + "elec_pppm": 0, + "elec_MJ": 0.72, + "waste": 0, + "alias": "washing" + }, + { + "name": "Désencollage", + "info": "Textile > Ennoblissement > Pré-traitement", + "unit": "kg", + "source": "Ecobalyse", + "correctif": "non applicable", + "step_usage": "Ennoblissement", + "uuid": "c0fc6425-9c6f-4418-94f3-e9f1e40bbc90", + "impacts": { + "acd": 1.2, + "cch": 1.2, + "etf": 1.2, + "etf-c": 1.2, + "fru": 1.2, + "fwe": 1.2, + "htc": 1.2, + "htc-c": 1.2, + "htn": 1.2, + "htn-c": 1.2, + "ior": 1.2, + "ldu": 1.2, + "mru": 1.2, + "ozd": 1.2, + "pco": 1.2, + "pma": 1.2, + "swe": 1.2, + "tre": 1.2, + "wtu": 1.2, + "ecs": 0, + "pef": 0 + }, + "heat_MJ": 3.2, + "elec_pppm": 0, + "elec_MJ": 0.36, + "waste": 0, + "alias": "desizing" + }, { "name": "Impression (pigmentaire)", "info": "Textile > Ennoblissement > Impression", diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index e3243124e..2b6c40dbd 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -266,16 +266,30 @@ bleachingImpacts : -> { bleachingProcess : Process -- Inbound: Bleaching process , aquaticPollutionScenario : Country.AquaticPollutionScenario + , countryElecProcess : Process + , countryHeatProcess : Process } -> Mass -> Impacts -bleachingImpacts impacts { bleachingProcess, aquaticPollutionScenario } baseMass = +bleachingImpacts impacts { bleachingProcess, countryElecProcess, countryHeatProcess } baseMass = impacts |> Impact.mapImpacts (\trigram _ -> - baseMass - |> Unit.forKg (Process.getImpact trigram bleachingProcess) - |> Quantity.multiplyBy (getAquaticPollutionRealRatio aquaticPollutionScenario) + Quantity.sum + [ bleachingProcess.elec + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forKWh (Process.getImpact trigram countryElecProcess) + , bleachingProcess.heat + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) + + -- FIXME: What to do with this now we don't have bleaching impacts anymore? + -- How should we use aquaticPollutionScenario now? + -- Maybe we should still apply the ratio to the resulting impacts? + -- , baseMass + -- |> Unit.forKg (Process.getImpact trigram bleachingProcess) + -- |> Quantity.multiplyBy (getAquaticPollutionRealRatio aquaticPollutionScenario) + ] ) diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index 2b0245875..385fed288 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -390,7 +390,7 @@ computeFinishingImpacts { textile } simulator = computeBleachingImpacts : Db -> Simulator -> Simulator -computeBleachingImpacts { textile } simulator = +computeBleachingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> @@ -400,6 +400,8 @@ computeBleachingImpacts { textile } simulator = |> Formula.bleachingImpacts step.impacts { bleachingProcess = textile.wellKnown.bleaching , aquaticPollutionScenario = step.country.aquaticPollutionScenario + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess } in { step diff --git a/src/Data/Textile/WellKnown.elm b/src/Data/Textile/WellKnown.elm index 48842d033..d24d27384 100644 --- a/src/Data/Textile/WellKnown.elm +++ b/src/Data/Textile/WellKnown.elm @@ -43,6 +43,10 @@ type alias WellKnown = , heatEurope : Process , heatRoW : Process , weaving : Process + , scouring : Process + , mercerising : Process + , washing : Process + , desizing : Process } @@ -112,6 +116,10 @@ load processes = , knittingCircular = "knitting-circular" , knittingStraight = "knitting-straight" , weaving = "weaving" + , scouring = "scouring" + , mercerising = "mercerising" + , washing = "washing" + , desizing = "desizing" } find get = @@ -145,6 +153,10 @@ load processes = |> find .heatEurope |> find .heatRoW |> find .weaving + |> find .scouring + |> find .mercerising + |> find .washing + |> find .desizing map : (Process -> Process) -> WellKnown -> WellKnown @@ -176,4 +188,8 @@ map update wellKnown = , knittingCircular = update wellKnown.knittingCircular , knittingStraight = update wellKnown.knittingStraight , weaving = update wellKnown.weaving + , scouring = update wellKnown.scouring + , mercerising = update wellKnown.mercerising + , washing = update wellKnown.washing + , desizing = update wellKnown.desizing } diff --git a/src/Views/Textile/Step.elm b/src/Views/Textile/Step.elm index 7e4c4e436..dc9a02e2b 100644 --- a/src/Views/Textile/Step.elm +++ b/src/Views/Textile/Step.elm @@ -827,6 +827,8 @@ ennoblingToxicityView db ({ selectedImpact, inputs } as config) current = |> Formula.bleachingImpacts current.impacts { bleachingProcess = db.textile.wellKnown.bleaching , aquaticPollutionScenario = current.country.aquaticPollutionScenario + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess } dyeingToxicity = diff --git a/tests/Data/Textile/SimulatorTest.elm b/tests/Data/Textile/SimulatorTest.elm index 59a362403..00c31535b 100644 --- a/tests/Data/Textile/SimulatorTest.elm +++ b/tests/Data/Textile/SimulatorTest.elm @@ -47,7 +47,7 @@ suite = [ { tShirtCotonFrance | countrySpinning = Nothing } - |> expectImpact db ecs 1668.06283770339 + |> expectImpact db ecs 1677.549640720743 |> asTest "should compute a simulation ecs impact" , describe "disabled steps" [ { tShirtCotonFrance | disabledSteps = [ Label.Ennobling ] } diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 623293a09..4e04ce6ab 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -11,27 +11,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 50.12607867773065, - "cch": 50.12607867773065, - "etf": 50.12607867773065, - "etf-c": 50.12607867773065, - "fru": 50.12607867773065, - "fwe": 50.12607867773065, - "htc": 50.12607867773065, - "htc-c": 50.12607867773065, - "htn": 50.12607867773065, - "htn-c": 50.12607867773065, - "ior": 50.12607867773065, - "ldu": 50.12607867773065, - "mru": 50.12607867773065, - "ozd": 50.12607867773065, - "pco": 50.12607867773065, - "pma": 50.12607867773065, - "swe": 50.12607867773065, - "tre": 50.12607867773065, - "wtu": 50.12607867773065, - "ecs": 1668.06283770339, - "pef": 1050.0394537813468 + "acd": 52.7170185019362, + "cch": 52.7170185019362, + "etf": 52.7170185019362, + "etf-c": 52.7170185019362, + "fru": 52.7170185019362, + "fwe": 52.7170185019362, + "htc": 52.7170185019362, + "htc-c": 52.7170185019362, + "htn": 52.7170185019362, + "htn-c": 52.7170185019362, + "ior": 52.7170185019362, + "ldu": 52.7170185019362, + "mru": 52.7170185019362, + "ozd": 52.7170185019362, + "pco": 52.7170185019362, + "pma": 52.7170185019362, + "swe": 52.7170185019362, + "tre": 52.7170185019362, + "wtu": 52.7170185019362, + "ecs": 1677.549640720743, + "pef": 1060.5313989039223 } }, { @@ -47,27 +47,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 50.951474728624994, - "cch": 50.951474728624994, - "etf": 50.951474728624994, - "etf-c": 50.951474728624994, - "fru": 50.951474728624994, - "fwe": 50.951474728624994, - "htc": 50.951474728624994, - "htc-c": 50.951474728624994, - "htn": 50.951474728624994, - "htn-c": 50.951474728624994, - "ior": 50.951474728624994, - "ldu": 50.951474728624994, - "mru": 50.951474728624994, - "ozd": 50.951474728624994, - "pco": 50.951474728624994, - "pma": 50.951474728624994, - "swe": 50.951474728624994, - "tre": 50.951474728624994, - "wtu": 50.951474728624994, - "ecs": 1640.791439988388, - "pef": 1023.2714818358444 + "acd": 53.54241455283054, + "cch": 53.54241455283054, + "etf": 53.54241455283054, + "etf-c": 53.54241455283054, + "fru": 53.54241455283054, + "fwe": 53.54241455283054, + "htc": 53.54241455283054, + "htc-c": 53.54241455283054, + "htn": 53.54241455283054, + "htn-c": 53.54241455283054, + "ior": 53.54241455283054, + "ldu": 53.54241455283054, + "mru": 53.54241455283054, + "ozd": 53.54241455283054, + "pco": 53.54241455283054, + "pma": 53.54241455283054, + "swe": 53.54241455283054, + "tre": 53.54241455283054, + "wtu": 53.54241455283054, + "ecs": 1650.278243005741, + "pef": 1033.7634269584198 } }, { @@ -82,27 +82,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 90.28599116981177, - "cch": 90.28599116981177, - "etf": 90.28599116981177, - "etf-c": 90.28599116981177, - "fru": 90.28599116981177, - "fwe": 90.28599116981177, - "htc": 90.28599116981177, - "htc-c": 90.28599116981177, - "htn": 90.28599116981177, - "htn-c": 90.28599116981177, - "ior": 90.28599116981177, - "ldu": 90.28599116981177, - "mru": 90.28599116981177, - "ozd": 90.28599116981177, - "pco": 90.28599116981177, - "pma": 90.28599116981177, - "swe": 90.28599116981177, - "tre": 90.28599116981177, - "wtu": 90.28599116981177, - "ecs": 2283.317667031533, - "pef": 1580.9302935394792 + "acd": 95.8107893243677, + "cch": 95.8107893243677, + "etf": 95.8107893243677, + "etf-c": 95.8107893243677, + "fru": 95.8107893243677, + "fwe": 95.8107893243677, + "htc": 95.8107893243677, + "htc-c": 95.8107893243677, + "htn": 95.8107893243677, + "htn-c": 95.8107893243677, + "ior": 95.8107893243677, + "ldu": 95.8107893243677, + "mru": 95.8107893243677, + "ozd": 95.8107893243677, + "pco": 95.8107893243677, + "pma": 95.8107893243677, + "swe": 95.8107893243677, + "tre": 95.8107893243677, + "wtu": 95.8107893243677, + "ecs": 2303.546879347947, + "pef": 1603.3028235802658 } }, { @@ -119,27 +119,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 54.64857551441069, - "cch": 54.64857551441069, - "etf": 54.64857551441069, - "etf-c": 54.64857551441069, - "fru": 54.64857551441069, - "fwe": 54.64857551441069, - "htc": 54.64857551441069, - "htc-c": 54.64857551441069, - "htn": 54.64857551441069, - "htn-c": 54.64857551441069, - "ior": 54.64857551441069, - "ldu": 54.64857551441069, - "mru": 54.64857551441069, - "ozd": 54.64857551441069, - "pco": 54.64857551441069, - "pma": 54.64857551441069, - "swe": 54.64857551441069, - "tre": 54.64857551441069, - "wtu": 54.64857551441069, - "ecs": 1603.0420633457854, - "pef": 991.6275139514742 + "acd": 57.59513453017385, + "cch": 57.59513453017385, + "etf": 57.59513453017385, + "etf-c": 57.59513453017385, + "fru": 57.59513453017385, + "fwe": 57.59513453017385, + "htc": 57.59513453017385, + "htc-c": 57.59513453017385, + "htn": 57.59513453017385, + "htn-c": 57.59513453017385, + "ior": 57.59513453017385, + "ldu": 57.59513453017385, + "mru": 57.59513453017385, + "ozd": 57.59513453017385, + "pco": 57.59513453017385, + "pma": 57.59513453017385, + "swe": 57.59513453017385, + "tre": 57.59513453017385, + "wtu": 57.59513453017385, + "ecs": 1613.8309765812064, + "pef": 1003.5595299732271 } }, { @@ -192,27 +192,27 @@ "airTransportRatio=1" ], "impacts": { - "acd": 116.34022343058344, - "cch": 116.34022343058344, - "etf": 116.34022343058344, - "etf-c": 116.34022343058344, - "fru": 116.34022343058344, - "fwe": 116.34022343058344, - "htc": 116.34022343058344, - "htc-c": 116.34022343058344, - "htn": 116.34022343058344, - "htn-c": 116.34022343058344, - "ior": 116.34022343058344, - "ldu": 116.34022343058344, - "mru": 116.34022343058344, - "ozd": 116.34022343058344, - "pco": 116.34022343058344, - "pma": 116.34022343058344, - "swe": 116.34022343058344, - "tre": 116.34022343058344, - "wtu": 116.34022343058344, - "ecs": 6907.995231498704, - "pef": 4130.023687607175 + "acd": 123.50285318836889, + "cch": 123.50285318836889, + "etf": 123.50285318836889, + "etf-c": 123.50285318836889, + "fru": 123.50285318836889, + "fwe": 123.50285318836889, + "htc": 123.50285318836889, + "htc-c": 123.50285318836889, + "htn": 123.50285318836889, + "htn-c": 123.50285318836889, + "ior": 123.50285318836889, + "ldu": 123.50285318836889, + "mru": 123.50285318836889, + "ozd": 123.50285318836889, + "pco": 123.50285318836889, + "pma": 123.50285318836889, + "swe": 123.50285318836889, + "tre": 123.50285318836889, + "wtu": 123.50285318836889, + "ecs": 6961.082647324671, + "pef": 4188.120312424041 } }, { @@ -227,27 +227,27 @@ "countryMaking=TR" ], "impacts": { - "acd": 186.21673316192428, - "cch": 186.21673316192428, - "etf": 186.21673316192428, - "etf-c": 186.21673316192428, - "fru": 186.21673316192428, - "fwe": 186.21673316192428, - "htc": 186.21673316192428, - "htc-c": 186.21673316192428, - "htn": 186.21673316192428, - "htn-c": 186.21673316192428, - "ior": 186.21673316192428, - "ldu": 186.21673316192428, - "mru": 186.21673316192428, - "ozd": 186.21673316192428, - "pco": 186.21673316192428, - "pma": 186.21673316192428, - "swe": 186.21673316192428, - "tre": 186.21673316192428, - "wtu": 186.21673316192428, - "ecs": 6021.020179355263, - "pef": 3791.118461733522 + "acd": 192.67639925647882, + "cch": 192.67639925647882, + "etf": 192.67639925647882, + "etf-c": 192.67639925647882, + "fru": 192.67639925647882, + "fwe": 192.67639925647882, + "htc": 192.67639925647882, + "htc-c": 192.67639925647882, + "htn": 192.67639925647882, + "htn-c": 192.67639925647882, + "ior": 192.67639925647882, + "ldu": 192.67639925647882, + "mru": 192.67639925647882, + "ozd": 192.67639925647882, + "pco": 192.67639925647882, + "pma": 192.67639925647882, + "swe": 192.67639925647882, + "tre": 192.67639925647882, + "wtu": 192.67639925647882, + "ecs": 6063.911608340519, + "pef": 3838.6210905373723 } }, { @@ -263,27 +263,27 @@ "fading=false" ], "impacts": { - "acd": 137.7266801115264, - "cch": 137.7266801115264, - "etf": 137.7266801115264, - "etf-c": 137.7266801115264, - "fru": 137.7266801115264, - "fwe": 137.7266801115264, - "htc": 137.7266801115264, - "htc-c": 137.7266801115264, - "htn": 137.7266801115264, - "htn-c": 137.7266801115264, - "ior": 137.7266801115264, - "ldu": 137.7266801115264, - "mru": 137.7266801115264, - "ozd": 137.7266801115264, - "pco": 137.7266801115264, - "pma": 137.7266801115264, - "swe": 137.7266801115264, - "tre": 137.7266801115264, - "wtu": 137.7266801115264, - "ecs": 5650.268422040605, - "pef": 3379.9470496246513 + "acd": 144.18634620608094, + "cch": 144.18634620608094, + "etf": 144.18634620608094, + "etf-c": 144.18634620608094, + "fru": 144.18634620608094, + "fwe": 144.18634620608094, + "htc": 144.18634620608094, + "htc-c": 144.18634620608094, + "htn": 144.18634620608094, + "htn-c": 144.18634620608094, + "ior": 144.18634620608094, + "ldu": 144.18634620608094, + "mru": 144.18634620608094, + "ozd": 144.18634620608094, + "pco": 144.18634620608094, + "pma": 144.18634620608094, + "swe": 144.18634620608094, + "tre": 144.18634620608094, + "wtu": 144.18634620608094, + "ecs": 5693.159851025861, + "pef": 3427.4496784285016 } }, { @@ -300,27 +300,27 @@ "reparability=1.15" ], "impacts": { - "acd": 50.12607867773065, - "cch": 50.12607867773065, - "etf": 50.12607867773065, - "etf-c": 50.12607867773065, - "fru": 50.12607867773065, - "fwe": 50.12607867773065, - "htc": 50.12607867773065, - "htc-c": 50.12607867773065, - "htn": 50.12607867773065, - "htn-c": 50.12607867773065, - "ior": 50.12607867773065, - "ldu": 50.12607867773065, - "mru": 50.12607867773065, - "ozd": 50.12607867773065, - "pco": 50.12607867773065, - "pma": 50.12607867773065, - "swe": 50.12607867773065, - "tre": 50.12607867773065, - "wtu": 50.12607867773065, - "ecs": 1668.06283770339, - "pef": 1050.0394537813468 + "acd": 52.7170185019362, + "cch": 52.7170185019362, + "etf": 52.7170185019362, + "etf-c": 52.7170185019362, + "fru": 52.7170185019362, + "fwe": 52.7170185019362, + "htc": 52.7170185019362, + "htc-c": 52.7170185019362, + "htn": 52.7170185019362, + "htn-c": 52.7170185019362, + "ior": 52.7170185019362, + "ldu": 52.7170185019362, + "mru": 52.7170185019362, + "ozd": 52.7170185019362, + "pco": 52.7170185019362, + "pma": 52.7170185019362, + "swe": 52.7170185019362, + "tre": 52.7170185019362, + "wtu": 52.7170185019362, + "ecs": 1677.549640720743, + "pef": 1060.5313989039223 } }, { @@ -336,27 +336,27 @@ "makingWaste=0" ], "impacts": { - "acd": 44.79678515193313, - "cch": 44.79678515193313, - "etf": 44.79678515193313, - "etf-c": 44.79678515193313, - "fru": 44.79678515193313, - "fwe": 44.79678515193313, - "htc": 44.79678515193313, - "htc-c": 44.79678515193313, - "htn": 44.79678515193313, - "htn-c": 44.79678515193313, - "ior": 44.79678515193313, - "ldu": 44.79678515193313, - "mru": 44.79678515193313, - "ozd": 44.79678515193313, - "pco": 44.79678515193313, - "pma": 44.79678515193313, - "swe": 44.79678515193313, - "tre": 44.79678515193313, - "wtu": 44.79678515193313, - "ecs": 1472.23640347204, - "pef": 931.9083865437087 + "acd": 46.99908400250784, + "cch": 46.99908400250784, + "etf": 46.99908400250784, + "etf-c": 46.99908400250784, + "fru": 46.99908400250784, + "fwe": 46.99908400250784, + "htc": 46.99908400250784, + "htc-c": 46.99908400250784, + "htn": 46.99908400250784, + "htn-c": 46.99908400250784, + "ior": 46.99908400250784, + "ldu": 46.99908400250784, + "mru": 46.99908400250784, + "ozd": 46.99908400250784, + "pco": 46.99908400250784, + "pma": 46.99908400250784, + "swe": 46.99908400250784, + "tre": 46.99908400250784, + "wtu": 46.99908400250784, + "ecs": 1480.30018603679, + "pef": 940.826539897898 } }, { @@ -372,27 +372,27 @@ "makingWaste=0.25" ], "impacts": { - "acd": 54.863228478439574, - "cch": 54.863228478439574, - "etf": 54.863228478439574, - "etf-c": 54.863228478439574, - "fru": 54.863228478439574, - "fwe": 54.863228478439574, - "htc": 54.863228478439574, - "htc-c": 54.863228478439574, - "htn": 54.863228478439574, - "htn-c": 54.863228478439574, - "ior": 54.863228478439574, - "ldu": 54.863228478439574, - "mru": 54.863228478439574, - "ozd": 54.863228478439574, - "pco": 54.863228478439574, - "pma": 54.863228478439574, - "swe": 54.863228478439574, - "tre": 54.863228478439574, - "wtu": 54.863228478439574, - "ecs": 1842.1307792423668, - "pef": 1155.044846881469 + "acd": 57.799626945872525, + "cch": 57.799626945872525, + "etf": 57.799626945872525, + "etf-c": 57.799626945872525, + "fru": 57.799626945872525, + "fwe": 57.799626945872525, + "htc": 57.799626945872525, + "htc-c": 57.799626945872525, + "htn": 57.799626945872525, + "htn-c": 57.799626945872525, + "ior": 57.799626945872525, + "ldu": 57.799626945872525, + "mru": 57.799626945872525, + "ozd": 57.799626945872525, + "pco": 57.799626945872525, + "pma": 57.799626945872525, + "swe": 57.799626945872525, + "tre": 57.799626945872525, + "wtu": 57.799626945872525, + "ecs": 1852.8824893287, + "pef": 1166.9357180203883 } }, { @@ -409,27 +409,27 @@ "surfaceMass=300" ], "impacts": { - "acd": 86.68577778828737, - "cch": 86.68577778828737, - "etf": 86.68577778828737, - "etf-c": 86.68577778828737, - "fru": 86.68577778828737, - "fwe": 86.68577778828737, - "htc": 86.68577778828737, - "htc-c": 86.68577778828737, - "htn": 86.68577778828737, - "htn-c": 86.68577778828737, - "ior": 86.68577778828737, - "ldu": 86.68577778828737, - "mru": 86.68577778828737, - "ozd": 86.68577778828737, - "pco": 86.68577778828737, - "pma": 86.68577778828737, - "swe": 86.68577778828737, - "tre": 86.68577778828737, - "wtu": 86.68577778828737, - "ecs": 2911.336135752931, - "pef": 1814.6493751497785 + "acd": 91.25802453688539, + "cch": 91.25802453688539, + "etf": 91.25802453688539, + "etf-c": 91.25802453688539, + "fru": 91.25802453688539, + "fwe": 91.25802453688539, + "htc": 91.25802453688539, + "htc-c": 91.25802453688539, + "htn": 91.25802453688539, + "htn-c": 91.25802453688539, + "ior": 91.25802453688539, + "ldu": 91.25802453688539, + "mru": 91.25802453688539, + "ozd": 91.25802453688539, + "pco": 91.25802453688539, + "pma": 91.25802453688539, + "swe": 91.25802453688539, + "tre": 91.25802453688539, + "wtu": 91.25802453688539, + "ecs": 2928.0775528423774, + "pef": 1833.164572424912 } }, { @@ -446,27 +446,27 @@ "printing=pigment" ], "impacts": { - "acd": 92.47029037628404, - "cch": 92.47029037628404, - "etf": 92.47029037628404, - "etf-c": 92.47029037628404, - "fru": 92.47029037628404, - "fwe": 92.47029037628404, - "htc": 92.47029037628404, - "htc-c": 92.47029037628404, - "htn": 92.47029037628404, - "htn-c": 92.47029037628404, - "ior": 92.47029037628404, - "ldu": 92.47029037628404, - "mru": 92.47029037628404, - "ozd": 92.47029037628404, - "pco": 92.47029037628404, - "pma": 92.47029037628404, - "swe": 92.47029037628404, - "tre": 92.47029037628404, - "wtu": 92.47029037628404, - "ecs": 2972.821068912862, - "pef": 1851.8276000857406 + "acd": 97.04253712488206, + "cch": 97.04253712488206, + "etf": 97.04253712488206, + "etf-c": 97.04253712488206, + "fru": 97.04253712488206, + "fwe": 97.04253712488206, + "htc": 97.04253712488206, + "htc-c": 97.04253712488206, + "htn": 97.04253712488206, + "htn-c": 97.04253712488206, + "ior": 97.04253712488206, + "ldu": 97.04253712488206, + "mru": 97.04253712488206, + "ozd": 97.04253712488206, + "pco": 97.04253712488206, + "pma": 97.04253712488206, + "swe": 97.04253712488206, + "tre": 97.04253712488206, + "wtu": 97.04253712488206, + "ecs": 2989.562486002309, + "pef": 1870.3427973608746 } }, { @@ -483,27 +483,27 @@ "printing=substantive" ], "impacts": { - "acd": 93.4171940870584, - "cch": 93.4171940870584, - "etf": 93.4171940870584, - "etf-c": 93.4171940870584, - "fru": 93.4171940870584, - "fwe": 93.4171940870584, - "htc": 93.4171940870584, - "htc-c": 93.4171940870584, - "htn": 93.4171940870584, - "htn-c": 93.4171940870584, - "ior": 93.4171940870584, - "ldu": 93.4171940870584, - "mru": 93.4171940870584, - "ozd": 93.4171940870584, - "pco": 93.4171940870584, - "pma": 93.4171940870584, - "swe": 93.4171940870584, - "tre": 93.4171940870584, - "wtu": 93.4171940870584, - "ecs": 2959.64344338708, - "pef": 1857.1107055003029 + "acd": 97.98944083565642, + "cch": 97.98944083565642, + "etf": 97.98944083565642, + "etf-c": 97.98944083565642, + "fru": 97.98944083565642, + "fwe": 97.98944083565642, + "htc": 97.98944083565642, + "htc-c": 97.98944083565642, + "htn": 97.98944083565642, + "htn-c": 97.98944083565642, + "ior": 97.98944083565642, + "ldu": 97.98944083565642, + "mru": 97.98944083565642, + "ozd": 97.98944083565642, + "pco": 97.98944083565642, + "pma": 97.98944083565642, + "swe": 97.98944083565642, + "tre": 97.98944083565642, + "wtu": 97.98944083565642, + "ecs": 2976.384860476527, + "pef": 1875.6259027754365 } }, { @@ -520,27 +520,27 @@ "printing=pigment;0.5" ], "impacts": { - "acd": 99.85843021639857, - "cch": 99.85843021639857, - "etf": 99.85843021639857, - "etf-c": 99.85843021639857, - "fru": 99.85843021639857, - "fwe": 99.85843021639857, - "htc": 99.85843021639857, - "htc-c": 99.85843021639857, - "htn": 99.85843021639857, - "htn-c": 99.85843021639857, - "ior": 99.85843021639857, - "ldu": 99.85843021639857, - "mru": 99.85843021639857, - "ozd": 99.85843021639857, - "pco": 99.85843021639857, - "pma": 99.85843021639857, - "swe": 99.85843021639857, - "tre": 99.85843021639857, - "wtu": 99.85843021639857, - "ecs": 3057.5507241681207, - "pef": 1898.6238073205607 + "acd": 104.4306769649966, + "cch": 104.4306769649966, + "etf": 104.4306769649966, + "etf-c": 104.4306769649966, + "fru": 104.4306769649966, + "fwe": 104.4306769649966, + "htc": 104.4306769649966, + "htc-c": 104.4306769649966, + "htn": 104.4306769649966, + "htn-c": 104.4306769649966, + "ior": 104.4306769649966, + "ldu": 104.4306769649966, + "mru": 104.4306769649966, + "ozd": 104.4306769649966, + "pco": 104.4306769649966, + "pma": 104.4306769649966, + "swe": 104.4306769649966, + "tre": 104.4306769649966, + "wtu": 104.4306769649966, + "ecs": 3074.292141257567, + "pef": 1917.1390045956944 } }, { @@ -556,27 +556,27 @@ "ennoblingHeatSource=coal" ], "impacts": { - "acd": 86.13239177229883, - "cch": 86.13239177229883, - "etf": 86.13239177229883, - "etf-c": 86.13239177229883, - "fru": 86.13239177229883, - "fwe": 86.13239177229883, - "htc": 86.13239177229883, - "htc-c": 86.13239177229883, - "htn": 86.13239177229883, - "htn-c": 86.13239177229883, - "ior": 86.13239177229883, - "ldu": 86.13239177229883, - "mru": 86.13239177229883, - "ozd": 86.13239177229883, - "pco": 86.13239177229883, - "pma": 86.13239177229883, - "swe": 86.13239177229883, - "tre": 86.13239177229883, - "wtu": 86.13239177229883, - "ecs": 3983.95804326105, - "pef": 2271.8164822143312 + "acd": 89.39214597824083, + "cch": 89.39214597824083, + "etf": 89.39214597824083, + "etf-c": 89.39214597824083, + "fru": 89.39214597824083, + "fwe": 89.39214597824083, + "htc": 89.39214597824083, + "htc-c": 89.39214597824083, + "htn": 89.39214597824083, + "htn-c": 89.39214597824083, + "ior": 89.39214597824083, + "ldu": 89.39214597824083, + "mru": 89.39214597824083, + "ozd": 89.39214597824083, + "pco": 89.39214597824083, + "pma": 89.39214597824083, + "swe": 89.39214597824083, + "tre": 89.39214597824083, + "wtu": 89.39214597824083, + "ecs": 4009.5752064709923, + "pef": 2300.10014617678 } } ] From 80ad1ff7a6ae655aef287ee95a253b279a04a8a2 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Mon, 22 Apr 2024 17:07:07 +0200 Subject: [PATCH 02/12] Apply inventory toxicity fixes to bleaching process & formula. --- public/data/textile/processes_impacts.json | 8 +- src/Data/Textile/Formula.elm | 12 +- tests/e2e-textile.json | 570 ++++++++++----------- 3 files changed, 293 insertions(+), 297 deletions(-) diff --git a/public/data/textile/processes_impacts.json b/public/data/textile/processes_impacts.json index ad118d4fc..7578ce7da 100644 --- a/public/data/textile/processes_impacts.json +++ b/public/data/textile/processes_impacts.json @@ -2927,20 +2927,20 @@ "info": "Textile > Ennoblissement > Pré-traitement", "unit": "kg", "source": "Ecobalyse", - "correctif": "non applicable", + "correctif": "Inventaires enrichis (substances chimiques)", "step_usage": "Ennoblissement", "uuid": "6976b6c6-e644-4e48-8ef8-705f281e3165", "impacts": { "acd": 0, "cch": 0, "etf": 0, - "etf-c": 0, + "etf-c": 1.27e2, "fru": 0, "fwe": 0, "htc": 0, - "htc-c": 0, + "htc-c": 6.03e-11, "htn": 0, - "htn-c": 0, + "htn-c": 1.55e-9, "ior": 0, "ldu": 0, "mru": 0, diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index 2b6c40dbd..7473ad48c 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -271,7 +271,7 @@ bleachingImpacts : } -> Mass -> Impacts -bleachingImpacts impacts { bleachingProcess, countryElecProcess, countryHeatProcess } baseMass = +bleachingImpacts impacts { bleachingProcess, aquaticPollutionScenario, countryElecProcess, countryHeatProcess } baseMass = impacts |> Impact.mapImpacts (\trigram _ -> @@ -282,13 +282,9 @@ bleachingImpacts impacts { bleachingProcess, countryElecProcess, countryHeatProc , bleachingProcess.heat |> Quantity.multiplyBy (Mass.inKilograms baseMass) |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) - - -- FIXME: What to do with this now we don't have bleaching impacts anymore? - -- How should we use aquaticPollutionScenario now? - -- Maybe we should still apply the ratio to the resulting impacts? - -- , baseMass - -- |> Unit.forKg (Process.getImpact trigram bleachingProcess) - -- |> Quantity.multiplyBy (getAquaticPollutionRealRatio aquaticPollutionScenario) + , baseMass + |> Unit.forKg (Process.getImpact trigram bleachingProcess) + |> Quantity.multiplyBy (getAquaticPollutionRealRatio aquaticPollutionScenario) ] ) diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 4e04ce6ab..5be8cd321 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -11,25 +11,25 @@ "countryMaking=FR" ], "impacts": { - "acd": 52.7170185019362, - "cch": 52.7170185019362, - "etf": 52.7170185019362, - "etf-c": 52.7170185019362, - "fru": 52.7170185019362, - "fwe": 52.7170185019362, - "htc": 52.7170185019362, - "htc-c": 52.7170185019362, - "htn": 52.7170185019362, - "htn-c": 52.7170185019362, - "ior": 52.7170185019362, - "ldu": 52.7170185019362, - "mru": 52.7170185019362, - "ozd": 52.7170185019362, - "pco": 52.7170185019362, - "pma": 52.7170185019362, - "swe": 52.7170185019362, - "tre": 52.7170185019362, - "wtu": 52.7170185019362, + "acd": 52.85224500633107, + "cch": 52.85224500633107, + "etf": 52.85224500633107, + "etf-c": 52.85224500633107, + "fru": 52.85224500633107, + "fwe": 52.85224500633107, + "htc": 52.85224500633107, + "htc-c": 52.85224500633107, + "htn": 52.85224500633107, + "htn-c": 52.85224500633107, + "ior": 52.85224500633107, + "ldu": 52.85224500633107, + "mru": 52.85224500633107, + "ozd": 52.85224500633107, + "pco": 52.85224500633107, + "pma": 52.85224500633107, + "swe": 52.85224500633107, + "tre": 52.85224500633107, + "wtu": 52.85224500633107, "ecs": 1677.549640720743, "pef": 1060.5313989039223 } @@ -47,25 +47,25 @@ "countryMaking=FR" ], "impacts": { - "acd": 53.54241455283054, - "cch": 53.54241455283054, - "etf": 53.54241455283054, - "etf-c": 53.54241455283054, - "fru": 53.54241455283054, - "fwe": 53.54241455283054, - "htc": 53.54241455283054, - "htc-c": 53.54241455283054, - "htn": 53.54241455283054, - "htn-c": 53.54241455283054, - "ior": 53.54241455283054, - "ldu": 53.54241455283054, - "mru": 53.54241455283054, - "ozd": 53.54241455283054, - "pco": 53.54241455283054, - "pma": 53.54241455283054, - "swe": 53.54241455283054, - "tre": 53.54241455283054, - "wtu": 53.54241455283054, + "acd": 53.67764105722541, + "cch": 53.67764105722541, + "etf": 53.67764105722541, + "etf-c": 53.67764105722541, + "fru": 53.67764105722541, + "fwe": 53.67764105722541, + "htc": 53.67764105722541, + "htc-c": 53.67764105722541, + "htn": 53.67764105722541, + "htn-c": 53.67764105722541, + "ior": 53.67764105722541, + "ldu": 53.67764105722541, + "mru": 53.67764105722541, + "ozd": 53.67764105722541, + "pco": 53.67764105722541, + "pma": 53.67764105722541, + "swe": 53.67764105722541, + "tre": 53.67764105722541, + "wtu": 53.67764105722541, "ecs": 1650.278243005741, "pef": 1033.7634269584198 } @@ -82,25 +82,25 @@ "countryMaking=FR" ], "impacts": { - "acd": 95.8107893243677, - "cch": 95.8107893243677, - "etf": 95.8107893243677, - "etf-c": 95.8107893243677, - "fru": 95.8107893243677, - "fwe": 95.8107893243677, - "htc": 95.8107893243677, - "htc-c": 95.8107893243677, - "htn": 95.8107893243677, - "htn-c": 95.8107893243677, - "ior": 95.8107893243677, - "ldu": 95.8107893243677, - "mru": 95.8107893243677, - "ozd": 95.8107893243677, - "pco": 95.8107893243677, - "pma": 95.8107893243677, - "swe": 95.8107893243677, - "tre": 95.8107893243677, - "wtu": 95.8107893243677, + "acd": 96.0991399587391, + "cch": 96.0991399587391, + "etf": 96.0991399587391, + "etf-c": 96.0991399587391, + "fru": 96.0991399587391, + "fwe": 96.0991399587391, + "htc": 96.0991399587391, + "htc-c": 96.0991399587391, + "htn": 96.0991399587391, + "htn-c": 96.0991399587391, + "ior": 96.0991399587391, + "ldu": 96.0991399587391, + "mru": 96.0991399587391, + "ozd": 96.0991399587391, + "pco": 96.0991399587391, + "pma": 96.0991399587391, + "swe": 96.0991399587391, + "tre": 96.0991399587391, + "wtu": 96.0991399587391, "ecs": 2303.546879347947, "pef": 1603.3028235802658 } @@ -119,25 +119,25 @@ "countryMaking=FR" ], "impacts": { - "acd": 57.59513453017385, - "cch": 57.59513453017385, - "etf": 57.59513453017385, - "etf-c": 57.59513453017385, - "fru": 57.59513453017385, - "fwe": 57.59513453017385, - "htc": 57.59513453017385, - "htc-c": 57.59513453017385, - "htn": 57.59513453017385, - "htn-c": 57.59513453017385, - "ior": 57.59513453017385, - "ldu": 57.59513453017385, - "mru": 57.59513453017385, - "ozd": 57.59513453017385, - "pco": 57.59513453017385, - "pma": 57.59513453017385, - "swe": 57.59513453017385, - "tre": 57.59513453017385, - "wtu": 57.59513453017385, + "acd": 57.74892153517193, + "cch": 57.74892153517193, + "etf": 57.74892153517193, + "etf-c": 57.74892153517193, + "fru": 57.74892153517193, + "fwe": 57.74892153517193, + "htc": 57.74892153517193, + "htc-c": 57.74892153517193, + "htn": 57.74892153517193, + "htn-c": 57.74892153517193, + "ior": 57.74892153517193, + "ldu": 57.74892153517193, + "mru": 57.74892153517193, + "ozd": 57.74892153517193, + "pco": 57.74892153517193, + "pma": 57.74892153517193, + "swe": 57.74892153517193, + "tre": 57.74892153517193, + "wtu": 57.74892153517193, "ecs": 1613.8309765812064, "pef": 1003.5595299732271 } @@ -192,25 +192,25 @@ "airTransportRatio=1" ], "impacts": { - "acd": 123.50285318836889, - "cch": 123.50285318836889, - "etf": 123.50285318836889, - "etf-c": 123.50285318836889, - "fru": 123.50285318836889, - "fwe": 123.50285318836889, - "htc": 123.50285318836889, - "htc-c": 123.50285318836889, - "htn": 123.50285318836889, - "htn-c": 123.50285318836889, - "ior": 123.50285318836889, - "ldu": 123.50285318836889, - "mru": 123.50285318836889, - "ozd": 123.50285318836889, - "pco": 123.50285318836889, - "pma": 123.50285318836889, - "swe": 123.50285318836889, - "tre": 123.50285318836889, - "wtu": 123.50285318836889, + "acd": 125.05994661397443, + "cch": 125.05994661397443, + "etf": 125.05994661397443, + "etf-c": 125.05994661397443, + "fru": 125.05994661397443, + "fwe": 125.05994661397443, + "htc": 125.05994661397443, + "htc-c": 125.05994661397443, + "htn": 125.05994661397443, + "htn-c": 125.05994661397443, + "ior": 125.05994661397443, + "ldu": 125.05994661397443, + "mru": 125.05994661397443, + "ozd": 125.05994661397443, + "pco": 125.05994661397443, + "pma": 125.05994661397443, + "swe": 125.05994661397443, + "tre": 125.05994661397443, + "wtu": 125.05994661397443, "ecs": 6961.082647324671, "pef": 4188.120312424041 } @@ -227,25 +227,25 @@ "countryMaking=TR" ], "impacts": { - "acd": 192.67639925647882, - "cch": 192.67639925647882, - "etf": 192.67639925647882, - "etf-c": 192.67639925647882, - "fru": 192.67639925647882, - "fwe": 192.67639925647882, - "htc": 192.67639925647882, - "htc-c": 192.67639925647882, - "htn": 192.67639925647882, - "htn-c": 192.67639925647882, - "ior": 192.67639925647882, - "ldu": 192.67639925647882, - "mru": 192.67639925647882, - "ozd": 192.67639925647882, - "pco": 192.67639925647882, - "pma": 192.67639925647882, - "swe": 192.67639925647882, - "tre": 192.67639925647882, - "wtu": 192.67639925647882, + "acd": 194.0806744944254, + "cch": 194.0806744944254, + "etf": 194.0806744944254, + "etf-c": 194.0806744944254, + "fru": 194.0806744944254, + "fwe": 194.0806744944254, + "htc": 194.0806744944254, + "htc-c": 194.0806744944254, + "htn": 194.0806744944254, + "htn-c": 194.0806744944254, + "ior": 194.0806744944254, + "ldu": 194.0806744944254, + "mru": 194.0806744944254, + "ozd": 194.0806744944254, + "pco": 194.0806744944254, + "pma": 194.0806744944254, + "swe": 194.0806744944254, + "tre": 194.0806744944254, + "wtu": 194.0806744944254, "ecs": 6063.911608340519, "pef": 3838.6210905373723 } @@ -263,25 +263,25 @@ "fading=false" ], "impacts": { - "acd": 144.18634620608094, - "cch": 144.18634620608094, - "etf": 144.18634620608094, - "etf-c": 144.18634620608094, - "fru": 144.18634620608094, - "fwe": 144.18634620608094, - "htc": 144.18634620608094, - "htc-c": 144.18634620608094, - "htn": 144.18634620608094, - "htn-c": 144.18634620608094, - "ior": 144.18634620608094, - "ldu": 144.18634620608094, - "mru": 144.18634620608094, - "ozd": 144.18634620608094, - "pco": 144.18634620608094, - "pma": 144.18634620608094, - "swe": 144.18634620608094, - "tre": 144.18634620608094, - "wtu": 144.18634620608094, + "acd": 145.59062144402756, + "cch": 145.59062144402756, + "etf": 145.59062144402756, + "etf-c": 145.59062144402756, + "fru": 145.59062144402756, + "fwe": 145.59062144402756, + "htc": 145.59062144402756, + "htc-c": 145.59062144402756, + "htn": 145.59062144402756, + "htn-c": 145.59062144402756, + "ior": 145.59062144402756, + "ldu": 145.59062144402756, + "mru": 145.59062144402756, + "ozd": 145.59062144402756, + "pco": 145.59062144402756, + "pma": 145.59062144402756, + "swe": 145.59062144402756, + "tre": 145.59062144402756, + "wtu": 145.59062144402756, "ecs": 5693.159851025861, "pef": 3427.4496784285016 } @@ -300,25 +300,25 @@ "reparability=1.15" ], "impacts": { - "acd": 52.7170185019362, - "cch": 52.7170185019362, - "etf": 52.7170185019362, - "etf-c": 52.7170185019362, - "fru": 52.7170185019362, - "fwe": 52.7170185019362, - "htc": 52.7170185019362, - "htc-c": 52.7170185019362, - "htn": 52.7170185019362, - "htn-c": 52.7170185019362, - "ior": 52.7170185019362, - "ldu": 52.7170185019362, - "mru": 52.7170185019362, - "ozd": 52.7170185019362, - "pco": 52.7170185019362, - "pma": 52.7170185019362, - "swe": 52.7170185019362, - "tre": 52.7170185019362, - "wtu": 52.7170185019362, + "acd": 52.85224500633107, + "cch": 52.85224500633107, + "etf": 52.85224500633107, + "etf-c": 52.85224500633107, + "fru": 52.85224500633107, + "fwe": 52.85224500633107, + "htc": 52.85224500633107, + "htc-c": 52.85224500633107, + "htn": 52.85224500633107, + "htn-c": 52.85224500633107, + "ior": 52.85224500633107, + "ldu": 52.85224500633107, + "mru": 52.85224500633107, + "ozd": 52.85224500633107, + "pco": 52.85224500633107, + "pma": 52.85224500633107, + "swe": 52.85224500633107, + "tre": 52.85224500633107, + "wtu": 52.85224500633107, "ecs": 1677.549640720743, "pef": 1060.5313989039223 } @@ -336,25 +336,25 @@ "makingWaste=0" ], "impacts": { - "acd": 46.99908400250784, - "cch": 46.99908400250784, - "etf": 46.99908400250784, - "etf-c": 46.99908400250784, - "fru": 46.99908400250784, - "fwe": 46.99908400250784, - "htc": 46.99908400250784, - "htc-c": 46.99908400250784, - "htn": 46.99908400250784, - "htn-c": 46.99908400250784, - "ior": 46.99908400250784, - "ldu": 46.99908400250784, - "mru": 46.99908400250784, - "ozd": 46.99908400250784, - "pco": 46.99908400250784, - "pma": 46.99908400250784, - "swe": 46.99908400250784, - "tre": 46.99908400250784, - "wtu": 46.99908400250784, + "acd": 47.114026531243475, + "cch": 47.114026531243475, + "etf": 47.114026531243475, + "etf-c": 47.114026531243475, + "fru": 47.114026531243475, + "fwe": 47.114026531243475, + "htc": 47.114026531243475, + "htc-c": 47.114026531243475, + "htn": 47.114026531243475, + "htn-c": 47.114026531243475, + "ior": 47.114026531243475, + "ldu": 47.114026531243475, + "mru": 47.114026531243475, + "ozd": 47.114026531243475, + "pco": 47.114026531243475, + "pma": 47.114026531243475, + "swe": 47.114026531243475, + "tre": 47.114026531243475, + "wtu": 47.114026531243475, "ecs": 1480.30018603679, "pef": 940.826539897898 } @@ -372,25 +372,25 @@ "makingWaste=0.25" ], "impacts": { - "acd": 57.799626945872525, - "cch": 57.799626945872525, - "etf": 57.799626945872525, - "etf-c": 57.799626945872525, - "fru": 57.799626945872525, - "fwe": 57.799626945872525, - "htc": 57.799626945872525, - "htc-c": 57.799626945872525, - "htn": 57.799626945872525, - "htn-c": 57.799626945872525, - "ior": 57.799626945872525, - "ldu": 57.799626945872525, - "mru": 57.799626945872525, - "ozd": 57.799626945872525, - "pco": 57.799626945872525, - "pma": 57.799626945872525, - "swe": 57.799626945872525, - "tre": 57.799626945872525, - "wtu": 57.799626945872525, + "acd": 57.952883650853366, + "cch": 57.952883650853366, + "etf": 57.952883650853366, + "etf-c": 57.952883650853366, + "fru": 57.952883650853366, + "fwe": 57.952883650853366, + "htc": 57.952883650853366, + "htc-c": 57.952883650853366, + "htn": 57.952883650853366, + "htn-c": 57.952883650853366, + "ior": 57.952883650853366, + "ldu": 57.952883650853366, + "mru": 57.952883650853366, + "ozd": 57.952883650853366, + "pco": 57.952883650853366, + "pma": 57.952883650853366, + "swe": 57.952883650853366, + "tre": 57.952883650853366, + "wtu": 57.952883650853366, "ecs": 1852.8824893287, "pef": 1166.9357180203883 } @@ -409,25 +409,25 @@ "surfaceMass=300" ], "impacts": { - "acd": 91.25802453688539, - "cch": 91.25802453688539, - "etf": 91.25802453688539, - "etf-c": 91.25802453688539, - "fru": 91.25802453688539, - "fwe": 91.25802453688539, - "htc": 91.25802453688539, - "htc-c": 91.25802453688539, - "htn": 91.25802453688539, - "htn-c": 91.25802453688539, - "ior": 91.25802453688539, - "ldu": 91.25802453688539, - "mru": 91.25802453688539, - "ozd": 91.25802453688539, - "pco": 91.25802453688539, - "pma": 91.25802453688539, - "swe": 91.25802453688539, - "tre": 91.25802453688539, - "wtu": 91.25802453688539, + "acd": 91.49665954464102, + "cch": 91.49665954464102, + "etf": 91.49665954464102, + "etf-c": 91.49665954464102, + "fru": 91.49665954464102, + "fwe": 91.49665954464102, + "htc": 91.49665954464102, + "htc-c": 91.49665954464102, + "htn": 91.49665954464102, + "htn-c": 91.49665954464102, + "ior": 91.49665954464102, + "ldu": 91.49665954464102, + "mru": 91.49665954464102, + "ozd": 91.49665954464102, + "pco": 91.49665954464102, + "pma": 91.49665954464102, + "swe": 91.49665954464102, + "tre": 91.49665954464102, + "wtu": 91.49665954464102, "ecs": 2928.0775528423774, "pef": 1833.164572424912 } @@ -446,25 +446,25 @@ "printing=pigment" ], "impacts": { - "acd": 97.04253712488206, - "cch": 97.04253712488206, - "etf": 97.04253712488206, - "etf-c": 97.04253712488206, - "fru": 97.04253712488206, - "fwe": 97.04253712488206, - "htc": 97.04253712488206, - "htc-c": 97.04253712488206, - "htn": 97.04253712488206, - "htn-c": 97.04253712488206, - "ior": 97.04253712488206, - "ldu": 97.04253712488206, - "mru": 97.04253712488206, - "ozd": 97.04253712488206, - "pco": 97.04253712488206, - "pma": 97.04253712488206, - "swe": 97.04253712488206, - "tre": 97.04253712488206, - "wtu": 97.04253712488206, + "acd": 97.28117213263769, + "cch": 97.28117213263769, + "etf": 97.28117213263769, + "etf-c": 97.28117213263769, + "fru": 97.28117213263769, + "fwe": 97.28117213263769, + "htc": 97.28117213263769, + "htc-c": 97.28117213263769, + "htn": 97.28117213263769, + "htn-c": 97.28117213263769, + "ior": 97.28117213263769, + "ldu": 97.28117213263769, + "mru": 97.28117213263769, + "ozd": 97.28117213263769, + "pco": 97.28117213263769, + "pma": 97.28117213263769, + "swe": 97.28117213263769, + "tre": 97.28117213263769, + "wtu": 97.28117213263769, "ecs": 2989.562486002309, "pef": 1870.3427973608746 } @@ -483,25 +483,25 @@ "printing=substantive" ], "impacts": { - "acd": 97.98944083565642, - "cch": 97.98944083565642, - "etf": 97.98944083565642, - "etf-c": 97.98944083565642, - "fru": 97.98944083565642, - "fwe": 97.98944083565642, - "htc": 97.98944083565642, - "htc-c": 97.98944083565642, - "htn": 97.98944083565642, - "htn-c": 97.98944083565642, - "ior": 97.98944083565642, - "ldu": 97.98944083565642, - "mru": 97.98944083565642, - "ozd": 97.98944083565642, - "pco": 97.98944083565642, - "pma": 97.98944083565642, - "swe": 97.98944083565642, - "tre": 97.98944083565642, - "wtu": 97.98944083565642, + "acd": 98.22807584341206, + "cch": 98.22807584341206, + "etf": 98.22807584341206, + "etf-c": 98.22807584341206, + "fru": 98.22807584341206, + "fwe": 98.22807584341206, + "htc": 98.22807584341206, + "htc-c": 98.22807584341206, + "htn": 98.22807584341206, + "htn-c": 98.22807584341206, + "ior": 98.22807584341206, + "ldu": 98.22807584341206, + "mru": 98.22807584341206, + "ozd": 98.22807584341206, + "pco": 98.22807584341206, + "pma": 98.22807584341206, + "swe": 98.22807584341206, + "tre": 98.22807584341206, + "wtu": 98.22807584341206, "ecs": 2976.384860476527, "pef": 1875.6259027754365 } @@ -520,25 +520,25 @@ "printing=pigment;0.5" ], "impacts": { - "acd": 104.4306769649966, - "cch": 104.4306769649966, - "etf": 104.4306769649966, - "etf-c": 104.4306769649966, - "fru": 104.4306769649966, - "fwe": 104.4306769649966, - "htc": 104.4306769649966, - "htc-c": 104.4306769649966, - "htn": 104.4306769649966, - "htn-c": 104.4306769649966, - "ior": 104.4306769649966, - "ldu": 104.4306769649966, - "mru": 104.4306769649966, - "ozd": 104.4306769649966, - "pco": 104.4306769649966, - "pma": 104.4306769649966, - "swe": 104.4306769649966, - "tre": 104.4306769649966, - "wtu": 104.4306769649966, + "acd": 104.66931197275224, + "cch": 104.66931197275224, + "etf": 104.66931197275224, + "etf-c": 104.66931197275224, + "fru": 104.66931197275224, + "fwe": 104.66931197275224, + "htc": 104.66931197275224, + "htc-c": 104.66931197275224, + "htn": 104.66931197275224, + "htn-c": 104.66931197275224, + "ior": 104.66931197275224, + "ldu": 104.66931197275224, + "mru": 104.66931197275224, + "ozd": 104.66931197275224, + "pco": 104.66931197275224, + "pma": 104.66931197275224, + "swe": 104.66931197275224, + "tre": 104.66931197275224, + "wtu": 104.66931197275224, "ecs": 3074.292141257567, "pef": 1917.1390045956944 } @@ -556,25 +556,25 @@ "ennoblingHeatSource=coal" ], "impacts": { - "acd": 89.39214597824083, - "cch": 89.39214597824083, - "etf": 89.39214597824083, - "etf-c": 89.39214597824083, - "fru": 89.39214597824083, - "fwe": 89.39214597824083, - "htc": 89.39214597824083, - "htc-c": 89.39214597824083, - "htn": 89.39214597824083, - "htn-c": 89.39214597824083, - "ior": 89.39214597824083, - "ldu": 89.39214597824083, - "mru": 89.39214597824083, - "ozd": 89.39214597824083, - "pco": 89.39214597824083, - "pma": 89.39214597824083, - "swe": 89.39214597824083, - "tre": 89.39214597824083, - "wtu": 89.39214597824083, + "acd": 90.94327352865248, + "cch": 90.94327352865248, + "etf": 90.94327352865248, + "etf-c": 90.94327352865248, + "fru": 90.94327352865248, + "fwe": 90.94327352865248, + "htc": 90.94327352865248, + "htc-c": 90.94327352865248, + "htn": 90.94327352865248, + "htn-c": 90.94327352865248, + "ior": 90.94327352865248, + "ldu": 90.94327352865248, + "mru": 90.94327352865248, + "ozd": 90.94327352865248, + "pco": 90.94327352865248, + "pma": 90.94327352865248, + "swe": 90.94327352865248, + "tre": 90.94327352865248, + "wtu": 90.94327352865248, "ecs": 4009.5752064709923, "pef": 2300.10014617678 } From f8e3e38cc07d1cda767eb2110a07e055cf992b2e Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Tue, 23 Apr 2024 18:10:07 +0200 Subject: [PATCH 03/12] Bleaching should only apply to non-synthetic materials. --- src/Data/Impact.elm | 6 ++ src/Data/Textile/Simulator.elm | 21 ++-- tests/e2e-textile.json | 170 ++++++++++++++++----------------- 3 files changed, 105 insertions(+), 92 deletions(-) diff --git a/src/Data/Impact.elm b/src/Data/Impact.elm index 2131b6b73..538a84637 100644 --- a/src/Data/Impact.elm +++ b/src/Data/Impact.elm @@ -3,6 +3,7 @@ module Data.Impact exposing , Impacts , StepsImpacts , addComplementsImpacts + , addImpacts , applyComplements , complementsImpactAsChartEntries , decodeImpacts @@ -400,6 +401,11 @@ perKg totalMass = mapImpacts (\_ -> Quantity.divideBy (Mass.inKilograms totalMass)) +addImpacts : Impacts -> Impacts -> Impacts +addImpacts a b = + sumImpacts [ a, b ] + + sumImpacts : List Impacts -> Impacts sumImpacts = List.foldl diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index 385fed288..ad8f0b39f 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -140,14 +140,14 @@ compute db query = |> nextIf Label.Spinning computeSpinningImpacts -- Compute Weaving & Knitting step impacts |> nextWithDbIf Label.Fabric computeFabricImpacts + -- Compute Ennobling step bleaching impacts + |> nextWithDbIf Label.Ennobling computeBleachingImpacts -- Compute Ennobling step Dyeing impacts |> nextWithDbIf Label.Ennobling computeDyeingImpacts -- Compute Ennobling step Printing impacts |> nextWithDbIf Label.Ennobling computePrintingImpacts -- Compute Ennobling step Finishing impacts |> nextWithDbIf Label.Ennobling computeFinishingImpacts - -- Compute Ennobling step bleaching impacts - |> nextWithDbIf Label.Ennobling computeBleachingImpacts -- Compute Making step impacts |> nextWithDbIf Label.Making computeMakingImpacts -- Compute product Use impacts @@ -384,7 +384,7 @@ computeFinishingImpacts { textile } simulator = { step | heat = step.heat |> Quantity.plus heat , kwh = step.kwh |> Quantity.plus kwh - , impacts = Impact.sumImpacts [ step.impacts, impacts ] + , impacts = step.impacts |> Impact.addImpacts impacts } ) @@ -394,18 +394,25 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> + -- Note: bleaching only applies to non-synthetic materials let - impacts = + nonSyntheticMaterialsShare = + inputs.materials + |> List.filter (\{ material } -> material.origin /= Origin.Synthetic) + |> List.map (.share >> Split.toFloat) + |> List.sum + in + { step + | impacts = step.outputMass + |> Quantity.multiplyBy nonSyntheticMaterialsShare |> Formula.bleachingImpacts step.impacts { bleachingProcess = textile.wellKnown.bleaching , aquaticPollutionScenario = step.country.aquaticPollutionScenario , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } - in - { step - | impacts = Impact.sumImpacts [ step.impacts, impacts ] + |> Impact.addImpacts step.impacts } ) diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 5be8cd321..880abf40c 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -66,7 +66,7 @@ "swe": 53.67764105722541, "tre": 53.67764105722541, "wtu": 53.67764105722541, - "ecs": 1650.278243005741, + "ecs": 1650.2782430057414, "pef": 1033.7634269584198 } }, @@ -82,27 +82,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 96.0991399587391, - "cch": 96.0991399587391, - "etf": 96.0991399587391, - "etf-c": 96.0991399587391, - "fru": 96.0991399587391, - "fwe": 96.0991399587391, - "htc": 96.0991399587391, - "htc-c": 96.0991399587391, - "htn": 96.0991399587391, - "htn-c": 96.0991399587391, - "ior": 96.0991399587391, - "ldu": 96.0991399587391, - "mru": 96.0991399587391, - "ozd": 96.0991399587391, - "pco": 96.0991399587391, - "pma": 96.0991399587391, - "swe": 96.0991399587391, - "tre": 96.0991399587391, - "wtu": 96.0991399587391, - "ecs": 2303.546879347947, - "pef": 1603.3028235802658 + "acd": 89.99764053544038, + "cch": 89.99764053544038, + "etf": 89.99764053544038, + "etf-c": 89.99764053544038, + "fru": 89.99764053544038, + "fwe": 89.99764053544038, + "htc": 89.99764053544038, + "htc-c": 89.99764053544038, + "htn": 89.99764053544038, + "htn-c": 89.99764053544038, + "ior": 89.99764053544038, + "ldu": 89.99764053544038, + "mru": 89.99764053544038, + "ozd": 89.99764053544038, + "pco": 89.99764053544038, + "pma": 89.99764053544038, + "swe": 89.99764053544038, + "tre": 89.99764053544038, + "wtu": 89.99764053544038, + "ecs": 2280.6584474295883, + "pef": 1578.0173811213674 } }, { @@ -119,27 +119,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 57.74892153517193, - "cch": 57.74892153517193, - "etf": 57.74892153517193, - "etf-c": 57.74892153517193, - "fru": 57.74892153517193, - "fwe": 57.74892153517193, - "htc": 57.74892153517193, - "htc-c": 57.74892153517193, - "htn": 57.74892153517193, - "htn-c": 57.74892153517193, - "ior": 57.74892153517193, - "ldu": 57.74892153517193, - "mru": 57.74892153517193, - "ozd": 57.74892153517193, - "pco": 57.74892153517193, - "pma": 57.74892153517193, - "swe": 57.74892153517193, - "tre": 57.74892153517193, - "wtu": 57.74892153517193, - "ecs": 1613.8309765812064, - "pef": 1003.5595299732271 + "acd": 56.12185502229227, + "cch": 56.12185502229227, + "etf": 56.12185502229227, + "etf-c": 56.12185502229227, + "fru": 56.12185502229227, + "fwe": 56.12185502229227, + "htc": 56.12185502229227, + "htc-c": 56.12185502229227, + "htn": 56.12185502229227, + "htn-c": 56.12185502229227, + "ior": 56.12185502229227, + "ldu": 56.12185502229227, + "mru": 56.12185502229227, + "ozd": 56.12185502229227, + "pco": 56.12185502229227, + "pma": 56.12185502229227, + "swe": 56.12185502229227, + "tre": 56.12185502229227, + "wtu": 56.12185502229227, + "ecs": 1607.7273947363105, + "pef": 996.8167453175207 } }, { @@ -192,27 +192,27 @@ "airTransportRatio=1" ], "impacts": { - "acd": 125.05994661397443, - "cch": 125.05994661397443, - "etf": 125.05994661397443, - "etf-c": 125.05994661397443, - "fru": 125.05994661397443, - "fwe": 125.05994661397443, - "htc": 125.05994661397443, - "htc-c": 125.05994661397443, - "htn": 125.05994661397443, - "htn-c": 125.05994661397443, - "ior": 125.05994661397443, - "ldu": 125.05994661397443, - "mru": 125.05994661397443, - "ozd": 125.05994661397443, - "pco": 125.05994661397443, - "pma": 125.05994661397443, - "swe": 125.05994661397443, - "tre": 125.05994661397443, - "wtu": 125.05994661397443, - "ecs": 6961.082647324671, - "pef": 4188.120312424041 + "acd": 124.03226495307477, + "cch": 124.03226495307477, + "etf": 124.03226495307477, + "etf-c": 124.03226495307477, + "fru": 124.03226495307477, + "fwe": 124.03226495307477, + "htc": 124.03226495307477, + "htc-c": 124.03226495307477, + "htn": 124.03226495307477, + "htn-c": 124.03226495307477, + "ior": 124.03226495307477, + "ldu": 124.03226495307477, + "mru": 124.03226495307477, + "ozd": 124.03226495307477, + "pco": 124.03226495307477, + "pma": 124.03226495307477, + "swe": 124.03226495307477, + "tre": 124.03226495307477, + "wtu": 124.03226495307477, + "ecs": 6954.337927157023, + "pef": 4180.737677236574 } }, { @@ -446,25 +446,25 @@ "printing=pigment" ], "impacts": { - "acd": 97.28117213263769, - "cch": 97.28117213263769, - "etf": 97.28117213263769, - "etf-c": 97.28117213263769, - "fru": 97.28117213263769, - "fwe": 97.28117213263769, - "htc": 97.28117213263769, - "htc-c": 97.28117213263769, - "htn": 97.28117213263769, - "htn-c": 97.28117213263769, - "ior": 97.28117213263769, - "ldu": 97.28117213263769, - "mru": 97.28117213263769, - "ozd": 97.28117213263769, - "pco": 97.28117213263769, - "pma": 97.28117213263769, - "swe": 97.28117213263769, - "tre": 97.28117213263769, - "wtu": 97.28117213263769, + "acd": 97.28117213263768, + "cch": 97.28117213263768, + "etf": 97.28117213263768, + "etf-c": 97.28117213263768, + "fru": 97.28117213263768, + "fwe": 97.28117213263768, + "htc": 97.28117213263768, + "htc-c": 97.28117213263768, + "htn": 97.28117213263768, + "htn-c": 97.28117213263768, + "ior": 97.28117213263768, + "ldu": 97.28117213263768, + "mru": 97.28117213263768, + "ozd": 97.28117213263768, + "pco": 97.28117213263768, + "pma": 97.28117213263768, + "swe": 97.28117213263768, + "tre": 97.28117213263768, + "wtu": 97.28117213263768, "ecs": 2989.562486002309, "pef": 1870.3427973608746 } @@ -503,7 +503,7 @@ "tre": 98.22807584341206, "wtu": 98.22807584341206, "ecs": 2976.384860476527, - "pef": 1875.6259027754365 + "pef": 1875.625902775437 } }, { @@ -575,7 +575,7 @@ "swe": 90.94327352865248, "tre": 90.94327352865248, "wtu": 90.94327352865248, - "ecs": 4009.5752064709923, + "ecs": 4009.575206470993, "pef": 2300.10014617678 } } From 427c2b5a105f1d3516578542b764f459624471b0 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 16:36:07 +0200 Subject: [PATCH 04/12] Implement desizing impacts. --- src/Data/Textile/Formula.elm | 27 ++++++ src/Data/Textile/Simulator.elm | 25 +++++ tests/e2e-textile.json | 168 ++++++++++++++++----------------- 3 files changed, 136 insertions(+), 84 deletions(-) diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index 7473ad48c..529e161e6 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -2,6 +2,7 @@ module Data.Textile.Formula exposing ( bleachingImpacts , computePicking , computeThreadDensity + , desizingImpacts , dyeingImpacts , endOfLifeImpacts , finishingImpacts @@ -289,6 +290,32 @@ bleachingImpacts impacts { bleachingProcess, aquaticPollutionScenario, countryEl ) +desizingImpacts : + Impacts + -> + { desizingProcess : Process -- Inbound: Bleaching process + , countryElecProcess : Process + , countryHeatProcess : Process + } + -> Mass + -> Impacts +desizingImpacts impacts { desizingProcess, countryElecProcess, countryHeatProcess } baseMass = + impacts + |> Impact.mapImpacts + (\trigram _ -> + Quantity.sum + [ desizingProcess.elec + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forKWh (Process.getImpact trigram countryElecProcess) + , desizingProcess.heat + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) + , baseMass + |> Unit.forKg (Process.getImpact trigram desizingProcess) + ] + ) + + materialDyeingToxicityImpacts : Impacts -> diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index ad8f0b39f..d927a7dc0 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -142,6 +142,8 @@ compute db query = |> nextWithDbIf Label.Fabric computeFabricImpacts -- Compute Ennobling step bleaching impacts |> nextWithDbIf Label.Ennobling computeBleachingImpacts + -- Compute Ennobling step desizing impacts + |> nextWithDbIf Label.Ennobling computeDesizingImpacts -- Compute Ennobling step Dyeing impacts |> nextWithDbIf Label.Ennobling computeDyeingImpacts -- Compute Ennobling step Printing impacts @@ -417,6 +419,29 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = ) +computeDesizingImpacts : Db -> Simulator -> Simulator +computeDesizingImpacts { textile } ({ inputs } as simulator) = + simulator + |> updateLifeCycleStep Label.Ennobling + (\step -> + -- Note: desizing only applies to weaved products + if inputs.product.fabric == Fabric.Weaving then + { step + | impacts = + step.outputMass + |> Formula.desizingImpacts step.impacts + { desizingProcess = textile.wellKnown.desizing + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> Impact.addImpacts step.impacts + } + + else + step + ) + + stepMaterialImpacts : Db -> Material -> Step -> Impacts stepMaterialImpacts { textile } material step = case Material.getRecyclingData material textile.materials of diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 880abf40c..7cc151935 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -82,27 +82,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 89.99764053544038, - "cch": 89.99764053544038, - "etf": 89.99764053544038, - "etf-c": 89.99764053544038, - "fru": 89.99764053544038, - "fwe": 89.99764053544038, - "htc": 89.99764053544038, - "htc-c": 89.99764053544038, - "htn": 89.99764053544038, - "htn-c": 89.99764053544038, - "ior": 89.99764053544038, - "ldu": 89.99764053544038, - "mru": 89.99764053544038, - "ozd": 89.99764053544038, - "pco": 89.99764053544038, - "pma": 89.99764053544038, - "swe": 89.99764053544038, - "tre": 89.99764053544038, - "wtu": 89.99764053544038, - "ecs": 2280.6584474295883, - "pef": 1578.0173811213674 + "acd": 94.46130835550957, + "cch": 94.46130835550957, + "etf": 94.46130835550957, + "etf-c": 94.46130835550957, + "fru": 94.46130835550957, + "fwe": 94.46130835550957, + "htc": 94.46130835550957, + "htc-c": 94.46130835550957, + "htn": 94.46130835550957, + "htn-c": 94.46130835550957, + "ior": 94.46130835550957, + "ldu": 94.46130835550957, + "mru": 94.46130835550957, + "ozd": 94.46130835550957, + "pco": 94.46130835550957, + "pma": 94.46130835550957, + "swe": 94.46130835550957, + "tre": 94.46130835550957, + "wtu": 94.46130835550957, + "ecs": 2293.8689286317367, + "pef": 1592.582100838713 } }, { @@ -192,27 +192,27 @@ "airTransportRatio=1" ], "impacts": { - "acd": 124.03226495307477, - "cch": 124.03226495307477, - "etf": 124.03226495307477, - "etf-c": 124.03226495307477, - "fru": 124.03226495307477, - "fwe": 124.03226495307477, - "htc": 124.03226495307477, - "htc-c": 124.03226495307477, - "htn": 124.03226495307477, - "htn-c": 124.03226495307477, - "ior": 124.03226495307477, - "ldu": 124.03226495307477, - "mru": 124.03226495307477, - "ozd": 124.03226495307477, - "pco": 124.03226495307477, - "pma": 124.03226495307477, - "swe": 124.03226495307477, - "tre": 124.03226495307477, - "wtu": 124.03226495307477, - "ecs": 6954.337927157023, - "pef": 4180.737677236574 + "acd": 130.7277666831786, + "cch": 130.7277666831786, + "etf": 130.7277666831786, + "etf-c": 130.7277666831786, + "fru": 130.7277666831786, + "fwe": 130.7277666831786, + "htc": 130.7277666831786, + "htc-c": 130.7277666831786, + "htn": 130.7277666831786, + "htn-c": 130.7277666831786, + "ior": 130.7277666831786, + "ldu": 130.7277666831786, + "mru": 130.7277666831786, + "ozd": 130.7277666831786, + "pco": 130.7277666831786, + "pma": 130.7277666831786, + "swe": 130.7277666831786, + "tre": 130.7277666831786, + "wtu": 130.7277666831786, + "ecs": 6992.656792636041, + "pef": 4222.729172801629 } }, { @@ -227,27 +227,27 @@ "countryMaking=TR" ], "impacts": { - "acd": 194.0806744944254, - "cch": 194.0806744944254, - "etf": 194.0806744944254, - "etf-c": 194.0806744944254, - "fru": 194.0806744944254, - "fwe": 194.0806744944254, - "htc": 194.0806744944254, - "htc-c": 194.0806744944254, - "htn": 194.0806744944254, - "htn-c": 194.0806744944254, - "ior": 194.0806744944254, - "ldu": 194.0806744944254, - "mru": 194.0806744944254, - "ozd": 194.0806744944254, - "pco": 194.0806744944254, - "pma": 194.0806744944254, - "swe": 194.0806744944254, - "tre": 194.0806744944254, - "wtu": 194.0806744944254, - "ecs": 6063.911608340519, - "pef": 3838.6210905373723 + "acd": 200.119058017596, + "cch": 200.119058017596, + "etf": 200.119058017596, + "etf-c": 200.119058017596, + "fru": 200.119058017596, + "fwe": 200.119058017596, + "htc": 200.119058017596, + "htc-c": 200.119058017596, + "htn": 200.119058017596, + "htn-c": 200.119058017596, + "ior": 200.119058017596, + "ldu": 200.119058017596, + "mru": 200.119058017596, + "ozd": 200.119058017596, + "pco": 200.119058017596, + "pma": 200.119058017596, + "swe": 200.119058017596, + "tre": 200.119058017596, + "wtu": 200.119058017596, + "ecs": 6095.9768283303665, + "pef": 3874.045302215825 } }, { @@ -263,27 +263,27 @@ "fading=false" ], "impacts": { - "acd": 145.59062144402756, - "cch": 145.59062144402756, - "etf": 145.59062144402756, - "etf-c": 145.59062144402756, - "fru": 145.59062144402756, - "fwe": 145.59062144402756, - "htc": 145.59062144402756, - "htc-c": 145.59062144402756, - "htn": 145.59062144402756, - "htn-c": 145.59062144402756, - "ior": 145.59062144402756, - "ldu": 145.59062144402756, - "mru": 145.59062144402756, - "ozd": 145.59062144402756, - "pco": 145.59062144402756, - "pma": 145.59062144402756, - "swe": 145.59062144402756, - "tre": 145.59062144402756, - "wtu": 145.59062144402756, - "ecs": 5693.159851025861, - "pef": 3427.4496784285016 + "acd": 151.6290049671981, + "cch": 151.6290049671981, + "etf": 151.6290049671981, + "etf-c": 151.6290049671981, + "fru": 151.6290049671981, + "fwe": 151.6290049671981, + "htc": 151.6290049671981, + "htc-c": 151.6290049671981, + "htn": 151.6290049671981, + "htn-c": 151.6290049671981, + "ior": 151.6290049671981, + "ldu": 151.6290049671981, + "mru": 151.6290049671981, + "ozd": 151.6290049671981, + "pco": 151.6290049671981, + "pma": 151.6290049671981, + "swe": 151.6290049671981, + "tre": 151.6290049671981, + "wtu": 151.6290049671981, + "ecs": 5725.225071015709, + "pef": 3462.8738901069546 } }, { From 896b5d188180a2cd3c206e815850f09b93b79101 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 16:43:51 +0200 Subject: [PATCH 05/12] Implement scouring impacts. --- src/Data/Textile/Formula.elm | 27 ++ src/Data/Textile/Simulator.elm | 32 ++ tests/Data/Textile/SimulatorTest.elm | 2 +- tests/e2e-textile.json | 588 +++++++++++++-------------- 4 files changed, 354 insertions(+), 295 deletions(-) diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index 529e161e6..434493d56 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -16,6 +16,7 @@ module Data.Textile.Formula exposing , printingImpacts , pureMaterialImpacts , recycledMaterialImpacts + , scouringImpacts , spinningImpacts , transportRatio , useImpacts @@ -316,6 +317,32 @@ desizingImpacts impacts { desizingProcess, countryElecProcess, countryHeatProces ) +scouringImpacts : + Impacts + -> + { scouringProcess : Process -- Inbound: scouring process + , countryElecProcess : Process + , countryHeatProcess : Process + } + -> Mass + -> Impacts +scouringImpacts impacts { scouringProcess, countryElecProcess, countryHeatProcess } baseMass = + impacts + |> Impact.mapImpacts + (\trigram _ -> + Quantity.sum + [ scouringProcess.elec + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forKWh (Process.getImpact trigram countryElecProcess) + , scouringProcess.heat + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) + , baseMass + |> Unit.forKg (Process.getImpact trigram scouringProcess) + ] + ) + + materialDyeingToxicityImpacts : Impacts -> diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index d927a7dc0..b6fd5a753 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -144,6 +144,8 @@ compute db query = |> nextWithDbIf Label.Ennobling computeBleachingImpacts -- Compute Ennobling step desizing impacts |> nextWithDbIf Label.Ennobling computeDesizingImpacts + -- Compute Ennobling step scouring impacts + |> nextWithDbIf Label.Ennobling computeScouringImpacts -- Compute Ennobling step Dyeing impacts |> nextWithDbIf Label.Ennobling computeDyeingImpacts -- Compute Ennobling step Printing impacts @@ -442,6 +444,36 @@ computeDesizingImpacts { textile } ({ inputs } as simulator) = ) +computeScouringImpacts : Db -> Simulator -> Simulator +computeScouringImpacts { textile } ({ inputs } as simulator) = + simulator + |> updateLifeCycleStep Label.Ennobling + (\step -> + -- Note: desizing only applies to natural materials + let + naturalMaterialsShare = + inputs.materials + |> List.filter + (\{ material } -> + List.member material.origin [ Origin.NaturalFromAnimal, Origin.NaturalFromVegetal ] + ) + |> List.map (.share >> Split.toFloat) + |> List.sum + in + { step + | impacts = + step.outputMass + |> Quantity.multiplyBy naturalMaterialsShare + |> Formula.scouringImpacts step.impacts + { scouringProcess = textile.wellKnown.scouring + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> Impact.addImpacts step.impacts + } + ) + + stepMaterialImpacts : Db -> Material -> Step -> Impacts stepMaterialImpacts { textile } material step = case Material.getRecyclingData material textile.materials of diff --git a/tests/Data/Textile/SimulatorTest.elm b/tests/Data/Textile/SimulatorTest.elm index 00c31535b..a79171365 100644 --- a/tests/Data/Textile/SimulatorTest.elm +++ b/tests/Data/Textile/SimulatorTest.elm @@ -47,7 +47,7 @@ suite = [ { tShirtCotonFrance | countrySpinning = Nothing } - |> expectImpact db ecs 1677.549640720743 + |> expectImpact db ecs 1702.5962976180485 |> asTest "should compute a simulation ecs impact" , describe "disabled steps" [ { tShirtCotonFrance | disabledSteps = [ Label.Ennobling ] } diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 7cc151935..330c58b56 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -11,27 +11,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 52.85224500633107, - "cch": 52.85224500633107, - "etf": 52.85224500633107, - "etf-c": 52.85224500633107, - "fru": 52.85224500633107, - "fwe": 52.85224500633107, - "htc": 52.85224500633107, - "htc-c": 52.85224500633107, - "htn": 52.85224500633107, - "htn-c": 52.85224500633107, - "ior": 52.85224500633107, - "ldu": 52.85224500633107, - "mru": 52.85224500633107, - "ozd": 52.85224500633107, - "pco": 52.85224500633107, - "pma": 52.85224500633107, - "swe": 52.85224500633107, - "tre": 52.85224500633107, - "wtu": 52.85224500633107, - "ecs": 1677.549640720743, - "pef": 1060.5313989039223 + "acd": 60.05711316048926, + "cch": 60.05711316048926, + "etf": 60.05711316048926, + "etf-c": 60.05711316048926, + "fru": 60.05711316048926, + "fwe": 60.05711316048926, + "htc": 60.05711316048926, + "htc-c": 60.05711316048926, + "htn": 60.05711316048926, + "htn-c": 60.05711316048926, + "ior": 60.05711316048926, + "ldu": 60.05711316048926, + "mru": 60.05711316048926, + "ozd": 60.05711316048926, + "pco": 60.05711316048926, + "pma": 60.05711316048926, + "swe": 60.05711316048926, + "tre": 60.05711316048926, + "wtu": 60.05711316048926, + "ecs": 1702.5962976180485, + "pef": 1088.0529907681896 } }, { @@ -47,27 +47,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 53.67764105722541, - "cch": 53.67764105722541, - "etf": 53.67764105722541, - "etf-c": 53.67764105722541, - "fru": 53.67764105722541, - "fwe": 53.67764105722541, - "htc": 53.67764105722541, - "htc-c": 53.67764105722541, - "htn": 53.67764105722541, - "htn-c": 53.67764105722541, - "ior": 53.67764105722541, - "ldu": 53.67764105722541, - "mru": 53.67764105722541, - "ozd": 53.67764105722541, - "pco": 53.67764105722541, - "pma": 53.67764105722541, - "swe": 53.67764105722541, - "tre": 53.67764105722541, - "wtu": 53.67764105722541, - "ecs": 1650.2782430057414, - "pef": 1033.7634269584198 + "acd": 60.8825092113836, + "cch": 60.8825092113836, + "etf": 60.8825092113836, + "etf-c": 60.8825092113836, + "fru": 60.8825092113836, + "fwe": 60.8825092113836, + "htc": 60.8825092113836, + "htc-c": 60.8825092113836, + "htn": 60.8825092113836, + "htn-c": 60.8825092113836, + "ior": 60.8825092113836, + "ldu": 60.8825092113836, + "mru": 60.8825092113836, + "ozd": 60.8825092113836, + "pco": 60.8825092113836, + "pma": 60.8825092113836, + "swe": 60.8825092113836, + "tre": 60.8825092113836, + "wtu": 60.8825092113836, + "ecs": 1675.324899903047, + "pef": 1061.285018822687 } }, { @@ -119,27 +119,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 56.12185502229227, - "cch": 56.12185502229227, - "etf": 56.12185502229227, - "etf-c": 56.12185502229227, - "fru": 56.12185502229227, - "fwe": 56.12185502229227, - "htc": 56.12185502229227, - "htc-c": 56.12185502229227, - "htn": 56.12185502229227, - "htn-c": 56.12185502229227, - "ior": 56.12185502229227, - "ldu": 56.12185502229227, - "mru": 56.12185502229227, - "ozd": 56.12185502229227, - "pco": 56.12185502229227, - "pma": 56.12185502229227, - "swe": 56.12185502229227, - "tre": 56.12185502229227, - "wtu": 56.12185502229227, - "ecs": 1607.7273947363105, - "pef": 996.8167453175207 + "acd": 60.21874083544106, + "cch": 60.21874083544106, + "etf": 60.21874083544106, + "etf-c": 60.21874083544106, + "fru": 60.21874083544106, + "fwe": 60.21874083544106, + "htc": 60.21874083544106, + "htc-c": 60.21874083544106, + "htn": 60.21874083544106, + "htn-c": 60.21874083544106, + "ior": 60.21874083544106, + "ldu": 60.21874083544106, + "mru": 60.21874083544106, + "ozd": 60.21874083544106, + "pco": 60.21874083544106, + "pma": 60.21874083544106, + "swe": 60.21874083544106, + "tre": 60.21874083544106, + "wtu": 60.21874083544106, + "ecs": 1621.9696114034061, + "pef": 1012.4662779462218 } }, { @@ -192,27 +192,27 @@ "airTransportRatio=1" ], "impacts": { - "acd": 130.7277666831786, - "cch": 130.7277666831786, - "etf": 130.7277666831786, - "etf-c": 130.7277666831786, - "fru": 130.7277666831786, - "fwe": 130.7277666831786, - "htc": 130.7277666831786, - "htc-c": 130.7277666831786, - "htn": 130.7277666831786, - "htn-c": 130.7277666831786, - "ior": 130.7277666831786, - "ldu": 130.7277666831786, - "mru": 130.7277666831786, - "ozd": 130.7277666831786, - "pco": 130.7277666831786, - "pma": 130.7277666831786, - "swe": 130.7277666831786, - "tre": 130.7277666831786, - "wtu": 130.7277666831786, - "ecs": 6992.656792636041, - "pef": 4222.729172801629 + "acd": 151.4682511122443, + "cch": 151.4682511122443, + "etf": 151.4682511122443, + "etf-c": 151.4682511122443, + "fru": 151.4682511122443, + "fwe": 151.4682511122443, + "htc": 151.4682511122443, + "htc-c": 151.4682511122443, + "htn": 151.4682511122443, + "htn-c": 151.4682511122443, + "ior": 151.4682511122443, + "ldu": 151.4682511122443, + "mru": 151.4682511122443, + "ozd": 151.4682511122443, + "pco": 151.4682511122443, + "pma": 151.4682511122443, + "swe": 151.4682511122443, + "tre": 151.4682511122443, + "wtu": 151.4682511122443, + "ecs": 7128.376487207696, + "pef": 4371.756014613863 } }, { @@ -227,27 +227,27 @@ "countryMaking=TR" ], "impacts": { - "acd": 200.119058017596, - "cch": 200.119058017596, - "etf": 200.119058017596, - "etf-c": 200.119058017596, - "fru": 200.119058017596, - "fwe": 200.119058017596, - "htc": 200.119058017596, - "htc-c": 200.119058017596, - "htn": 200.119058017596, - "htn-c": 200.119058017596, - "ior": 200.119058017596, - "ldu": 200.119058017596, - "mru": 200.119058017596, - "ozd": 200.119058017596, - "pco": 200.119058017596, - "pma": 200.119058017596, - "swe": 200.119058017596, - "tre": 200.119058017596, - "wtu": 200.119058017596, - "ecs": 6095.9768283303665, - "pef": 3874.045302215825 + "acd": 220.9023315392062, + "cch": 220.9023315392062, + "etf": 220.9023315392062, + "etf-c": 220.9023315392062, + "fru": 220.9023315392062, + "fwe": 220.9023315392062, + "htc": 220.9023315392062, + "htc-c": 220.9023315392062, + "htn": 220.9023315392062, + "htn-c": 220.9023315392062, + "ior": 220.9023315392062, + "ldu": 220.9023315392062, + "mru": 220.9023315392062, + "ozd": 220.9023315392062, + "pco": 220.9023315392062, + "pma": 220.9023315392062, + "swe": 220.9023315392062, + "tre": 220.9023315392062, + "wtu": 220.9023315392062, + "ecs": 6224.497798186809, + "pef": 4016.04128911514 } }, { @@ -263,27 +263,27 @@ "fading=false" ], "impacts": { - "acd": 151.6290049671981, - "cch": 151.6290049671981, - "etf": 151.6290049671981, - "etf-c": 151.6290049671981, - "fru": 151.6290049671981, - "fwe": 151.6290049671981, - "htc": 151.6290049671981, - "htc-c": 151.6290049671981, - "htn": 151.6290049671981, - "htn-c": 151.6290049671981, - "ior": 151.6290049671981, - "ldu": 151.6290049671981, - "mru": 151.6290049671981, - "ozd": 151.6290049671981, - "pco": 151.6290049671981, - "pma": 151.6290049671981, - "swe": 151.6290049671981, - "tre": 151.6290049671981, - "wtu": 151.6290049671981, - "ecs": 5725.225071015709, - "pef": 3462.8738901069546 + "acd": 172.4122784888083, + "cch": 172.4122784888083, + "etf": 172.4122784888083, + "etf-c": 172.4122784888083, + "fru": 172.4122784888083, + "fwe": 172.4122784888083, + "htc": 172.4122784888083, + "htc-c": 172.4122784888083, + "htn": 172.4122784888083, + "htn-c": 172.4122784888083, + "ior": 172.4122784888083, + "ldu": 172.4122784888083, + "mru": 172.4122784888083, + "ozd": 172.4122784888083, + "pco": 172.4122784888083, + "pma": 172.4122784888083, + "swe": 172.4122784888083, + "tre": 172.4122784888083, + "wtu": 172.4122784888083, + "ecs": 5853.746040872151, + "pef": 3604.8698770062692 } }, { @@ -300,27 +300,27 @@ "reparability=1.15" ], "impacts": { - "acd": 52.85224500633107, - "cch": 52.85224500633107, - "etf": 52.85224500633107, - "etf-c": 52.85224500633107, - "fru": 52.85224500633107, - "fwe": 52.85224500633107, - "htc": 52.85224500633107, - "htc-c": 52.85224500633107, - "htn": 52.85224500633107, - "htn-c": 52.85224500633107, - "ior": 52.85224500633107, - "ldu": 52.85224500633107, - "mru": 52.85224500633107, - "ozd": 52.85224500633107, - "pco": 52.85224500633107, - "pma": 52.85224500633107, - "swe": 52.85224500633107, - "tre": 52.85224500633107, - "wtu": 52.85224500633107, - "ecs": 1677.549640720743, - "pef": 1060.5313989039223 + "acd": 60.05711316048926, + "cch": 60.05711316048926, + "etf": 60.05711316048926, + "etf-c": 60.05711316048926, + "fru": 60.05711316048926, + "fwe": 60.05711316048926, + "htc": 60.05711316048926, + "htc-c": 60.05711316048926, + "htn": 60.05711316048926, + "htn-c": 60.05711316048926, + "ior": 60.05711316048926, + "ldu": 60.05711316048926, + "mru": 60.05711316048926, + "ozd": 60.05711316048926, + "pco": 60.05711316048926, + "pma": 60.05711316048926, + "swe": 60.05711316048926, + "tre": 60.05711316048926, + "wtu": 60.05711316048926, + "ecs": 1702.5962976180485, + "pef": 1088.0529907681896 } }, { @@ -336,27 +336,27 @@ "makingWaste=0" ], "impacts": { - "acd": 47.114026531243475, - "cch": 47.114026531243475, - "etf": 47.114026531243475, - "etf-c": 47.114026531243475, - "fru": 47.114026531243475, - "fwe": 47.114026531243475, - "htc": 47.114026531243475, - "htc-c": 47.114026531243475, - "htn": 47.114026531243475, - "htn-c": 47.114026531243475, - "ior": 47.114026531243475, - "ldu": 47.114026531243475, - "mru": 47.114026531243475, - "ozd": 47.114026531243475, - "pco": 47.114026531243475, - "pma": 47.114026531243475, - "swe": 47.114026531243475, - "tre": 47.114026531243475, - "wtu": 47.114026531243475, - "ecs": 1480.30018603679, - "pef": 940.826539897898 + "acd": 53.23816446227796, + "cch": 53.23816446227796, + "etf": 53.23816446227796, + "etf-c": 53.23816446227796, + "fru": 53.23816446227796, + "fwe": 53.23816446227796, + "htc": 53.23816446227796, + "htc-c": 53.23816446227796, + "htn": 53.23816446227796, + "htn-c": 53.23816446227796, + "ior": 53.23816446227796, + "ldu": 53.23816446227796, + "mru": 53.23816446227796, + "ozd": 53.23816446227796, + "pco": 53.23816446227796, + "pma": 53.23816446227796, + "swe": 53.23816446227796, + "tre": 53.23816446227796, + "wtu": 53.23816446227796, + "ecs": 1501.5898443994997, + "pef": 964.2198929825253 } }, { @@ -372,27 +372,27 @@ "makingWaste=0.25" ], "impacts": { - "acd": 57.952883650853366, - "cch": 57.952883650853366, - "etf": 57.952883650853366, - "etf-c": 57.952883650853366, - "fru": 57.952883650853366, - "fwe": 57.952883650853366, - "htc": 57.952883650853366, - "htc-c": 57.952883650853366, - "htn": 57.952883650853366, - "htn-c": 57.952883650853366, - "ior": 57.952883650853366, - "ldu": 57.952883650853366, - "mru": 57.952883650853366, - "ozd": 57.952883650853366, - "pco": 57.952883650853366, - "pma": 57.952883650853366, - "swe": 57.952883650853366, - "tre": 57.952883650853366, - "wtu": 57.952883650853366, - "ecs": 1852.8824893287, - "pef": 1166.9357180203883 + "acd": 66.11840089223269, + "cch": 66.11840089223269, + "etf": 66.11840089223269, + "etf-c": 66.11840089223269, + "fru": 66.11840089223269, + "fwe": 66.11840089223269, + "htc": 66.11840089223269, + "htc-c": 66.11840089223269, + "htn": 66.11840089223269, + "htn-c": 66.11840089223269, + "ior": 66.11840089223269, + "ldu": 66.11840089223269, + "mru": 66.11840089223269, + "ozd": 66.11840089223269, + "pco": 66.11840089223269, + "pma": 66.11840089223269, + "swe": 66.11840089223269, + "tre": 66.11840089223269, + "wtu": 66.11840089223269, + "ecs": 1881.2687004789796, + "pef": 1198.1268554665578 } }, { @@ -409,27 +409,27 @@ "surfaceMass=300" ], "impacts": { - "acd": 91.49665954464102, - "cch": 91.49665954464102, - "etf": 91.49665954464102, - "etf-c": 91.49665954464102, - "fru": 91.49665954464102, - "fwe": 91.49665954464102, - "htc": 91.49665954464102, - "htc-c": 91.49665954464102, - "htn": 91.49665954464102, - "htn-c": 91.49665954464102, - "ior": 91.49665954464102, - "ldu": 91.49665954464102, - "mru": 91.49665954464102, - "ozd": 91.49665954464102, - "pco": 91.49665954464102, - "pma": 91.49665954464102, - "swe": 91.49665954464102, - "tre": 91.49665954464102, - "wtu": 91.49665954464102, - "ecs": 2928.0775528423774, - "pef": 1833.164572424912 + "acd": 104.21113275786142, + "cch": 104.21113275786142, + "etf": 104.21113275786142, + "etf-c": 104.21113275786142, + "fru": 104.21113275786142, + "fwe": 104.21113275786142, + "htc": 104.21113275786142, + "htc-c": 104.21113275786142, + "htn": 104.21113275786142, + "htn-c": 104.21113275786142, + "ior": 104.21113275786142, + "ldu": 104.21113275786142, + "mru": 104.21113275786142, + "ozd": 104.21113275786142, + "pco": 104.21113275786142, + "pma": 104.21113275786142, + "swe": 104.21113275786142, + "tre": 104.21113275786142, + "wtu": 104.21113275786142, + "ecs": 2972.2775356023276, + "pef": 1881.7320874795018 } }, { @@ -446,27 +446,27 @@ "printing=pigment" ], "impacts": { - "acd": 97.28117213263768, - "cch": 97.28117213263768, - "etf": 97.28117213263768, - "etf-c": 97.28117213263768, - "fru": 97.28117213263768, - "fwe": 97.28117213263768, - "htc": 97.28117213263768, - "htc-c": 97.28117213263768, - "htn": 97.28117213263768, - "htn-c": 97.28117213263768, - "ior": 97.28117213263768, - "ldu": 97.28117213263768, - "mru": 97.28117213263768, - "ozd": 97.28117213263768, - "pco": 97.28117213263768, - "pma": 97.28117213263768, - "swe": 97.28117213263768, - "tre": 97.28117213263768, - "wtu": 97.28117213263768, - "ecs": 2989.562486002309, - "pef": 1870.3427973608746 + "acd": 109.99564534585807, + "cch": 109.99564534585807, + "etf": 109.99564534585807, + "etf-c": 109.99564534585807, + "fru": 109.99564534585807, + "fwe": 109.99564534585807, + "htc": 109.99564534585807, + "htc-c": 109.99564534585807, + "htn": 109.99564534585807, + "htn-c": 109.99564534585807, + "ior": 109.99564534585807, + "ldu": 109.99564534585807, + "mru": 109.99564534585807, + "ozd": 109.99564534585807, + "pco": 109.99564534585807, + "pma": 109.99564534585807, + "swe": 109.99564534585807, + "tre": 109.99564534585807, + "wtu": 109.99564534585807, + "ecs": 3033.7624687622592, + "pef": 1918.9103124154644 } }, { @@ -483,27 +483,27 @@ "printing=substantive" ], "impacts": { - "acd": 98.22807584341206, - "cch": 98.22807584341206, - "etf": 98.22807584341206, - "etf-c": 98.22807584341206, - "fru": 98.22807584341206, - "fwe": 98.22807584341206, - "htc": 98.22807584341206, - "htc-c": 98.22807584341206, - "htn": 98.22807584341206, - "htn-c": 98.22807584341206, - "ior": 98.22807584341206, - "ldu": 98.22807584341206, - "mru": 98.22807584341206, - "ozd": 98.22807584341206, - "pco": 98.22807584341206, - "pma": 98.22807584341206, - "swe": 98.22807584341206, - "tre": 98.22807584341206, - "wtu": 98.22807584341206, - "ecs": 2976.384860476527, - "pef": 1875.625902775437 + "acd": 110.94254905663243, + "cch": 110.94254905663243, + "etf": 110.94254905663243, + "etf-c": 110.94254905663243, + "fru": 110.94254905663243, + "fwe": 110.94254905663243, + "htc": 110.94254905663243, + "htc-c": 110.94254905663243, + "htn": 110.94254905663243, + "htn-c": 110.94254905663243, + "ior": 110.94254905663243, + "ldu": 110.94254905663243, + "mru": 110.94254905663243, + "ozd": 110.94254905663243, + "pco": 110.94254905663243, + "pma": 110.94254905663243, + "swe": 110.94254905663243, + "tre": 110.94254905663243, + "wtu": 110.94254905663243, + "ecs": 3020.5848432364774, + "pef": 1924.1934178300262 } }, { @@ -520,27 +520,27 @@ "printing=pigment;0.5" ], "impacts": { - "acd": 104.66931197275224, - "cch": 104.66931197275224, - "etf": 104.66931197275224, - "etf-c": 104.66931197275224, - "fru": 104.66931197275224, - "fwe": 104.66931197275224, - "htc": 104.66931197275224, - "htc-c": 104.66931197275224, - "htn": 104.66931197275224, - "htn-c": 104.66931197275224, - "ior": 104.66931197275224, - "ldu": 104.66931197275224, - "mru": 104.66931197275224, - "ozd": 104.66931197275224, - "pco": 104.66931197275224, - "pma": 104.66931197275224, - "swe": 104.66931197275224, - "tre": 104.66931197275224, - "wtu": 104.66931197275224, - "ecs": 3074.292141257567, - "pef": 1917.1390045956944 + "acd": 117.3837851859726, + "cch": 117.3837851859726, + "etf": 117.3837851859726, + "etf-c": 117.3837851859726, + "fru": 117.3837851859726, + "fwe": 117.3837851859726, + "htc": 117.3837851859726, + "htc-c": 117.3837851859726, + "htn": 117.3837851859726, + "htn-c": 117.3837851859726, + "ior": 117.3837851859726, + "ldu": 117.3837851859726, + "mru": 117.3837851859726, + "ozd": 117.3837851859726, + "pco": 117.3837851859726, + "pma": 117.3837851859726, + "swe": 117.3837851859726, + "tre": 117.3837851859726, + "wtu": 117.3837851859726, + "ecs": 3118.492124017518, + "pef": 1965.7065196502836 } }, { @@ -556,27 +556,27 @@ "ennoblingHeatSource=coal" ], "impacts": { - "acd": 90.94327352865248, - "cch": 90.94327352865248, - "etf": 90.94327352865248, - "etf-c": 90.94327352865248, - "fru": 90.94327352865248, - "fwe": 90.94327352865248, - "htc": 90.94327352865248, - "htc-c": 90.94327352865248, - "htn": 90.94327352865248, - "htn-c": 90.94327352865248, - "ior": 90.94327352865248, - "ldu": 90.94327352865248, - "mru": 90.94327352865248, - "ozd": 90.94327352865248, - "pco": 90.94327352865248, - "pma": 90.94327352865248, - "swe": 90.94327352865248, - "tre": 90.94327352865248, - "wtu": 90.94327352865248, - "ecs": 4009.575206470993, - "pef": 2300.10014617678 + "acd": 103.65774674187287, + "cch": 103.65774674187287, + "etf": 103.65774674187287, + "etf-c": 103.65774674187287, + "fru": 103.65774674187287, + "fwe": 103.65774674187287, + "htc": 103.65774674187287, + "htc-c": 103.65774674187287, + "htn": 103.65774674187287, + "htn-c": 103.65774674187287, + "ior": 103.65774674187287, + "ldu": 103.65774674187287, + "mru": 103.65774674187287, + "ozd": 103.65774674187287, + "pco": 103.65774674187287, + "pma": 103.65774674187287, + "swe": 103.65774674187287, + "tre": 103.65774674187287, + "wtu": 103.65774674187287, + "ecs": 4096.83954151979, + "pef": 2396.289612379351 } } ] From bf212a83f4f3f8750718ed9a2f3c6e626606dd51 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 16:53:26 +0200 Subject: [PATCH 06/12] Implement mercerising impacts. --- src/Data/Textile/Formula.elm | 27 ++ src/Data/Textile/Simulator.elm | 33 ++ tests/Data/Textile/SimulatorTest.elm | 2 +- tests/e2e-textile.json | 588 +++++++++++++-------------- 4 files changed, 355 insertions(+), 295 deletions(-) diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index 434493d56..7fa8b54b8 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -13,6 +13,7 @@ module Data.Textile.Formula exposing , makingWaste , materialDyeingToxicityImpacts , materialPrintingToxicityImpacts + , mercerisingImpacts , printingImpacts , pureMaterialImpacts , recycledMaterialImpacts @@ -343,6 +344,32 @@ scouringImpacts impacts { scouringProcess, countryElecProcess, countryHeatProces ) +mercerisingImpacts : + Impacts + -> + { mercerisingProcess : Process -- Inbound: mercerising process + , countryElecProcess : Process + , countryHeatProcess : Process + } + -> Mass + -> Impacts +mercerisingImpacts impacts { mercerisingProcess, countryElecProcess, countryHeatProcess } baseMass = + impacts + |> Impact.mapImpacts + (\trigram _ -> + Quantity.sum + [ mercerisingProcess.elec + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forKWh (Process.getImpact trigram countryElecProcess) + , mercerisingProcess.heat + |> Quantity.multiplyBy (Mass.inKilograms baseMass) + |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) + , baseMass + |> Unit.forKg (Process.getImpact trigram mercerisingProcess) + ] + ) + + materialDyeingToxicityImpacts : Impacts -> diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index b6fd5a753..ead21481f 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -146,6 +146,8 @@ compute db query = |> nextWithDbIf Label.Ennobling computeDesizingImpacts -- Compute Ennobling step scouring impacts |> nextWithDbIf Label.Ennobling computeScouringImpacts + -- Compute Ennobling step mercerising impacts + |> nextWithDbIf Label.Ennobling computeMercerisingImpacts -- Compute Ennobling step Dyeing impacts |> nextWithDbIf Label.Ennobling computeDyeingImpacts -- Compute Ennobling step Printing impacts @@ -474,6 +476,37 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = ) +computeMercerisingImpacts : Db -> Simulator -> Simulator +computeMercerisingImpacts { textile } ({ inputs } as simulator) = + simulator + |> updateLifeCycleStep Label.Ennobling + (\step -> + -- Note: mercerising only applies to cotton (conventional and organic) + let + cottonShare = + inputs.materials + |> List.filter + (\{ material } -> + [ "ei-coton", "ei-coton-organic" ] + |> List.member (Material.idToString material.id) + ) + |> List.map (.share >> Split.toFloat) + |> List.sum + in + { step + | impacts = + step.outputMass + |> Quantity.multiplyBy cottonShare + |> Formula.mercerisingImpacts step.impacts + { mercerisingProcess = textile.wellKnown.mercerising + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> Impact.addImpacts step.impacts + } + ) + + stepMaterialImpacts : Db -> Material -> Step -> Impacts stepMaterialImpacts { textile } material step = case Material.getRecyclingData material textile.materials of diff --git a/tests/Data/Textile/SimulatorTest.elm b/tests/Data/Textile/SimulatorTest.elm index a79171365..38a61fdf1 100644 --- a/tests/Data/Textile/SimulatorTest.elm +++ b/tests/Data/Textile/SimulatorTest.elm @@ -47,7 +47,7 @@ suite = [ { tShirtCotonFrance | countrySpinning = Nothing } - |> expectImpact db ecs 1702.5962976180485 + |> expectImpact db ecs 1707.963240274767 |> asTest "should compute a simulation ecs impact" , describe "disabled steps" [ { tShirtCotonFrance | disabledSteps = [ Label.Ennobling ] } diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 330c58b56..7a5695e52 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -11,27 +11,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 60.05711316048926, - "cch": 60.05711316048926, - "etf": 60.05711316048926, - "etf-c": 60.05711316048926, - "fru": 60.05711316048926, - "fwe": 60.05711316048926, - "htc": 60.05711316048926, - "htc-c": 60.05711316048926, - "htn": 60.05711316048926, - "htn-c": 60.05711316048926, - "ior": 60.05711316048926, - "ldu": 60.05711316048926, - "mru": 60.05711316048926, - "ozd": 60.05711316048926, - "pco": 60.05711316048926, - "pma": 60.05711316048926, - "swe": 60.05711316048926, - "tre": 60.05711316048926, - "wtu": 60.05711316048926, - "ecs": 1702.5962976180485, - "pef": 1088.0529907681896 + "acd": 61.90701174061097, + "cch": 61.90701174061097, + "etf": 61.90701174061097, + "etf-c": 61.90701174061097, + "fru": 61.90701174061097, + "fwe": 61.90701174061097, + "htc": 61.90701174061097, + "htc-c": 61.90701174061097, + "htn": 61.90701174061097, + "htn-c": 61.90701174061097, + "ior": 61.90701174061097, + "ldu": 61.90701174061097, + "mru": 61.90701174061097, + "ozd": 61.90701174061097, + "pco": 61.90701174061097, + "pma": 61.90701174061097, + "swe": 61.90701174061097, + "tre": 61.90701174061097, + "wtu": 61.90701174061097, + "ecs": 1707.963240274767, + "pef": 1093.9819910688968 } }, { @@ -47,27 +47,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 60.8825092113836, - "cch": 60.8825092113836, - "etf": 60.8825092113836, - "etf-c": 60.8825092113836, - "fru": 60.8825092113836, - "fwe": 60.8825092113836, - "htc": 60.8825092113836, - "htc-c": 60.8825092113836, - "htn": 60.8825092113836, - "htn-c": 60.8825092113836, - "ior": 60.8825092113836, - "ldu": 60.8825092113836, - "mru": 60.8825092113836, - "ozd": 60.8825092113836, - "pco": 60.8825092113836, - "pma": 60.8825092113836, - "swe": 60.8825092113836, - "tre": 60.8825092113836, - "wtu": 60.8825092113836, - "ecs": 1675.324899903047, - "pef": 1061.285018822687 + "acd": 62.73240779150531, + "cch": 62.73240779150531, + "etf": 62.73240779150531, + "etf-c": 62.73240779150531, + "fru": 62.73240779150531, + "fwe": 62.73240779150531, + "htc": 62.73240779150531, + "htc-c": 62.73240779150531, + "htn": 62.73240779150531, + "htn-c": 62.73240779150531, + "ior": 62.73240779150531, + "ldu": 62.73240779150531, + "mru": 62.73240779150531, + "ozd": 62.73240779150531, + "pco": 62.73240779150531, + "pma": 62.73240779150531, + "swe": 62.73240779150531, + "tre": 62.73240779150531, + "wtu": 62.73240779150531, + "ecs": 1680.6918425597655, + "pef": 1067.2140191233946 } }, { @@ -119,27 +119,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 60.21874083544106, - "cch": 60.21874083544106, - "etf": 60.21874083544106, - "etf-c": 60.21874083544106, - "fru": 60.21874083544106, - "fwe": 60.21874083544106, - "htc": 60.21874083544106, - "htc-c": 60.21874083544106, - "htn": 60.21874083544106, - "htn-c": 60.21874083544106, - "ior": 60.21874083544106, - "ldu": 60.21874083544106, - "mru": 60.21874083544106, - "ozd": 60.21874083544106, - "pco": 60.21874083544106, - "pma": 60.21874083544106, - "swe": 60.21874083544106, - "tre": 60.21874083544106, - "wtu": 60.21874083544106, - "ecs": 1621.9696114034061, - "pef": 1012.4662779462218 + "acd": 61.27064394962791, + "cch": 61.27064394962791, + "etf": 61.27064394962791, + "etf-c": 61.27064394962791, + "fru": 61.27064394962791, + "fwe": 61.27064394962791, + "htc": 61.27064394962791, + "htc-c": 61.27064394962791, + "htn": 61.27064394962791, + "htn-c": 61.27064394962791, + "ior": 61.27064394962791, + "ldu": 61.27064394962791, + "mru": 61.27064394962791, + "ozd": 61.27064394962791, + "pco": 61.27064394962791, + "pma": 61.27064394962791, + "swe": 61.27064394962791, + "tre": 61.27064394962791, + "wtu": 61.27064394962791, + "ecs": 1625.0214023258538, + "pef": 1015.8376702740751 } }, { @@ -192,27 +192,27 @@ "airTransportRatio=1" ], "impacts": { - "acd": 151.4682511122443, - "cch": 151.4682511122443, - "etf": 151.4682511122443, - "etf-c": 151.4682511122443, - "fru": 151.4682511122443, - "fwe": 151.4682511122443, - "htc": 151.4682511122443, - "htc-c": 151.4682511122443, - "htn": 151.4682511122443, - "htn-c": 151.4682511122443, - "ior": 151.4682511122443, - "ldu": 151.4682511122443, - "mru": 151.4682511122443, - "ozd": 151.4682511122443, - "pco": 151.4682511122443, - "pma": 151.4682511122443, - "swe": 151.4682511122443, - "tre": 151.4682511122443, - "wtu": 151.4682511122443, - "ecs": 7128.376487207696, - "pef": 4371.756014613863 + "acd": 156.79351062781524, + "cch": 156.79351062781524, + "etf": 156.79351062781524, + "etf-c": 156.79351062781524, + "fru": 156.79351062781524, + "fwe": 156.79351062781524, + "htc": 156.79351062781524, + "htc-c": 156.79351062781524, + "htn": 156.79351062781524, + "htn-c": 156.79351062781524, + "ior": 156.79351062781524, + "ldu": 156.79351062781524, + "mru": 156.79351062781524, + "ozd": 156.79351062781524, + "pco": 156.79351062781524, + "pma": 156.79351062781524, + "swe": 156.79351062781524, + "tre": 156.79351062781524, + "wtu": 156.79351062781524, + "ecs": 7158.727727962107, + "pef": 4404.977872957464 } }, { @@ -227,27 +227,27 @@ "countryMaking=TR" ], "impacts": { - "acd": 220.9023315392062, - "cch": 220.9023315392062, - "etf": 220.9023315392062, - "etf-c": 220.9023315392062, - "fru": 220.9023315392062, - "fwe": 220.9023315392062, - "htc": 220.9023315392062, - "htc-c": 220.9023315392062, - "htn": 220.9023315392062, - "htn-c": 220.9023315392062, - "ior": 220.9023315392062, - "ldu": 220.9023315392062, - "mru": 220.9023315392062, - "ozd": 220.9023315392062, - "pco": 220.9023315392062, - "pma": 220.9023315392062, - "swe": 220.9023315392062, - "tre": 220.9023315392062, - "wtu": 220.9023315392062, - "ecs": 6224.497798186809, - "pef": 4016.04128911514 + "acd": 226.23857744340341, + "cch": 226.23857744340341, + "etf": 226.23857744340341, + "etf-c": 226.23857744340341, + "fru": 226.23857744340341, + "fwe": 226.23857744340341, + "htc": 226.23857744340341, + "htc-c": 226.23857744340341, + "htn": 226.23857744340341, + "htn-c": 226.23857744340341, + "ior": 226.23857744340341, + "ldu": 226.23857744340341, + "mru": 226.23857744340341, + "ozd": 226.23857744340341, + "pco": 226.23857744340341, + "pma": 226.23857744340341, + "swe": 226.23857744340341, + "tre": 226.23857744340341, + "wtu": 226.23857744340341, + "ecs": 6252.418747678336, + "pef": 4046.885583887958 } }, { @@ -263,27 +263,27 @@ "fading=false" ], "impacts": { - "acd": 172.4122784888083, - "cch": 172.4122784888083, - "etf": 172.4122784888083, - "etf-c": 172.4122784888083, - "fru": 172.4122784888083, - "fwe": 172.4122784888083, - "htc": 172.4122784888083, - "htc-c": 172.4122784888083, - "htn": 172.4122784888083, - "htn-c": 172.4122784888083, - "ior": 172.4122784888083, - "ldu": 172.4122784888083, - "mru": 172.4122784888083, - "ozd": 172.4122784888083, - "pco": 172.4122784888083, - "pma": 172.4122784888083, - "swe": 172.4122784888083, - "tre": 172.4122784888083, - "wtu": 172.4122784888083, - "ecs": 5853.746040872151, - "pef": 3604.8698770062692 + "acd": 177.74852439300554, + "cch": 177.74852439300554, + "etf": 177.74852439300554, + "etf-c": 177.74852439300554, + "fru": 177.74852439300554, + "fwe": 177.74852439300554, + "htc": 177.74852439300554, + "htc-c": 177.74852439300554, + "htn": 177.74852439300554, + "htn-c": 177.74852439300554, + "ior": 177.74852439300554, + "ldu": 177.74852439300554, + "mru": 177.74852439300554, + "ozd": 177.74852439300554, + "pco": 177.74852439300554, + "pma": 177.74852439300554, + "swe": 177.74852439300554, + "tre": 177.74852439300554, + "wtu": 177.74852439300554, + "ecs": 5881.666990363678, + "pef": 3635.7141717790873 } }, { @@ -300,27 +300,27 @@ "reparability=1.15" ], "impacts": { - "acd": 60.05711316048926, - "cch": 60.05711316048926, - "etf": 60.05711316048926, - "etf-c": 60.05711316048926, - "fru": 60.05711316048926, - "fwe": 60.05711316048926, - "htc": 60.05711316048926, - "htc-c": 60.05711316048926, - "htn": 60.05711316048926, - "htn-c": 60.05711316048926, - "ior": 60.05711316048926, - "ldu": 60.05711316048926, - "mru": 60.05711316048926, - "ozd": 60.05711316048926, - "pco": 60.05711316048926, - "pma": 60.05711316048926, - "swe": 60.05711316048926, - "tre": 60.05711316048926, - "wtu": 60.05711316048926, - "ecs": 1702.5962976180485, - "pef": 1088.0529907681896 + "acd": 61.90701174061097, + "cch": 61.90701174061097, + "etf": 61.90701174061097, + "etf-c": 61.90701174061097, + "fru": 61.90701174061097, + "fwe": 61.90701174061097, + "htc": 61.90701174061097, + "htc-c": 61.90701174061097, + "htn": 61.90701174061097, + "htn-c": 61.90701174061097, + "ior": 61.90701174061097, + "ldu": 61.90701174061097, + "mru": 61.90701174061097, + "ozd": 61.90701174061097, + "pco": 61.90701174061097, + "pma": 61.90701174061097, + "swe": 61.90701174061097, + "tre": 61.90701174061097, + "wtu": 61.90701174061097, + "ecs": 1707.963240274767, + "pef": 1093.9819910688968 } }, { @@ -336,27 +336,27 @@ "makingWaste=0" ], "impacts": { - "acd": 53.23816446227796, - "cch": 53.23816446227796, - "etf": 53.23816446227796, - "etf-c": 53.23816446227796, - "fru": 53.23816446227796, - "fwe": 53.23816446227796, - "htc": 53.23816446227796, - "htc-c": 53.23816446227796, - "htn": 53.23816446227796, - "htn-c": 53.23816446227796, - "ior": 53.23816446227796, - "ldu": 53.23816446227796, - "mru": 53.23816446227796, - "ozd": 53.23816446227796, - "pco": 53.23816446227796, - "pma": 53.23816446227796, - "swe": 53.23816446227796, - "tre": 53.23816446227796, - "wtu": 53.23816446227796, - "ecs": 1501.5898443994997, - "pef": 964.2198929825253 + "acd": 54.8105782553814, + "cch": 54.8105782553814, + "etf": 54.8105782553814, + "etf-c": 54.8105782553814, + "fru": 54.8105782553814, + "fwe": 54.8105782553814, + "htc": 54.8105782553814, + "htc-c": 54.8105782553814, + "htn": 54.8105782553814, + "htn-c": 54.8105782553814, + "ior": 54.8105782553814, + "ldu": 54.8105782553814, + "mru": 54.8105782553814, + "ozd": 54.8105782553814, + "pco": 54.8105782553814, + "pma": 54.8105782553814, + "swe": 54.8105782553814, + "tre": 54.8105782553814, + "wtu": 54.8105782553814, + "ecs": 1506.1517456577108, + "pef": 969.2595432381264 } }, { @@ -372,27 +372,27 @@ "makingWaste=0.25" ], "impacts": { - "acd": 66.11840089223269, - "cch": 66.11840089223269, - "etf": 66.11840089223269, - "etf-c": 66.11840089223269, - "fru": 66.11840089223269, - "fwe": 66.11840089223269, - "htc": 66.11840089223269, - "htc-c": 66.11840089223269, - "htn": 66.11840089223269, - "htn-c": 66.11840089223269, - "ior": 66.11840089223269, - "ldu": 66.11840089223269, - "mru": 66.11840089223269, - "ozd": 66.11840089223269, - "pco": 66.11840089223269, - "pma": 66.11840089223269, - "swe": 66.11840089223269, - "tre": 66.11840089223269, - "wtu": 66.11840089223269, - "ecs": 1881.2687004789796, - "pef": 1198.1268554665578 + "acd": 68.21495261637062, + "cch": 68.21495261637062, + "etf": 68.21495261637062, + "etf-c": 68.21495261637062, + "fru": 68.21495261637062, + "fwe": 68.21495261637062, + "htc": 68.21495261637062, + "htc-c": 68.21495261637062, + "htn": 68.21495261637062, + "htn-c": 68.21495261637062, + "ior": 68.21495261637062, + "ldu": 68.21495261637062, + "mru": 68.21495261637062, + "ozd": 68.21495261637062, + "pco": 68.21495261637062, + "pma": 68.21495261637062, + "swe": 68.21495261637062, + "tre": 68.21495261637062, + "wtu": 68.21495261637062, + "ecs": 1887.3512354899276, + "pef": 1204.8463891406927 } }, { @@ -409,27 +409,27 @@ "surfaceMass=300" ], "impacts": { - "acd": 104.21113275786142, - "cch": 104.21113275786142, - "etf": 104.21113275786142, - "etf-c": 104.21113275786142, - "fru": 104.21113275786142, - "fwe": 104.21113275786142, - "htc": 104.21113275786142, - "htc-c": 104.21113275786142, - "htn": 104.21113275786142, - "htn-c": 104.21113275786142, - "ior": 104.21113275786142, - "ldu": 104.21113275786142, - "mru": 104.21113275786142, - "ozd": 104.21113275786142, - "pco": 104.21113275786142, - "pma": 104.21113275786142, - "swe": 104.21113275786142, - "tre": 104.21113275786142, - "wtu": 104.21113275786142, - "ecs": 2972.2775356023276, - "pef": 1881.7320874795018 + "acd": 107.47565966395854, + "cch": 107.47565966395854, + "etf": 107.47565966395854, + "etf-c": 107.47565966395854, + "fru": 107.47565966395854, + "fwe": 107.47565966395854, + "htc": 107.47565966395854, + "htc-c": 107.47565966395854, + "htn": 107.47565966395854, + "htn-c": 107.47565966395854, + "ior": 107.47565966395854, + "ldu": 107.47565966395854, + "mru": 107.47565966395854, + "ozd": 107.47565966395854, + "pco": 107.47565966395854, + "pma": 107.47565966395854, + "swe": 107.47565966395854, + "tre": 107.47565966395854, + "wtu": 107.47565966395854, + "ecs": 2981.7486108788908, + "pef": 1892.1950291866322 } }, { @@ -446,27 +446,27 @@ "printing=pigment" ], "impacts": { - "acd": 109.99564534585807, - "cch": 109.99564534585807, - "etf": 109.99564534585807, - "etf-c": 109.99564534585807, - "fru": 109.99564534585807, - "fwe": 109.99564534585807, - "htc": 109.99564534585807, - "htc-c": 109.99564534585807, - "htn": 109.99564534585807, - "htn-c": 109.99564534585807, - "ior": 109.99564534585807, - "ldu": 109.99564534585807, - "mru": 109.99564534585807, - "ozd": 109.99564534585807, - "pco": 109.99564534585807, - "pma": 109.99564534585807, - "swe": 109.99564534585807, - "tre": 109.99564534585807, - "wtu": 109.99564534585807, - "ecs": 3033.7624687622592, - "pef": 1918.9103124154644 + "acd": 113.2601722519552, + "cch": 113.2601722519552, + "etf": 113.2601722519552, + "etf-c": 113.2601722519552, + "fru": 113.2601722519552, + "fwe": 113.2601722519552, + "htc": 113.2601722519552, + "htc-c": 113.2601722519552, + "htn": 113.2601722519552, + "htn-c": 113.2601722519552, + "ior": 113.2601722519552, + "ldu": 113.2601722519552, + "mru": 113.2601722519552, + "ozd": 113.2601722519552, + "pco": 113.2601722519552, + "pma": 113.2601722519552, + "swe": 113.2601722519552, + "tre": 113.2601722519552, + "wtu": 113.2601722519552, + "ecs": 3043.2335440388224, + "pef": 1929.3732541225943 } }, { @@ -483,27 +483,27 @@ "printing=substantive" ], "impacts": { - "acd": 110.94254905663243, - "cch": 110.94254905663243, - "etf": 110.94254905663243, - "etf-c": 110.94254905663243, - "fru": 110.94254905663243, - "fwe": 110.94254905663243, - "htc": 110.94254905663243, - "htc-c": 110.94254905663243, - "htn": 110.94254905663243, - "htn-c": 110.94254905663243, - "ior": 110.94254905663243, - "ldu": 110.94254905663243, - "mru": 110.94254905663243, - "ozd": 110.94254905663243, - "pco": 110.94254905663243, - "pma": 110.94254905663243, - "swe": 110.94254905663243, - "tre": 110.94254905663243, - "wtu": 110.94254905663243, - "ecs": 3020.5848432364774, - "pef": 1924.1934178300262 + "acd": 114.20707596272956, + "cch": 114.20707596272956, + "etf": 114.20707596272956, + "etf-c": 114.20707596272956, + "fru": 114.20707596272956, + "fwe": 114.20707596272956, + "htc": 114.20707596272956, + "htc-c": 114.20707596272956, + "htn": 114.20707596272956, + "htn-c": 114.20707596272956, + "ior": 114.20707596272956, + "ldu": 114.20707596272956, + "mru": 114.20707596272956, + "ozd": 114.20707596272956, + "pco": 114.20707596272956, + "pma": 114.20707596272956, + "swe": 114.20707596272956, + "tre": 114.20707596272956, + "wtu": 114.20707596272956, + "ecs": 3030.0559185130405, + "pef": 1934.6563595371565 } }, { @@ -520,27 +520,27 @@ "printing=pigment;0.5" ], "impacts": { - "acd": 117.3837851859726, - "cch": 117.3837851859726, - "etf": 117.3837851859726, - "etf-c": 117.3837851859726, - "fru": 117.3837851859726, - "fwe": 117.3837851859726, - "htc": 117.3837851859726, - "htc-c": 117.3837851859726, - "htn": 117.3837851859726, - "htn-c": 117.3837851859726, - "ior": 117.3837851859726, - "ldu": 117.3837851859726, - "mru": 117.3837851859726, - "ozd": 117.3837851859726, - "pco": 117.3837851859726, - "pma": 117.3837851859726, - "swe": 117.3837851859726, - "tre": 117.3837851859726, - "wtu": 117.3837851859726, - "ecs": 3118.492124017518, - "pef": 1965.7065196502836 + "acd": 120.64831209206973, + "cch": 120.64831209206973, + "etf": 120.64831209206973, + "etf-c": 120.64831209206973, + "fru": 120.64831209206973, + "fwe": 120.64831209206973, + "htc": 120.64831209206973, + "htc-c": 120.64831209206973, + "htn": 120.64831209206973, + "htn-c": 120.64831209206973, + "ior": 120.64831209206973, + "ldu": 120.64831209206973, + "mru": 120.64831209206973, + "ozd": 120.64831209206973, + "pco": 120.64831209206973, + "pma": 120.64831209206973, + "swe": 120.64831209206973, + "tre": 120.64831209206973, + "wtu": 120.64831209206973, + "ecs": 3127.9631992940804, + "pef": 1976.1694613574143 } }, { @@ -556,27 +556,27 @@ "ennoblingHeatSource=coal" ], "impacts": { - "acd": 103.65774674187287, - "cch": 103.65774674187287, - "etf": 103.65774674187287, - "etf-c": 103.65774674187287, - "fru": 103.65774674187287, - "fwe": 103.65774674187287, - "htc": 103.65774674187287, - "htc-c": 103.65774674187287, - "htn": 103.65774674187287, - "htn-c": 103.65774674187287, - "ior": 103.65774674187287, - "ldu": 103.65774674187287, - "mru": 103.65774674187287, - "ozd": 103.65774674187287, - "pco": 103.65774674187287, - "pma": 103.65774674187287, - "swe": 103.65774674187287, - "tre": 103.65774674187287, - "wtu": 103.65774674187287, - "ecs": 4096.83954151979, - "pef": 2396.289612379351 + "acd": 106.92227364796999, + "cch": 106.92227364796999, + "etf": 106.92227364796999, + "etf-c": 106.92227364796999, + "fru": 106.92227364796999, + "fwe": 106.92227364796999, + "htc": 106.92227364796999, + "htc-c": 106.92227364796999, + "htn": 106.92227364796999, + "htn-c": 106.92227364796999, + "ior": 106.92227364796999, + "ldu": 106.92227364796999, + "mru": 106.92227364796999, + "ozd": 106.92227364796999, + "pco": 106.92227364796999, + "pma": 106.92227364796999, + "swe": 106.92227364796999, + "tre": 106.92227364796999, + "wtu": 106.92227364796999, + "ecs": 4116.800506881717, + "pef": 2418.2661743127383 } } ] From 36251daec1cb05abfed90c6831697af6da4c6b9d Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 17:04:16 +0200 Subject: [PATCH 07/12] Implement washing impacts. --- src/Data/Textile/Formula.elm | 45 ++---------- src/Data/Textile/Simulator.elm | 46 ++++++++++-- tests/e2e-textile.json | 126 ++++++++++++++++----------------- 3 files changed, 111 insertions(+), 106 deletions(-) diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index 7fa8b54b8..c626ccb15 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -2,10 +2,10 @@ module Data.Textile.Formula exposing ( bleachingImpacts , computePicking , computeThreadDensity - , desizingImpacts , dyeingImpacts , endOfLifeImpacts , finishingImpacts + , genericImpacts , genericWaste , knittingImpacts , makingDeadStock @@ -17,7 +17,6 @@ module Data.Textile.Formula exposing , printingImpacts , pureMaterialImpacts , recycledMaterialImpacts - , scouringImpacts , spinningImpacts , transportRatio , useImpacts @@ -292,54 +291,24 @@ bleachingImpacts impacts { bleachingProcess, aquaticPollutionScenario, countryEl ) -desizingImpacts : +genericImpacts : Impacts - -> - { desizingProcess : Process -- Inbound: Bleaching process - , countryElecProcess : Process - , countryHeatProcess : Process - } - -> Mass - -> Impacts -desizingImpacts impacts { desizingProcess, countryElecProcess, countryHeatProcess } baseMass = - impacts - |> Impact.mapImpacts - (\trigram _ -> - Quantity.sum - [ desizingProcess.elec - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forKWh (Process.getImpact trigram countryElecProcess) - , desizingProcess.heat - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) - , baseMass - |> Unit.forKg (Process.getImpact trigram desizingProcess) - ] - ) - - -scouringImpacts : - Impacts - -> - { scouringProcess : Process -- Inbound: scouring process - , countryElecProcess : Process - , countryHeatProcess : Process - } + -> { process : Process, countryElecProcess : Process, countryHeatProcess : Process } -> Mass -> Impacts -scouringImpacts impacts { scouringProcess, countryElecProcess, countryHeatProcess } baseMass = +genericImpacts impacts { process, countryElecProcess, countryHeatProcess } baseMass = impacts |> Impact.mapImpacts (\trigram _ -> Quantity.sum - [ scouringProcess.elec + [ process.elec |> Quantity.multiplyBy (Mass.inKilograms baseMass) |> Unit.forKWh (Process.getImpact trigram countryElecProcess) - , scouringProcess.heat + , process.heat |> Quantity.multiplyBy (Mass.inKilograms baseMass) |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) , baseMass - |> Unit.forKg (Process.getImpact trigram scouringProcess) + |> Unit.forKg (Process.getImpact trigram process) ] ) diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index ead21481f..75de22c39 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -148,6 +148,8 @@ compute db query = |> nextWithDbIf Label.Ennobling computeScouringImpacts -- Compute Ennobling step mercerising impacts |> nextWithDbIf Label.Ennobling computeMercerisingImpacts + -- Compute Ennobling step washing impacts + |> nextWithDbIf Label.Ennobling computeWashingImpacts -- Compute Ennobling step Dyeing impacts |> nextWithDbIf Label.Ennobling computeDyeingImpacts -- Compute Ennobling step Printing impacts @@ -433,8 +435,8 @@ computeDesizingImpacts { textile } ({ inputs } as simulator) = { step | impacts = step.outputMass - |> Formula.desizingImpacts step.impacts - { desizingProcess = textile.wellKnown.desizing + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.desizing , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } @@ -451,7 +453,7 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - -- Note: desizing only applies to natural materials + -- Note: scouring only applies to natural materials let naturalMaterialsShare = inputs.materials @@ -466,8 +468,8 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = | impacts = step.outputMass |> Quantity.multiplyBy naturalMaterialsShare - |> Formula.scouringImpacts step.impacts - { scouringProcess = textile.wellKnown.scouring + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.scouring , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } @@ -507,6 +509,40 @@ computeMercerisingImpacts { textile } ({ inputs } as simulator) = ) +computeWashingImpacts : Db -> Simulator -> Simulator +computeWashingImpacts { textile } ({ inputs } as simulator) = + simulator + |> updateLifeCycleStep Label.Ennobling + (\step -> + -- Note: washing only applies to synthetic and artificial materials + let + syntheticAndArtificialMaterialsShare = + inputs.materials + |> List.filter + (\{ material } -> + List.member material.origin + [ Origin.ArtificialFromInorganic + , Origin.ArtificialFromOrganic + , Origin.Synthetic + ] + ) + |> List.map (.share >> Split.toFloat) + |> List.sum + in + { step + | impacts = + step.outputMass + |> Quantity.multiplyBy syntheticAndArtificialMaterialsShare + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.washing + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> Impact.addImpacts step.impacts + } + ) + + stepMaterialImpacts : Db -> Material -> Step -> Impacts stepMaterialImpacts { textile } material step = case Material.getRecyclingData material textile.materials of diff --git a/tests/e2e-textile.json b/tests/e2e-textile.json index 7a5695e52..c7a82e279 100644 --- a/tests/e2e-textile.json +++ b/tests/e2e-textile.json @@ -82,27 +82,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 94.46130835550957, - "cch": 94.46130835550957, - "etf": 94.46130835550957, - "etf-c": 94.46130835550957, - "fru": 94.46130835550957, - "fwe": 94.46130835550957, - "htc": 94.46130835550957, - "htc-c": 94.46130835550957, - "htn": 94.46130835550957, - "htn-c": 94.46130835550957, - "ior": 94.46130835550957, - "ldu": 94.46130835550957, - "mru": 94.46130835550957, - "ozd": 94.46130835550957, - "pco": 94.46130835550957, - "pma": 94.46130835550957, - "swe": 94.46130835550957, - "tre": 94.46130835550957, - "wtu": 94.46130835550957, - "ecs": 2293.8689286317367, - "pef": 1592.582100838713 + "acd": 106.91805576035387, + "cch": 106.91805576035387, + "etf": 106.91805576035387, + "etf-c": 106.91805576035387, + "fru": 106.91805576035387, + "fwe": 106.91805576035387, + "htc": 106.91805576035387, + "htc-c": 106.91805576035387, + "htn": 106.91805576035387, + "htn-c": 106.91805576035387, + "ior": 106.91805576035387, + "ldu": 106.91805576035387, + "mru": 106.91805576035387, + "ozd": 106.91805576035387, + "pco": 106.91805576035387, + "pma": 106.91805576035387, + "swe": 106.91805576035387, + "tre": 106.91805576035387, + "wtu": 106.91805576035387, + "ecs": 2335.833025174165, + "pef": 1638.6251269668926 } }, { @@ -119,27 +119,27 @@ "countryMaking=FR" ], "impacts": { - "acd": 61.27064394962791, - "cch": 61.27064394962791, - "etf": 61.27064394962791, - "etf-c": 61.27064394962791, - "fru": 61.27064394962791, - "fwe": 61.27064394962791, - "htc": 61.27064394962791, - "htc-c": 61.27064394962791, - "htn": 61.27064394962791, - "htn-c": 61.27064394962791, - "ior": 61.27064394962791, - "ldu": 61.27064394962791, - "mru": 61.27064394962791, - "ozd": 61.27064394962791, - "pco": 61.27064394962791, - "pma": 61.27064394962791, - "swe": 61.27064394962791, - "tre": 61.27064394962791, - "wtu": 61.27064394962791, - "ecs": 1625.0214023258538, - "pef": 1015.8376702740751 + "acd": 64.59244325758638, + "cch": 64.59244325758638, + "etf": 64.59244325758638, + "etf-c": 64.59244325758638, + "fru": 64.59244325758638, + "fwe": 64.59244325758638, + "htc": 64.59244325758638, + "htc-c": 64.59244325758638, + "htn": 64.59244325758638, + "htn-c": 64.59244325758638, + "ior": 64.59244325758638, + "ldu": 64.59244325758638, + "mru": 64.59244325758638, + "ozd": 64.59244325758638, + "pco": 64.59244325758638, + "pma": 64.59244325758638, + "swe": 64.59244325758638, + "tre": 64.59244325758638, + "wtu": 64.59244325758638, + "ecs": 1636.2118280705015, + "pef": 1028.115810574923 } }, { @@ -192,27 +192,27 @@ "airTransportRatio=1" ], "impacts": { - "acd": 156.79351062781524, - "cch": 156.79351062781524, - "etf": 156.79351062781524, - "etf-c": 156.79351062781524, - "fru": 156.79351062781524, - "fwe": 156.79351062781524, - "htc": 156.79351062781524, - "htc-c": 156.79351062781524, - "htn": 156.79351062781524, - "htn-c": 156.79351062781524, - "ior": 156.79351062781524, - "ldu": 156.79351062781524, - "mru": 156.79351062781524, - "ozd": 156.79351062781524, - "pco": 156.79351062781524, - "pma": 156.79351062781524, - "swe": 156.79351062781524, - "tre": 156.79351062781524, - "wtu": 156.79351062781524, - "ecs": 7158.727727962107, - "pef": 4404.977872957464 + "acd": 158.66202273854185, + "cch": 158.66202273854185, + "etf": 158.66202273854185, + "etf-c": 158.66202273854185, + "fru": 158.66202273854185, + "fwe": 158.66202273854185, + "htc": 158.66202273854185, + "htc-c": 158.66202273854185, + "htn": 158.66202273854185, + "htn-c": 158.66202273854185, + "ior": 158.66202273854185, + "ldu": 158.66202273854185, + "mru": 158.66202273854185, + "ozd": 158.66202273854185, + "pco": 158.66202273854185, + "pma": 158.66202273854185, + "swe": 158.66202273854185, + "tre": 158.66202273854185, + "wtu": 158.66202273854185, + "ecs": 7170.435333941801, + "pef": 4417.845093342868 } }, { From 1ae23f2b2d0adb607216f7bba4bf62e2ab6328e1 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 17:15:21 +0200 Subject: [PATCH 08/12] Factor materials filtering functions. --- src/Data/Textile/Inputs.elm | 21 ++++++++++ src/Data/Textile/Material/Origin.elm | 27 +++++++++++++ src/Data/Textile/Simulator.elm | 57 ++++------------------------ 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/Data/Textile/Inputs.elm b/src/Data/Textile/Inputs.elm index c43f1793e..4de346a0c 100644 --- a/src/Data/Textile/Inputs.elm +++ b/src/Data/Textile/Inputs.elm @@ -5,8 +5,10 @@ module Data.Textile.Inputs exposing , countryList , encode , fromQuery + , getCottonShare , getMaterialMicrofibersComplement , getMaterialsOriginShares + , getMaterialsShareForOrigin , getOutOfEuropeEOLComplement , getOutOfEuropeEOLProbability , getTotalMicrofibersComplement @@ -380,6 +382,17 @@ countryList inputs = ] +getCottonShare : List MaterialInput -> Float +getCottonShare = + List.filter + (\{ material } -> + [ "ei-coton", "ei-coton-organic" ] + |> List.member (Material.idToString material.id) + ) + >> List.map (.share >> Split.toFloat) + >> List.sum + + getMaterialMicrofibersComplement : Mass -> MaterialInput -> Unit.Impact getMaterialMicrofibersComplement finalProductMass { material, share } = -- Note: Impact is computed against the final product mass, because microfibers @@ -411,6 +424,14 @@ getMaterialsOriginShares materialInputs = } +getMaterialsShareForOrigin : List Origin -> List MaterialInput -> Float +getMaterialsShareForOrigin origins = + List.filter + (\{ material } -> List.member material.origin origins) + >> List.map (.share >> Split.toFloat) + >> List.sum + + getMaterialCategoryShare : Origin -> List MaterialInput -> Split getMaterialCategoryShare origin = List.filterMap diff --git a/src/Data/Textile/Material/Origin.elm b/src/Data/Textile/Material/Origin.elm index 9a7292ea1..fa9581e76 100644 --- a/src/Data/Textile/Material/Origin.elm +++ b/src/Data/Textile/Material/Origin.elm @@ -4,6 +4,9 @@ module Data.Textile.Material.Origin exposing , decode , defaultShares , isSynthetic + , natural + , nonSynthetic + , syntheticAndArtificial , threadProcess , toLabel , toMicrofibersComplement @@ -76,6 +79,30 @@ isSynthetic origin = origin == Synthetic +natural : List Origin +natural = + [ NaturalFromAnimal + , NaturalFromVegetal + ] + + +nonSynthetic : List Origin +nonSynthetic = + [ ArtificialFromInorganic + , ArtificialFromOrganic + , NaturalFromAnimal + , NaturalFromVegetal + ] + + +syntheticAndArtificial : List Origin +syntheticAndArtificial = + [ ArtificialFromInorganic + , ArtificialFromOrganic + , Synthetic + ] + + toMicrofibersComplement : Origin -> Unit.Impact toMicrofibersComplement origin = -- see https://fabrique-numerique.gitbook.io/ecobalyse/textile/limites-methodologiques/old/microfibres#calcul-du-complement-microfibres diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index 75de22c39..3f463902d 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -403,17 +403,11 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = |> updateLifeCycleStep Label.Ennobling (\step -> -- Note: bleaching only applies to non-synthetic materials - let - nonSyntheticMaterialsShare = - inputs.materials - |> List.filter (\{ material } -> material.origin /= Origin.Synthetic) - |> List.map (.share >> Split.toFloat) - |> List.sum - in { step | impacts = step.outputMass - |> Quantity.multiplyBy nonSyntheticMaterialsShare + -- Note: bleaching only applies to non-synthetic materials + |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.nonSynthetic inputs.materials) |> Formula.bleachingImpacts step.impacts { bleachingProcess = textile.wellKnown.bleaching , aquaticPollutionScenario = step.country.aquaticPollutionScenario @@ -453,21 +447,11 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - -- Note: scouring only applies to natural materials - let - naturalMaterialsShare = - inputs.materials - |> List.filter - (\{ material } -> - List.member material.origin [ Origin.NaturalFromAnimal, Origin.NaturalFromVegetal ] - ) - |> List.map (.share >> Split.toFloat) - |> List.sum - in { step | impacts = step.outputMass - |> Quantity.multiplyBy naturalMaterialsShare + -- Note: scouring only applies to natural materials + |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.natural inputs.materials) |> Formula.genericImpacts step.impacts { process = textile.wellKnown.scouring , countryElecProcess = inputs.countryDyeing.electricityProcess @@ -483,22 +467,11 @@ computeMercerisingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - -- Note: mercerising only applies to cotton (conventional and organic) - let - cottonShare = - inputs.materials - |> List.filter - (\{ material } -> - [ "ei-coton", "ei-coton-organic" ] - |> List.member (Material.idToString material.id) - ) - |> List.map (.share >> Split.toFloat) - |> List.sum - in { step | impacts = step.outputMass - |> Quantity.multiplyBy cottonShare + -- Note: mercerising only applies to cotton (conventional and organic) + |> Quantity.multiplyBy (Inputs.getCottonShare inputs.materials) |> Formula.mercerisingImpacts step.impacts { mercerisingProcess = textile.wellKnown.mercerising , countryElecProcess = inputs.countryDyeing.electricityProcess @@ -514,25 +487,11 @@ computeWashingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - -- Note: washing only applies to synthetic and artificial materials - let - syntheticAndArtificialMaterialsShare = - inputs.materials - |> List.filter - (\{ material } -> - List.member material.origin - [ Origin.ArtificialFromInorganic - , Origin.ArtificialFromOrganic - , Origin.Synthetic - ] - ) - |> List.map (.share >> Split.toFloat) - |> List.sum - in { step | impacts = step.outputMass - |> Quantity.multiplyBy syntheticAndArtificialMaterialsShare + -- Note: washing only applies to synthetic and artificial materials + |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.syntheticAndArtificial inputs.materials) |> Formula.genericImpacts step.impacts { process = textile.wellKnown.washing , countryElecProcess = inputs.countryDyeing.electricityProcess From 2d0bd1415624ae2af37e09dcdd150801d9bc8d32 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 18:53:47 +0200 Subject: [PATCH 09/12] Attach elec and heat to pre-treatment formula results. --- src/Data/Textile/Formula.elm | 69 ++++++++++++++++++++-------------- src/Data/Textile/Simulator.elm | 41 +++++++++++++------- src/Views/Textile/Step.elm | 8 +++- 3 files changed, 74 insertions(+), 44 deletions(-) diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index c626ccb15..c012dcf3e 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -272,45 +272,56 @@ bleachingImpacts : , countryHeatProcess : Process } -> Mass - -> Impacts + -> { heat : Energy, kwh : Energy, impacts : Impacts } bleachingImpacts impacts { bleachingProcess, aquaticPollutionScenario, countryElecProcess, countryHeatProcess } baseMass = - impacts - |> Impact.mapImpacts - (\trigram _ -> - Quantity.sum - [ bleachingProcess.elec - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forKWh (Process.getImpact trigram countryElecProcess) - , bleachingProcess.heat - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) - , baseMass - |> Unit.forKg (Process.getImpact trigram bleachingProcess) - |> Quantity.multiplyBy (getAquaticPollutionRealRatio aquaticPollutionScenario) - ] + let + ( elec, heat ) = + ( bleachingProcess.elec |> Quantity.multiplyBy (Mass.inKilograms baseMass) + , bleachingProcess.heat |> Quantity.multiplyBy (Mass.inKilograms baseMass) ) + in + { kwh = elec + , heat = heat + , impacts = + impacts + |> Impact.mapImpacts + (\trigram _ -> + Quantity.sum + [ elec |> Unit.forKWh (Process.getImpact trigram countryElecProcess) + , heat |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) + , baseMass + |> Unit.forKg (Process.getImpact trigram bleachingProcess) + |> Quantity.multiplyBy (getAquaticPollutionRealRatio aquaticPollutionScenario) + ] + ) + } genericImpacts : Impacts -> { process : Process, countryElecProcess : Process, countryHeatProcess : Process } -> Mass - -> Impacts + -> { heat : Energy, kwh : Energy, impacts : Impacts } genericImpacts impacts { process, countryElecProcess, countryHeatProcess } baseMass = - impacts - |> Impact.mapImpacts - (\trigram _ -> - Quantity.sum - [ process.elec - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forKWh (Process.getImpact trigram countryElecProcess) - , process.heat - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) - , baseMass - |> Unit.forKg (Process.getImpact trigram process) - ] + let + ( elec, heat ) = + ( process.elec |> Quantity.multiplyBy (Mass.inKilograms baseMass) + , process.heat |> Quantity.multiplyBy (Mass.inKilograms baseMass) ) + in + { kwh = elec + , heat = heat + , impacts = + impacts + |> Impact.mapImpacts + (\trigram _ -> + Quantity.sum + [ elec |> Unit.forKWh (Process.getImpact trigram countryElecProcess) + , heat |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) + , baseMass |> Unit.forKg (Process.getImpact trigram process) + ] + ) + } mercerisingImpacts : diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index 3f463902d..37fdca146 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -402,9 +402,8 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - -- Note: bleaching only applies to non-synthetic materials - { step - | impacts = + let + { kwh, impacts, heat } = step.outputMass -- Note: bleaching only applies to non-synthetic materials |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.nonSynthetic inputs.materials) @@ -414,7 +413,11 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } - |> Impact.addImpacts step.impacts + in + { step + | impacts = impacts |> Impact.addImpacts step.impacts + , kwh = kwh |> Quantity.plus step.kwh + , heat = heat |> Quantity.plus step.heat } ) @@ -426,15 +429,19 @@ computeDesizingImpacts { textile } ({ inputs } as simulator) = (\step -> -- Note: desizing only applies to weaved products if inputs.product.fabric == Fabric.Weaving then - { step - | impacts = + let + { kwh, impacts, heat } = step.outputMass |> Formula.genericImpacts step.impacts { process = textile.wellKnown.desizing , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } - |> Impact.addImpacts step.impacts + in + { step + | impacts = impacts |> Impact.addImpacts step.impacts + , kwh = kwh |> Quantity.plus step.kwh + , heat = heat |> Quantity.plus step.heat } else @@ -447,8 +454,8 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - { step - | impacts = + let + { kwh, impacts, heat } = step.outputMass -- Note: scouring only applies to natural materials |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.natural inputs.materials) @@ -457,7 +464,11 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } - |> Impact.addImpacts step.impacts + in + { step + | impacts = impacts |> Impact.addImpacts step.impacts + , kwh = kwh |> Quantity.plus step.kwh + , heat = heat |> Quantity.plus step.heat } ) @@ -487,8 +498,8 @@ computeWashingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - { step - | impacts = + let + { kwh, impacts, heat } = step.outputMass -- Note: washing only applies to synthetic and artificial materials |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.syntheticAndArtificial inputs.materials) @@ -497,7 +508,11 @@ computeWashingImpacts { textile } ({ inputs } as simulator) = , countryElecProcess = inputs.countryDyeing.electricityProcess , countryHeatProcess = inputs.countryDyeing.heatProcess } - |> Impact.addImpacts step.impacts + in + { step + | impacts = impacts |> Impact.addImpacts step.impacts + , kwh = kwh |> Quantity.plus step.kwh + , heat = heat |> Quantity.plus step.heat } ) diff --git a/src/Views/Textile/Step.elm b/src/Views/Textile/Step.elm index dc9a02e2b..9ae0a901b 100644 --- a/src/Views/Textile/Step.elm +++ b/src/Views/Textile/Step.elm @@ -868,7 +868,11 @@ ennoblingToxicityView db ({ selectedImpact, inputs } as config) current = Impact.empty toxicity = - Impact.sumImpacts [ bleachingToxicity, dyeingToxicity, printingToxicity ] + Impact.sumImpacts + [ bleachingToxicity.impacts + , dyeingToxicity + , printingToxicity + ] in li [ class "list-group-item text-muted d-flex justify-content-center gap-2" ] [ span [] [ text <| "Dont inventaires enrichis\u{00A0}:" ] @@ -1074,7 +1078,7 @@ advancedStepView ({ db, inputs, selectedImpact, current } as config) = Label.Ennobling -> [ div [ class "mb-2" ] - [ text "Pré-traitement\u{00A0}: non applicable" ] + [ text "Pré-traitement\u{00A0}: TODO" ] , ennoblingGenericFields config , div [ class "mt-2" ] [ text "Finition\u{00A0}: apprêt chimique" ] From da5529be121ef69f18573416c561d631bf5049d1 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 24 Apr 2024 19:02:29 +0200 Subject: [PATCH 10/12] Factor out the way we're adding elec, heat & impacts to step. --- src/Data/Textile/Formula.elm | 27 ------ src/Data/Textile/Simulator.elm | 149 +++++++++++++-------------------- 2 files changed, 60 insertions(+), 116 deletions(-) diff --git a/src/Data/Textile/Formula.elm b/src/Data/Textile/Formula.elm index c012dcf3e..e4c8c2839 100644 --- a/src/Data/Textile/Formula.elm +++ b/src/Data/Textile/Formula.elm @@ -13,7 +13,6 @@ module Data.Textile.Formula exposing , makingWaste , materialDyeingToxicityImpacts , materialPrintingToxicityImpacts - , mercerisingImpacts , printingImpacts , pureMaterialImpacts , recycledMaterialImpacts @@ -324,32 +323,6 @@ genericImpacts impacts { process, countryElecProcess, countryHeatProcess } baseM } -mercerisingImpacts : - Impacts - -> - { mercerisingProcess : Process -- Inbound: mercerising process - , countryElecProcess : Process - , countryHeatProcess : Process - } - -> Mass - -> Impacts -mercerisingImpacts impacts { mercerisingProcess, countryElecProcess, countryHeatProcess } baseMass = - impacts - |> Impact.mapImpacts - (\trigram _ -> - Quantity.sum - [ mercerisingProcess.elec - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forKWh (Process.getImpact trigram countryElecProcess) - , mercerisingProcess.heat - |> Quantity.multiplyBy (Mass.inKilograms baseMass) - |> Unit.forMJ (Process.getImpact trigram countryHeatProcess) - , baseMass - |> Unit.forKg (Process.getImpact trigram mercerisingProcess) - ] - ) - - materialDyeingToxicityImpacts : Impacts -> diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index 37fdca146..fb833e16e 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -181,6 +181,15 @@ initializeFinalMass ({ inputs } as simulator) = |> updateLifeCycleSteps Label.all (Step.initMass inputs.mass) +addFormulaResultToStep : Step -> { heat : Energy, kwh : Energy, impacts : Impacts } -> Step +addFormulaResultToStep step { kwh, impacts, heat } = + { step + | impacts = impacts |> Impact.addImpacts step.impacts + , kwh = kwh |> Quantity.plus step.kwh + , heat = heat |> Quantity.plus step.heat + } + + computeDurability : Simulator -> Simulator computeDurability ({ inputs } as simulator) = let @@ -380,20 +389,13 @@ computeFinishingImpacts { textile } simulator = simulator |> updateLifeCycleStep Label.Ennobling (\({ country } as step) -> - let - { heat, kwh, impacts } = - step.outputMass - |> Formula.finishingImpacts step.impacts - { finishingProcess = textile.wellKnown.finishing - , heatProcess = WellKnown.getEnnoblingHeatProcess textile.wellKnown country - , elecProcess = country.electricityProcess - } - in - { step - | heat = step.heat |> Quantity.plus heat - , kwh = step.kwh |> Quantity.plus kwh - , impacts = step.impacts |> Impact.addImpacts impacts - } + step.outputMass + |> Formula.finishingImpacts step.impacts + { finishingProcess = textile.wellKnown.finishing + , heatProcess = WellKnown.getEnnoblingHeatProcess textile.wellKnown country + , elecProcess = country.electricityProcess + } + |> addFormulaResultToStep step ) @@ -402,23 +404,16 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - let - { kwh, impacts, heat } = - step.outputMass - -- Note: bleaching only applies to non-synthetic materials - |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.nonSynthetic inputs.materials) - |> Formula.bleachingImpacts step.impacts - { bleachingProcess = textile.wellKnown.bleaching - , aquaticPollutionScenario = step.country.aquaticPollutionScenario - , countryElecProcess = inputs.countryDyeing.electricityProcess - , countryHeatProcess = inputs.countryDyeing.heatProcess - } - in - { step - | impacts = impacts |> Impact.addImpacts step.impacts - , kwh = kwh |> Quantity.plus step.kwh - , heat = heat |> Quantity.plus step.heat - } + step.outputMass + -- Note: bleaching only applies to non-synthetic materials + |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.nonSynthetic inputs.materials) + |> Formula.bleachingImpacts step.impacts + { bleachingProcess = textile.wellKnown.bleaching + , aquaticPollutionScenario = step.country.aquaticPollutionScenario + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> addFormulaResultToStep step ) @@ -429,20 +424,13 @@ computeDesizingImpacts { textile } ({ inputs } as simulator) = (\step -> -- Note: desizing only applies to weaved products if inputs.product.fabric == Fabric.Weaving then - let - { kwh, impacts, heat } = - step.outputMass - |> Formula.genericImpacts step.impacts - { process = textile.wellKnown.desizing - , countryElecProcess = inputs.countryDyeing.electricityProcess - , countryHeatProcess = inputs.countryDyeing.heatProcess - } - in - { step - | impacts = impacts |> Impact.addImpacts step.impacts - , kwh = kwh |> Quantity.plus step.kwh - , heat = heat |> Quantity.plus step.heat - } + step.outputMass + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.desizing + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> addFormulaResultToStep step else step @@ -454,22 +442,15 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - let - { kwh, impacts, heat } = - step.outputMass - -- Note: scouring only applies to natural materials - |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.natural inputs.materials) - |> Formula.genericImpacts step.impacts - { process = textile.wellKnown.scouring - , countryElecProcess = inputs.countryDyeing.electricityProcess - , countryHeatProcess = inputs.countryDyeing.heatProcess - } - in - { step - | impacts = impacts |> Impact.addImpacts step.impacts - , kwh = kwh |> Quantity.plus step.kwh - , heat = heat |> Quantity.plus step.heat - } + step.outputMass + -- Note: scouring only applies to natural materials + |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.natural inputs.materials) + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.scouring + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> addFormulaResultToStep step ) @@ -478,18 +459,15 @@ computeMercerisingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - { step - | impacts = - step.outputMass - -- Note: mercerising only applies to cotton (conventional and organic) - |> Quantity.multiplyBy (Inputs.getCottonShare inputs.materials) - |> Formula.mercerisingImpacts step.impacts - { mercerisingProcess = textile.wellKnown.mercerising - , countryElecProcess = inputs.countryDyeing.electricityProcess - , countryHeatProcess = inputs.countryDyeing.heatProcess - } - |> Impact.addImpacts step.impacts - } + step.outputMass + -- Note: mercerising only applies to cotton (conventional and organic) + |> Quantity.multiplyBy (Inputs.getCottonShare inputs.materials) + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.mercerising + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> addFormulaResultToStep step ) @@ -498,22 +476,15 @@ computeWashingImpacts { textile } ({ inputs } as simulator) = simulator |> updateLifeCycleStep Label.Ennobling (\step -> - let - { kwh, impacts, heat } = - step.outputMass - -- Note: washing only applies to synthetic and artificial materials - |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.syntheticAndArtificial inputs.materials) - |> Formula.genericImpacts step.impacts - { process = textile.wellKnown.washing - , countryElecProcess = inputs.countryDyeing.electricityProcess - , countryHeatProcess = inputs.countryDyeing.heatProcess - } - in - { step - | impacts = impacts |> Impact.addImpacts step.impacts - , kwh = kwh |> Quantity.plus step.kwh - , heat = heat |> Quantity.plus step.heat - } + step.outputMass + -- Note: washing only applies to synthetic and artificial materials + |> Quantity.multiplyBy (Inputs.getMaterialsShareForOrigin Origin.syntheticAndArtificial inputs.materials) + |> Formula.genericImpacts step.impacts + { process = textile.wellKnown.washing + , countryElecProcess = inputs.countryDyeing.electricityProcess + , countryHeatProcess = inputs.countryDyeing.heatProcess + } + |> addFormulaResultToStep step ) From 7267ea649055f8c7c18b129e85778e003c7afeea Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Tue, 30 Apr 2024 16:02:46 +0200 Subject: [PATCH 11/12] TMP render computation details --- src/Data/Textile/Simulator.elm | 8 ++++++++ src/Data/Textile/Step.elm | 18 ++++++++++++------ src/Views/Textile/Step.elm | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index fb833e16e..a4318dfb9 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -485,6 +485,14 @@ computeWashingImpacts { textile } ({ inputs } as simulator) = , countryHeatProcess = inputs.countryDyeing.heatProcess } |> addFormulaResultToStep step + |> Step.updateStepProcessInfo + (\processInfo -> + { processInfo + | preTreatments = + processInfo.preTreatments + |> Maybe.map (\preTreatments -> preTreatments ++ ", " ++ textile.wellKnown.washing.name) + } + ) ) diff --git a/src/Data/Textile/Step.elm b/src/Data/Textile/Step.elm index 198ad1557..fadc1a97a 100644 --- a/src/Data/Textile/Step.elm +++ b/src/Data/Textile/Step.elm @@ -15,6 +15,7 @@ module Data.Textile.Step exposing , surfaceMassToString , updateDeadStock , updateFromInputs + , updateStepProcessInfo , updateWaste , yarnSizeToString ) @@ -89,25 +90,24 @@ type alias ProcessInfo = , distribution : Maybe String , fading : Maybe String , printing : Maybe String + , preTreatments : Maybe String } create : { label : Label, editable : Bool, country : Country, enabled : Bool } -> Step create { label, editable, country, enabled } = - let - defaultImpacts = - Impact.empty - in { label = label , enabled = enabled , country = country + + -- FIXME: check if this field is still useful , editable = editable , inputMass = Quantity.zero , outputMass = Quantity.zero , waste = Quantity.zero , deadstock = Quantity.zero - , transport = Transport.default defaultImpacts - , impacts = defaultImpacts + , transport = Transport.default Impact.empty + , impacts = Impact.empty , complementsImpacts = Impact.noComplementsImpacts , heat = Quantity.zero , kwh = Quantity.zero @@ -144,6 +144,7 @@ defaultProcessInfo = , distribution = Nothing , fading = Nothing , printing = Nothing + , preTreatments = Nothing } @@ -415,6 +416,11 @@ updateWaste waste mass step = } +updateStepProcessInfo : (ProcessInfo -> ProcessInfo) -> Step -> Step +updateStepProcessInfo fn step = + { step | processInfo = fn step.processInfo } + + updateDeadStock : Mass -> Mass -> Step -> Step updateDeadStock deadstock mass step = { step diff --git a/src/Views/Textile/Step.elm b/src/Views/Textile/Step.elm index 9ae0a901b..716a69284 100644 --- a/src/Views/Textile/Step.elm +++ b/src/Views/Textile/Step.elm @@ -1078,7 +1078,7 @@ advancedStepView ({ db, inputs, selectedImpact, current } as config) = Label.Ennobling -> [ div [ class "mb-2" ] - [ text "Pré-traitement\u{00A0}: TODO" ] + [ viewProcessInfo current.processInfo.preTreatments ] , ennoblingGenericFields config , div [ class "mt-2" ] [ text "Finition\u{00A0}: apprêt chimique" ] From e3dfb94bf5449504a062cee70ae31bbe41b3e765 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 12 Jun 2024 18:49:35 +0200 Subject: [PATCH 12/12] Add pre-treatments process info. --- src/Data/Textile/Simulator.elm | 41 +++++++++++++++++++++------------- src/Data/Textile/Step.elm | 10 ++------- src/Views/Textile/Step.elm | 23 ++++++++++--------- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/src/Data/Textile/Simulator.elm b/src/Data/Textile/Simulator.elm index a4318dfb9..bdc899794 100644 --- a/src/Data/Textile/Simulator.elm +++ b/src/Data/Textile/Simulator.elm @@ -140,21 +140,21 @@ compute db query = |> nextIf Label.Spinning computeSpinningImpacts -- Compute Weaving & Knitting step impacts |> nextWithDbIf Label.Fabric computeFabricImpacts - -- Compute Ennobling step bleaching impacts + -- Compute Ennobling step bleaching impacts (Blanchiment) |> nextWithDbIf Label.Ennobling computeBleachingImpacts - -- Compute Ennobling step desizing impacts + -- Compute Ennobling step desizing impacts (Désencollage) |> nextWithDbIf Label.Ennobling computeDesizingImpacts - -- Compute Ennobling step scouring impacts + -- Compute Ennobling step scouring impacts (Dégraissage) |> nextWithDbIf Label.Ennobling computeScouringImpacts - -- Compute Ennobling step mercerising impacts + -- Compute Ennobling step mercerising impacts (Mercerisage) |> nextWithDbIf Label.Ennobling computeMercerisingImpacts - -- Compute Ennobling step washing impacts + -- Compute Ennobling step washing impacts (Lavage) |> nextWithDbIf Label.Ennobling computeWashingImpacts - -- Compute Ennobling step Dyeing impacts + -- Compute Ennobling step Dyeing impacts (Teinture) |> nextWithDbIf Label.Ennobling computeDyeingImpacts - -- Compute Ennobling step Printing impacts + -- Compute Ennobling step Printing impacts (Impression) |> nextWithDbIf Label.Ennobling computePrintingImpacts - -- Compute Ennobling step Finishing impacts + -- Compute Ennobling step Finishing impacts (Finition) |> nextWithDbIf Label.Ennobling computeFinishingImpacts -- Compute Making step impacts |> nextWithDbIf Label.Making computeMakingImpacts @@ -190,6 +190,18 @@ addFormulaResultToStep step { kwh, impacts, heat } = } +addPretreatmentInfo : String -> Step -> Step +addPretreatmentInfo text ({ processInfo } as step) = + { step + | processInfo = + { processInfo + | preTreatments = + text + :: processInfo.preTreatments + } + } + + computeDurability : Simulator -> Simulator computeDurability ({ inputs } as simulator) = let @@ -414,6 +426,7 @@ computeBleachingImpacts { textile } ({ inputs } as simulator) = , countryHeatProcess = inputs.countryDyeing.heatProcess } |> addFormulaResultToStep step + |> addPretreatmentInfo "Blanchiment" ) @@ -431,6 +444,7 @@ computeDesizingImpacts { textile } ({ inputs } as simulator) = , countryHeatProcess = inputs.countryDyeing.heatProcess } |> addFormulaResultToStep step + |> addPretreatmentInfo "Désencollage" else step @@ -451,6 +465,7 @@ computeScouringImpacts { textile } ({ inputs } as simulator) = , countryHeatProcess = inputs.countryDyeing.heatProcess } |> addFormulaResultToStep step + |> addPretreatmentInfo "Dégraissage" ) @@ -468,6 +483,7 @@ computeMercerisingImpacts { textile } ({ inputs } as simulator) = , countryHeatProcess = inputs.countryDyeing.heatProcess } |> addFormulaResultToStep step + |> addPretreatmentInfo "Mercerisage" ) @@ -485,14 +501,7 @@ computeWashingImpacts { textile } ({ inputs } as simulator) = , countryHeatProcess = inputs.countryDyeing.heatProcess } |> addFormulaResultToStep step - |> Step.updateStepProcessInfo - (\processInfo -> - { processInfo - | preTreatments = - processInfo.preTreatments - |> Maybe.map (\preTreatments -> preTreatments ++ ", " ++ textile.wellKnown.washing.name) - } - ) + |> addPretreatmentInfo "Lavage" ) diff --git a/src/Data/Textile/Step.elm b/src/Data/Textile/Step.elm index fadc1a97a..afd3ee1d6 100644 --- a/src/Data/Textile/Step.elm +++ b/src/Data/Textile/Step.elm @@ -15,7 +15,6 @@ module Data.Textile.Step exposing , surfaceMassToString , updateDeadStock , updateFromInputs - , updateStepProcessInfo , updateWaste , yarnSizeToString ) @@ -90,7 +89,7 @@ type alias ProcessInfo = , distribution : Maybe String , fading : Maybe String , printing : Maybe String - , preTreatments : Maybe String + , preTreatments : List String } @@ -144,7 +143,7 @@ defaultProcessInfo = , distribution = Nothing , fading = Nothing , printing = Nothing - , preTreatments = Nothing + , preTreatments = [] } @@ -416,11 +415,6 @@ updateWaste waste mass step = } -updateStepProcessInfo : (ProcessInfo -> ProcessInfo) -> Step -> Step -updateStepProcessInfo fn step = - { step | processInfo = fn step.processInfo } - - updateDeadStock : Mass -> Mass -> Step -> Step updateDeadStock deadstock mass step = { step diff --git a/src/Views/Textile/Step.elm b/src/Views/Textile/Step.elm index 716a69284..d56aa9845 100644 --- a/src/Views/Textile/Step.elm +++ b/src/Views/Textile/Step.elm @@ -1063,7 +1063,7 @@ advancedStepView ({ db, inputs, selectedImpact, current } as config) = , showIf (inputs.fading == Just True) <| viewProcessInfo current.processInfo.fading ] , ul - [ class "StepBody p-0 list-group list-group-flush border-bottom-0" + [ class "StepBody p-0 list-group list-group-flush border-top border-bottom-0" , classList [ ( "disabled", not current.enabled ) ] ] (List.map @@ -1077,20 +1077,21 @@ advancedStepView ({ db, inputs, selectedImpact, current } as config) = [ surfaceMassField config ] Label.Ennobling -> - [ div [ class "mb-2" ] - [ viewProcessInfo current.processInfo.preTreatments ] + [ showIf (List.length current.processInfo.preTreatments > 0) + (text <| + "Pré-traitements\u{00A0}: " + ++ String.join ", " current.processInfo.preTreatments + ) , ennoblingGenericFields config - , div [ class "mt-2" ] - [ text "Finition\u{00A0}: apprêt chimique" ] + , text "Finition\u{00A0}: apprêt chimique" ] Label.Making -> - List.filterMap identity - [ Just <| makingWasteField config - , Just <| makingDeadStockField config - , Just <| airTransportRatioField config - , Just (fadingField config) - ] + [ makingWasteField config + , makingDeadStockField config + , airTransportRatioField config + , fadingField config + ] Label.Use -> [ daysOfWearInfo config