NEST main@caf0ae8
 
Loading...
Searching...
No Matches
iaf_cond_alpha.h
Go to the documentation of this file.
1/*
2 * iaf_cond_alpha.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_COND_ALPHA_H
24#define IAF_COND_ALPHA_H
25
26// Generated includes:
27#include "config.h"
28
29#ifdef HAVE_GSL
30
31// C includes:
32#include <gsl/gsl_errno.h>
33#include <gsl/gsl_matrix.h>
34#include <gsl/gsl_odeiv.h>
35
36// Includes from nestkernel:
37#include "archiving_node.h"
38#include "connection.h"
39#include "event.h"
40#include "nest_types.h"
41#include "recordables_map.h"
42#include "ring_buffer.h"
44
45namespace nest
46{
57extern "C" int iaf_cond_alpha_dynamics( double, const double*, double*, void* );
58
59/* BeginUserDocs: neuron, integrate-and-fire, conductance-based, hard threshold
60
61Short description
62+++++++++++++++++
63
64Simple conductance based leaky integrate-and-fire neuron model
65
66Description
67+++++++++++
68
69``iaf_cond_alpha`` is an implementation of a spiking neuron using IAF dynamics with
70conductance-based synapses. Incoming spike events induce a postsynaptic change
71of conductance modelled by an alpha function. The alpha function
72is normalized such that an event of weight 1.0 results in a peak conductance of 1 nS
73at :math:`t = \tau_{syn}`.
74
75See also :footcite:p:`Meffin2004`, :footcite:p:`Bernander1991`, :footcite:p:`Kuhn2004`.
76
77Parameters
78++++++++++
79
80The following parameters can be set in the status Dictionary.
81
82=========== ======= ===========================================================
83 V_m mV Membrane potential
84 E_L mV Leak reversal potential
85 C_m pF Capacity of the membrane
86 t_ref ms Duration of refractory period
87 V_th mV Spike threshold
88 V_reset mV Reset potential of the membrane
89 E_ex mV Excitatory reversal potential
90 E_in mV Inhibitory reversal potential
91 g_L nS Leak conductance
92 tau_syn_ex ms Rise time of the excitatory synaptic alpha function
93 tau_syn_in ms Rise time of the inhibitory synaptic alpha function
94 I_e pA Constant input current
95=========== ======= ===========================================================
96
97Sends
98+++++
99
100SpikeEvent
101
102Receives
103++++++++
104
105SpikeEvent, CurrentEvent, DataLoggingRequest
106
107References
108++++++++++
109
110.. footbibliography::
111
112See also
113++++++++
114
115iaf_cond_exp, iaf_cond_alpha_mc
116
117Examples using this model
118+++++++++++++++++++++++++
119
120.. listexamples:: iaf_cond_alpha
121
122EndUserDocs */
123
124void register_iaf_cond_alpha( const std::string& name );
125
126class iaf_cond_alpha : public ArchivingNode
127{
128
129 // Boilerplate function declarations --------------------------------
130
131public:
132 iaf_cond_alpha();
133 iaf_cond_alpha( const iaf_cond_alpha& );
134 ~iaf_cond_alpha() override;
135
136 /*
137 * Import all overloaded virtual functions that we
138 * override in this class. For background information,
139 * see http://www.gotw.ca/gotw/005.htm.
140 */
141
142 using Node::handle;
143 using Node::handles_test_event;
144
145 size_t send_test_event( Node& tagret, size_t receptor_type, synindex, bool ) override;
146
147 size_t handles_test_event( SpikeEvent&, size_t ) override;
148 size_t handles_test_event( CurrentEvent&, size_t ) override;
149 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
150
151 void handle( SpikeEvent& ) override;
152 void handle( CurrentEvent& ) override;
153 void handle( DataLoggingRequest& ) override;
154
155 void get_status( Dictionary& ) const override;
156 void set_status( const Dictionary& ) override;
157
158private:
159 void init_buffers_() override;
160 void pre_run_hook() override;
161 void update( Time const&, const long, const long ) override;
162
163 // END Boilerplate function declarations ----------------------------
164
165 // Friends --------------------------------------------------------
166
167 // make dynamics function quasi-member
168 friend int iaf_cond_alpha_dynamics( double, const double*, double*, void* );
169
170 // The next two classes need to be friends to access the State_ class/member
171 friend class RecordablesMap< iaf_cond_alpha >;
172 friend class UniversalDataLogger< iaf_cond_alpha >;
173
174private:
175 // Parameters class -------------------------------------------------
176
178 struct Parameters_
179 {
180 double V_th;
181 double V_reset;
182 double t_ref;
183 double g_L;
184 double C_m;
185 double E_ex;
186 double E_in;
187 double E_L;
188 double tau_synE;
189 double tau_synI;
190 double I_e;
191
192 Parameters_();
193
194 void get( Dictionary& ) const;
195 void set( const Dictionary&, Node* node );
196 };
197
198 // State variables class --------------------------------------------
199
209public:
210 struct State_
211 {
213 enum StateVecElems
214 {
215 V_M = 0,
216 DG_EXC,
217 G_EXC,
218 DG_INH,
219 G_INH,
220 STATE_VEC_SIZE
221 };
222
224 double y[ STATE_VEC_SIZE ];
225
227 int r;
228
229 State_( const Parameters_& );
230 State_( const State_& );
231
232 State_& operator=( const State_& );
233
234 void get( Dictionary& ) const;
235
240 void set( const Dictionary&, const Parameters_&, Node* );
241 };
242
243private:
244 // Buffers class --------------------------------------------------------
245
252 struct Buffers_
253 {
254 Buffers_( iaf_cond_alpha& );
255 Buffers_( const Buffers_&, iaf_cond_alpha& );
256
258 UniversalDataLogger< iaf_cond_alpha > logger_;
259
261 RingBuffer spike_exc_;
262 RingBuffer spike_inh_;
263 RingBuffer currents_;
264
265 /* GSL ODE stuff */
266 gsl_odeiv_step* s_;
267 gsl_odeiv_control* c_;
268 gsl_odeiv_evolve* e_;
269 gsl_odeiv_system sys_;
270
271 // Since IntegrationStep_ is initialized with step_, and the resolution
272 // cannot change after nodes have been created, it is safe to place both
273 // here.
274 double step_;
275 double IntegrationStep_;
276
284 double I_stim_;
285 };
286
287 // Variables class -------------------------------------------------------
288
293 struct Variables_
294 {
299 double PSConInit_E;
300
305 double PSConInit_I;
306
308 int RefractoryCounts;
309 };
310
311 // Access functions for UniversalDataLogger -------------------------------
312
314 template < State_::StateVecElems elem >
315 double
316 get_y_elem_() const
317 {
318 return S_.y[ elem ];
319 }
320
322 double
323 get_r_() const
324 {
325 return Time::get_resolution().get_ms() * S_.r;
326 }
327
328 // Data members -----------------------------------------------------------
329
330 // keep the order of these lines, seems to give best performance
331 Parameters_ P_;
332 State_ S_;
333 Variables_ V_;
334 Buffers_ B_;
335
337 static RecordablesMap< iaf_cond_alpha > recordablesMap_;
338};
339
340
341// Boilerplate inline function definitions ----------------------------------
342
343inline size_t
344iaf_cond_alpha::send_test_event( Node& target, size_t receptor_type, synindex, bool )
345{
346 SpikeEvent e;
347 e.set_sender( *this );
348 return target.handles_test_event( e, receptor_type );
349}
350
351inline size_t
352iaf_cond_alpha::handles_test_event( SpikeEvent&, size_t receptor_type )
353{
354 if ( receptor_type != 0 )
355 {
356 throw UnknownReceptorType( receptor_type, get_name() );
357 }
358 return 0;
359}
360
361inline size_t
362iaf_cond_alpha::handles_test_event( CurrentEvent&, size_t receptor_type )
363{
364 if ( receptor_type != 0 )
365 {
366 throw UnknownReceptorType( receptor_type, get_name() );
367 }
368 return 0;
369}
370
371inline size_t
372iaf_cond_alpha::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
373{
374 if ( receptor_type != 0 )
375 {
376 throw UnknownReceptorType( receptor_type, get_name() );
377 }
378 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
379}
380
381inline void
382iaf_cond_alpha::get_status( Dictionary& d ) const
383{
384 P_.get( d );
385 S_.get( d );
387
388 d[ names::recordables ] = recordablesMap_.get_list();
389}
390
391inline void
392iaf_cond_alpha::set_status( const Dictionary& d )
393{
394 Parameters_ ptmp = P_; // temporary copy in case of errors
395 ptmp.set( d, this ); // throws if BadProperty
396 State_ stmp = S_; // temporary copy in case of errors
397 stmp.set( d, ptmp, this ); // throws if BadProperty
398
399 // We now know that (ptmp, stmp) are consistent. We do not
400 // write them back to (P_, S_) before we are also sure that
401 // the properties to be set in the parent class are internally
402 // consistent.
404
405 // if we get here, temporaries contain consistent set of properties
406 P_ = ptmp;
407 S_ = stmp;
408}
409
410} // namespace
411
412#endif // IAF_COND_ALPHA_H
413
414#endif // HAVE_GSL
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
void set_status(const Dictionary &d) override
Change properties of the node according to the entries in the dictionary.
Definition archiving_node.cpp:236
const std::string t_ref("t_ref")
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string V_reset("V_reset")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string V_th("V_th")
const std::string y("y")
const std::string E_in("E_in")
const std::string target("target")
const std::string E_ex("E_ex")
const std::string g_L("g_L")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
const double e
Definition numerics.cpp:32