NEST  2.6.0,not_revisioned_source_dir@0
step_current_generator.h
Go to the documentation of this file.
1 /*
2  * step_current_generator.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 
24 /*BeginDocumentation
25  Name: step_current_generator - provides a piecewise constant DC input current
26 
27  Description:
28  The dc_generator provides a piecewise constant DC input to the
29  connected node(s). The amplitude of the current is changed at the
30  specified times. The unit of the current is pA.
31 
32  Parameters:
33  The following parameters can be set in the status dictionary:
34  amplitude_times list of doubles - Times at which current changes in ms
35  amplitude_values list of doubles - Amplitudes of step current current in pA
36 
37  Examples:
38  The current can be altered in the following way:
39  /step_current_generator Create /sc Set
40  sc << /amplitude_times [0.2 0.5] /amplitude_values [2.0 4.0] >> SetStatus
41 
42  The amplitude of the DC will be 0.0 pA in the time interval [0, 0.2),
43  2.0 pA in the interval [0.2, 0.5) and 4.0 from then on.
44 
45  Sends: CurrentEvent
46 
47  Author: Jochen Martin Eppler, Jens Kremkow
48 
49  SeeAlso: ac_generator, dc_generator, step_current_generator, Device, StimulatingDevice
50 */
51 
52 #ifndef STEP_CURRENT_GENERATOR_H
53 #define STEP_CURRENT_GENERATOR_H
54 
55 #include <vector>
56 #include "nest.h"
57 #include "event.h"
58 #include "node.h"
59 #include "ring_buffer.h"
60 #include "connection.h"
61 #include "stimulating_device.h"
62 
63 namespace nest
64 {
66  {
67 
68  public:
69 
72 
73  bool has_proxies() const {return false;}
74 
76 
77  void get_status(DictionaryDatum &) const;
78  void set_status(const DictionaryDatum &);
79 
80  private:
81 
82  void init_state_(const Node&);
83  void init_buffers_();
84  void calibrate();
85 
86  void update(Time const &, const long_t, const long_t);
87 
88  struct Buffers_;
89 
93  struct Parameters_ {
94  std::vector<double_t> amp_times_;
95  std::vector<double_t> amp_values_;
96 
97  Parameters_();
99 
100  void get(DictionaryDatum&) const;
101  void set(const DictionaryDatum&, Buffers_&);
102  };
103 
104  // ------------------------------------------------------------
105 
106  struct Buffers_ {
107  size_t idx_;
109  };
110 
111  // ------------------------------------------------------------
112 
116  };
117 
118  inline
120  {
121  device_.enforce_single_syn_type(syn_id);
122 
123  CurrentEvent e;
124  e.set_sender(*this);
125 
126  return target.handles_test_event(e, receptor_type);
127  }
128 
129  inline
131  {
132  P_.get(d);
133  device_.get_status(d);
134  }
135 
136  inline
138  {
139  Parameters_ ptmp = P_; // temporary copy in case of errors
140  ptmp.set(d, B_); // throws if BadProperty
141 
142  // We now know that ptmp is consistent. We do not write it back
143  // to P_ before we are also sure that the properties to be set
144  // in the parent class are internally consistent.
145  device_.set_status(d);
146 
147  // if we get here, temporaries contain consistent set of properties
148  P_ = ptmp;
149  }
150 
151 
152 } // namespace
153 
154 #endif /* #ifndef STEP_CURRENT_GENERATOR_H */
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
std::vector< double_t > amp_times_
Definition: step_current_generator.h:94
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: step_current_generator.cpp:122
Base class for common properties of Stimulating Devices.
Definition: stimulating_device.h:117
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: step_current_generator.h:73
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
step_current_generator()
Definition: step_current_generator.cpp:80
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
Parameters_ P_
Definition: step_current_generator.h:114
void set(const DictionaryDatum &, Buffers_ &)
Set values from dicitonary.
Definition: step_current_generator.cpp:49
void set_status(const DictionaryDatum &)
Definition: step_current_generator.h:137
Definition: step_current_generator.h:106
Definition: step_current_generator.h:65
Store independent parameters of the model.
Definition: step_current_generator.h:93
Definition: nest_time.h:130
Parameters_()
Sets default parameter values.
Definition: step_current_generator.cpp:34
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: step_current_generator.h:119
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: step_current_generator.cpp:97
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Buffers_ B_
Definition: step_current_generator.h:115
std::vector< double_t > amp_values_
Definition: step_current_generator.h:95
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
void calibrate()
Re-calculate dependent parameters of the node.
Definition: step_current_generator.cpp:112
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: step_current_generator.cpp:104
double double_t
Double precision floating point numbers.
Definition: nest.h:93
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: step_current_generator.cpp:43
void get_status(DictionaryDatum &) const
Definition: step_current_generator.h:130
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
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Default types used by the NEST kernel.
size_t idx_
index of current amplitude
Definition: step_current_generator.h:107
StimulatingDevice< CurrentEvent > device_
Definition: step_current_generator.h:113
Base class for all NEST network objects.
Definition: node.h:96
double_t amp_
current amplitude
Definition: step_current_generator.h:108
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62