Skip to content

Commit

Permalink
chore: change waste ratio to input mass (#711)
Browse files Browse the repository at this point in the history
Jusqu’à présent on utilisait dans processes.json la définition du taux
de perte de la base Impacts que l’on qualifiera de “taux de perte masse
sortante”. Mais cette définition est contre-intuitive et n’était donc
pas utilisé dans la doc. On a donc 2 valeurs différentes entre la doc et
le code.

Solution: passer le taux de perte du code en version intuitive ou “taux de 
perte masse entrante”.
  • Loading branch information
paulboosz authored Sep 25, 2024
1 parent 6b1e03d commit a309fec
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 366 deletions.
44 changes: 22 additions & 22 deletions public/data/textile/processes.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.270519,
"waste": 0.21292,
"alias": null
},
{
Expand Down Expand Up @@ -756,7 +756,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.270519,
"waste": 0.21292,
"alias": null
},
{
Expand Down Expand Up @@ -794,7 +794,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.270519,
"waste": 0.21292,
"alias": null
},
{
Expand Down Expand Up @@ -832,7 +832,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.0319569,
"waste": 0.03097,
"alias": null
},
{
Expand Down Expand Up @@ -870,7 +870,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.0319569,
"waste": 0.03097,
"alias": null
},
{
Expand Down Expand Up @@ -908,7 +908,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.0319569,
"waste": 0.03097,
"alias": null
},
{
Expand Down Expand Up @@ -946,7 +946,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.0319569,
"waste": 0.03097,
"alias": null
},
{
Expand Down Expand Up @@ -984,7 +984,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.0765978,
"waste": 0.07115,
"alias": null
},
{
Expand Down Expand Up @@ -1022,7 +1022,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.538462,
"waste": 0.35,
"alias": null
},
{
Expand Down Expand Up @@ -1060,7 +1060,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.538462,
"waste": 0.35,
"alias": null
},
{
Expand Down Expand Up @@ -1098,7 +1098,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.201201,
"waste": 0.1675,
"alias": null
},
{
Expand Down Expand Up @@ -1136,7 +1136,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.105105,
"waste": 0.09511,
"alias": null
},
{
Expand Down Expand Up @@ -1174,7 +1174,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.221094,
"waste": 0.18106,
"alias": null
},
{
Expand Down Expand Up @@ -1212,7 +1212,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.0582011,
"waste": 0.055,
"alias": null
},
{
Expand Down Expand Up @@ -1250,7 +1250,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.631206,
"waste": 0.38696,
"alias": null
},
{
Expand Down Expand Up @@ -1288,7 +1288,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0.21716,
"waste": 0.17842,
"alias": null
},
{
Expand Down Expand Up @@ -1326,7 +1326,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 8.64,
"waste": 0.0576,
"waste": 0.05446,
"alias": "knitting-mix"
},
{
Expand Down Expand Up @@ -1364,7 +1364,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 6.06443,
"waste": 0.00502513,
"waste": 0.005,
"alias": "knitting-fully-fashioned"
},
{
Expand Down Expand Up @@ -1402,7 +1402,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 13.2112,
"waste": 0.00502513,
"waste": 0.005,
"alias": "knitting-seamless"
},
{
Expand Down Expand Up @@ -1440,7 +1440,7 @@
"heat_MJ": 0,
"elec_pppm": 0.0003145,
"elec_MJ": 0,
"waste": 0.0667,
"waste": 0.06253,
"alias": "weaving"
},
{
Expand Down Expand Up @@ -2694,7 +2694,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 4.194,
"waste": 0.0417,
"waste": 0.04003,
"alias": "knitting-straight"
},
{
Expand Down Expand Up @@ -2732,7 +2732,7 @@
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 4.25101,
"waste": 0.0351967,
"waste": 0.034,
"alias": "knitting-circular"
},
{
Expand Down
30 changes: 10 additions & 20 deletions src/Data/Textile/Formula.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Data.Textile.Formula exposing
, knittingImpacts
, makingDeadStock
, makingImpacts
, makingWaste
, materialDyeingToxicityImpacts
, materialPrintingToxicityImpacts
, printingImpacts
Expand Down Expand Up @@ -51,27 +50,18 @@ type alias StepValues =
{-| Compute source mass needed and waste generated by the operation.
-}
genericWaste : Split -> Mass -> { mass : Mass, waste : Mass }
genericWaste processWaste baseMass =
genericWaste processWaste stepOutputMass =
let
waste =
baseMass
|> Quantity.multiplyBy (Split.toFloat processWaste)
in
{ mass = baseMass |> Quantity.plus waste, waste = waste }


{-| Compute source material mass needed and waste generated by the operation, according to
material & product waste data.
-}
makingWaste : Split -> Mass -> { mass : Mass, waste : Mass }
makingWaste pcrWaste baseMass =
let
mass =
-- (product weight + textile waste for confection) / (1 - PCR product waste rate)
baseMass
|> Quantity.divideBy (Split.toFloat (Split.complement pcrWaste))
stepInputMass =
-- Use input mass waste ratio formula by default
-- See https://fabrique-numerique.gitbook.io/ecobalyse/textile/cycle-de-vie-des-produits-textiles/pertes-et-rebus
--
-- inputMass = outputMass / 1 - Input processWasteRatio
stepOutputMass
|> Quantity.divideBy (1 - Split.toFloat processWaste)
in
{ mass = mass, waste = Quantity.minus baseMass mass }
-- We return the inputMass of this step (considered as the output mass of the previous step)
{ mass = stepInputMass, waste = Quantity.minus stepOutputMass stepInputMass }


{-| Compute source material mass needed and deadstock generated by the operation, according to
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Textile/Simulator.elm
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ computeMakingStepWaste ({ inputs } as simulator) =

{ mass, waste } =
inputs.mass
|> Formula.makingWaste
|> Formula.genericWaste
(fabricProcess
|> Fabric.getMakingWaste product.making.pcrWaste makingWaste
)
Expand Down
8 changes: 1 addition & 7 deletions tests/Data/Textile/FormulaTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,8 @@ suite =
[ describe "Formula.genericWaste"
[ kg 1
|> Formula.genericWaste Split.half
|> Expect.equal { mass = kg 1.5, waste = kg 0.5 }
|> asTest "should compute material waste"
]
, describe "Formula.makingWaste"
[ kg 1
|> Formula.makingWaste Split.half
|> Expect.equal { mass = kg 2, waste = kg 1 }
|> asTest "should compute material waste from material and product waste data"
|> asTest "should compute generic waste using input waste ratio"
]
, describe "Formula.makingDeadStock"
[ kg 1
Expand Down
2 changes: 1 addition & 1 deletion tests/Data/Textile/SimulatorTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ suite =
[ { tShirtCotonFrance
| countrySpinning = Nothing
}
|> expectImpact db ecs 1471.1431913678628
|> expectImpact db ecs 1473.9780976999311
|> asTest "should compute a simulation ecs impact"
, describe "disabled steps"
[ { tShirtCotonFrance | disabledSteps = [ Label.Ennobling ] }
Expand Down
Loading

0 comments on commit a309fec

Please sign in to comment.