-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroom.h
191 lines (132 loc) · 4.44 KB
/
room.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
#ifndef ROOM_H
#define ROOM_H
// Dependencies
#include "MainWindow.h"
#include "antena.h"
#include "math.h"
#include "wall.h"
#include "ray.h"
#include "lineo.h"
// Libraries
#include <complex>
#include <vector>
#include "math.h"
using namespace std;
class antena;
class wall;
class MainWindow;
class ray;
class room : public QGraphicsScene//, private QImage
{
Q_OBJECT
public:
explicit room(MainWindow *parent = 0);
void launch_algo(bool drawR);
float distance();
void drawWall(qreal &x1, qreal &y1, qreal &x2, qreal &y2);
// Getters && Setters
double getReceivedPower();
antena* getTransmitter();
antena* getReceiver();
wall* getWalls(int i);
int getAmountWalls();
double getBinaryDebit();
int getAmountDiscret();
double getpowerEmettor();
double getInitBinaryDeb();
complex <double> getTotalEfield();
void setTransmitter(antena *new_transmitter);
void setReceiver(antena *new_receiver);
void setAntenaType(int type);
//Misc tools
void readSettingsFile();
void clearAll();
void drawCoverege();
signals:
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
int antenaType;
private:
// Qt visuals
MainWindow *myParent;
QGraphicsView *graphicsView;
// General objects
antena *Transmitter;
antena *Receiver;
wall *walls[11]; // For easier use walls are put in arrays
// --> Global variables (electrical constants)
double epsilonAir = 8.864e-12; // A²S⁴kg⁻1m⁻3
double Zvoid = 120*M_PI;
double muAir = 4*M_PI*1e-7; // Tm/A
double c =2.998e+8; // m/s
double freq = 2.45e+9; // Hz
double lambda;
double alpha;
double beta;
complex <double> gamma;
double power;
double Ra = 71.0; // Ohms, its a typical resistance data for \lambda/2 emettors
// Algo parameters
int ray_counter;
vector< vector <ray*>> allRays; // Declaring the multi-ray vector
vector < vector <ray*>> allDiffractedRays;
vector <ray*> completeRay;
vector <ray*> current; // algo power
complex <double> Efield;
complex <double> totalEfield = 0.0;
//lineo *current_wall = NULL;
lineo *current_ray;
QLineF lineToVirtualSource;
int recursionState = 0;
wall* wallRecursiveNumber[9];
double transmitterSerie[9][2];
double angle_wall;
qreal x2wall;
qreal y2wall;
double imCoordinates[2];
// Wall parameters
double wallThickness;
double wallSigma;
double wallEps;
double epsilonWallRel;
// Problem parameters
int reflectionsNumber;
int amount_walls = 11;
int amount_discret = 20;
double powerEmettor = 20.0; // In watts the power of the emettor
double Zwall;
double eps;
bool diffractOn = false;
// Results
double resultsBinaryDebit;
double powerReceived;
// ---------- Methods ------------------------
// Computation methods
void imagesMethod(double transmitterPosX,double transmitterPosY ,double reveiverPosX,double receiverPosY, int numberOfReflections);
void recursion(double transmitterPosX, double transmitterPosY, double receiverPosX, double receiverPosY, int numberOfReflections, void (*draw)(double, double, double, double, room *));
static void drawRay(double TransmitterImagePosX, double TransmitterImagePosY, double OriginX, double OriginY, room *scene);
static void buildRay(double TransmitterPosX, double TransmitterPosY, double OriginX, double OriginY, room *scene);
void calculateDiffractedRays();
// Numerical analysis
complex <double> FtIntegral(double x);
// Geometric methods
bool pointOnLine(lineo* line1, double x, double y);
vector<double> intersection(lineo* line1, lineo* line2 );
double distInWall(double tetai);
void distCorrection(vector<ray*> oneCompleteRay, wall walls[]);
bool commonToAnyWall(double posX, double posY, int indWall);
// Telecom calculation tools
double dBm(double power);
double dBmRev(double dbm);
double binaryDebit(double power);
double calculatePower(vector< vector<ray*>> allRays);
double calculatePowerDiff(vector< vector<ray*>> allRays);
double calculateRay(vector<ray*> rayLine);
double calculateRayDiff(vector<ray*> rayLine);
//Misc
void setDefaultSettings();
public slots:
};
#endif // ROOM_H