def test_subassembly(self): logging.debug('') logging.debug('test_subassembly') top = set_as_top(Assembly()) sub = top.add('sub', Assembly()) top.driver.workflow.add('sub') cid = sub.add('driver', CaseIteratorDriver()) sub.add('comp1', TracedComponent()) sub.add('comp2', TracedComponent()) cid.workflow.add(('comp1', 'comp2')) cid.add_parameter('comp1.inp') cid.add_parameter('comp2.inp') cid.add_response('comp1.itername') cid.add_response('comp2.itername') # Sequential. cid.case_inputs.comp1.inp = range(3) cid.case_inputs.comp2.inp = range(3) top.run() self.verify_itername(cid, subassembly=True) # Concurrent. sub.driver.sequential = False cid.case_inputs.comp1.inp = range(3) cid.case_inputs.comp2.inp = range(3) top.run() self.verify_itername(cid, subassembly=True)
def configure(self): self.add('p', DummyComp()) cid = self.add('cid', CaseIteratorDriver()) self.driver.workflow.add('cid') cid.workflow.add('p') cid.sequential = False cid.reload_model = False cid.add_parameter('p.x_in') cid.add_parameter('p.y_in') cid.add_response('p.x_out') cid.add_response('p.y_out') self.add('parab', Paraboloidish()) self.driver.workflow.add('parab') self.create_passthrough('cid.case_inputs.p.x_in') self.create_passthrough('cid.case_inputs.p.y_in') self.connect('cid.case_outputs.p.x_out', 'parab.x') self.connect('cid.case_outputs.p.y_out', 'parab.y') self.create_passthrough('parab.f_xy')
def test_connections(self): logging.debug('') logging.debug('test_connections') top = Assembly() top.add('generator', Generator()) cid = top.add('cid', CaseIteratorDriver()) top.add('driven', DrivenComponent()) top.add('verifier', Verifier()) top.driver.workflow.add(('generator', 'cid', 'verifier')) cid.workflow.add('driven') cid.add_parameter('driven.x') cid.add_parameter('driven.y') cid.add_response('driven.rosen_suzuki') cid.add_response('driven.sum_y') top.connect('generator.x', 'cid.case_inputs.driven.x') top.connect('generator.y', 'cid.case_inputs.driven.y') top.connect('generator.x', 'verifier.x') top.connect('generator.y', 'verifier.y') top.connect('cid.case_outputs.driven.rosen_suzuki', 'verifier.rosen_suzuki') top.connect('cid.case_outputs.driven.sum_y', 'verifier.sum_y') top.run()
def configure(self): self.add('a', A()) self.add('driver', CaseIteratorDriver()) self.driver.add_parameter('a.x') self.driver.add_response('a.X') self.driver.workflow.add('a')
def configure_AEPWindRose(self): """Generic configure method for AEPSingleWindRose and AEPMultipleWindRoses. After this configure method is called, some connections are hanging loose: - if wind_rose_type == 'single': - case_gen.wind_rose - if wind_rose_type == 'multiple': - case_gen.wt_layout Examples -------- ### In a single wind rose case: def configure(self): self.add('case_gen', SingleWindRoseCaseGenerator()) self.add('postprocess_wind_rose', PostProcessSingleWindRose()) configure_AEPWindRose(self) self.connect('wind_rose', 'case_gen.wind_rose') ### In a multiple wind rose case: def configure(self): self.add('case_gen', MultipleWindRosesCaseGenerator()) self.add('postprocess_wind_rose', PostProcessMultipleWindRoses()) configure_AEPWindRose(self) self.connect('wt_layout', 'case_gen.wt_layout') """ # Adding self.add('driver', Driver()) self.add('wind_rose_driver', CaseIteratorDriver()) self.add_default('wf', GenericWindFarm()) self.add_default('case_gen', GenericWindRoseCaseGenerator()) self.add_default('postprocess_wind_rose', GenericPostProcessWindRose()) # Drivers configuration self.wind_rose_driver.workflow.add('wf') self.wind_rose_driver.add_parameter('wf.wind_speed') self.wind_rose_driver.add_parameter('wf.wind_direction') self.wind_rose_driver.add_responses( ['wf.power', 'wf.wt_power', 'wf.wt_thrust']) self.driver.workflow.add( ['case_gen', 'wind_rose_driver', 'postprocess_wind_rose']) # wiring self.connect('wind_speeds', ['case_gen.wind_speeds', 'postprocess_wind_rose.wind_speeds']) self.connect( 'wind_directions', ['case_gen.wind_directions', 'postprocess_wind_rose.wind_directions']) self.connect('case_gen.all_wind_speeds', 'wind_rose_driver.case_inputs.wf.wind_speed') self.connect('case_gen.all_wind_directions', 'wind_rose_driver.case_inputs.wf.wind_direction') self.connect('case_gen.all_frequencies', 'postprocess_wind_rose.frequencies') self.connect('wind_rose_driver.case_outputs.wf.power', 'postprocess_wind_rose.powers') self.connect('postprocess_wind_rose.net_aep', 'net_aep') self.connect('postprocess_wind_rose.array_aep', 'array_aep')
def configure(self): self.add('c', PTComp()) self.add('driver', CaseIteratorDriver()) self.driver.workflow.add(['c']) self.driver.add_parameter('c.i') self.driver.add_response('c.o') self.driver.case_inputs.c.i = range(10)
def configure(self): self.add('driver', CaseIteratorDriver()) self.add('acomp', AComp()) self.driver.workflow.add('acomp') self.driver.add_parameter('acomp.inp') self.driver.add_response('acomp.out') self.driver.case_inputs.acomp.inp = [0, 1, 2]
def configure(self): super(SweepOpt, self).configure() opt = self.add('opt', SLSQPdriver()) opt.add_parameter('wing_weight.cbar', low=.3, high=5) opt.add_parameter('wing_weight.b', low=5, high=100) opt.add_parameter('wing_weight.fos', low=2.3, high=4) opt.add_parameter('wing_weight.y_pod', low=0, high=15) #spanwise location of the outboard pods opt.add_objective('level.drag') opt.add_constraint('level.Cl < 1.1') opt.add_constraint('wing_weight.tip_slope - .1 < 0') #IDF #state variables opt.add_parameter('level.alpha', low=0, high=5, start=3) opt.add_parameter('turning.alpha', low=0, high=10, start=3) #compatibility constraints opt.add_constraint( '(level.lift/9.81 - (wing_weight.M_tot + fuse_weight.M_tot))/2500 = 0 ' ) opt.add_constraint( '(turning.lift/9.81 - (turning.load_factor * (wing_weight.M_tot + fuse_weight.M_tot)))/1200 = 0' ) sweep = self.add('driver', CaseIteratorDriver()) sweep.workflow.add('opt') sweep.add_parameter('fuse_weight.N_pilot')
def __init__(self, extra_reqs=None): """ Create assembly with Sleeper as sole component. """ super(CID, self).__init__() self.add('sleeper', Sleeper()) self.add('driver', CaseIteratorDriver()) self.driver.extra_reqs = extra_reqs self.driver.workflow.add('sleeper') self.driver.log_level = logging.DEBUG
def configure(self): self.add('c', ConnectC()) self.add('driver', CaseIteratorDriver()) self.driver.sequential = self.sequential self.driver.workflow.add('c') self.driver.add_parameter('c.i1') self.driver.add_response('c.o1') self.connect('i1', 'driver.case_inputs.c.i1') self.connect('driver.case_outputs.c.o1', 'o1')
def configure(self): driver = self.add('driver', CaseIteratorDriver()) self.add('driven', DrivenComponent()) driver.workflow.add('driven') driver.add_parameter('driven.x') driver.add_parameter('driven.y') driver.add_parameter('driven.raise_error') driver.add_response('driven.rosen_suzuki') driver.add_response('driven.sum_y')
def configure(self): self.add("model", self.instance) self.add("driver", CaseIteratorDriver()) self.driver.workflow.add('model') self.driver.add_parameter("model.x", low=0, high=1) self.driver.add_response("model.f_x") self.driver.case_inputs.model.x = self.cases self.create_passthrough('driver.case_inputs.model.x') self.create_passthrough('driver.case_outputs.model.f_x')
def configure(self): self.add('cid', CaseIteratorDriver()) self.driver.workflow.add('cid') self.create_passthrough('cid.sequential') # default to parallel execution of cases self.sequential = False self.cid.add_parameter('case_id') self.create_passthrough('cid.case_inputs.case_id', alias='case_ids') # input file writer self.add('input', HAWC2SInputWriter()) self.input.log_level = logging.DEBUG # HAWC2S wrapper self.add('wrapper', HAWC2Wrapper()) self.wrapper.log_level = logging.DEBUG self.connect('input.Flag', 'wrapper.Flag') # output reader self.add('output', HAWC2SOutputIDO()) self.connect('wrapper.OutputFlag', 'output.OutputFlag') self.output.log_level = logging.DEBUG self.cid.workflow.add(['input', 'wrapper', 'output']) # Input variable initialization self.input.from_file = True self.connect('model_name+case_id', 'input.case_id') self.create_passthrough('input.set_tsr_flag') # Wrapper variable initialization self.wrapper.solver = 'HAWC2S' self.create_passthrough('wrapper.hawc2bin') self.connect('model_name+case_id', 'wrapper.case_id') self.connect('model_name+case_id', 'output.case_id') self.wrapper.copyback_results = False # add parameters and responses self.cid.add_parameter('input.vartrees') self.create_passthrough('cid.case_inputs.input.vartrees') self.cid.add_response('output.rotor_loads') self.cid.add_response('output.blade_loads') self.cid.add_response('output.hub_loads') self.cid.add_response('output.blade_disps') self.cid.add_response('output.oper') self.create_passthrough('cid.case_outputs.output.rotor_loads') self.create_passthrough('cid.case_outputs.output.blade_loads') self.create_passthrough('cid.case_outputs.output.hub_loads') self.create_passthrough('cid.case_outputs.output.blade_disps') self.create_passthrough('cid.case_outputs.output.oper')
def configure(self): self.add('a', SimpleComp()) self.add('b', SimpleComp()) self.add('c', SimpleComp()) self.add('d', Aggregator()) self.connect('a.out1', 'b.in1') self.connect('b.out1', 'c.in1') self.add('cid_driver', CaseIteratorDriver()) # self.add('cid_driver', SimpleCaseIterDriver()) #note, using "new" parameter interface that does not require low/high self.cid_driver.add_parameter('b.in2') self.cid_driver.add_parameter('c.in2') #tells the driver which values from the MP runs are of interest, # allows us to create extra variables only for the needed values #output arrays created on the driver on the fly, with no size # determined until runtime #variable names have no special meaning, just chosen for clarity here self.cid_driver.add_response('b.out1') self.cid_driver.add_response('b.out2') self.cid_driver.add_response('c.out1') #vtree inputs created on the fly based on parameters given #number of multi-point executions given at runtime based on length of # inputs, all inputs must be same length self.cid_driver.case_inputs.b.in2 = [1, 2, 3, 4, 5, 6] self.cid_driver.case_inputs.c.in2 = [0, 1, 0, 1, 0, 1] #d is a component that does mp_aggregation #NOTE: d is expecting arrays of equal length self.connect('cid_driver.case_outputs.b.out1', 'd.in1') self.connect('cid_driver.case_outputs.b.out2', 'd.in2') self.connect('cid_driver.case_outputs.c.out1', 'd.in3') #Options: # 1) d could be a very simple component that requires all the array # data to be pulled onto one processor # 2) d could be a more advanced component that works with distributed # vectors to do aggregation operations (like sum or norm) #Possibly could make a setting or two different MPIMultiPoint drivers # to control this behavior. #One would require a standard array output. The other a distributed # vector. I'm not sure what the right answer is... self.driver.workflow.add(['a', 'cid_driver', 'd']) self.cid_driver.workflow.add(['b', 'c'])
def becas_configure_stress_recovery(kls): # uncomment to keep Sim-* directories # import os # os.environ['OPENMDAO_KEEPDIRS'] = '1' kls.add('blade_strength', BECASStressRecovery()) kls.driver.workflow.add('blade_strength') cls = kls.blade_strength cls.add('cid', CaseIteratorDriver()) cls.driver.workflow.add('cid') cls.create_passthrough('cid.sequential') cls.sequential = False # add becas cls.add('becas', BECASWrapper()) cls.cid.workflow.add('becas') cls.becas.exec_mode = 'octave' cls.becas.analysis_mode = 'stress_recovery' cls.create_passthrough('becas.path_becas') # add parameters and responses cls.cid.add_parameter('becas.load_cases') cls.cid.add_response('becas.max_failure') cls.cid.add_response('becas.max_failure_ks') cls.connect('load_cases', 'cid.case_inputs.becas.load_cases') # cls.create_passthrough('cid.case_inputs.becas.load_cases') # cls.cid.add_response('becas.stress') # cls.cid.add_response('becas.strain') # add postprocessing components cls.add('process_failure', ProcessFailures()) cls.add('process_failure_ks', ProcessFailures()) cls.driver.workflow.add(['process_failure', 'process_failure_ks']) cls.connect('cid.case_outputs.becas.max_failure', 'process_failure.failureIn') cls.connect('cid.case_outputs.becas.max_failure_ks', 'process_failure_ks.failureIn') cls.connect('process_failure.max_failure', 'failure') cls.create_passthrough('process_failure_ks.max_failure', alias='failure_ks') cls.log_level = logging.DEBUG cls.becas.log_level = logging.DEBUG
def configure(self): self.add('c0', C0_vt()) self.add('c1', C1_vt()) cid = self.add('parallel_driver', CaseIteratorDriver()) self.driver.workflow.add(['c0', 'parallel_driver']) N = 10 self.c0.N = N cid.workflow.add(['c1']) cid.add_parameter('c1.i') cid.add_response('c1.val') cid.case_inputs.c1.i = range(N) self.connect('c0.vt', 'c1.vt')
def setUp(self): self.top = top = set_as_top(Assembly()) driver = top.add('driver', CaseIteratorDriver()) top.add('comp1', TExecComp(exprs=['z=x+y'])) top.add('comp2', ExecComp(exprs=['z=x+1'])) top.connect('comp1.z', 'comp2.x') driver.workflow.add(['comp1', 'comp2']) # now create some Cases outputs = ['comp1.z', 'comp2.z'] cases = [] for i in range(10): inputs = [('comp1.x', i), ('comp1.y', i * 2)] cases.append(Case(inputs=inputs, outputs=outputs)) Case.set_vartree_inputs(driver, cases) driver.add_responses(outputs)
def __init__(self): """Creates an Assembly to run DREA and HSRnoise.""" super(DREA_HSRnoise, self).__init__() FO1 = Case(inputs=[('point', 1),('dreaprep.Mach',0.28),('alt',2000.0),('dreaprep.PC',100.0),('hsrnoise.phi', 0.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) FO2 = Case(inputs=[('point', 1),('dreaprep.Mach',0.28),('alt',2000.0),('dreaprep.PC', 65.0),('hsrnoise.phi', 0.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) App = Case(inputs=[('point', 2),('dreaprep.Mach',0.20),('alt', 394.0),('dreaprep.PC', 30.0),('hsrnoise.phi', 0.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) SL1 = Case(inputs=[('point', 3),('dreaprep.Mach',0.25),('alt',1000.0),('dreaprep.PC',100.0),('hsrnoise.phi', 0.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) SL2 = Case(inputs=[('point', 3),('dreaprep.Mach',0.25),('alt',1000.0),('dreaprep.PC',100.0),('hsrnoise.phi',30.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) SL3 = Case(inputs=[('point', 3),('dreaprep.Mach',0.25),('alt',1000.0),('dreaprep.PC',100.0),('hsrnoise.phi',60.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) SL4 = Case(inputs=[('point', 3),('dreaprep.Mach',0.25),('alt',1000.0),('dreaprep.PC',100.0),('hsrnoise.phi',90.0)], outputs=[('drea.CFG',0.0),('hsrnoise.thetas',0.0),('hsrnoise.Freq',0.0),('hsrnoise.SPL_corr',0),('hsrnoise.OASPL30',0.0),('hsrnoise.OASPL60',0.0),('hsrnoise.OASPL90',0.0),('hsrnoise.OASPL120',0.0),('hsrnoise.OASPL150',0.0)]) cases = ListCaseIterator([FO1,FO2,App,SL1,SL2,SL3,SL4]) db_recorder = DBCaseRecorder() self.add('geo', Geometry()) self.add('dreaprep', DREAprep()) self.add('drea', DREA()) self.add('hsrnoise', HSRNOISE()) self.add('ACDgen', ACDgen()) self.add('analysis',CaseIteratorDriver()) self.analysis.iterator = cases self.analysis.recorders = [db_recorder] self.ACDgen.case_data = db_recorder.get_iterator() # Set up the workflows #--------------------------- #self.analysis.workflow.add(['dreaprep', 'drea', 'hsrnoise']) #self.driver.workflow.add(['analysis','ACDgen']) self.driver.workflow.add(['dreaprep', 'drea', 'hsrnoise']) # Connections #--------------------------- self.connect('geo',['drea.geo_in','hsrnoise.geo_in']) self.connect('alt',['dreaprep.alt','hsrnoise.ALTEVO']) self.connect('dreaprep.flow_out','drea.flow_in') self.connect('drea.flow_out','hsrnoise.flow_in') self.connect('drea.CFG','hsrnoise.CFG')
def configure(self): # Expensive and Cheap DOE (note: have to be nested) doe_e = [0.0, 0.4, 0.6, 1.0] doe_c = [0.1, 0.2, 0.3, 0.5, 0.7, 0.8, 0.9] + doe_e self.add('hifi_cases', CasesBuilder(HighFidelityModel(), doe_e)) self.add('lofi_cases', CasesBuilder(LowFidelityModel(), doe_c)) # MetaModel self.add( "meta_model", MultiFiMetaModel(params=('x', ), responses=('f_x', ), nfi=self.nfi)) self.meta_model.default_surrogate = self.surrogate self.connect('hifi_cases.x', 'meta_model.params.x') self.connect('hifi_cases.f_x', 'meta_model.responses.f_x') if self.nfi > 1: self.connect('lofi_cases.x', 'meta_model.params.x_fi2') self.connect('lofi_cases.f_x', 'meta_model.responses.f_x_fi2') # Iteration Hierarchy self.add('mm_checker', CaseIteratorDriver()) self.add('model', Model()) self.mm_checker.add_parameter("meta_model.x", low=0, high=1) self.mm_checker.add_parameter("model.x", low=0, high=1) self.mm_checker.add_response("model.f_x") self.mm_checker.add_response("meta_model.f_x") ngrid = 100 self.mm_checker.case_inputs.meta_model.x = np.linspace(0, 1, ngrid) self.mm_checker.case_inputs.model.x = np.linspace(0, 1, ngrid) self.driver.workflow.add('hifi_cases') if self.nfi > 1: self.driver.workflow.add('lofi_cases') self.driver.workflow.add('mm_checker')
def configure(self): # Create Optimizer instance self.add('driver', CaseIteratorDriver()) # Create component instances self.add('input_list', Input_List()) self.add('postprocess', Postprocess_Fuzzy_Outputs()) self.add('compatibility', checkCompatibility()) #PHI SYSTEM self.add('fuzz_combine_phi', Build_Fuzzy_Input()) self.add('phi_sys', Fuzzy_System()) #Lift/Drag SYSTEM self.add('fuzz_combine_LD', Build_Fuzzy_Input()) self.add('LoD_sys', Fuzzy_System()) #FoM SYSTEM self.add('fuzz_combine_FoM', Build_Fuzzy_Input()) self.add('FoM_sys', DFES()) #Propulsive Efficiency System self.add('fuzz_combine_etaP', Build_Fuzzy_Input()) self.add('etaP_sys', Fuzzy_System()) #QUANTIFICATION self.add('quantifyPHI', Quantify()) self.add('quantifySFC', Quantify()) #RF SYSTEMs self.add('fuzz_combine_GWT', Build_Fuzzy_Input()) self.add('GWT_sys', DFES()) self.add('fuzz_combine_P', Build_Fuzzy_Input()) self.add('P_sys', DFES()) self.add('fuzz_combine_VH', Build_Fuzzy_Input()) self.add('VH_sys', DFES()) # Iteration Hierarchy self.driver.workflow.add([ 'compatibility', 'input_list', 'fuzz_combine_phi', 'phi_sys', 'fuzz_combine_LD', 'LoD_sys', 'fuzz_combine_FoM', 'FoM_sys', 'fuzz_combine_etaP', 'etaP_sys', 'quantifyPHI', 'quantifySFC', 'GWT_sys', 'P_sys', 'VH_sys', 'postprocess' ]) self.connect('compatibility.option1_out', 'input_list.option1') self.connect('compatibility.option2_out', 'input_list.option2') self.connect('compatibility.option3_out', 'input_list.option3') self.connect('compatibility.option4_out', 'input_list.option4') self.connect('compatibility.option5_out', 'input_list.option5') self.connect('compatibility.option6_out', 'input_list.option6') self.connect('compatibility.option7_out', 'input_list.option7') self.connect('compatibility.option8_out', 'input_list.option8') self.connect('compatibility.option9_out', 'input_list.option9') self.connect('compatibility.compatibility', 'input_list.passthrough') self.connect('compatibility.compatibility', 'postprocess.passthrough') self.connect('compatibility.incompatCount', 'postprocess.incompatCount') self.connect('compatibility.compatibility', 'phi_sys.passthrough') self.connect('compatibility.compatibility', 'LoD_sys.passthrough') self.connect('compatibility.compatibility', 'FoM_sys.passthrough') self.connect('compatibility.compatibility', 'etaP_sys.passthrough') self.connect('compatibility.compatibility', 'GWT_sys.passthrough') self.connect('compatibility.compatibility', 'P_sys.passthrough') self.connect('compatibility.compatibility', 'VH_sys.passthrough') self.connect('compatibility.compatibility', 'quantifyPHI.passthrough') self.connect('compatibility.compatibility', 'quantifySFC.passthrough') ## CONNECT phi system #connect inputs for phi system self.connect("input_list.VL_SYS_TYPE_phi", "fuzz_combine_phi.in_1.input_value") self.connect("input_list.VL_SYS_TYPE_w", "fuzz_combine_phi.in_2.input_value") self.connect("input_list.VL_SYS_TYPE_f", "fuzz_combine_phi.in_3.input_value") self.connect("input_list.VL_SYS_PROP_w", "fuzz_combine_phi.in_4.input_value") self.connect("input_list.VL_SYS_PROP_phi", "fuzz_combine_phi.in_5.input_value") self.connect("input_list.VL_SYS_TECH_phi", "fuzz_combine_phi.in_6.input_value") self.connect("input_list.VL_SYS_TECH_w", "fuzz_combine_phi.in_7.input_value") self.connect("input_list.VL_SYS_TECH_f", "fuzz_combine_phi.in_8.input_value") self.connect("input_list.VL_SYS_TECH_LD", "fuzz_combine_phi.in_9.input_value") self.connect("input_list.FWD_SYS_PROP_eta_p", "fuzz_combine_phi.in_10.input_value") self.connect("input_list.FWD_SYS_DRV_eta_d", "fuzz_combine_phi.in_11.input_value") self.connect("input_list.FWD_SYS_TYPE_phi", "fuzz_combine_phi.in_12.input_value") self.connect("input_list.FWD_SYS_TYPE_TP", "fuzz_combine_phi.in_13.input_value") self.connect("input_list.WING_SYS_TYPE_LD", "fuzz_combine_phi.in_14.input_value") self.connect("input_list.WING_SYS_TYPE_f", "fuzz_combine_phi.in_15.input_value") self.connect("fuzz_combine_phi.system_inputs", "phi_sys.input_list") self.connect("fuzz_combine_phi.runFlag_out", "phi_sys.runFlag_in") self.postprocess.fuzzSys_in_1.mf_key = 'sys_phi' self.connect('phi_sys.outputs_all', 'postprocess.fuzzSys_in_1.mf_dict') ## CONNECT LoD System self.connect("input_list.SYSTEM_f", "fuzz_combine_LD.in_1.input_value") self.connect("input_list.WING_LoD", "fuzz_combine_LD.in_2.input_value") self.connect("fuzz_combine_LD.system_inputs", "LoD_sys.input_list") self.connect("fuzz_combine_LD.runFlag_out", "LoD_sys.runFlag_in") self.postprocess.fuzzSys_in_2.mf_key = 'sys_LoD' self.connect('LoD_sys.outputs_all', 'postprocess.fuzzSys_in_2.mf_dict') ## CONNECT FoM System self.connect("input_list.VL_SYS_e_d", "fuzz_combine_FoM.in_1.input_value") self.connect("input_list.VL_SYS_PROP_sigma", "fuzz_combine_FoM.in_2.input_value") self.connect("input_list.VL_SYS_w", "fuzz_combine_FoM.in_3.input_value") self.connect("input_list.VL_SYS_DRV_eta_d", "fuzz_combine_FoM.in_4.input_value") self.connect("fuzz_combine_FoM.system_inputs", "FoM_sys.input_list") self.connect("fuzz_combine_FoM.runFlag_out", "FoM_sys.runFlag_in") self.postprocess.fuzzSys_in_3.mf_key = 'sys_FoM' self.connect('FoM_sys.outputs_all', 'postprocess.fuzzSys_in_3.mf_dict') ## CONNECT etaP System self.connect("input_list.FWD_SYS_eta_p", "fuzz_combine_etaP.in_1.input_value") self.connect("input_list.FWD_DRV_eta_d", "fuzz_combine_etaP.in_2.input_value") self.connect("fuzz_combine_etaP.system_inputs", "etaP_sys.input_list") self.connect("fuzz_combine_etaP.runFlag_out", "etaP_sys.runFlag_in") self.postprocess.fuzzSys_in_4.mf_key = 'sys_etaP' self.connect('etaP_sys.outputs_all', 'postprocess.fuzzSys_in_4.mf_dict') self.postprocess.PLOTMODE = 0 ## CONNECT RF Systems self.connect('phi_sys.outputs_all', 'quantifyPHI.inDict') #key defined below self.connect('input_list.ENG_SYS_TYPE_SFC', 'quantifySFC.qualVal') #GWT: self.connect("quantifyPHI.quantVal", "fuzz_combine_GWT.in_1.input_value") self.connect("input_list.VL_SYS_w", "fuzz_combine_GWT.in_2.input_value") self.connect("input_list.WING_SYS_TYPE_WS", "fuzz_combine_GWT.in_3.input_value") self.connect("etaP_sys.outputs_all", "fuzz_combine_GWT.inDict_1.input_dict") self.connect("input_list.VL_SYS_DRV_eta_d", "fuzz_combine_GWT.in_4.input_value") self.connect("FoM_sys.outputs_all", "fuzz_combine_GWT.inDict_2.input_dict") self.connect("input_list.VL_SYS_e_d", "fuzz_combine_GWT.in_5.input_value") self.connect("quantifySFC.quantVal", "fuzz_combine_GWT.in_6.input_value") self.connect("input_list.SYS_type", "fuzz_combine_GWT.in_7.input_value") #self.connect("input_list.SYS_tech", "fuzz_combine_GWT.in_8.input_value") self.connect("fuzz_combine_GWT.system_inputs", "GWT_sys.input_list") self.connect("fuzz_combine_GWT.runFlag_out", "GWT_sys.runFlag_in") self.postprocess.fuzzSys_in_5.mf_key = 'sys_GWT' self.connect('GWT_sys.outputs_all', 'postprocess.fuzzSys_in_5.mf_dict') #Power Installed: self.connect("quantifyPHI.quantVal", "fuzz_combine_P.in_1.input_value") self.connect("input_list.VL_SYS_w", "fuzz_combine_P.in_2.input_value") self.connect("input_list.WING_SYS_TYPE_WS", "fuzz_combine_P.in_3.input_value") self.connect("etaP_sys.outputs_all", "fuzz_combine_P.inDict_1.input_dict") self.connect("input_list.VL_SYS_DRV_eta_d", "fuzz_combine_P.in_4.input_value") self.connect("FoM_sys.outputs_all", "fuzz_combine_P.inDict_2.input_dict") self.connect("input_list.VL_SYS_e_d", "fuzz_combine_P.in_5.input_value") self.connect("quantifySFC.quantVal", "fuzz_combine_P.in_6.input_value") self.connect("input_list.SYS_type", "fuzz_combine_P.in_7.input_value") #self.connect("input_list.SYS_tech", "fuzz_combine_P.in_8.input_value") self.connect("fuzz_combine_P.system_inputs", "P_sys.input_list") self.connect("fuzz_combine_P.runFlag_out", "P_sys.runFlag_in") self.postprocess.fuzzSys_in_6.mf_key = 'sys_P' self.connect('P_sys.outputs_all', 'postprocess.fuzzSys_in_6.mf_dict') #VH: self.connect("quantifyPHI.quantVal", "fuzz_combine_VH.in_1.input_value") self.connect("input_list.VL_SYS_w", "fuzz_combine_VH.in_2.input_value") self.connect("input_list.WING_SYS_TYPE_WS", "fuzz_combine_VH.in_3.input_value") self.connect("etaP_sys.outputs_all", "fuzz_combine_VH.inDict_1.input_dict") self.connect("input_list.VL_SYS_DRV_eta_d", "fuzz_combine_VH.in_4.input_value") self.connect("FoM_sys.outputs_all", "fuzz_combine_VH.inDict_2.input_dict") self.connect("input_list.VL_SYS_e_d", "fuzz_combine_VH.in_5.input_value") self.connect("quantifySFC.quantVal", "fuzz_combine_VH.in_6.input_value") self.connect("input_list.SYS_type", "fuzz_combine_VH.in_7.input_value") #self.connect("input_list.SYS_tech", "fuzz_combine_VH.in_8.input_value") self.connect("fuzz_combine_VH.system_inputs", "VH_sys.input_list") self.connect("fuzz_combine_VH.runFlag_out", "VH_sys.runFlag_in") self.postprocess.fuzzSys_in_7.mf_key = 'sys_VH' self.connect('VH_sys.outputs_all', 'postprocess.fuzzSys_in_7.mf_dict') ###### # Design Variables self.input_list.input_file = 'data/morphInputs_13Jun15.csv' ## SET VARIABLES phi system self.phi_sys.TESTMODE = 0 self.phi_sys.TESTPLOT = 0 self.phi_sys.fcl_file = 'FCL_files/FRBS_phi/PHIsys_trained_5-2In9-2Out_gauss250tData_50vData_optInputsBEST_GA.fcl' self.fuzz_combine_phi.in_1.input_key = 'VL_SYS_TYPE_phi' self.fuzz_combine_phi.in_2.input_key = 'VL_SYS_TYPE_w' self.fuzz_combine_phi.in_3.input_key = 'VL_SYS_TYPE_f' self.fuzz_combine_phi.in_4.input_key = 'VL_SYS_PROP_w' self.fuzz_combine_phi.in_5.input_key = 'VL_SYS_PROP_phi' self.fuzz_combine_phi.in_6.input_key = 'VL_SYS_TECH_phi' self.fuzz_combine_phi.in_7.input_key = 'VL_SYS_TECH_w' self.fuzz_combine_phi.in_8.input_key = 'VL_SYS_TECH_f' self.fuzz_combine_phi.in_9.input_key = 'VL_SYS_TECH_LD' self.fuzz_combine_phi.in_10.input_key = 'FWD_SYS_PROP_eta_p' self.fuzz_combine_phi.in_11.input_key = 'FWD_SYS_DRV_eta_d' self.fuzz_combine_phi.in_12.input_key = 'FWD_SYS_TYPE_phi' self.fuzz_combine_phi.in_13.input_key = 'FWD_SYS_TYPE_TP' self.fuzz_combine_phi.in_14.input_key = 'WING_SYS_TYPE_LD' self.fuzz_combine_phi.in_15.input_key = 'WING_SYS_TYPE_f' ## SET VARIABLES LoD system self.LoD_sys.TESTMODE = 0 self.LoD_sys.TESTPLOT = 0 self.LoD_sys.fcl_file = 'FCL_files/LoDsys_simple_13Jun15.fcl' self.fuzz_combine_LD.in_1.input_key = 'SYSTEM_f' self.fuzz_combine_LD.in_2.input_key = 'WING_LoD' ## SET VARIABLES FoM system self.FoM_sys.weight_file = 'FCL_files/DFES_FoM/DFES_FOMdata_data(500)_nodes(160_50_50).nwf' self.FoM_sys.inRanges = { 'VL_SYS_e_d': [0.0, 0.3], 'VL_SYS_PROP_sigma': [0.05, 0.4], 'VL_SYS_w': [0., 150.], 'VL_SYS_DRV_eta': [0.5, 1.0], } self.FoM_sys.inOrder = [ 'VL_SYS_e_d', 'VL_SYS_w', 'VL_SYS_DRV_eta', 'VL_SYS_PROP_sigma' ] self.FoM_sys.outRanges = {'sys_FoM': [0.4, 1.0]} self.FoM_sys.actType = 'sigmoid' self.FoM_sys.hidNodes = 160 self.FoM_sys.inGran = 50 self.FoM_sys.outGran = 50 self.FoM_sys.TESTPLOT = 0 self.fuzz_combine_FoM.in_1.input_key = 'VL_SYS_e_d' self.fuzz_combine_FoM.in_2.input_key = 'VL_SYS_PROP_sigma' self.fuzz_combine_FoM.in_3.input_key = 'VL_SYS_w' self.fuzz_combine_FoM.in_4.input_key = 'VL_SYS_DRV_eta' ## SET VARIABLES etaP system self.etaP_sys.TESTMODE = 0 self.etaP_sys.TESTPLOT = 0 self.etaP_sys.fcl_file = 'FCL_files/etaPsys_simple_14Aug15.fcl' self.fuzz_combine_etaP.in_1.input_key = 'FWD_SYS_eta_p' self.fuzz_combine_etaP.in_2.input_key = 'FWD_DRV_eta_d' ## SET VARIABLES RF systems self.quantifyPHI.quantRange = [0.85, 0.50] self.quantifyPHI.inKey = 'sys_phi' self.quantifySFC.quantRange = [0.75, 0.35] ## SET VARIABLES RF: #GWT: self.GWT_sys.weight_file = 'FCL_files/DFES_RF/BEST/RFdata20Aug_DFES_GWT_30_250_50.nwf' self.GWT_sys.inRanges = { 'SYSTEM_QUANT_PHI': [0.5, 0.85], 'VL_SYS_w': [1., 150.], 'WING_SYS_TYPE_WS': [15., 300.], 'sys_etaP': [0.6, 1.0], 'VL_SYS_DRV_eta_d': [0.7, 1.0], 'sys_FoM': [0.3, 1.0], 'VL_SYS_e_d': [0.0, 0.3], 'ENG_SYS_TYPE_SFC': [0.35, 0.75], 'SYS_type': [0.5, 3.5], } self.GWT_sys.inOrder = [ 'VL_SYS_e_d', 'WING_SYS_TYPE_WS', 'SYSTEM_QUANT_PHI', 'SYS_type', 'VL_SYS_DRV_eta_d', 'sys_FoM', 'VL_SYS_w', 'sys_etaP', 'ENG_SYS_TYPE_SFC' ] #['SYSTEM_QUANT_PHI', 'VL_SYS_w', 'WING_SYS_TYPE_WS', 'sys_etaP', # 'VL_SYS_DRV_eta_d', 'sys_FoM','VL_SYS_e_d', 'ENG_SYS_TYPE_SFC', 'SYS_type'] self.GWT_sys.outRanges = {'sys_GWT': [5000, 50000]} self.GWT_sys.actType = 'sigmoid' self.GWT_sys.hidNodes = 250 self.GWT_sys.inGran = 30 self.GWT_sys.outGran = 50 self.fuzz_combine_GWT.in_1.input_key = 'SYSTEM_QUANT_PHI' self.fuzz_combine_GWT.in_2.input_key = 'VL_SYS_w' self.fuzz_combine_GWT.in_3.input_key = 'WING_SYS_TYPE_WS' self.fuzz_combine_GWT.inDict_1.input_keys = ['sys_etaP'] self.fuzz_combine_GWT.in_4.input_key = 'VL_SYS_DRV_eta_d' self.fuzz_combine_GWT.inDict_2.input_keys = ['sys_FoM'] self.fuzz_combine_GWT.in_5.input_key = 'VL_SYS_e_d' self.fuzz_combine_GWT.in_6.input_key = 'ENG_SYS_TYPE_SFC' self.fuzz_combine_GWT.in_7.input_key = 'SYS_type' #self.fuzz_combine_GWT.in_8.input_key ='SYS_tech' #P installed: self.P_sys.weight_file = 'FCL_files/DFES_RF/BEST/RFdata20Aug_DFES_Pin_30_250_50.nwf' self.P_sys.TESTPLOT = 0 self.P_sys.inRanges = { 'SYSTEM_QUANT_PHI': [0.5, 0.85], 'VL_SYS_w': [1., 150.], 'WING_SYS_TYPE_WS': [15., 300.], 'sys_etaP': [0.6, 1.0], 'VL_SYS_DRV_eta_d': [0.7, 1.0], 'sys_FoM': [0.3, 1.0], 'VL_SYS_e_d': [0.0, 0.3], 'ENG_SYS_TYPE_SFC': [0.35, 0.75], 'SYS_type': [0.5, 3.5], } self.P_sys.inOrder = [ 'VL_SYS_e_d', 'WING_SYS_TYPE_WS', 'SYSTEM_QUANT_PHI', 'SYS_type', 'VL_SYS_DRV_eta_d', 'sys_FoM', 'VL_SYS_w', 'sys_etaP', 'ENG_SYS_TYPE_SFC' ] #['SYSTEM_QUANT_PHI', 'VL_SYS_w', 'WING_SYS_TYPE_WS', 'sys_etaP', # 'VL_SYS_DRV_eta_d', 'sys_FoM','VL_SYS_e_d', 'ENG_SYS_TYPE_SFC', 'SYS_type'] self.P_sys.outRanges = {'sys_P': [1000, 15000]} self.P_sys.actType = 'sigmoid' self.P_sys.hidNodes = 250 self.P_sys.inGran = 30 self.P_sys.outGran = 50 self.fuzz_combine_P.in_1.input_key = 'SYSTEM_QUANT_PHI' self.fuzz_combine_P.in_2.input_key = 'VL_SYS_w' self.fuzz_combine_P.in_3.input_key = 'WING_SYS_TYPE_WS' self.fuzz_combine_P.inDict_1.input_keys = ['sys_etaP'] self.fuzz_combine_P.in_4.input_key = 'VL_SYS_DRV_eta_d' self.fuzz_combine_P.inDict_2.input_keys = ['sys_FoM'] self.fuzz_combine_P.in_5.input_key = 'VL_SYS_e_d' self.fuzz_combine_P.in_6.input_key = 'ENG_SYS_TYPE_SFC' self.fuzz_combine_P.in_7.input_key = 'SYS_type' #self.fuzz_combine_P.in_8.input_key ='SYS_tech' #VH: self.VH_sys.weight_file = 'FCL_files/DFES_RF/BEST/RFdata20Aug_DFES_VH_40_250_50.nwf' self.VH_sys.inRanges = { 'SYSTEM_QUANT_PHI': [0.5, 0.85], 'VL_SYS_w': [1., 150.], 'WING_SYS_TYPE_WS': [15., 300.], 'sys_etaP': [0.6, 1.0], 'VL_SYS_DRV_eta_d': [0.7, 1.0], 'sys_FoM': [0.3, 1.0], 'VL_SYS_e_d': [0.0, 0.3], 'ENG_SYS_TYPE_SFC': [0.35, 0.75], 'SYS_type': [0.5, 3.5], } self.VH_sys.inOrder = [ 'VL_SYS_e_d', 'WING_SYS_TYPE_WS', 'SYSTEM_QUANT_PHI', 'SYS_type', 'VL_SYS_DRV_eta_d', 'sys_FoM', 'VL_SYS_w', 'sys_etaP', 'ENG_SYS_TYPE_SFC' ] #['SYSTEM_QUANT_PHI', 'VL_SYS_w', 'WING_SYS_TYPE_WS', 'sys_etaP', #'VL_SYS_DRV_eta_d', 'sys_FoM','VL_SYS_e_d', 'ENG_SYS_TYPE_SFC', 'SYS_type'] self.VH_sys.outRanges = {'sys_VH': [200, 500]} self.VH_sys.actType = 'sigmoid' self.VH_sys.hidNodes = 250 self.VH_sys.inGran = 40 self.VH_sys.outGran = 50 self.fuzz_combine_VH.in_1.input_key = 'SYSTEM_QUANT_PHI' self.fuzz_combine_VH.in_2.input_key = 'VL_SYS_w' self.fuzz_combine_VH.in_3.input_key = 'WING_SYS_TYPE_WS' self.fuzz_combine_VH.inDict_1.input_keys = ['sys_etaP'] self.fuzz_combine_VH.in_4.input_key = 'VL_SYS_DRV_eta_d' self.fuzz_combine_VH.inDict_2.input_keys = ['sys_FoM'] self.fuzz_combine_VH.in_5.input_key = 'VL_SYS_e_d' self.fuzz_combine_VH.in_6.input_key = 'ENG_SYS_TYPE_SFC' self.fuzz_combine_VH.in_7.input_key = 'SYS_type' # CONFIGURE DRIVER self.driver.iprint = 0 # Driver Flags self.driver.add_parameter( 'compatibility.option1') #list of options as input self.driver.add_parameter( 'compatibility.option2') #list of options as input self.driver.add_parameter( 'compatibility.option3') #list of options as input self.driver.add_parameter( 'compatibility.option4') #list of options as input self.driver.add_parameter( 'compatibility.option5') #list of options as input self.driver.add_parameter( 'compatibility.option6') #list of options as input self.driver.add_parameter( 'compatibility.option7') #list of options as input self.driver.add_parameter( 'compatibility.option8') #list of options as input self.driver.add_parameter( 'compatibility.option9') #list of options as input self.driver.add_response( 'postprocess.ranges_out') #output from system (dict) self.driver.add_response( 'postprocess.response_1') #output from system (dict) self.driver.add_response( 'postprocess.response_1_r') #output from system (dict) self.driver.add_response( 'postprocess.response_2') #output from system (dict) self.driver.add_response( 'postprocess.response_2_r') #output from system (dict) self.driver.add_response( 'postprocess.response_3') #output from system (dict) self.driver.add_response( 'postprocess.response_3_r') #output from system (dict) self.driver.add_response( 'postprocess.response_4') #output from system (dict) self.driver.add_response( 'postprocess.response_4_r') #output from system (dict) self.driver.add_response( 'postprocess.response_5') #output from system (dict) self.driver.add_response( 'postprocess.response_5_r') #output from system (dict) self.driver.add_response( 'postprocess.response_6') #output from system (dict) self.driver.add_response( 'postprocess.response_6_r') #output from system (dict) self.driver.add_response( 'postprocess.response_7') #output from system (dict) self.driver.add_response( 'postprocess.response_7_r') #output from system (dict) #TEST ALTERNATIVES: """ tests = [ [5, 1, 1, 1, 1, 1, 1, 1, 1], [5, 1, 1, 1, 1, 1, 1, 3, 1], [5, 1, 1, 1, 1, 1, 2, 1, 3],] self.driver.case_inputs.compatibility.option1 = [t[0] for t in tests] self.driver.case_inputs.compatibility.option2 = [t[1] for t in tests] self.driver.case_inputs.compatibility.option3 = [t[2] for t in tests] self.driver.case_inputs.compatibility.option4 = [t[3] for t in tests] self.driver.case_inputs.compatibility.option5 = [t[4] for t in tests] self.driver.case_inputs.compatibility.option6 = [t[5] for t in tests] self.driver.case_inputs.compatibility.option7 = [t[6] for t in tests] self.driver.case_inputs.compatibility.option8 = [t[7] for t in tests] self.driver.case_inputs.compatibility.option9 = [t[8] for t in tests] """ #PRE-SELECTED ALTERNATIVES: """ self.driver.case_inputs.compatibility.option1 = [2, 2, 4, 4, 1, 1, 6, 4, 1, 5] self.driver.case_inputs.compatibility.option2 = [2, 1, 3, 3, 2, 2, 2, 3, 2, 3] self.driver.case_inputs.compatibility.option3 = [1, 1, 3, 1, 2, 1, 1, 1, 2, 1] self.driver.case_inputs.compatibility.option4 = [2, 2, 1, 2, 3, 5, 2, 1, 5, 1] self.driver.case_inputs.compatibility.option5 = [2, 1, 4, 3, 4, 1, 2, 1, 4, 3] self.driver.case_inputs.compatibility.option6 = [1, 1, 3, 1, 3, 1, 1, 1, 3, 1] self.driver.case_inputs.compatibility.option7 = [2, 2, 1, 2, 1, 1, 2, 1, 1, 4] self.driver.case_inputs.compatibility.option8 = [1, 5, 2, 4, 6, 1, 1, 4, 1, 1] self.driver.case_inputs.compatibility.option9 = [1, 1, 2, 1, 3, 1, 1, 1, 3, 4] """ #CREATE RANDOM ALTERNTIVES: """ n = 10000 self.driver.case_inputs.compatibility.option1 = [random.randrange(1,7) for i in range(n)] self.driver.case_inputs.compatibility.option2 = [random.randrange(1,4) for i in range(n)] self.driver.case_inputs.compatibility.option3 = [random.randrange(1,4) for i in range(n)] self.driver.case_inputs.compatibility.option4 = [random.randrange(1,6) for i in range(n)] self.driver.case_inputs.compatibility.option5 = [random.randrange(1,5) for i in range(n)] self.driver.case_inputs.compatibility.option6 = [random.randrange(1,4) for i in range(n)] self.driver.case_inputs.compatibility.option7 = [random.randrange(1,5) for i in range(n)] self.driver.case_inputs.compatibility.option8 = [random.randrange(1,7) for i in range(n)] self.driver.case_inputs.compatibility.option9 = [random.randrange(1,5) for i in range(n)] """ #ALL COMPATIBLE COMBOS: nMax = None o_cases = [[] for i in range(9)] with open('compatCombos.csv', 'rb') as csvfile: reader = csv.reader(csvfile, delimiter=',') for row in reader: if int(row[1]) <> 4 and int(row[2]) <> 4: #remove bad options #print "case:", row for i in range(len(row)): o_cases[i].append(int(row[i])) #print "captured:", [o[-1] for o in o_cases] print len(o_cases[0]), "compatible combos read. Running cases..." #for i in range(len(o_cases)): o_cases[i] = list(reversed(o_cases[i]))[:1000] if nMax is None: self.driver.case_inputs.compatibility.option1 = o_cases[0] self.driver.case_inputs.compatibility.option2 = o_cases[1] self.driver.case_inputs.compatibility.option3 = o_cases[2] self.driver.case_inputs.compatibility.option4 = o_cases[3] self.driver.case_inputs.compatibility.option5 = o_cases[4] self.driver.case_inputs.compatibility.option6 = o_cases[5] self.driver.case_inputs.compatibility.option7 = o_cases[6] self.driver.case_inputs.compatibility.option8 = o_cases[7] self.driver.case_inputs.compatibility.option9 = o_cases[8] else: cnums = random.sample(range(len(o_cases[0])), nMax) self.driver.case_inputs.compatibility.option1 = [ o_cases[0][i] for i in cnums ] self.driver.case_inputs.compatibility.option2 = [ o_cases[1][i] for i in cnums ] self.driver.case_inputs.compatibility.option3 = [ o_cases[2][i] for i in cnums ] self.driver.case_inputs.compatibility.option4 = [ o_cases[3][i] for i in cnums ] self.driver.case_inputs.compatibility.option5 = [ o_cases[4][i] for i in cnums ] self.driver.case_inputs.compatibility.option6 = [ o_cases[5][i] for i in cnums ] self.driver.case_inputs.compatibility.option7 = [ o_cases[6][i] for i in cnums ] self.driver.case_inputs.compatibility.option8 = [ o_cases[7][i] for i in cnums ] self.driver.case_inputs.compatibility.option9 = [ o_cases[8][i] for i in cnums ] self.recorders = [CSVCaseRecorder(filename='randomCompatCases.csv')] self.recording_options.includes = [ 'compatibility.gen_num', 'compatibility.option1', 'compatibility.option2', 'compatibility.option3', 'compatibility.option4', 'compatibility.option5', 'compatibility.option6', 'compatibility.option7', 'compatibility.option8', 'compatibility.option9', "compatibility.compatibility", 'postprocess.response_1', 'postprocess.response_2', 'postprocess.response_3', 'postprocess.response_4', 'postprocess.response_5', 'postprocess.response_6', 'postprocess.response_7', 'postprocess.response_1_r', 'postprocess.response_2_r', 'postprocess.response_3_r', 'postprocess.response_4_r', 'postprocess.response_5_r', 'postprocess.response_6_r', 'postprocess.response_7_r', 'postprocess.response_1_POS', 'postprocess.response_2_POS', 'postprocess.response_3_POS', 'postprocess.response_4_POS', 'postprocess.response_5_POS', 'postprocess.response_6_POS', 'postprocess.response_7_POS', 'postprocess.fuzzyPOS' ] #if __name__ == "__main__": # None
def configure(self): # --------------------------------------------------------------------------- # # --- Instantiate Counter Component # --------------------------------------------------------------------------- # self.add('counter', DOECounterComp()) # --------------------------------------------------------------------------- # # --- Instantiate Subcounter Component # --------------------------------------------------------------------------- # self.add('subcounter', SubCounterComp()) # --------------------------------------------------------------------------- # # --- Instantiate Restart Component # --------------------------------------------------------------------------- # self.add('restart_doe', RestartComp()) # --------------------------------------------------------------------------- # # --- Instantiate NPSS Non-Reacting Component # --------------------------------------------------------------------------- # self.add('npss_nonreacting', NpssNonreacting()) self.npss_nonreacting.Comb_dPqPBase = init_dP() # --------------------------------------------------------------------------- # # --- Instantiate NPSS Reacting Component # --------------------------------------------------------------------------- # self.add('npss_reacting', NpssReacting()) self.npss_reacting.Comb_dPqPBase = init_dP() # --------------------------------------------------------------------------- # # --- Instantiate Geometry Component # --------------------------------------------------------------------------- # self.add('geometry', GeometryComp()) # --------------------------------------------------------------------------- # # --- Instantiate Mesh Component # --------------------------------------------------------------------------- # self.add('mesh', MeshComp()) # --------------------------------------------------------------------------- # # --- Instantiate NCC Non-reacting Component (1-Step Chemistry) # --------------------------------------------------------------------------- # self.add('ncc_nonreacting', NCCcomponent()) self.ncc_nonreacting.max_iterations_per_time_step = 40000 self.ncc_nonreacting.nonreacting = True self.ncc_nonreacting.continuity_goal = 2000 self.ncc_nonreacting.restarts = 40000 self.ncc_nonreacting.CFL = 0.8 self.ncc_nonreacting.mass_imbalance_goal = 1.0E-2 self.ncc_nonreacting.aero2 = -1.0E-3 self.ncc_nonreacting.k_e2 = -1.0E-3 self.ncc_nonreacting.species2 = -1.0E-3 self.ncc_nonreacting.enthalpy2 = -1.0E-3 self.ncc_nonreacting.aero4 = 0.05 self.ncc_nonreacting.k_e4 = 0.05 self.ncc_nonreacting.species4 = 0.05 self.ncc_nonreacting.enthalpy4 = 0.05 self.ncc_nonreacting.twall_run = 4.0 self.ncc_nonreacting._num_procs = 400 # --- Must be divisible by 20 to run on Ivy Bridge # --------------------------------------------------------------------------- # # --- Instantiate NCC Reacting Component (1-Step Chemistry) # --------------------------------------------------------------------------- # self.add('ncc_reacting', NCCcomponent()) self.ncc_reacting.reacting = True self.ncc_reacting.continuity_goal = 750 self.ncc_reacting.max_iterations_per_time_step = 15000 self.ncc_reacting.restarts = 15000 self.ncc_reacting.CFL = 0.8 self.ncc_reacting.pbcfl = 0.375 self.ncc_reacting.etau_beta = 0.15 self.ncc_reacting.mass_imbalance_goal = 1.0E-3 self.ncc_reacting.aux_var_name_list = "'unmixed' 'C12H23'" self.ncc_reacting.spec_name_ignite = 'C12H23' self.ncc_reacting.fuel_symbol = 'C12H23' self.ncc_reacting.combust = True self.ncc_reacting.lspray = True self.ncc_reacting.aero2 = -2.5E-3 self.ncc_reacting.k_e2 = -2.5E-3 self.ncc_reacting.species2 = -2.5E-3 self.ncc_reacting.enthalpy2 = -2.5E-3 self.ncc_reacting.aero4 = 0.05 self.ncc_reacting.k_e4 = 0.05 self.ncc_reacting.species4 = 0.05 self.ncc_reacting.enthalpy4 = 0.05 self.ncc_reacting.ignite_done_model = 0 self.ncc_reacting.ignition_on = True self.ncc_reacting.no_of_streams = 16 self.ncc_reacting.twall_run = 4.0 self.ncc_reacting._num_procs = 400 # --- Must be divisible by 20 to run on Ivy Bridge # --------------------------------------------------------------------------- # # --- Instantiate NCC Reacting Component (Detailed Chemistry) # --------------------------------------------------------------------------- # self.add('ncc_reacting2', NCCcomponent()) self.ncc_reacting2.reacting2 = True self.ncc_reacting2.continuity_goal = 750 self.ncc_reacting2.max_iterations_per_time_step = 10000 self.ncc_reacting2.restarts = 10000 self.ncc_reacting2.CFL = 0.9 self.ncc_reacting.pbcfl = 0.5 self.ncc_reacting2.mass_imbalance_goal = 1.0E-3 self.ncc_reacting2.aux_var_name_list = "'unmixed' 'C11H21'" self.ncc_reacting2.spec_name_ignite = 'C11H21' self.ncc_reacting2.fuel_symbol = 'C11H21' self.ncc_reacting2.combust = True self.ncc_reacting2.lspray = True self.ncc_reacting2.aero2 = -1.0E-3 self.ncc_reacting2.k_e2 = -1.0E-3 self.ncc_reacting2.species2 = -1.0E-3 self.ncc_reacting2.enthalpy2 = -1.0E-3 self.ncc_reacting2.aero4 = 0.05 self.ncc_reacting2.k_e4 = 0.05 self.ncc_reacting2.species4 = 0.05 self.ncc_reacting2.enthalpy4 = 0.05 self.ncc_reacting2.energy = 0.0001 self.ncc_reacting2.when_start_spray = 1 self.ncc_reacting2.ignite_done_model = 0 self.ncc_reacting2.ignition_on = True self.ncc_reacting2.twall_run = 7.5 self.ncc_reacting2._num_procs = 400 # --- Must be divisible by 20 to Run on Ivy Bridge # --------------------------------------------------------------------------- # # --- Instantiate Tecplot Nonreacting Component # --------------------------------------------------------------------------- # self.add('tecplot_nonreacting', TecplotComp()) self.tecplot_nonreacting.nonreacting = True # --------------------------------------------------------------------------- # # --- Instantiate Tecplot Reacting Spray Component # --------------------------------------------------------------------------- # self.add('tecplot_reacting', TecplotComp()) self.tecplot_reacting.reacting = True # --------------------------------------------------------------------------- # # --- Instantiate Tecplot Reacting Spray Component # --------------------------------------------------------------------------- # self.add('tecplot_reacting2', TecplotComp()) self.tecplot_reacting2.reacting2 = True # --------------------------------------------------------------------------- # # --- Create Driver Instances # --------------------------------------------------------------------------- # # --- Top Level Assembly Driver self.add('driver', IterateUntil()) self.driver.max_iterations = 1 self.driver.workflow = SequentialWorkflow() # --- Inner Nonreacting Driver (Fixed Point) self.add('nonreacting_driver', FixedPointIterator()) self.nonreacting_driver.workflow = SequentialWorkflow() self.nonreacting_driver.step_size = 0.125 self.nonreacting_driver.max_iteration = 1 self.nonreacting_driver.tolerance = 0.001 # --- Inner Reacting Driver self.add('reacting_driver', IterateUntil()) self.reacting_driver.max_iterations = 1 self.reacting_driver.workflow = SequentialWorkflow() # --- Inner Reacting Driver #2 self.add('reacting_driver2', IterateUntil()) self.reacting_driver2.max_iterations = 2 self.reacting_driver2.workflow = SequentialWorkflow() self.reacting_driver2.add_stop_condition( 'tecplot_reacting2.dTqTBase < 0.0025') # --- Run Design at All ICAO Power Settings self.add('power_hook', CaseIteratorDriver()) self.power_hook.workflow = SequentialWorkflow() self.power_hook.iterator = CSVCaseIterator(filename='ICAOsettings.csv') self.power_hook.workflow.add(['reacting_driver2']) # --------------------------------------------------------------------------- # # --- Create Main Assembly Workflow # --------------------------------------------------------------------------- # # --- Add component instances to top-level assembly #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'mesh', 'nonreacting_driver', 'reacting_driver', 'reacting_driver2']) #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'nonreacting_driver', 'reacting_driver', 'reacting_driver2']) #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'reacting_driver2']) #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'npss_nonreacting', 'npss_reacting']) self.driver.workflow.add( ['counter', 'restart_doe', 'geometry', 'power_hook']) # --------------------------------------------------------------------------- # # --- Create Sub-Assembly Workflows # --------------------------------------------------------------------------- # # --- Inner Nonreacting Loop - Solve via fixed point iteration self.nonreacting_driver.workflow.add([ 'subcounter', 'npss_nonreacting', 'ncc_nonreacting', 'tecplot_nonreacting' ]) # --- Add solver independents and dependents for fixed point iterator self.nonreacting_driver.add_parameter( ['npss_nonreacting.Comb_dPqPBase', 'npss_reacting.Comb_dPqPBase'], low=-9.e99, high=9.e99) self.nonreacting_driver.add_constraint( 'tecplot_nonreacting.dPqPBase = npss_nonreacting.Comb_dPqPBase') # --- Inner Reacting Loop - Run Once self.reacting_driver.workflow.add([ 'subcounter', 'npss_reacting', 'ncc_reacting', 'tecplot_reacting' ]) # --- Inner Reacting Loop #2 - Run Once self.reacting_driver2.workflow.add([ 'subcounter', 'npss_reacting', 'ncc_reacting2', 'tecplot_reacting2' ]) # --------------------------------------------------------------------------- # # --- Add Driver Events --- Comment this section out to override numbering # --------------------------------------------------------------------------- # if (self.subcounter._iteration == 0): self.driver.add_event('subcounter.reset_iteration') self.driver.add_event('ncc_nonreacting.clean_start') self.power_hook.add_event('subcounter.reset_iteration') self.power_hook.add_event('ncc_nonreacting.clean_start') # --------------------------------------------------------------------------- # # --- Specify Case Recorders # --------------------------------------------------------------------------- # self.driver.case_outputs = [ 'geometry.pilot_recession', 'geometry.vane_height', 'geometry.venturi_angle', 'nonreacting_driver.ncc_nonreacting.FAR', 'nonreacting_driver.tecplot_nonreacting.dPqPBase' ] self.power_hook.recorders = [DumpCaseRecorder()] # --------------------------------------------------------------------------- # # --- Create Data Connections # --------------------------------------------------------------------------- # self.connect('counter.config', [ 'subcounter.case', 'restart_doe.config', 'geometry.config', 'mesh.config' ]) self.connect('subcounter.config', [ 'ncc_nonreacting.config', 'ncc_reacting.config', 'ncc_reacting2.config', 'tecplot_nonreacting.config', 'tecplot_reacting.config', 'tecplot_reacting2.config' ]) self.connect('restart_doe.pilot_recession', ['geometry.pilot_recession', 'mesh.pilot_recession']) self.connect('restart_doe.venturi_angle', ['geometry.venturi_angle', 'mesh.venturi_angle']) self.connect('restart_doe.vane_height', ['geometry.vane_height', 'mesh.vane_height']) self.connect('geometry.injector_dia', [ 'ncc_nonreacting.injector_dia', 'ncc_nonreacting.bc1_Lmix', 'ncc_reacting.injector_dia', 'ncc_reacting.bc1_Lmix', 'ncc_reacting2.injector_dia', 'ncc_reacting2.bc1_Lmix' ]) self.connect('geometry.sector_area', [ 'npss_nonreacting.Inlet_Fl_O_Aphy', 'npss_nonreacting.Comb_Fl_O_Aphy', 'npss_nonreacting.Bld1_Fl_O_Aphy', 'npss_nonreacting.Bld2_Fl_O_Aphy' ]) self.connect('geometry.sector_area', [ 'npss_reacting.Inlet_Fl_O_Aphy', 'npss_reacting.Comb_Fl_O_Aphy', 'npss_reacting.Bld1_Fl_O_Aphy', 'npss_reacting.Bld2_Fl_O_Aphy' ]) self.connect('geometry.venturi_throat_area', [ 'npss_nonreacting.Conv_Duct_Fl_O_Aphy', 'npss_reacting.Conv_Duct_Fl_O_Aphy' ]) self.connect('geometry.venturi_exit_area', [ 'npss_nonreacting.Div_Duct_Fl_O_Aphy', 'npss_reacting.Div_Duct_Fl_O_Aphy' ]) self.connect('npss_nonreacting.Conv_Duct_Fl_O_W', 'ncc_nonreacting.bc1_mdot') self.connect('npss_nonreacting.Inlet_Fl_O_V', 'ncc_nonreacting.u_init') self.connect( 'npss_nonreacting.Inlet_Fl_O_Ts', ['ncc_nonreacting.bc1_Tstatic', 'ncc_nonreacting.Tstatic_init']) self.connect( 'npss_nonreacting.Comb_Fl_O_Ps', ['ncc_nonreacting.bc2_Pstatic', 'ncc_nonreacting.Pstatic_init']) self.connect('npss_nonreacting.Comb_Fl_O_Ts', 'ncc_nonreacting.bc2_Tstatic') self.connect('npss_nonreacting.Comb_FAR', 'ncc_nonreacting.FAR') self.connect('npss_nonreacting.Inlet_Fl_O_rhos', 'ncc_nonreacting.rho_air') self.connect('npss_nonreacting.Bld1_BldOut_W', 'ncc_nonreacting.bc7_mdot') self.connect('npss_nonreacting.Bld1_Fl_O_Ts', 'ncc_nonreacting.bc7_Tstatic') self.connect('npss_reacting.Conv_Duct_Fl_O_W', ['ncc_reacting.bc1_mdot', 'ncc_reacting2.bc1_mdot']) self.connect('npss_reacting.Inlet_Fl_O_Ts', ['ncc_reacting.bc1_Tstatic', 'ncc_reacting2.bc1_Tstatic']) self.connect('npss_reacting.Comb_Fl_O_Ps', [ 'ncc_reacting.bc2_Pstatic', 'ncc_reacting2.bc2_Pstatic', 'ncc_reacting.Pstatic_init', 'ncc_reacting2.Pstatic_init' ]) self.connect('npss_reacting.Comb_Fl_O_Ts', [ 'ncc_reacting.bc2_Tstatic', 'ncc_reacting2.bc2_Tstatic', 'ncc_reacting.Tstatic_init', 'ncc_reacting2.Tstatic_init' ]) self.connect('npss_reacting.Comb_FAR', ['ncc_reacting.FAR', 'ncc_reacting2.FAR']) self.connect('npss_reacting.Inlet_Fl_O_rhos', ['ncc_reacting.rho_air', 'ncc_reacting2.rho_air']) self.connect('npss_reacting.Bld1_BldOut_W', ['ncc_reacting.bc7_mdot', 'ncc_reacting2.bc7_mdot']) self.connect('npss_reacting.Bld1_Fl_O_Ts', ['ncc_reacting.bc7_Tstatic', 'ncc_reacting2.bc7_Tstatic'])
doe = self.add('driver', DOEdriver()) doe.DOEgenerator = Uniform(num_samples=1000) doe.add_parameter('paraboloid.x', low=-50, high=50) doe.add_parameter('paraboloid.y', low=-50, high=50) doe.case_outputs = ['paraboloid.f_xy'] doe.workflow.add('paraboloid') if __name__ == '__main__': analysis = Analysis() # Run full experiment and record results. recorder = ListCaseRecorder() analysis.driver.recorders = [recorder] analysis.run() # Reconfigure driver. workflow = analysis.driver.workflow analysis.add('driver', CaseIteratorDriver()) analysis.driver.workflow = workflow # Rerun cases where paraboloid.f_xy <= 0. analysis.driver.iterator = recorder.get_iterator() analysis.driver.filter = ExprCaseFilter("case['paraboloid.f_xy'] <= 0") analysis.run() # Rerun cases which failed. analysis.driver.iterator = recorder.get_iterator() analysis.driver.filter = ExprCaseFilter("case.msg") analysis.run()
def becas_configure_stiffness_calc(kls): # uncomment to keep Sim-* directories # import os # os.environ['OPENMDAO_KEEPDIRS'] = '1' kls.add('blade_beam_st', BECASBeamStructure()) kls.driver.workflow.add('blade_beam_st') cls = kls.blade_beam_st cls.add('cid', CaseIteratorDriver()) cls.driver.workflow.add('cid') cls.create_passthrough('cid.sequential') cls.sequential = False cls.add('a2b', CS2DtoBECAS()) cls.cid.workflow.add('a2b') cls.create_passthrough('a2b.path_shellexpander') cls.connect('becas_inputs', 'a2b.becas_inputs') cls.connect('section_name', 'a2b.section_name') # add BECAS mesh parameters cls.create_passthrough('a2b.total_points') cls.create_passthrough('a2b.max_layers') # add the CrossSectionStructureVT as parameter to the cid cls.cid.add_parameter('a2b.cs2d') # the parent assembly will connect to this with a list of cases # for each radial position cls.connect('cs2d', 'cid.case_inputs.a2b.cs2d') # declare outputs cls.cid.add_response('a2b.te_ratio') cls.create_passthrough('cid.case_outputs.a2b.te_ratio') # add becas cls.add('becas', BECASWrapper()) cls.cid.workflow.add('becas') cls.becas.exec_mode = 'octave' cls.becas.analysis_mode = 'stiffness' # connect path_input constructed by a2b to becas cls.connect('a2b.path_input', 'becas.path_input') cls.connect('a2b.cs2d.s/pf.blade_length', 'becas.spanpos') # path_becas needs to be set at runtime cls.create_passthrough('becas.path_becas') # declare outputs cls.cid.add_response('becas.hawc2_crossVT') cls.create_passthrough('cid.case_outputs.becas.hawc2_crossVT') # postprocess each case to generate the BeamStructureVT output # moved to parent assembly to avoid pickling error cls.add('postpro', ComputeHAWC2BeamProps()) cls.driver.workflow.add('postpro') cls.connect('pf', 'postpro.pf') cls.connect('cid.case_outputs.becas.hawc2_crossVT', 'postpro.cs2d_cases') cls.connect('postpro.beam_structure', 'beam_structure') cls.create_passthrough('postpro.mass') cls.create_passthrough('postpro.mass_moment') cls.create_passthrough('postpro.hub_radius') # uncomment to get full debug output cls.log_level = logging.DEBUG cls.a2b.log_level = logging.DEBUG cls.becas.log_level = logging.DEBUG
def configure(self): self.add('sleeper', Sleeper()) self.add('driver', CaseIteratorDriver()) self.driver.extra_reqs = self._extra_reqs self.driver.workflow.add('sleeper') self.driver.log_level = logging.DEBUG