def test_sweep_serial(): # set-up trial options options = awe.Options(True) # True refers to internal access switch options['user_options']['system_model']['architecture'] = {1: 0} options['user_options']['system_model']['kite_dof'] = 3 options['user_options']['kite_standard'] = awe.ampyx_data.data_dict() options['user_options']['tether_drag_model'] = 'split' options['user_options']['trajectory']['lift_mode']['windings'] = 1 options['user_options']['induction_model'] = 'not_in_use' options['nlp']['n_k'] = 2 options['solver']['max_iter'] = 0 # set-up sweep options sweep_opts = [(['nlp', 'discretization'], ['direct_collocation', 'multiple_shooting'])] # trial sweep sweep_opts = [(['user_options', 'wind', 'u_ref'], [5., 5.5])] # parametric sweep # build, run and save sweep sweep = awe.Sweep(name='serial_test', options=options, seed=sweep_opts) sweep.build() sweep.run(final_homotopy_step='initial') sweep.save('dict') # load and test sweep file_pi = open('serial_test.dict', 'rb') dict_test = pickle.load(file_pi) sweep_test = awe.Sweep(dict_test) file_pi.close() os.remove("serial_test.dict") sweep_test.plot(['all', 'comp_all'])
def test_visualization(): options = awe.Options(True) # basic options options['user_options']['system_model']['architecture'] = {1: 0} options['user_options']['trajectory']['lift_mode']['windings'] = 1 options['user_options']['kite_standard'] = awe.ampyx_data.data_dict() options['user_options']['trajectory']['type'] = 'lift_mode' options['user_options']['system_model']['kite_dof'] = 3 options['user_options']['induction_model'] = 'not_in_use' options['user_options']['tether_drag_model'] = 'trivial' options['nlp']['n_k'] = 2 options['solver']['max_iter'] = 0 # build trial and optimize trial = awe.Trial(options, 'trial1') trial.build() trial.optimize(final_homotopy_step='initial', debug_flags='all') # set flags and plot trial_flags = ['all'] trial.plot(trial_flags) # build sweep and run sweep_opts = [(['user_options', 'wind', 'u_ref'], [5., 5.5])] sweep = awe.Sweep(name='sweep_viz_test', options=options, seed=sweep_opts) sweep.run(final_homotopy_step='initial', debug_flags='all') # set flags and plot sweep_flags = [ 'all', 'comp_all', 'outputs:tether_length', 'comp_outputs:tether_length' ] sweep.plot(sweep_flags)
options['user_options']['wind']['u_ref'] = 5.0 # m/s options['user_options']['induction_model'] = 'not_in_use' options['user_options']['tether_drag_model'] = 'split' trial = awe.Trial(seed = options, name = 'opt_design') trial.build() trial.optimize() # fix params for wind speed sweep fixed_params = {} for name in list(trial.model.variables_dict['theta'].keys()): if ('diam' in name) or (name == 'l_s'): fixed_params[name] = trial.optimization.V_final['theta',name].full() options['user_options']['trajectory']['fixed_params'] = fixed_params ######################## # SET-UP SWEEP OPTIONS # ######################## sweep_opts = [(['user_options', 'wind', 'u_ref'], np.linspace(3,15,5, endpoint=True))] ################## # OPTIMIZE SWEEP # ################## sweep = awe.Sweep(name = 'dual_kites_power_curve', options = options, seed = sweep_opts) sweep.build() sweep.run() sweep.plot('comp_stats', 'comp_convergence') plt.show()