1 package org.wcb.e6b;
2
3
4
5
6
7
8
9
10
11
12 public class PressureAltitude extends AbstractE6B {
13
14 private double altitude;
15 private double hg;
16 private long pAlt;
17 private static final double STANDARD_PRESSURE_MB = 1013.250556514;
18
19
20
21
22
23 public double getAltitude() {
24 return altitude;
25 }
26
27
28
29
30
31 public void setAltitude(double alt) {
32 this.altitude = alt;
33 }
34
35
36
37
38
39 public double getHg() {
40 return hg;
41 }
42
43
44
45
46
47 public void setHg(double inchMercury) {
48 this.hg = inchMercury;
49 }
50
51
52
53
54
55 public void calculate() {
56 double altSet = E6bConverter.hgToMillibars(hg);
57 double altpress;
58 altpress = (1 - Math.pow((altSet / STANDARD_PRESSURE_MB), 0.190284)) * 145366.45;
59 pAlt = roundSet(altitude + altpress);
60 }
61
62
63
64
65
66 public long presureAlitude() {
67 return pAlt;
68 }
69
70
71
72
73
74
75 public long roundSet(double value) {
76 return Math.round(10 * value) / 10;
77 }
78
79 }