R12h.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * @file malaria/Si.cpp
  3. *
  4. * This file is part of VLE, a framework for multi-modeling, simulation
  5. * and analysis of complex dynamical systems
  6. * http://www.vle-project.org
  7. *
  8. * Copyright (c) 2011 INRA http://www.inra.fr
  9. *
  10. * See the AUTHORS or Authors.txt file for copyright owners and contributors
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. /* @@tagdepends: vle.extension.differential-equation @@endtagdepends
  26. @@tagdynamic@@ */
  27. #include <vle/extension/DifferentialEquation.hpp>
  28. #include <iostream>
  29. #include <sstream>
  30. namespace malariaspread {
  31. namespace ved = vle::extension::differential_equation;
  32. class R12h :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. R12h(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. alpha_2 = events.getDouble("alpha_2"); // = ???
  41. d2_H2 = events.getDouble("d2_H2"); // = ???
  42. phi_r1 = events.getDouble("phi_r1"); // = ???
  43. epsilon_2 = events.getDouble("epsilon_2"); // = ???
  44. _R12h = createVar("R12h");
  45. _I12h = createExt("I12h");
  46. _R1h= createExt("R1h");
  47. }
  48. virtual ~R12h()
  49. { }
  50. void compute(const vle::devs::Time& /* time */)
  51. {
  52. grad(_R12h) = alpha_2*_I12h() + phi_r1*_R1h() - epsilon_2*_R12h()- d2_H2*_R12h();
  53. }
  54. private:
  55. // transition rate from i -> R in the host population for the patch 2
  56. double alpha_2;
  57. // natural death rate of R in the host population for the patch 2
  58. double d2_H2;
  59. //transition rate from R -> S in the host population for the patch 2
  60. double epsilon_2;
  61. // migration rate of Recovered of host population of the patch 1 that left to patch 2 (Go)
  62. double phi_r1;
  63. Var _R12h;
  64. Ext _I12h;
  65. Ext _R1h;
  66. };
  67. } // namespace malariaspread
  68. DECLARE_DYNAMICS(malariaspread::R12h)