Пример #1
0
def create_new_calc_obj(init_obj, x, fat_dict=None):
    '''
    Returns a new calculation object to be used in optimization
    :param init_obj:
    :return:
    '''
    x_old = [
        init_obj.get_s(),
        init_obj.get_plate_thk(),
        init_obj.get_web_h(),
        init_obj.get_web_thk(),
        init_obj.get_fl_w(),
        init_obj.get_fl_thk(),
        init_obj.get_span(),
        init_obj.get_lg()
    ]

    sigma_y1_new = stress_scaling(init_obj.get_sigma_y1(),
                                  init_obj.get_plate_thk(), x[1])
    sigma_y2_new = stress_scaling(init_obj.get_sigma_y2(),
                                  init_obj.get_plate_thk(), x[1])
    tau_xy_new = stress_scaling(init_obj.get_tau_xy(),
                                init_obj.get_plate_thk(), x[1])
    sigma_x_new = stress_scaling_area(init_obj.get_sigma_x(),
                                      sum(get_field_tot_area(x_old)),
                                      sum(get_field_tot_area(x)))
    try:
        stf_type = x[8]
    except IndexError:
        stf_type = init_obj.get_stiffener_type()

    main_dict = {
        'mat_yield': [init_obj.get_fy(), 'Pa'],
        'span': [init_obj.get_span(), 'm'],
        'spacing': [x[0], 'm'],
        'plate_thk': [x[1], 'm'],
        'stf_web_height': [x[2], 'm'],
        'stf_web_thk': [x[3], 'm'],
        'stf_flange_width': [x[4], 'm'],
        'stf_flange_thk': [x[5], 'm'],
        'structure_type': [init_obj.get_structure_type(), ''],
        'stf_type': [stf_type, ''],
        'sigma_y1': [sigma_y1_new, 'MPa'],
        'sigma_y2': [sigma_y2_new, 'MPa'],
        'sigma_x': [sigma_x_new, 'MPa'],
        'tau_xy': [tau_xy_new, 'MPa'],
        'plate_kpp': [init_obj.get_kpp(), ''],
        'stf_kps': [init_obj.get_kps(), ''],
        'stf_km1': [init_obj.get_km1(), ''],
        'stf_km2': [init_obj.get_km2(), ''],
        'stf_km3': [init_obj.get_km3(), '']
    }
    if fat_dict == None:
        return calc.CalcScantlings(main_dict), None
    else:
        return calc.CalcScantlings(main_dict), calc.CalcFatigue(
            main_dict, fat_dict)
Пример #2
0
def get_geo_opt_object():
    dicts = ({'mat_yield': [355000000.0, 'Pa'], 'span': [4.0, 'm'], 'spacing': [0.7, 'm'], 'plate_thk': [0.015, 'm'],
             'stf_web_height': [0.4, 'm'], 'stf_web_thk': [0.012, 'm'], 'stf_flange_width': [0.15, 'm'],
             'stf_flange_thk': [0.02, 'm'], 'structure_type': ['BOTTOM', ''], 'plate_kpp': [1, ''], 'stf_kps': [1, ''],
             'stf_km1': [12, ''], 'stf_km2': [24, ''], 'stf_km3': [12, ''], 'sigma_y1': [80, 'MPa'],
             'sigma_y2': [80, 'MPa'], 'sigma_x': [80, 'MPa'], 'tau_xy': [5, 'MPa'], 'stf_type': ['T', '']},
             {'mat_yield': [355000000.0, 'Pa'], 'span': [4.0, 'm'], 'spacing': [0.7, 'm'], 'plate_thk': [0.015, 'm'],
              'stf_web_height': [0.4, 'm'], 'stf_web_thk': [0.012, 'm'], 'stf_flange_width': [0.15, 'm'],
              'stf_flange_thk': [0.02, 'm'], 'structure_type': ['BOTTOM', ''], 'plate_kpp': [1, ''],
              'stf_kps': [1, ''], 'stf_km1': [12, ''], 'stf_km2': [24, ''], 'stf_km3': [12, ''],
              'sigma_y1': [80, 'MPa'], 'sigma_y2': [80, 'MPa'], 'sigma_x': [80, 'MPa'], 'tau_xy': [5, 'MPa'],
              'stf_type': ['T', '']},
             {'mat_yield': [355000000.0, 'Pa'], 'span': [4.0, 'm'], 'spacing': [0.7, 'm'], 'plate_thk': [0.015, 'm'],
              'stf_web_height': [0.4, 'm'], 'stf_web_thk': [0.012, 'm'], 'stf_flange_width': [0.15, 'm'],
              'stf_flange_thk': [0.02, 'm'], 'structure_type': ['BOTTOM', ''], 'plate_kpp': [1, ''], 'stf_kps': [1, ''],
              'stf_km1': [12, ''], 'stf_km2': [24, ''], 'stf_km3': [12, ''], 'sigma_y1': [80, 'MPa'],
              'sigma_y2': [80, 'MPa'], 'sigma_x': [80, 'MPa'], 'tau_xy': [5, 'MPa'], 'stf_type': ['T', '']},
             {'mat_yield': [355000000.0, 'Pa'], 'span': [4.0, 'm'], 'spacing': [0.7, 'm'], 'plate_thk': [0.015, 'm'],
              'stf_web_height': [0.4, 'm'], 'stf_web_thk': [0.012, 'm'], 'stf_flange_width': [0.15, 'm'],
              'stf_flange_thk': [0.02, 'm'], 'structure_type': ['GENERAL_INTERNAL_WT', ''], 'plate_kpp': [1, ''], 'stf_kps': [1, ''],
              'stf_km1': [12, ''], 'stf_km2': [24, ''], 'stf_km3': [12, ''], 'sigma_y1': [80, 'MPa'],
              'sigma_y2': [80, 'MPa'], 'sigma_x': [80, 'MPa'], 'tau_xy': [5, 'MPa'], 'stf_type': ['T', '']},
             {'mat_yield': [355000000.0, 'Pa'], 'span': [4.0, 'm'], 'spacing': [0.7, 'm'], 'plate_thk': [0.015, 'm'],
              'stf_web_height': [0.4, 'm'], 'stf_web_thk': [0.012, 'm'], 'stf_flange_width': [0.15, 'm'],
              'stf_flange_thk': [0.02, 'm'], 'structure_type': ['GENERAL_INTERNAL_WT', ''], 'plate_kpp': [1, ''], 'stf_kps': [1, ''],
              'stf_km1': [12, ''], 'stf_km2': [24, ''], 'stf_km3': [12, ''], 'sigma_y1': [80, 'MPa'],
              'sigma_y2': [80, 'MPa'], 'sigma_x': [80, 'MPa'], 'tau_xy': [5, 'MPa'], 'stf_type': ['T', '']},
             {'mat_yield': [355000000.0, 'Pa'], 'span': [4.0, 'm'], 'spacing': [0.7, 'm'], 'plate_thk': [0.015, 'm'],
              'stf_web_height': [0.4, 'm'], 'stf_web_thk': [0.012, 'm'], 'stf_flange_width': [0.15, 'm'],
              'stf_flange_thk': [0.02, 'm'], 'structure_type': ['GENERAL_INTERNAL_WT', ''], 'plate_kpp': [1, ''], 'stf_kps': [1, ''],
              'stf_km1': [12, ''], 'stf_km2': [24, ''], 'stf_km3': [12, ''], 'sigma_y1': [80, 'MPa'],
              'sigma_y2': [80, 'MPa'], 'sigma_x': [80, 'MPa'], 'tau_xy': [5, 'MPa'], 'stf_type': ['T', '']})
    return [calc_structure.CalcScantlings(dic) for dic in dicts]
Пример #3
0
def opt_input():
    obj_dict = ex.obj_dict
    fat_obj = ex.get_fatigue_object()
    fp = ex.get_fatigue_pressures()
    fat_press = ((fp['p_ext']['loaded'],fp['p_ext']['ballast'],fp['p_ext']['part']),
                 (fp['p_int']['loaded'],fp['p_int']['ballast'],fp['p_int']['part']))
    x0 = [obj_dict['spacing'][0], obj_dict['plate_thk'][0], obj_dict['stf_web_height'][0], obj_dict['stf_web_thk'][0],
          obj_dict['stf_flange_width'][0], obj_dict['stf_flange_thk'][0], obj_dict['span'][0], 10]
    obj = calc.Structure(obj_dict)
    lat_press = 271.124
    calc_object = calc.CalcScantlings(obj_dict)
    upper_bounds = np.array([0.6, 0.01, 0.3, 0.01, 0.1, 0.01, 3.5, 10])
    lower_bounds = np.array([0.8, 0.02, 0.5, 0.02, 0.22, 0.03, 3.5, 10])
    deltas = np.array([0.05, 0.005, 0.05, 0.005, 0.05, 0.005])
    return obj, upper_bounds, lower_bounds, lat_press, deltas, fat_obj, fat_press, x0
Пример #4
0
def get_structure_calc_object(line=None, heavy=False):
    if line in ('line12', 'line13', 'line11', 'line4'):
        return calc_structure.CalcScantlings(obj_dict_fr)
    else:
        return calc_structure.CalcScantlings(
            obj_dict if not heavy else obj_dict_heavy)
Пример #5
0
def scantling_cls():
    return calc.CalcScantlings(ex.obj_dict), calc.CalcScantlings(ex.obj_dict2), calc.CalcScantlings(ex.obj_dict_L)
Пример #6
0
def get_structure_calc_object(line=None):
    if line in ('line12', 'line13', 'line11', 'line4'):
        return calc_structure.CalcScantlings(obj_dict_fr)
    else:
        return calc_structure.CalcScantlings(obj_dict)
Пример #7
0
 obj_dict = test.obj_dict
 fat_obj = test.get_fatigue_object()
 fp = test.get_fatigue_pressures()
 fat_press = ((fp['p_ext']['loaded'], fp['p_ext']['ballast'],
               fp['p_ext']['part']),
              (fp['p_int']['loaded'], fp['p_int']['ballast'],
               fp['p_int']['part']))
 x0 = [
     obj_dict['spacing'][0], obj_dict['plate_thk'][0],
     obj_dict['stf_web_height'][0], obj_dict['stf_web_thk'][0],
     obj_dict['stf_flange_width'][0], obj_dict['stf_flange_thk'][0],
     obj_dict['span'][0], 10
 ]
 obj = calc.Structure(obj_dict)
 lat_press = 271.124
 calc_object = calc.CalcScantlings(obj_dict)
 upper_bounds = np.array([0.6, 0.01, 0.3, 0.01, 0.05, 0.01, 3.5, 10])
 lower_bounds = np.array([0.8, 0.025, 0.5, 0.022, 0.25, 0.03, 3.5, 10])
 deltas = np.array([0.02, 0.002, 0.01, 0.002, 0.02, 0.002])
 geo_opt_obj = test.get_geo_opt_object()
 geo_opt_press = test.get_geo_opt_presure()
 print('Initial x is:', x0)
 print(
     'Initial constraint ok? ', True
     if any_constraints_all(x0,
                            obj,
                            lat_press,
                            calc_weight(x0),
                            fat_dict=fat_obj.get_fatigue_properties(),
                            fat_press=fat_press) is not False else False)
 print('Initial weight is:', calc_weight(x0))