-
Notifications
You must be signed in to change notification settings - Fork 1
Add function vsm_settings #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new vsm_settings function to retrieve vortex step model settings filenames, following the same pattern as existing settings functions for flight path controller, flight path planner, and winch controller.
- Added
vsm_settingsfunction with proper docstring documentation - Created example code demonstrating how to load extra settings from YAML files
- Updated system configuration to include VSM settings file reference
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/settings.jl | Added vsm_settings function with docstring, improved comment in fpp_settings |
| src/KiteUtils.jl | Exported the new vsm_settings function |
| examples/load_extra_settings.jl | Added example demonstrating FPC settings loading pattern |
| data/system.yaml | Added VSM settings file reference to system configuration |
| data/fpc_settings.yaml | Added FPC settings configuration file for the example |
| REUSE.toml | Updated copyright annotations to include new settings file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
jellepoland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, looks exactly like we discussed.
Do I understand it correctly that I could now:
Extend system.yaml to :
system:
sim_settings: "settings.yaml"
vsm_settings: "vsm_settings.yaml"
and then load the setting using:
vsm_settings = vsm_settings(filename)
Or I guess integrate it into this function (see: https://github.com/OpenSourceAWE/VortexStepMethod.jl/blob/main/src/settings.jl)
@Base.kwdef mutable struct VSMSettings
condition::ConditionSettings = ConditionSettings()
wings::Vector{WingSettings} = []
solver_settings::SolverSettings = SolverSettings()
end
function VSMSettings(filename)
# Uwe's suggested 3-line approach using StructMapping.jl (adapted)
data = YAML.load_file(joinpath("data", filename))
# Use StructMapping for basic structure conversion
# But handle special fields manually due to enum conversion needs
vsm_settings = VSMSettings()
# Convert condition settings using StructMapping (if present)
if haskey(data, "condition")
vsm_settings.condition = convertdict(ConditionSettings, data["condition"])
end
# Convert wing settings manually due to enum conversions
n_panels = 0
n_groups = 0
if haskey(data, "wings")
for wing_data in data["wings"]
wing = WingSettings()
wing.name = wing_data["name"]
if haskey(wing_data, "geometry_file")
wing.geometry_file = wing_data["geometry_file"]
end
wing.n_panels = wing_data["n_panels"]
wing.n_groups = wing_data["n_groups"]
wing.spanwise_panel_distribution = eval(Symbol(wing_data["spanwise_panel_distribution"]))
wing.spanwise_direction = MVec3(wing_data["spanwise_direction"])
wing.remove_nan = wing_data["remove_nan"]
push!(vsm_settings.wings, wing)
n_panels += wing.n_panels
n_groups += wing.n_groups
end
end
# Convert solver settings using StructMapping base, then override special fields
if haskey(data, "solver_settings")
solver_data = data["solver_settings"]
# Create a copy of solver_data with string fields for enums removed
solver_data_clean = copy(solver_data)
delete!(solver_data_clean, "aerodynamic_model_type")
delete!(solver_data_clean, "type_initial_gamma_distribution")
# Use StructMapping for the basic fields
vsm_settings.solver_settings = convertdict(SolverSettings, solver_data_clean)
# Handle enum conversions manually
vsm_settings.solver_settings.aerodynamic_model_type = eval(Symbol(solver_data["aerodynamic_model_type"]))
vsm_settings.solver_settings.type_initial_gamma_distribution = eval(Symbol(solver_data["type_initial_gamma_distribution"]))
# Override with calculated totals
vsm_settings.solver_settings.n_panels = n_panels
vsm_settings.solver_settings.n_groups = n_groups
end
return vsm_settings
end
|
Remark: Currently, VortexStepMethod.jl does not depend on KiteUtils. Do you want to change that? |
|
I guess yes? |
|
Can you also include the same as "vsm_settings", but then: |
Uh oh!
There was an error while loading. Please reload this page.