-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathElectroMagneticWaves.h
265 lines (227 loc) · 8.75 KB
/
ElectroMagneticWaves.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
//
// Created by Ryan.Zurrin001 on 12/16/2021.
//
#ifndef PHYSICSFORMULA_ELECTROMAGNETICWAVES_H
#define PHYSICSFORMULA_ELECTROMAGNETICWAVES_H
#include "ElectroMagneticInduction.h"
static int emWaves_objectCount = 0;
class ElectromagneticWaves :
public ElectroMagneticInduction
{
public:
ElectromagneticWaves()
{
emWaveVar = 0.0;
countIncrease();
}
/**
* @brief copy constructor
*/
ElectromagneticWaves(const ElectromagneticWaves& t)
{
emWaveVar = t.getMagVar();
countIncrease();
}
/**
* #brief move constructor
*/
ElectromagneticWaves(ElectromagneticWaves&& t) noexcept
{
emWaveVar = t.getEmWaveVar();
countIncrease();
}
/**
* @brief copy assignment operator
*/
ElectromagneticWaves& operator=(const ElectromagneticWaves& t)
{
if (this != &t)
{
emWaveVar = getEmWaveVar();
countIncrease();
}
return *this;
}
void setEmWaveVar(ld var) { emWaveVar = var; }
ld getEmWaveVar() const { return emWaveVar; }
static void show_objectCount() { std::cout << "\n emWaves object count: "
<< emWaves_objectCount << std::endl; }
static int get_objectCount() { return emWaves_objectCount; }
static ld speedOfElectroMagneticWaves();
/// <summary>
/// B fields the strength electromagnetic wave
/// </summary>
/// <param name="E">The e field strength.</param>
/// <returns>electromagnetic B field strength</returns>
static ld magneticFieldStrength_emWave(ld E);
/// <summary>
/// magnetic field strength of em wave. E field
/// </summary>
/// <param name="B">The B field strength of an emWave.</param>
/// <returns>electromagnetic E field strength</returns>
static ld electricFieldStrength_emWave(ld B);
/// <summary>
/// The maximum magnetic field strength of an electromagnetic field is B
/// Calculate the maximum electric field strength if the wave is traveling
/// in a medium in which the speed of the wave is percentOfc of c
/// </summary>
/// <param name="B">The B field strength of an emWave.</param>
/// <param name="percentOfc">The percent ofc.</param>
/// <returns></returns>
static ld electricFieldStrength_emWave(ld B, ld percentOfc);
/// <summary>
/// Calculates the wave length of a em wave having a frequency of f.
/// </summary>
/// <param name="f">The frequency.</param>
/// <returns>the wave length (m)</returns>
static ld waveLength_emWave(ld f);
/// <summary>
/// Calculates the frequency an em wave having a wave length of waveLen.
/// </summary>
/// <param name="waveLen">Length of the wave.</param>
/// <returns>frequency(Hz)</returns>
static ld frequency_emWave(ld waveLen);
/// <summary>
/// A radar used to detect the presence of aircraft receives a pulse that
/// has reflected off an object t(s) after it was transmitted. What is
/// the distance from the radar station to the reflecting object?
/// </summary>
/// <param name="t">The time in seconds.</param>
/// <returns>distance from radar station (m)</returns>
static ld distanceFromRadarStation(ld t);
/// <summary>
/// Determine the amount of time it takes for X_-rays to travel
/// a distance of d(m).
/// </summary>
/// <param name="d">The distance.</param>
/// <returns>time is seconds</returns>
static ld timeFor_emWaveToTravelDistance(ld d);
/// <summary>
/// What is the echo time for a car d m from a Highway Police radar
/// unit?
/// </summary>
/// <param name="d">The distance.</param>
/// <returns>time for radar echo to return</returns>
static ld echoTime(ld d);
/// <summary>
/// Find the intensity of an electromagnetic wave having a peak magnetic
/// field strength of B(T)
/// </summary>
/// <param name="B">The magnetic field strength.</param>
/// <returns>Intensity ( W/m^2)</returns>
static ld intensityAvg_emWave_B(ld B);
/// <summary>
/// A university communications satellite dish receives
/// TV signals that have a maximum electric field strength
/// (for one channel) of E V/m . What is the intensity of this wave?
/// </summary>
/// <param name="E">The maximum electric field strength.</param>
/// <returns>intensity W/m^2</returns>
static ld intensityAvg_emWave_E(ld E);
/// <summary>
/// A d(m)-diameter university communications satellite dish receives
/// TV signals that have a intensity of I
/// (for one channel). What is the power received by the antenna?
/// </summary>
/// <param name="d">The d.</param>
/// <param name="I">The I.</param>
/// <returns>power in (W)</returns>
static ld powerReceivedByAntenna(ld d, ld I);
/// <summary>
/// Astronomers determine that a particular star in our galaxy is moving
/// toward Earth at a speed of v m/s with respect to the Earth.
/// If Earth receives a wavelength 𝜆 = receivedWL m from this star, what
/// was the wavelength emitted by the star?
/// </summary>
/// <param name="v">The speed.</param>
/// <param name="receivedWL">The received wavelength.</param>
/// <returns></returns>
static ld waveLength_dopplerEffect(ld v, ld receivedWL);
/// <summary>
/// Calculates the inductance of a LC circuit containing a C-F capacitor
/// oscillates at such a frequency that it radiates at a theta-m wavelength.
/// </summary>
/// <param name="theta">The theta.</param>
/// <param name="C">The c.</param>
/// <returns>inductance</returns>
static ld inductanceOfCircuitFromWavelength(ld theta, ld C);
/// <summary>
/// Calculates the capacitance_Qv of a LC circuit containing a L-H inductor
/// oscillates at such a frequency that it radiates at a theta-m wavelength.
/// </summary>
/// <param name="theta">The theta.</param>
/// <param name="L">The l.</param>
/// <returns>capacitance_Qv</returns>
static ld capacitanceOfCircuitFromWavelength(ld theta, ld L);
~ElectromagneticWaves()
{
countDecrease();
}
private:
ld emWaveVar;
static void countIncrease() { emWaves_objectCount += 1; }
static void countDecrease() { emWaves_objectCount -= 1; }
};
#endif //PHYSICSFORMULA_ELECTROMAGNETICWAVES_H
//=============================================================================
//in-line class Implementation
inline ld ElectromagneticWaves::speedOfElectroMagneticWaves()
{
return 1.0 / sqrt (constants::_mu0 * constants::_e0);
}
inline ld ElectromagneticWaves::magneticFieldStrength_emWave(const ld E)
{
return E / constants::LIGHT_SPEED;
}
inline ld ElectromagneticWaves::electricFieldStrength_emWave(const ld B)
{
return constants::LIGHT_SPEED * B;
}
inline ld ElectromagneticWaves::electricFieldStrength_emWave(const ld B, const ld percentOfc)
{
return percentOfc * constants::LIGHT_SPEED * B;
}
inline ld ElectromagneticWaves::waveLength_emWave(const ld f)
{
return constants::LIGHT_SPEED / f;
}
inline ld ElectromagneticWaves::frequency_emWave(const ld waveLen)
{
return constants::LIGHT_SPEED / waveLen;
}
inline ld ElectromagneticWaves::distanceFromRadarStation(const ld t)
{
return (constants::LIGHT_SPEED * t) / 2.0;
}
inline ld ElectromagneticWaves::timeFor_emWaveToTravelDistance(const ld d)
{
return d / constants::LIGHT_SPEED;
}
inline ld ElectromagneticWaves::echoTime(const ld d)
{
return (2.0 * d) / constants::LIGHT_SPEED;
}
inline ld ElectromagneticWaves::intensityAvg_emWave_E(const ld E)
{
return (constants::LIGHT_SPEED * constants::_e0 * (E * E)) / 2.0;
}
inline ld ElectromagneticWaves::powerReceivedByAntenna(const ld d, const ld I)
{
return (I * constants::PI * (d * d)) / 4.0;
}
inline ld ElectromagneticWaves::waveLength_dopplerEffect(const ld v, const ld receivedWL)
{
return receivedWL / (1.0 - (v / constants::LIGHT_SPEED));
}
inline ld ElectromagneticWaves::inductanceOfCircuitFromWavelength(const ld theta, const ld C)
{
return (theta * theta) / (4.0 * (constants::PI * constants::PI) * (constants::LIGHT_SPEED * constants::LIGHT_SPEED) * C);
}
inline ld ElectromagneticWaves::capacitanceOfCircuitFromWavelength(const ld theta, const ld L)
{
return (theta * theta) / (4.0 * (constants::PI * constants::PI) * L * (constants::LIGHT_SPEED * constants::LIGHT_SPEED));
}
inline ld ElectromagneticWaves::intensityAvg_emWave_B(const ld B)
{
return (constants::LIGHT_SPEED * (B * B)) / (2.0 * constants::_mu0);
}