-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWorm.h
90 lines (70 loc) · 2.29 KB
/
Worm.h
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// Worm.hpp
// one
//
// Created by Eduardo Izquierdo on 9/25/15.
// Copyright © 2015 Eduardo Izquierdo. All rights reserved.
//
#include "VectorMatrix.h"
#include "random.h"
#include "WormBody.h"
#include "NervousSystem.h"
#include "Muscles.h"
#include "StretchReceptor.h"
#include <cmath>
#define PI 3.14159265
using namespace std;
// Parameters
const int N_muscles = 24; // Number of muscles alongside the body
const int N_units = 6; // Number of neural units
const int N_neuronsperunit = 6; // Number of neurons in a neural unit
const int N_stretchrec = 6; // N_units + 1 // Number of stretch receptors
//
const double T_muscle = 0.1; // Muscle time constant
const int HeadMotorNeuronMuscles = 6; // Head motorneurons innervate first 8 muscles (temporarily first 6)
const int VNCMuscleStart = 7; // VNC motorneurons innervate starting from 7th muscle
const int NmusclePerNU = 3; // All the way down to 24, in groups of 3 per unit
// Neuron name conventions
const int DB = 1;
const int DD = 2;
const int VBA = 3;
const int VDA = 4;
const int VBP = 5;
const int VDP = 6;
// Neuron name conventions
const int SMDD = 1;
const int RMDD = 2;
const int SMDV = 3;
const int RMDV = 4;
// Body segment name conventions
const int Head = 1;
const int Tail = N_segments;
class Worm {
public:
Worm(TVector<double> &v, double output);
void InitializeState(RandomState &rs);
void HeadStep(double StepSize, double output);
void Step(double StepSize, double output);
void DumpBodyState(ofstream &ofs, int skips);
void DumpActState(ofstream &ofs, int skips);
void DumpVoltage(ofstream &ofs, int skips);
void DumpParams(ofstream &ofs);
double CoMx();
double CoMy();
void Curvature(TVector<double> &c);
double Orientation();
WormBody b;
Muscles m;
NervousSystem n;
StretchReceptor sr;
NervousSystem h;
double t; // Time
// Neuromuscular junctions
double NMJ_DB, NMJ_VBa, NMJ_VBp, NMJ_DD, NMJ_VDa, NMJ_VDp;
double NMJ_SMDD, NMJ_RMDD, NMJ_SMDV, NMJ_RMDV;
double NMJ_Gain_Map;
TVector<double> NMJ_Gain;
// Head oscillator
double dorsalinput1, ventralinput1, dorsalinput2, ventralinput2;
double headFreq, headDelay, headGain, headBias;
};