Skip to content

Conversation

@SiboVG
Copy link
Member

@SiboVG SiboVG commented Aug 27, 2024

Goal of this PR

This PR fixes #2525 and introduces the ability to perform a parameter sweep over a given domain type (wind direction, angle of attack, mach number, or roll rate), and then plot and export different component analysis outputs (CP, CNa, CD...).

How it works

The UI

The Component Analysis dialog is converted to a tabbed pan with 2 tabs: General and Plot / Export. The General tab contains the already existing CA content.
image

The Plot / Export tab has a section on top to configure the parameter sweep domain type (the X axis). You can choose the minimum and maximum value for the parameter sweep, as well as the step size. In the Plot / Export tab is another tabbed pane for plotting (Plot) and exporting (Export).

plot_export_tab

Configuring an analysis sweep

The main configuration for a component analysis sweep is which domain type to choose and the sweep range and step size. As mentioned earlier, this can be set at the top of the Plot / Export tab.

The other parameters for the CA sweep are taken from the General tab. For instance, if I do a sweep over Mach number, then the analysis uses the values in the General tab for wind direction, angle of attack and roll rate).

Plotting

Configuring a plot is similar to configuring a simulation plot, with two differences:

  1. You must specify the parameter sweep boundary and step size
  2. You must specify the rocket component to plot the parameter for

I have added one plot preset: Total CD vs. Mach number, which does a parameter sweep over the mach number, and plots the total CD of the rocket. For instance, for 'A simple model rocket':
image

Here is an example plot of a CD plot for all rocket components of 'A simple model rocket':

combined_plots

Exporting

Configuring an export is very similar to a sim export. The only difference is that you must specify for which rocket components you wish to export a data type. If no components are selected, a warning dialog will appear and that data type will be ignored during the export.

Here's is an example export for a Three-staged rocket:

# Parameters:;Wind direction:;54°;Angle of attack:;0°;Roll rate:;0 r/s;Active stages:;Sustainer;Flight configuration:;[C6-5]
# 121 data points written for 4 variables.
# Mach number;CP (A simple model rocket) (cm);CP (Body tube) (cm);CNα (Trapezoidal fin set) (​);CNα (A simple model rocket) (​)
0;31.933;12.5;9.876;11.876
0.025;31.933;12.5;9.876;11.876
0.05;31.934;12.5;9.878;11.878
0.075;31.936;12.5;9.881;11.881
0.1;31.938;12.5;9.886;11.886
0.125;31.941;12.5;9.892;11.892
0.15;31.944;12.5;9.899;11.899
0.175;31.948;12.5;9.907;11.907
0.2;31.952;12.5;9.917;11.917
...

Imported in Excel:
image

Demo

Screen.Recording.2024-08-27.at.02.01.02.mp4

Additional notes

For this PR to work, I refactored all the plot and export UI code from the simulation plot/export, so we wouldn't have to maintain duplicate code. I also had to re-implement #2530 for the refactored code.

SiboVG added 30 commits August 13, 2024 02:55
@SiboVG
Copy link
Member Author

SiboVG commented Aug 28, 2024

Note: I think this PR will become very useful in conjunction with the RASAero export feature, because RASAero has a feature called "Aero Plots" which basically does the same as this PR's Component Analysis Plot. So, we could compare the results and see where OR differs.

For instance, OR's result:

image

RASAero's result:

image

I don't know if this is comparing apples to oranges (the reference area is the same for OR and RASAero though), but there is already a noticeable difference between the two programs.

CP comparison:

image

RASAero:

image

@neilweinstock
Copy link
Contributor

This is a major tentpole feature for the next release. Very impressive.

I confess I've never really needed this for my own use, so I'm not entirely sure how to exercise it well. I was curious about one thing, though: I have a sim from someone else that is very large and complex. Opening up the plot tab yields this:
image

Two things here:

  1. Choosing from the very large list of components is pretty unwieldy. I'm guessing they're in component tree order, but the end result in this particular case is that it would be virtually impossible to pick out what you want. It is probably true that the people who use this feature will do so with much simpler models, so this might not be an issue that really needs to be addressed, at least not yet.

  2. I enlarged the dialog as much as I good to spread out the list.... the bottom section (below the scrolling window) expanded as I enlarged the window. That section should be fixed size, and all the expansion should go to the scrolling window. Just a layout tweak I think.

@SiboVG
Copy link
Member Author

SiboVG commented Aug 29, 2024

  1. Choosing from the very large list of components is pretty unwieldy. I'm guessing they're in component tree order, but the end result in this particular case is that it would be virtually impossible to pick out what you want. It is probably true that the people who use this feature will do so with much simpler models, so this might not be an issue that really needs to be addressed, at least not yet.

Wow, it never even occurred to me to have that many components. :) I guess in the future we could change it to a button "Select Components" and a label underneath showing the already selected components. The button would open a new dialog with the component tree, where you can select which components to add. I would grey out and disable components in the component tree that are not relevant for the data type (e.g. only fins have roll characteristics), and have a click behavior where clicking once will toggle the component selection, instead of having to hold Ctrl/Cmd to do multi-component selection.

We could also change the component combobox in the plot panel with a button "Select Component" which has similar behavior, but with only single-component selection. (Or we can change the behavior to have multi-component selection in the plot panel instead of having to add a new Y axis type for each component, and then have the component series be split up automatically; don't know).

2. I enlarged the dialog as much as I good to spread out the list.... the bottom section (below the scrolling window) expanded as I enlarged the window. That section should be fixed size, and all the expansion should go to the scrolling window. Just a layout tweak I think.

I'll see what I can do.

@SiboVG
Copy link
Member Author

SiboVG commented Aug 29, 2024

2. I enlarged the dialog as much as I good to spread out the list.... the bottom section (below the scrolling window) expanded as I enlarged the window. That section should be fixed size, and all the expansion should go to the scrolling window. Just a layout tweak I think.

Fixed.

@neilweinstock
Copy link
Contributor

  1. Choosing from the very large list of components is pretty unwieldy. I'm guessing they're in component tree order, but the end result in this particular case is that it would be virtually impossible to pick out what you want. It is probably true that the people who use this feature will do so with much simpler models, so this might not be an issue that really needs to be addressed, at least not yet.

Wow, it never even occurred to me to have that many components. :) I guess in the future we could change it to a button "Select Components" and a label underneath showing the already selected components. The button would open a new dialog with the component tree, where you can select which components to add. I would grey out and disable components in the component tree that are not relevant for the data type (e.g. only fins have roll characteristics), and have a click behavior where clicking once will toggle the component selection, instead of having to hold Ctrl/Cmd to do multi-component selection.

Yeah that's not a normal or typical sim. :)

I think what you have right now is probably good for initial release, and we can enhance in the future as needed.

@JoePfeiffer
Copy link
Contributor

Oh, this is great. As always!

@JoePfeiffer JoePfeiffer merged commit b1a7812 into openrocket:unstable Aug 29, 2024
@SiboVG SiboVG deleted the issue-2525 branch August 29, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Ability to plot/export component analysis parameters in terms of Mach (+ roll rate, AOA, ...?)

3 participants