NEST main@caf0ae8
 
Loading...
Searching...
No Matches
nest::StimulationDevice Class Reference

Base class for common properties of StimulationDevices. More...

#include <stimulation_device.h>

Inheritance diagram for nest::StimulationDevice:
[legend]
Collaboration diagram for nest::StimulationDevice:
[legend]

Classes

struct  Parameters_
 

Public Types

enum  Type { CURRENT_GENERATOR , SPIKE_GENERATOR , DOUBLE_DATA_GENERATOR , DELAYED_RATE_CONNECTION_GENERATOR }
 Device type. More...
 

Public Member Functions

 StimulationDevice ()
 
 StimulationDevice (StimulationDevice const &)
 
 ~StimulationDevice () override=default
 
bool is_active (const Time &) const override
 Determine whether device is active.
 
void get_status (Dictionary &d) const override
 Export properties of the node by setting entries in the status dictionary.
 
void set_status (const Dictionary &) override
 Change properties of the node according to the entries in the dictionary.
 
bool has_proxies () const override
 Returns true if the node has proxies on remote threads.
 
std::string get_element_type () const override
 Return the element type of the node.
 
void pre_run_hook () override
 Re-calculate dependent parameters of the node.
 
void enforce_single_syn_type (synindex)
 Throws IllegalConnection if synapse id differs from initial synapse id.
 
virtual Type get_type () const
 
const std::string & get_label () const
 
virtual void set_data_from_stimulation_backend (std::vector< double > &)
 
void update (Time const &, const long, const long) override
 Advance the state of the node in time through the given interval.
 
virtual void init_buffers ()
 Reset buffers.
 
virtual void init_state ()
 Reset dynamic state to that of model.
 
virtual void pre_run_hook ()
 Set internal variables before calls to SimulationManager::run()
 
virtual void pre_run_hook ()=0
 Re-calculate dependent parameters of the node.
 
- Public Member Functions inherited from nest::DeviceNode
 DeviceNode ()
 
 DeviceNode (DeviceNode const &dn)
 
void set_local_device_id (const size_t ldid) override
 Sets the local device id.
 
size_t get_local_device_id () const override
 Gets the local device id.
 
- Public Member Functions inherited from nest::Node
 Node ()
 
 Node (Node const &)
 
virtual ~Node ()
 
virtual Node * clone () const
 This function creates a new object by calling the derived class' copy constructor and returning its pointer.
 
virtual bool supports_urbanczik_archiving () const
 Returns true if the node supports the Urbanczik-Senn plasticity rule.
 
virtual bool local_receiver () const
 Returns true if the node only receives events from nodes/devices on the same thread.
 
virtual bool one_node_per_process () const
 Returns true if the node exists only once per process, but does not have proxies on remote threads.
 
virtual bool is_off_grid () const
 Returns true if the node sends/receives off-grid events.
 
virtual bool is_proxy () const
 Returns true if the node is a proxy node.
 
std::string get_name () const
 Return class name.
 
size_t get_node_id () const
 Return global Network ID.
 
int get_model_id () const
 Return model ID of the node.
 
bool is_frozen () const
 Returns true if node is frozen, i.e., shall not be updated.
 
bool node_uses_wfr () const
 Returns true if the node uses the waveform relaxation method.
 
void set_node_uses_wfr (const bool)
 Sets node_uses_wfr_ member variable (to be able to set it to "true" for any class derived from Node)
 
void init ()
 Initialize node prior to first simulation after node has been created.
 
virtual void calibrate_time (const TimeConverter &)
 Re-calculate time-based properties of the node.
 
virtual void post_run_cleanup ()
 Cleanup node after Run.
 
virtual void finalize ()
 Finalize node.
 
virtual bool wfr_update (Time const &, const long, const long)
 Advance the state of the node in time through the given interval (see Node::update() for more details).
 
virtual size_t send_test_event (Node &receiving_node, size_t receptor_type, synindex syn_id, bool dummy_target)
 Send an event to the receiving_node passed as an argument.
 
virtual size_t handles_test_event (SpikeEvent &, size_t receptor_type)
 Check if the node can handle a particular event and receptor type.
 
virtual size_t handles_test_event (WeightRecorderEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (RateEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (DataLoggingRequest &, size_t receptor_type)
 
virtual size_t handles_test_event (CurrentEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (ConductanceEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (DoubleDataEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (DSSpikeEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (DSCurrentEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (GapJunctionEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (InstantaneousRateConnectionEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (DiffusionConnectionEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (DelayedRateConnectionEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (LearningSignalConnectionEvent &, size_t receptor_type)
 
virtual size_t handles_test_event (SICEvent &, size_t receptor_type)
 
virtual void sends_secondary_event (GapJunctionEvent &ge)
 Required to check, if source neuron may send a SecondaryEvent.
 
virtual void sends_secondary_event (InstantaneousRateConnectionEvent &re)
 Required to check, if source neuron may send a SecondaryEvent.
 
virtual void sends_secondary_event (DiffusionConnectionEvent &de)
 Required to check, if source neuron may send a SecondaryEvent.
 
virtual void sends_secondary_event (DelayedRateConnectionEvent &re)
 Required to check, if source neuron may send a SecondaryEvent.
 
virtual void sends_secondary_event (LearningSignalConnectionEvent &re)
 Required to check if source node may send a LearningSignalConnectionEvent.
 
virtual void sends_secondary_event (SICEvent &sic)
 Required to check if source node may send a SICEvent.
 
virtual void register_stdp_connection (double, double)
 Register a STDP connection.
 
virtual void register_eprop_connection ()
 Registers an eprop connection.
 
virtual void initialize_update_history ()
 Initializes the update history.
 
virtual long get_shift () const
 Retrieves the temporal shift of the signal.
 
virtual void write_update_to_history (const long t_previous_update, const long t_current_update, const bool is_flush_event, const bool previous_was_flush_event)
 Registers the current update in the update history and deregisters the previous update.
 
virtual void erase_used_eprop_history ()
 Erases used e-prop history for bsshslm_2020 models.
 
virtual void erase_used_eprop_history (const long t_spike, const long t_spike_previous)
 Erases used e-prop history based on inter-spike interval.
 
virtual bool is_eprop_recurrent_node () const
 Checks if the node is part of the recurrent network and thus not a readout neuron.
 
virtual void handle (SpikeEvent &e)
 Handle incoming spike events.
 
virtual void handle (WeightRecorderEvent &e)
 Handle incoming weight recording events.
 
virtual void handle (RateEvent &e)
 Handler for rate events.
 
virtual void handle (DataLoggingRequest &e)
 Handler for universal data logging request.
 
virtual void handle (DataLoggingReply &e)
 Handler for universal data logging request.
 
virtual void handle (CurrentEvent &e)
 Handler for current events.
 
virtual void handle (ConductanceEvent &e)
 Handler for conductance events.
 
virtual void handle (DoubleDataEvent &e)
 Handler for DoubleData events.
 
virtual void handle (GapJunctionEvent &e)
 Handler for gap junction events.
 
virtual void handle (InstantaneousRateConnectionEvent &e)
 Handler for rate neuron events.
 
virtual void handle (DiffusionConnectionEvent &e)
 Handler for rate neuron events.
 
virtual void handle (DelayedRateConnectionEvent &e)
 Handler for delay rate neuron events.
 
virtual void handle (LearningSignalConnectionEvent &e)
 Handler for learning signal connection events.
 
virtual void handle (SICEvent &e)
 Handler for slow inward current events (SICEvents).
 
virtual double get_Ca_minus () const
 Return the Ca_minus value at time Ca_t which corresponds to the time of the last update in Calcium concentration which is performed each time a Node spikes.
 
virtual double get_synaptic_elements (std::string) const
 Get the number of synaptic element for the current Node at Ca_t which corresponds to the time of the last spike.
 
virtual int get_synaptic_elements_vacant (std::string) const
 Get the number of vacant synaptic element for the current Node Return 0 if not overridden.
 
virtual int get_synaptic_elements_connected (std::string) const
 Get the number of connected synaptic element for the current Node.
 
virtual std::map< std::string, double > get_synaptic_elements () const
 Get the number of all synaptic elements for the current Node at time t.
 
virtual void update_synaptic_elements (double)
 Triggers the update of all SynapticElements stored in the synaptic_element_map_.
 
virtual void decay_synaptic_elements_vacant ()
 Is used to reduce the number of synaptic elements in the node through time.
 
virtual void connect_synaptic_element (std::string, int)
 Is used to update the number of connected synaptic elements (SynapticElement::z_connected_) when a synapse is formed or deleted.
 
virtual double get_K_value (double t)
 return the Kminus value at t (in ms).
 
virtual double get_LTD_value (double t)
 
virtual void get_K_values (double t, double &Kminus, double &nearest_neighbor_Kminus, double &Kminus_triplet)
 write the Kminus, nearest_neighbor_Kminus, and Kminus_triplet values at t (in ms) to the provided locations.
 
virtual void get_history (double t1, double t2, std::deque< histentry >::iterator *start, std::deque< histentry >::iterator *finish)
 return the spike history for (t1,t2].
 
virtual void get_LTP_history (double t1, double t2, std::deque< histentry_extended >::iterator *start, std::deque< histentry_extended >::iterator *finish)
 
virtual void get_urbanczik_history (double t1, double t2, std::deque< histentry_extended >::iterator *start, std::deque< histentry_extended >::iterator *finish, int)
 
virtual double get_C_m (int comp)
 
virtual double get_g_L (int comp)
 
virtual double get_tau_L (int comp)
 
virtual double get_tau_s (int comp)
 
virtual double get_tau_syn_ex (int comp)
 
virtual double get_tau_syn_in (int comp)
 
virtual void compute_gradient (const long t_spike, const long t_spike_previous, double &z_previous_buffer, double &z_bar, double &e_bar, double &e_bar_reg, double &epsilon, double &weight, const CommonSynapseProperties &cp, WeightOptimizer *optimizer, bool is_flush_event, bool previous_was_flush_event, double &sum_grad, long &remaining_steps_until_cutoff, long &decay_steps)
 Compute gradient change for eprop synapses.
 
virtual double compute_gradient (std::vector< long > &presyn_isis, const long t_previous_update, const long t_previous_trigger_spike, const double kappa, const bool average_gradient)
 Compute gradient change for eprop synapses.
 
virtual void event_hook (DSSpikeEvent &)
 Modify Event object parameters during event delivery.
 
virtual void event_hook (DSCurrentEvent &)
 
void set_thread (size_t)
 Store the number of the thread to which the node is assigned.
 
size_t get_thread () const
 Retrieve the number of the thread to which the node is assigned.
 
void set_vp (size_t)
 Store the number of the virtual process to which the node is assigned.
 
size_t get_vp () const
 Retrieve the number of the virtual process to which the node is assigned.
 
void set_model_id (int)
 Set the model id.
 
void set_initialized ()
 Execute post-initialization actions in node models.
 
virtual SignalType sends_signal () const
 
virtual SignalType receives_signal () const
 
Dictionary get_status_base ()
 Return a dictionary with the node's properties.
 
void set_status_base (const Dictionary &)
 Set status dictionary of a node.
 
bool is_model_prototype () const
 Returns true if node is model prototype.
 
void set_thread_lid (const size_t)
 set thread local index
 
size_t get_thread_lid () const
 get thread local index
 
void set_tmp_nc_index (size_t index)
 Set index in node collection; required by ThirdOutBuilder.
 
size_t get_tmp_nc_index ()
 Return and invalidate index in node collection; required by ThirdOutBuilder.
 
- Public Member Functions inherited from nest::Device
 Device ()
 
 Device (const Device &n)
 
virtual ~Device ()
 
long get_t_min_ () const
 Return lower limit in steps.
 
long get_t_max_ () const
 Return upper limit in steps.
 
Time const & get_origin () const
 
Time const & get_start () const
 
Time const & get_stop () const
 

Protected Member Functions

void set_initialized_ () final
 
- Protected Member Functions inherited from nest::Node
virtual void init_state_ ()
 Configure state variables depending on runtime information.
 
virtual void init_buffers_ ()
 Configure persistent internal data structures.
 
Model & get_model_ () const
 
void set_frozen_ (bool frozen)
 Mark node as frozen.
 
template<typename ConcreteNode >
const ConcreteNode & downcast (const Node &)
 Auxiliary function to downcast a Node to a concrete class derived from Node.
 

Protected Attributes

struct nest::StimulationDevice::Parameters_ P_
 
- Protected Attributes inherited from nest::DeviceNode
size_t local_device_id_
 

Private Attributes

synindex first_syn_id_
 Synapse type of the first outgoing connection made by the Device.
 
Dictionary backend_params_
 

Additional Inherited Members

- Public Attributes inherited from nest::Node
DeprecationWarning deprecation_warning
 Member of DeprecationWarning class to be used by models if parameters are deprecated.
 

Detailed Description

Base class for common properties of StimulationDevices.

Stimulation devices are all devices injecting currents, spike trains or other signals into a network. They provide only output and do not receive any input.

Stimulation devices come in (at least) two varieties: those providing analog signals (CurrentEvent) and thos providing spike trains (SpikeEvent). Device activation needs to be handled differently in both cases. The general principle is that of the left-open, right-closed interval (start, stop]. For devices emitting spikes, spikes with times in that interval will be emitted.

For analog stimuli, e.g., currents, a stimulus is present in the interval (t, t+h], where h is the simulation resolution, if the effect of the stimulus can be observed at t+h. Thus, if a stimulus is to be active from time a, its effect will first be observable at a+h. This requires that the Event communicating the stimulus must be delivered at time a, i.e., by the deliver_events() call prior to the update for (a, a+h].

Since stimulation devices are connected to their targets with a delay of one time step, this means that analog stimulation devices need to emit the event during the update step for the interval (a-h, a]. Thus, the device needs to be PRO-ACTIVE.

Further, activity of stimulation devices is determined on the basis of simulation time, not event time stamps. This means that the first simulation time step during which the device must emit events is the step for which the global clock has time a-h. If stimulation is to end by time b, this means that the last event should be emitted during the time step for which the global clock has time b-2h.

Note
Any stimulation devices transmitting analog signals must NOT HAVE PROXIES.
The distinction between analog and spike emitting devices is implemented by making StimulationDevice a template class with the type of the Event sent as template parameter. Member is_active() is not implemented in general and is available only for those cases for which it is explicitly specialized.
StimulationDevice inherits protected from Device, so that implementations of is_active() can access t_min and t_max.
Todo:
The timing of analog devices is correct only if they are transmitted using Network::send_local(), but we cannot enforce this currently.

Member Enumeration Documentation

◆ Type

Device type.

Enumerator
CURRENT_GENERATOR 
SPIKE_GENERATOR 
DOUBLE_DATA_GENERATOR 
DELAYED_RATE_CONNECTION_GENERATOR 

Constructor & Destructor Documentation

◆ StimulationDevice() [1/2]

nest::StimulationDevice::StimulationDevice ( )

◆ StimulationDevice() [2/2]

nest::StimulationDevice::StimulationDevice ( StimulationDevice const &  sd)

◆ ~StimulationDevice()

nest::StimulationDevice::~StimulationDevice ( )
overridedefault

Member Function Documentation

◆ enforce_single_syn_type()

◆ get_element_type()

std::string nest::StimulationDevice::get_element_type ( ) const
inlineoverridevirtual

Return the element type of the node.

The returned string is a free label describing the class of network elements a node belongs to. Currently used values are "neuron", "recorder", "stimulator", and "other", which are all defined as static string objects in the names namespace. This function is overwritten with a corresponding value in the derived classes

Reimplemented from nest::Node.

References nest::names::stimulator().

Here is the call graph for this function:

◆ get_label()

const std::string & nest::StimulationDevice::get_label ( ) const

References nest::StimulationDevice::Parameters_::label_, and P_.

Referenced by nest::StimulationBackendMPI::get_port().

Here is the caller graph for this function:

◆ get_status()

void nest::StimulationDevice::get_status ( Dictionary &  ) const
overridevirtual

◆ get_type()

virtual Type nest::StimulationDevice::get_type ( ) const
inlinevirtual

◆ has_proxies()

bool nest::StimulationDevice::has_proxies ( ) const
inlineoverridevirtual

Returns true if the node has proxies on remote threads.

This is used to discriminate between different types of nodes, when adding new nodes to the network.

Reimplemented from nest::Node.

◆ init_buffers()

◆ init_state()

◆ is_active()

bool nest::StimulationDevice::is_active ( const Time &  T) const
overridevirtual

Determine whether device is active.

The argument is the value of the simulation time.

See also
class comment for details.

Implements nest::Device.

References CURRENT_GENERATOR, DELAYED_RATE_CONNECTION_GENERATOR, DOUBLE_DATA_GENERATOR, nest::Time::get_steps(), nest::Device::get_t_max_(), nest::Device::get_t_min_(), and get_type().

Referenced by nest::ac_generator::update(), nest::dc_generator::update(), nest::gamma_sup_generator::update(), nest::inhomogeneous_poisson_generator::update(), nest::mip_generator::update(), nest::noise_generator::update(), nest::poisson_generator::update(), nest::ppd_sup_generator::update(), nest::pulsepacket_generator::update(), nest::sinusoidal_poisson_generator::update(), nest::spike_dilutor::update(), nest::spike_generator::update(), nest::step_rate_generator::update(), and nest::step_current_generator::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_run_hook() [1/3]

void nest::Device::pre_run_hook ( )
virtual

Set internal variables before calls to SimulationManager::run()

Implements nest::Node.

◆ pre_run_hook() [2/3]

void nest::StimulationDevice::pre_run_hook ( )
overridevirtual

Re-calculate dependent parameters of the node.

This function is called each time a simulation is begun/resumed. It must re-calculate all internal Variables of the node required for spike handling or updating the node.

Implements nest::Node.

References nest::Device::pre_run_hook().

Referenced by nest::ac_generator::pre_run_hook(), nest::dc_generator::pre_run_hook(), nest::gamma_sup_generator::pre_run_hook(), nest::inhomogeneous_poisson_generator::pre_run_hook(), nest::mip_generator::pre_run_hook(), nest::noise_generator::pre_run_hook(), nest::poisson_generator::pre_run_hook(), nest::poisson_generator_ps::pre_run_hook(), nest::ppd_sup_generator::pre_run_hook(), nest::pulsepacket_generator::pre_run_hook(), nest::sinusoidal_poisson_generator::pre_run_hook(), nest::spike_dilutor::pre_run_hook(), nest::spike_generator::pre_run_hook(), nest::step_current_generator::pre_run_hook(), and nest::step_rate_generator::pre_run_hook().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_run_hook() [3/3]

virtual void nest::Node::pre_run_hook ( )
virtual

Re-calculate dependent parameters of the node.

This function is called each time a simulation is begun/resumed. It must re-calculate all internal Variables of the node required for spike handling or updating the node.

Implements nest::Node.

◆ set_data_from_stimulation_backend()

◆ set_initialized_()

void nest::StimulationDevice::set_initialized_ ( )
finalprotectedvirtual

Reimplemented from nest::Node.

References backend_params_, nest::IOManager::enroll_stimulator(), nest::KernelManager::io_manager, nest::kernel(), P_, and nest::StimulationDevice::Parameters_::stimulus_source_.

Here is the call graph for this function:

◆ set_status()

◆ update()

void nest::StimulationDevice::update ( Time const &  ,
const long  ,
const long   
)
inlineoverridevirtual

Advance the state of the node in time through the given interval.

This method advances the state of the node through the interval (origin+from, origin+to], which is at most min_delay long.

  • Precondition: State of the node corresponds to the time origin+from.
  • Postcondition: State of the node corresponds to the time origin+to.

Each step between from and to corresponds to one simulation timestep (nest.resolution).

If events are emitted, they have time stamps in the interval T+from+1 .. T+to.

Parameters
originnetwork time at beginning of time slice
frominitial step inside time slice
topost-final step inside time slice

Implements nest::Node.

Member Data Documentation

◆ backend_params_

Dictionary nest::StimulationDevice::backend_params_
private

◆ first_syn_id_

synindex nest::StimulationDevice::first_syn_id_
private

Synapse type of the first outgoing connection made by the Device.

Used to check that devices connect using only a single synapse type, see #481 and #737. Since this value must survive resets, it is stored here, even though it is an implementation detail.

Referenced by enforce_single_syn_type().

◆ P_

struct nest::StimulationDevice::Parameters_ nest::StimulationDevice::P_
protected

The documentation for this class was generated from the following files: