Skip to content

Conversation

@ufechner7
Copy link
Member

@ufechner7 ufechner7 commented Oct 7, 2025

  • Add function vsm_settings
  • Add docstrings
  • Add example load_extra_settings.jl
  • Add fpc_settings.yaml for the example above
  • Add script reuse_lint

@ufechner7 ufechner7 self-assigned this Oct 7, 2025
@ufechner7 ufechner7 linked an issue Oct 7, 2025 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ufechner7 ufechner7 requested a review from Copilot October 7, 2025 17:36
Copy link

Copilot AI left a 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_settings function 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.

@ufechner7 ufechner7 requested a review from jellepoland October 7, 2025 17:53
Copy link

@jellepoland jellepoland left a 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

@ufechner7
Copy link
Member Author

Remark: Currently, VortexStepMethod.jl does not depend on KiteUtils. Do you want to change that?

@jellepoland
Copy link

I guess yes?
That would be the reason for this update right?
To be able to streamline the yaml inputs through system.yaml, when using several packages --including VSM

@jellepoland
Copy link

@ufechner7

Can you also include the same as "vsm_settings", but then:
for an "aero_geometry.yaml" and a "struc_geometry.yaml" ?

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.

Adding VSMSettings

4 participants