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)
def fatigue_cls(): return calc.CalcFatigue(ex.obj_dict, ex.fat_obj_dict), calc.CalcFatigue(ex.obj_dict2, ex.fat_obj_dict), \ calc.CalcFatigue(ex.obj_dict_L, ex.fat_obj_dict)
def get_fatigue_object(): return calc_structure.CalcFatigue(obj_dict, fat_obj_dict)