summaryrefslogtreecommitdiffstats
path: root/helper/FunctionFit.java
blob: 4fcf88eb2b0748b657178d0673f4045aa6a39bdc (plain) (blame)
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
package helper;

import DataStructure.GSMMap;
import DataStructure.SingleBTS;

/**
 * Fits GSM receive strength to youngs model at 1.8GHz
 * 
 * @author richy
 * 
 */
public class FunctionFit {
	final static double log1800 = (float) Math.log10(1800);

	/**
	 * @param type
	 *            0-2 for open, suburban, city. If type is not in range 0...2,
	 *            zero is returned
	 * @return Hata Model Parameter K for 1800MHz (precomputed)
	 */
	@SuppressWarnings("unused")
	private static double C(int type) {
		// Parameter at the end of extendet Hata Model
		switch (type) {
		case 0:
			return 31.924;
		case 1:
			return 11.9386;
		default:
			return 0;
		}
	}

	/**
	 * Returns value a(h) of the Hata Model. Use this when calculating DL
	 * (Signal from BTS to MS)
	 * 
	 * @param suburban
	 *            false, if surrounding is open or with medium buildings. True
	 *            if buildings > 15m exits
	 * @param ms_height
	 *            height of mobile station antenna (typically around 1.6m)
	 * @return value for a(h2), partly pre computed
	 */
	private static double a_DL(boolean suburban, double ms_height) {
		if (suburban) {
			return ((1.1 * log1800 - 0.7) * ms_height - (1.56 * log1800 - 0.8));
		} else {
			return 3.2 * Math.pow(Math.log10(11.75 * ms_height), 2) - 4.97;
		}

	}

	/**
	 * Returns value a(h) of the Hata Model. Use this when calculating UL
	 * (Signal from MS to BTS)
	 * 
	 * @param suburban
	 *            false, if surrounding is open or with medium buildings. True
	 *            if buildings > 15m exits
	 * @param ms_height
	 *            height of mobile station antenna (typically around 1.6m)
	 * @return value for a(h2), partly pre computed
	 */
	private static double a_UL(boolean suburban, double bts_height) {
		return a_DL(suburban, bts_height);
	}

	public static double do_fit(boolean DL, double receive1, double receive2,
			double receive3) {

		return 0.0;
	}

	public static boolean try_extrapolation(GSMMap map, SingleBTS arfcn, int x,
			int y) {
		if (ListBTS.contains(map.map[x][y], arfcn)) {
			// check if uplink can be extrapolated
			if (ListBTS.containsUL(map.map[x][y], arfcn)) {
				// nothing todo. map[x][y] contains DL and UL
			} else {
				// upload is missing. Try Interpolation here. BTS element
				// already exists
			}

		} else {
			// try Interpolation SingleBTS object does not exist
		}
		return false;
	}
}