27 #ifndef SPORE_TEST_CONNECTION 28 #define SPORE_TEST_CONNECTION 32 #include "connection.h" 33 #include "normal_randomdev.h" 34 #include "spikecounter.h" 36 #include "tracing_node.h" 37 #include "spore_names.h" 54 :
nest::CommonSynapseProperties(),
55 weight_update_time_(100.0),
78 void set_status(
const DictionaryDatum& d, nest::ConnectorModel& cm)
80 updateValue<double>(d, names::weight_update_time, weight_update_time_);
81 updateValue<long>(d, names::bap_trace_id, bap_trace_id_);
91 resolution_unit_ = nest::Time::get_resolution().get_ms();
114 return nest::CommonSynapseProperties::get_node();
117 double weight_update_time_;
118 TracingNode::trace_id bap_trace_id_;
119 double resolution_unit_;
128 template<
typename target
identifierT>
143 void check_connection(nest::Node& s, nest::Node& t,
144 nest::rport receptor_type,
double t_lastspike,
const CommonPropertiesType& cp)
146 if (!dynamic_cast<TracingNode*> (&t))
148 throw nest::IllegalConnection(
"This synapse only works with nodes exposing their firing probability trace (e.g. TracingNode-Subclass)!");
151 ConnTestDummyNode dummy_target;
152 ConnectionBase::check_connection_(dummy_target, s, t, receptor_type);
156 void set_status(
const DictionaryDatum& d, nest::ConnectorModel& cm);
158 void send(nest::Event& e, nest::thread t,
double t_lastspike,
const CommonPropertiesType& cp);
160 using ConnectionBase::get_delay_steps;
161 using ConnectionBase::get_delay;
162 using ConnectionBase::get_rport;
163 using ConnectionBase::get_target;
165 void set_weight(
double w)
182 std::vector<double> recorder_times_;
183 std::vector<double> recorder_values_;
185 void update_synapse_state(
double t_to,
186 double t_last_update,
188 const CommonPropertiesType& cp);
190 void update_synapic_weight(
double time,
193 const CommonPropertiesType& cp);
195 class ConnTestDummyNode :
public nest::ConnTestDummyNodeBase
198 using nest::ConnTestDummyNodeBase::handles_test_event;
200 nest::port handles_test_event(nest::SpikeEvent&, nest::rport)
202 return nest::invalid_port_;
205 nest::port handles_test_event(nest::DSSpikeEvent&, nest::rport)
207 return nest::invalid_port_;
221 template <
typename target
identifierT>
229 template <
typename target
identifierT>
230 SporeTestConnection<targetidentifierT>::SporeTestConnection(
const SporeTestConnection& rhs)
232 weight_(rhs.weight_),
233 t_weight_(rhs.t_weight_)
237 template <
typename target
identifierT>
246 template <
typename target
identifierT>
249 ConnectionBase::get_status(d);
250 (*d)[names::recorder_times] = recorder_times_;
251 (*d)[names::recorder_values] = recorder_values_;
254 template <
typename target
identifierT>
257 ConnectionBase::set_status(d, cm);
276 template <
typename target
identifierT>
282 const double t_to = e.get_stamp().get_ms();
283 double t_from = t_last_spike;
285 assert(cp.resolution_unit_ > 0.0);
287 if (t_to > t_last_spike)
295 for (
double next_weight_time = t_weight_ + cp.weight_update_time_;
296 next_weight_time <= t_to;
297 next_weight_time += cp.weight_update_time_)
299 update_synapse_state(next_weight_time, t_from, bap_trace, cp);
300 update_synapic_weight(next_weight_time, thread, target, cp);
301 t_from = next_weight_time;
306 update_synapse_state(t_to, t_from, bap_trace, cp);
310 if (e.get_rport() >= 0)
314 e.set_weight(weight_);
316 e.set_delay(get_delay_steps());
317 e.set_receiver(*get_target(thread));
318 e.set_rport(get_rport());
336 template <
typename target
identifierT>
338 double t_last_update,
342 t_to -= cp.resolution_unit_ / 2.0;
344 for (
double time = t_last_update; time < t_to; time += cp.resolution_unit_)
349 recorder_times_.push_back(time);
350 recorder_values_.push_back(*bap_trace);
363 template <
typename target
identifierT>
nest::Node * get_node()
Definition: spore_test_connection.h:112
nest::Connection< targetidentifierT > ConnectionBase
Shortcut for base class.
Definition: spore_test_connection.h:141
void get_status(DictionaryDatum &d) const
Definition: spore_test_connection.h:71
Base class to all nodes that record traces.
Definition: tracing_node.h:52
bool is_degenerated() const
Definition: spore_test_connection.h:173
Definition: poisson_dbl_exp_neuron.cpp:43
~SporeTestConnectionCommonProperties()
Definition: spore_test_connection.h:64
SporeTestConnectionCommonProperties CommonPropertiesType
Type to use for representing common synapse properties.
Definition: spore_test_connection.h:138
Class holding the common properties for all synapses of type SporeTestConnection. ...
Definition: spore_test_connection.h:46
Constant iterator class.
Definition: circular_buffer.h:49
void check_event(nest::SpikeEvent &)
Definition: spore_test_connection.h:97
void calibrate(const nest::TimeConverter &tc)
Definition: spore_test_connection.h:89
Connection for testing the spore module.
Definition: spore_test_connection.h:129
SporeTestConnectionCommonProperties()
Definition: spore_test_connection.h:53
static ConnectionUpdateManager * instance()
Definition: connection_updater.cpp:312
Global namespace holding all classes of the SPORE NEST module.
Definition: circular_buffer.h:31
void set_status(const DictionaryDatum &d, nest::ConnectorModel &cm)
Definition: spore_test_connection.h:78
long get_vt_gid() const
Definition: spore_test_connection.h:104
void send(nest::Event &e, nest::thread t, double t_lastspike, const CommonPropertiesType &cp)
Definition: spore_test_connection.h:277
const_iterator get_trace(nest::delay steps, trace_id id) const
Access the trace of id at time step step.
Definition: tracing_node.h:82