From 3ea0d83e21c5dc3cd9f0d0fc8a119e726620500a Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 12 Sep 2022 17:24:09 +0200 Subject: [PATCH] Added cloth mask to backend --- caimira/apps/calculator/model_generator.py | 2 +- caimira/apps/templates/base/calculator.form.html.j2 | 7 +++++++ caimira/models.py | 12 ++++++++++++ caimira/monte_carlo/data.py | 5 +++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/caimira/apps/calculator/model_generator.py b/caimira/apps/calculator/model_generator.py index 49fb639a..4896e485 100644 --- a/caimira/apps/calculator/model_generator.py +++ b/caimira/apps/calculator/model_generator.py @@ -807,7 +807,7 @@ def baseline_raw_form_data() -> typing.Dict[str, typing.Union[str, float]]: ACTIVITY_TYPES = {'office', 'smallmeeting', 'largemeeting', 'training', 'training_attendee', 'callcentre', 'controlroom-day', 'controlroom-night', 'library', 'workshop', 'lab', 'gym'} MECHANICAL_VENTILATION_TYPES = {'mech_type_air_changes', 'mech_type_air_supply', 'not-applicable'} -MASK_TYPES = {'Type I', 'FFP2'} +MASK_TYPES = {'Type I', 'FFP2', 'Cloth'} MASK_WEARING_OPTIONS = {'mask_on', 'mask_off'} VENTILATION_TYPES = {'natural_ventilation', 'mechanical_ventilation', 'no_ventilation'} VIRUS_TYPES = {'SARS_CoV_2', 'SARS_CoV_2_ALPHA', 'SARS_CoV_2_BETA','SARS_CoV_2_GAMMA', 'SARS_CoV_2_DELTA', 'SARS_CoV_2_OMICRON'} diff --git a/caimira/apps/templates/base/calculator.form.html.j2 b/caimira/apps/templates/base/calculator.form.html.j2 index b1dc9534..4a73a9fb 100644 --- a/caimira/apps/templates/base/calculator.form.html.j2 +++ b/caimira/apps/templates/base/calculator.form.html.j2 @@ -295,6 +295,13 @@ +
+ + +

diff --git a/caimira/models.py b/caimira/models.py index 86808236..f23298f8 100644 --- a/caimira/models.py +++ b/caimira/models.py @@ -526,6 +526,9 @@ class Mask: #: Filtration efficiency of masks when inhaling. η_inhale: _VectorisedFloat + #: Filtration efficiency of masks when exhaling. + η_exhale: _VectorisedFloat = 0. + #: Global factor applied to filtration efficiency of masks when exhaling. factor_exhale: float = 1. @@ -541,6 +544,11 @@ class Mask: the leakage through the sides. Diameter is in microns. """ + if self.η_exhale is not 0.: + # For cloth mask we simply return its exhale efficiency distribution value. + # Ref: https://doi.org/10.1080/02786826.2021.1890687 + return self.η_exhale + d = np.array(diameter) intermediate_range1 = np.bitwise_and(0.5 <= d, d < 0.94614) intermediate_range2 = np.bitwise_and(0.94614 <= d, d < 3.) @@ -570,6 +578,10 @@ Mask.types = { 'FFP2': Mask( η_inhale=0.865, # (94% penetration efficiency + 8% max inward leakage -> EN 149) ), + 'Cloth': Mask( # https://doi.org/10.1080/02786826.2021.1890687 + η_inhale=0.35, + η_exhale=0.225, + ), } diff --git a/caimira/monte_carlo/data.py b/caimira/monte_carlo/data.py index 8ad2fcfc..c387dbb0 100644 --- a/caimira/monte_carlo/data.py +++ b/caimira/monte_carlo/data.py @@ -168,8 +168,9 @@ virus_distributions = { # https://doi.org/10.1016/j.jhin.2013.02.007 # https://doi.org/10.4209/aaqr.2020.08.0531 mask_distributions = { - 'Type I': mc.Mask(Uniform(0.25, 0.80)), - 'FFP2': mc.Mask(Uniform(0.83, 0.91)), + 'Type I': mc.Mask(η_inhale=Uniform(0.25, 0.80)), + 'FFP2': mc.Mask(η_inhale=Uniform(0.83, 0.91)), + 'Cloth': mc.Mask(η_inhale=Uniform(0.05, 0.40), η_exhale=Uniform(0.20, 0.50)), }