-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNanobot.h
197 lines (160 loc) · 5.03 KB
/
Nanobot.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/* -*- Mode: C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2017 Universität zu Lübeck [GEYER]
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Regine Geyer <geyer@itm.uni-luebeck.de>
*/
#ifndef CLASS_NANOBOT_
#define CLASS_NANOBOT_
#include "ns3/object.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include <iostream>
#include <vector>
#include "NanoNetDevice.h"
namespace ns3 {
class Nanobot;
/**
* \brief Nanobot is a mobile Object.
*
* Each Nanobot has a dimension [length and width] and can be positioned by a Vector.
* The position of the Nanobot is the position of its node which it owns.
* A Nanobot belongs to a particular stream of a specific Bloodvessel.
* Its current velocity depends on the stream it is in. Nanobots are managed by bloodvessels.
*/
class Nanobot : public ns3::Object
{
private:
int m_nanobotID; // nanobot's id
double m_length; // nanobot's length.
double m_width; // nanobot's width.
int m_stream_nb; // nanobot's stream.
std::vector<int> m_gateway_positions; // position of gateway
std::vector<int> m_tissue_ID;
Ptr<Node> m_node; // nanobot has a node - a node has a position
Ptr<NanoNetDevice> m_nanoNetDevice;
bool m_shouldChange; // nanobots change setting - if true change streams
ns3::Time m_timeStep; // simulatortime of the last change of the nanobot
public:
//static TypeId GetTypeId (void);
/// Constructor to initialize values of all variables.
/// Length an width are set to 100nm and the Nanobot does not change streams by default.
/// The NanobotID is set in bloodcircuit, were the Nanobots are initialised.
Nanobot ();
/// Destructor [does nothing].
~Nanobot ();
/// Compare is used for the purpose of sorting nanobots based on their ID in a list or a queue.
/// returns true if the ID of v1 is smaller than v2's ID.
static bool Compare (Ptr<Nanobot> v1, Ptr<Nanobot> v2);
///Getter and setter methods
/**
* \returns the Nanobot Id.
*/
int GetNanobotID ();
/**
* \param value a Nanobot Id.
*
* A Nanobot has an unique Id.
*/
void SetNanobotID (int value);
/**
* \returns the length of the Nanobot.
*/
double GetLength ();
/**
* \param value the length of the Nanobot.
*/
void SetLength (double value);
/**
* \returns the width of the Nanobot.
*/
double GetWidth ();
/**
* \param value the stream of the Nanobot.
*/
void SetStream (int value);
/**
* \returns the stream of the Nanobot.
*/
int GetStream ();
/**
* \param value the width of the Nanobot.
*/
void SetWidth (double value);
/**
* \returns true if the Nanobot should change
*/
bool GetShouldChange ();
/**
* \param bool if nanobot should change.
*/
void SetShouldChange (bool value);
/**
* \returns the time of the last change of Nanobots position
*/
ns3::Time GetTimeStep ();
/**
* \sets the time of the last change in position.
*/
void SetTimeStep ();
/**
* \returns the position of Nanobot's Node which is located at the center back of the Nanobot.
*/
Vector GetPosition ();
/**
* \param value a position Vector.
*
* This function sets the position of Nanobot's Node. Nanobot's position is its Node's position.
* The position Vector must point to the center back of the Nanobot.
*/
void SetPosition (Vector value);
/**
* \returns the position of Gateways to Communicate.
*/
std::vector<int> GetGatewayPositions();
/**
* \param val a int Vector.
*
* This function sets the position of Gateways.
*/
void SetGatewayPositions(std::vector<int> val);
/**
* \param val a int Vector.
*
* This function sets the position of tissue ID, where to measure.
*/
void Settissue_ID(std::vector<int> val);
/**
* \returns the position of Tissue_ID to measure.
*/
vector<int> Gettissue_ID();
/**
* \param channel a channel pointer.
*
* This function install the according NanoNetDevice inside the Naobot with the specific channel
*/
void InstallNanoNetDevice(Ptr<BVSChannel> channel);
/**
* \returns the pointer to the installed Netdevice
*/
Ptr<NetDevice> GetDevice();
/**
* \returns the pointer to the installed NanoNetDevice
*/
Ptr<NanoNetDevice> GetNanoNetDevice();
};
}; // namespace ns3
#endif