ANYstructure 5.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. anystruct/ANYstructure_documentation.pdf +0 -0
  2. anystruct/SN_curve_parameters.py +35 -0
  3. anystruct/__init__.py +0 -0
  4. anystruct/__main__.py +24 -0
  5. anystruct/api.py +772 -0
  6. anystruct/buckling_calc_external.py +120 -0
  7. anystruct/bulb_anglebar_tbar_flatbar.csv +677 -0
  8. anystruct/calc_loads.py +526 -0
  9. anystruct/calc_structure.py +4838 -0
  10. anystruct/compartment_window.py +176 -0
  11. anystruct/example_data.py +532 -0
  12. anystruct/example_data_puls.py +46 -0
  13. anystruct/excel_inteface.py +244 -0
  14. anystruct/fatigue_window.py +352 -0
  15. anystruct/grid_window.py +307 -0
  16. anystruct/gui.py +24 -0
  17. anystruct/helper.py +623 -0
  18. anystruct/images/ANYstructure_logo.jpg +0 -0
  19. anystruct/images/Buckling_Strength_of_Shells.png +0 -0
  20. anystruct/images/Panel_geometry_definitions.png +0 -0
  21. anystruct/images/current_comps_NONE.png +0 -0
  22. anystruct/images/fls_button.gif +0 -0
  23. anystruct/images/img_T_L_FB.gif +0 -0
  24. anystruct/images/img_axial_stresses.gif +0 -0
  25. anystruct/images/img_ext_pressure_button.gif +0 -0
  26. anystruct/images/img_ext_pressure_button_def.gif +0 -0
  27. anystruct/images/img_fixation_parameters.gif +0 -0
  28. anystruct/images/img_generate_report.gif +0 -0
  29. anystruct/images/img_int_pressure_button.gif +0 -0
  30. anystruct/images/img_int_pressure_button_search.gif +0 -0
  31. anystruct/images/img_multi_opt.gif +0 -0
  32. anystruct/images/img_optimize.gif +0 -0
  33. anystruct/images/img_plate_and_stiffener.gif +0 -0
  34. anystruct/images/img_stf_button.gif +0 -0
  35. anystruct/images/img_stiffener.gif +0 -0
  36. anystruct/images/img_stress_button.gif +0 -0
  37. anystruct/images/img_title.gif +0 -0
  38. anystruct/images/img_transverse_stress.gif +0 -0
  39. anystruct/load_factor_window.py +166 -0
  40. anystruct/load_window.py +721 -0
  41. anystruct/main_application.py +7918 -0
  42. anystruct/make_grid_numpy.py +506 -0
  43. anystruct/make_queue.py +52 -0
  44. anystruct/make_stack.py +52 -0
  45. anystruct/ml_files/CL_CSR-Tank_req_cl_predictor.pickle +0 -0
  46. anystruct/ml_files/CL_CSR-Tank_req_cl_scaler.pickle +0 -0
  47. anystruct/ml_files/CL_CSR_plate_cl,_CSR_web_cl,_CSR_web_flange_cl,_CSR_flange_cl_predictor.pickle +0 -0
  48. anystruct/ml_files/CL_CSR_plate_cl,_CSR_web_cl,_CSR_web_flange_cl,_CSR_flange_cl_scaler.pickle +0 -0
  49. anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_1_SP.pickle +0 -0
  50. anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_1_UP.pickle +0 -0
  51. anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
  52. anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
  53. anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_1_SP.pickle +0 -0
  54. anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_1_UP.pickle +0 -0
  55. anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
  56. anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
  57. anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_1_SP.pickle +0 -0
  58. anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_1_UP.pickle +0 -0
  59. anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
  60. anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
  61. anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_1_SP.pickle +0 -0
  62. anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_1_UP.pickle +0 -0
  63. anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
  64. anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
  65. anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_1_SP.pickle +0 -0
  66. anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_1_UP.pickle +0 -0
  67. anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
  68. anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
  69. anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_1_SP.pickle +0 -0
  70. anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_1_UP.pickle +0 -0
  71. anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
  72. anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
  73. anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_1_SP.pickle +0 -0
  74. anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_1_UP.pickle +0 -0
  75. anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
  76. anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
  77. anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_1_SP.pickle +0 -0
  78. anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_1_UP.pickle +0 -0
  79. anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
  80. anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
  81. anystruct/opt_problem.py +31 -0
  82. anystruct/optimize.py +1680 -0
  83. anystruct/optimize_cylinder.py +898 -0
  84. anystruct/optimize_geometry.py +1708 -0
  85. anystruct/optimize_multiple_window.py +1507 -0
  86. anystruct/optimize_window.py +1117 -0
  87. anystruct/pl_stf_window.py +572 -0
  88. anystruct/report_generator.py +912 -0
  89. anystruct/sections.csv +202 -0
  90. anystruct/sesam_interface.py +115 -0
  91. anystruct/ship_section_example.txt +1 -0
  92. anystruct/stresses_window.py +269 -0
  93. anystruct/testCalc.py +118 -0
  94. anystructure-5.2.0.dist-info/METADATA +86 -0
  95. anystructure-5.2.0.dist-info/RECORD +99 -0
  96. anystructure-5.2.0.dist-info/WHEEL +5 -0
  97. anystructure-5.2.0.dist-info/entry_points.txt +2 -0
  98. anystructure-5.2.0.dist-info/licenses/LICENSE +21 -0
  99. anystructure-5.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,46 @@
1
+ '''
2
+ Contains examples to be used for testing.
3
+ '''
4
+
5
+
6
+ ex1 = {'Identification': 'Panel 1', 'Length of panel': 3000, 'Stiffener spacing': 700, 'Plate thickness': 15,
7
+ 'Number of primary stiffeners': 20, 'Stiffener type (L,T,F)': 'T', 'Stiffener boundary': 'C',
8
+ 'Stiff. Height': 350, 'Web thick.': 12,'Flange width': 150, 'Flange thick.': 18, 'Tilt angle': 0,
9
+ 'Number of sec. stiffeners': 0, 'Modulus of elasticity': 2.1e11/1e6, "Poisson's ratio": 0.33,
10
+ 'Yield stress plate': 355, 'Yield stress stiffener': 355, 'Axial stress': 80, 'Trans. stress 1': 60,
11
+ 'Trans. stress 2': 50, 'Shear stress': 10, 'Pressure (fixed)': 0.08, 'In-plane support': 'Int'}
12
+
13
+ ex2 = {'Identification': 'Panel 2', 'Length of panel': 3500, 'Stiffener spacing': 700, 'Plate thickness': 15,
14
+ 'Number of primary stiffeners': 20, 'Stiffener type (L,T,F)': 'T', 'Stiffener boundary': 'C',
15
+ 'Stiff. Height': 350, 'Web thick.': 12,'Flange width': 150, 'Flange thick.': 18, 'Tilt angle': 0,
16
+ 'Number of sec. stiffeners': 0, 'Modulus of elasticity': 2.1e11/1e6, "Poisson's ratio": 0.33,
17
+ 'Yield stress plate': 355, 'Yield stress stiffener': 355, 'Axial stress': 80, 'Trans. stress 1': 60,
18
+ 'Trans. stress 2': 50, 'Shear stress': 10, 'Pressure (fixed)': 0.08, 'In-plane support': 'Int'}
19
+
20
+ ex3 = {'Identification': 'Panel 3', 'Length of panel': 4000, 'Stiffener spacing': 700, 'Plate thickness': 15,
21
+ 'Number of primary stiffeners': 20, 'Stiffener type (L,T,F)': 'T', 'Stiffener boundary': 'C',
22
+ 'Stiff. Height': 350, 'Web thick.': 12,'Flange width': 150, 'Flange thick.': 18, 'Tilt angle': 0,
23
+ 'Number of sec. stiffeners': 0, 'Modulus of elasticity': 2.1e11/1e6, "Poisson's ratio": 0.33,
24
+ 'Yield stress plate': 355, 'Yield stress stiffener': 355, 'Axial stress': 80, 'Trans. stress 1': 60,
25
+ 'Trans. stress 2': 50, 'Shear stress': 10, 'Pressure (fixed)': 0.08, 'In-plane support': 'Int'}
26
+
27
+ ex4 = {'Identification': 'Panel 4', 'Length of panel': 3000, 'Stiffener spacing': 700, 'Plate thickness': 15,
28
+ 'Number of primary stiffeners': 20, 'Stiffener type (L,T,F)': 'T', 'Stiffener boundary': 'C',
29
+ 'Stiff. Height': 400, 'Web thick.': 12,'Flange width': 150, 'Flange thick.': 18, 'Tilt angle': 0,
30
+ 'Number of sec. stiffeners': 0, 'Modulus of elasticity': 2.1e11/1e6, "Poisson's ratio": 0.33,
31
+ 'Yield stress plate': 355, 'Yield stress stiffener': 355, 'Axial stress': 80, 'Trans. stress 1': 60,
32
+ 'Trans. stress 2': 50, 'Shear stress': 10, 'Pressure (fixed)': 0.08, 'In-plane support': 'Int'}
33
+
34
+ ex5 = {'Identification': 'Panel 5', 'Length of panel': 3500, 'Stiffener spacing': 700, 'Plate thickness': 15,
35
+ 'Number of primary stiffeners': 20, 'Stiffener type (L,T,F)': 'T', 'Stiffener boundary': 'C',
36
+ 'Stiff. Height': 350, 'Web thick.': 12,'Flange width': 150, 'Flange thick.': 25, 'Tilt angle': 0,
37
+ 'Number of sec. stiffeners': 0, 'Modulus of elasticity': 2.1e11/1e6, "Poisson's ratio": 0.33,
38
+ 'Yield stress plate': 355, 'Yield stress stiffener': 355, 'Axial stress': 80, 'Trans. stress 1': 60,
39
+ 'Trans. stress 2': 50, 'Shear stress': 10, 'Pressure (fixed)': 0.08, 'In-plane support': 'Int'}
40
+
41
+ ex6 = {'Identification': 'Panel 6', 'Length of panel': 4000, 'Stiffener spacing': 800, 'Plate thickness': 20,
42
+ 'Number of primary stiffeners': 20, 'Stiffener type (L,T,F)': 'T', 'Stiffener boundary': 'C',
43
+ 'Stiff. Height': 350, 'Web thick.': 12,'Flange width': 150, 'Flange thick.': 18, 'Tilt angle': 0,
44
+ 'Number of sec. stiffeners': 0, 'Modulus of elasticity': 2.1e11/1e6, "Poisson's ratio": 0.33,
45
+ 'Yield stress plate': 355, 'Yield stress stiffener': 355, 'Axial stress': 80, 'Trans. stress 1': 60,
46
+ 'Trans. stress 2': 50, 'Shear stress': 10, 'Pressure (fixed)': 0.08, 'In-plane support': 'Int'}
@@ -0,0 +1,244 @@
1
+ '''
2
+ This file open up excel PULS file
3
+ 1. read and write to the file.
4
+ 2. run macros.
5
+ 3. get the results.
6
+ '''
7
+
8
+ import numpy as np
9
+ from xlwings import App, Book
10
+
11
+ class ExcelInterface():
12
+ ''' This class open a ExcelInterface work.
13
+ Input and output structure data and results.
14
+ Running macros.
15
+ '''
16
+ def __init__(self, path_and_file_to_book: str = None, visible = True, read_only = False):
17
+ '''
18
+ :param path_and_file_to_book: Path and file name or just filename in base directory.
19
+ :param visible: If excel shall open in windows or run in the background.
20
+ '''
21
+ super(ExcelInterface, self).__init__()
22
+ self.app = App(visible=visible)
23
+ self.book = Book(path_and_file_to_book, read_only=read_only)
24
+
25
+ self.names_sp = {'Identification': 1, 'Length of panel': 3, 'Stiffener spacing': 4, 'Plate thickness': 5,
26
+ 'Number of primary stiffeners': 6, 'Stiffener type (L,T,F)': 7, 'Stiffener boundary': 8,
27
+ 'Stiff. Height': 9, 'Web thick.': 10,'Flange width': 11, 'Flange thick.': 12, 'Tilt angle': 13,
28
+ 'Number of sec. stiffeners': 14, 'Modulus of elasticity': 21, "Poisson's ratio": 22,
29
+ 'Yield stress plate': 23, 'Yield stress stiffener': 24, 'Axial stress': 25, 'Trans. stress 1': 26,
30
+ 'Trans. stress 2': 27, 'Shear stress': 28, 'Pressure (fixed)': 29, 'In-plane support': 30}
31
+
32
+ self.names_up = {'Identification': 1, 'Length of plate': 3, 'Width of c': 4, 'Plate thickness': 5,
33
+ 'Modulus of elasticity': 6, "Poisson's ratio":7, 'Yield stress plate': 8,
34
+ 'Axial stress 1': 9, 'Axial stress 2': 10,'Trans. stress 1': 11,
35
+ 'Trans. stress 2': 12, 'Shear stress': 13, 'Pressure (fixed)': 14, 'In-plane support': 15,
36
+ 'Rot left': 16, 'Rot right': 17, 'Rot upper': 18, 'Rot lower': 19}
37
+
38
+ def close_book(self, save = False):
39
+ ''' Closing ass and book. '''
40
+ if save:
41
+ self.book.save()
42
+ self.book.close()
43
+ self.app.kill()
44
+
45
+ def read_data(self, row_number: int = 1, column_number: int = 1):
46
+ ''' Read one cell in the sheet
47
+ Row and columns starts at 1 (not 0 as in python general)
48
+ '''
49
+ return self.book.sheets[1].range((row_number, column_number)).value
50
+
51
+ def set_cell_value(self, row_number: int = 1, column_number: int = 1, cell_value = None, sheet_num = 1):
52
+ '''
53
+ Set values of a cell.
54
+ :param row_number:
55
+ :param column_number:
56
+ :param cell_value:
57
+ :return:
58
+ '''
59
+ #print('Row', row_number, 'Col', column_number, 'Cell', cell_value)
60
+ self.book.sheets[sheet_num].range((row_number, column_number)).value = cell_value
61
+
62
+ def set_one_row(self, row_number: int = 20, data_dict: dict = None):
63
+ '''
64
+ Set one row of values
65
+ :param row_number: The row to set.
66
+ :param data_dict: Data for one panel.
67
+ :return:
68
+ '''
69
+ for name, col_num in self.names_sp.items():
70
+ self.set_cell_value(row_number, col_num, data_dict[name])
71
+
72
+ def set_multiple_rows(self, start_row:int = 20, data_dict: dict = None):
73
+ '''
74
+
75
+ :param start_row: First row to input.
76
+ :param list_of_dicts: The data to be set.
77
+ :return:
78
+ '''
79
+
80
+ row_number = start_row
81
+ for id, data in data_dict.items():
82
+ self.set_one_row(row_number, data)
83
+ row_number += 1
84
+
85
+ def set_multiple_rows_batch(self, data_dict: dict = None):
86
+ '''
87
+
88
+ :param start_row: First row to input.
89
+ :param list_of_dicts: The data to be set.
90
+ :return:
91
+ '''
92
+
93
+ sp_dict, up_dict = dict(), dict()
94
+ for key, val in data_dict.items():
95
+ if val['sp or up'] == 'SP':
96
+ sp_dict[key] = val
97
+ else:
98
+ up_dict[key] = val
99
+ if len(sp_dict)>0:
100
+ for name, col_num in self.names_sp.items():
101
+ start_row = 20
102
+ self.book.sheets[1].range((start_row, col_num)).options(expand='table', transpose=True).value = \
103
+ [val[name] for val in sp_dict.values()]
104
+ if len(up_dict) > 0:
105
+ for name, col_num in self.names_up.items():
106
+ start_row = 21
107
+ self.book.sheets[4].range((start_row, col_num)).options(expand='table', transpose=True).value = \
108
+ [val[name] for val in up_dict.values()]
109
+
110
+ return len(sp_dict)>0, len(up_dict)>0
111
+
112
+ def calculate_panels(self, sp = True, up = False):
113
+ ''' Calculate the panels in the sheet. '''
114
+ if sp:
115
+ run_macro_sp = self.app.macro('Sheet1.cmdCalculatePanels_Click')
116
+ run_macro_sp()
117
+ if up:
118
+ run_macro_up = self.app.macro('Sheet3.CalculatePanelsU3')
119
+ run_macro_up()
120
+
121
+ def get_results_one_cell(self, row_number: int = 1, column_number: int = 1):
122
+ ''' Return the results in one cell of a calculated panel. '''
123
+ return self.book.sheets[2].range((row_number, column_number)).value
124
+
125
+ def get_results_one_row(self, row_number: int = 15):
126
+ '''
127
+ Return one row.
128
+ :param row_number:
129
+ :return: dict : [value, unit] e.g. [3000, 'mm']
130
+ '''
131
+ return_dict = dict()
132
+ return_dict['Identification'] = self.get_results_one_cell(row_number, column_number=1)
133
+ # print('start')
134
+ # for idx in range(3,74):
135
+ # if self.get_results_one_cell(11, column_number=idx) != None:
136
+ # return_dict[self.get_results_one_cell(11, column_number=idx)] = {}
137
+ # print('stop')
138
+ current_top_row = ''
139
+ for idx in range(3,74):
140
+ if self.get_results_one_cell(11, column_number=idx) != None:
141
+ current_top_row = self.get_results_one_cell(11, column_number=idx)
142
+ return_dict[current_top_row] = {}
143
+
144
+ return_dict[current_top_row][self.get_results_one_cell(12, column_number=idx)] = \
145
+ [self.get_results_one_cell(row_number, column_number=idx),
146
+ self.get_results_one_cell(14, column_number=idx)]
147
+ return return_dict
148
+
149
+ def get_all_results_batch(self, sp = True, up = False):
150
+
151
+ spup = {(True, True) : ['SP', 'UP'], (True, False) : ['SP'], (False, True) : ['UP']}
152
+
153
+ return_dict = {}
154
+ for run in spup[(sp, up)]:
155
+ all_ids = self.book.sheets[2 if run == 'SP' else 5].range('A15').expand().value
156
+ if type(all_ids) != list:
157
+ all_ids = [all_ids]
158
+ all_data = np.array(self.book.sheets[2 if run == 'SP' else 5].range('C12').expand().value)
159
+ all_top_names = np.array(self.book.sheets[2 if run == 'SP' else 5].range('C11:BU11' if run == 'SP' else 'C11:AS11').value)
160
+ all_names = all_data[0]
161
+ all_data = all_data[3:]
162
+ all_units = np.array(self.book.sheets[2 if run == 'SP' else 5].range('C14:BU14'if run == 'SP' else 'C14:AS14').value)
163
+ current_top_row = ''
164
+
165
+ for data_idx, id in enumerate(all_ids):
166
+ return_dict[id] = {}
167
+ return_dict[id]['Identification'] = id
168
+ same, same_idx = False, 2
169
+ for top_name, name, data, unit in zip(all_top_names, all_names, all_data[data_idx], all_units):
170
+ if top_name != None:
171
+ current_top_row = top_name
172
+ return_dict[id][current_top_row] = {}
173
+ if name in return_dict[id][current_top_row].keys():
174
+ same = True
175
+ name = name + ' ' +str(same_idx)
176
+ same_idx += 1
177
+ elif same == True and name not in return_dict[id][current_top_row].keys():
178
+ same = False
179
+ same_idx = 2
180
+ return_dict[id][current_top_row][name] = [data, unit]
181
+ if run == 'UP':
182
+ return_dict[id]['Ultimate capacity']['Actual usage Factor'] = \
183
+ return_dict[id]['Ultimate capacity']['Usage factor']
184
+ return_dict[id]['Ultimate capacity']['Allowable usage factor'] = \
185
+ return_dict[id]['Ultimate capacity']['Alowable usage']
186
+ return_dict[id]['Buckling strength']['Actual usage Factor'] = \
187
+ return_dict[id]['Buckling strength']['Usage factor']
188
+ return_dict[id]['Buckling strength']['Allowable usage factor'] = \
189
+ return_dict[id]['Buckling strength']['Alowable usage']
190
+
191
+ return_dict[id]['Ultimate capacity'].pop('Usage factor')
192
+ return_dict[id]['Ultimate capacity'].pop('Alowable usage')
193
+ return_dict[id]['Buckling strength'].pop('Usage factor')
194
+ return_dict[id]['Buckling strength'].pop('Alowable usage')
195
+ return return_dict
196
+
197
+ def get_all_results(self):
198
+ '''
199
+ Return all results in run.
200
+ :return:
201
+ '''
202
+
203
+ return_dict, found_last, row_number = dict(), False, 15
204
+ while found_last is False:
205
+ this_row = self.get_results_one_row(row_number)
206
+ if this_row['Identification'] is not None:
207
+ return_dict[row_number] = this_row
208
+ row_number += 1
209
+ else:
210
+ found_last = True
211
+
212
+ return return_dict
213
+
214
+ def get_sheet_data(self, sheet = 'flat_plate'):
215
+ map = {'flat_plate': 0, 'cylinder': 1}
216
+ if sheet not in list(map.keys()):
217
+ return None
218
+
219
+ this_sheet = self.book.sheets[map[sheet]]
220
+ return this_sheet.used_range.value
221
+
222
+ if __name__ == '__main__':
223
+ # ex1 = {'line25': {'Identification': 'line25', 'Length of plate': 3, 'Width of c': 800.0, 'Plate thickness': 20.0,
224
+ # 'Modulus of elasticity': 210000.0, "Poisson's ratio": 0.3, 'Yield stress plate': 355.0,
225
+ # 'Axial stress 1': 60.0, 'Axial stress 2': 60.0, 'Trans. stress 1': 0, 'Trans. stress 2': 0,
226
+ # 'Shear stress': 10.0, 'Pressure (fixed)': 0.0, 'In-plane support': 'GL', 'Rot left': 'SS',
227
+ # 'Rot right': 'SS', 'Rot upper': 'SS', 'Rot lower': 'SS', 'sp or up': 'UP'}}
228
+ # my_puls = ExcelInterface(r'C:\Github\ANYstructure\ANYstructure\PULS\PulsExcel_new - Copy.xlsm',
229
+ # visible=True)
230
+ # my_puls.set_multiple_rows_batch(ex1)
231
+ # my_puls.set_multiple_rows(20, [ex.ex1, ex.ex2, ex.ex3, ex.ex4, ex.ex5, ex.ex6])
232
+ # my_puls.calculate_panels()
233
+ #my_puls.set_one_row(data_dict=ex.ex1['line1'])
234
+ # [print(key, value) for key, value in my_puls.get_all_results().items()]
235
+ # my_puls.close_book()
236
+ my_input = ExcelInterface(r'C:\Github\ANYstructure\anystruct\excel_input_example.xlsx',
237
+ visible=False)
238
+ data = my_input.get_sheet_data()
239
+
240
+ for dom, l1x, l1y, l2x, l2y, pl_t, pl_s, web_h, web_th, fl_b, fl_th, sig_x1, sig_x2, sig_y1, sig_y2, tau_xy in data[1:]:
241
+ print(dom, l1x, l1y, l2x, l2y, pl_t, pl_s, web_h, web_th, fl_b, fl_th, sig_x1, sig_x2, sig_y1, sig_y2, tau_xy)
242
+
243
+
244
+
@@ -0,0 +1,352 @@
1
+ # This is fatigue properties are defined.
2
+ import tkinter as tk
3
+
4
+ try:
5
+ import anystruct.example_data as test
6
+ import anystruct.SN_curve_parameters as sn
7
+ except ModuleNotFoundError:
8
+ import ANYstructure.anystruct.example_data as test
9
+ import ANYstructure.anystruct.SN_curve_parameters as sn
10
+
11
+
12
+ class CreateFatigueWindow():
13
+ '''
14
+ This class initiates the GUI used to define stresses for the selected structure.
15
+ '''
16
+ def __init__(self, master, app=None):
17
+ super(CreateFatigueWindow, self).__init__()
18
+ if __name__ == '__main__':
19
+ self._initial_structure_obj = test.get_structure_object()
20
+ self.load_objects = [test.get_loa_fls_load(),test.get_loa_uls_load(),
21
+ test.get_bal_fls_load(), test.get_bal_uls_load()]
22
+ self.active_line = 'line1'
23
+ points = test.line_dict['line1']
24
+ coords = (test.point_dict['point'+str(points[0])], test.point_dict['point'+str(points[1])])
25
+ self.pressure_coords = self.get_pressure_point_coord_from_two_points(coords[0],coords[1])
26
+ self.comp_objects = [test.get_tank_object()]
27
+ self._initial_fatigue_obj = test.get_fatigue_object()
28
+
29
+ else:
30
+ if app._line_to_struc[app._active_line][0] is None:
31
+ return
32
+ elif app._line_to_struc[app._active_line][0].Stiffener is None:
33
+ return
34
+ self.app = app
35
+ self.active_line = app._active_line
36
+ points = app._line_dict[self.active_line]
37
+ coords = (app._point_dict['point'+str(points[0])], app._point_dict['point'+str(points[1])])
38
+ self.pressure_coords = self.get_pressure_point_coord_from_two_points(coords[0], coords[1])
39
+ self._initial_structure_obj = app._line_to_struc[app._active_line][0].Stiffener
40
+ self.load_objects = app._line_to_struc[app._active_line][3]
41
+
42
+ self.comp_objects = [app._tank_dict['comp'+str(comp_i)] for comp_i in
43
+ app.get_compartments_for_line(app._active_line)]
44
+ self._initial_fatigue_obj = app._line_to_struc[self.active_line][2]
45
+
46
+
47
+ self._frame = master
48
+ self._frame.wm_title("Specify fatigue properties here.")
49
+ self._frame.geometry('1300x810')
50
+ self._frame.grab_set()
51
+
52
+ tk.Label(self._frame, text='-- Fatigue calculation for plates according to DNVGL-RP-C203, '
53
+ 'Section 5 Simplified fatigue analysis --',
54
+ font='Verdana 15 bold').place(x=10, y=10)
55
+
56
+ ent_w = 10
57
+
58
+ self.new_sn_curve = tk.StringVar()
59
+ self.new_k_factor = tk.DoubleVar()
60
+ self.new_no_of_cycles = tk.DoubleVar()
61
+ self.new_design_life = tk.DoubleVar()
62
+ self.new_dff = tk.DoubleVar()
63
+
64
+ self.new_weibull_loa = tk.DoubleVar()
65
+ self.new_weibull_bal = tk.DoubleVar()
66
+ self.new_weibull_prt = tk.DoubleVar()
67
+
68
+ self.new_period_loa = tk.DoubleVar()
69
+ self.new_period_bal = tk.DoubleVar()
70
+ self.new_period_prt = tk.DoubleVar()
71
+
72
+ self.new_corr_loc_loa = tk.DoubleVar()
73
+ self.new_corr_loc_bal = tk.DoubleVar()
74
+ self.new_corr_loc_prt = tk.DoubleVar()
75
+
76
+ self.new_fraction_loa = tk.DoubleVar()
77
+ self.new_fraction_bal = tk.DoubleVar()
78
+ self.new_fraction_prt = tk.DoubleVar()
79
+
80
+ self.new_az_loa = tk.DoubleVar()
81
+ self.new_az_bal = tk.DoubleVar()
82
+ self.new_az_prt = tk.DoubleVar()
83
+
84
+
85
+ sn_curves = sn.get_all_curves()
86
+
87
+ self.ent_sn_curve = tk.OptionMenu(self._frame, self.new_sn_curve, command=self.change_sn_curve,*sn_curves)
88
+ self.ent_dff = tk.Entry(self._frame, textvariable=self.new_dff, width=ent_w)
89
+ self.ent_k_factor = tk.Entry(self._frame, textvariable=self.new_k_factor, width=ent_w)
90
+ self.ent_no_of_cycles = tk.Entry(self._frame, textvariable=self.new_no_of_cycles, width=ent_w)
91
+ self.ent_new_design_life = tk.Entry(self._frame, textvariable=self.new_design_life, width=ent_w)
92
+
93
+ self.ent_weibull_loa = tk.Entry(self._frame, textvariable=self.new_weibull_loa, width=ent_w)
94
+ self.ent_weibull_bal = tk.Entry(self._frame, textvariable=self.new_weibull_bal, width=ent_w)
95
+ self.ent_weibull_prt = tk.Entry(self._frame, textvariable=self.new_weibull_prt, width=ent_w)
96
+
97
+ self.ent_period_loa = tk.Entry(self._frame, textvariable=self.new_period_loa, width=ent_w)
98
+ self.ent_period_bal = tk.Entry(self._frame, textvariable=self.new_period_bal, width=ent_w)
99
+ self.ent_period_prt = tk.Entry(self._frame, textvariable=self.new_period_prt, width=ent_w)
100
+
101
+ self.ent_corr_loc_loa = tk.Entry(self._frame, textvariable=self.new_corr_loc_loa, width=ent_w)
102
+ self.ent_corr_loc_bal = tk.Entry(self._frame, textvariable=self.new_corr_loc_bal, width=ent_w)
103
+ self.ent_corr_loc_prt = tk.Entry(self._frame, textvariable=self.new_corr_loc_prt, width=ent_w)
104
+
105
+ self.ent_fraction_loa = tk.Entry(self._frame, textvariable=self.new_fraction_loa, width=ent_w)
106
+ self.ent_fraction_bal = tk.Entry(self._frame, textvariable=self.new_fraction_bal, width=ent_w)
107
+ self.ent_fraction_prt = tk.Entry(self._frame, textvariable=self.new_fraction_prt, width=ent_w)
108
+
109
+ self.ent_acc_loa = tk.Entry(self._frame, textvariable=self.new_az_loa, width=ent_w)
110
+ self.ent_acc_bal = tk.Entry(self._frame, textvariable=self.new_az_bal, width=ent_w)
111
+ self.ent_acc_prt = tk.Entry(self._frame, textvariable=self.new_az_prt, width=ent_w)
112
+
113
+ start_x, start_y, dx, dy = 20, 100, 150, 35
114
+
115
+ loaded_exist = False
116
+ ballast_exist = False
117
+ part_exist = False
118
+ fls_exist = (loaded_exist, ballast_exist, part_exist)
119
+
120
+ # Frames to hide loaded, ballast or part
121
+ loa_fr = tk.Frame(self._frame, width=100, height=170, bg="gray25", colormap="new")
122
+ bal_fr = tk.Frame(self._frame, width=100, height=170, bg="gray25", colormap="new")
123
+ prt_fr = tk.Frame(self._frame, width=100, height=170, bg="gray25", colormap="new")
124
+
125
+ for load in self.load_objects:
126
+ if load != None:
127
+ if load.get_limit_state() == 'FLS':
128
+ if load.get_load_condition() == 'loaded':
129
+ loaded_exist = True
130
+ elif load.get_load_condition() == 'ballast':
131
+ ballast_exist = True
132
+ elif load.get_load_condition() == 'part':
133
+ part_exist = True
134
+ else:
135
+ pass
136
+ fls_exist = (loaded_exist, ballast_exist, part_exist)
137
+
138
+
139
+ if self._initial_fatigue_obj == None:
140
+ self.new_sn_curve.set('Ec')
141
+ self.new_k_factor.set(1)
142
+ self.new_no_of_cycles.set(10000)
143
+ self.new_design_life.set(20)
144
+ self.new_dff.set(2)
145
+ if any(fls_exist):
146
+ if loaded_exist:
147
+ self.new_fraction_loa.set(1 / fls_exist.count(True))
148
+ self.new_weibull_loa.set(0.8)
149
+ self.new_period_loa.set(8)
150
+ self.new_corr_loc_loa.set(0.5)
151
+ self.new_az_loa.set(0.5)
152
+ if ballast_exist:
153
+ self.new_fraction_bal.set(1 / fls_exist.count(True))
154
+ self.new_weibull_bal.set(0.8)
155
+ self.new_period_bal.set(8)
156
+ self.new_corr_loc_bal.set(0.5)
157
+ self.new_az_bal.set(0.5)
158
+ if part_exist:
159
+ self.new_fraction_prt.set(1 / fls_exist.count(True))
160
+ self.new_weibull_prt.set(0.8)
161
+ self.new_period_prt.set(8)
162
+ self.new_corr_loc_prt.set(0.5)
163
+ self.new_az_prt.set(0.5)
164
+ else:
165
+ fat_prop = self._initial_fatigue_obj.get_fatigue_properties()
166
+ self.new_sn_curve.set(fat_prop['SN-curve'])
167
+ self.new_k_factor.set(fat_prop['SCF'])
168
+ self.new_no_of_cycles.set(fat_prop['n0'])
169
+ self.new_design_life.set(fat_prop['Design life'])
170
+ self.new_dff.set(fat_prop['DFF'])
171
+ if any(fls_exist):
172
+ if loaded_exist:
173
+ self.new_fraction_loa.set(fat_prop['Fraction'][0])
174
+ self.new_weibull_loa.set(fat_prop['Weibull'][0])
175
+ self.new_period_loa.set(fat_prop['Period'][0])
176
+ self.new_corr_loc_loa.set(fat_prop['CorrLoc'][0])
177
+ self.new_az_loa.set(fat_prop['Accelerations'][0])
178
+ if ballast_exist:
179
+ self.new_fraction_bal.set(fat_prop['Fraction'][1])
180
+ self.new_weibull_bal.set(fat_prop['Weibull'][1])
181
+ self.new_period_bal.set(fat_prop['Period'][1])
182
+ self.new_corr_loc_bal.set(fat_prop['CorrLoc'][1])
183
+ self.new_az_bal.set(fat_prop['Accelerations'][1])
184
+ if part_exist:
185
+ self.new_fraction_prt.set(fat_prop['Fraction'][2])
186
+ self.new_weibull_prt.set(fat_prop['Weibull'][2])
187
+ self.new_period_prt.set(fat_prop['Period'][2])
188
+ self.new_corr_loc_prt.set(fat_prop['CorrLoc'][2])
189
+ self.new_az_prt.set(fat_prop['Accelerations'][2])
190
+
191
+ all_acc = (self.new_az_loa.get(), self.new_az_bal.get(), self.new_az_prt.get())
192
+
193
+ count = 1
194
+ for load in self.load_objects:
195
+ if load == None:
196
+ continue
197
+ press = []
198
+ if load.get_limit_state() == 'FLS':
199
+ tk.Label(self._frame, text=str(count)+'. '+load.get_name(), font='Verdana 8')\
200
+ .place(x=start_x + 5 * dx, y=start_y + (5+count) * dy)
201
+ idx = 0
202
+ for exist in fls_exist:
203
+ if exist:
204
+ press.append(round(load.get_calculated_pressure(self.pressure_coords,all_acc[idx],
205
+ self._initial_structure_obj.
206
+ get_structure_type()), 1))
207
+ idx += 1
208
+
209
+ tk.Label(self._frame, text=press, font='Verdana 8') \
210
+ .place(x=start_x + 6.5 * dx, y=start_y + (5 + count) * dy)
211
+ count += 1
212
+ press = []
213
+ for comp in self.comp_objects:
214
+ if comp == None:
215
+ continue
216
+ tk.Label(self._frame, text=str(count) + '. ' +str(comp.get_name()), font='Verdana 8') \
217
+ .place(x=start_x + 5 * dx, y=start_y + (5 + count) * dy)
218
+
219
+ idx = 0
220
+
221
+ if fls_exist[0] and comp.is_loaded_condition():
222
+ press.append(round(comp.get_calculated_pressure(self.pressure_coords, all_acc[0]), 1))
223
+ if fls_exist[1] and comp.is_ballast_condition():
224
+ press.append(round(comp.get_calculated_pressure(self.pressure_coords, all_acc[1]), 1))
225
+ if fls_exist[2] and any([comp.is_loaded_condition(),comp.is_ballast_condition()]):
226
+ press.append(round(comp.get_calculated_pressure(self.pressure_coords, all_acc[2]), 1))
227
+
228
+ tk.Label(self._frame, text=press, font='Verdana 8') \
229
+ .place(x=start_x + 6.5 * dx, y=start_y + (5 + count) * dy)
230
+
231
+ count += 1
232
+
233
+ tk.Label(self._frame, text='Design life:', font='Verdana 8 bold') \
234
+ .place(x=start_x , y=start_y + 0*dy)
235
+ tk.Label(self._frame, text='Design Fatigue Factor (DFF):', font='Verdana 8 bold') \
236
+ .place(x=start_x+ 3*dx , y=start_y + 0*dy)
237
+ tk.Label(self._frame, text='SN-curve:', font='Verdana 8 bold') \
238
+ .place(x=start_x , y=start_y + 1*dy)
239
+ tk.Label(self._frame, text='Cycles in return period, n0', font='Verdana 8 bold') \
240
+ .place(x=start_x , y=start_y + 2*dy)
241
+ tk.Label(self._frame, text='Stress Concentration Factor, SCF', font='Verdana 8 bold') \
242
+ .place(x=start_x , y=start_y + 3*dy)
243
+
244
+ tk.Label(self._frame, text='Loaded', font='Verdana 8 bold') \
245
+ .place(x=start_x+2*dx , y=start_y + 5*dy)
246
+ tk.Label(self._frame, text='Ballast', font='Verdana 8 bold') \
247
+ .place(x=start_x+3*dx , y=start_y + 5*dy)
248
+ tk.Label(self._frame, text='Part', font='Verdana 8 bold') \
249
+ .place(x=start_x+4*dx , y=start_y + 5*dy)
250
+ tk.Label(self._frame, text='Defined loads', font='Verdana 8 bold') \
251
+ .place(x=start_x+5*dx , y=start_y + 5*dy)
252
+ tk.Label(self._frame, text='Resulting pressures', font='Verdana 8 bold') \
253
+ .place(x=start_x+6.5*dx , y=start_y + 5*dy)
254
+
255
+ tk.Label(self._frame, text='Fraction (sum of bal/part/loa is 1)', font='Verdana 8 bold') \
256
+ .place(x=start_x, y=start_y + 6 * dy)
257
+ tk.Label(self._frame, text='Weibull', font='Verdana 8 bold') \
258
+ .place(x=start_x , y=start_y + 7*dy)
259
+ tk.Label(self._frame, text='Period', font='Verdana 8 bold') \
260
+ .place(x=start_x , y=start_y + 8*dy)
261
+ tk.Label(self._frame, text='Corr. loc.', font='Verdana 8 bold') \
262
+ .place(x=start_x , y=start_y + 9*dy)
263
+ tk.Label(self._frame, text='Accelerations', font='Verdana 8 bold') \
264
+ .place(x=start_x , y=start_y + 10*dy)
265
+
266
+ self.ent_new_design_life.place(x=start_x+2*dx, y=start_y + 0 * dy)
267
+ self.ent_dff.place(x=start_x + 5 * dx, y=start_y + 0 * dy)
268
+ self.ent_sn_curve.place(x=start_x+2*dx , y=start_y + 1*dy)
269
+ self.ent_no_of_cycles .place(x=start_x+2*dx , y=start_y + 2*dy)
270
+ self.ent_k_factor.place(x=start_x+2*dx , y=start_y + 3*dy)
271
+
272
+ self.ent_fraction_loa.place(x=start_x + 2 * dx, y=start_y + 6 * dy)
273
+ self.ent_fraction_bal.place(x=start_x+3*dx , y=start_y + 6*dy)
274
+ self.ent_fraction_prt.place(x=start_x+4*dx , y=start_y + 6*dy)
275
+
276
+ self.ent_weibull_loa.place(x=start_x + 2 * dx, y=start_y + 7 * dy)
277
+ self.ent_weibull_bal.place(x=start_x+3*dx , y=start_y + 7*dy)
278
+ self.ent_weibull_prt.place(x=start_x+4*dx , y=start_y + 7*dy)
279
+
280
+ self.ent_period_loa.place(x=start_x + 2 * dx, y=start_y + 8 * dy)
281
+ self.ent_period_bal.place(x=start_x+3*dx, y=start_y + 8*dy)
282
+ self.ent_period_prt.place(x=start_x+4*dx, y=start_y + 8*dy)
283
+
284
+ self.ent_corr_loc_loa.place(x=start_x + 2 * dx, y=start_y + 9 * dy)
285
+ self.ent_corr_loc_bal.place(x=start_x+3*dx, y=start_y + 9*dy)
286
+ self.ent_corr_loc_prt.place(x=start_x+4*dx, y=start_y + 9*dy)
287
+
288
+ self.ent_acc_loa.place(x=start_x + 2 * dx, y=start_y + 10 * dy)
289
+ self.ent_acc_bal.place(x=start_x + 3 * dx, y=start_y + 10 * dy)
290
+ self.ent_acc_prt.place(x=start_x + 4 * dx, y=start_y + 10 * dy)
291
+
292
+ # if not loaded_exist:
293
+ # loa_fr.place(x=start_x + 2 * dx, y=start_y + 6 * dy)
294
+ # elif not ballast_exist:
295
+ # bal_fr.place(x=start_x + 3 * dx, y=start_y + 6 * dy)
296
+ # elif not part_exist:
297
+ # prt_fr.place(x=start_x + 4 * dx, y=start_y + 6 * dy)
298
+
299
+ self._close_and_save = tk.Button(self._frame, text='Return fatigue parameters',
300
+ command=self.save_and_close, bg='green', font='Verdana 15', fg='yellow')
301
+ self._close_and_save.place(x=start_x + dx, y=start_y + dy * 15)
302
+
303
+ def get_pressure_point_coord_from_two_points(self,p1,p2):
304
+ ''' Finding the coordinates to use in pressure calculations '''
305
+
306
+ if p1[1] <= p2[1]:
307
+ start_point = p1
308
+ end_point = p2
309
+ else:
310
+ start_point = p2
311
+ end_point = p1
312
+
313
+ vector = [end_point[0]-start_point[0], end_point[1]-start_point[1]]
314
+
315
+ return start_point[0]+vector[0]*1/3, start_point[1]+vector[1]*1/3
316
+
317
+ def change_sn_curve(self,event):
318
+ '''
319
+ Action when changing the structure type
320
+ :return:
321
+ '''
322
+ self.new_sn_curve.set(event)
323
+
324
+ def save_and_close(self):
325
+ '''
326
+ Save and close
327
+ :return:
328
+ '''
329
+ if __name__ == '__main__':
330
+ self._frame.destroy()
331
+ return
332
+ # order of return is (Loaded,Ballast,Part)
333
+ temp_dict = {'SN-curve':self.new_sn_curve.get(),
334
+ 'SCF':self.new_k_factor.get(),
335
+ 'Design life':self.new_design_life.get(),
336
+ 'n0':self.new_no_of_cycles.get(),
337
+ 'Weibull':(self.new_weibull_loa.get(),self.new_weibull_bal.get(),self.new_weibull_prt.get()),
338
+ 'Period':(self.new_period_loa.get(),self.new_period_bal.get(),self.new_period_prt.get()),
339
+ 'Fraction':(self.new_fraction_loa.get(),self.new_fraction_bal.get(),self.new_fraction_prt.get()),
340
+ 'CorrLoc':(self.new_corr_loc_loa.get(),self.new_corr_loc_bal.get(),self.new_corr_loc_prt.get()),
341
+ 'Order':('Loaded','Ballast','Part'),
342
+ 'Accelerations':(self.new_az_loa.get(),self.new_az_bal.get(),self.new_az_prt.get()),
343
+ 'DFF': self.new_dff.get()}
344
+
345
+ self.app.on_close_fatigue_window(temp_dict)
346
+ self._frame.destroy()
347
+
348
+
349
+ if __name__ == '__main__':
350
+ root = tk.Tk()
351
+ my_app = CreateFatigueWindow(root,app=None)
352
+ root.mainloop()