summaryrefslogtreecommitdiff
path: root/code/core/simulate.h
blob: 3d84b6e0ed7c7f329591aebb390d8f9330f43f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef SIMULATE_H
#define SIMULATE_H

#include <queue>
#include <list>

#include "neuron.h"
#include "synapse.h"
#include "tracepoints.h"
#include "event.h"
#include "interface.h"
#include "spike.h"

using namespace std;
 
class Simulation {
public:
  Simulation();

  // ----- FUNCTIONS -----

  // controlling functions
  bool Step(); // do a single step (fire one neuron); return if the net is dead
  bool proceedTime(double td);
  bool proceedSpikes(long count);

  void addEvent(Event*);

  // ----- SIMULATION STATE -----

  // simulation global variables
  double currentTime;

  // list of spikes and events
  priority_queue<Event, vector<Event*>, PEventGreater> pendingSpikes;

  // list of discontinous dopamin changes (time, amount), sorted by time (newest is front)
  std::list<pair<double, double> > da_history;

  // ----- HELPER VARS -----

  // reflection & traces
  std::list<OutputInterface<SpikeMUX> *> spikeOIfList;

  std::set<Bin*> binSets;

  // file descriptors
  FILE *fd_ineuron,
    *fd_isynapse,
    *fd_ispike,
    *fd_iglobal,
    *fd_oneuron,
    *fd_osynapse,
    *fd_ospike,
    *fd_oglobal,
    *fd_trace; // command file

  // debug vars
#ifdef DEBUG_STATUSLINE
  long long numSpikes; // number of spikes (counted after axon hillock) processed so far
  map<int, int> eventCount;
  int charCount;
#endif
};

// init neural network
Simulation s;


#endif // SIMULATE_H
contact: Jan Huwald // Impressum