示例#1
0
def main():
    
    #initialize the problem
    nexus                        = Nexus()
    vehicle = vehicle_setup()
    nexus.vehicle_configurations = configs_setup(vehicle)
    nexus.analyses               = Analyses.setup(nexus.vehicle_configurations)
    nexus.missions               = Missions.setup(nexus.analyses)
    
    #problem = Data()
    #nexus.optimization_problem       = problem
    nexus.procedure                  = setup()
    nexus.sizing_loop                = Sizing_Loop()
    nexus.total_number_of_iterations = 0
    
    evaluate_problem(nexus)
    results = nexus.results

    err      = nexus.sizing_loop.norm_error
    err_true = 0.00975078 #for 1E-2 tol
    error    = abs((err-err_true)/err)
    print 'error = ', error
    assert(error<1e-5), 'sizing loop regression failed'    
    
    #output=nexus._really_evaluate() #run; use optimization setup without inputs
    return
示例#2
0
def main():

    #initialize the problem
    nexus = Nexus()
    vehicle = vehicle_setup()
    nexus.vehicle_configurations = configs_setup(vehicle)
    nexus.analyses = Analyses.setup(nexus.vehicle_configurations)
    nexus.missions = Missions.setup(nexus.analyses)

    problem = Data()
    problem_inputs = np.array([
        ['dummy', 1., (.1, 10.), 1., ' continuous', Units.less],
        ['dummy2', 2., (.1, 10.), 1., ' continuous', Units.less],
    ])  #create dummy inputs for optimization to test io
    problem.inputs = problem_inputs
    nexus.optimization_problem = problem
    nexus.procedure = setup()
    sizing_loop = Sizing_Loop()
    sizing_loop.output_filename = 'sizing_outputs.txt'
    nexus.sizing_loop = sizing_loop

    #create a fake array of data to test outputs
    write_sizing_outputs(sizing_loop, np.array([6.]), [5., 5.])
    write_sizing_outputs(sizing_loop, np.array([12.]), [4., 1.])
    write_sizing_outputs(sizing_loop, np.array([11.]), [1., 3.])

    nexus.total_number_of_iterations = 0
    evaluate_problem(nexus)
    results = nexus.results
    err = nexus.sizing_loop.norm_error

    err_true = 0.0008433474527249522  #for 1E-2 tol
    error = abs((err - err_true) / err_true)

    data_inputs, data_outputs, read_success = read_sizing_residuals(
        sizing_loop, problem.inputs)
    check_read_res = -0.06803060191281879

    error_res = (data_outputs[1][0] - check_read_res) / check_read_res

    #remove files for later
    os.remove('sizing_outputs.txt')
    os.remove('y_err_values.txt')
    print('error = ', error)
    print('error_res = ', error_res)
    assert (error < 1e-4), 'sizing loop regression failed'
    assert (error_res < 1e-4), 'sizing loop io failed'

    return
示例#3
0
def main():

    #initialize the problem
    nexus = Nexus()
    vehicle = vehicle_setup()
    nexus.vehicle_configurations = configs_setup(vehicle)
    nexus.analyses = Analyses.setup(nexus.vehicle_configurations)
    nexus.missions = Missions.setup(nexus.analyses)

    nexus.procedure = setup()
    nexus.sizing_loop = Sizing_Loop()
    nexus.total_number_of_iterations = 0

    evaluate_problem(nexus)
    results = nexus.results

    err = nexus.sizing_loop.norm_error
    err_true = 0.0096907307307155348  #for 1E-2 tol
    error = abs((err_true - err) / err_true)
    print 'error = ', error
    assert (error < 1e-6), 'sizing loop regression failed'

    return
示例#4
0
def main():
    
    #initialize the problem
    nexus                        = Nexus()
    vehicle = vehicle_setup()
    nexus.vehicle_configurations = configs_setup(vehicle)
    nexus.analyses               = Analyses.setup(nexus.vehicle_configurations)
    nexus.missions               = Missions.setup(nexus.analyses)
    
    nexus.procedure                  = setup()
    nexus.sizing_loop                = Sizing_Loop()
    nexus.total_number_of_iterations = 0
    
    evaluate_problem(nexus)
    results = nexus.results

    err      = nexus.sizing_loop.norm_error
    err_true = 0.0096907307307155348#for 1E-2 tol
    error    = abs((err_true-err)/err_true)
    print 'error = ', error
    assert(error<1e-6), 'sizing loop regression failed'    
    
    return