Simplify the concentration calculation.

This commit is contained in:
Phil Elson 2020-10-26 20:12:54 +01:00
parent d984866396
commit 4722a5511c

View file

@ -266,6 +266,13 @@ class Model:
return k + self.virus.decay_constant + self.ventilation.air_exchange(self.room, time)
def collect_time_state_changes(self):
"""
All time dependent entities on this model must provide information about
the times at which their state changes.
"""
@functools.lru_cache()
def concentration(self, time: float) -> float:
t = time
@ -286,4 +293,5 @@ class Model:
else:
# Concentration while infected not present.
end_concentration = self.concentration(t1)
return (end_concentration + ((np.exp(IVRR * t1) - 1) * end_concentration)) * np.exp(-IVRR * t)
fac = np.exp(IVRR * (t1 - t))
return end_concentration * fac