Skip to content

Conversation

@SiboVG
Copy link
Member

@SiboVG SiboVG commented Feb 8, 2025

This PR fixes 2 issues:

Fixes #2699, where air temperature and pressure interpolation failed if the launch site altitude was above 0. The issue was caused by ExtendedISAModel setting layer[0] to the launch site conditions, affecting interpolation in InterpolatingAtmosphericModel. When InterpolatingAtmosphericModel runs the computeLayers method, it does so by calculating the atmospheric conditions at 500 m incrementing air layers, starting at sea level (altitude = 0 m), and ending at the maximum altitude for the model.

If you set the launch site altitude to 250 m, so in the middle of an air layer (between level 0 m and level 500 m), InterpolatingAtmosphericModel.getConditions will calculate the temperature and pressure at that altitude using interpolation of the level below it (0 m) and above it (500 m). However, for 0 m, ExtendedISAModel.getExactConditions would return the temperature and pressure of the launch site (250 m) because the lowest layer of the model, layer[0] was set to the launch site conditions and ingetExactConditions, the altitude would get clamped altitude = MathUtil.clamp(altitude, layer[0], layer[layer.length - 1]);.

The result is a 50% interpolation between the 250 m (should be 0 m) and 500 m conditions, whereas you want the 250 m conditions.

To fix this, if the launch site altitude is > 0, I do not replace layer[0] with the launch site conditions. Instead, I add the launch site conditions as a new layer between layer[0] and layer[1], and extrapolate the conditions at sea level (altitude 0) to layer[0]. Now, InterpolatingAtmosphericModel.getConditions will still interpolate between level 0 m and 500 m, but the resulting interpolation at 250 m is the same as the original launch site conditions (well, almost, there is a very slight difference for the pressure because of rounding errors or something).

Added unit tests for the atmospheric models. I also prepared our Gradle build setting somewhat for Gradle version 9.0, as I kept getting warnings.

Before (pressure at the launch site is much lower than the set 990.66 mbar):
Screenshot 2025-02-08 at 01 49 56

After (correct starting pressure):
Screenshot 2025-02-08 at 01 50 05


Fixes #2677, where the user could enter a launch site altitude greater than what ExtendedISAModel could interpolate, i.e. if the launch site altitude is > 11 km (entering the Tropopause; layer[1]). The altitude is now limited both in the UI and in the SimulationOptions.

@SiboVG SiboVG marked this pull request as draft February 8, 2025 00:46
@SiboVG SiboVG changed the title [#2699] Extrapolate sea level atmospheric conditions if launch site altitude is > 0 & [#2677] Limit launch site altitude to Troposphere [#2699] Extrapolate sea level atmospheric conditions if launch site altitude is above 0 & [#2677] Limit launch site altitude to Troposphere Feb 8, 2025
@SiboVG SiboVG marked this pull request as ready for review February 8, 2025 00:55
@SiboVG SiboVG merged commit e29dd33 into openrocket:unstable Feb 9, 2025
1 check passed
@SiboVG SiboVG deleted the issue-2699 branch February 9, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant