S2h.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 S2h :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. S2h(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. mu2_H2 = events.getDouble("mu2_H2"); // = ???
  41. //k_2 = events.getDouble("k_2"); // = ???
  42. //beta_2 = events.getDouble("beta_2"); // = ???
  43. b_2 = events.getDouble("b_2"); // = ???
  44. d2_H2 = events.getDouble("d2_H2"); // = ???
  45. H_2 = events.getDouble("H_2"); // = ???
  46. epsilon_2 = events.getDouble("epsilon_2"); // = ???
  47. phi_s2 = events.getDouble("phi_s2"); // = ???
  48. phi_s1 = events.getDouble("phi_s1"); // = ???
  49. _S2h = createVar("S2h");
  50. _I2v = createExt("I2v");
  51. _R2h = createExt("R2h");
  52. //_Pth2 = createExt("Pth2");
  53. _S1h= createExt("S1h");
  54. /* _S2v= createExt("S2v");
  55. _E2v= createExt("E2v"); */
  56. }
  57. virtual ~S2h()
  58. { }
  59. void compute(const vle::devs::Time& /* time */)
  60. {
  61. // V_2 = grad(_S2v) + grad(_E2v) + grad(_I2v); //current size of all compartments at time t
  62. grad(_S2h) = mu2_H2*H_2 + phi_s1*_S1h() - phi_s2*_S2h() + epsilon_2*_R2h() - b_2*_S2h()*_I2v()/H_2 - d2_H2*_S2h();
  63. }
  64. private:
  65. //birth rate of host population of the patch 2
  66. double mu2_H2;
  67. //contact proportion between Susceptibles humans of the patch 2 and Infectious mosquitoes of the patch 2
  68. //double beta_2;
  69. //average number of that contact per unit time for that patch 2
  70. //double k_2;
  71. //inoculation rate of patch 2
  72. double b_2;
  73. // size of host population
  74. double H_2;
  75. // natural death rate of S in the host population for the patch 2
  76. double d2_H2;
  77. //transition rate from R -> S in the host population for the patch 2
  78. double epsilon_2;
  79. // migration rate of Susceptible of host population of the patch 2 that left to patch 1 (Go)
  80. double phi_s2;
  81. // migration rate of Susceptible of host population of the patch 1 that come to patch 2 (Come)
  82. double phi_s1;
  83. Var _S2h;
  84. Ext _I2v;
  85. Ext _R2h;
  86. //Ext _Pth2;
  87. Ext _S1h;
  88. /* Ext _S2v;
  89. Ext _E2v; */
  90. };
  91. } // namespace malariaspread
  92. DECLARE_DYNAMICS(malariaspread::S2h)