Modigliani  2.0
A stochastic simulator for axons, neurons, and networks
membrane_current.h
1 
23 #ifndef MODIGLIANI_MODIGLIANI_CORE_MEMBRANE_CURRENT_H_
24 #define MODIGLIANI_MODIGLIANI_CORE_MEMBRANE_CURRENT_H_
25 
26 #include <assert.h>
27 
28 #include "modigliani_base/types.h"
29 #include "modigliani_core/object.h"
30 
31 namespace modigliani_core {
32 
43 class Membrane_current : public Object {
44  public:
49  explicit Membrane_current(modigliani_base::Real reversalPotential);
50  Membrane_current(const Membrane_current & original) = delete;
51  Membrane_current & operator=(const Membrane_current & right) = delete;
52  virtual ~Membrane_current();
53 
59  virtual modigliani_base::Real MaxConductivity() const = 0;
60 
65  modigliani_base::Real conductance() const {
66  return (conductance_);
67  }
68 
73  void set_reversal_potential(modigliani_base::Real eRev /* mV */) {
74  reversal_potential_ = eRev;
75  }
76 
81  modigliani_base::Real reversal_potential() const {
82  return (reversal_potential_);
83  }
84 
89  modigliani_base::Real temperature() const {
90  return (temperature_);
91  }
92 
97  modigliani_base::ReturnEnum set_temperature(modigliani_base::Real newTemp) {
98  assert(newTemp > modigliani_base::ZERO_KELVIN);
99  temperature_ = newTemp;
100  return (modigliani_base::ReturnEnum::SUCCESS);
101  }
102 
107  modigliani_base::Real q10() const {
108  return (q10_);
109  }
110 
115  virtual modigliani_base::ReturnEnum set_q10(modigliani_base::Real newQ10) {
116  q10_ = newQ10;
117  return (modigliani_base::ReturnEnum::SUCCESS);
118  }
119 
125  return (simulation_mode_);
126  }
127 
132  virtual void set_simulation_mode(enum StochasticType newMode) {
133  simulation_mode_ = newMode;
134  }
135 
140  void set_voltage(modigliani_base::Real newVoltage) {
141  voltage_ = newVoltage;
142  }
143 
150  modigliani_base::ReturnEnum Step(modigliani_base::Real newVm) {
151  // ComputeRateConstants(newVm); /* UpdateRateConstantsAND*/
152  voltage_ = newVm;
153  modigliani_base::ReturnEnum result = StepCurrent();
154  if (result != modigliani_base::ReturnEnum::SUCCESS) {
155  std::cerr << "membrane_current::Step - ERROR : Current step failed at "
156  << newVm << "mV. " << std::endl;
157  return (modigliani_base::ReturnEnum::FAIL);
158  }
160  ComputeCurrent(newVm);
161  return (modigliani_base::ReturnEnum::SUCCESS);
162  }
163 
168  modigliani_base::Real ComputeCurrent(
169  modigliani_base::Real vM) {
170  return (set_current(conductance()* 1000.0 /* mA/nA */
171  * (vM - reversal_potential())));
172  }
173 
178  virtual modigliani_base::ReturnEnum StepCurrent() = 0;
179 
184  virtual modigliani_base::Real ComputeConductance() = 0;
185 
192  virtual modigliani_base::Real ComputeTimeConstant() {
193  return (0.0);
194  }
195 
200  modigliani_base::Real current() const {
201  return (current_);
202  }
203 
204  protected:
209  modigliani_base::Real set_current(
210  modigliani_base::Real newVal) {
211  return (current_ = newVal);
212  }
213 
218  modigliani_base::Real set_conductance(
219  modigliani_base::Real newVal) {
220  return (conductance_ = newVal);
221  }
222 
226  modigliani_base::Real voltage_;
227 
231  modigliani_base::Real temperature_;
232 
233  private:
234  void _init(modigliani_base::Real newReversalPotential);
235  modigliani_base::Real current_; // in nanoAmpere
236  modigliani_base::Real conductance_; // in mSiemens
237  modigliani_base::Real reversal_potential_; // in mV
238  // the Q_10 value for temperature dependent reaction kinetics
239  modigliani_base::Real q10_;
240  enum StochasticType simulation_mode_;
241 };
242 } // namespace modigliani_core
243 #endif // MODIGLIANI_MODIGLIANI_CORE_MEMBRANE_CURRENT_H_
enum StochasticType simulation_mode() const
Returns the simulation mode.
Definition: membrane_current.h:124
modigliani_base::Real current() const
Returns the current.
Definition: membrane_current.h:200
Membrane_current class.
Definition: membrane_current.h:43
modigliani_base::Real reversal_potential() const
Returns the reversal potential.
Definition: membrane_current.h:81
void set_voltage(modigliani_base::Real newVoltage)
Sets the membrane potential.
Definition: membrane_current.h:140
void set_reversal_potential(modigliani_base::Real eRev)
Sets the reversal potential.
Definition: membrane_current.h:73
modigliani_base::ReturnEnum Step(modigliani_base::Real newVm)
Runs one step of the simulation, updates the conductance and the current flowing through.
Definition: membrane_current.h:150
virtual modigliani_base::ReturnEnum StepCurrent()=0
Runs one step of the simulation.
modigliani_base::Real q10() const
Returns the Q10 factor.
Definition: membrane_current.h:107
modigliani_base::Real set_conductance(modigliani_base::Real newVal)
Sets the conductance.
Definition: membrane_current.h:218
modigliani_base::ReturnEnum set_temperature(modigliani_base::Real newTemp)
Sets the temperature.
Definition: membrane_current.h:97
StochasticType
Stochastic simulation algortihms.
Definition: object.h:70
virtual modigliani_base::Real MaxConductivity() const =0
Returns maximum conductivity.
modigliani_base::Real temperature_
Temperature in [ ].
Definition: membrane_current.h:231
modigliani_base::Real set_current(modigliani_base::Real newVal)
Sets the current.
Definition: membrane_current.h:209
Base class for all objects in modigliani_core.
Definition: object.h:113
Membrane_current(modigliani_base::Real reversalPotential)
Constructs a current.
Definition: membrane_current.cc:28
modigliani_base::Real conductance() const
Returns momentary conductance.
Definition: membrane_current.h:65
virtual modigliani_base::Real ComputeConductance()=0
Computes and returns conductance.
modigliani_base::Real temperature() const
Returns the temperature.
Definition: membrane_current.h:89
modigliani_base::Real ComputeCurrent(modigliani_base::Real vM)
Computes, sets and returns the current going through.
Definition: membrane_current.h:168
modigliani_base::Real voltage_
Membrane potential in [ ].
Definition: membrane_current.h:226
virtual modigliani_base::Real ComputeTimeConstant()
Computes and returns the rate constants.
Definition: membrane_current.h:192
virtual modigliani_base::ReturnEnum set_q10(modigliani_base::Real newQ10)
Sets the Q10 factor.
Definition: membrane_current.h:115
virtual void set_simulation_mode(enum StochasticType newMode)
Sets simulation mode.
Definition: membrane_current.h:132