NEST  2.6.0,not_revisioned_source_dir@0
ac_generator.h
Go to the documentation of this file.
1 /*
2  * ac_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 #ifndef AC_GENERATOR_H
24 #define AC_GENERATOR_H
25 
26 // provides AC input current
27 
28 #include "nest.h"
29 #include "event.h"
30 #include "node.h"
31 #include "connection.h"
32 #include "stimulating_device.h"
33 
34 /* BeginDocumentation
35  Name: ac_generator - provides AC input current
36  Description:
37 
38  This device produce an ac-current which are sent by a current event.
39  The parameters are
40  amplitude double - Amplitude of sine current in pA
41  offset double - Constant amplitude offset in pA
42  phase double - Phase of sine current (0-360 deg)
43  frequency double - Frequency in Hz
44  4) The
45 
46  The currents are updated every time step by exact integration schemes from [1]
47 
48  References:
49  [1] S. Rotter and M. Diesmann, Exact digital simulation of time-
50  invariant linear systems with applications to neuronal modeling,
51  Biol. Cybern. 81, 381-402 (1999)
52 
53  Sends: CurrentEvent
54 
55  Author: Johan Hake, Spring 2003
56 
57  SeeAlso: Device, StimulatingDevice, dc_generator
58 */
59 
60 namespace nest{
61 
62  class Network;
63 
64  class ac_generator: public Node
65  {
66 
67  public:
68 
69  ac_generator();
70  ac_generator(const ac_generator&);
71 
72  bool has_proxies() const {return false;}
73 
75 
76  void get_status(DictionaryDatum &) const;
77  void set_status(const DictionaryDatum &) ;
78 
79  private:
80  void init_state_(const Node&);
81  void init_buffers_();
82  void calibrate();
83 
84  void update(Time const &, const long_t, const long_t);
85 
86 
87  // ------------------------------------------------------------
88 
89  struct Parameters_ {
94 
95  Parameters_();
96 
97  void get(DictionaryDatum&) const;
98  void set(const DictionaryDatum&);
99  };
100 
101  // ------------------------------------------------------------
102 
103  struct State_ {
106 
107  State_();
108 
109  void get(DictionaryDatum&) const;
110  };
111 
112  // ------------------------------------------------------------
113 
114  struct Variables_ {
117 
118  // The exact integration matrix
123  };
124 
125  // ------------------------------------------------------------
126 
131  };
132 
133  inline
135  {
136  device_.enforce_single_syn_type(syn_id);
137 
138  CurrentEvent e;
139  e.set_sender(*this);
140 
141  return target.handles_test_event(e, receptor_type);
142  }
143 
144  inline
146  {
147  P_.get(d);
148  S_.get(d);
149  device_.get_status(d);
150  }
151 
152  inline
154  {
155  Parameters_ ptmp = P_; // temporary copy in case of errors
156  ptmp.set(d); // throws if BadProperty
157 
158  // State_ is read-only
159 
160  // We now know that ptmp is consistent. We do not write it back
161  // to P_ before we are also sure that the properties to be set
162  // in the parent class are internally consistent.
163  device_.set_status(d);
164 
165  // if we get here, temporaries contain consistent set of properties
166  P_ = ptmp;
167  }
168 
169 }
170 #endif //AC_GENERATOR_H
StimulatingDevice< CurrentEvent > device_
Definition: ac_generator.h:127
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: ac_generator.cpp:101
const Name receptor_type("receptor_type")
Connection parameters.
Definition: nest_names.h:240
double_t amp_
Amplitude of sine-current.
Definition: ac_generator.h:90
double_t freq_
Standard frequency in Hz.
Definition: ac_generator.h:92
Definition: lockptrdatum.h:40
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
void set(const DictionaryDatum &)
Set values from dicitonary.
Definition: ac_generator.cpp:69
Declarations for base class Node.
double_t A_10_
Definition: ac_generator.h:121
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
ac_generator()
Definition: ac_generator.cpp:82
Definition: ac_generator.h:103
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: ac_generator.h:72
double_t phi_deg_
Phase of sine current (0-360 deg)
Definition: ac_generator.h:93
double_t A_11_
Definition: ac_generator.h:122
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
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: ac_generator.cpp:55
double_t y_1_
Definition: ac_generator.h:105
void calibrate()
Re-calculate dependent parameters of the node.
Definition: ac_generator.cpp:114
double_t offset_
Offset of sine-current.
Definition: ac_generator.h:91
double_t A_01_
Definition: ac_generator.h:120
State_()
Sets default parameter values.
Definition: ac_generator.cpp:45
port send_test_event(Node &, rport, synindex, bool)
Send an event to the receiving_node passed as an argument.
Definition: ac_generator.h:134
double_t A_00_
Definition: ac_generator.h:119
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: ac_generator.cpp:109
Definition: nest_time.h:130
State_ S_
Definition: ac_generator.h:129
const Name target("target")
Connection parameters.
Definition: nest_names.h:282
Parameters_ P_
Definition: ac_generator.h:128
void get(DictionaryDatum &) const
Store current values in dictionary.
Definition: ac_generator.cpp:63
Definition: ac_generator.h:89
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
Definition: ac_generator.h:114
double_t y_0_
Definition: ac_generator.h:104
void set_status(const DictionaryDatum &)
Definition: ac_generator.h:153
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.
double_t omega_
Angelfrequency i rad/s.
Definition: ac_generator.h:115
void get_status(DictionaryDatum &) const
Definition: ac_generator.h:145
Definition: ac_generator.h:64
Base class for all NEST network objects.
Definition: node.h:96
double_t phi_rad_
Phase of sine current (0-2Pi rad)
Definition: ac_generator.h:116
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
const double e
Definition: numerics.cpp:62
Variables_ V_
Definition: ac_generator.h:130
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: ac_generator.cpp:136
Parameters_()
Sets default parameter values.
Definition: ac_generator.cpp:38