NEST  2.6.0,not_revisioned_source_dir@0
dc_generator.h
Go to the documentation of this file.
1 /*
2  * dc_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: dc_generator - provides DC input current
26 
27 Description: The DC-Generator provides a constant DC Input
28 to the connected node. The unit of the current is pA.
29 
30 Parameters:
31  The following parameters can be set in the status dictionary:
32  amplitude double - Amplitude of current in pA
33 
34 Examples: The dc current can be altered in the following way:
35  /dc_generator Create /dc_gen Set % Creates a dc_generator, which is a node
36  dc_gen GetStatus info % View properties (amplitude is 0)
37  dc_gen << /amplitude 1500. >> SetStatus
38  dc_gen GetStatus info % amplitude is now 1500.0
39 
40 Note: The dc_generator is rather inefficient, since it needs to
41  send the same current information on each time step. If you
42  only need a constant bias current into a neuron, you should
43  set it directly in the neuron, e.g., dc_generator.
44 
45 Sends: CurrentEvent
46 
47 Author: docu by Sirko Straube
48 
49 SeeAlso: Device, StimulatingDevice
50 
51 */
52 
53 #ifndef DC_GENERATOR_H
54 #define DC_GENERATOR_H
55 
56 #include <vector>
57 #include "nest.h"
58 #include "event.h"
59 #include "node.h"
60 #include "ring_buffer.h"
61 #include "connection.h"
62 #include "stimulating_device.h"
63 
64 namespace nest
65 {
71  class dc_generator : public Node
72  {
73 
74  public:
75 
76  dc_generator();
77  dc_generator(const dc_generator&);
78 
79  bool has_proxies() const {return false;}
80 
82 
83  void get_status(DictionaryDatum &) const;
84  void set_status(const DictionaryDatum &);
85 
86  private:
87 
88  void init_state_(const Node&);
89  void init_buffers_();
90  void calibrate();
91 
92  void update(Time const &, const long_t, const long_t);
93 
94  // ------------------------------------------------------------
95 
99  struct Parameters_ {
101 
102  Parameters_();
103 
104  void get(DictionaryDatum&) const;
105  void set(const DictionaryDatum&);
106  };
107 
108  // ------------------------------------------------------------
109 
112  };
113 
114  inline
116  {
117  device_.enforce_single_syn_type(syn_id);
118 
119  CurrentEvent e;
120  e.set_sender(*this);
121 
122  return target.handles_test_event(e, receptor_type);
123  }
124 
125  inline
127  {
128  P_.get(d);
129  device_.get_status(d);
130  }
131 
132  inline
134  {
135  Parameters_ ptmp = P_; // temporary copy in case of errors
136  ptmp.set(d); // throws if BadProperty
137 
138  // We now know that ptmp is consistent. We do not write it back
139  // to P_ before we are also sure that the properties to be set
140  // in the parent class are internally consistent.
141  device_.set_status(d);
142 
143  // if we get here, temporaries contain consistent set of properties
144  P_ = ptmp;
145  }
146 
147 
148 } // namespace
149 
150 #endif /* #ifndef DC_GENERATOR_H */
151 
Parameters_ P_
Definition: dc_generator.h:111
void calibrate()
Re-calculate dependent parameters of the node.
Definition: dc_generator.cpp:88
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
Definition: lockptrdatum.h:40
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: dc_generator.h:79
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
Declarations for base class Node.
Base class for common properties of Stimulating Devices.
Definition: stimulating_device.h:117
void set_sender(Node &)
Change pointer to sending Node.
Definition: event.h:714
DC current generator.
Definition: dc_generator.h:71
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: dc_generator.cpp:83
void set_status(const DictionaryDatum &)
Definition: dc_generator.h:133
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
Store independent parameters of the model.
Definition: dc_generator.h:99
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: dc_generator.cpp:44
double_t amp_
stimulation amplitude, in pA
Definition: dc_generator.h:100
Definition: nest_time.h:130
Parameters_()
Sets default parameter values.
Definition: dc_generator.cpp:35
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: dc_generator.cpp:98
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: dc_generator.cpp:76
long_t port
Connection port number to distinguis outgoing connections.
Definition: nest.h:155
double double_t
Double precision floating point numbers.
Definition: nest.h:93
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
void get_status(DictionaryDatum &) const
Definition: dc_generator.h:126
unsigned char synindex
Unsigned char type for enumerations of synapse types.
Definition: nest.h:115
Default types used by the NEST kernel.
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: dc_generator.h:115
Base class for all NEST network objects.
Definition: node.h:96
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: dc_generator.cpp:49
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
dc_generator()
Definition: dc_generator.cpp:59
StimulatingDevice< CurrentEvent > device_
Definition: dc_generator.h:110