/*
    cuba.sli

    Copyright (C) 2004 The NEST Initiative                 
    This file is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This file is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

/*
   Benchmark 2 of the simulator review
 
   The SLI code in this file creates a sparsely coupled network of
   excitatory and inhibitory neurons which exhibits self-sustained
   activity after an initial stimulus.  Connections within and across
   both populations are created at random.  Both neuron populations
   receive Poissonian background input.  The spike output of 500
   neurons from each population are recorded.  Neurons are modeled
   as leaky integrate-and-fire neurons with conductance based synapses
   (exponential functions).  The model is based on 

      T.P. Vogels & L.F. Abbott
      Signal Propagation and Logic Gating in Networks of 
      Integrate-and-Fire Neurons
      Journal of Neuroscience, 2005, vol 25, pp 10786-10795.

   Note that the simulation time is set 10 times longer than for
   benchmark 2 (coba.sli) or benchmark 3 (hh_coba.sli). This is
   necessary as the computational load here is much lower, so a
   longer simulation time is necessary to make reasonable
   measurements.

    Marc-Oliver Gewaltig, Abigail Morrison, Tobias Potjans
*/
  
%%% PARAMETER SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% define all relevant parameters: changes should be made here
% all data is place in the userdict dictionary

% A dictionary is a list of name value pairs, enclosed in << and >>
% Here we use dictionaries to encapsulate the parameters for the different
% benchmarks
  
/cuba_params
<<
  /model  /iaf_psc_exp  % the neuron model to use

  /model_params
   <<
     /E_L      -49.0 mV  % resting membrane potential [mV]
     /V_th     -50.0 mV  % Threshold [mV] 
     /V_reset  -60.0 mV  % Reset Potential [mV] 
     /C_m      200.0 pF  % Capacity of the membrane [pF]
     /tau_m     20.0 ms  % Membrane time constant [ms]
     /tau_syn_ex 5.0 ms  % time const. postsynaptic excitatory currents [ms]
     /tau_syn_in 10.0 ms % time const. postsynaptic inhibitory currents [ms]
     /t_ref       5.0 ms % duration of refractory period [ms]
   >>

  /delay  0.1 ms         % synaptic delay, all connections [ms]
 
  % synaptic strengths, here peak current
  /E_synapse_params
  <<
     /weight 16.2 pA     % excitatory PSC amplitude
  >>
  
  /I_synapse_params
  <<
     /weight -139.5 pA   % inhibitory PSC amplitude
  >>
 
  /stimulus /poisson_generator 
  /stimulus_params
  <<
    /rate 300.0 Hz   % rate of inital poisson stimulus
    /start  1.0 ms   % start of Poisson_generator [ms]
    /stop  51.0 ms   % stop of Poisson_generator [ms]
    /origin 0.0 ms   % origin of time, to calculate start_time [ms]
  >>

  /detector /spike_detector
  /detector_params
  << 
   /withtime true 
   /withgid true
   /to_file false
   /label (cuba)
  >>

  % number of neurons per population to record from
  /Nrec 500 

  %number of neurons to stimulate
  /Nstim 50 
  /simtime 10000.0 ms % simulated time 
  /dt         0.1 ms % simulation step   

  /NE 3200       % number of excitatory neurons
  /NI  800       % number of inhibitory neurons
  /epsilon 0.02  % Connection probability 

%  /virtual_processes 1  % number of virtual processes to use

>> def

cuba_params using % here we activate the definitions in the dictionary