sPyNNaker neural_modelling  7.4.2
additional_input_ca2_adaptive_impl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 //----------------------------------------------------------------------------
24 //----------------------------------------------------------------------------
25 #ifndef _ADDITIONAL_INPUT_CA2_ADAPTIVE_H_
26 #define _ADDITIONAL_INPUT_CA2_ADAPTIVE_H_
27 
28 #include "additional_input.h"
29 
40 };
41 
50 };
51 
52 static inline void additional_input_initialise(
54  uint32_t n_steps_per_timestep) {
55  REAL ts = kdivui(params->time_step, n_steps_per_timestep);
56  state->exp_tau_ca2 = expk(-kdivk(ts, params->tau_ca2));
57  state->i_ca2 = params->i_ca2;
58  state->i_alpha = params->i_alpha;
59 }
60 
61 static inline void additional_input_save_state(additional_input_t *state,
63  params->i_ca2 = state->i_ca2;
64 }
65 
73  additional_input_t *additional_input,
74  UNUSED state_t membrane_voltage) {
75  // Decay Ca2 trace
76  additional_input->i_ca2 *= additional_input->exp_tau_ca2;
77 
78  // Return the Ca2
79  return -additional_input->i_ca2;
80 }
81 
85 static inline void additional_input_has_spiked(
86  additional_input_t *additional_input) {
87  // Apply influx of calcium to trace
88  additional_input->i_ca2 += additional_input->i_alpha;
89 }
90 
91 #endif // _ADDITIONAL_INPUT_CA2_ADAPTIVE_H_
API for additional inputs.
static void additional_input_initialise(additional_input_t *state, additional_input_params_t *params, uint32_t n_steps_per_timestep)
initialise the structure from the parameters
static void additional_input_save_state(additional_input_t *state, additional_input_params_t *params)
save parameters and state back to SDRAM for reading by host and recovery on restart
static input_t additional_input_get_input_value_as_current(additional_input_t *additional_input, state_t membrane_voltage)
Gets the value of current provided by the additional input this timestep.
static void additional_input_has_spiked(additional_input_t *additional_input)
Notifies the additional input type that the neuron has spiked.
REAL i_alpha
Influx of CA2 caused by each spike.
REAL exp_tau_ca2
exp(-(machine time step in ms) / (tau_ca2))
REAL time_step
The time step of the simulation.
REAL tau_ca2
Time constant of decay of i_ca2.
REAL i_alpha
Influx of CA2 caused by each spike.
The additional input is due to calcium ions.
The additional input is due to calcium ions.
accum REAL
Type used for "real" numbers.
Definition: maths-util.h:91
static REAL kdivk(REAL a, REAL b)
Divides an accum by another accum.
Definition: maths-util.h:234
static REAL kdivui(REAL a, uint32_t b)
Divides an accum by an unsigned integer.
Definition: maths-util.h:258
REAL state_t
The type of a state variable.
REAL input_t
The type of an input.
static uint n_steps_per_timestep
The number of steps to run per timestep.
static stdp_params params
Configuration parameters.