E12h.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 E12h :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. E12h(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. k_2 = events.getDouble("k_2"); // = ???
  41. beta_2 = events.getDouble("beta_2"); // = ???
  42. delta_H2 = events.getDouble("delta_H2"); // = ???
  43. d2_H2 = events.getDouble("d2_H2"); // = ???
  44. H_2 = events.getDouble("H_2"); // = ???
  45. phi_e1 = events.getDouble("phi_e1"); // = ???
  46. _E12h = createVar("E12h");
  47. _S12h = createExt("S12h");
  48. _I2v = createExt("I2v");
  49. //_Pth2 = createExt("Pth2");
  50. _E1h= createExt("E1h");
  51. /*_S1v= createExt("S1v");
  52. _E1v= createExt("E1v"); */
  53. }
  54. virtual ~E12h()
  55. { }
  56. void compute(const vle::devs::Time& /* time */)
  57. {
  58. // V_2 = grad(_S2v) + grad(_E2v) + grad(_I2v); //current size of all compartments at time t
  59. grad(_E12h) = phi_e1*_E1h() + k_2*beta_2*_S12h()*_I2v()/H_2 - delta_H2*_E12h() - d2_H2*_E12h();
  60. }
  61. private:
  62. //contact proportion between a human belonging to the patch 2 and a mosquitoe belonging to the patch 2
  63. double beta_2;
  64. //average number of that contact per unit time for that patch 2
  65. double k_2;
  66. // transition rate from E -> I for the patch 1 of the host population
  67. double delta_H2;
  68. // natural death rate of E of host population for the patch 2
  69. double d2_H2;
  70. // size of host population for the patch 2
  71. double H_2;
  72. // migration rate of Infected (E) host population of the patch 1 that left to patch 2 (Go)
  73. double phi_e1;
  74. Var _E12h;
  75. Ext _S12h;
  76. Ext _I2v;
  77. //Ext _Pth2;
  78. Ext _E1h;
  79. /* Ext _S1v;
  80. Ext _E1v; */
  81. };
  82. } // namespace malariaspread
  83. DECLARE_DYNAMICS(malariaspread::E12h)