Skip to content

Automatic Motor Optimization #204

Open
@mvccogo

Description

It would be interesting to have an option in the "Tools" dropdown list to automatically find a suitable motor given the parameters proposed by the user. I've done a similar thing using scipy.optimize, and some of you may be familiar with Matlab's fminsearch/fmincon.

The parameters given as constraints are:

  • Mean Pressure: average pressure developed after a simulation
  • Port ratio: set minimum Port/Throat ratio to reduce effects of erosive burning
  • Peak Pressure: peak pressure developed after a simulation
  • Kn variation: maximum allowed Kn variation throughout the burn
  • Maximum Mass Flux: reduce effects of erosive burning

The parameters given as input/goals are:

  • Total impulse

The parameters given as bounds are:

  • Min and Max outer diameter (BATES)
  • Min and Max inner diameter (BATES)
  • Min and Max length (BATES)

The output design parameters are:

  • Number of grains
  • Length of grains
  • Inner and outer diameter of grains
  • Nozzle configuration

Python code as a concept:

def optimize_for_impulse():
    constraint = [{'type' : 'ineq', 'fun' : restraint_mean_pressure},              
                  {'type' : 'ineq', 'fun' : restraint_port_ratio},                    
                  {'type' : 'ineq', 'fun' : restraint_peak_pressure},               
                  {'type' : 'ineq', 'fun' : restraint_kn_variation},                  
                  {'type' : 'ineq', 'fun' : restraint_mass_flux}]                     
    bounds = ((0.005, 0.01), (0.05, 0.225), (0.003, 0.015))                    
    it = 0
    while (True):
        initial_guess = [random.uniform(0.005, 0.03664*0.6), random.uniform (0.1, 0.225), random.uniform(0.005, 0.015)]
        a = optimize.minimize(optimize_total_impulse, initial_guess, bounds=bounds, constraints=constraint ) 
        if a.success and a.fun < 10:
            return a.x, it
        elif it > 500:
            print("No suitable configuration was found in ", it, "iterations.")
            break
        it += 1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions