from src.divers.pretty_print import print_lampam, print_ss, print_list_ss #============================================================================== # Targets #============================================================================== # Total number of plies n_plies = 61 # Stacking sequence target ss_target = np.array([45, 90, -45, 0, 0], dtype='int16') print_ss(ss_target, 200) # Calculation of target lamination parameters lampam = calc_lampam_2(ss_target) print_lampam(lampam) targets = Targets(n_plies=n_plies, lampam=lampam, stack=ss_target) #============================================================================== # Type of optimisations #============================================================================== optimisation_type = 'A' # only in-plane lamination parameters optimised optimisation_type = 'D' # only out-of-plane lamination parameters optimised optimisation_type = 'AD' # in- and out-of-plane lamination parameters optimised #============================================================================== # Design guidelines #============================================================================== ### Set of design and manufacturing constraints: constraints_set = 'C0' constraints_set = 'C1' # C0: - No design and manufacturing constraints other than symmetry
# print(''' #The number of plies of the last group (parameters.group_size_max) is #recommended to be equal to or greater than 5. #''') if n_groups > maxi: raise PartitioningError(''' No partition possible of the plies into groups of smaller size parameters.group_size_minand bigger size parameters.group_size_max. Increase parameters.group_size_max or decrease parameters.group_size_min. ''') return n_plies_in_groups, pos_first_ply_groups, n_groups if __name__ == "__main__": import sys sys.path.append(r'C:\LAYLA') from src.LAYLA_V02.constraints import Constraints from src.LAYLA_V02.parameters import Parameters from src.LAYLA_V02.targets import Targets constraints = Constraints(sym=False, bal=True) targets = Targets(n_plies=200) parameters = Parameters( constraints=constraints, n_outer_step=5, group_size_min=3, group_size_max=6) n_plies_in_groups, pos_first_ply_groups, n_groups \ = divide_laminate_asym(parameters, targets) print(n_plies_in_groups) print(pos_first_ply_groups) print(n_groups)
[1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0]) else: lampam_to_be_optimised = np.array( [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]) # Lamination parameters sensitivities from the first-lebel optimiser first_level_sensitivities = np.ones((12, ), float) parameters = Parameters( constraints=constraints, p_A=p_A, n_D1=n_D1, n_D2=n_D2, n_D3=n_D3, first_level_sensitivities=first_level_sensitivities, lampam_to_be_optimised=lampam_to_be_optimised, repair_membrane_switch=repair_membrane_switch, repair_flexural_switch=repair_flexural_switch) targets = Targets(n_plies=ss.size, lampam=lampam_target) ss, completed, n_obj_func_D_calls = repair_ss(ss, constraints, parameters, targets, count_obj=True) print('Repair successful?', completed) print_ss(ss, 20) print('n_obj_func_D_calls', n_obj_func_D_calls) check_lay_up_rules(ss, constraints)
B11_target = data.loc[i, 'B11'] B22_target = data.loc[i, 'B22'] B12_target = data.loc[i, 'B12'] B66_target = data.loc[i, 'B66'] B16_target = data.loc[i, 'B16'] B26_target = data.loc[i, 'B26'] D11_target = data.loc[i, 'D11'] D22_target = data.loc[i, 'D22'] D12_target = data.loc[i, 'D12'] D66_target = data.loc[i, 'D66'] D16_target = data.loc[i, 'D16'] D26_target = data.loc[i, 'D26'] targets = Targets(n_plies=n_plies_lam, lampam=lampam_target, stack=ss_target) # print('target', ss_target) ### Algorithm run print(f'Algorithm running.') print('Laminate type: ', constraints.laminate_scheme) print('Laminate type of the target stacking sequences: ', constraints.laminate_scheme_test) t = time.time() result = LAYLA_optimiser(parameters, constraints, targets, mat_prop) elapsed1 = time.time() - t ### Results processing and display if not result.completed:
pos_mom_areas = np.array([ (abs(pos_top[-1]) + abs(pos_bot[-1])) / 2, (abs(pos_top[-1]**2) + abs(pos_bot[-1]**2)) / 2, (abs(pos_top[-1]**3) + abs(pos_bot[-1]**3)) / 2 ]) cummul_mom_areas[-1, :] += pos_mom_areas mom_areas_ply_group += pos_mom_areas group_mom_areas[-1, :] += mom_areas_ply_group return mom_areas, cummul_mom_areas, group_mom_areas if __name__ == "__main__": print('*** Test for the functions calc_moment_of_areas ***\n') import sys sys.path.append(r'C:\LAYLA') from src.LAYLA_V02.constraints import Constraints from src.LAYLA_V02.targets import Targets from src.LAYLA_V02.ply_order import calc_ply_order constraints = Constraints(sym=True) targets = Targets(n_plies=21) ply_order = calc_ply_order(constraints, targets) n_plies_in_groups = np.array([5, 6]) mom_areas, cummul_mom_areas, group_mom_areas = calc_mom_of_areas( constraints, targets, ply_order, n_plies_in_groups) print(mom_areas) print(cummul_mom_areas) print(group_mom_areas, sum(group_mom_areas))
INPUTS - ply_order: array of the ply indices sorted in the order in which plies are optimised (middle ply of symmetric laminates included) - n_plies_in_groups: number of plies in each ply group - n_groups: number of ply groups """ levels_in_groups = [None] * n_groups for ind_group in range(n_groups): levels_in_groups[ind_group] = [] ind_all_plies = 0 for ind_group in range(n_groups): for ind_plies in range(n_plies_in_groups[ind_group]): levels_in_groups[ind_group].append(ply_order[ind_all_plies]) ind_all_plies += 1 return levels_in_groups if __name__ == "__main__": import sys sys.path.append(r'C:\LAYLA') from src.LAYLA_V02.parameters import Parameters from src.LAYLA_V02.constraints import Constraints from src.LAYLA_V02.targets import Targets constraints = Constraints(sym=False) targets = Targets(n_plies=6) ply_order = calc_ply_order(constraints, targets) print(ply_order)