NEST main@f146f75
Loading...
Searching...
No Matches
delay_types.h
Go to the documentation of this file.
1/*
2 * delay_types.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 DELAY_TYPES_H
24#define DELAY_TYPES_H
25
26// Includes from nestkernel:
27#include "kernel_manager.h"
28#include "nest_time.h"
29#include "nest_types.h"
30
31namespace nest
32{
33
34
40{
41 uint32_t delay_;
42
43 explicit TotalDelay( double d )
44 {
45 set_delay_ms( d );
46 }
47
51 long
53 {
54 throw BadProperty( "Trying to get dendritic delay on a synapse which only stores the total transmission delay." );
55 }
56
60 void
62 {
63 throw BadProperty( "Trying to set dendritic delay on a synapse which only stores the total transmission delay." );
64 }
65
69 double
71 {
72 throw BadProperty( "Trying to get dendritic delay on a synapse which only stores the total transmission delay." );
73 }
74
78 void
79 set_dendritic_delay_ms( const double )
80 {
81 throw BadProperty( "Trying to set dendritic delay on a synapse which only stores the total transmission delay." );
82 }
83
87 long
89 {
90 throw BadProperty( "Trying to get axonal delay on a synapse which only stores the total transmission delay." );
91 }
92
96 void
97 set_axonal_delay_steps( const double )
98 {
99 throw BadProperty( "Trying to set axonal delay on a synapse which only stores the total transmission delay." );
100 }
101
105 double
107 {
108 throw BadProperty( "Trying to get axonal delay on a synapse which only stores the total transmission delay." );
109 }
110
114 void
115 set_axonal_delay_ms( const double )
116 {
117 throw BadProperty( "Trying to set axonal delay on a synapse which only stores the total transmission delay." );
118 }
119
123 long
125 {
126 return delay_;
127 }
128
132 void
133 set_delay_steps( const long d )
134 {
135 delay_ = d;
136 }
137
141 double
143 {
145 }
146
150 void
151 set_delay_ms( const double d )
152 {
154 }
155
156 void
158 {
159 Time t = tc.from_old_steps( delay_ );
160 delay_ = t.get_steps();
161
162 if ( delay_ == 0 )
163 {
164 delay_ = 1;
165 }
166 }
167
168 void
170 {
172 }
173
174 void
176 {
177 // Check for allowed combinations. See PR #2989 for more details.
178 if ( d.known( names::dendritic_delay ) or d.known( names::axonal_delay ) )
179 {
180 throw BadParameter( "Synapse type does not support explicitly setting axonal and dendritic delays." );
181 }
182
183 // Update delay values
184 double delay;
185 if ( d.update_value( names::delay, delay ) )
186 {
187 set_delay_ms( delay );
188 }
189
191 }
192};
193
196
201{
204
205 explicit AxonalDendriticDelay( double d )
206 : axonal_delay_( 0 )
207 {
209 }
210
214 long
216 {
217 return dendritic_delay_;
218 }
219
223 void
225 {
227 }
228
232 double
237
241 void
242 set_dendritic_delay_ms( const double d )
243 {
245 }
246
250 long
252 {
253 return axonal_delay_;
254 }
255
259 void
261 {
262 axonal_delay_ = d;
263 }
264
268 double
273
277 void
278 set_axonal_delay_ms( const double d )
279 {
281 }
282
286 long
288 {
290 }
291
295 void
296 set_delay_steps( const long d )
297 {
299 axonal_delay_ = 0;
300 }
301
305 double
307 {
309 }
310
317 void
318 set_delay_ms( const double )
319 {
320 throw BadProperty(
321 "The total delay cannot be set for synapse types which use both dendritic and axonal delays, because of "
322 "ambiguity." );
323 }
324
325 void
327 {
328 Time ax_delay_t = tc.from_old_steps( axonal_delay_ );
329 Time dend_delay_t = tc.from_old_steps( dendritic_delay_ );
330 axonal_delay_ = ax_delay_t.get_steps();
331 dendritic_delay_ = dend_delay_t.get_steps();
332
333 if ( dendritic_delay_ == 0 )
334 {
336 }
337 }
338
339 void
346
347 void
349 {
350 if ( d.known( names::delay ) )
351 {
352 throw BadParameter( "Setting the total transmission delay via the parameter '" + names::delay
353 + "' is not allowed for synapse types which use both dendritic and axonal delays, because of ambiguity." );
354 }
355
356 // Update delay values
357 double dendritic_delay = get_dendritic_delay_ms();
358 if ( d.update_value( names::dendritic_delay, dendritic_delay ) )
359 {
360 set_dendritic_delay_ms( dendritic_delay );
361 }
362 double axonal_delay = get_axonal_delay_ms();
363 if ( d.update_value( names::axonal_delay, axonal_delay ) )
364 {
365 set_axonal_delay_ms( axonal_delay );
366 }
367
369 }
370};
371
374
375}
376
377#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Exception to be thrown if a parameter cannot be set.
Definition exceptions.h:717
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
DelayChecker & get_delay_checker()
Returns the delay checker for the current thread.
Definition connection_manager.cpp:214
Definition connector_model.h:69
void assert_valid_delay_ms(double)
Raise exception if delay value in milliseconds is invalid.
Definition delay_checker.cpp:149
Class to convert times from one representation to another.
Definition nest_timeconverter.h:42
Time from_old_steps(long s_old) const
Converts a given number of steps with respect to old representation into a time object in current rep...
Definition nest_timeconverter.cpp:38
Definition nest_time.h:135
static double delay_steps_to_ms(long steps)
Convert between delays given in steps and milliseconds.
Definition nest_time.h:529
static long delay_ms_to_steps(double ms)
Definition nest_time.h:539
long get_steps() const
Definition nest_time.h:504
ConnectionManager connection_manager
Definition kernel_manager.h:239
const std::string delay("delay")
const std::string axonal_delay("axonal_delay")
const std::string dendritic_delay("dendritic_delay")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311
constexpr uint8_t NUM_BITS_DENDRITIC_DELAY
Definition nest_types.h:93
StaticAssert< sizeof(TotalDelay)==4 >::success success_total_transmission_delay_data_size
check legal size
Definition delay_types.h:195
StaticAssert< sizeof(AxonalDendriticDelay)==4 >::success success_axonal_dendritic_delay_data_size
check legal size
Definition delay_types.h:373
constexpr uint8_t NUM_BITS_AXONAL_DELAY
Definition nest_types.h:94
Container for explicit dendritic and axonal delay values.
Definition delay_types.h:201
long get_axonal_delay_steps() const
Return the axonal delay of the connection in steps.
Definition delay_types.h:251
AxonalDendriticDelay(double d)
Definition delay_types.h:205
uint32_t axonal_delay_
Definition delay_types.h:203
long get_delay_steps() const
Return the delay of the connection in steps.
Definition delay_types.h:287
void set_dendritic_delay_ms(const double d)
Set the dendritic delay of the connection specified in ms.
Definition delay_types.h:242
void calibrate(const TimeConverter &tc)
Definition delay_types.h:326
double get_dendritic_delay_ms() const
Return the dendritic delay of the connection in ms.
Definition delay_types.h:233
void set_delay_steps(const long d)
Set the delay of the connection specified in ms.
Definition delay_types.h:296
void set_status(const Dictionary &d, ConnectorModel &)
Definition delay_types.h:348
long get_dendritic_delay_steps() const
Return the dendritic delay of the connection in steps.
Definition delay_types.h:215
void get_status(Dictionary &d) const
Definition delay_types.h:340
void set_axonal_delay_steps(const long d)
Set the axonal delay of the connection specified in ms.
Definition delay_types.h:260
void set_dendritic_delay_steps(const long d)
Set the dendritic delay of the connection specified in ms.
Definition delay_types.h:224
double get_delay_ms() const
Return the total delay of the connection in ms.
Definition delay_types.h:306
uint32_t dendritic_delay_
Definition delay_types.h:202
double get_axonal_delay_ms() const
Return the axonal delay of the connection in ms.
Definition delay_types.h:269
void set_axonal_delay_ms(const double d)
Set the axonal delay of the connection specified in ms.
Definition delay_types.h:278
void set_delay_ms(const double)
Setting the total delay is not supported, because it is ambiguous how it should be split into a dendr...
Definition delay_types.h:318
Compile time assertions.
Definition static_assert.h:47
Container for a single delay value which is interpreted as total transmission delay or purely dendrit...
Definition delay_types.h:40
void calibrate(const TimeConverter &tc)
Definition delay_types.h:157
void set_axonal_delay_ms(const double)
Set the axonal delay of the connection specified in ms.
Definition delay_types.h:115
void set_delay_steps(const long d)
Set the delay of the connection specified in ms.
Definition delay_types.h:133
void set_axonal_delay_steps(const double)
Set the axonal delay of the connection specified in ms.
Definition delay_types.h:97
void set_status(const Dictionary &d, ConnectorModel &)
Definition delay_types.h:175
void set_delay_ms(const double d)
Set the delay of the connection specified in ms.
Definition delay_types.h:151
void get_status(Dictionary &d) const
Definition delay_types.h:169
void set_dendritic_delay_steps(const double)
Set the dendritic delay of the connection specified in ms.
Definition delay_types.h:61
double get_axonal_delay_ms() const
Return the axonal delay of the connection in ms.
Definition delay_types.h:106
uint32_t delay_
Definition delay_types.h:41
long get_axonal_delay_steps() const
Return the axonal delay of the connection in steps.
Definition delay_types.h:88
void set_dendritic_delay_ms(const double)
Set the dendritic delay of the connection specified in ms.
Definition delay_types.h:79
long get_dendritic_delay_steps() const
Return the dendritic delay of the connection in steps.
Definition delay_types.h:52
TotalDelay(double d)
Definition delay_types.h:43
double get_delay_ms() const
Return the total delay of the connection in ms.
Definition delay_types.h:142
long get_delay_steps() const
Return the delay of the connection in steps.
Definition delay_types.h:124
double get_dendritic_delay_ms() const
Return the dendritic delay of the connection in ms.
Definition delay_types.h:70