Skip to content

Commit 656b2dc

Browse files
committed
Add spot altitude test cases
1 parent 45e1c38 commit 656b2dc

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

tests/atmosphere/test_international_standard_atmosphere.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ def test_band_boundaries(self):
4242

4343
isa.update(None)
4444

45-
print(f"Testing altitude {band_info[0]} m: pressure={isa.outputs[0]} Pa, temperature={isa.outputs[2]} K")
46-
47-
print(isa.outputs[0], band_info[2])
48-
print(isa.outputs[2], band_info[1])
49-
5045
self.assertAlmostEqual(isa.outputs[0], band_info[2], places=1) # pressure
5146
self.assertAlmostEqual(isa.outputs[2], band_info[1], places=1) # temperature
5247

@@ -110,6 +105,37 @@ def test_temp_deviation(self):
110105
self.assertGreater(density_std_day, density_pos_dev)
111106
self.assertGreater(density_neg_dev, density_std_day)
112107

108+
def test_spot_altitudes(self):
109+
"""Test pressure, density, temp, speed of sound and spot altitudes."""
110+
111+
isa = ISAtmosphere()
112+
113+
# References from - https://aerospaceweb.org/design/scripts/atmosphere/
114+
references = [
115+
[ 0, 101325, 1.2250, 288.15, 340.294 ],
116+
[ 5000, 54048, 0.7364, 255.68, 320.545 ],
117+
[15000, 12112, 0.1948, 216.65, 295.069 ],
118+
[25000, 2549.2, 0.0401, 221.55, 298.389 ],
119+
[35000, 574.59, 0.0085, 236.51, 308.299 ],
120+
[49000, 90.337, 0.0012, 270.65, 329.799 ],
121+
[65000, 10.930, 0.00016, 233.29, 306.193 ],
122+
[75000, 2.388, 0.0000399, 208.40, 289.396 ]
123+
]
124+
125+
for ref in references:
126+
isa.inputs[0] = ref[0] # altitude
127+
isa.inputs[1] = 0
128+
isa.update(None)
129+
pressure = isa.outputs[0]
130+
density = isa.outputs[1]
131+
temperature = isa.outputs[2]
132+
speed_of_sound = isa.outputs[3]
133+
134+
self.assertAlmostEqual(pressure, ref[1], places=0)
135+
self.assertAlmostEqual(density, ref[2], places=4)
136+
self.assertAlmostEqual(temperature, ref[3], places=2)
137+
self.assertAlmostEqual(speed_of_sound, ref[4], places=3)
138+
113139

114140
# RUN TESTS LOCALLY ====================================================================
115141

0 commit comments

Comments
 (0)