Skip to content

Commit

Permalink
fixed error in rate constant process
Browse files Browse the repository at this point in the history
  • Loading branch information
uliw committed Oct 29, 2020
1 parent 9bcca9f commit ad6869e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions esbmtk /esbmtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2657,7 +2657,7 @@ class RateConstant(Process):
reservoir concentration C and a constant which describes the
kvalue between the reservoir concentration and the flux scaling
F = kvalue * (C/C0)
F = (C/C0 -1) * k
where C denotes
the concentration in the ustream reservoir, C0 denotes the baseline
Expand Down Expand Up @@ -2722,8 +2722,9 @@ def __call__(self, reservoir: Reservoir, i: int) -> None:
"""
this will be called by the Model.run() method
"""
scale: float = reservoir.c[i - 1] / self.C0 * self.kvalue
self.f[i] = self.f[i] * scale
scale: float = (reservoir.c[i - 1] / self.C0 - 1) * self.kvalue
scale = scale * (scale >= 0) # prevent negative fluxes.
self.f[i] = self.f[i] + self.f[i] * scale

class Monod(Process):
"""This process scales the flux as a function of the upstream
Expand Down

0 comments on commit ad6869e

Please sign in to comment.