NEST  2.6.0,not_revisioned_source_dir@0
iaf_psc_exp_multisynapse.h
Go to the documentation of this file.
1 /*
2  * iaf_psc_exp_multisynapse.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef IAF_PSC_EXP_MULTISYNAPSE_H
24 #define IAF_PSC_EXP_MULTISYNAPSE_H
25 
26 #include "nest.h"
27 #include "event.h"
28 #include "archiving_node.h"
29 #include "ring_buffer.h"
30 #include "connection.h"
31 #include "universal_data_logger.h"
32 #include "recordables_map.h"
33 
34 namespace nest
35 {
36  class Network;
37 
38  /* BeginDocumentation
39  Name: iaf_psc_exp_multisynapse - Leaky integrate-and-fire neuron model with multiple ports.
40 
41  Description:
42 
43  iaf_psc_exp_multisynapse is a direct extension of iaf_psc_exp.
44  On the postsynapic side, there can be arbitrarily many synaptic
45  time constants (iaf_psc_exp has exactly two: tau_syn_ex and tau_syn_in).
46 
47  This can be reached by specifying separate receptor ports, each for
48  a different time constant. The port number has to match the respective
49  "receptor_type" in the connectors.
50 
51  Sends: SpikeEvent
52 
53  Receives: SpikeEvent, CurrentEvent, DataLoggingRequest
54 
55  Author: Plesser, adapted from iaf_psc_alpha_multisynapse
56  SeeAlso: iaf_psc_alpha, iaf_psc_delta, iaf_psc_exp, iaf_cond_exp, iaf_psc_alpha_multisynapse
57  */
59  {
60 
61  public:
62 
65 
70  using Node::handle;
72 
74 
75  void handle(SpikeEvent &);
76  void handle(CurrentEvent &);
77  void handle(DataLoggingRequest &);
78 
82 
83  void get_status(DictionaryDatum &) const;
84  void set_status(const DictionaryDatum &);
85 
86  private:
87 
88  void init_state_(const Node& proto);
89  void init_buffers_();
90  void calibrate();
91 
92  void update(Time const&, const long_t, const long_t);
93 
94  // The next two classes need to be friends to access the State_ class/member
96  friend class UniversalDataLogger<iaf_psc_exp_multisynapse>;
97 
98  // ----------------------------------------------------------------
99 
103  struct Parameters_ {
104 
107 
110 
113 
116 
119 
122 
126 
128  std::vector<double_t> tau_syn_;
129 
130  // type is long because other types are not put through in GetStatus
131  std::vector<long> receptor_types_;
133 
134  // boolean flag which indicates whether the neuron has connections
136 
137  Parameters_();
138 
139  void get(DictionaryDatum&) const;
140 
144  double set(const DictionaryDatum&);
145  }; // Parameters_
146 
147  // ----------------------------------------------------------------
148 
152  struct State_ {
153  double_t i_0_; // synaptic dc input current, variable 0
154  std::vector<double_t> i_syn_;
155  double_t V_m_; // membrane potential, variable 2
157 
158  int_t r_ref_; // absolute refractory counter (no membrane potential propagation)
159 
160  State_();
161 
162  void get(DictionaryDatum&, const Parameters_&) const;
163 
169  void set(const DictionaryDatum&, const Parameters_&, const double);
170  }; // State_
171 
172  // ----------------------------------------------------------------
173 
177  struct Buffers_ {
180 
182  std::vector<RingBuffer> spikes_;
184 
187  };
188 
189  // ----------------------------------------------------------------
190 
194  struct Variables_ {
200  // double_t PSCInitialValue_;
201 
202  // time evolution operator
203  std::vector<double_t> P11_syn_;
204  std::vector<double_t> P21_syn_;
207 
209 
210  unsigned int receptor_types_size_;
211 
212  }; // Variables
213 
214  // Access functions for UniversalDataLogger -------------------------------
215 
217  double_t get_V_m_() const { return S_.V_m_ + P_.U0_; }
218 
234  };
235 
236 inline
238 {
239  SpikeEvent e;
240  e.set_sender(*this);
241 
242  return target.handles_test_event(e, receptor_type);
243 }
244 
245 inline
247 {
248  if (receptor_type != 0)
249  throw UnknownReceptorType(receptor_type, get_name());
250  return 0;
251 }
252 
253 inline
255 {
256  if (receptor_type != 0)
257  throw UnknownReceptorType(receptor_type, get_name());
258  return B_.logger_.connect_logging_device(dlr, recordablesMap_);
259 }
260 
261 inline
263 {
264  P_.get(d);
265  S_.get(d, P_);
267 
268  (*d)[names::recordables] = recordablesMap_.get_list();
269 }
270 
271 inline
273 {
274  Parameters_ ptmp = P_; // temporary copy in case of errors
275  const double delta_EL = ptmp.set(d); // throws if BadProperty
276  State_ stmp = S_; // temporary copy in case of errors
277  stmp.set(d, ptmp, delta_EL); // throws if BadProperty
278 
279  // We now know that (ptmp, stmp) are consistent. We do not
280  // write them back to (P_, S_) before we are also sure that
281  // the properties to be set in the parent class are internally
282  // consistent.
284 
285  // if we get here, temporaries contain consistent set of properties
286  P_ = ptmp;
287  S_ = stmp;
288 }
289 
290 } // namespace
291 
292 #endif /* #ifndef IAF_PSC_EXP_MULTISYNAPSE_H */
void calibrate()
Re-calculate dependent parameters of the node.
Definition: iaf_psc_exp_multisynapse.cpp:214
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
static RecordablesMap< iaf_psc_exp_multisynapse > recordablesMap_
Mapping of recordables names to access functions.
Definition: iaf_psc_exp_multisynapse.h:233
int int_t
Integer number with at least 16 bit.
Definition: nest.h:95
Definition of Archiving_Node which is capable of recording and managing a spike history.
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Buffers_(iaf_psc_exp_multisynapse &)
Definition: iaf_psc_exp_multisynapse.cpp:166
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
std::vector< long > receptor_types_
Definition: iaf_psc_exp_multisynapse.h:131
std::vector< double_t > tau_syn_
Time constants of synaptic currents in ms.
Definition: iaf_psc_exp_multisynapse.h:128
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
bool has_connections_
Definition: iaf_psc_exp_multisynapse.h:135
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: iaf_psc_exp_multisynapse.cpp:204
std::vector< double_t > P11_syn_
Amplitude of the synaptic current.
Definition: iaf_psc_exp_multisynapse.h:203
iaf_psc_exp_multisynapse()
Definition: iaf_psc_exp_multisynapse.cpp:178
void set(const DictionaryDatum &, const Parameters_ &, const double)
Set values from dictionary.
Definition: iaf_psc_exp_multisynapse.cpp:158
void handle(SpikeEvent &)
Handle incoming spike events.
Definition: iaf_psc_exp_multisynapse.cpp:307
double_t t_ref_
Refractory period in ms.
Definition: iaf_psc_exp_multisynapse.h:112
void get_status(DictionaryDatum &) const
Definition: iaf_psc_exp_multisynapse.h:262
Event for electrical currents.
Definition: event.h:420
long_t rport
Connection port number to distinguish incoming connections, also called receiver port.
Definition: nest.h:147
Buffers of the model.
Definition: iaf_psc_exp_multisynapse.h:177
std::vector< double_t > i_syn_
Definition: iaf_psc_exp_multisynapse.h:154
std::vector< RingBuffer > spikes_
buffers and sums up incoming spikes/currents
Definition: iaf_psc_exp_multisynapse.h:182
double_t V_reset_
Reset value of the membrane potential.
Definition: iaf_psc_exp_multisynapse.h:121
Parameters_ P_
Definition: iaf_psc_exp_multisynapse.h:226
int_t RefractoryCounts_
Definition: iaf_psc_exp_multisynapse.h:208
double set(const DictionaryDatum &)
Set values from dictionary.
Definition: iaf_psc_exp_multisynapse.cpp:99
Map names of recordables to data access functions.
Definition: recordables_map.h:58
int_t r_ref_
This is the current in a time step. This is only here to allow logging.
Definition: iaf_psc_exp_multisynapse.h:158
State variables of the model.
Definition: iaf_psc_exp_multisynapse.h:152
Definition: nest_time.h:130
friend class UniversalDataLogger< iaf_psc_exp_multisynapse >
Definition: iaf_psc_exp_multisynapse.h:96
UniversalDataLogger< iaf_psc_exp_multisynapse > logger_
Logger for all analog data.
Definition: iaf_psc_exp_multisynapse.h:186
double_t C_
Membrane capacitance in pF.
Definition: iaf_psc_exp_multisynapse.h:109
std::string get_name() const
Return class name.
Definition: node.cpp:83
port handles_test_event(SpikeEvent &, rport)
Check if the node can handle a particular event and receptor type.
Definition: iaf_psc_exp_multisynapse.cpp:298
void set_status(const DictionaryDatum &)
Definition: iaf_psc_exp_multisynapse.h:272
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: iaf_psc_exp_multisynapse.h:237
void set_status(const DictionaryDatum &d)
Definition: archiving_node.cpp:185
Exception to be thrown if the specified receptor type does not exist in the node. ...
Definition: exceptions.h:254
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
double_t get_V_m_() const
Read out the real membrane potential.
Definition: iaf_psc_exp_multisynapse.h:217
Buffers_ B_
Definition: iaf_psc_exp_multisynapse.h:229
size_t num_of_receptors_
Definition: iaf_psc_exp_multisynapse.h:132
void init_state_(const Node &proto)
Private function to initialize the state of a node to model defaults.
Definition: iaf_psc_exp_multisynapse.cpp:198
Independent parameters of the model.
Definition: iaf_psc_exp_multisynapse.h:103
double_t P22_
Definition: iaf_psc_exp_multisynapse.h:206
double_t Tau_
Membrane time constant in ms.
Definition: iaf_psc_exp_multisynapse.h:106
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: iaf_psc_exp_multisynapse.cpp:250
std::vector< double_t > P21_syn_
Definition: iaf_psc_exp_multisynapse.h:204
a node which archives spike history for the purposes of timing dependent plasticity ...
Definition: archiving_node.h:50
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
double_t I_e_
External current in pA.
Definition: iaf_psc_exp_multisynapse.h:118
virtual void handle(SpikeEvent &e)
Handle incoming spike events.
Definition: node.cpp:198
double_t Theta_
Threshold, RELATIVE TO RESTING POTENTIAL(!).
Definition: iaf_psc_exp_multisynapse.h:125
double double_t
Double precision floating point numbers.
Definition: nest.h:93
unsigned int receptor_types_size_
Definition: iaf_psc_exp_multisynapse.h:210
Parameters_()
Sets default parameter values.
Definition: iaf_psc_exp_multisynapse.cpp:57
virtual port handles_test_event(SpikeEvent &, rport receptor_type)
Check if the node can handle a particular event and receptor type.
Definition: node.cpp:203
Definition: iaf_psc_exp_multisynapse.h:58
Request data to be logged/logged data to be sent.
Definition: event.h:486
double_t P20_
Definition: iaf_psc_exp_multisynapse.h:205
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
double_t U0_
Resting potential in mV.
Definition: iaf_psc_exp_multisynapse.h:115
RingBuffer currents_
Definition: iaf_psc_exp_multisynapse.h:183
double_t V_m_
Definition: iaf_psc_exp_multisynapse.h:155
Default types used by the NEST kernel.
void get_status(DictionaryDatum &d) const
Definition: archiving_node.cpp:175
Event for spike information.
Definition: event.h:320
Base class for all NEST network objects.
Definition: node.h:96
State_()
Default initialization.
Definition: iaf_psc_exp_multisynapse.cpp:70
State_ S_
Definition: iaf_psc_exp_multisynapse.h:227
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: iaf_psc_exp_multisynapse.cpp:82
Internal variables of the model.
Definition: iaf_psc_exp_multisynapse.h:194
double_t current_
Definition: iaf_psc_exp_multisynapse.h:156
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
Variables_ V_
Definition: iaf_psc_exp_multisynapse.h:228
void get(DictionaryDatum &, const Parameters_ &) const
Definition: iaf_psc_exp_multisynapse.cpp:153
double_t i_0_
Definition: iaf_psc_exp_multisynapse.h:153
Buffer Layout.
Definition: ring_buffer.h:77