S2v.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 S2v :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. S2v(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. mu2_V2 = events.getDouble("mu2_V2"); // = ???
  41. f_2 = events.getDouble("f_2");; // = ???
  42. omega_2 = events.getDouble("omega_2"); // = ???
  43. d2_V2 = events.getDouble("d2_V2"); // = ???
  44. V_2 = events.getDouble("V_2"); // = ???
  45. H_2 = events.getDouble("H_2"); // = ???
  46. _S2v = createVar("S2v");
  47. _I2h = createExt("I2h");
  48. _T2 = createExt("Tmin");
  49. _Rh2 = createExt("Hmax");
  50. }
  51. virtual ~S2v()
  52. { }
  53. void compute(const vle::devs::Time& /* time */)
  54. {
  55. beta0 = 0.00113*_Rh2()*_Rh2()-0.158*_Rh2()-6.61;
  56. beta1 = -2.32*pow(10,-4)*_Rh2()*_Rh2()+0.0515*_Rh2()+1.06;
  57. beta2 = 4*pow(10,-6)*_Rh2()*_Rh2()-1.09*pow(10,-3)*_Rh2()-0.0255;
  58. ptrh2 = -log(exp(-1/(beta0+beta1*_T2()+beta2*_T2()*_T2()))); // mortality rate of the vector at temperature t1 and relative humidity rh1
  59. // grad(_S2v) = mu2_V2 *V_2 - f_2*omega_2*_S2v()*_I2h()/H_2 - ptrh2*_S2v() - d2_V2*_S2v();
  60. grad(_S2v) = mu2_V2 *V_2 - f_2*omega_2*_S2v()*_I2h()/V_2 - ptrh2*_S2v();
  61. }
  62. private:
  63. //birth rate of vector population of the patch 2
  64. double mu2_V2;
  65. //contact proportion between Susceptibles mosquitoes of the patch 2 and Infectious humans of the patch 2
  66. double omega_2;
  67. //average number of that contact per unit time for that patch 2
  68. double f_2;
  69. // size of vector population for the patch 2
  70. double V_2;
  71. double H_2;
  72. // natural death rate of S in the vector population for the patch 2
  73. double d2_V2;
  74. //coefficients for mortality rate
  75. double beta0;
  76. double beta1;
  77. double beta2;
  78. double ptrh2;
  79. Var _S2v;
  80. Ext _I2h;
  81. Ext _T2;
  82. Ext _Rh2;
  83. };
  84. } // namespace malariaspread
  85. DECLARE_DYNAMICS(malariaspread::S2v)