I1v.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 I1v :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. I1v(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. delta_V1 = events.getDouble("delta_V1");; // = ???
  41. d1_V1 = events.getDouble("d1_V1"); // = ???
  42. _I1v = createVar("I1v");
  43. _E1v = createExt("E1v");
  44. _T1 = createExt("Tmin");
  45. _Rh1 = createExt("Hmax");
  46. }
  47. virtual ~I1v()
  48. { }
  49. void compute(const vle::devs::Time& /* time */)
  50. {
  51. beta0 = 0.00113*_Rh1()*_Rh1()-0.158*_Rh1()-6.61;
  52. beta1 = -2.32*pow(10,-4)*_Rh1()*_Rh1()+0.0515*_Rh1()+1.06;
  53. beta2 = 4*pow(10,-6)*_Rh1()*_Rh1()-1.09*pow(10,-3)*_Rh1()-0.0255;
  54. ptrh1 = -log(exp(-1/(beta0+beta1*_T1()+beta2*_T1()*_T1()))); // mortality rate of the vector at temperature t1 and relative humidity rh1
  55. // grad(_I1v) = delta_V1*_E1v() - ptrh1*_I1v() - d1_V1*_I1v();
  56. grad(_I1v) = delta_V1*_E1v() - ptrh1*_I1v();
  57. }
  58. private:
  59. // transition rate from E -> I for the patch 1 of the vector population
  60. double delta_V1;
  61. // natural death rate of I of vector population for the patch 1
  62. double d1_V1;
  63. //coefficients for mortality rate
  64. double beta0;
  65. double beta1;
  66. double beta2;
  67. double ptrh1;
  68. Var _I1v;
  69. Ext _E1v;
  70. Ext _T1;
  71. Ext _Rh1;
  72. };
  73. } // namespace malariaspread
  74. DECLARE_DYNAMICS(malariaspread::I1v)