-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestOxyAtten.cpp
More file actions
68 lines (63 loc) · 1.64 KB
/
testOxyAtten.cpp
File metadata and controls
68 lines (63 loc) · 1.64 KB
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
/***********************************************************************
* testOxyAtten.cpp:
* Driver for oxygenAtten class
* Author:
* Alexander Marvin
* Summary:
* Test oxygenAtten class
************************************************************************/
#include "atten.h"
#include "datafile.h"
#include <iostream>
#include <cmath>
using namespace std;
void loopFreq(datafile & data, oxygenAtten & test);
int main()
{
cout << "testOxyAtten running\n";
//initialize
datafile data("TIGR0001");
//read in file
data.readFile(true);
//set altitude
data.setAltitude(0);
cout << "Altitude is set to 0 km\n";
//pass pointer to oxygenAtten class
oxygenAtten test(&data);
//loop through frequencies
loopFreq(data, test);
//now do for another altitude
data.setAltitude(8e+3);
cout << endl;
cout << "Altitude is set to 8 km\n";
//reset values
test.resetValues();
//now loop through Frequencies
loopFreq(data, test);
//set for third altitude
data.setAltitude(30e+3);
cout << endl;
cout << "Altitude is set to 30 km\n";
//now loop through Frequencies
loopFreq(data, test);
}
void loopFreq(datafile & data, oxygenAtten & test)
{
double testValue;
int start = 50;
int end = 70;
double stepsize = 1;
int numValues = (end - start)/stepsize + 1;
cout << "Frequency\tAttenuation\n";
for (int i = 0; i < numValues; i++)
{
//set frequency
double frequency = start+i*stepsize;
data.setFreq(frequency);
//reset values
test.resetValues();
//testing code
testValue = test.getValue();
cout << frequency << "\t" << testValue << " db/km" << endl;
}
}