From 3a15b7be36dd80f031f385d1e5aefbd93369d730 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Wed, 19 Feb 2025 20:08:44 +0530 Subject: [PATCH 01/23] Added SimpleConnection module with 4 submodule placeholder and launcher --- src/osdag/osdagMainPage.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/osdag/osdagMainPage.py b/src/osdag/osdagMainPage.py index d49647a3b..10e460f2d 100644 --- a/src/osdag/osdagMainPage.py +++ b/src/osdag/osdagMainPage.py @@ -261,7 +261,13 @@ def __init__(self): self.ui.myStackedWidget.currentChanged.connect(self.current_changed) self.Under_Development='UNDER DEVELOPMENT' self.Modules={ - 'Connection' : { + 'Connection' : {'Simple Connection' : [ + ('Lap Joint Bolted',str(files("osdag.data.ResourceFiles.images").joinpath("LapJointBolted.png")),'Lap_Joint_Bolted'), + ('Lap Joint Welded',str(files("osdag.data.ResourceFiles.images").joinpath("LapJointWelded.png")),'Lap_Joint_Welded'), + ('Butt Joint Bolted',str(files("osdag.data.ResourceFiles.images").joinpath("ButtJointBolted.png")),'Butt_Joint_Bolted'), + ('Butt Joint Welded',str(files("osdag.data.ResourceFiles.images").joinpath("ButtJointWelded.png")),'Butt_Joint_Welded'), + self.show_simple_connection, + ], 'Shear Connection' : [ ('Fin Plate',str(files("osdag.data.ResourceFiles.images").joinpath("finplate.png")),'Fin_Plate'), ('Cleat Angle',str(files("osdag.data.ResourceFiles.images").joinpath("cleatAngle.png")),'Cleat_Angle'), @@ -530,7 +536,26 @@ def ButtonConnection(self,Button,Modules,ModuleName): Button.ui.LP_Button.clicked.connect(lambda : self.ui.myStackedWidget.setCurrentIndex(Modules.index(ModuleName)+1)) #################################### Module Launchers ########################################## - + @pyqtSlot() + def show_simple_connection(self): + if self.findChild(QRadioButton, 'Lap_Joint_Bolted').isChecked(): + module_class = SimpleConnection # Import from simple_connection.py + elif self.findChild(QRadioButton, 'Lap_Joint_Welded').isChecked(): + module_class = SimpleConnection # You might adjust parameters if needed + elif self.findChild(QRadioButton, 'Butt_Joint_Bolted').isChecked(): + module_class = SimpleConnection + elif self.findChild(QRadioButton, 'Butt_Joint_Welded').isChecked(): + module_class = SimpleConnection + else: + QMessageBox.about(self, "INFO", "Please select an appropriate variant") + return + + # Launch the module's UI window using the corresponding design class. + self.hide() + self.ui2 = Ui_ModuleWindow(module_class, ' ') + self.ui2.show() + self.ui2.closed.connect(self.show) + @pyqtSlot() def show_shear_connection(self): if self.findChild(QRadioButton,'Fin_Plate').isChecked(): From 56cbfc493b8c7990c4f57de41197f464c8bd8251 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Fri, 21 Feb 2025 21:14:07 +0530 Subject: [PATCH 02/23] Added input and output dock with parameters for the Lapjointbolted connection --- src/osdag/Common.py | 15 + .../connection/lap_joint_bolted.py | 449 ++++++++++++++++++ .../connection/moment_connection.py | 1 + src/osdag/design_type/main.py | 10 +- src/osdag/gui/UI_DESIGN_PREFERENCE.py | 3 +- src/osdag/gui/ui_template.py | 3 + src/osdag/osdagMainPage.py | 3 +- 7 files changed, 477 insertions(+), 7 deletions(-) create mode 100644 src/osdag/design_type/connection/lap_joint_bolted.py diff --git a/src/osdag/Common.py b/src/osdag/Common.py index bd5c20630..14d72557d 100644 --- a/src/osdag/Common.py +++ b/src/osdag/Common.py @@ -346,6 +346,7 @@ def is_valid_custom(self): KEY_DISP_COLUMNCOVERPLATE = 'Column-to-Column Cover Plate Bolted Connection' KEY_DISP_BEAMCOVERPLATEWELD = 'Beam-to-Beam Cover Plate Welded Connection' KEY_DISP_COLUMNCOVERPLATEWELD = 'Column-to-Column Cover Plate Welded Connection' +KEY_DISP_LAPJOINTBOLTED = 'Lap Joint Bolted Connection' # KEY_DISP_BEAMENDPLATE = 'Beam End Plate Connection' KEY_DISP_COLUMNENDPLATE = 'Column-to-Column End Plate Connection' KEY_DISP_BCENDPLATE = 'Beam-to-Column End Plate Connection' @@ -885,6 +886,7 @@ def is_valid_custom(self): DISP_MAX_CLEAT_HEIGHT = 'Max. Cleat Angle Height' DISP_MIN_CLEAT_THK = 'Min. Cleat Angle Thickness (mm)' DISP_MIN_WIDTH = 'Minimum Width (mm)' + DISP_MIN_PLATE_THICK = 'Min. Plate Thickness (mm)' ######### Minimun for Flange#### @@ -938,6 +940,16 @@ def is_valid_custom(self): # VALUES_CONN_BP = ['Welded-Slab Base', 'Bolted-Slab Base', 'Gusseted Base Plate', 'Hollow Section'] +#lapjointbolted +KEY_PLATE1_THICKNESS = "Plate1Thickness" +KEY_PLATE2_THICKNESS = "Plate2Thickness" +KEY_PLATE_WIDTH = "PlateWidth" +KEY_DISP_PLATE1_THICKNESS = "Thickness of Plate-1 (mm) *" +KEY_DISP_PLATE2_THICKNESS = "Thickness of Plate-2 (mm) *" +KEY_DISP_PLATE_WIDTH = "Width of Plate (mm) *" +KEY_TENSILE_FORCE = "TensileForce*" +KEY_DISP_TENSILE_FORCE = "Tensile Force (kN) *" + KEY_DISP_LENGTH = 'Length (mm) *' KEY_DISP_LOCATION = 'Conn_Location *' KEY_DISP_LOCATION_STRUT = 'Connection *' @@ -1310,6 +1322,7 @@ def is_valid_custom(self): DISP_TITLE_INTERMITTENT = 'Intermittent Connection' DISP_TITLE_BOLTD = 'Bolt Details' +DISP_TITLE_BOLTDS = 'Bolt Design' DISP_TITLE_PLATED = 'Plate Details' KEY_DISP_DP_DETAILING_GAP = 'Gap Between Beam and
Support (mm)' @@ -1799,6 +1812,8 @@ def is_valid_custom(self): KEY_OUT_GRD_PROVIDED = 'Bolt.Grade_Provided' +KEY_OUT_DISP_TYP_PROVIDED = 'Type' +KEY_OUT_TYP_PROVIDED = 'Bolt.Type_Provided' KEY_OUT_DISP_GRD_PROVIDED = 'Property Class' KEY_OUT_INTER_GRD_PROVIDED = 'Bolt.InterGrade' KEY_OUT_DISP_INTER_GRD_PROVIDED = 'Grade' diff --git a/src/osdag/design_type/connection/lap_joint_bolted.py b/src/osdag/design_type/connection/lap_joint_bolted.py new file mode 100644 index 000000000..8f1861f66 --- /dev/null +++ b/src/osdag/design_type/connection/lap_joint_bolted.py @@ -0,0 +1,449 @@ +""" +Module: lap_joint_bolted.py +Author: Aman +Date: 2025-02-18 + +Description: + LapJointBolted is a moment connection module that represents a bolted lap joint connection. + It inherits from MomentConnection and follows the same structure and design logic as other + connection modules (e.g., BeamCoverPlate, ColumnCoverPlate) used in Osdag. + +Reference: + - Osdag software guidelines and connection module structure documentation +""" + +from .moment_connection import MomentConnection +from ...utils.common.component import * +from ...utils.common.is800_2007 import * +from ...Common import * +from ...design_report.reportGenerator_latex import CreateLatex +from ...Report_functions import * +from ...utils.common.load import Load +import logging + +import math + +class LapJointBolted(MomentConnection): + def __init__(self): + super(LapJointBolted, self).__init__() + self.design_status = False + + ############################################### + # Design Preference Functions Start + ############################################### + def tab_list(self): + """ + + :return: This function returns the list of tuples. Each tuple will create a tab in design preferences, in the + order they are appended. Format of the Tuple is: + [Tab Title, Type of Tab, function for tab content) + Tab Title : Text which is displayed as Title of Tab, + Type of Tab: There are Three types of tab layouts. + Type_TAB_1: This have "Add", "Clear", "Download xlsx file" "Import xlsx file" + TYPE_TAB_2: This contains a Text box for side note. + TYPE_TAB_3: This is plain layout + function for tab content: All the values like labels, input widgets can be passed as list of tuples, + which will be displayed in chosen tab layout + + """ + tabs = [] + + t1 = (KEY_DISP_COLSEC, TYPE_TAB_1, self.tab_supporting_section) + tabs.append(t1) + + # t1 = (KEY_DISP_BEAMSEC, TYPE_TAB_1, self.tab_supported_section) + # tabs.append(t1) + + # t6 = ("Connector", TYPE_TAB_2, self.plate_connector_values) + # tabs.append(t6) + + t2 = ("Bolt", TYPE_TAB_2, self.bolt_values) + tabs.append(t2) + + # t2 = ("Weld", TYPE_TAB_2, self.weld_values) + # tabs.append(t2) + + t4 = ("Detailing", TYPE_TAB_2, self.detailing_values) + tabs.append(t4) + + # t5 = ("Design", TYPE_TAB_2, self.design_values) + # tabs.append(t5) + + return tabs + + def tab_value_changed(self): + """ + + :return: This function is used to update the values of the keys in design preferences, + which are dependent on other inputs. + It returns list of tuple which contains, tab name, keys whose values will be changed, + function to change the values and arguments for the function. + + [Tab Name, [Argument list], [list of keys to be updated], input widget type of keys, change_function] + + Here Argument list should have only one element. + Changing of this element,(either changing index or text depending on widget type), + will update the list of keys (this can be more than one). + + """ + change_tab = [] + + t1 = (KEY_DISP_COLSEC, [KEY_SUPTNGSEC_MATERIAL], [KEY_SUPTNGSEC_FU, KEY_SUPTNGSEC_FY], TYPE_TEXTBOX, + self.get_fu_fy_I_section_suptng) + change_tab.append(t1) + + # t2 = (KEY_DISP_BEAMSEC, [KEY_SUPTDSEC_MATERIAL], [KEY_SUPTDSEC_FU, KEY_SUPTDSEC_FY], TYPE_TEXTBOX, + # self.get_fu_fy_I_section_suptd) + # change_tab.append(t2) + + # t3 = ("Connector", [KEY_CONNECTOR_MATERIAL], [KEY_CONNECTOR_FU, KEY_CONNECTOR_FY_20, KEY_CONNECTOR_FY_20_40, + # KEY_CONNECTOR_FY_40], TYPE_TEXTBOX, self.get_fu_fy) + + # change_tab.append(t3) + + + t4 = (KEY_DISP_COLSEC, ['Label_1', 'Label_2', 'Label_3', 'Label_4', 'Label_5'], + ['Label_11', 'Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', + 'Label_19', 'Label_20','Label_21','Label_22',KEY_IMAGE], TYPE_TEXTBOX, self.get_I_sec_properties) + change_tab.append(t4) + + # t5 = (KEY_DISP_BEAMSEC, ['Label_1', 'Label_2', 'Label_3', 'Label_4','Label_5'], + # ['Label_11', 'Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', + # 'Label_19', 'Label_20','Label_21','Label_22',KEY_IMAGE], TYPE_TEXTBOX, self.get_I_sec_properties) + # change_tab.append(t5) + + t6 = (KEY_DISP_COLSEC, [KEY_SUPTNGSEC], [KEY_SOURCE], TYPE_TEXTBOX, self.change_source) + change_tab.append(t6) + + # t7 = (KEY_DISP_BEAMSEC, [KEY_SUPTDSEC], [KEY_SOURCE], TYPE_TEXTBOX, self.change_source) + # change_tab.append(t7) + + return change_tab + + def edit_tabs(self): + """ This function is required if the tab name changes based on connectivity or profile or any other key. + Not required for this module but empty list should be passed""" + return [] + + # def list_for_fu_fy_validation(self): + # """ This function is no longer required""" + # + # fu_fy_list = [] + # + # t2 = (KEY_SEC_MATERIAL, KEY_SEC_FU, KEY_SEC_FY) + # fu_fy_list.append(t2) + # + # t3 = (KEY_CONNECTOR_MATERIAL, KEY_CONNECTOR_FU, KEY_CONNECTOR_FY) + # fu_fy_list.append(t3) + # + # return fu_fy_list + + def input_dictionary_design_pref(self): + """ + + :return: This function is used to choose values of design preferences to be saved to design dictionary. + + It returns list of tuple which contains, tab name, input widget type of keys, keys whose values to be saved, + + [(Tab Name, input widget type of keys, [List of keys to be saved])] + + """ + design_input = [] + + t1 = (KEY_DISP_COLSEC, TYPE_COMBOBOX, [KEY_SUPTNGSEC_MATERIAL]) + design_input.append(t1) + + # t2 = (KEY_DISP_BEAMSEC, TYPE_COMBOBOX, [KEY_SUPTDSEC_MATERIAL]) + # design_input.append(t2) + + + + t3 = ("Bolt", TYPE_COMBOBOX, [KEY_DP_BOLT_TYPE, KEY_DP_BOLT_HOLE_TYPE, KEY_DP_BOLT_SLIP_FACTOR]) + design_input.append(t3) + + # t4 = ("Weld", TYPE_COMBOBOX, [KEY_DP_WELD_FAB]) + # design_input.append(t4) + + # t4 = ("Weld", TYPE_TEXTBOX, [KEY_DP_WELD_MATERIAL_G_O]) + # design_input.append(t4) + + t5 = ("Detailing", TYPE_COMBOBOX, [KEY_DP_DETAILING_EDGE_TYPE, KEY_DP_DETAILING_CORROSIVE_INFLUENCES]) + design_input.append(t5) + + t5 = ("Detailing", TYPE_TEXTBOX, [KEY_DP_DETAILING_GAP]) + design_input.append(t5) + + # t6 = ("Design", TYPE_COMBOBOX, [KEY_DP_DESIGN_METHOD]) + # design_input.append(t6) + + # t7 = ("Connector", TYPE_COMBOBOX, [KEY_CONNECTOR_MATERIAL]) + # design_input.append(t7) + + return design_input + + + def input_dictionary_without_design_pref(self): + """ + + :return: This function is used to choose values of design preferences to be saved to + design dictionary if design preference is never opened by user. It sets are design preference values to default. + If any design preference value needs to be set to input dock value, tuple shall be written as: + + (Key of input dock, [List of Keys from design prefernce], 'Input Dock') + + If the values needs to be set to default, + + (None, [List of Design Prefernce Keys], '') + + """ + design_input = [] + t1 = (KEY_MATERIAL, [KEY_SUPTNGSEC_MATERIAL], 'Input Dock') + design_input.append(t1) + + t2 = (None, [KEY_DP_BOLT_TYPE, KEY_DP_BOLT_HOLE_TYPE, KEY_DP_BOLT_SLIP_FACTOR, + KEY_DP_DETAILING_EDGE_TYPE, KEY_DP_DETAILING_GAP, + KEY_DP_DETAILING_CORROSIVE_INFLUENCES], '') + design_input.append(t2) + return design_input + + def refresh_input_dock(self): + """ + + :return: This function returns list of tuples which has keys that needs to be updated, + on changing Keys in design preference (ex: adding a new section to database should reflect in input dock) + + [(Tab Name, Input Dock Key, Input Dock Key type, design preference key, Master key, Value, Database Table Name)] + """ + add_buttons = [] + + t2 = (KEY_DISP_COLSEC, KEY_SECSIZE, TYPE_COMBOBOX, KEY_SECSIZE, None, None, "Columns") + add_buttons.append(t2) + + return add_buttons + + def get_values_for_design_pref(self, key, design_dictionary): + + # if design_dictionary[KEY_MATERIAL] != 'Select Material': + # fu = Material(design_dictionary[KEY_MATERIAL],41).fu + # else: + # fu = '' + + val = {KEY_DP_BOLT_TYPE: "Pretensioned", + KEY_DP_BOLT_HOLE_TYPE: "Standard", + KEY_DP_BOLT_SLIP_FACTOR: str(0.3), + # KEY_DP_WELD_FAB: KEY_DP_FAB_SHOP, + KEY_DP_DETAILING_EDGE_TYPE: "Sheared or hand flame cut", + KEY_DP_DETAILING_GAP: '3', + KEY_DP_DETAILING_CORROSIVE_INFLUENCES: 'No', + # KEY_DP_DESIGN_METHOD: "Limit State Design", + # KEY_CONNECTOR_MATERIAL: str(design_dictionary[KEY_MATERIAL]) + }[key] + + return val + + + + def out_bolt_bearing(self): + + bolt_type = self[0] + if bolt_type != TYP_BEARING: + return True + else: + return False + + def preference_type(self): + + pref_type = self[0] + if pref_type == VALUES_FLANGEPLATE_PREFERENCES[0]: + return True + else: + return False + #################################### + # Design Preference Functions End + #################################### + + def set_osdaglogger(key): + + """ + Function to set Logger for Tension Module + """ + + # @author Arsil Zunzunia + global logger + logger = logging.getLogger('Osdag') + + logger.setLevel(logging.DEBUG) + handler = logging.StreamHandler() + formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + + handler.setFormatter(formatter) + logger.addHandler(handler) + handler = logging.FileHandler('logging_text.log') + + formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + handler.setFormatter(formatter) + logger.addHandler(handler) + + if key is not None: + handler = OurLog(key) + formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', + datefmt='%Y-%m-%d %H:%M:%S') + handler.setFormatter(formatter) + logger.addHandler(handler) + + + def input_value_changed(self): + + lst = [] + + t8 = ([KEY_MATERIAL], KEY_MATERIAL, TYPE_CUSTOM_MATERIAL, self.new_material) + lst.append(t8) + + return lst + + + def input_values(self): + + options_list = [] + + t16 = (KEY_MODULE, KEY_DISP_LAPJOINTBOLTED, TYPE_MODULE, None, True, 'No Validator') + options_list.append(t16) + + t1 = (None, DISP_TITLE_CM, TYPE_TITLE, None, True, 'No Validator') + options_list.append(t1) + + t5 = (KEY_MATERIAL, KEY_DISP_MATERIAL, TYPE_COMBOBOX, VALUES_MATERIAL, True, 'No Validator') + options_list.append(t5) + + t31 = (KEY_PLATE1_THICKNESS, KEY_DISP_PLATE1_THICKNESS, TYPE_COMBOBOX_CUSTOMIZED, VALUES_FLANGEPLATE_THICKNESS, True, 'Float Validator') + options_list.append(t31) + + t34 = (KEY_PLATE2_THICKNESS, KEY_DISP_PLATE2_THICKNESS, TYPE_COMBOBOX_CUSTOMIZED, VALUES_FLANGEPLATE_THICKNESS, True, 'Float Validator') + options_list.append(t34) + + t35 = (KEY_PLATE_WIDTH, KEY_DISP_PLATE_WIDTH, TYPE_TEXTBOX, None, True, 'Float Validator') + options_list.append(t35) + + t6 = (None, DISP_TITLE_FSL, TYPE_TITLE, None, True, 'No Validator') + options_list.append(t6) + + t17 = (KEY_TENSILE_FORCE, KEY_DISP_TENSILE_FORCE, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t17) + + t9 = (None, DISP_TITLE_BOLT, TYPE_TITLE, None, True, 'No Validator') + options_list.append(t9) + + t10 = (KEY_D, KEY_DISP_D, TYPE_COMBOBOX_CUSTOMIZED, VALUES_D, True, 'No Validator') + options_list.append(t10) + + t12 = (KEY_GRD, KEY_DISP_GRD, TYPE_COMBOBOX_CUSTOMIZED, VALUES_GRD, True, 'No Validator') + options_list.append(t12) + + t11 = (KEY_TYP, KEY_DISP_TYP, TYPE_COMBOBOX, VALUES_TYP, True, 'No Validator') + options_list.append(t11) + + return options_list + + def customized_input(self): + + list1 = [] + t1 = (KEY_GRD, self.grdval_customized) + list1.append(t1) + t3 = (KEY_D, self.diam_bolt_customized) + list1.append(t3) + t5 = (KEY_PLATE1_THICKNESS, self.plate_thick_customized) + list1.append(t5) + t6 = (KEY_PLATE2_THICKNESS, self.plate_thick_customized) + list1.append(t6) + + return list1 + + def output_values(self, flag): + + out_list = [] + t4 = (None, DISP_TITLE_BOLTD, TYPE_TITLE, None, True) + out_list.append(t4) + + t2 = (KEY_OUT_D_PROVIDED, KEY_OUT_DISP_D_PROVIDED, TYPE_TEXTBOX, + '', True) + out_list.append(t2) + + t3 = (KEY_OUT_GRD_PROVIDED, KEY_OUT_DISP_GRD_PROVIDED, TYPE_TEXTBOX, + '', True) + out_list.append(t3) + + t31 = (KEY_OUT_TYP_PROVIDED, KEY_OUT_DISP_TYP_PROVIDED, TYPE_TEXTBOX, + '', True) + out_list.append(t31) + + t8 = (KEY_OUT_BOLT_SHEAR,KEY_OUT_DISP_BOLT_SHEAR , TYPE_TEXTBOX, '', True) + out_list.append(t8) + + t4 = (KEY_OUT_BOLT_BEARING, KEY_OUT_DISP_BOLT_BEARING, TYPE_TEXTBOX, '', True) + out_list.append(t4) + + t5 = (KEY_OUT_BOLT_CAPACITY, KEY_OUT_DISP_BOLT_CAPACITY, TYPE_TEXTBOX, + '', True) + out_list.append(t5) + + t17 = (None, DISP_TITLE_BOLTDS, TYPE_TITLE, None, True) + out_list.append(t17) + t17 = (KEY_OUT_TOT_NO_BOLTS, KEY_OUT_DISP_TOT_NO_BOLTS, TYPE_TEXTBOX, '', True) + out_list.append(t17) + t18 = (KEY_OUT_ROW_PROVIDED, KEY_OUT_DISP_ROW_PROVIDED, TYPE_TEXTBOX,'', True) + out_list.append(t18) + + t19 = (KEY_OUT_COL_PROVIDED, KEY_OUT_DISP_COL_PROVIDED, TYPE_TEXTBOX,'', True) + out_list.append(t19) + + t20 = (KEY_OUT_PLATE_LENGTH, KEY_OUT_DISP_PLATE_LENGTH, TYPE_TEXTBOX,'', True) + out_list.append(t20) + + return out_list + + def module_name(self): + + return KEY_DISP_LAPJOINTBOLTED + + def call_3DColumn(self, ui, bgcolor): + # status = self.resultObj['Bolt']['status'] + # if status is True: + # self.ui.chkBx_beamSec1.setChecked(Qt.Checked) + if ui.chkBxCol.isChecked(): + ui.btn3D.setChecked(Qt.Unchecked) + ui.chkBxCol.setChecked(Qt.Unchecked) + ui.mytabWidget.setCurrentIndex(0) + # self.display_3DModel("Beam", bgcolor) + ui.commLogicObj.display_3DModel("Column", bgcolor) + + def get_3d_components(self): + components = [] + + t1 = ('Model', self.call_3DModel) + components.append(t1) + + t3 = ('Column', self.call_3DColumn) + components.append(t3) + + t4 = ('Cover Plate', self.call_3DPlate) + components.append(t4) + + return components + + def call_3DPlate(self, ui, bgcolor): + from PyQt5.QtWidgets import QCheckBox + from PyQt5.QtCore import Qt + for chkbox in ui.frame.children(): + if chkbox.objectName() == 'Cover Plate': + continue + if isinstance(chkbox, QCheckBox): + chkbox.setChecked(Qt.Unchecked) + ui.commLogicObj.display_3DModel("Cover Plate", bgcolor) + + + ################################ Outlist Dict ##################################################################################### + + + + ################################ Design Report ##################################################################################### + diff --git a/src/osdag/design_type/connection/moment_connection.py b/src/osdag/design_type/connection/moment_connection.py index 0e44f6823..9e712ea54 100644 --- a/src/osdag/design_type/connection/moment_connection.py +++ b/src/osdag/design_type/connection/moment_connection.py @@ -24,6 +24,7 @@ def tab_section(self, input_dictionary): if not input_dictionary or input_dictionary[KEY_SECSIZE] == 'Select Section' or \ input_dictionary[KEY_MATERIAL] == 'Select Material': + designation = '' material_grade = '' source = 'Custom' diff --git a/src/osdag/design_type/main.py b/src/osdag/design_type/main.py index d4c742ee9..413938417 100644 --- a/src/osdag/design_type/main.py +++ b/src/osdag/design_type/main.py @@ -90,8 +90,8 @@ def weld_values(self, input_dictionary): def detailing_values(self, input_dictionary): values = {KEY_DP_DETAILING_EDGE_TYPE: 'Sheared or hand flame cut', - KEY_DP_DETAILING_GAP: '10', - KEY_DP_DETAILING_CORROSIVE_INFLUENCES: 'No'} + KEY_DP_DETAILING_GAP: '10', + KEY_DP_DETAILING_CORROSIVE_INFLUENCES: 'No'} for key in values.keys(): if key in input_dictionary.keys(): @@ -100,15 +100,15 @@ def detailing_values(self, input_dictionary): detailing = [] t1 = (KEY_DP_DETAILING_EDGE_TYPE, KEY_DISP_DP_DETAILING_EDGE_TYPE, TYPE_COMBOBOX, - ['Sheared or hand flame cut', 'Rolled, machine-flame cut, sawn and planed'], - values[KEY_DP_DETAILING_EDGE_TYPE]) + ['Sheared or hand flame cut', 'Rolled, machine-flame cut, sawn and planed'], + values[KEY_DP_DETAILING_EDGE_TYPE]) detailing.append(t1) t2 = (KEY_DP_DETAILING_GAP, KEY_DISP_DP_DETAILING_GAP, TYPE_TEXTBOX, None, values[KEY_DP_DETAILING_GAP]) detailing.append(t2) t3 = (KEY_DP_DETAILING_CORROSIVE_INFLUENCES, KEY_DISP_DP_DETAILING_CORROSIVE_INFLUENCES, TYPE_COMBOBOX, - ['No', 'Yes'], values[KEY_DP_DETAILING_CORROSIVE_INFLUENCES]) + ['No', 'Yes'], values[KEY_DP_DETAILING_CORROSIVE_INFLUENCES]) detailing.append(t3) t4 = ("textBrowser", "", TYPE_TEXT_BROWSER, DETAILING_DESCRIPTION, None) diff --git a/src/osdag/gui/UI_DESIGN_PREFERENCE.py b/src/osdag/gui/UI_DESIGN_PREFERENCE.py index c695c3e49..15c58e104 100644 --- a/src/osdag/gui/UI_DESIGN_PREFERENCE.py +++ b/src/osdag/gui/UI_DESIGN_PREFERENCE.py @@ -479,7 +479,7 @@ def initUI(self,main,input_dictionary): pushButton_Download_Angle = self.tabWidget.tabs.findChild(QWidget, "pushButton_Download_" + KEY_DISP_SEATED_ANGLE) pushButton_Download_Angle.clicked.connect(lambda: self.download_Database(table="Angles", call_type="header")) - if module == KEY_DISP_COLUMNCOVERPLATE or module == KEY_DISP_COLUMNCOVERPLATEWELD or module == KEY_DISP_COLUMNENDPLATE: + if module == KEY_DISP_COLUMNCOVERPLATE or module == KEY_DISP_COLUMNCOVERPLATEWELD or module == KEY_DISP_COLUMNENDPLATE or KEY_DISP_LAPJOINTBOLTED: pushButton_Clear_Column = self.tabWidget.tabs.findChild(QtWidgets.QWidget, "pushButton_Clear_" + KEY_DISP_COLSEC) pushButton_Clear_Column.clicked.connect(lambda: self.clear_tab(KEY_DISP_COLSEC)) pushButton_Add_Column = self.tabWidget.tabs.findChild(QtWidgets.QWidget, "pushButton_Add_" + KEY_DISP_COLSEC) @@ -619,6 +619,7 @@ def add_baseplate_tab_column(self): shs = connectdb("SHS", call_type="popup") chs = connectdb("CHS", call_type="popup") hs = rhs + shs + input_section = self.input_dictionary[KEY_SECSIZE] if input_section in hs: diff --git a/src/osdag/gui/ui_template.py b/src/osdag/gui/ui_template.py index c112b739e..89c12cf5a 100644 --- a/src/osdag/gui/ui_template.py +++ b/src/osdag/gui/ui_template.py @@ -45,6 +45,7 @@ from ..design_type.connection.beam_beam_end_plate_splice import BeamBeamEndPlateSplice from ..design_type.connection.column_end_plate import ColumnEndPlate from ..design_type.connection.column_cover_plate_weld import ColumnCoverPlateWeld +from ..design_type.connection.lap_joint_bolted import LapJointBolted from ..design_type.connection.base_plate_connection import BasePlateConnection from ..design_type.tension_member.tension_bolted import Tension_bolted from ..design_type.tension_member.tension_welded import Tension_welded @@ -1850,6 +1851,8 @@ def return_class(self,name): return ColumnEndPlate elif name == KEY_DISP_BCENDPLATE: return BeamColumnEndPlate + elif name == KEY_DISP_LAPJOINTBOLTED: + return LapJointBolted elif name == KEY_DISP_BASE_PLATE: return BasePlateConnection elif name == KEY_DISP_TENSION_BOLTED: diff --git a/src/osdag/osdagMainPage.py b/src/osdag/osdagMainPage.py index 10e460f2d..ffca1d1cd 100644 --- a/src/osdag/osdagMainPage.py +++ b/src/osdag/osdagMainPage.py @@ -148,6 +148,7 @@ from .design_type.connection.base_plate_connection import BasePlateConnection from .design_type.connection.truss_connection_bolted import TrussConnectionBolted +from .design_type.connection.lap_joint_bolted import LapJointBolted from .design_type.connection.beam_cover_plate import BeamCoverPlate from .design_type.connection.beam_cover_plate_weld import BeamCoverPlateWeld from .design_type.connection.column_cover_plate_weld import ColumnCoverPlateWeld @@ -539,7 +540,7 @@ def ButtonConnection(self,Button,Modules,ModuleName): @pyqtSlot() def show_simple_connection(self): if self.findChild(QRadioButton, 'Lap_Joint_Bolted').isChecked(): - module_class = SimpleConnection # Import from simple_connection.py + module_class =LapJointBolted # Import from simple_connection.py elif self.findChild(QRadioButton, 'Lap_Joint_Welded').isChecked(): module_class = SimpleConnection # You might adjust parameters if needed elif self.findChild(QRadioButton, 'Butt_Joint_Bolted').isChecked(): From 3a22cb4ee98ab247866c21707166e405d9658867 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Mon, 24 Feb 2025 02:21:49 +0530 Subject: [PATCH 03/23] Added Design preferences for Bolt and Detailing --- .../connection/lap_joint_bolted.py | 299 ++++++------------ .../connection/moment_connection.py | 10 +- src/osdag/gui/UI_DESIGN_PREFERENCE.py | 5 +- src/osdag/gui/ui_template.py | 23 +- 4 files changed, 98 insertions(+), 239 deletions(-) diff --git a/src/osdag/design_type/connection/lap_joint_bolted.py b/src/osdag/design_type/connection/lap_joint_bolted.py index 8f1861f66..a378cb1ea 100644 --- a/src/osdag/design_type/connection/lap_joint_bolted.py +++ b/src/osdag/design_type/connection/lap_joint_bolted.py @@ -32,232 +32,114 @@ def __init__(self): # Design Preference Functions Start ############################################### def tab_list(self): - """ - - :return: This function returns the list of tuples. Each tuple will create a tab in design preferences, in the - order they are appended. Format of the Tuple is: - [Tab Title, Type of Tab, function for tab content) - Tab Title : Text which is displayed as Title of Tab, - Type of Tab: There are Three types of tab layouts. - Type_TAB_1: This have "Add", "Clear", "Download xlsx file" "Import xlsx file" - TYPE_TAB_2: This contains a Text box for side note. - TYPE_TAB_3: This is plain layout - function for tab content: All the values like labels, input widgets can be passed as list of tuples, - which will be displayed in chosen tab layout - - """ tabs = [] - - t1 = (KEY_DISP_COLSEC, TYPE_TAB_1, self.tab_supporting_section) - tabs.append(t1) - - # t1 = (KEY_DISP_BEAMSEC, TYPE_TAB_1, self.tab_supported_section) - # tabs.append(t1) - - # t6 = ("Connector", TYPE_TAB_2, self.plate_connector_values) - # tabs.append(t6) - - t2 = ("Bolt", TYPE_TAB_2, self.bolt_values) - tabs.append(t2) - - # t2 = ("Weld", TYPE_TAB_2, self.weld_values) - # tabs.append(t2) - - t4 = ("Detailing", TYPE_TAB_2, self.detailing_values) - tabs.append(t4) - - # t5 = ("Design", TYPE_TAB_2, self.design_values) - # tabs.append(t5) - + # Only Bolt and Detailing tabs + tabs.append(("Bolt", TYPE_TAB_2, self.bolt_values)) + tabs.append(("Detailing", TYPE_TAB_2, self.detailing_values)) return tabs def tab_value_changed(self): - """ - - :return: This function is used to update the values of the keys in design preferences, - which are dependent on other inputs. - It returns list of tuple which contains, tab name, keys whose values will be changed, - function to change the values and arguments for the function. - - [Tab Name, [Argument list], [list of keys to be updated], input widget type of keys, change_function] - - Here Argument list should have only one element. - Changing of this element,(either changing index or text depending on widget type), - will update the list of keys (this can be more than one). - - """ - change_tab = [] - - t1 = (KEY_DISP_COLSEC, [KEY_SUPTNGSEC_MATERIAL], [KEY_SUPTNGSEC_FU, KEY_SUPTNGSEC_FY], TYPE_TEXTBOX, - self.get_fu_fy_I_section_suptng) - change_tab.append(t1) - - # t2 = (KEY_DISP_BEAMSEC, [KEY_SUPTDSEC_MATERIAL], [KEY_SUPTDSEC_FU, KEY_SUPTDSEC_FY], TYPE_TEXTBOX, - # self.get_fu_fy_I_section_suptd) - # change_tab.append(t2) - - # t3 = ("Connector", [KEY_CONNECTOR_MATERIAL], [KEY_CONNECTOR_FU, KEY_CONNECTOR_FY_20, KEY_CONNECTOR_FY_20_40, - # KEY_CONNECTOR_FY_40], TYPE_TEXTBOX, self.get_fu_fy) - - # change_tab.append(t3) - - - t4 = (KEY_DISP_COLSEC, ['Label_1', 'Label_2', 'Label_3', 'Label_4', 'Label_5'], - ['Label_11', 'Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', - 'Label_19', 'Label_20','Label_21','Label_22',KEY_IMAGE], TYPE_TEXTBOX, self.get_I_sec_properties) - change_tab.append(t4) - - # t5 = (KEY_DISP_BEAMSEC, ['Label_1', 'Label_2', 'Label_3', 'Label_4','Label_5'], - # ['Label_11', 'Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', - # 'Label_19', 'Label_20','Label_21','Label_22',KEY_IMAGE], TYPE_TEXTBOX, self.get_I_sec_properties) - # change_tab.append(t5) - - t6 = (KEY_DISP_COLSEC, [KEY_SUPTNGSEC], [KEY_SOURCE], TYPE_TEXTBOX, self.change_source) - change_tab.append(t6) - - # t7 = (KEY_DISP_BEAMSEC, [KEY_SUPTDSEC], [KEY_SOURCE], TYPE_TEXTBOX, self.change_source) - # change_tab.append(t7) - - return change_tab - - def edit_tabs(self): - """ This function is required if the tab name changes based on connectivity or profile or any other key. - Not required for this module but empty list should be passed""" + # No tab value dependencies needed for bolt and detailing return [] - # def list_for_fu_fy_validation(self): - # """ This function is no longer required""" - # - # fu_fy_list = [] - # - # t2 = (KEY_SEC_MATERIAL, KEY_SEC_FU, KEY_SEC_FY) - # fu_fy_list.append(t2) - # - # t3 = (KEY_CONNECTOR_MATERIAL, KEY_CONNECTOR_FU, KEY_CONNECTOR_FY) - # fu_fy_list.append(t3) - # - # return fu_fy_list + def edit_tabs(self): + return [] # Keep original empty implementation def input_dictionary_design_pref(self): - """ - - :return: This function is used to choose values of design preferences to be saved to design dictionary. - - It returns list of tuple which contains, tab name, input widget type of keys, keys whose values to be saved, - - [(Tab Name, input widget type of keys, [List of keys to be saved])] - - """ design_input = [] - - t1 = (KEY_DISP_COLSEC, TYPE_COMBOBOX, [KEY_SUPTNGSEC_MATERIAL]) - design_input.append(t1) - - # t2 = (KEY_DISP_BEAMSEC, TYPE_COMBOBOX, [KEY_SUPTDSEC_MATERIAL]) - # design_input.append(t2) - - - - t3 = ("Bolt", TYPE_COMBOBOX, [KEY_DP_BOLT_TYPE, KEY_DP_BOLT_HOLE_TYPE, KEY_DP_BOLT_SLIP_FACTOR]) - design_input.append(t3) - - # t4 = ("Weld", TYPE_COMBOBOX, [KEY_DP_WELD_FAB]) - # design_input.append(t4) - - # t4 = ("Weld", TYPE_TEXTBOX, [KEY_DP_WELD_MATERIAL_G_O]) - # design_input.append(t4) - - t5 = ("Detailing", TYPE_COMBOBOX, [KEY_DP_DETAILING_EDGE_TYPE, KEY_DP_DETAILING_CORROSIVE_INFLUENCES]) - design_input.append(t5) - - t5 = ("Detailing", TYPE_TEXTBOX, [KEY_DP_DETAILING_GAP]) - design_input.append(t5) - - # t6 = ("Design", TYPE_COMBOBOX, [KEY_DP_DESIGN_METHOD]) - # design_input.append(t6) - - # t7 = ("Connector", TYPE_COMBOBOX, [KEY_CONNECTOR_MATERIAL]) - # design_input.append(t7) - + + # Bolt preferences + design_input.append(("Bolt", TYPE_COMBOBOX, [ + KEY_DP_BOLT_TYPE, # For pretensioned/non-pretensioned + KEY_DP_BOLT_HOLE_TYPE, # For standard/oversized + KEY_DP_BOLT_SLIP_FACTOR # For slip factor as per Table 20 + ])) + + # Detailing preferences + design_input.append(("Detailing", TYPE_COMBOBOX, [ + KEY_DP_DETAILING_EDGE_TYPE # For edge preparation method + ])) + return design_input - def input_dictionary_without_design_pref(self): - """ - - :return: This function is used to choose values of design preferences to be saved to - design dictionary if design preference is never opened by user. It sets are design preference values to default. - If any design preference value needs to be set to input dock value, tuple shall be written as: - - (Key of input dock, [List of Keys from design prefernce], 'Input Dock') - - If the values needs to be set to default, - - (None, [List of Design Prefernce Keys], '') - - """ design_input = [] - t1 = (KEY_MATERIAL, [KEY_SUPTNGSEC_MATERIAL], 'Input Dock') - design_input.append(t1) - - t2 = (None, [KEY_DP_BOLT_TYPE, KEY_DP_BOLT_HOLE_TYPE, KEY_DP_BOLT_SLIP_FACTOR, - KEY_DP_DETAILING_EDGE_TYPE, KEY_DP_DETAILING_GAP, - KEY_DP_DETAILING_CORROSIVE_INFLUENCES], '') - design_input.append(t2) + + # Default values for bolt and detailing + design_input.append((None, [ + KEY_DP_BOLT_TYPE, + KEY_DP_BOLT_HOLE_TYPE, + KEY_DP_BOLT_SLIP_FACTOR, + KEY_DP_DETAILING_EDGE_TYPE + ], '')) + return design_input - def refresh_input_dock(self): - """ - - :return: This function returns list of tuples which has keys that needs to be updated, - on changing Keys in design preference (ex: adding a new section to database should reflect in input dock) - - [(Tab Name, Input Dock Key, Input Dock Key type, design preference key, Master key, Value, Database Table Name)] - """ - add_buttons = [] - - t2 = (KEY_DISP_COLSEC, KEY_SECSIZE, TYPE_COMBOBOX, KEY_SECSIZE, None, None, "Columns") - add_buttons.append(t2) - - return add_buttons - def get_values_for_design_pref(self, key, design_dictionary): + # Default values as per requirements + defaults = { + KEY_DP_BOLT_TYPE: "Non Pre-tensioned", + KEY_DP_BOLT_HOLE_TYPE: "Standard", + KEY_DP_BOLT_SLIP_FACTOR: "0.3", + KEY_DP_DETAILING_EDGE_TYPE: "Sheared or hand flame cut" + } + return defaults.get(key) + + def detailing_values(self, input_dictionary): + values = { + KEY_DP_DETAILING_EDGE_TYPE: 'Sheared or hand flame cut' + } + + for key in values.keys(): + if key in input_dictionary.keys(): + values[key] = input_dictionary[key] + + detailing = [] + + # Edge preparation method as per Cl. 10.2.4 of IS:800:2007 + t1 = (KEY_DP_DETAILING_EDGE_TYPE, KEY_DISP_DP_DETAILING_EDGE_TYPE, TYPE_COMBOBOX, + ['Sheared or hand flame cut', 'Rolled, machine-flame cut, sawn and planed'], + values[KEY_DP_DETAILING_EDGE_TYPE]) + detailing.append(t1) + t4 = ("textBrowser", "", TYPE_TEXT_BROWSER, DETAILING_DESCRIPTION, None) + detailing.append(t4) + + return detailing + + # def bolt_values(self, input_dictionary): + # values = { + # KEY_DP_BOLT_TYPE: 'Non Pre-tensioned', + # KEY_DP_BOLT_HOLE_TYPE: 'Standard', + # KEY_DP_BOLT_SLIP_FACTOR: '0.3' + # } + + # for key in values.keys(): + # if key in input_dictionary.keys(): + # values[key] = input_dictionary[key] + + # bolt = [] + + # # Bolt type selection + # t1 = (KEY_DP_BOLT_TYPE, "Type", TYPE_COMBOBOX, + # ['Non Pre-tensioned', 'Pre-tensioned'], + # values[KEY_DP_BOLT_TYPE]) + # bolt.append(t1) + + # # Bolt hole type + # t2 = (KEY_DP_BOLT_HOLE_TYPE, "Bolt Hole", TYPE_COMBOBOX, + # ['Standard', 'Over-sized'], + # values[KEY_DP_BOLT_HOLE_TYPE]) + # bolt.append(t2) + + # # Slip factor as per Table 20 of IS 800 + # t3 = (KEY_DP_BOLT_SLIP_FACTOR, "Slip Factor", TYPE_COMBOBOX, + # ['0.3', '0.45', '0.5'], + # values[KEY_DP_BOLT_SLIP_FACTOR]) + # bolt.append(t3) - # if design_dictionary[KEY_MATERIAL] != 'Select Material': - # fu = Material(design_dictionary[KEY_MATERIAL],41).fu - # else: - # fu = '' - - val = {KEY_DP_BOLT_TYPE: "Pretensioned", - KEY_DP_BOLT_HOLE_TYPE: "Standard", - KEY_DP_BOLT_SLIP_FACTOR: str(0.3), - # KEY_DP_WELD_FAB: KEY_DP_FAB_SHOP, - KEY_DP_DETAILING_EDGE_TYPE: "Sheared or hand flame cut", - KEY_DP_DETAILING_GAP: '3', - KEY_DP_DETAILING_CORROSIVE_INFLUENCES: 'No', - # KEY_DP_DESIGN_METHOD: "Limit State Design", - # KEY_CONNECTOR_MATERIAL: str(design_dictionary[KEY_MATERIAL]) - }[key] - - return val - - - - def out_bolt_bearing(self): - - bolt_type = self[0] - if bolt_type != TYP_BEARING: - return True - else: - return False + # return bolt - def preference_type(self): - pref_type = self[0] - if pref_type == VALUES_FLANGEPLATE_PREFERENCES[0]: - return True - else: - return False #################################### # Design Preference Functions End #################################### @@ -445,5 +327,4 @@ def call_3DPlate(self, ui, bgcolor): - ################################ Design Report ##################################################################################### - + ################################ Design Report ##################################################################################### \ No newline at end of file diff --git a/src/osdag/design_type/connection/moment_connection.py b/src/osdag/design_type/connection/moment_connection.py index 9e712ea54..d4218ad67 100644 --- a/src/osdag/design_type/connection/moment_connection.py +++ b/src/osdag/design_type/connection/moment_connection.py @@ -21,9 +21,9 @@ def __init__(self): def tab_section(self, input_dictionary): "In design preference, it shows other properties of section used " - - if not input_dictionary or input_dictionary[KEY_SECSIZE] == 'Select Section' or \ - input_dictionary[KEY_MATERIAL] == 'Select Material': + section_value = input_dictionary.get(KEY_SECSIZE, 'Select Section') + material_value = input_dictionary.get(KEY_MATERIAL, 'Select Material') + if not input_dictionary or section_value == 'Select Section' or material_value == 'Select Material': designation = '' material_grade = '' @@ -55,8 +55,8 @@ def tab_section(self, input_dictionary): warping_const = '' image = VALUES_IMG_BEAM[0] else: - designation = str(input_dictionary[KEY_SECSIZE]) - material_grade = str(input_dictionary[KEY_MATERIAL]) + designation = str(input_dictionary.get(KEY_SECSIZE, '')) + material_grade = str(input_dictionary.get(KEY_MATERIAL, '')) m_o_e = "200" m_o_r = "76.9" p_r = "0.3" diff --git a/src/osdag/gui/UI_DESIGN_PREFERENCE.py b/src/osdag/gui/UI_DESIGN_PREFERENCE.py index 15c58e104..2e70e80b6 100644 --- a/src/osdag/gui/UI_DESIGN_PREFERENCE.py +++ b/src/osdag/gui/UI_DESIGN_PREFERENCE.py @@ -479,7 +479,7 @@ def initUI(self,main,input_dictionary): pushButton_Download_Angle = self.tabWidget.tabs.findChild(QWidget, "pushButton_Download_" + KEY_DISP_SEATED_ANGLE) pushButton_Download_Angle.clicked.connect(lambda: self.download_Database(table="Angles", call_type="header")) - if module == KEY_DISP_COLUMNCOVERPLATE or module == KEY_DISP_COLUMNCOVERPLATEWELD or module == KEY_DISP_COLUMNENDPLATE or KEY_DISP_LAPJOINTBOLTED: + if module == KEY_DISP_COLUMNCOVERPLATE or module == KEY_DISP_COLUMNCOVERPLATEWELD or module == KEY_DISP_COLUMNENDPLATE: pushButton_Clear_Column = self.tabWidget.tabs.findChild(QtWidgets.QWidget, "pushButton_Clear_" + KEY_DISP_COLSEC) pushButton_Clear_Column.clicked.connect(lambda: self.clear_tab(KEY_DISP_COLSEC)) pushButton_Add_Column = self.tabWidget.tabs.findChild(QtWidgets.QWidget, "pushButton_Add_" + KEY_DISP_COLSEC) @@ -619,7 +619,6 @@ def add_baseplate_tab_column(self): shs = connectdb("SHS", call_type="popup") chs = connectdb("CHS", call_type="popup") hs = rhs + shs - input_section = self.input_dictionary[KEY_SECSIZE] if input_section in hs: @@ -1685,4 +1684,4 @@ def close_designPref(self): # def closeEvent(self, QCloseEvent): # self.save_designPref_para() - # QCloseEvent.accept() + # QCloseEvent.accept() \ No newline at end of file diff --git a/src/osdag/gui/ui_template.py b/src/osdag/gui/ui_template.py index 89c12cf5a..d4fab5475 100644 --- a/src/osdag/gui/ui_template.py +++ b/src/osdag/gui/ui_template.py @@ -45,7 +45,6 @@ from ..design_type.connection.beam_beam_end_plate_splice import BeamBeamEndPlateSplice from ..design_type.connection.column_end_plate import ColumnEndPlate from ..design_type.connection.column_cover_plate_weld import ColumnCoverPlateWeld -from ..design_type.connection.lap_joint_bolted import LapJointBolted from ..design_type.connection.base_plate_connection import BasePlateConnection from ..design_type.tension_member.tension_bolted import Tension_bolted from ..design_type.tension_member.tension_welded import Tension_welded @@ -866,7 +865,6 @@ def setupUi(self, MainWindow, main,folder): else: for t in updated_list: for key_name in t[0]: - key_changed = self.dockWidgetContents.findChild(QtWidgets.QWidget, key_name) self.on_change_connect(key_changed, updated_list, data, main) print(f"key_name{key_name} \n key_changed{key_changed} \n self.on_change_connect ") @@ -1851,8 +1849,6 @@ def return_class(self,name): return ColumnEndPlate elif name == KEY_DISP_BCENDPLATE: return BeamColumnEndPlate - elif name == KEY_DISP_LAPJOINTBOLTED: - return LapJointBolted elif name == KEY_DISP_BASE_PLATE: return BasePlateConnection elif name == KEY_DISP_TENSION_BOLTED: @@ -2137,24 +2133,7 @@ def common_function_for_save_and_design(self, main, data, trigger_type): action.setEnabled(True) fName = str('./ResourceFiles/images/3d.png') file_extension = fName.split(".")[-1] - - # if file_extension == 'png': - # self.display.ExportToImage(fName) - # im = Image.open('./ResourceFiles/images/3d.png') - # w,h=im.size - # if(w< 640 or h < 360): - # print('Re-taking Screenshot') - # self.resize(700,500) - # self.outputDock.hide() - # self.inputDock.hide() - # self.textEdit.hide() - # QTimer.singleShot(0, lambda:self.retakeScreenshot(fName)) - else: - for fName in ['3d.png', 'top.png', - 'front.png', 'side.png']: - with open("./ResourceFiles/images/"+fName, 'w'): - pass self.display.EraseAll() for chkbox in main.get_3d_components(main): self.frame.findChild(QtWidgets.QCheckBox, chkbox[0]).setEnabled(False) @@ -3043,4 +3022,4 @@ def showEvent(self, event): ui = Ui_ModuleWindow() ui.setupUi(MainWindow) MainWindow.show() - sys.exit(app.exec_()) + sys.exit(app.exec_()) \ No newline at end of file From 833ddc7f29d1b6683828f4a9ccf71b1b0ddfed7e Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Mon, 24 Feb 2025 02:32:08 +0530 Subject: [PATCH 04/23] Updated the detailing tab display message --- src/osdag/Common.py | 7 +++++++ src/osdag/design_type/connection/lap_joint_bolted.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/osdag/Common.py b/src/osdag/Common.py index 14d72557d..0aefe29c8 100644 --- a/src/osdag/Common.py +++ b/src/osdag/Common.py @@ -2503,6 +2503,13 @@ def get_leg_lengths(designation): "

Specifying whether the members are exposed to corrosive influences, here, only affects the calculation of the maximum edge distance as per cl. 10.2.4.3

\n" "


") +DETAILING_DESCRIPTION_LAPJOINT = str("\n" + "\n" + "

The minimum edge and end distances from the centre of any hole to the nearest edge of a plate shall not be less than 1.7 times the hole diameter in case of [sheared or hand flame cut edges] and 1.5 times the hole diameter in case of [Rolled, machine-flame cut, sawn and planed edges] (IS 800 - cl. 10. 2. 4. 2)

\n" + "


\n") + COLUMN_OPTIMIZATION_DESCRIPTION = str("\n" "\n" ) + Allowable_Utilization_Para + Effective_Area_Para + Effective_Length_Para + OPTIMIZATION_TABLE_UI + Bearing_Length_Para + +PLATE_GIRDER_DEFLECTION_TABLE = str(""" + + + + Clause 5.6.1 Deflection + + + + +

Clause 5.6.1 Deflection

+

Vertical Deflection - Table 6 of IS800-2007

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type of structureLoad TypeMemberSupportingDeflection Limit
Industrial buildingLive LoadPurlins and GirtsElastic claddingSpan/150
Industrial buildingLive LoadPurlins and GirtsBrittle claddingSpan/180
Industrial buildingLive LoadSimple spanElastic claddingSpan/240
Industrial buildingLive LoadSimple spanBrittle claddingSpan/300
Industrial buildingLive LoadCantilever spanElastic claddingSpan/120
Industrial buildingLive LoadCantilever spanBrittle claddingSpan/150
Industrial buildingLive LoadRafter supportingProfiled Metal SheetingSpan/180
Industrial buildingLive LoadRafter supportingPlastered SheetingSpan/240
Industrial buildingCrane Load(Manual operation)GantryCraneSpan/500
Industrial buildingCrane load(Electric operation up to 50t)GantryCraneSpan/750
Industrial buildingCrane load(Electric operation over 50t)GantryCraneSpan/1000
Other buildingsLive LoadFloor and RoofElements not susceptible to crackingSpan/300
Other buildingsLive LoadFloor and RoofElement susceptible to crackingSpan/360
Other buildingsLive LoadCantilever SpanElements not susceptible to crackingSpan/150
Other buildingsLive LoadCantilever SpanElement susceptible to crackingSpan/180
Highway BridgesLive LoadSimple spanNASpan/600
Railway BridgesLive LoadSimple spanNASpan/600
Highway BridgesDead LoadSimple spanNASpan/800
Railway BridgesDead LoadSimple spanNASpan/800
Highway BridgesLive LoadCantilever spanNASpan/400
Railway BridgesLive LoadCantilever spanNASpan/400
Highway BridgesDead LoadCantilever spanNASpan/800
Railway BridgesDead LoadCantilever spanNASpan/800
+ + + + + + +""") \ No newline at end of file diff --git a/src/osdag/design_type/connection/lap_joint_bolted.py b/src/osdag/design_type/connection/lap_joint_bolted.py index 19e28d237..9c9fb1c49 100644 --- a/src/osdag/design_type/connection/lap_joint_bolted.py +++ b/src/osdag/design_type/connection/lap_joint_bolted.py @@ -27,6 +27,7 @@ class LapJointBolted(MomentConnection): def __init__(self): super(LapJointBolted, self).__init__() self.design_status = False + # self.spacing = None ############################################### @@ -354,14 +355,14 @@ def set_input_values(self, design_dictionary): self.count = 0 self.slip_res = None self.yield_stress = None - self.number_bolts = 0 + # self.number_bolts = 0 self.cap_red = False self.bolt_dia_grade_status = False self.dia_available = False - self.final_pitch = None - self.final_end_dist = None - self.final_edge_dist = None - self.final_gauge = None + self.final_pitch = 0 + self.final_end_dist = 0 + self.final_edge_dist = 0 + self.final_gauge = 0 self.rows = 0 self.cols = 0 self.len_conn = 0 @@ -388,11 +389,11 @@ def select_bolt_dia_and_grade(self,design_dictionary): if float(self.plate1thk) < float(self.plate2thk): self.plate = self.plate1 - self.minpltthk = float(self.plate1thk) + self.pltthk = float(self.plate1thk) self.yield_stress = self.plate1.fy else: self.plate = self.plate2 - self.minminpltthk = float(self.plate2thk) + self.pltthk = float(self.plate2thk) self.yield_stress = self.plate2.fy for self.bolt.bolt_diameter_provided in self.bolt.bolt_diameter: @@ -405,12 +406,32 @@ def select_bolt_dia_and_grade(self,design_dictionary): conn_plates_t_fu_fy=self.bolt_conn_plates_t_fu_fy,n=self.planes) # self.max_pitch_round = self.max_gauge_round = - + # self.bolt.calculate_bolt_capacity(bolt_diameter_provided=float(self.bolt.bolt_diameter_provided), + # bolt_grade_provided=float(self.bolt.bolt_grade_provided), + # conn_plates_t_fu_fy=self.bolt_conn_plates_t_fu_fy, + # n_planes=self.planes, e=float(self.bolt.min_end_dist_round), + # p=float(self.bolt.min_pitch_round)) # self.bolt.calculate_bolt_tension_capacity(bolt_diameter_provided=self.bolt.bolt_diameter_provided, # bolt_grade_provided=self.bolt.bolt_grade_provided) # print("fnafnafan",self.bolt.bolt_capacity) - self.maxmin_and_capacitycalc(self,design_dictionary) - + self.bolt.min_pitch_round = min(self.bolt.min_pitch_round, 2.5 * float(self.bolt.bolt_diameter_provided)) + self.bolt.min_gauge_round = min(self.bolt.min_gauge_round, 2.5 * float(self.bolt.bolt_diameter_provided)) + + if design_dictionary[KEY_DP_DETAILING_EDGE_TYPE] == 'Sheared or hand flame cut': + self.bolt.min_edge_dist_round = round(max(1.7 * float(self.bolt.bolt_diameter_provided),self.bolt.min_edge_dist_round),0) + self.bolt.min_end_dist_round = round(max(1.7 * float(self.bolt.bolt_diameter_provided),self.bolt.min_end_dist_round),0) + else: + self.bolt.min_edge_dist_round = round(max(1.5 * float(self.bolt.bolt_diameter_provided),self.bolt.min_edge_dist_round),0) + self.bolt.min_end_dist_round = round(max(1.5 * float(self.bolt.bolt_diameter_provided),self.bolt.min_end_dist_round),0) + + self.max_pitch_round = self.max_gauge_round = min(32 * self.pltthk , 300) + + self.bolt.max_edge_dist_round = self.bolt.max_end_dist_round = round(min(self.bolt.max_edge_dist_round , 12 * self.pltthk * ((250 / self.yield_stress)** 0.5 )),0) + self.bolt.calculate_bolt_capacity(bolt_diameter_provided=float(self.bolt.bolt_diameter_provided), + bolt_grade_provided=float(self.bolt.bolt_grade_provided), + conn_plates_t_fu_fy=self.bolt_conn_plates_t_fu_fy, + n_planes=self.planes, e=float(self.bolt.min_end_dist_round), + p=float(self.bolt.min_pitch_round)) num_bolts = float(self.tensile_force) / ( self.bolt.bolt_capacity / 1000) # print("num_bolts",num_bolts) @@ -442,36 +463,15 @@ def select_bolt_dia_and_grade(self,design_dictionary): else: self.design_status = True - + if self.bolt.bolt_type == 'Bearing Bolt': + self.bolt.bolt_bearing_capacity = round(float(self.bolt.bolt_bearing_capacity),2) + self.bolt.bolt_shear_capacity = round(float(self.bolt.bolt_shear_capacity),2) + self.bolt.bolt_capacity = round(float(self.bolt.bolt_capacity),2) # print(self.bolt) - self.number_r_c_bolts(self, design_dictionary) + self.number_r_c_bolts(self, design_dictionary,0,0) - def maxmin_and_capacitycalc(self,design_dictionary): - self.bolt.min_pitch_round = min(self.bolt.min_pitch_round, 2.5 * float(self.bolt.bolt_diameter_provided)) - self.bolt.min_gauge_round = min(self.bolt.min_gauge_round, 2.5 * float(self.bolt.bolt_diameter_provided)) - if design_dictionary[KEY_DP_DETAILING_EDGE_TYPE] == 'Sheared or hand flame cut': - self.bolt.min_edge_dist_round = round(max(1.7 * float(self.bolt.bolt_diameter_provided),self.bolt.min_edge_dist_round),0) - self.bolt.min_end_dist_round = round(max(1.7 * float(self.bolt.bolt_diameter_provided),self.bolt.min_end_dist_round),0) - else: - self.bolt.min_edge_dist_round = round(max(1.5 * float(self.bolt.bolt_diameter_provided),self.bolt.min_edge_dist_round),0) - self.bolt.min_end_dist_round = round(max(1.5 * float(self.bolt.bolt_diameter_provided),self.bolt.min_end_dist_round),0) - - self.max_pitch_round = min(16 * self.minpltthk , 200) - self.max_gauge_round = min(100 + 4*self.minpltthk , 200) - - self.bolt.max_edge_dist_round = self.bolt.max_end_dist_round = round(min(self.bolt.max_edge_dist_round , 12 * self.minpltthk * ((250 / self.yield_stress)** 0.5 )),0) - self.bolt.calculate_bolt_capacity(bolt_diameter_provided=float(self.bolt.bolt_diameter_provided), - bolt_grade_provided=float(self.bolt.bolt_grade_provided), - conn_plates_t_fu_fy=self.bolt_conn_plates_t_fu_fy, - n_planes=self.planes, e=float(self.bolt.min_end_dist_round), - p=float(self.bolt.min_pitch_round)) - if self.bolt.bolt_type == 'Bearing Bolt': - self.bolt.bolt_bearing_capacity = round(float(self.bolt.bolt_bearing_capacity),2) - self.bolt.bolt_shear_capacity = round(float(self.bolt.bolt_shear_capacity),2) - self.bolt.bolt_capacity = round(float(self.bolt.bolt_capacity),2) - - def number_r_c_bolts(self,design_dictionary,count=0): + def number_r_c_bolts(self,design_dictionary,count=0,hit=0): bolt_cap = self.bolt.bolt_capacity if self.bolt.bolt_type == 'Bearing Bolt': @@ -482,8 +482,13 @@ def number_r_c_bolts(self,design_dictionary,count=0): self.bolt.bolt_shear_capacity = 'N/A' # print("fafafa",bolt_cap) - self.number_bolts = float(self.tensile_force) /( bolt_cap / 1000) - + + if hit == 0: + self.number_bolts = float(self.tensile_force) /( bolt_cap / 1000) + else: + self.number_bolts += 1 + + print("Hit",hit,self.number_bolts) self.number_bolts = math.ceil(self.number_bolts) if self.number_bolts < 2: @@ -513,6 +518,7 @@ def check_no_cols(numbolts): #in function for recursive call self.len_conn = self.bolt.min_pitch_round + 2*self.bolt.min_end_dist_round if self.number_bolts >= 2 and count == 0: self.design_status = True + # print("Num bolts leaving",self.number_bolts) self.check_capacity_reduction_1(self, design_dictionary) elif self.number_bolts>=2 and count == 1: self.design_status = True @@ -524,13 +530,14 @@ def check_no_cols(numbolts): #in function for recursive call def check_capacity_reduction_1(self,design_dictionary): - + # print("Capacity red check 1") if self.number_bolts > 2: lg = (self.rows - 1)*self.bolt.min_pitch_round if lg > 15 * self.bolt.bolt_diameter_provided: self.bij = 1.075 - (lg / (200 * self.bolt.bolt_diameter_provided)) if self.bij >= 0.75 and self.bij <= 1.0: self.cap_red = True + # print("1 cap red") self.bolt.bolt_shear_capacity = self.bolt.bolt_shear_capacity * self.bij if self.bolt.bolt_type == 'Bearing Bolt': self.bolt.bolt_capacity = min(self.bolt.bolt_shear_capacity, self.bolt.bolt_bearing_capacity) @@ -543,11 +550,14 @@ def check_capacity_reduction_1(self,design_dictionary): self.check_capacity_reduction_2(self,design_dictionary) def check_capacity_reduction_2(self,design_dictionary): + self.cap_red = False + # print("Capacity red check 2") if self.plate1thk + self.plate2thk > 5 * self.bolt.bolt_diameter_provided: self.blg = 8 / (3 + (self.plate1thk + self.plate2thk / self.bolt.bolt_diameter_provided)) if self.blg < self.bij and self.blg != 0: self.cap_red = True # print("blg",self.blg) + # print("2 cap red") self.bolt.bolt_shear_capacity = self.bolt.bolt_shear_capacity * self.blg if self.bolt.bolt_type == 'Bearing Bolt': self.bolt.bolt_capacity = min(self.bolt.bolt_shear_capacity, self.bolt.bolt_bearing_capacity) @@ -555,15 +565,54 @@ def check_capacity_reduction_2(self,design_dictionary): self.slip_res = self.bolt.bolt_shear_capacity self.bolt.bolt_capacity = self.slip_res - self.number_r_c_bolts(self,design_dictionary,1) + self.number_r_c_bolts(self,design_dictionary,1,0) if self.cap_red == False: self.design_status = True + # print("Going to formatting") + # print("After checks 2 numbolts",self.number_bolts) self.final_formatting(self,design_dictionary) def final_formatting(self,design_dictionary): + # print("I am herefa fafjafjafjafjajfjafajf") + # print(self.bolt) + + gauge_dist = (float(self.width) - 2*self.bolt.min_end_dist_round)/(self.rows - 1) + + if gauge_dist > self.max_gauge_round: + self.final_gauge = self.max_gauge_round + self.final_pitch = self.bolt.min_pitch_round + + enddist = (float(self.width) - ((self.rows - 1)*self.final_gauge))/2 + if enddist > self.bolt.max_end_dist_round: + self.design_status = False + self.number_r_c_bolts(self,design_dictionary,0,1) + # print("okay") + + # self.design_status = True + else: + self.final_end_dist = enddist + self.final_edge_dist = enddist + self.design_status = True + else: + self.final_gauge = gauge_dist + self.final_pitch = self.bolt.min_pitch_round + enddist = (float(self.width) - ((self.rows - 1)*self.final_gauge))/2 + if enddist > self.bolt.max_end_dist_round: + # self.loop_helper_func(self,design_dictionary) + # print("okay") + # self.design_status = False + self.design_status = False + self.number_r_c_bolts(self,design_dictionary,0,1) + + + else: + self.final_end_dist = enddist + self.final_edge_dist = enddist + self.design_status = True + # print("I got here") if self.bolt.bolt_type == 'Bearing Bolt': self.bolt.bolt_shear_capacity = self.bolt.bolt_shear_capacity/ 1000 self.bolt.bolt_bearing_capacity = self.bolt.bolt_bearing_capacity / 1000 @@ -577,44 +626,26 @@ def final_formatting(self,design_dictionary): self.bolt.bolt_capacity = self.bolt.bolt_capacity / 1000 self.bolt.bolt_capacity = round(self.bolt.bolt_capacity, 2) - self.utilization_ratio = float(self.tensile_force) / (self.bolt.bolt_capacity * self.number_bolts) + # print("Going for util ratio") + # print("Still here") + # print("Numbolts",self.number_bolts) + bltcap = self.bolt.bolt_capacity + if bltcap < 1: + bltcap = 1 + self.utilization_ratio = float(self.tensile_force) / (bltcap * self.number_bolts) self.utilization_ratio = round(self.utilization_ratio, 2) - print(self.bolt) + + self.final_gauge = round(self.final_gauge,0) + self.final_pitch = round(self.final_pitch,0) + # print("fafafafafa",self.final_edge_dist, self.final_end_dist, self.final_pitch, self.final_gauge) + print("FINAL FINAL",self.bolt) + print("Final Edge/End/Gauge/Pitch",self.final_edge_dist,self.final_end_dist,self.final_gauge,self.final_pitch) # print(self) - print("faahfnafanfaf") + # print("faahfnafanfaf") print("Max and min end edge dist ",self.bolt.max_end_dist_round, self.bolt.min_end_dist_round, self.bolt.max_edge_dist_round, self.bolt.min_edge_dist_round) print("Max min gauge pitch dist",self.max_gauge_round,self.bolt.min_gauge_round, self.max_pitch_round, self.bolt.min_pitch_round) - - enddist = float(self.width) - self.bolt.min_pitch_round*(self.rows - 1) - print(enddist) - if enddist/2 <= self.bolt.max_edge_dist_round: - if enddist/2 >= self.bolt.min_edge_dist_round: - - self.final_end_dist = enddist/2 - self.final_edge_dist = enddist/2 - self.final_gauge = self.final_pitch = round(self.bolt.min_pitch_round,0) - else: - self.final_edge_dist = self.bolt.min_edge_dist_round - self.final_end_dist = self.bolt.min_edge_dist_round - self.final_gauge = self.final_pitch = round(self.bolt.min_pitch_round,0) - else: - self.final_edge_dist = self.bolt.max_edge_dist_round - self.final_end_dist = self.bolt.max_edge_dist_round - widdist = float(self.width) - 2 * self.final_edge_dist - if widdist/(self.rows - 1) <= self.max_pitch_round: - self.final_pitch = widdist/(self.rows - 1) - self.final_pitch = round(self.final_pitch, 0) - self.final_gauge = self.final_pitch - else: - self.final_pitch = self.max_pitch_round - self.final_gauge = self.max_pitch_round - self.final_edge_dist = self.final_end_dist = float(self.width) - self.final_pitch*(self.rows - 1) - - - # print("fafafafafa",self.final_edge_dist, self.final_end_dist, self.final_pitch, self.final_gauge) - - self.design_status = True + # self.design_status = True @@ -647,11 +678,11 @@ def call_3DPlate(self, ui, bgcolor): from PyQt5.QtWidgets import QCheckBox from PyQt5.QtCore import Qt for chkbox in ui.frame.children(): - if chkbox.objectName() == 'Lap Joint': + if chkbox.objectName() == 'Cover Plate': continue if isinstance(chkbox, QCheckBox): chkbox.setChecked(Qt.Unchecked) - ui.commLogicObj.display_3DModel("Lap Joint", bgcolor) + ui.commLogicObj.display_3DModel("Cover Plate", bgcolor) def warn_text(self): diff --git a/src/osdag/design_type/member.py b/src/osdag/design_type/member.py index 7040b0e58..45a4ba707 100644 --- a/src/osdag/design_type/member.py +++ b/src/osdag/design_type/member.py @@ -3,6 +3,7 @@ from ..utils.common.component import * from ..utils.common.Section_Properties_Calculator import * from .main import Main +from ..utils.common.Unsymmetrical_Section_Properties import Unsymmetrical_I_Section_Properties class Member(Main): @@ -2952,100 +2953,45 @@ def girder_geometry(self, input_dictionary): def tab_girder_sec(self, input_dictionary): - # if not input_dictionary or input_dictionary[KEY_SECSIZE] == 'Select Section' or \ - # input_dictionary[KEY_MATERIAL] == 'Select Material': - # if not input_dictionary or input_dictionary[KEY_MATERIAL] == 'Select Material': - designation = '' - material_grade = '' - source = 'Custom' - fu = '' - fy = '' - depth = '' - flange_width = '' - flange_thickness = '' - web_thickness = '' - flange_slope = '' - root_radius = '' - toe_radius = '' - m_o_e = "200" - m_o_r = "76.9" - p_r = "0.3" - t_e = "12" - mass = '' - area = '' - mom_inertia_z = '' - mom_inertia_y = '' - rad_of_gy_z = '' - rad_of_gy_y = '' - elast_sec_mod_z = '' - elast_sec_mod_y = '' - plast_sec_mod_z = '' - plast_sec_mod_y = '' - torsion_const = '' - warping_const = '' - - image = '' + + #initialize variables + material = connectdb("Material", call_type="popup") + material_grade = material[1] + mat = Material(material_grade,41) + fu = mat.fu #material fu + fy = mat.fy #material fy + m_o_e = 200 + m_o_r = 76.9 + p_r = 0.3 + t_e = 12 + tot_depth = '750' + web_thickness = '10' + top_flange_width = '300' + top_flange_thickness = '15' + bottom_flange_width = '400' + bottom_flange_thickness = '20' + mass = '' + area = '' + mom_inertia_z = '' + mom_inertia_y = '' + rad_of_gy_z = '' + rad_of_gy_y = '' + elast_sec_mod_z = '' + elast_sec_mod_y = '' + plast_sec_mod_z = '' + plast_sec_mod_y = '' + torsion_const = '' + warping_const = '' + image = VALUES_IMG_BEAM[0] #just any image put into the place just to check - # else: - # designation = 'NA' - # material_grade = str(input_dictionary[KEY_MATERIAL]) - # m_o_e = "200" - # m_o_r = "76.9" - # p_r = "0.3" - # t_e = "12" - # image = VALUES_IMG_BEAM[0] - # I_sec_attributes = ISection(designation) - # table = "Beams" if designation in connectdb("Beams", "popup") else "Columns" - # I_sec_attributes.connect_to_database_update_other_attributes(table, designation, material_grade) - # source = str(I_sec_attributes.source) - # fu = str(I_sec_attributes.fu) - # fy = str(I_sec_attributes.fy) - # depth = str(I_sec_attributes.depth) - # flange_width = str(I_sec_attributes.flange_width) - # flange_thickness = str(I_sec_attributes.flange_thickness) - # web_thickness = str(I_sec_attributes.web_thickness) - # flange_slope = float(I_sec_attributes.flange_slope) - # root_radius = str(I_sec_attributes.root_radius) - # toe_radius = str(I_sec_attributes.toe_radius) - # mass = str(I_sec_attributes.mass) - # area = str(round((I_sec_attributes.area / 10 ** 2), 2)) - # mom_inertia_z = str(round((I_sec_attributes.mom_inertia_z / 10 ** 4), 2)) - # mom_inertia_y = str(round((I_sec_attributes.mom_inertia_y / 10 ** 4), 2)) - # rad_of_gy_z = str(round((I_sec_attributes.rad_of_gy_z / 10), 2)) - # rad_of_gy_y = str(round((I_sec_attributes.rad_of_gy_y / 10), 2)) - # elast_sec_mod_z = str(round((I_sec_attributes.elast_sec_mod_z / 10 ** 3), 2)) - # elast_sec_mod_y = str(round((I_sec_attributes.elast_sec_mod_y / 10 ** 3), 2)) - # plast_sec_mod_z = str(round((I_sec_attributes.plast_sec_mod_z / 10 ** 3), 2)) - # plast_sec_mod_y = str(round((I_sec_attributes.plast_sec_mod_y / 10 ** 3), 2)) - # torsion_const = str(round((I_sec_attributes.It / 10 ** 4), 2)) - # warping_const = str(round((I_sec_attributes.Iw / 10 ** 6), 2)) - # if flange_slope != 90: - # image = VALUES_IMG_BEAM[0] - # else: - # image = VALUES_IMG_BEAM[1] - - # if KEY_SEC_MATERIAL in input_dictionary.keys(): - # material_grade = input_dictionary[KEY_SEC_MATERIAL] - # material_attributes = Material(material_grade) - # fu = material_attributes.fu - # fy = material_attributes.fy - section = [] - # if input_dictionary: - # designation_list = input_dictionary[KEY_SECSIZE] - # else: - designation_list = [] - t0 = (KEY_SECSIZE, KEY_DISP_DESIGNATION, TYPE_COMBOBOX, designation_list, designation) - section.append(t0) - t1 = (KEY_SECSIZE_SELECTED, KEY_DISP_DESIGNATION, TYPE_TEXTBOX, None, designation) - section.append(t1) + section = [] t2 = (None, KEY_DISP_MECH_PROP, TYPE_TITLE, None, None) section.append(t2) - material = connectdb("Material", call_type="popup") t34 = (KEY_SEC_MATERIAL, KEY_DISP_MATERIAL, TYPE_COMBOBOX, material, material_grade) section.append(t34) @@ -3055,99 +3001,95 @@ def tab_girder_sec(self, input_dictionary): t4 = (KEY_SEC_FY, KEY_DISP_FY, TYPE_TEXTBOX, None, fy) section.append(t4) - t15 = ('Label_9', KEY_DISP_MOD_OF_ELAST, TYPE_TEXTBOX, None, m_o_e) + t15 = ('Label_1', KEY_DISP_MOD_OF_ELAST, TYPE_TEXTBOX, None, m_o_e) section.append(t15) - t16 = ('Label_10', KEY_DISP_MOD_OF_RIGID, TYPE_TEXTBOX, None, m_o_r) + t16 = ('Label_2', KEY_DISP_MOD_OF_RIGID, TYPE_TEXTBOX, None, m_o_r) section.append(t16) - t31 = ('Label_24', KEY_DISP_POISSON_RATIO, TYPE_TEXTBOX, None, p_r) + t31 = ('Label_3', KEY_DISP_POISSON_RATIO, TYPE_TEXTBOX, None, p_r) section.append(t31) - t32 = ('Label_23', KEY_DISP_THERMAL_EXP, TYPE_TEXTBOX, None, t_e) + t32 = ('Label_4', KEY_DISP_THERMAL_EXP, TYPE_TEXTBOX, None, t_e) section.append(t32) - t14 = ('Label_8', KEY_DISP_TYPE, TYPE_COMBOBOX, ['Rolled', 'Welded'], 'Rolled') + t14 = ('Label_5', KEY_DISP_TYPE, TYPE_COMBOBOX, ['Welded'], 'Welded') section.append(t14) - t29 = (KEY_SOURCE, KEY_DISP_SOURCE, TYPE_TEXTBOX, None, source) - section.append(t29) - - t13 = (None, None, TYPE_BREAK, None, None) - section.append(t13) - t5 = (None, KEY_DISP_DIMENSIONS, TYPE_TITLE, None, None) section.append(t5) - t6 = ('Label_1', KEY_DISP_DEPTH, TYPE_TEXTBOX, None, depth) + + t6 = ('Label_6', KEY_DISP_OVERALL_DEPTH_PG, TYPE_TEXTBOX, None, tot_depth) section.append(t6) - t7 = ('Label_2', KEY_DISP_FLANGE_W, TYPE_TEXTBOX, None, flange_width) + t9 = ('Label_7', KEY_DISP_WEB_THICKNESS_PG, TYPE_TEXTBOX, None, web_thickness) + section.append(t9) + + t7 = ('Label_8',KEY_DISP_TOP_Bflange_PG , TYPE_TEXTBOX, None, top_flange_width) section.append(t7) - t8 = ('Label_3', KEY_DISP_FLANGE_T, TYPE_TEXTBOX, None, flange_thickness) + t8 = ('Label_9', KEY_DISP_TOP_FLANGE_THICKNESS_PG, TYPE_TEXTBOX, None, top_flange_thickness) section.append(t8) - t9 = ('Label_4', KEY_DISP_WEB_T, TYPE_TEXTBOX, None, web_thickness) - section.append(t9) - - t10 = ('Label_5', KEY_DISP_FLANGE_S, TYPE_TEXTBOX, None, flange_slope) - section.append(t10) - - t11 = ('Label_6', KEY_DISP_ROOT_R, TYPE_TEXTBOX, None, root_radius) - section.append(t11) + t7 = ('Label_10',KEY_DISP_BOTTOM_Bflange_PG , TYPE_TEXTBOX, None, bottom_flange_width) + section.append(t7) - t12 = ('Label_7', KEY_DISP_TOE_R, TYPE_TEXTBOX, None, toe_radius) - section.append(t12) + t8 = ('Label_11', KEY_DISP_BOTTOM_FLANGE_THICKNESS_PG, TYPE_TEXTBOX, None, bottom_flange_thickness) + section.append(t8) + + t13 = (None, None, TYPE_BREAK, None, None) + section.append(t13) t17 = (None, KEY_DISP_SEC_PROP, TYPE_TITLE, None, None) section.append(t17) - t18 = ('Label_11', KEY_DISP_MASS, TYPE_TEXTBOX, None, mass) + t18 = ('Label_12', KEY_DISP_MASS, TYPE_TEXTBOX, None, mass) section.append(t18) - t19 = ('Label_12', KEY_DISP_AREA, TYPE_TEXTBOX, None, area) + t19 = ('Label_13', KEY_DISP_AREA, TYPE_TEXTBOX, None, area) section.append(t19) - t20 = ('Label_13', KEY_DISP_MOA_IZ, TYPE_TEXTBOX, None, mom_inertia_z) + t20 = ('Label_14', KEY_DISP_MOA_IZ, TYPE_TEXTBOX, None, mom_inertia_z) section.append(t20) - t21 = ('Label_14', KEY_DISP_MOA_IY, TYPE_TEXTBOX, None, mom_inertia_y) + t21 = ('Label_15', KEY_DISP_MOA_IY, TYPE_TEXTBOX, None, mom_inertia_y) section.append(t21) - t22 = ('Label_15', KEY_DISP_ROG_RZ, TYPE_TEXTBOX, None, rad_of_gy_z) + t22 = ('Label_16', KEY_DISP_ROG_RZ, TYPE_TEXTBOX, None, rad_of_gy_z) section.append(t22) - t23 = ('Label_16', KEY_DISP_ROG_RY, TYPE_TEXTBOX, None, rad_of_gy_y) + t23 = ('Label_17', KEY_DISP_ROG_RY, TYPE_TEXTBOX, None, rad_of_gy_y) section.append(t23) - t24 = ('Label_17', KEY_DISP_EM_ZZ, TYPE_TEXTBOX, None, elast_sec_mod_z) + t24 = ('Label_18', KEY_DISP_EM_ZZ, TYPE_TEXTBOX, None, elast_sec_mod_z) section.append(t24) - t25 = ('Label_18', KEY_DISP_EM_ZY, TYPE_TEXTBOX, None, elast_sec_mod_y) + t25 = ('Label_19', KEY_DISP_EM_ZY, TYPE_TEXTBOX, None, elast_sec_mod_y) section.append(t25) - t28 = (None, None, TYPE_BREAK, None, None) - section.append(t28) - - t33 = (KEY_IMAGE, None, TYPE_IMAGE, None, image) - section.append(t33) - - t17 = (None, KEY_DISP_SEC_PROP, TYPE_TITLE, None, None) - section.append(t17) - - t26 = ('Label_19', KEY_DISP_PM_ZPZ, TYPE_TEXTBOX, None, plast_sec_mod_z) + t26 = ('Label_20', KEY_DISP_PM_ZPZ, TYPE_TEXTBOX, None, plast_sec_mod_z) section.append(t26) - t27 = ('Label_20', KEY_DISP_PM_ZPY, TYPE_TEXTBOX, None, plast_sec_mod_y) + t27 = ('Label_21', KEY_DISP_PM_ZPY, TYPE_TEXTBOX, None, plast_sec_mod_y) section.append(t27) - t26 = ('Label_21', KEY_DISP_It, TYPE_TEXTBOX, None, torsion_const) + t26 = ('Label_22', KEY_DISP_It, TYPE_TEXTBOX, None, torsion_const) section.append(t26) - t27 = ('Label_22', KEY_DISP_Iw, TYPE_TEXTBOX, None, warping_const) + t27 = ('Label_23', KEY_DISP_Iw, TYPE_TEXTBOX, None, warping_const) section.append(t27) - + + t13 = (None, None, TYPE_BREAK, None, None) + section.append(t13) + + t17 = (None, 'Dynamic Image', TYPE_TITLE, None, None) + section.append(t17) + + t33 = (KEY_IMAGE, None, TYPE_IMAGE, None, image) + section.append(t33) + return section + def deflection_values(self, input_dictionary): @@ -3169,24 +3111,87 @@ def deflection_values(self, input_dictionary): deflection.append(t4) t5 = (KEY_MAX_DEFL,KEY_DISP_MAX_DEFL, TYPE_TEXTBOX, None , VALUES_MAX_DEFL[0]) deflection.append(t5) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, PLATE_GIRDER_DEFLECTION_TABLE , None) + deflection.append(t9) return deflection ######################################## # Design Preference Functions End ######################################## + def get_fu_fy_I_section_plate_girder(self): + material_grade = self[0] + + fu = '' + fy = '' + if material_grade != "Select Material": + material = Material(material_grade, 41) + fu = material.fu + fy = material.fy + else: + pass + + d = { + KEY_SEC_FU: fu, + KEY_SEC_FY: fy} + + return d + + def Unsymm_I_Section_properties(self): + mass = '' + area = '' + mom_inertia_z = '' + mom_inertia_y = '' + rad_of_gy_z = '' + rad_of_gy_y = '' + elast_sec_mod_z = '' + elast_sec_mod_y = '' + plast_sec_mod_z = '' + plast_sec_mod_y = '' + torsion_const = '' + warping_const = '' + + t_d = float(self[0]) + w_t = float(self[1]) + t_f_w = float(self[2]) + t_f_t = float(self[3]) + b_f_w = float(self[4]) + b_f_t = float(self[5]) + + pc = Unsymmetrical_I_Section_Properties() + + mass = pc.calc_mass(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + area = pc.calc_area(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + mom_inertia_z = pc.calc_MomentOfAreaZ(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + mom_inertia_y = pc.calc_MomentOfAreaY(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + rad_of_gy_z = pc.calc_RadiusOfGyrationZ(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + rad_of_gy_y = pc.calc_RadiusOfGyrationY(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + elast_sec_mod_z = pc.calc_ElasticModulusZz(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + elast_sec_mod_y = pc.calc_ElasticModulusZy(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + plast_sec_mod_z = pc.calc_PlasticModulusZ(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + plast_sec_mod_y = pc.calc_PlasticModulusY(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + torsion_const = pc.calc_TorsionConstantIt(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + warping_const = pc.calc_WarpingConstantIw(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + + + + + + + + return {'Label_11': str(mass), + 'Label_12': str(area), + 'Label_13': str(mom_inertia_z), + 'Label_14': str(mom_inertia_y), + 'Label_15': str(rad_of_gy_z), + 'Label_16': str(rad_of_gy_y), + 'Label_17': str(elast_sec_mod_z), + 'Label_18': str(elast_sec_mod_y), + 'Label_19': str(plast_sec_mod_z), + 'Label_20': str(plast_sec_mod_y), + 'Label_21': str(torsion_const), + 'Label_22': str(warping_const) +} - # def customized_input(self): - # - # list1 = [] - # t1 = (KEY_GRD, self.grdval_customized) - # list1.append(t1) - # t3 = (KEY_D, self.diam_bolt_customized) - # list1.append(t3) - # t6 = (KEY_PLATETHK, self.plate_thick_customized) - # list1.append(t6) - # # t8 = (KEY_SIZE, self.size_customized) - # # list1.append(t8) - # return list1 @staticmethod def grdval_customized(): diff --git a/src/osdag/design_type/plate_girder/temp.py b/src/osdag/design_type/plate_girder/temp.py new file mode 100644 index 000000000..bfc174871 --- /dev/null +++ b/src/osdag/design_type/plate_girder/temp.py @@ -0,0 +1,188 @@ +def tab_girder_sec(self, input_dictionary): + # if not input_dictionary or input_dictionary[KEY_SECSIZE] == 'Select Section' or \ + # input_dictionary[KEY_MATERIAL] == 'Select Material': + # if not input_dictionary or input_dictionary[KEY_MATERIAL] == 'Select Material': + designation = '' + material_grade = '' + source = 'Custom' + fu = '' + fy = '' + depth = '' + flange_width = '' + flange_thickness = '' + web_thickness = '' + flange_slope = '' + root_radius = '' + toe_radius = '' + m_o_e = "200" + m_o_r = "76.9" + p_r = "0.3" + t_e = "12" + mass = '' + area = '' + mom_inertia_z = '' + mom_inertia_y = '' + rad_of_gy_z = '' + rad_of_gy_y = '' + elast_sec_mod_z = '' + elast_sec_mod_y = '' + plast_sec_mod_z = '' + plast_sec_mod_y = '' + torsion_const = '' + warping_const = '' + + image = '' + + + # else: + # designation = 'NA' + # material_grade = str(input_dictionary[KEY_MATERIAL]) + # m_o_e = "200" + # m_o_r = "76.9" + # p_r = "0.3" + # t_e = "12" + # image = VALUES_IMG_BEAM[0] + # I_sec_attributes = ISection(designation) + # table = "Beams" if designation in connectdb("Beams", "popup") else "Columns" + # I_sec_attributes.connect_to_database_update_other_attributes(table, designation, material_grade) + # source = str(I_sec_attributes.source) + # fu = str(I_sec_attributes.fu) + # fy = str(I_sec_attributes.fy) + # depth = str(I_sec_attributes.depth) + # flange_width = str(I_sec_attributes.flange_width) + # flange_thickness = str(I_sec_attributes.flange_thickness) + # web_thickness = str(I_sec_attributes.web_thickness) + # flange_slope = float(I_sec_attributes.flange_slope) + # root_radius = str(I_sec_attributes.root_radius) + # toe_radius = str(I_sec_attributes.toe_radius) + # mass = str(I_sec_attributes.mass) + # area = str(round((I_sec_attributes.area / 10 ** 2), 2)) + # mom_inertia_z = str(round((I_sec_attributes.mom_inertia_z / 10 ** 4), 2)) + # mom_inertia_y = str(round((I_sec_attributes.mom_inertia_y / 10 ** 4), 2)) + # rad_of_gy_z = str(round((I_sec_attributes.rad_of_gy_z / 10), 2)) + # rad_of_gy_y = str(round((I_sec_attributes.rad_of_gy_y / 10), 2)) + # elast_sec_mod_z = str(round((I_sec_attributes.elast_sec_mod_z / 10 ** 3), 2)) + # elast_sec_mod_y = str(round((I_sec_attributes.elast_sec_mod_y / 10 ** 3), 2)) + # plast_sec_mod_z = str(round((I_sec_attributes.plast_sec_mod_z / 10 ** 3), 2)) + # plast_sec_mod_y = str(round((I_sec_attributes.plast_sec_mod_y / 10 ** 3), 2)) + # torsion_const = str(round((I_sec_attributes.It / 10 ** 4), 2)) + # warping_const = str(round((I_sec_attributes.Iw / 10 ** 6), 2)) + # if flange_slope != 90: + # image = VALUES_IMG_BEAM[0] + # else: + # image = VALUES_IMG_BEAM[1] + + # if KEY_SEC_MATERIAL in input_dictionary.keys(): + # material_grade = input_dictionary[KEY_SEC_MATERIAL] + # material_attributes = Material(material_grade) + # fu = material_attributes.fu + # fy = material_attributes.fy + section = [] + # if input_dictionary: + # designation_list = input_dictionary[KEY_SECSIZE] + # else: + designation_list = [] + + t2 = (None, KEY_DISP_MECH_PROP, TYPE_TITLE, None, None) + section.append(t2) + + material = connectdb("Material", call_type="popup") + t34 = (KEY_SEC_MATERIAL, KEY_DISP_MATERIAL, TYPE_COMBOBOX, material, material_grade) + section.append(t34) + + t3 = (KEY_SEC_FU, KEY_DISP_FU, TYPE_TEXTBOX, None, fu) + section.append(t3) + + t4 = (KEY_SEC_FY, KEY_DISP_FY, TYPE_TEXTBOX, None, fy) + section.append(t4) + + t15 = ('Label_9', KEY_DISP_MOD_OF_ELAST, TYPE_TEXTBOX, None, m_o_e) + section.append(t15) + + t16 = ('Label_10', KEY_DISP_MOD_OF_RIGID, TYPE_TEXTBOX, None, m_o_r) + section.append(t16) + + t31 = ('Label_24', KEY_DISP_POISSON_RATIO, TYPE_TEXTBOX, None, p_r) + section.append(t31) + + t32 = ('Label_23', KEY_DISP_THERMAL_EXP, TYPE_TEXTBOX, None, t_e) + section.append(t32) + + t14 = ('Label_8', KEY_DISP_TYPE, TYPE_COMBOBOX, ['Welded'], 'Welded') + section.append(t14) + + # t13 = (None, None, TYPE_BREAK, None, None) + # section.append(t13) + + t5 = (None, KEY_DISP_DIMENSIONS, TYPE_TITLE, None, None) + section.append(t5) + t6 = ('Label_1', KEY_DISP_DEPTH, TYPE_TEXTBOX, None, depth) + section.append(t6) + + t7 = ('Label_2', KEY_DISP_FLANGE_W, TYPE_TEXTBOX, None, flange_width) + section.append(t7) + + t8 = ('Label_3', KEY_DISP_FLANGE_T, TYPE_TEXTBOX, None, flange_thickness) + section.append(t8) + + t9 = ('Label_4', KEY_DISP_WEB_T, TYPE_TEXTBOX, None, web_thickness) + section.append(t9) + + t10 = ('Label_5', KEY_DISP_FLANGE_S, TYPE_TEXTBOX, None, flange_slope) + section.append(t10) + + t11 = ('Label_6', KEY_DISP_ROOT_R, TYPE_TEXTBOX, None, root_radius) + section.append(t11) + + # t12 = ('Label_7', KEY_DISP_TOE_R, TYPE_TEXTBOX, None, toe_radius) + # section.append(t12) + + t17 = (None, KEY_DISP_SEC_PROP, TYPE_TITLE, None, None) + section.append(t17) + + t18 = ('Label_11', KEY_DISP_MASS, TYPE_TEXTBOX, None, mass) + section.append(t18) + + t19 = ('Label_12', KEY_DISP_AREA, TYPE_TEXTBOX, None, area) + section.append(t19) + + t20 = ('Label_13', KEY_DISP_MOA_IZ, TYPE_TEXTBOX, None, mom_inertia_z) + section.append(t20) + + t21 = ('Label_14', KEY_DISP_MOA_IY, TYPE_TEXTBOX, None, mom_inertia_y) + section.append(t21) + + t22 = ('Label_15', KEY_DISP_ROG_RZ, TYPE_TEXTBOX, None, rad_of_gy_z) + section.append(t22) + + t23 = ('Label_16', KEY_DISP_ROG_RY, TYPE_TEXTBOX, None, rad_of_gy_y) + section.append(t23) + + t24 = ('Label_17', KEY_DISP_EM_ZZ, TYPE_TEXTBOX, None, elast_sec_mod_z) + section.append(t24) + + t25 = ('Label_18', KEY_DISP_EM_ZY, TYPE_TEXTBOX, None, elast_sec_mod_y) + section.append(t25) + + t28 = (None, None, TYPE_BREAK, None, None) + section.append(t28) + + t33 = (KEY_IMAGE, None, TYPE_IMAGE, None, image) + section.append(t33) + + t17 = (None, KEY_DISP_SEC_PROP, TYPE_TITLE, None, None) + section.append(t17) + + t26 = ('Label_19', KEY_DISP_PM_ZPZ, TYPE_TEXTBOX, None, plast_sec_mod_z) + section.append(t26) + + t27 = ('Label_20', KEY_DISP_PM_ZPY, TYPE_TEXTBOX, None, plast_sec_mod_y) + section.append(t27) + + t26 = ('Label_21', KEY_DISP_It, TYPE_TEXTBOX, None, torsion_const) + section.append(t26) + + t27 = ('Label_22', KEY_DISP_Iw, TYPE_TEXTBOX, None, warping_const) + section.append(t27) + + return section \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder.py b/src/osdag/design_type/plate_girder/weldedPlateGirder.py index 7aadbcd32..aa8bf0785 100644 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder.py +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder.py @@ -37,7 +37,7 @@ from ...utils.common import is800_2007 from ...utils.common.component import * from osdag.cad.items.plate import Plate - +from ...utils.common.Unsymmetrical_Section_Properties import Unsymmetrical_I_Section_Properties class PlateGirderWelded(Member): @@ -88,12 +88,12 @@ def tab_list(self): def tab_value_changed(self): change_tab = [] - t1 = (KEY_DISP_GIRDERSEC, [KEY_SEC_MATERIAL], [KEY_SEC_FU, KEY_SEC_FY], TYPE_TEXTBOX, self.get_fu_fy_I_section) + t1 = (KEY_DISP_GIRDERSEC, [KEY_SEC_MATERIAL], [KEY_SEC_FU, KEY_SEC_FY], TYPE_TEXTBOX, self.get_fu_fy_I_section_plate_girder) change_tab.append(t1) - t4 = (KEY_DISP_GIRDERSEC, ['Label_1', 'Label_2', 'Label_3', 'Label_4', 'Label_5'], - ['Label_11', 'Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', - 'Label_19', 'Label_20', 'Label_21', 'Label_22', KEY_IMAGE], TYPE_TEXTBOX, self.get_I_sec_properties) + t4 = (KEY_DISP_GIRDERSEC, ['Label_6', 'Label_7', 'Label_8', 'Label_9', 'Label_10', 'Label_11'], + ['Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', + 'Label_19', 'Label_20', 'Label_21', 'Label_22'], TYPE_TEXTBOX, self.Unsymm_I_Section_properties) change_tab.append(t4) t9 = ("Deflection", [KEY_STR_TYPE], [KEY_MEMBER_OPTIONS], TYPE_COMBOBOX, self.member_options_change) @@ -103,18 +103,7 @@ def tab_value_changed(self): t9 = ("Deflection", [KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_SUPPORTING_OPTIONS], [KEY_MAX_DEFL], TYPE_TEXTBOX, self.max_defl_change) change_tab.append(t9) - # t5 = (KEY_DISP_GIRDERSEC, ['Label_HS_1', 'Label_HS_2', 'Label_HS_3'], - # ['Label_HS_11', 'Label_HS_12', 'Label_HS_13', 'Label_HS_14', 'Label_HS_15', 'Label_HS_16', 'Label_HS_17', 'Label_HS_18', - # 'Label_HS_19', 'Label_HS_20', 'Label_HS_21', 'Label_HS_22', KEY_IMAGE], TYPE_TEXTBOX, self.get_SHS_RHS_properties) - # change_tab.append(t5) - - # t6 = (KEY_DISP_GIRDERSEC, ['Label_CHS_1', 'Label_CHS_2', 'Label_CHS_3'], - # ['Label_CHS_11', 'Label_CHS_12', 'Label_CHS_13', 'Label_HS_14', 'Label_HS_15', 'Label_HS_16', 'Label_21', 'Label_22', - # KEY_IMAGE], TYPE_TEXTBOX, self.get_CHS_properties) - # change_tab.append(t6) - # t6 = (KEY_DISP_GIRDERSEC, [KEY_SECSIZE], [KEY_SOURCE], TYPE_TEXTBOX, self.change_source) - # change_tab.append(t6) return change_tab @@ -187,19 +176,19 @@ def refresh_input_dock(self): add_buttons = [] - # t2 = (KEY_DISP_GIRDERSEC,KEY_SECSIZE, TYPE_COMBOBOX, KEY_SECSIZE, None, None, "Columns") - # add_buttons.append(t2) - return add_buttons def get_values_for_design_pref(self, key, design_dictionary): - if design_dictionary[KEY_MATERIAL] != 'Select Material': - material = Material(design_dictionary[KEY_MATERIAL], 41) - fu = material.fu - fy = material.fy - else: - fu = '' - fy = '' + # if design_dictionary[KEY_MATERIAL] != 'Select Material': + # material = Material(design_dictionary[KEY_MATERIAL], 41) + # material_grade = design_dictionary[KEY_MATERIAL] + # fu = material.fu + # fy = material.fy + # else: + # fu = '' + # fy = '' + + val = { KEY_ALLOW_CLASS: 'Yes', @@ -418,6 +407,8 @@ def input_values(self): #t4 = (KEY_STR_TYPE, KEY_DISP_STR_TYPE, TYPE_COMBOBOX, KEY_DISP_STR_TYPE_list, True, 'No Validator') #options_list.append(t4) + t5 = (KEY_SUPPORT_WIDTH, KEY_DISP_SUPPORT_WIDTH, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t5) t4 = (KEY_WEB_PHILOSOPHY, KEY_DISP_WEB_PHILOSOPHY, TYPE_COMBOBOX, WEB_PHILOSOPHY_list, True, 'No Validator') options_list.append(t4) @@ -923,6 +914,12 @@ def set_input_values(self, design_dictionary): self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) #3 list loops for V inp= self.Zp_req: @@ -1069,23 +1074,204 @@ def section_classification(self,design_dictionary): self.V_d = ((A_vg * self.material.fy) / (math.sqrt(3) * self.gamma_m0)) print("Shear check",self.V_d) print("shear force ",self.load.shear_force) #V value self.load.shear_force - if self.cl_8_2_1_2_high_shear_check(self,self.load.shear_force,self.V_d): #high shear + if IS800_2007.cl_8_2_1_2_high_shear_check(self.load.shear_force,self.V_d): #high shear if self.support_type == 'Major Laterally Supported': - self.Mdv = self.calc_Mdv(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - print("fafafamfm a",self.Mdv) - else: - print("Not Lat supp") - else: - if self.support_type == 'Major Laterally Supported': #low shear - self.Md =self.plast_sec_mod_z * self.material.fy / self.gamma_m0 - print("sefafafaf c",self.Md) - - else: - print("Not Lat supp") - + if self.web_philosophy == 'Thick Web without ITS': + if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): + self.Mdv = self.calc_Mdv(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.web_buckling_check(self) + print("fafafamfm a",self.Mdv) + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) + if interp_val != None: + self.fcd = round(interp_val, 2) + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + else: + logger.error("Change materrial grade. Minimum Grade is E 250") + + + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #buckling method + c = 0 + if design_dictionary[KEY_IntermediateStiffener_spacing] != 'NA': + c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): + print("Check passed") + else: + print("Check Failed") + else: + pass + + + + else: + logger.error("Web thickness is not sufficient\n Re-enter new thickness") + else: + # print("To include thin web condition") + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + pass + else: + + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if design_dictionary[KEY_IntermediateStiffener_spacing] == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) + if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): + print("Check passed") + else: + print("Check Failed") + + else: #unsupported + if self.web_philosophy == 'Thick Web without ITS': + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) + if interp_val != None: + self.fcd = round(interp_val, 2) + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + else: + logger.error("Change materrial grade. Minimum Grade is E 250") + else: #thin web + pass + G = 0.769 * 10**5 + Kw = self.get_K_from_warping_restraint(self,self.warping) + Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, It, Iw, self.effective_length, Kw, self.total_depth, + self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, + self.loading_case, self.warping) + print("Input moment",self.load.moment) + print("MCR VAL",self.M_cr) + if self.M_cr < self.load.moment: + print("Passed Moment check") + + else: + logger.error("Moment check failed! Need to increase flange size") + else: #low shear + if self.support_type == 'Major Laterally Supported': + if self.web_philosophy == 'Thick Web without ITS': + if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): + self.Md =self.plast_sec_mod_z * self.material.fy / self.gamma_m0 + print("sefafafaf c",self.Md) + self.web_buckling_check(self) + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) + if interp_val != None: + self.fcd = round(interp_val, 2) + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + else: + logger.error("Change materrial grade. Minimum Grade is E 250") + + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #bukling method + c = 0 + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if design_dictionary[KEY_IntermediateStiffener_spacing] != 'NA': + c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): + print("Check passed") + else: + print("Check Failed") + else: + pass + else: + logger.error("Web thickness is not sufficient\n Re-enter new thickness") + + else: #thin web condition + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + pass + else: + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if design_dictionary[KEY_IntermediateStiffener_spacing] == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) + if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): + print("Check passed") + else: + print("Check Failed") + + else: #unsupported + if self.web_philosophy == 'Thick Web without ITS': + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) + if interp_val != None: + self.fcd = round(interp_val, 2) + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + else: + logger.error("Change materrial grade. Minimum Grade is E 250") + else: #thin web + pass + G = 0.769 * 10**5 + Kw = self.get_K_from_warping_restraint(self,self.warping) + Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, It, Iw, self.effective_length, Kw, self.total_depth, + self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, + self.loading_case, self.warping) + print("Input moment",self.load.moment) + print("MCR VAL",self.M_cr) + if self.M_cr > self.load.moment: + print("Passed Moment check") + else: + logger.error("Moment check failed! Need to increase flange size") + @@ -1112,54 +1298,56 @@ def effective_length_beam(self, design_dictionary, length): print(f"Working 3 {self.effective_length}") print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) - def cl_8_2_1_2_high_shear_check(self,V, V_d): - if V > 0.6 * V_d : - print('High shear') - return True - else: - print('Low shear') - return False - - def calc_Centroid(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - A_top = B_top * t_f_top - A_bot = B_bot * t_f_bot - A_web = (D - t_f_top - t_f_bot) * t_w - - y_top = D - t_f_top / 2 - y_bot = t_f_bot / 2 - y_web = t_f_bot + (D - t_f_top - t_f_bot) / 2 - - y_neutral = (A_top * y_top + A_bot * y_bot + A_web * y_web) / (A_top + A_bot + A_web) - return y_neutral - - def calc_PlasticModulusZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - y_neutral = self.calc_Centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - A_top = B_top * t_f_top - A_bot = B_bot * t_f_bot - A_web_top = t_w * (D - y_neutral - t_f_top) - A_web_bot = t_w * (y_neutral - t_f_bot) - - Zpz = (A_top * (D - y_neutral - t_f_top / 2) + A_web_top * (D - y_neutral - t_f_top - (D - y_neutral - t_f_top) / 2) + - A_bot * (y_neutral - t_f_bot / 2) + A_web_bot * ((y_neutral - t_f_bot) / 2)) / 1000 - - return round(Zpz, 2) - - def calc_MomentOfAreaZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - y_neutral = self.calc_Centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - - I_top = (B_top * t_f_top ** 3) / 12 + B_top * t_f_top * (D - t_f_top / 2 - y_neutral) ** 2 - I_bot = (B_bot * t_f_bot ** 3) / 12 + B_bot * t_f_bot * (y_neutral - t_f_bot / 2) ** 2 - I_web = (t_w * (D - t_f_top - t_f_bot) ** 3) / 12 + t_w * (D - t_f_top - t_f_bot) * (y_neutral - (t_f_bot + (D - t_f_top - t_f_bot) / 2)) ** 2 - I_zz = (I_top + I_bot + I_web) / 10000 - return round(I_zz, 2) - def calc_ElasticModulusZz(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - I_zz = self.calc_MomentOfAreaZ(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - y_neutral = self.calc_Centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - Z_ez_top = I_zz * 10 / (D - y_neutral) - Z_ez_bot = I_zz * 10 / y_neutral - return round(min(Z_ez_top, Z_ez_bot), 2) + def web_buckling_check(self): + self.web_buckling = IS800_2007.cl_8_2_1_web_buckling( + d=self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness), + tw=self.web_thickness, + e=self.epsilon,) + print("fafafajnafjkfmaf",self.web_buckling) + + # if not self.web_buckling_check: + # self.web_not_buckling_steps(self) + def shear_buckling_check_simple_postcritical(self,eff_depth,A_vg,V,c=0): + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c/eff_depth < 1: + K_v = 4 + 5.35/(c/eff_depth)**2 + else: + K_v = 5.35 + 4/(c/eff_depth)**2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + print("V_cr value",V_cr) + if V_cr > V: + return True + else: + return False + + def shear_buckling_check_tension_field(self,eff_depth,A_vg,c=0,Nf = 0): + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c/eff_depth < 1: + K_v = 4 + 5.35/(c/eff_depth)**2 + else: + K_v = 5.35 + 4/(c/eff_depth)**2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + phi,M_fr,s, w_tf,sai,fv,V_tf = IS800_2007.cl_8_4_2_2_TensionField( c, eff_depth, self.web_thickness, self.material.fy, self.top_flange_width,self.top_flange_thickness, self.material.fy,Nf, self.gamma_m0, A_vg,tau_b,self.load.shear_force) + print("vtf val",V_tf) + if V_tf >= self.load.shear_force: + return True + else: + return False def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only for major laterally supp """ @@ -1203,9 +1391,103 @@ def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only fo return round(min(Mdv, Mdv_limit), 2) - + def get_K_from_warping_restraint(self,warping_condition): + """ + Return effective length factor K based on exact warping restraint description (IS 800:2007, Clause E.1). + """ + if warping_condition == "Both flanges fully restrained": + return 0.5 + elif warping_condition == "Compression flange fully restrained": + return 0.7 + elif warping_condition == "Compression flange partially restrained": + return 0.85 + elif warping_condition == "Warping not restrained in both flanges": + return 1.0 + else: + raise ValueError("Invalid warping restraint. Use one of the four standard conditions.") + + def calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D): + """ + Calculate yj per IS 800:2007 Clause E.3.2.2. Returns 0 for symmetric sections. + """ + if Bf_top == Bf_bot and tf_top == tf_bot: + return 0.0 # symmetric section + h = D - (tf_top + tf_bot) + Ift = (Bf_top * tf_top**3) / 12 + Ifc = (Bf_bot * tf_bot**3) / 12 + beta_f = Ifc / (Ifc + Ift) + alpha = 0.8 if beta_f > 0.5 else 1.0 + return alpha * (2 * beta_f - 1) * h / 2 + + def calc_Mcr_LoadingCase(self,E, G, Iy, It, Iw, LLT, Kw, D, + tf_top, tf_bot, Bf_top, Bf_bot, + LoadingCase, warping_condition): + """ + Calculate Elastic Critical Moment Mcr based on IS 800:2007 (Annex E or Eq 2.20 for symmetric). + Returns: + Mcr : Elastic Critical Moment in N·mm + """ + yg = D / 2 + yj = self.calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D) + K_value = 0 + # Constants from Table 42 (IS 800:2007) + if LoadingCase == KEY_DISP_UDL_PIN_PIN_PG: + K_value == 1.0 + c1, c2, c3 = 1.132, 0.459, 0.525 + elif LoadingCase == KEY_DISP_UDL_FIX_FIX_PG: + K_value == 0.5 + c1, c2, c3 = 0.712, 0.652, 1.070 + elif LoadingCase == KEY_DISP_PL_PIN_PIN_PG: + K_value == 1.0 + c1, c2, c3 = 1.365, 0.553, 1.780 + elif LoadingCase == KEY_DISP_PL_FIX_FIX_PG: + K_value == 0.5 + c1, c2, c3 = 0.938, 0.715, 4.800 + else: + raise ValueError("Invalid Loading Case.") + + # Symmetric section (Eq 2.20) + if Bf_top == Bf_bot and tf_top == tf_bot: + term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) + term2 = (Iw / Iy) + term3 = (G * It * LLT**2) / (math.pi**2 * E * Iy) + Mcr = term1 * math.sqrt(term2 + term3) + else: + # Unsymmetric case (Annex E full formula) + term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) + bracket = ((K_value / Kw) ** 2 * (Iw / Iy) + + (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + + (c2 * yg - c3 * yj) ** 2) + Mcr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) + + return Mcr # in N·mm + + def interpolate_value(self,slenderness_input, yield_stress_input,df): + # Extract the available slenderness ratios and yield stresses + slenderness_ratios = df.index.to_numpy() + yield_stresses = df.columns.to_numpy() + + # Interpolate along the slenderness ratio for two nearest yield stress values + + yield_stress_lower_list = [ys for ys in yield_stresses if ys <= yield_stress_input] + yield_stress_upper_list = [ys for ys in yield_stresses if ys >= yield_stress_input] + if len(yield_stress_lower_list) == 0 or len(yield_stress_upper_list) == 0: + return None + + yield_stress_lower = max(yield_stress_lower_list) + yield_stress_upper = min(yield_stress_upper_list) + + + + interp_lower = np.interp(slenderness_input, slenderness_ratios, df[yield_stress_lower].to_numpy()) + interp_upper = np.interp(slenderness_input, slenderness_ratios, df[yield_stress_upper].to_numpy()) + # Interpolate between the lower and upper yield stress for the final value + final_value = np.interp(yield_stress_input, [yield_stress_lower, yield_stress_upper], [interp_lower, interp_upper]) + + + return final_value #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/src/osdag/is800_2007exp.py b/src/osdag/is800_2007exp.py index cd9ce2712..e2dbee3eb 100755 --- a/src/osdag/is800_2007exp.py +++ b/src/osdag/is800_2007exp.py @@ -184,6 +184,74 @@ def Table2_hollow_tube(diameter, thickness, f_y, load='Axial Compression', secti "gamma_mr": {KEY_DP_FAB_SHOP: 1.25, KEY_DP_FAB_FIELD: 1.25}, "gamma_mw": {KEY_DP_FAB_SHOP: 1.25, KEY_DP_FAB_FIELD: 1.50} } + + # ------------------------------------------------------------ + # 5.6.1 Deflection + # ------------------------------------------------------------- + @staticmethod + def cl_5_6_1_vertical_deflection_table_6(structure_type,design_load,member_type,supporting_type): + if structure_type in ['Highway Bridge','Railway Bridge']: + if member_type == 'Simple Span': + if design_load == 'Live load': + return VALUES_MAX_DEFL[0] + elif design_load == 'Dead load': + return VALUES_MAX_DEFL[1] + else: + return 'NA' + + else: + if design_load == 'Live load': + return VALUES_MAX_DEFL[2] + elif design_load == 'Dead load': + return VALUES_MAX_DEFL[1] + else: + return 'NA' + + elif structure_type == 'Other Building': + if design_load == 'Live load': + if member_type == 'Floor and roof': + if supporting_type == 'Elements not susceptible to cracking': + return VALUES_MAX_DEFL[3] + else: + return VALUES_MAX_DEFL[4] + else: + if supporting_type == 'Elements not susceptible to cracking': + return VALUES_MAX_DEFL[5] + else: + return VALUES_MAX_DEFL[6] + else: + return 'NA' + else: + if member_type == 'Purlin and Girts' and design_load == 'Live load': + if supporting_type == 'Elastic cladding': + return VALUES_MAX_DEFL[5] + else: + return VALUES_MAX_DEFL[6] + elif member_type == 'Simple span' and design_load == 'Live load': + if supporting_type == 'Elastic cladding': + return VALUES_MAX_DEFL[7] + else: + return VALUES_MAX_DEFL[3] + elif member_type == 'Cantilever span' and design_load == 'Live load': + if supporting_type == 'Elastic cladding': + return VALUES_MAX_DEFL[8] + else: + return VALUES_MAX_DEFL[5] + elif member_type == 'Rafter Supporting' and design_load == 'Live load': + if supporting_type == 'Profiled Metal sheeting': + return VALUES_MAX_DEFL[6] + else: + return VALUES_MAX_DEFL[7] + elif member_type == 'Gantry' and design_load == 'Live load': + if design_load == 'Crane Load(Manual operation)': + return VALUES_MAX_DEFL[9] + elif design_load == 'Crane load(Electric operation up to 50t)': + return VALUES_MAX_DEFL[10] + else: + return VALUES_MAX_DEFL[11] + else: + return 'NA' + # ========================================================================== """ SECTION 6 DESIGN OF TENSION MEMBERS """ diff --git a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py new file mode 100644 index 000000000..175cd8710 --- /dev/null +++ b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py @@ -0,0 +1,121 @@ +import math +class Unsymmetrical_I_Section_Properties: + """ + Parameters: + D : Total depth of the section + B_top : Width of the top flange + B_bot : Width of the bottom flange + t_w : Thickness of the web + t_f_top : Thickness of the top flange + t_f_bot : Thickness of the bottom flange + + """ + + + def calc_mass(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + A = Unsymmetrical_I_Section_Properties.calc_area(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) + M = (7850 * A) / 10000 + return round(M, 2) + + + def calc_area(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + A = (B_top * t_f_top + B_bot * t_f_bot + (D - t_f_top - t_f_bot) * t_w) / 100 + return round(A, 2) + + + def calc_centroid(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + A_top = B_top * t_f_top + A_bot = B_bot * t_f_bot + A_web = (D - t_f_top - t_f_bot) * t_w + + y_top = D - t_f_top / 2 + y_bot = t_f_bot / 2 + y_web = t_f_bot + (D - t_f_top - t_f_bot) / 2 + + y_neutral = (A_top * y_top + A_bot * y_bot + A_web * y_web) / (A_top + A_bot + A_web) + return y_neutral + + + def calc_MomentOfAreaZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + y_neutral = Unsymmetrical_I_Section_Properties.calc_centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) + + I_top = (B_top * t_f_top ** 3) / 12 + B_top * t_f_top * (D - t_f_top / 2 - y_neutral) ** 2 + I_bot = (B_bot * t_f_bot ** 3) / 12 + B_bot * t_f_bot * (y_neutral - t_f_bot / 2) ** 2 + I_web = (t_w * (D - t_f_top - t_f_bot) ** 3) / 12 + t_w * (D - t_f_top - t_f_bot) * ( + y_neutral - (t_f_bot + (D - t_f_top - t_f_bot) / 2)) ** 2 + + I_zz = (I_top + I_bot + I_web) / 10000 + return round(I_zz, 2) + + + def calc_MomentOfAreaY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + I_top = (t_f_top * B_top ** 3) / 12 + I_bot = (t_f_bot * B_bot ** 3) / 12 + I_web = ((D - t_f_top - t_f_bot) * t_w ** 3) / 12 + + I_yy = (I_top + I_bot + I_web) / 10000 + return round(I_yy, 2) + + + def calc_ElasticModulusZz(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + I_zz = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaZ(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) + y_neutral = Unsymmetrical_I_Section_Properties.calc_centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) + Z_ez_top = I_zz * 10 / (D - y_neutral) + Z_ez_bot = I_zz * 10 / y_neutral + return round(min(Z_ez_top, Z_ez_bot), 2) + + + def calc_ElasticModulusZy(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + I_yy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) + B_max = max(B_top, B_bot) + Z_ey = (I_yy * 2 * 10) / B_max + return round(Z_ey, 2) + + + def calc_PlasticModulusZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + y_neutral = Unsymmetrical_I_Section_Properties.calc_centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) + A_top = B_top * t_f_top + A_bot = B_bot * t_f_bot + A_web_top = t_w * (D - y_neutral - t_f_top) + A_web_bot = t_w * (y_neutral - t_f_bot) + + Zpz = (A_top * (D - y_neutral - t_f_top / 2) + A_web_top * ( + D - y_neutral - t_f_top - (D - y_neutral - t_f_top) / 2) + + A_bot * (y_neutral - t_f_bot / 2) + A_web_bot * ((y_neutral - t_f_bot) / 2)) / 1000 + + return round(Zpz, 2) + + + def calc_PlasticModulusY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + Zpy = (t_f_top * B_top ** 2 / 4 + t_f_bot * B_bot ** 2 / 4 + (D - t_f_top - t_f_bot) * t_w ** 2 / 4) / 1000 + return round(Zpy, 2) + + def calc_TorsionConstantIt(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + h = D - (t_f_top + t_f_bot) + It = (1 / 3) * (t_f_top * B_top ** 3 + t_f_bot * B_bot ** 3 + t_w ** 3 * h) + return round(It, 2) + + def calc_WarpingConstantIw(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + h = D - (t_f_top + t_f_bot) + numerator_Iw = (h ** 2) * t_f_top * t_f_bot * (B_top ** 3) * (B_bot ** 3) + denominator_Iw = 12 * (t_f_top * B_top ** 3 + t_f_bot * B_bot ** 3) + Iw = numerator_Iw / denominator_Iw + return round(Iw, 2) + + def calc_RadiusOfGyrationZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + """ + Radius of gyration about z-axis (major axis) + """ + I_zz = self.calc_MomentOfAreaZ(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 10000 # convert to mm⁴ + A = self.calc_area(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 100 # convert to mm² + r_z = math.sqrt(I_zz / A) + return round(r_z, 2) + + def calc_RadiusOfGyrationY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): + """ + Radius of gyration about y-axis (minor axis) + """ + I_yy = self.calc_MomentOfAreaY(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 10000 # convert to mm⁴ + A = self.calc_area(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 100 # convert to mm² + r_y = math.sqrt(I_yy / A) + return round(r_y, 2) \ No newline at end of file diff --git a/src/osdag/utils/common/is800_2007.py b/src/osdag/utils/common/is800_2007.py index 95ff64492..9895aadd3 100644 --- a/src/osdag/utils/common/is800_2007.py +++ b/src/osdag/utils/common/is800_2007.py @@ -6,6 +6,7 @@ """ import math from ...Common import * +import pandas as pd # from ...Common import KEY_DP_FAB_SHOP @@ -496,6 +497,40 @@ def cl_3_8_max_slenderness_ratio(Type = 1): "gamma_mr": {KEY_DP_FAB_SHOP: 1.25, KEY_DP_FAB_FIELD: 1.25}, "gamma_mw": {KEY_DP_FAB_SHOP: 1.25, KEY_DP_FAB_FIELD: 1.50} } + + # ------------------------------------------------------------ + # 5.6.1 Deflection + # ------------------------------------------------------------- + +# cl_5_6_1_vertical_deflection_Table_6 = { + +# Type of structure Load Type Member Supporting Deflection Limit +# Industrial building Live Load Purlins and Girts Elastic cladding Span/150 +# Industrial building Live Load Purlins and Girts Brittle cladding Span/180 +# Industrial building Live Load Simple span Elastic cladding Span/240 +# Industrial building Live Load Simple span Brittle cladding Span/300 +# Industrial building Live Load Cantilever span Elastic cladding Span/120 +# Industrial building Live Load Cantilever span Brittle cladding Span/150 +# Industrial building Live Load Rafter supporting Profiled Metal Sheeting Span/180 +# Industrial building Live Load Rafter supporting Plastered Sheeting Span/240 +# Industrial building Crane Load(Manual operation) Gantry Crane Span/500 +# Industrial building Crane load(Electric operation up to 50t) Gantry Crane Span/750 +# Industrial building Crane load(Electric operation over 50t) Gantry Crane Span/1000 +# Other buildings Live Load Floor and Roof Elements not susceptible to cracking Span/300 +# Other buildings Live Load Floor and Roof Element susceptible to cracking Span/360 +# Other buildings Live Load Cantilever Span Elements not susceptible to cracking Span/150 +# Other buildings Live Load Cantilever Span Element susceptible to cracking Span/180 +# Highway Bridges Live Load Simple span NA Span/600 +# Railway Bridges Live Load Simple span NA Span/600 +# Highway Bridges Dead Load Simple span NA Span/800 +# Railway Bridges Dead Load Simple span NA Span/800 +# Highway Bridges Live Load Cantilever span NA Span/400 +# Railway Bridges Live Load Cantilever span NA Span/400 +# Highway Bridges Dead Load Cantilever span NA Span/800 +# Railway Bridges Dead Load Cantilever span NA Span/800 + + + # } # ========================================================================== """ SECTION 6 DESIGN OF TENSION MEMBERS """ @@ -805,6 +840,55 @@ def cl_7_1_2_2_buckling_class_of_crosssections(b, h, t_f, cross_section='Rolled } return buckling_class + + @staticmethod + def cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c(): + data = { + 200: [182.00, 182.00, 172.00, 163.00, 153.00, 142.00, 131.00, 120.00, 108.00, 97.50, 87.30, 78.20, 70.00, 62.90, + 56.60, 51.10, 46.40, 42.20, 38.50, 35.30, 32.40, 29.90, 27.60, 25.60, 23.80], + 210: [191.00, 190.00, 180.00, 170.00, 159.00, 148.00, 136.00, 123.00, 111.00, 100.00, 89.00, 79.40, 71.00, 63.60, + 57.20, 51.60, 46.80, 42.50, 38.80, 35.50, 32.60, 30.10, 27.80, 25.70, 23.90], + 220: [200.00, 199.00, 188.00, 177.00, 165.00, 153.00, 140.00, 127.00, 114.00, 102.00, 90.50, 80.60, 71.90, 64.40, + 57.80, 52.10, 47.10, 42.80, 39.00, 35.70, 32.80, 30.20, 27.90, 25.90, 24.00], + 230: [209.00, 207.00, 196.00, 184.00, 172.00, 158.00, 144.00, 130.00, 116.00, 104.00, 92.00, 81.70, 72.80, 65.00, + 58.30, 52.50, 47.50, 43.10, 39.30, 35.90, 33.00, 30.40, 28.00, 26.00, 24.10], + 240: [218.00, 216.00, 204.00, 191.00, 178.00, 163.00, 148.00, 133.00, 119.00, 105.00, 93.30, 82.70, 73.50, 65.60, + 58.80, 52.90, 47.80, 43.40, 39.50, 36.10, 33.10, 30.50, 28.20, 26.10, 24.20], + 250: [227.00, 224.00, 211.00, 198.00, 183.00, 168.00, 152.00, 136.00, 121.00, 107.00, 94.60, 83.70, 74.30, 66.20, + 59.20, 53.30, 48.10, 43.60, 39.70, 36.30, 33.30, 30.60, 28.30, 26.20, 24.30], + 260: [236.00, 233.00, 219.00, 205.00, 189.00, 173.00, 156.00, 139.00, 123.00, 109.00, 95.70, 84.60, 75.00, 66.70, + 59.70, 53.60, 48.40, 43.90, 39.90, 36.50, 33.40, 30.80, 28.40, 26.30, 24.40], + 280: [255.00, 250.00, 234.00, 218.00, 201.00, 182.00, 163.00, 145.00, 127.00, 112.00, 97.90, 86.20, 76.20, 67.70, + 60.40, 54.20, 48.90, 44.30, 40.30, 36.80, 33.70, 31.00, 28.60, 26.40, 24.50], + 300: [273.00, 266.00, 249.00, 231.00, 212.00, 191.00, 170.00, 149.00, 131.00, 114.00, 100.00, 87.60, 77.30, 68.60, + 61.10, 54.80, 49.30, 44.70, 40.60, 37.00, 33.90, 31.20, 28.80, 26.60, 24.70], + 320: [291.00, 283.00, 264.00, 244.00, 222.00, 199.00, 176.00, 154.00, 134.00, 116.00, 102.00, 88.90, 78.30, 69.30, + 61.70, 55.30, 49.80, 45.00, 40.90, 37.30, 34.10, 31.40, 28.90, 26.70, 24.80], + 340: [309.00, 299.00, 278.00, 256.00, 232.00, 207.00, 182.00, 158.00, 137.00, 119.00, 103.00, 90.10, 79.20, 70.00, + 62.30, 55.70, 50.10, 45.30, 41.10, 37.50, 34.30, 31.50, 29.10, 26.90, 24.90], + 360: [327.00, 316.00, 293.00, 268.00, 242.00, 215.00, 187.00, 162.00, 140.00, 120.00, 104.00, 91.10, 80.00, 70.70, + 62.80, 56.10, 50.50, 45.60, 41.40, 37.70, 34.50, 31.70, 29.20, 27.00, 25.00], + 380: [345.00, 332.00, 307.00, 280.00, 252.00, 222.00, 192.00, 165.00, 142.00, 122.00, 106.00, 92.10, 80.70, 71.20, + 63.30, 56.50, 50.80, 45.80, 41.60, 37.90, 34.70, 31.80, 29.30, 27.10, 25.10], + 400: [364.00, 348.00, 321.00, 292.00, 261.00, 228.00, 197.00, 169.00, 144.00, 124.00, 107.00, 93.00, 81.40, 71.80, + 63.70, 56.90, 51.10, 46.10, 41.80, 38.10, 34.80, 31.90, 29.40, 27.20, 25.20], + 420: [382.00, 364.00, 335.00, 304.00, 270.00, 235.00, 202.00, 172.00, 146.00, 125.00, 108.00, 93.80, 82.00, 72.30, + 64.10, 57.20, 51.30, 46.30, 42.00, 38.20, 34.90, 32.10, 29.50, 27.30, 25.30], + 450: [409.00, 388.00, 355.00, 320.00, 282.00, 244.00, 208.00, 176.00, 149.00, 127.00, 110.00, 94.90, 82.90, 72.90, + 64.60, 57.60, 51.70, 46.60, 42.20, 38.40, 35.10, 32.20, 29.70, 27.40, 25.40], + 480: [436.00, 412.00, 376.00, 337.00, 295.00, 252.00, 213.00, 180.00, 152.00, 129.00, 111.00, 95.90, 83.60, 73.50, + 65.10, 58.00, 52.00, 46.90, 42.50, 38.60, 35.30, 32.40, 29.80, 27.50, 25.50], + 510: [464.00, 435.00, 395.00, 352.00, 306.00, 260.00, 218.00, 183.00, 154.00, 131.00, 112.00, 96.80, 84.30, 74.10, + 65.50, 58.40, 52.30, 47.10, 42.70, 38.80, 35.40, 32.50, 29.90, 27.60, 25.60], + 540: [491.00, 458.00, 415.00, 367.00, 317.00, 267.00, 223.00, 186.00, 156.00, 132.00, 113.00, 97.60, 84.90, 74.60, + 65.90, 58.70, 52.60, 47.30, 42.90, 39.00, 35.60, 32.60, 30.00, 27.70, 25.70] +} + slenderness_ratios = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, + 220, 230, 240, 250] + df = pd.DataFrame(data, index=slenderness_ratios) + return df + + @staticmethod def cl_7_5_1_2_equivalent_slenderness_ratio_of_truss_compression_members_loaded_one_leg(length, r_min, b1, b2, t, f_y, bolt_no = 2, fixity = 'Fixed'): @@ -1286,7 +1370,10 @@ def cl_8_4_2_2_TensionField( c, d, tw, fyw, bf,tf, fyf,Nf, gamma_mo, A_v,tau_b,V Author: Rutvik Joshi ''' - phi = math.atan(d/c) * 180/math.pi + if c == 0: + phi = 90 + else: + phi = math.atan(d/c) * 180/math.pi M_fr = 0.25 * bf * tf**2 * fyf*(1-(Nf/(bf * tf * fyf / gamma_mo))**2) print('phi',phi,'\n Nf',Nf,M_fr,'M_fr',phi*math.pi/180) s = 2 * math.sqrt(M_fr / (fyw * tw)) / math.sin(phi*math.pi/180) @@ -1331,6 +1418,16 @@ def cl_8_5_1_EndPanel(c, d, tw, fyw, bf, tf, fyf, Nf, gamma_mo, A_v, tau_b, V_p) else: V_tf == V_p return phi, M_fr, s, w_tf, sai, fv, V_tf + + + @staticmethod + def cl_8_6_1_1_plate_girder_minimum_web_a(D,tw,epsilon,tf_top,tf_bot): + d = D - (tf_top + tf_bot) + if d/tw < 200 * epsilon: + return True + else: + return False + # ========================================================================== """ SECTION 9 MEMBER SUBJECTED TO COMBINED FORCES """ @@ -1367,6 +1464,16 @@ def cl_8_7_1_3_stiff_bearing_length(shear_force, web_thickness, flange_thickness # ========================================================================== """ SECTION 9 MEMBER SUBJECTED TO COMBINED FORCES """ + + # ------------------------------------------------------------- + # 10.1 General + # ------------------------------------------------------------- + + + + + + # ========================================================================== """ SECTION 10 CONNECTIONS """ From 1a87e60381c2871e62aeb577c5ac3e4a54838cf5 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Wed, 30 Apr 2025 04:38:57 +0530 Subject: [PATCH 17/23] Working draft of Plate Girder --- .../Unsymmetrical_Section_Properties.py | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py index 175cd8710..4bfe26b20 100644 --- a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py +++ b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py @@ -19,7 +19,7 @@ def calc_mass(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): def calc_area(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - A = (B_top * t_f_top + B_bot * t_f_bot + (D - t_f_top - t_f_bot) * t_w) / 100 + A = (B_top * t_f_top + B_bot * t_f_bot + (D - t_f_top - t_f_bot) * t_w) return round(A, 2) @@ -44,7 +44,7 @@ def calc_MomentOfAreaZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): I_web = (t_w * (D - t_f_top - t_f_bot) ** 3) / 12 + t_w * (D - t_f_top - t_f_bot) * ( y_neutral - (t_f_bot + (D - t_f_top - t_f_bot) / 2)) ** 2 - I_zz = (I_top + I_bot + I_web) / 10000 + I_zz = (I_top + I_bot + I_web) return round(I_zz, 2) @@ -53,22 +53,22 @@ def calc_MomentOfAreaY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): I_bot = (t_f_bot * B_bot ** 3) / 12 I_web = ((D - t_f_top - t_f_bot) * t_w ** 3) / 12 - I_yy = (I_top + I_bot + I_web) / 10000 + I_yy = (I_top + I_bot + I_web) return round(I_yy, 2) def calc_ElasticModulusZz(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): I_zz = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaZ(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) y_neutral = Unsymmetrical_I_Section_Properties.calc_centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - Z_ez_top = I_zz * 10 / (D - y_neutral) - Z_ez_bot = I_zz * 10 / y_neutral + Z_ez_top = I_zz / (D - y_neutral) + Z_ez_bot = I_zz / y_neutral return round(min(Z_ez_top, Z_ez_bot), 2) def calc_ElasticModulusZy(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): I_yy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) B_max = max(B_top, B_bot) - Z_ey = (I_yy * 2 * 10) / B_max + Z_ey = (I_yy * 2 ) / B_max return round(Z_ey, 2) @@ -81,22 +81,22 @@ def calc_PlasticModulusZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): Zpz = (A_top * (D - y_neutral - t_f_top / 2) + A_web_top * ( D - y_neutral - t_f_top - (D - y_neutral - t_f_top) / 2) + - A_bot * (y_neutral - t_f_bot / 2) + A_web_bot * ((y_neutral - t_f_bot) / 2)) / 1000 + A_bot * (y_neutral - t_f_bot / 2) + A_web_bot * ((y_neutral - t_f_bot) / 2)) return round(Zpz, 2) def calc_PlasticModulusY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - Zpy = (t_f_top * B_top ** 2 / 4 + t_f_bot * B_bot ** 2 / 4 + (D - t_f_top - t_f_bot) * t_w ** 2 / 4) / 1000 + Zpy = (t_f_top * B_top ** 2 / 4 + t_f_bot * B_bot ** 2 / 4 + (D - t_f_top - t_f_bot) * t_w ** 2 / 4) return round(Zpy, 2) def calc_TorsionConstantIt(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - h = D - (t_f_top + t_f_bot) - It = (1 / 3) * (t_f_top * B_top ** 3 + t_f_bot * B_bot ** 3 + t_w ** 3 * h) + h = D - ((t_f_top + t_f_bot)/2) + It = (1 / 3) * ( B_top * t_f_top ** 3 + B_bot * t_f_bot ** 3 + h * t_w ** 3 ) return round(It, 2) def calc_WarpingConstantIw(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - h = D - (t_f_top + t_f_bot) + h = D - ((t_f_top + t_f_bot)/2) numerator_Iw = (h ** 2) * t_f_top * t_f_bot * (B_top ** 3) * (B_bot ** 3) denominator_Iw = 12 * (t_f_top * B_top ** 3 + t_f_bot * B_bot ** 3) Iw = numerator_Iw / denominator_Iw @@ -106,8 +106,8 @@ def calc_RadiusOfGyrationZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): """ Radius of gyration about z-axis (major axis) """ - I_zz = self.calc_MomentOfAreaZ(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 10000 # convert to mm⁴ - A = self.calc_area(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 100 # convert to mm² + I_zz = self.calc_MomentOfAreaZ(D, B_top, B_bot, t_w, t_f_top, t_f_bot) + A = self.calc_area(D, B_top, B_bot, t_w, t_f_top, t_f_bot) r_z = math.sqrt(I_zz / A) return round(r_z, 2) @@ -115,7 +115,7 @@ def calc_RadiusOfGyrationY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): """ Radius of gyration about y-axis (minor axis) """ - I_yy = self.calc_MomentOfAreaY(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 10000 # convert to mm⁴ - A = self.calc_area(D, B_top, B_bot, t_w, t_f_top, t_f_bot) * 100 # convert to mm² + I_yy = self.calc_MomentOfAreaY(D, B_top, B_bot, t_w, t_f_top, t_f_bot) + A = self.calc_area(D, B_top, B_bot, t_w, t_f_top, t_f_bot) r_y = math.sqrt(I_yy / A) return round(r_y, 2) \ No newline at end of file From 25b7a53efffc04f6b1ad1e9ad0dac2817786d8f2 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Wed, 21 May 2025 15:47:14 +0530 Subject: [PATCH 18/23] Plate Girder PSO included --- src/osdag/Common.py | 14 +- .../connection/lap_joint_bolted.py | 9 +- src/osdag/design_type/member.py | 4 +- src/osdag/design_type/plate_girder/sample.py | 113 + .../plate_girder/weldedPlateGirder.py | 4407 +++++++-------- .../plate_girder/weldedPlateGirder_working.py | 4727 +++++++++++++++++ .../Unsymmetrical_Section_Properties.py | 86 +- src/osdag/utils/common/is800_2007.py | 239 +- 8 files changed, 6937 insertions(+), 2662 deletions(-) create mode 100644 src/osdag/design_type/plate_girder/sample.py create mode 100644 src/osdag/design_type/plate_girder/weldedPlateGirder_working.py diff --git a/src/osdag/Common.py b/src/osdag/Common.py index e4d2c3c1b..b20f3ae48 100644 --- a/src/osdag/Common.py +++ b/src/osdag/Common.py @@ -453,7 +453,7 @@ def is_valid_custom(self): KEY_EULER_BUCKLING_STRESS = 'MajorBucklingStress' KEY_DISP_EULER_BUCKLING_STRESS = 'Buckling Stress (MPa)' # Euler KEY_EFF_SEC_AREA = 'MajorEffSecArea' -KEY_DISP_EFF_SEC_AREA = 'Eff. Sectional Area (mm2)' # ective +KEY_DISP_EFF_SEC_AREA = 'Eff. Sectional Area (cm2)' # ective KEY_EFF_LEN = 'Major.Effective_Length' KEY_DISP_EFF_LEN = 'Eff. Length (m)' # ective KEY_BUCKLING_CURVE = 'BucklingCurve' @@ -547,8 +547,8 @@ def is_valid_custom(self): KEY_DISP_LTB= 'Lateral Torsional Buckling Details' KEY_DISP_Elastic_CM= 'Critical Moment (Mcr)' # Elastic KEY_DISP_Elastic_CM_latex= 'Elastic Critical Moment(kNm)' # -KEY_DISP_T_constatnt= 'Torsional Constant (mm4)' # (It) -KEY_DISP_W_constatnt= 'Warping Constant (mm6)' # (Iw) +KEY_DISP_T_constatnt= 'Torsional Constant (cm4)' # (It) +KEY_DISP_W_constatnt= 'Warping Constant (cm6)' # (Iw) KEY_LTB= 'L.T.B.Details' KEY_Elastic_CM= 'Elastic.Moment' KEY_T_constatnt= 'T.Constant' @@ -667,9 +667,11 @@ def is_valid_custom(self): KEY_DISP_IntermediateStiffener_spacing = 'Intermediate Stiffener Spacing' KEY_LongitudnalStiffener = 'LongitudnalStiffener.Data' KEY_LongitudnalStiffener_thickness = 'LongitudnalStiffner.Thickness' +KEY_LongitudnalStiffener_thickness_val = 'LongitudnalStiffner.Thickness.val' KEY_DISP_LongitudnalStiffener = 'Longitudnal Stiffener' KEY_DISP_LongitudnalStiffener_thickness = 'Longitudnal Stiffener Thickness' KEY_IntermediateStiffener_thickness = 'IntermediateStiffener.Thickness' +KEY_IntermediateStiffener_thickness_val = 'IntermediateStiffener.Thickness.val' KEY_DISP_IntermediateStiffener_thickness = 'Intermediate Stiffener Thickness' KEY_WeldWebtoflange= 'WeldWebtoflange.Data' KEY_DISP_WeldWebtoflange= 'Weld for Web to Flange' @@ -749,6 +751,12 @@ def is_valid_custom(self): VALUES_MAX_DEFL = ['Span/600','Span/800','Span/400','Span/300','Span/360','Span/150','Span/180','Span/240','Span/120','Span/500','Span/750','Span/1000'] KEY_SUPPORT_WIDTH = 'Support.Width' KEY_DISP_SUPPORT_WIDTH = 'Support Width (mm)' +VALUES_STIFFENER_THICKNESS = ['8', '10', '12', '14', '16', '18', '20', '22', '25', '28', '32', '36', '40', '45', '50', '56', '63', '75', '80', '90', '100', + '110', '120'] +KEY_EndpanelStiffener_thickness = 'EndpanelStiffener.Thickness' +KEY_DISP_EndpanelStiffener_thickness = 'End Panel Stiffener Thickness (mm)' +KEY_LongitudnalStiffener_numbers = 'LongitudnalStiffener.Numbers' +KEY_DISP_LongitudnalStiffener_numbers = 'Number of Longitudnal Stiffeners' ################################### # All Input Keys diff --git a/src/osdag/design_type/connection/lap_joint_bolted.py b/src/osdag/design_type/connection/lap_joint_bolted.py index 9c9fb1c49..c846ee4f4 100644 --- a/src/osdag/design_type/connection/lap_joint_bolted.py +++ b/src/osdag/design_type/connection/lap_joint_bolted.py @@ -466,7 +466,8 @@ def select_bolt_dia_and_grade(self,design_dictionary): if self.bolt.bolt_type == 'Bearing Bolt': self.bolt.bolt_bearing_capacity = round(float(self.bolt.bolt_bearing_capacity),2) self.bolt.bolt_shear_capacity = round(float(self.bolt.bolt_shear_capacity),2) - self.bolt.bolt_capacity = round(float(self.bolt.bolt_capacity),2) + self.bolt.bolt_capacity = round(float(self.bolt.bolt_capacity),2) + logger.info(" : Bolt diameter and grade selected are {} mm and {} respectively.".format(self.bolt.bolt_diameter_provided, self.bolt.bolt_grade_provided)) # print(self.bolt) self.number_r_c_bolts(self, design_dictionary,0,0) @@ -509,7 +510,9 @@ def check_no_cols(numbolts): #in function for recursive call self.cols += 1 else: break - self.rows = math.ceil(self.rows/self.cols) + self.rows = math.ceil(self.rows/self.cols) + if self.rows == 1: + self.rows = 2 if self.cols>1: self.len_conn = (self.cols - 1)*self.bolt.min_pitch_round + 2*self.bolt.min_end_dist_round @@ -640,7 +643,7 @@ def final_formatting(self,design_dictionary): # print("fafafafafa",self.final_edge_dist, self.final_end_dist, self.final_pitch, self.final_gauge) print("FINAL FINAL",self.bolt) print("Final Edge/End/Gauge/Pitch",self.final_edge_dist,self.final_end_dist,self.final_gauge,self.final_pitch) - + logger.info("Design is successful. \n") # print(self) # print("faahfnafanfaf") print("Max and min end edge dist ",self.bolt.max_end_dist_round, self.bolt.min_end_dist_round, self.bolt.max_edge_dist_round, self.bolt.min_edge_dist_round) diff --git a/src/osdag/design_type/member.py b/src/osdag/design_type/member.py index 45a4ba707..9713b1cbf 100644 --- a/src/osdag/design_type/member.py +++ b/src/osdag/design_type/member.py @@ -2906,7 +2906,7 @@ def Stiffener_design(self, input_dictionary): optimum = [] values = {KEY_IntermediateStiffener:'Yes', KEY_IntermediateStiffener_spacing:'NA', - KEY_LongitudnalStiffener:'Yes', + KEY_LongitudnalStiffener:'Yes and 1 stiffener', KEY_IntermediateStiffener_thickness:'6', KEY_LongitudnalStiffener_thickness:'6', KEY_ShearBucklingOption : KEY_DISP_SB_Option[0] @@ -2921,7 +2921,7 @@ def Stiffener_design(self, input_dictionary): t8 = (KEY_IntermediateStiffener_spacing, KEY_DISP_IntermediateStiffener_spacing, TYPE_TEXTBOX, None, values[KEY_IntermediateStiffener_spacing]) optimum.append(t8) - t9 = (KEY_LongitudnalStiffener, KEY_DISP_LongitudnalStiffener, TYPE_COMBOBOX, ['Yes','No'], values[KEY_LongitudnalStiffener]) + t9 = (KEY_LongitudnalStiffener, KEY_DISP_LongitudnalStiffener, TYPE_COMBOBOX, ['Yes and 1 stiffener','Yes and 2 stiffeners','No'], values[KEY_LongitudnalStiffener]) optimum.append(t9) t10 = (KEY_IntermediateStiffener_thickness, KEY_DISP_IntermediateStiffener_thickness, TYPE_COMBOBOX, ['All','Customized'], values[KEY_IntermediateStiffener_thickness]) optimum.append(t10) diff --git a/src/osdag/design_type/plate_girder/sample.py b/src/osdag/design_type/plate_girder/sample.py new file mode 100644 index 000000000..4180d6750 --- /dev/null +++ b/src/osdag/design_type/plate_girder/sample.py @@ -0,0 +1,113 @@ +from PyQt5.QtWidgets import ( + QDialog, QLabel, QLineEdit, QPushButton, QFormLayout, + QApplication, QMessageBox +) +from PyQt5.QtGui import QFont +from PyQt5.QtCore import Qt +import sys + +class RangeInputDialog(QDialog): + def __init__(self): + super().__init__() + self.setWindowTitle("Custom Range Input") + self.setFixedSize(350, 200) + self.set_styles() + + self.values = [] + + self.lower_input = QLineEdit() + self.upper_input = QLineEdit() + self.step_input = QLineEdit() + + for widget in [self.lower_input, self.upper_input, self.step_input]: + widget.setFont(QFont("Segoe UI", 11)) # Slightly larger font + widget.setFixedHeight(32) # Increased height + + # Form layout + form_layout = QFormLayout() + form_layout.setLabelAlignment(Qt.AlignRight) + form_layout.setFormAlignment(Qt.AlignCenter) + + lower_label = QLabel("Lower Bound:") + upper_label = QLabel("Upper Bound:") + step_label = QLabel("Step:") + + for label in [lower_label, upper_label, step_label]: + label.setFont(QFont("Segoe UI", 10)) + + form_layout.addRow(lower_label, self.lower_input) + form_layout.addRow(upper_label, self.upper_input) + form_layout.addRow(step_label, self.step_input) + + self.submit_button = QPushButton("Add") + self.submit_button.setFont(QFont("Segoe UI", 10, QFont.Bold)) + self.submit_button.clicked.connect(self.validate_and_submit) + + form_layout.addRow(self.submit_button) + self.setLayout(form_layout) + + def set_styles(self): + self.setStyleSheet(""" + QDialog { + background-color: white; + } + QLabel { + font-size: 10pt; + } + QLineEdit { + font-size: 11pt; + padding: 4px 6px; + border: 1px solid #aaa; + border-radius: 3px; + } + QPushButton { + background-color: #814c4c; + color: white; + font-size: 10pt; + font-weight: bold; + height: 28px; + border-radius: 4px; + } + QPushButton:hover { + background-color: #a05c5c; + } + """) + + def validate_and_submit(self): + lower_text = self.lower_input.text().strip() + upper_text = self.upper_input.text().strip() + step_text = self.step_input.text().strip() + + if not lower_text or not upper_text or not step_text: + self.show_error("All fields must be filled.") + return + + try: + lower = float(lower_text) + upper = float(upper_text) + step = float(step_text) + + if step <= 0: + self.show_error("Step must be greater than 0.") + return + + self.values = [lower, upper, step] + self.accept() + + except ValueError: + self.show_error("Please enter valid numeric values.") + + def show_error(self, message): + QMessageBox.warning(self, "Input Error", message) + + def get_values(self): + return self.values + + +# Run for test +if __name__ == "__main__": + app = QApplication(sys.argv) + dialog = RangeInputDialog() + if dialog.exec_() == QDialog.Accepted: + print("Returned values:", dialog.get_values()) + sys.exit(app.exec_()) diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder.py b/src/osdag/design_type/plate_girder/weldedPlateGirder.py index aa8bf0785..93ff1f3c0 100644 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder.py +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder.py @@ -22,6 +22,7 @@ import logging import math import numpy as np +from pyswarms.single.global_best import GlobalBestPSO from ...Common import * # from ..connection.moment_connection import MomentConnection from ...utils.common.material import * @@ -38,11 +39,298 @@ from ...utils.common.component import * from osdag.cad.items.plate import Plate from ...utils.common.Unsymmetrical_Section_Properties import Unsymmetrical_I_Section_Properties -class PlateGirderWelded(Member): +#GUI TO SELECT CUSTOM IN DESIGN PREFERENCES +from PyQt5 import QtCore, QtWidgets +from PyQt5.QtWidgets import QDialog, QListWidget, QListWidgetItem +from PyQt5.QtWidgets import ( + QDialog, QLabel, QLineEdit, QPushButton, QFormLayout, + QApplication, QMessageBox +) +from PyQt5.QtGui import QFont +from PyQt5.QtCore import Qt +import re +import sys + +scale = 1 # For resizing components + +class RangeInputDialog(QDialog): + def __init__(self): + super().__init__() + self.setWindowTitle("Custom Range Input") + self.setFixedSize(350, 200) + self.set_styles() + + self.values = [] + + self.lower_input = QLineEdit() + self.upper_input = QLineEdit() + self.step_input = QLineEdit() + + for widget in [self.lower_input, self.upper_input, self.step_input]: + widget.setFont(QFont("Segoe UI", 11)) # Slightly larger font + widget.setFixedHeight(32) # Increased height + + # Form layout + form_layout = QFormLayout() + form_layout.setLabelAlignment(Qt.AlignRight) + form_layout.setFormAlignment(Qt.AlignCenter) + + lower_label = QLabel("Lower Bound:") + upper_label = QLabel("Upper Bound:") + step_label = QLabel("Step:") + + for label in [lower_label, upper_label, step_label]: + label.setFont(QFont("Segoe UI", 10)) + + form_layout.addRow(lower_label, self.lower_input) + form_layout.addRow(upper_label, self.upper_input) + form_layout.addRow(step_label, self.step_input) + + self.submit_button = QPushButton("Add") + self.submit_button.setFont(QFont("Segoe UI", 10, QFont.Bold)) + self.submit_button.clicked.connect(self.validate_and_submit) + + form_layout.addRow(self.submit_button) + self.setLayout(form_layout) + + def set_styles(self): + self.setStyleSheet(""" + QDialog { + background-color: white; + } + QLabel { + font-size: 10pt; + } + QLineEdit { + font-size: 11pt; + padding: 4px 6px; + border: 1px solid #aaa; + border-radius: 3px; + } + QPushButton { + background-color: #814c4c; + color: white; + font-size: 10pt; + font-weight: bold; + height: 28px; + border-radius: 4px; + } + QPushButton:hover { + background-color: #a05c5c; + } + """) + + def validate_and_submit(self): + lower_text = self.lower_input.text().strip() + upper_text = self.upper_input.text().strip() + step_text = self.step_input.text().strip() + + if not lower_text or not upper_text or not step_text: + self.show_error("All fields must be filled.") + return + + try: + lower = float(lower_text) + upper = float(upper_text) + step = float(step_text) + + if step <= 0: + self.show_error("Step must be greater than 0.") + return + + self.values = [lower, upper, step] + self.accept() + + except ValueError: + self.show_error("Please enter valid numeric values.") + + def show_error(self, message): + QMessageBox.warning(self, "Input Error", message) + + def get_values(self): + return self.values + + +class My_ListWidget(QListWidget): + def addItems(self, Iterable, p_str=None): + super().addItems(Iterable) + self.sortItems() + + def addItem(self, *__args): + super().addItem(My_ListWidgetItem(__args[0])) + self.sortItems() + +class My_ListWidgetItem(QListWidgetItem): + def __lt__(self, other): + try: + self_text = str(re.sub("[^0-9.]", "", self.text())) + other_text = str(re.sub("[^0-9.]", "", other.text())) + return float(self_text) < float(other_text) + except Exception: + return super().__lt__(other) + +class PopupDialog(QDialog): + def __init__(self, disabled_values=[], note="", parent=None): + super().__init__(parent) + self.disabled_values = disabled_values + self.note = note + self.setWindowTitle("Customized") + self.resize(int(scale*540), int(scale*470)) + self.init_ui() + self.set_styles() + + def init_ui(self): + self.label = QtWidgets.QLabel("Available:", self) + self.label.setGeometry(QtCore.QRect(20, 20, 150, 30)) + + self.label_2 = QtWidgets.QLabel("Selected:", self) + self.label_2.setGeometry(QtCore.QRect(int(scale * 320), 20, 150, 30)) + + self.listWidget = My_ListWidget(self) + self.listWidget.setGeometry(QtCore.QRect(20, 50, int(scale*180), int(scale*300))) + self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget.itemDoubleClicked.connect(self.move_to_selected) + + self.listWidget_2 = My_ListWidget(self) + self.listWidget_2.setGeometry(QtCore.QRect(int(scale*320), 50, int(scale*180), int(scale*300))) + self.listWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget_2.itemDoubleClicked.connect(self.move_to_available) + + self.pushButton = QtWidgets.QPushButton(">>", self) + self.pushButton.setGeometry(QtCore.QRect(int(scale*225), int(scale*140), int(scale*70), int(scale*30))) + + self.pushButton_2 = QtWidgets.QPushButton(">", self) + self.pushButton_2.setGeometry(QtCore.QRect(int(scale*225), int(scale*180), int(scale*70), int(scale*30))) + + self.pushButton_3 = QtWidgets.QPushButton("<", self) + self.pushButton_3.setGeometry(QtCore.QRect(int(scale*225), int(scale*220), int(scale*70), int(scale*30))) + + self.pushButton_4 = QtWidgets.QPushButton("<<", self) + self.pushButton_4.setGeometry(QtCore.QRect(int(scale*225), int(scale*260), int(scale*70), int(scale*30))) + + self.pushButton_5 = QtWidgets.QPushButton("Submit", self) + self.pushButton_5.setGeometry(QtCore.QRect(int(scale*190), int(scale*400), int(scale*140), int(scale*35))) + self.pushButton_5.setDefault(True) + + self.pushButton.clicked.connect(self.move_all_to_selected) + self.pushButton_2.clicked.connect(self.move_selected_to_selected) + self.pushButton_3.clicked.connect(self.move_selected_to_available) + self.pushButton_4.clicked.connect(self.move_all_to_available) + self.pushButton_5.clicked.connect(self.accept) + + self.listWidget.itemSelectionChanged.connect(self.update_buttons_status) + self.listWidget_2.itemSelectionChanged.connect(self.update_buttons_status) + + self.update_buttons_status() + + def update_buttons_status(self): + self.pushButton_2.setDisabled(not bool(self.listWidget.selectedItems())) + self.pushButton_3.setDisabled(not bool(self.listWidget_2.selectedItems())) + + def move_selected_to_selected(self): + for item in self.listWidget.selectedItems(): + self.listWidget_2.addItem(item.text()) + for item in self.listWidget.selectedItems(): + self.listWidget.takeItem(self.listWidget.row(item)) + + def move_selected_to_available(self): + for item in self.listWidget_2.selectedItems(): + self.listWidget.addItem(item.text()) + for item in self.listWidget_2.selectedItems(): + self.listWidget_2.takeItem(self.listWidget_2.row(item)) + + def move_all_to_selected(self): + while self.listWidget.count() > 0: + self.listWidget_2.addItem(self.listWidget.takeItem(0).text()) + + def move_all_to_available(self): + while self.listWidget_2.count() > 0: + self.listWidget.addItem(self.listWidget_2.takeItem(0).text()) + + def move_to_selected(self, item): + self.listWidget_2.addItem(item.text()) + self.listWidget.takeItem(self.listWidget.row(item)) + + def move_to_available(self, item): + self.listWidget.addItem(item.text()) + self.listWidget_2.takeItem(self.listWidget_2.row(item)) + + def get_selected_items(self): + return [self.listWidget_2.item(i).text() for i in range(self.listWidget_2.count())] + + def set_styles(self): + brown = "#925a5b" + grey = "#8e8e8e" + white = "#ffffff" + + button_style = f""" + QPushButton {{ + background-color: {brown}; + color: {white}; + border-radius: 6px; + font-size: 22px; + padding: 6px 18px; + border: none; + }} + QPushButton:disabled {{ + background-color: {grey}; + color: {white}; + }} + """ + for btn in [self.pushButton, self.pushButton_2, self.pushButton_3, self.pushButton_4, self.pushButton_5]: + btn.setStyleSheet(button_style) + + list_item_style = """ + QListWidget::item { + font-size: 24px; + color: black; + margin: 2px 0px; + } + """ + scrollbar_style = f""" + QScrollBar:vertical {{ + border: none; + background: #f5f5f5; + width: 12px; + border-radius: 6px; + }} + QScrollBar::handle:vertical {{ + background: {grey}; + min-height: 20px; + border-radius: 6px; + }} + QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {{ + background: none; + height: 0px; + }} + QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {{ + background: none; + }} + QScrollBar:horizontal {{ + height: 0px; + }} + """ + self.listWidget.setStyleSheet(list_item_style + scrollbar_style) + self.listWidget_2.setStyleSheet(list_item_style + scrollbar_style) + + + + + + + + +class PlateGirderWelded(Member): + int_thicklist = [] + long_thicklist = [] + def __init__(self): super(PlateGirderWelded, self).__init__() + self.design_status = False + + ############################################### # Design Preference Functions Start @@ -93,7 +381,7 @@ def tab_value_changed(self): t4 = (KEY_DISP_GIRDERSEC, ['Label_6', 'Label_7', 'Label_8', 'Label_9', 'Label_10', 'Label_11'], ['Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', - 'Label_19', 'Label_20', 'Label_21', 'Label_22'], TYPE_TEXTBOX, self.Unsymm_I_Section_properties) + 'Label_19', 'Label_20', 'Label_21', 'Label_22','Label_23'], TYPE_TEXTBOX, self.Unsymm_I_Section_properties) change_tab.append(t4) t9 = ("Deflection", [KEY_STR_TYPE], [KEY_MEMBER_OPTIONS], TYPE_COMBOBOX, self.member_options_change) @@ -102,6 +390,14 @@ def tab_value_changed(self): change_tab.append(t9) t9 = ("Deflection", [KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_SUPPORTING_OPTIONS], [KEY_MAX_DEFL], TYPE_TEXTBOX, self.max_defl_change) change_tab.append(t9) + t10 = ("Stiffeners", [KEY_IntermediateStiffener_thickness], [KEY_IntermediateStiffener_thickness_val], TYPE_COMBOBOX, self.Int_stiffener_thickness_customized) + change_tab.append(t10) + t11 = ("Stiffeners", [KEY_LongitudnalStiffener_thickness], [KEY_LongitudnalStiffener_thickness_val], TYPE_COMBOBOX, self.Long_stiffener_thickness_customized) + change_tab.append(t11) + + + # t10 = ('Stiffeners',[KEY_WEB_PHILOSOPHY],[KEY_IntermediateStiffener_spacing],TYPE_TEXTBOX,self.Intm_stiffener_spacing_change) + # change_tab.append(t10) @@ -136,13 +432,13 @@ def input_dictionary_design_pref(self): t2 = ("Optimisation", TYPE_COMBOBOX, [KEY_ALLOW_CLASS, KEY_LOAD]) # , KEY_STEEL_COST design_input.append(t2) - t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_IntermediateStiffener,KEY_LongitudnalStiffener]) + t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_IntermediateStiffener,KEY_LongitudnalStiffener,KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness]) design_input.append(t2) t2 = ("Stiffeners", TYPE_TEXTBOX, [KEY_IntermediateStiffener_spacing]) design_input.append(t2) - t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness,KEY_ShearBucklingOption]) + t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_ShearBucklingOption,KEY_IntermediateStiffener_thickness_val,KEY_LongitudnalStiffener_thickness_val]) design_input.append(t2) t2 = ("Additional Girder Data", TYPE_COMBOBOX, [KEY_IS_IT_SYMMETRIC]) @@ -166,7 +462,7 @@ def input_dictionary_without_design_pref(self): design_input.append(t2) t2 = (None, [KEY_ALLOW_CLASS, KEY_EFFECTIVE_AREA_PARA, KEY_LENGTH_OVERWRITE, KEY_LOAD, KEY_DP_DESIGN_METHOD,KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_MAX_DEFL, - KEY_SUPPORTING_OPTIONS,KEY_ShearBucklingOption, KEY_IntermediateStiffener_spacing, KEY_IntermediateStiffener,KEY_LongitudnalStiffener, + KEY_SUPPORTING_OPTIONS,KEY_ShearBucklingOption, KEY_IntermediateStiffener_spacing, KEY_IntermediateStiffener,KEY_LongitudnalStiffener,KEY_IntermediateStiffener_thickness_val,KEY_LongitudnalStiffener_thickness_val, KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness, KEY_IS_IT_SYMMETRIC], '') design_input.append(t2) @@ -198,16 +494,18 @@ def get_values_for_design_pref(self, key, design_dictionary): KEY_DP_DESIGN_METHOD: "Limit State Design", KEY_ShearBucklingOption: KEY_DISP_SB_Option[0], KEY_IS_IT_SYMMETRIC: 'Symmetrical', - KEY_IntermediateStiffener: 'Yes', - KEY_IntermediateStiffener_spacing: 'NA', - KEY_IntermediateStiffener_thickness: '6', - KEY_LongitudnalStiffener: 'Yes', - KEY_LongitudnalStiffener_thickness:'6', + KEY_IntermediateStiffener_spacing:'NA', + KEY_IntermediateStiffener: 'No', + KEY_IntermediateStiffener_thickness:'All', + KEY_LongitudnalStiffener: 'Yes and 1 stiffener', + KEY_LongitudnalStiffener_thickness:'All', KEY_STR_TYPE:'Highway Bridge', KEY_DESIGN_LOAD:'Live Load', KEY_MEMBER_OPTIONS :'Simple Span', KEY_SUPPORTING_OPTIONS: 'NA', - KEY_MAX_DEFL : 'Span/600' + KEY_MAX_DEFL : 'Span/600', + KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS, + KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS }[key] return val @@ -294,7 +592,32 @@ def max_defl_change(self): return {KEY_MAX_DEFL : VALUES_MAX_DEFL[11]} else: return {KEY_MAX_DEFL : 'NA'} - + + def Int_stiffener_thickness_customized(self): + selected_items = [] + if self[0] == 'All': + return {KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS} + else: + popup = PopupDialog() + popup.listWidget.addItems(VALUES_STIFFENER_THICKNESS) # Set available items + if popup.exec_() == QDialog.Accepted: + selected_items = popup.get_selected_items() + # print("Selected:", selected_items) + PlateGirderWelded.int_thicklist = selected_items + return {KEY_IntermediateStiffener_thickness_val : selected_items} + + def Long_stiffener_thickness_customized(self): + selected_items2 = [] + if self[0] == 'All': + return {KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS} + else: + popup = PopupDialog() + popup.listWidget.addItems(VALUES_STIFFENER_THICKNESS) # Set available items + if popup.exec_() == QDialog.Accepted: + selected_items2 = popup.get_selected_items() + # print("Selected:", selected_items2) + PlateGirderWelded.long_thicklist = selected_items2 + return {KEY_LongitudnalStiffener_thickness_val : selected_items2} #################################### # Design Preference Functions End @@ -344,6 +667,9 @@ def customized_input(self): t3= (KEY_WEB_THICKNESS_PG, self.plate_thick_customized) c_lst.append(t3) + + # t4 = (KEY_LongitudnalStiffener_thickness,self.long_stf_thk_customized) + # c_lst.append(t4) return c_lst @@ -492,10 +818,9 @@ def customized_dimensions_2(self): def customized_dims(self): conn = self[0] if conn == "Customized": - return TYPE_TEXTBOX + return True else: - return '' - + return False def customized_options(self): conn = self[0] if conn == "Customized": @@ -517,22 +842,22 @@ def input_value_changed(self): lst.append(t44) t45 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_OVERALL_DEPTH_PG, TYPE_TEXTBOX, self.customized_dims) lst.append(t45) - t46 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_WEB_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) - lst.append(t46) + # t46 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_WEB_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) + # lst.append(t46) t2 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_LABEL, self.customized_dimensions_1) lst.append(t2) t3 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) lst.append(t3) - t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) - lst.append(t47) + # t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) + # lst.append(t47) t23 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_Bflange_PG, TYPE_LABEL, self.customized_dimensions_2) lst.append(t23) t24 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) lst.append(t24) - t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) - lst.append(t47) + # t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) + # lst.append(t47) t3 = ([KEY_MATERIAL], KEY_MATERIAL, TYPE_CUSTOM_MATERIAL, self.new_material) lst.append(t3) @@ -593,6 +918,30 @@ def input_value_changed(self): KEY_Elastic_CM, TYPE_OUT_DOCK, self.output_modifier) lst.append(t18) + t19 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_thickness,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t19) + + t20 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_thickness,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t20) + + t21 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_thickness,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t21) + + t22 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_thickness,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t22) + + t23 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_spacing,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t23) + + t24 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_spacing,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t24) + + t25 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t25) + + t26 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t26) + return lst def warning_majorbending(self): @@ -612,6 +961,15 @@ def output_modifier(self): # return True else: return True + + def output_modifier2(self): + print(self) + if self[0] == 'Thin Web with ITS': + return False + # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : + # return True + else: + return True def Design_pref_modifier(self): print("Design_pref_modifier",self) @@ -621,99 +979,99 @@ def output_values(self, flag): out_list = [] - t1 = (None, DISP_TITLE_STRUT_SECTION, TYPE_TITLE, None, True) - out_list.append(t1) + t0 = (None, DISP_TITLE_STRUT_SECTION, TYPE_TITLE, None, True) + out_list.append(t0) t1 = (KEY_TITLE_OPTIMUM_DESIGNATION, KEY_DISP_TITLE_OPTIMUM_DESIGNATION, TYPE_TEXTBOX, self.result_designation if flag else '', True) out_list.append(t1) - t1 = ( + t2 = ( KEY_OPTIMUM_UR_COMPRESSION, KEY_DISP_OPTIMUM_UR_COMPRESSION, TYPE_TEXTBOX, round(self.result_UR,3) if flag else '', True) - out_list.append(t1) + out_list.append(t2) - t1 = (KEY_OPTIMUM_SC, KEY_DISP_OPTIMUM_SC, TYPE_TEXTBOX, self.result_section_class if flag else '', True) - out_list.append(t1) + t3 = (KEY_OPTIMUM_SC, KEY_DISP_OPTIMUM_SC, TYPE_TEXTBOX, self.section_classification_val if flag else '', True) + out_list.append(t3) - t2 = (KEY_betab_constatnt,KEY_DISP_betab_constatnt, TYPE_TEXTBOX, - round(self.result_betab,2) if flag else '', True) - out_list.append(t2) + t4 = (KEY_betab_constatnt,KEY_DISP_betab_constatnt, TYPE_TEXTBOX, + self.betab if flag else '', True) + out_list.append(t4) - t2 = ( - KEY_EFF_SEC_AREA, KEY_DISP_EFF_SEC_AREA, TYPE_TEXTBOX, self.result_effective_area if flag else '', + t5 = ( + KEY_EFF_SEC_AREA, KEY_DISP_EFF_SEC_AREA, TYPE_TEXTBOX, self.effectivearea if flag else '', True) - out_list.append(t2) + out_list.append(t5) - t1 = (None,KEY_DESIGN_COMPRESSION , TYPE_TITLE, None, True) - out_list.append(t1) + # t6 = (None,"Design Results" , TYPE_TITLE, None, True) + # out_list.append(t6) - t1 = (KEY_SHEAR_STRENGTH, KEY_DISP_DESIGN_STRENGTH_SHEAR, TYPE_TEXTBOX, - self.result_shear if flag else - '', True) - out_list.append(t1) - # - t1 = (KEY_MOMENT_STRENGTH, KEY_DISP_DESIGN_STRENGTH_MOMENT, TYPE_TEXTBOX, - self.result_bending if flag else - '', True) - out_list.append(t1) + - t1 = (None, KEY_DISP_DESIGN_STIFFER , TYPE_TITLE, None, True) - out_list.append(t1) + - t1 = (KEY_IntermediateStiffener_thickness, KEY_DISP_IntermediateStiffener_thickness, TYPE_TEXTBOX, - self.result_shear if flag else - '', True) + # t9 = (None, KEY_DISP_DESIGN_STIFFER , TYPE_TITLE, None, True) + # out_list.append(t9) + + t10 = (KEY_IntermediateStiffener_thickness, KEY_DISP_IntermediateStiffener_thickness, TYPE_TEXTBOX, + self.intstiffener_thk if flag else '', True) + out_list.append(t10) + + t10 = (KEY_IntermediateStiffener_spacing, KEY_DISP_IntermediateStiffener_spacing, TYPE_TEXTBOX, + self.intstiffener_spacing if flag else '', True) + out_list.append(t10) + + t1 = (KEY_LongitudnalStiffener_thickness, KEY_DISP_LongitudnalStiffener_thickness, TYPE_TEXTBOX, + self.longstiffener_thk if flag else '', True) out_list.append(t1) - t1 = (KEY_IntermediateStiffener_thickness, KEY_DISP_IntermediateStiffener_thickness, TYPE_TEXTBOX, - self.result_shear if flag else - '', True) + t1 = (KEY_LongitudnalStiffener_numbers, KEY_DISP_LongitudnalStiffener_numbers, TYPE_TEXTBOX, '', True) out_list.append(t1) - t1 = (KEY_MOMENT_STRENGTH, KEY_DISP_MOMENT, TYPE_TEXTBOX, - self.result_bending if flag else + t2 = (KEY_EndpanelStiffener_thickness, KEY_DISP_EndpanelStiffener_thickness, TYPE_TEXTBOX, '', True) + out_list.append(t2) - t1 = (None, KEY_DISP_WELD_DESIGN, TYPE_TITLE, None, True) + t1 = (KEY_MOMENT_STRENGTH, KEY_DISP_MOMENT, TYPE_TEXTBOX, + self.design_moment if flag else '', True) out_list.append(t1) + # t1 = (None, KEY_DISP_WELD_DESIGN, TYPE_TITLE, None, True) + # out_list.append(t1) + t1 = (KEY_WeldWebtoflange, KEY_DISP_WeldWebtoflange, TYPE_TEXTBOX, - self.result_bending if flag else '', True) out_list.append(t1) t1 = (KEY_WeldStiffenertoweb, KEY_DISP_WeldStiffenertoweb, TYPE_TEXTBOX, - self.result_bending if flag else '', True) out_list.append(t1) - t1 = (None, KEY_DISP_LTB, TYPE_TITLE, None, False) - out_list.append(t1) + # t1 = (None, KEY_DISP_LTB, TYPE_TITLE, None, False) + # out_list.append(t1) t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, - self.result_tc if flag else '', False) + self.torsion_cnst if flag else '', False) out_list.append(t2) - t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.result_wc if flag else '', False) + t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.warping_cnst if flag else '', False) out_list.append(t2) t2 = ( - KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, self.result_IF_lt if flag else '', + KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, '', False) out_list.append(t2) - t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, self.result_srf_lt if flag else '', False) + t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, '', False) out_list.append(t2) - t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, self.result_nd_esr_lt if flag else '', False) + t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, '', False) out_list.append(t2) t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, - self.result_nd_esr_lt if flag else '', False) out_list.append(t1) - t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.result_mcr if flag else '', False) + t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.critical_moment if flag else '', False) out_list.append(t2) # TODO @Rutvik: can add tab button for asthetics @@ -898,11 +1256,15 @@ def set_input_values(self, design_dictionary): self.section_class = None if self.design_type == 'Optimized': self.total_depth = 1 - self.web_thickness = 1 + self.web_thickness_list = design_dictionary[KEY_WEB_THICKNESS_PG] self.top_flange_width = 1 - self.top_flange_thickness = 1 + self.top_flange_thickness_list = design_dictionary[KEY_TOP_FLANGE_THICKNESS_PG] self.bottom_flange_width = 1 - self.bottom_flange_thickness = 1 + self.bottom_flange_thickness_list = design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG] + #optimize the initialization for list outputs + self.web_thickness = float(design_dictionary[KEY_WEB_THICKNESS_PG][0]) + self.top_flange_thickness = float(design_dictionary[KEY_TOP_FLANGE_THICKNESS_PG][0]) + self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) else: @@ -922,8 +1284,32 @@ def set_input_values(self, design_dictionary): # self.bottom_flange_thickness_list = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG]) + ########## - modify when the thickness becomes a list thickness_for_mat = max(self.web_thickness,self.top_flange_thickness, self.bottom_flange_thickness) + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + self.IntStiffnerwidth = min(self.top_flange_width,self.bottom_flange_width) - self.web_thickness/2 - 10 self.material = Material(design_dictionary[KEY_MATERIAL],thickness_for_mat) + self.eff_width_longitudnal = min(self.top_flange_width,self.bottom_flange_width) - self.web_thickness/2 - 10 + + #-------------------------------------------------------------------------------- + # if design_dictionary[KEY_IntermediateStiffener_thickness] == 'All': + if design_dictionary[KEY_IntermediateStiffener_thickness] == 'Customized': + design_dictionary[KEY_IntermediateStiffener_thickness_val] = PlateGirderWelded.int_thicklist + else: + design_dictionary[KEY_IntermediateStiffener_thickness_val] = VALUES_STIFFENER_THICKNESS + + self.int_thickness_list = design_dictionary[KEY_IntermediateStiffener_thickness_val] + + if design_dictionary[KEY_LongitudnalStiffener_thickness] == 'Customized': + design_dictionary[KEY_LongitudnalStiffener_thickness_val] = PlateGirderWelded.long_thicklist + else: + design_dictionary[KEY_LongitudnalStiffener_thickness_val] = VALUES_STIFFENER_THICKNESS + + self.long_thickness_list = design_dictionary[KEY_LongitudnalStiffener_thickness_val] #float conv required + + self.support_condition = 'Simply Supported' + self.loading_case = design_dictionary[KEY_BENDING_MOMENT_SHAPE] + self.shear_type = None self.support_type = design_dictionary[KEY_DESIGN_TYPE_FLEXURE] self.loading_condition = design_dictionary[KEY_LOAD] self.torsional_res = design_dictionary[KEY_TORSIONAL_RES] @@ -936,6 +1322,53 @@ def set_input_values(self, design_dictionary): self.web_philosophy = design_dictionary[KEY_WEB_PHILOSOPHY] self.epsilon = math.sqrt(250 / self.material.fy) self.b1 = float(design_dictionary[KEY_SUPPORT_WIDTH]) + self.c = design_dictionary[KEY_IntermediateStiffener_spacing] + self.Is = None + self.IntStiffThickness = float(self.int_thickness_list[0]) + self.LongStiffThickness = float(self.long_thickness_list[0]) + self.V_cr = None + self.V_d = None + self.V_tf = None + self.long_Stiffner = design_dictionary[KEY_LongitudnalStiffener] + self.load = Load(shear_force=design_dictionary[KEY_SHEAR],axial_force="",moment=design_dictionary[KEY_MOMENT],unit_kNm=True,) + self.alpha_lt = 0.49 + self.phi_lt = None + self.gamma_m0 = IS800_2007.cl_5_4_1_Table_5["gamma_m0"]["yielding"] + self.X_lt = None + self.fbd_lt = None + self.Md = None + if self.support_type == 'Major Laterally Supported': + self.lefactor = 0.7 + else: + self.lefactor = 1 + self.M_cr = None + self.F_q = None + self.Critical_buckling_load = None + self.shear_ratio = 0 + self.moment_ratio = 0 + self.deflection_ratio = 0 + self.It = None + self.Iw = None + self.torsion_cnst = None + self.warping_cnst = None + self.critical_moment = None + self.fcd = None + # #OUTPUT VAR INITIALIZATION + # self.result_designation = None + # self.result_UR = None + # self.result_section_class = None + # self.result_betab = None + # self.result_effective_area = None + # self.result_shear = None + # self.result_bending = None + # self.result_tc = None + # self.result_wc = None + # self.result_IF_lt = None + # self.result_srf_lt = None + # self.result_nd_esr_lt = None + # self.result_nd_esr_lt = None + # self.result_mcr = None + # design type # self.design_type_temp = design_dictionary[KEY_DESIGN_TYPE_FLEXURE] # or KEY_DISP_DESIGN_TYPE2_FLEXURE # self.latex_design_type = design_dictionary[KEY_DESIGN_TYPE_FLEXURE] # or KEY_DISP_DESIGN_TYPE2_FLEXURE @@ -961,9 +1394,12 @@ def set_input_values(self, design_dictionary): # self.support = design_dictionary[KEY_DESIGN_TYPE_FLEXURE] # factored loads - self.load = Load(shear_force=design_dictionary[KEY_SHEAR],axial_force="",moment=design_dictionary[KEY_MOMENT],unit_kNm=True,) - + + + + + # design preferences # self.allowable_utilization_ratio = float(design_dictionary[KEY_ALLOW_UR]) @@ -992,7 +1428,7 @@ def set_input_values(self, design_dictionary): # print("==================") # # safety factors - self.gamma_m0 = IS800_2007.cl_5_4_1_Table_5["gamma_m0"]["yielding"] + # self.gamma_m1 = IS800_2007.cl_5_4_1_Table_5["gamma_m1"]["ultimate_stress"] # self.material_property = Material(material_grade=self.material, thickness=0) # self.fyf = self.material_property.fy @@ -1003,14 +1439,32 @@ def set_input_values(self, design_dictionary): # initialize the design status # self.design_status_list = [] self.design_status = False + + self.shear_force_optimal = False + self.moment_optimal = False + self.min_mass = False # self.sec_prop_initial_dict = {} # self.failed_design_dict = {} - self.section_classification(self, design_dictionary) + if self.design_type == 'Optimized': + is_thick_web = False + is_symmetric = False + if self.web_philosophy == 'Thick Web without ITS': + is_thick_web = True + else: + is_thick_web = False + + if design_dictionary[KEY_IS_IT_SYMMETRIC] == 'Symmetric Girder': + is_symmetric = True + else: + is_symmetric = False + self.optimized_method(self,design_dictionary,is_thick_web,is_symmetric) + + # pass + else: + self.design_check(self,design_dictionary) # if self.flag: # self.results(self, design_dictionary) - self.shear_force_optimal = False - self.moment_optimal = False - self.min_mass = False + # else: # pass @@ -1019,340 +1473,176 @@ def set_input_values(self, design_dictionary): # # ) # return - # Simulation starts here def section_classification(self,design_dictionary): - # for self.web_thickness in self.web_thickness_list: - # for self.top_flange_thickness in self.top_flange_thickness_list: - # for + self.design_status = False + + print("THICKNESS VALUES INT STIFFNER", self.int_thickness_list) + print("THICKNESS VALUE LONG STIFFENER",self.long_thickness_list) flange_class_top = IS800_2007.Table2_i(((self.top_flange_width / 2)),self.top_flange_thickness,self.material.fy,'Welded')[0] flange_class_bottom = IS800_2007.Table2_i(((self.bottom_flange_width / 2)),self.bottom_flange_thickness,self.material.fy,'Welded')[0] web_class = IS800_2007.Table2_iii((self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness),self.web_thickness,self.material.fy) web_ratio = (self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness)) / self.web_thickness flange_ratio_top = self.top_flange_width / (2 *self.top_flange_thickness) flange_ratio_bottom = self.bottom_flange_width / (2 *self.bottom_flange_thickness) - print("fafafafafafafafaf",flange_class_top, flange_class_bottom,web_class,web_ratio,flange_ratio_top,flange_ratio_bottom) + print("Section classification- top flange, bottom flange, Web",flange_class_top, flange_class_bottom,web_class,web_ratio,flange_ratio_top,flange_ratio_bottom) if flange_class_bottom == "Slender" or web_class == "Slender" or flange_class_top == 'Slender': self.section_class = "Slender" else: - if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic and flange_class_top == KEY_Plastic: - self.section_class = KEY_Plastic - elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact and flange_class_top == KEY_Plastic: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact and flange_class_top == KEY_Plastic: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic and flange_class_top == KEY_Compact: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact and flange_class_top == KEY_Compact: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact and flange_class_top == KEY_Compact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic and flange_class_top == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact and flange_class_top == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact and flange_class_top == KEY_SemiCompact: + if flange_class_top == KEY_Plastic: + if web_class == KEY_Plastic: + if flange_class_bottom == KEY_Plastic: + self.section_class = KEY_Plastic + elif flange_class_bottom == KEY_Compact: + self.section_class = KEY_Compact + else: # SemiCompact + self.section_class = KEY_SemiCompact + elif web_class == KEY_Compact: + if flange_class_bottom in [KEY_Plastic, KEY_Compact]: + self.section_class = KEY_Compact + else: # SemiCompact + self.section_class = KEY_SemiCompact + else: # web SemiCompact + self.section_class = KEY_SemiCompact + + elif flange_class_top == KEY_Compact: + if web_class == KEY_Plastic: + if flange_class_bottom in [KEY_Plastic, KEY_Compact]: + self.section_class = KEY_Compact + else: # SemiCompact + self.section_class = KEY_SemiCompact + elif web_class == KEY_Compact: + if flange_class_bottom in [KEY_Plastic, KEY_Compact]: + self.section_class = KEY_Compact + else: # SemiCompact + self.section_class = KEY_SemiCompact + else: # web SemiCompact + self.section_class = KEY_SemiCompact + + else: # flange_class_top == SemiCompact self.section_class = KEY_SemiCompact - print("fafafahjahfhabnfahf", self.section_class) + print("overall section class", self.section_class) self.Zp_req = self.load.moment * self.gamma_m0 / self.material.fy self.effective_length_beam(self, design_dictionary, self.length) print( 'self.allow_class', self.allow_class) + + if self.section_class == 'Slender': + return False + else: + return True + + + def beta_value(self,design_dictionary,section_class): self.plast_sec_mod_z = Unsymmetrical_I_Section_Properties.calc_PlasticModulusZ(self,self.total_depth,self.top_flange_width,self.bottom_flange_width, - self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness) + self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.epsilon) self.elast_sec_mod_z =Unsymmetrical_I_Section_Properties.calc_ElasticModulusZz(self,self.total_depth,self.top_flange_width,self.bottom_flange_width, self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness) + print("self.plast_sec_mod_z",self.plast_sec_mod_z) + print("self.elast_sec_mod_z",self.elast_sec_mod_z) self.Zp_req = self.load.moment * self.gamma_m0 / self.material.fy if self.plast_sec_mod_z >= self.Zp_req: print( 'self.section_property.plast_sec_mod_z More than Requires',self.plast_sec_mod_z,self.Zp_req) - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - self.beta_b_lt = 1.0 - else: - self.beta_b_lt = (self.elast_sec_mod_z/ self.plast_sec_mod_z) - print("Fafavsfqf",self.beta_b_lt) - A_vg = (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness) * self.web_thickness - self.V_d = ((A_vg * self.material.fy) / (math.sqrt(3) * self.gamma_m0)) - print("Shear check",self.V_d) - print("shear force ",self.load.shear_force) #V value self.load.shear_force - if IS800_2007.cl_8_2_1_2_high_shear_check(self.load.shear_force,self.V_d): #high shear - if self.support_type == 'Major Laterally Supported': - if self.web_philosophy == 'Thick Web without ITS': - if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): - self.Mdv = self.calc_Mdv(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.web_buckling_check(self) - print("fafafamfm a",self.Mdv) - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) - if interp_val != None: - self.fcd = round(interp_val, 2) - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - else: - logger.error("Change materrial grade. Minimum Grade is E 250") - + if section_class == KEY_Plastic or section_class == KEY_Compact: + self.beta_b_lt = 1.0 + else: + self.beta_b_lt = (self.elast_sec_mod_z/ self.plast_sec_mod_z) + print("Beta value",self.beta_b_lt) - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #buckling method - c = 0 - if design_dictionary[KEY_IntermediateStiffener_spacing] != 'NA': - c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): - print("Check passed") - else: - print("Check Failed") - else: - pass + + #-----add a check function to call everything. + #checks thick web thickness + def min_web_thickness_thick_web(self, d, tw, eps, stiffner_type,c): + if IS800_2007.cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffner_type, c): + return True + else: + return False - - - else: - logger.error("Web thickness is not sufficient\n Re-enter new thickness") - else: - # print("To include thin web condition") - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': - pass - else: - - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if design_dictionary[KEY_IntermediateStiffener_spacing] == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) - if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): - print("Check passed") - else: - print("Check Failed") - - else: #unsupported - if self.web_philosophy == 'Thick Web without ITS': - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) - if interp_val != None: - self.fcd = round(interp_val, 2) - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - else: - logger.error("Change materrial grade. Minimum Grade is E 250") - else: #thin web - pass - G = 0.769 * 10**5 - Kw = self.get_K_from_warping_restraint(self,self.warping) - Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, It, Iw, self.effective_length, Kw, self.total_depth, - self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, - self.loading_case, self.warping) - print("Input moment",self.load.moment) - print("MCR VAL",self.M_cr) - if self.M_cr < self.load.moment: - print("Passed Moment check") - else: - logger.error("Moment check failed! Need to increase flange size") + #check 2 moment capacity for major laterally supported & thick web and thin web + def moment_capacity_laterally_supported(self, V,Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot, section_class) : + A_vg = (D - tf_top - tf_bot) * tw + self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) + if V > 0.6 * self.V_d: #high shear(Mdv calculation for high shear. Naming kept Md for compatibility) + self.Md = self.calc_Mdv(self, V, self.V_d, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot) else: #low shear - if self.support_type == 'Major Laterally Supported': - if self.web_philosophy == 'Thick Web without ITS': - if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): - self.Md =self.plast_sec_mod_z * self.material.fy / self.gamma_m0 - print("sefafafaf c",self.Md) - self.web_buckling_check(self) - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) - if interp_val != None: - self.fcd = round(interp_val, 2) - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - else: - logger.error("Change materrial grade. Minimum Grade is E 250") - - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #bukling method - c = 0 - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if design_dictionary[KEY_IntermediateStiffener_spacing] != 'NA': - c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): - print("Check passed") - else: - print("Check Failed") - else: - pass - else: - logger.error("Web thickness is not sufficient\n Re-enter new thickness") - - else: #thin web condition - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': - pass - else: - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if design_dictionary[KEY_IntermediateStiffener_spacing] == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - c = float(design_dictionary[KEY_IntermediateStiffener_spacing]) - if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): - print("Check passed") - else: - print("Check Failed") - - else: #unsupported - if self.web_philosophy == 'Thick Web without ITS': - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) - if interp_val != None: - self.fcd = round(interp_val, 2) - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - else: - logger.error("Change materrial grade. Minimum Grade is E 250") - else: #thin web - pass - - G = 0.769 * 10**5 - Kw = self.get_K_from_warping_restraint(self,self.warping) - Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, It, Iw, self.effective_length, Kw, self.total_depth, - self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, - self.loading_case, self.warping) - print("Input moment",self.load.moment) - print("MCR VAL",self.M_cr) - if self.M_cr > self.load.moment: - print("Passed Moment check") - - else: - logger.error("Moment check failed! Need to increase flange size") - - - - - def effective_length_beam(self, design_dictionary, length): - if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': - self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported(Torsional=self.torsional_res,Warping=self.warping, - length=length,depth=(self.total_depth/1000),load=self.loading_condition) - print(f"Working 1 {self.effective_length}") + self.Md = IS800_2007.cl_8_2_1_2_design_bending_strength(section_class, Zp, Ze, Fy, gamma_m0, self.support_condition) + self.moment_ratio = self.load.moment/ self.Md + if self.Md >= self.load.moment: + return True else: - try: - if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: - design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' - else: - length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) - - self.effective_length = length - print(f"Working 2 {self.effective_length}") - except: - print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) - logger.warning("Invalid Effective Length Parameter.") - logger.info('Effective Length Parameter is set to default: 1.0') - design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' - self.effective_length_beam(self, design_dictionary, length) - print(f"Working 3 {self.effective_length}") - print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) - - + return False - def web_buckling_check(self): - self.web_buckling = IS800_2007.cl_8_2_1_web_buckling( - d=self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness), - tw=self.web_thickness, - e=self.epsilon,) - print("fafafajnafjkfmaf",self.web_buckling) - - # if not self.web_buckling_check: - # self.web_not_buckling_steps(self) - def shear_buckling_check_simple_postcritical(self,eff_depth,A_vg,V,c=0): - if self.web_philosophy == 'Thick Web without ITS': - K_v = 5.35 - else: - if c/eff_depth < 1: - K_v = 4 + 5.35/(c/eff_depth)**2 - else: - K_v = 5.35 + 4/(c/eff_depth)**2 - E = self.material.modulus_of_elasticity - mu = 0.3 - tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) - lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) - tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) - V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) - print("V_cr value",V_cr) - if V_cr > V: + #check 3 shear capacity for major laterally supported & thick web + def shear_capacity_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top, tf_bot): + A_vg = (D - tf_top - tf_bot) * tw + self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) + self.shear_ratio = max(self.load.shear_force / self.V_d,self.shear_ratio) + if self.V_d >= self.load.shear_force: return True else: return False - - def shear_buckling_check_tension_field(self,eff_depth,A_vg,c=0,Nf = 0): - if self.web_philosophy == 'Thick Web without ITS': - K_v = 5.35 + + + #check 4 Web buckling for major laterally supported and unsupported & thick web + def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top, tf_bot,E, b1): + self.eff_depth = D - (tf_bot + tf_top) + n1 = self.eff_depth / 2 + Ac = (b1 + n1) * tw + slenderness_input = 2.5 * self.eff_depth / tw + self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder(Fy, gamma_m0, slenderness_input, E) + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + self.shear_ratio = max(self.load.shear_force / Critical_buckling_load , self.shear_ratio) + if Critical_buckling_load>= self.load.shear_force: + return True else: - if c/eff_depth < 1: - K_v = 4 + 5.35/(c/eff_depth)**2 - else: - K_v = 5.35 + 4/(c/eff_depth)**2 - E = self.material.modulus_of_elasticity - mu = 0.3 - tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) - lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) - tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) - phi,M_fr,s, w_tf,sai,fv,V_tf = IS800_2007.cl_8_4_2_2_TensionField( c, eff_depth, self.web_thickness, self.material.fy, self.top_flange_width,self.top_flange_thickness, self.material.fy,Nf, self.gamma_m0, A_vg,tau_b,self.load.shear_force) - print("vtf val",V_tf) - if V_tf >= self.load.shear_force: + return False + + #check 5 Web crippling for major laterally supported and unsupported & thick web + def web_crippling_laterally_supported_thick_web(self, Fy, gamma_m0, tw, tf_top, b1): + n2 = 2.5 * tf_top + Critical_crippling_load = round((b1 + n2) * tw * Fy / (gamma_m0 * 1000), 2) + self.shear_ratio = max(self.load.shear_force / Critical_crippling_load , self.shear_ratio) + if Critical_crippling_load >= self.load.shear_force: return True else: return False - def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only for major laterally supp + + #check 6 moment capacity for major laterally unsupported & thick web + + def get_K_from_warping_restraint(self,warping_condition): + """ + Return effective length factor K based on exact warping restraint description (IS 800:2007, Clause E.1). + """ + if warping_condition == "Both flanges fully restrained": + return 0.5 + elif warping_condition == "Compression flange fully restrained": + return 0.7 + elif warping_condition == "Compression flange partially restrained": + return 0.85 + elif warping_condition == "Warping not restrained in both flanges": + return 1.0 + else: + raise ValueError("Invalid warping restraint. Use one of the four standard conditions.") + def bending_check_lat_unsupported(self, beta_b_lt, plast_sec_mod_z, elast_sec_mod_z, fy, M_cr, section_class): + self.lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment(beta_b_lt, plast_sec_mod_z, elast_sec_mod_z, fy, + M_cr) + + self.phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt(self.alpha_lt, self.lambda_lt) + self.X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor(self.phi_lt, self.lambda_lt) + self.fbd_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress(self.X_lt, fy, self.gamma_m0) + self.Md = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength(plast_sec_mod_z, elast_sec_mod_z, self.fbd_lt, + section_class) + + return round(self.Md, 2) + + def calc_Mdv_lat_unsupported(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot, + Md): # only for major laterally supp """ Calculate Mdv for high shear conditions. - + Parameters: V : Factored applied shear force Vd : Design shear strength governed by web yielding/buckling @@ -1364,7 +1654,7 @@ def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only fo tw : Thickness of the web tf_top : Thickness of the top flange tf_bot : Thickness of the bottom flange - + Returns: Mdv : Design bending strength under high shear condition """ @@ -1375,12 +1665,52 @@ def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only fo # Calculating Aw and Zfd d = D - (tf_top + tf_bot) Aw = d * tw - Zfd = Zp - (Aw * D / 4) / 1000 # convert mm^3 to cm^3 if necessary - + Zfd = Zp - (Aw * D / 4) + print("Aw", Aw, "Zfd", Zfd) # Calculating Mfd - Mfd = beta * Zfd * Fy / gamma_m0 + Mfd = Zfd * Fy / gamma_m0 - # Calculating Md (Plastic Design Moment) + # Calculating Mdv + Mdv = Md - beta * (Md - Mfd) + + # Limiting value as per the provided formula + Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 + print("Mfd", Mfd, "Mdv", Mdv, "Mdv_limit", Mdv_limit) + return round(min(Mdv, Mdv_limit), 2) + + def calc_Mdv(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): # only for major laterally supp + """ + Calculate Mdv for high shear conditions. + + Parameters: + V : Factored applied shear force + Vd : Design shear strength governed by web yielding/buckling + Zp : Plastic section modulus of the section (Z-axis) + Ze : Elastic section modulus of the section (Z-axis) + Fy : Yield strength of material + gamma_m0 : Partial safety factor for material + D : Total depth of section + tw : Thickness of the web + tf_top : Thickness of the top flange + tf_bot : Thickness of the bottom flange + + Returns: + Mdv : Design bending strength under high shear condition + """ + + # Calculating beta + beta = (2 * V / Vd - 1) ** 2 + + # Calculating Aw and Zfd + d = D - (tf_top + tf_bot) + Aw = d * tw + Zfd = Zp - (Aw * D / 4) + print("Aw", Aw, "Zfd", Zfd) + + # Calculating Mfd + Mfd = Zfd * Fy / gamma_m0 + + # Calculating Md (Plastic Design Moment) Md = Zp * Fy / gamma_m0 # Calculating Mdv @@ -1388,24 +1718,10 @@ def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only fo # Limiting value as per the provided formula Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 + print("Mfd", Mfd / 1000000, "Mdv", Mdv / 1000000, "Mdv_limit", Mdv_limit / 1000000) return round(min(Mdv, Mdv_limit), 2) - def get_K_from_warping_restraint(self,warping_condition): - """ - Return effective length factor K based on exact warping restraint description (IS 800:2007, Clause E.1). - """ - if warping_condition == "Both flanges fully restrained": - return 0.5 - elif warping_condition == "Compression flange fully restrained": - return 0.7 - elif warping_condition == "Compression flange partially restrained": - return 0.85 - elif warping_condition == "Warping not restrained in both flanges": - return 1.0 - else: - raise ValueError("Invalid warping restraint. Use one of the four standard conditions.") - def calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D): """ Calculate yj per IS 800:2007 Clause E.3.2.2. Returns 0 for symmetric sections. @@ -1418,17 +1734,29 @@ def calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D): beta_f = Ifc / (Ifc + Ift) alpha = 0.8 if beta_f > 0.5 else 1.0 return alpha * (2 * beta_f - 1) * h / 2 + + def moment_capacity_laterally_unsupported(self,E, LLT, D, + tf_top, tf_bot, Bf_top, Bf_bot,tw, + LoadingCase,gamma_m0, Fy,shear_force): + if Bf_top == Bf_bot and tf_top == tf_bot: + return 0.0 # symmetric section + h = D - (tf_top + tf_bot) + Ift = (Bf_top * tf_top ** 3) / 12 + Ifc = (Bf_bot * tf_bot ** 3) / 12 + beta_f = Ifc / (Ifc + Ift) + alpha = 0.8 if beta_f > 0.5 else 1.0 + alpha * (2 * beta_f - 1) * h / 2 - def calc_Mcr_LoadingCase(self,E, G, Iy, It, Iw, LLT, Kw, D, - tf_top, tf_bot, Bf_top, Bf_bot, - LoadingCase, warping_condition): - """ - Calculate Elastic Critical Moment Mcr based on IS 800:2007 (Annex E or Eq 2.20 for symmetric). - Returns: - Mcr : Elastic Critical Moment in N·mm - """ + + G = 0.769 * 10**5 + Kw = self.get_K_from_warping_restraint(self,self.warping) + Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + + #Mcr calc yg = D / 2 - yj = self.calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D) + yj = self.calc_yj(self, Bf_top, tf_top, Bf_bot, tf_bot, D) K_value = 0 # Constants from Table 42 (IS 800:2007) if LoadingCase == KEY_DISP_UDL_PIN_PIN_PG: @@ -1450,2265 +1778,1152 @@ def calc_Mcr_LoadingCase(self,E, G, Iy, It, Iw, LLT, Kw, D, if Bf_top == Bf_bot and tf_top == tf_bot: term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) term2 = (Iw / Iy) - term3 = (G * It * LLT**2) / (math.pi**2 * E * Iy) - Mcr = term1 * math.sqrt(term2 + term3) + term3 = (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + self.M_cr = term1 * math.sqrt(term2 + term3) else: # Unsymmetric case (Annex E full formula) term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) bracket = ((K_value / Kw) ** 2 * (Iw / Iy) + (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + (c2 * yg - c3 * yj) ** 2) - Mcr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) + self.M_cr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) + + print("Input moment",self.load.moment) + print("MCR VAL",self.M_cr) + A_vg = (D - tf_top - tf_bot) * tw + self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) + if shear_force > 0.6 * self.V_d: # high shear(Mdv calculation for high shear. Naming kept Md for compatibility) + self.Md = self.calc_Mdv_lat_unsupported(self, self.load.shear_force, self.V_d, self.plast_sec_mod_z, + self.elast_sec_mod_z, self.material.fy, self.gamma_m0, + self.total_depth, self.web_thickness, self.top_flange_thickness, + self.bottom_flange_thickness, self.Md) + else: # low shear + self.Md = self.bending_check_lat_unsupported(self, self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, + self.material.fy, self.M_cr, self.section_class) + + + self.moment_ratio = self.load.moment/ self.Md + print("Ratio for moment", self.moment_ratio) + # # print("supp mdv",self.Mdv) + if self.Md >= self.load.moment: + return True + else: + return False - return Mcr # in N·mm - - def interpolate_value(self,slenderness_input, yield_stress_input,df): - # Extract the available slenderness ratios and yield stresses - slenderness_ratios = df.index.to_numpy() - yield_stresses = df.columns.to_numpy() + #effective length calculation + def effective_length_beam(self, design_dictionary, length): + if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': + self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported(Torsional=self.torsional_res,Warping=self.warping, + length=length,depth=(self.total_depth/1000),load=self.loading_condition) + print(f"Working 1 {self.effective_length}") + else: + try: + if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: + design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' + else: + length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) - # Interpolate along the slenderness ratio for two nearest yield stress values - - yield_stress_lower_list = [ys for ys in yield_stresses if ys <= yield_stress_input] - yield_stress_upper_list = [ys for ys in yield_stresses if ys >= yield_stress_input] - if len(yield_stress_lower_list) == 0 or len(yield_stress_upper_list) == 0: - return None - - yield_stress_lower = max(yield_stress_lower_list) - yield_stress_upper = min(yield_stress_upper_list) + self.effective_length = length + print(f"Working 2 {self.effective_length}") + except: + print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) + logger.warning("Invalid Effective Length Parameter.") + logger.info('Effective Length Parameter is set to default: 1.0') + design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' + self.effective_length_beam(self, design_dictionary, length) + print(f"Working 3 {self.effective_length}") + print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) + + + def end_panel_stiffener_calc(self, + Bf_top, Bf_bot, tw, tq, fy, gamma_m0, effective_depth, + tf_top, total_depth, effective_length, tf_bot, E, eps +): + """ + Calculate end panel stiffener properties. + + Parameters: + Bf_top (float): Width of flange at top (mm) + Bf_bot (float): Width of flange at bottom (mm) + tw (float): Thickness of web (mm) + tq (float): Thickness of stiffener (mm) + fy (float): Yield strength of material (MPa) + gamma_m0 (float): Partial safety factor + + + effective_depth (float): Effective depth (mm) + tf_top (float): Top flange thickness (mm) + total_depth (float): Total depth of section (mm) + effective_length (float): Effective length for slenderness (mm) + D (float): Depth of section (mm) + E (float): modulus of elasticity of steel (MPa) + + Returns: + dict: Dictionary of results including buckling resistance, bearing capacity, and torsion check. + """ + + # Geometrical properties + net_outstand = min(Bf_top, Bf_bot) - tq + width_stiffener = min(max(net_outstand, 14 * tq * eps), 20 * tq * eps) + + # Core area and moment of inertia for buckling resistance + A_core = (14 * tq * epsilon * 2) + (20 * tw * tw) + Ixx = ((tq * (14 * tq * epsilon * 2) ** 3) / 12) + ((20 * tw * tw ** 3) / 12) + r = math.sqrt(Ixx / A_core) + # Slenderness ratio + slenderness_input = 0.7 * effective_depth / r + self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + fy, + gamma_m0, + slenderness_input, + E ) + buckling_resistance = self.fcd * A_core + + # Bearing capacity + chamfered_width = 15 # mm + Aq = 2 * (width_stiffener - chamfered_width) * tq + bearing_capacity = (Aq * fy) / (0.8 * gamma_m0) + + # Torsional restraint + ry = Unsymmetrical_I_Section_Properties.calc_RadiusOfGyrationY(self, total_depth, Bf_top, Bf_bot, tw, tf_top, tf_bot) + slender_torsion = effective_length / ry + + if slender_torsion <= 50: + alpha_s = 0.006 + elif slender_torsion <= 100: + alpha_s = 0.3 / slender_torsion + else: + alpha_s = 30 / (slender_torsion ** 2) + + torsion_check = 0.34 * alpha_s * (total_depth ** 3) * tf_top + Is = (tq * (2 * width_stiffener) ** 3) / 12 + torsion_ok = Is >= torsion_check + + return { + "Buckling Resistance (N)": buckling_resistance, + "Bearing Capacity (N)": bearing_capacity, + "Slenderness Ratio": slenderness_input, + "Design Compressive Strength fcd (MPa)": self.fcd, + "Moment of Inertia Is (mm^4)": Is, + "Torsion Check (mm^4)": torsion_check, + "Torsion OK": torsion_ok + } + + def deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case): + """ + Compute max mid-span deflection from bending moment, + converting M (kN·m) → N·m and L (mm) → m internally. + + Parameters + ---------- + M_kNm : float + Max bending moment in kN·m. + L_mm : float + Span length in mm. + E : float + Young’s modulus in Pa (N/m²). + I : float + Second moment of area in m^4. + case : str + One of 'simple_udl', 'fixed_udl', 'simple_point', 'fixed_point'. + + Returns + ------- + delta : float + Mid-span deflection in meters. + """ + # unit conversions + M = M_kNm * 1e3 # kN·m → N·m + + pref = M * L ** 2 / (E * I) + if case == KEY_DISP_UDL_PIN_PIN_PG: + return (5 / 48) * pref + elif case == KEY_DISP_UDL_FIX_FIX_PG: + return (1 / 32) * pref + elif case == KEY_DISP_PL_PIN_PIN_PG: + return (1 / 12) * pref + elif case == KEY_DISP_PL_FIX_FIX_PG: + return (1 / 24) * pref + else: + raise ValueError( + "Unknown case. Use 'simple_udl', 'fixed_udl', 'simple_point', or 'fixed_point'." + ) + def evaluate_deflection_kNm_mm(self, + M_kNm, L, E, case, criteria_list=VALUES_MAX_DEFL +): + """ + 1) Calculate deflection from moment (with unit conversions). + 2) Compare against span-based limits. + Returns (delta_m, results_dict, best_criterion). + """ + # 1) compute deflection in meters + I = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaZ(self,self.total_depth,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness) + delta = self.deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case) + + # 2) compare against each 'Span/N' limit + results = {} + passed = [] + for crit in criteria_list: + try: + _, denom = crit.split('/') + n = float(denom) + except ValueError: + continue + allowable = L / n + ok = (delta <= allowable) + self.deflection_ratio = max(delta / allowable, self.deflection_ratio) + + if ok: + return True + else: + return False + # results[crit] = { + # 'allowable_m': allowable, + # 'actual_m': delta, + # 'passes': ok + # } + # if ok: + # passed.append((n, crit)) + + # # pick most stringent (smallest denom) that still passes + # best = min(passed)[1] if passed else None + + # return delta, results + + def shear_stress_unsym_I(self, V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w): + + # Part areas [mm^2] + A_t = b_ft * t_ft + A_b = b_fb * t_fb + A_w = t_w * h_w + + # Section total depth & area + D = t_fb + h_w + t_ft + A = A_t + A_b + A_w + + # Centroid y‐coords from bottom of bottom flange [mm] + y_b = t_fb / 2 + y_w = t_fb + h_w / 2 + y_t = t_fb + h_w + t_ft / 2 + + # Neutral axis from bottom [mm] + y_na = (A_b * y_b + A_w * y_w + A_t * y_t) / A + + # Second moment I_z [mm^4] + I_b = b_fb * t_fb ** 3 / 12 + A_b * (y_b - y_na) ** 2 + I_w = t_w * h_w ** 3 / 12 + A_w * (y_w - y_na) ** 2 + I_t = b_ft * t_ft ** 3 / 12 + A_t * (y_t - y_na) ** 2 + I_z = I_b + I_w + I_t + + # First moments Q [mm^3] + Q_bot = A_b * abs(y_na - y_b) + Q_top = A_t * abs(y_t - y_na) + + # Shear flows q = V*Q / I [kN·mm^3 / mm^4 = kN/mm] + q_bot = V_ed * Q_bot / I_z + q_top = V_ed * Q_top / I_z + + return { + 'y_na_mm': y_na, 'I_z_mm4': I_z, + 'Q_top_mm3': Q_top, 'Q_bot_mm3': Q_bot, + 'q_top_kN_per_mm': q_top, + 'q_bot_kN_per_mm': q_bot, + } - - interp_lower = np.interp(slenderness_input, slenderness_ratios, df[yield_stress_lower].to_numpy()) - interp_upper = np.interp(slenderness_input, slenderness_ratios, df[yield_stress_upper].to_numpy()) + def weld_leg_from_q_with_cl10(self, + q_kN_per_mm, # shear flow [kN/mm] + ultimate_stresses, # list of MPa + fabrication='shop' + ): + """ + Compute fillet‐weld leg a [mm] from shear flow, + using f_wd from cl.10.5.7.1.1. + """ + # 1) get f_wd in MPa → convert to N/mm² + f_wd = IS800_2007.cl_10_5_7_1_1_fillet_weld_design_stress( + ultimate_stresses, fabrication + ) # MPa + + # 2) convert q to N/mm + q_N_per_mm = q_kN_per_mm * 1e3 + + # 3) throat thickness t = q / f_wd [mm] + t_throat = q_N_per_mm / f_wd + + # 4) leg size a = t·√2 + return t_throat * math.sqrt(2) + + + def design_welds_with_strength_web_to_flange(self, + # section loads & geometry + V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w, + # material / weld properties + ultimate_stresses, fabrication, + # stiffener inputs + t_st, b_st, V_unstf, L_weld + ): + # compute shear flows + sf = self.shear_stress_unsym_I(self, V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w) + + # weld legs using cl.10 strength + a_top = self.weld_leg_from_q_with_cl10(self, + sf['q_top'], ultimate_stresses, fabrication + ) + a_bot = self.weld_leg_from_q_with_cl10(self, + sf['q_bot'], ultimate_stresses, fabrication + ) + + # end‐stiffener check (unchanged) + + return { + **sf, + 'a_top_mm': a_top, + 'a_bot_mm': a_bot + } + + def weld_for_end_stiffener(self, t_st, b_st, V_ed, V_unstf, D, t_ft, t_fb, tw): + """ + t_st : thickness of stiffener + b_st : width of stiffener + V_ed : design shear force + V_unstf : unstiffened shear force + D : depth of section + t_ft : thickness of top flange + t_fb : thickness of bottom flange + tw : thickness of web + Automatically computes L_weld = D - t_ft - t_fb, + then returns: + q1_min = t_st^2/(5·b_st) + q2_ext = (V_ed–V_unstf)/L_weld + q_total = q1 + q2 + q_each_weld = q_total/2 + All in kN/mm. + """ + # 0) available weld length + L_weld = D - t_ft - t_fb - # Interpolate between the lower and upper yield stress for the final value - final_value = np.interp(yield_stress_input, [yield_stress_lower, yield_stress_upper], [interp_lower, interp_upper]) - - + # 1) min weld per side + q1 = tw ** 2 / (5 * b_st) - return final_value + # 2) stiffener shear per unit length + delta_V = max(V_ed - V_unstf, 0) + q2 = delta_V / L_weld - #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - def section_classification1(self, design_dictionary,trial_section=""): - """Classify the sections based on Table 2 of IS 800:2007""" - print(f"Inside section_classification") - local_flag = True - self.input_modified = [] - self.input_section_list = [] - self.input_section_classification = {} - lambda_check = False - for trial_section in self.sec_list: - trial_section = trial_section.strip("'") - self.section_property = self.section_connect_database(self, trial_section) - print(f"Type of section{self.section_property.designation}") - if self.section_property.type == "Rolled": - web_class = IS800_2007.Table2_iii( - self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius), - self.section_property.web_thickness, - self.material_property.fy, - ) - flange_class_bottom = IS800_2007.Table2_i( - self.section_property.flange_width / 2, - self.section_property.flange_thickness, - self.material_property.fy,self.section_property.type - )[0] - web_ratio = (self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius)) / self.section_property.web_thickness - flange_ratio = self.section_property.flange_width / 2 /self.section_property.flange_thickness - else: - flange_class_bottom = IS800_2007.Table2_i( - ( - (self.section_property.flange_width / 2) - # - (self.section_property.web_thickness / 2) - ), - self.section_property.flange_thickness, - self.section_property.fy, - self.section_property.type, - )[0] - - web_class = IS800_2007.Table2_iii( - ( - self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius) - ), - self.section_property.web_thickness, - self.material_property.fy, # classification_type="Axial compression", - ) - web_ratio = (self.section_property.depth - 2 * ( - self.section_property.flange_thickness + self.section_property.root_radius)) / self.section_property.web_thickness - flange_ratio = self.section_property.flange_width / 2 / self.section_property.flange_thickness - print(f"\n \n \n flange_class_bottom {flange_class_bottom} \n web_class{web_class} \n \n") - if flange_class_bottom == "Slender" or web_class == "Slender": - self.section_class = "Slender" - else: - if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic: - self.section_class = KEY_Plastic - elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact: - self.section_class = KEY_SemiCompact + # 3) total on one side + q_tot = q1 + q2 - self.Zp_req = self.load.moment * self.gamma_m0 / self.material_property.fy - self.effective_length_beam(self, design_dictionary, self.length) # mm - - print( 'self.allow_class', self.allow_class) - if self.section_property.plast_sec_mod_z >= self.Zp_req: - print( 'self.section_property.plast_sec_mod_z More than Requires') - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.It = self.section_property.It - # ( - # 2 - # * self.section_property.flange_width - # * self.section_property.flange_thickness ** 3 - # ) / 3 + ( - # (self.section_property.depth - self.section_property.flange_thickness) - # * self.section_property.web_thickness ** 3 - # ) / 3 - self.hf = self.section_property.depth - self.section_property.flange_thickness - self.Iw = self.section_property.Iw - # 0.5 ** 2 * self.section_property.mom_inertia_y * self.hf ** 2 - - - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - self.beta_b_lt = 1.0 - else: - self.beta_b_lt = ( - self.section_property.elast_sec_mod_z - / self.section_property.plast_sec_mod_z - ) - _ = IS800_2007.cl_8_2_2_Unsupported_beam_bending_non_slenderness( - self.material_property.modulus_of_elasticity, - 0.3, - self.section_property.mom_inertia_y, - self.It, - self.Iw, - self.effective_length * 1e3, self.beta_b_lt, self.section_property.plast_sec_mod_z, self.hf, self.section_property.rad_of_gy_y, self.section_property.flange_thickness - ) - self.M_cr = _[0] - self.fcrb = _[1] - lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment( - self.beta_b_lt, - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - self.material_property.fy, - self.M_cr - ) - if lambda_lt < 0.4: - lambda_check = True - continue - if self.allow_class != 'No': - if ( - self.section_class == KEY_SemiCompact - or self.section_class == KEY_Compact - or self.section_class == KEY_Plastic - ): - - self.input_section_list.append(trial_section) - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio,self.It,self.hf,self.Iw,self.M_cr,self.beta_b_lt,lambda_lt,self.fcrb]}) - else: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio]}) + # 4) split into two welds (each face) + q_each = q_tot / 2 - elif self.section_class == "Slender": - logger.warning(f"The section.{trial_section} is Slender. Ignoring") - else: - if self.section_class == KEY_Compact or self.section_class == KEY_Plastic: - self.input_section_list.append(trial_section) - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio,self.It,self.hf,self.Iw,self.M_cr,self.beta_b_lt,lambda_lt, self.fcrb]}) - else: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio]}) - elif self.section_class == "Slender": - logger.warning(f"The section.{trial_section} is Slender. Ignoring") - # self.design_status = False - # self.design_status_list.append(self.design_status) - elif self.section_class == KEY_SemiCompact: - logger.warning( - f"The section.{trial_section} is Semi-Compact. Ignoring" - ) - # self.design_status = False - # self.design_status_list.append(self.design_status) - if lambda_check: - logger.info("After checking Non-dimensional slenderness ratio for given sections, some sections maybe be ignored by Osdag.[Ref IS 8.2.2] ") - if len(self.input_section_list) == 0: - local_flag = False - else: - local_flag = True - return local_flag + return { + 'L_weld_mm': L_weld, + 'q1_min': q1, + 'q2_ext': q2, + 'q_total': q_tot, + 'q_each_weld': q_each + } - def design(self, design_dictionary, flag=0): - ''' - TODO optimimation_tab_check changes to include self.material_property = Material(material_grade=self.material, thickness=0) - for each section - ''' - - self.optimization_tab_check(self) - - self.design_beam(self, design_dictionary) - - def optimization_tab_check(self): - ''' - TODO add button to give user option to take Tension holes or not - ''' - print(f"\n Inside optimization_tab_check") - self.latex_tension_zone = False - if (self.effective_area_factor <= 0.10) or (self.effective_area_factor > 1.0): - logger.error( - "The defined value of Effective Area Factor in the design preferences tab is out of the suggested range." - ) - logger.info("Provide an appropriate input and re-design.") - logger.warning("Assuming a default value of 1.0.") - self.effective_area_factor = 1.0 - # self.design_status = False - # self.design_status_list.append(self.design_status) - self.optimization_tab_check(self) - elif (self.steel_cost_per_kg < 0.10) or (self.effective_area_factor > 1.0) or (self.effective_area_factor < 0): - # No suggested range in Description - logger.warning( - "The defined value of the effective area factor in the design preferences tab is out of the suggested range." - ) - # logger.info("Provide an appropriate input and re-design.") - logger.info("Assuming a default value of 1.0") - self.steel_cost_per_kg = 50 - self.effective_area_factor = 1 - self.design_status = False - # self.design_status_list.append(self.design_status) + + #-------------Thin Web (Simple post critical method)------------------------# + def shear_buckling_check_simple_postcritical(self, eff_depth,D,tf_top,tf_bot,tw, V, c=0): + A_vg = (D - tf_top - tf_bot) * tw + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 else: - if self.latex_tension_zone: - if self.effective_area_factor >= (self.material_property.fy * self.gamma_m0 / (self.material_property.fu * 0.9 * self.gamma_m1)): - pass - else: - self.latex_tension_zone = True - print(f'self.latex_tension_zone: {self.latex_tension_zone}') - # self.effective_area_factor = ( - # self.material_property.fy - # * self.gamma_m0 - # / (self.material_property.fu * 0.9 * self.gamma_m1) - # ) - # logger.info( - # f"The effect of holes in the tension flange is considered on the design bending strength. The ratio of net to gross area of the flange in tension is considered {self.effective_area_factor}" - # ) - - logger.info("Provided appropriate design preference, now checking input.") - - def input_modifier(self): - """Classify the sections based on Table 2 of IS 800:2007""" - print(f"Inside input_modifier") - local_flag = True - self.input_modified = [] - self.input_section_list = [] - # self.input_section_classification = {} - - for section in self.sec_list: - section = section.strip("'") - self.section_property = self.section_connect_database(self, section) - - self.Zp_req = self.load.moment * self.gamma_m0 / self.material_property.fy - print('Inside input_modifier not allow_class',self.allow_class,self.load.moment, self.gamma_m0, self.material_property.fy) - if self.section_property.plast_sec_mod_z >= self.Zp_req: - - self.input_modified.append(section) - # logger.info( - # f"Required self.Zp_req = {round(self.Zp_req * 10**-3,2)} x 10^3 mm^3 and Zp of section {self.section_property.designation} = {round(self.section_property.plast_sec_mod_z* 10**-3,2)} x 10^3 mm^3.Section satisfy Min self.Zp_req value") - # else: - # local_flag = False - - # logger.warning( - # f"Required self.Zp_req = {round(self.Zp_req* 10**-3,2)} x 10^3 mm^3 and Zp of section {self.section_property.designation} = {round(self.section_property.plast_sec_mod_z* 10**-3,2)} x 10^3 mm^3.Section dosen't satisfy Min self.Zp_req value") - # logger.info("") - print("self.input_modified", self.input_modified) - - def section_connect_database(self, section): - print(f"section_connect_database{section}") - print(section) - # print(self.sec_profile) - if ( - self.sec_profile == VALUES_SECTYPE[1] - or self.sec_profile == "I-section" - ): # I-section - self.section_property = ISection( - designation=section, material_grade=self.material - ) - self.material_property.connect_to_database_to_get_fy_fu( - self.material, max(self.section_property.flange_thickness, self.section_property.web_thickness) - ) - print(f"section_connect_database material_property.fy{self.material_property.fy}") - self.epsilon = math.sqrt(250 / self.material_property.fy) - return self.section_property - - def design_beam(self, design_dictionary): - # 1- Based on optimum UR - self.optimum_section_ur_results = {} - self.optimum_section_ur = [] - - # 2 - Based on optimum cost - self.optimum_section_cost_results = {} - self.optimum_section_cost = [] - - # 1 - section classification - self.flag = self.section_classification(self,design_dictionary) - - print('self.flag:',self.flag) - if self.effective_area_factor < 1.0: - logger.warning( - "Reducing the effective sectional area as per the definition in the Design Preferences tab." - ) + if c / eff_depth < 1: + K_v = 4 + 5.35 / (c / eff_depth) ** 2 + else: + K_v = 5.35 + 4 / (c / eff_depth) ** 2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E, mu, eff_depth, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + print("V_cr value", self.V_cr) + self.shear_ratio = max(self.load.shear_force / self.V_cr , self.shear_ratio) + if self.V_cr > V: + return True else: - logger.info( - "The effective sectional area is taken as 100% of the cross-sectional area [Reference: Cl. 7.3.2, IS 800:2007]." - ) - # Effective length - print( - f"self.effective_length {self.effective_length} \n self.input_section_classification{self.input_section_classification} ") - print('self.input_section_list:',self.input_section_list) - if self.flag: - for section in self.input_section_list: - # initialize lists for updating the results dictionary - self.section_property = self.section_connect_database(self, section) - if self.section_property.type == 'Rolled': - self.effective_depth = (self.section_property.depth - 2 * ( - self.section_property.flange_thickness + self.section_property.root_radius)) - else: - self.effective_depth = (self.section_property.depth - 2 *self.section_property.flange_thickness ) - print('self.section_property.type:',self.section_property.type, self.bending_type) - - if self.sec_profile == 'Beams' or self.sec_profile == 'Columns' or self.sec_profile == VALUES_SECTYPE[1]: - if self.section_property.type == "Rolled" and self.bending_type == KEY_DISP_BENDING1: - self.shear_area = self.section_property.depth * self.section_property.web_thickness - elif self.section_property.type != "Rolled" and self.bending_type == KEY_DISP_BENDING1: - self.shear_area = self.effective_depth * self.section_property.web_thickness - elif self.bending_type == KEY_DISP_BENDING2: - self.shear_area = 2 * self.section_property.flange_width * self.section_property.flange_thickness - - self.effective_length_beam(self, design_dictionary, self.length) # mm - - # Step 1.1 - computing the effective sectional area - self.effective_area = self.section_property.area - self.common_checks_1(self, section, step=2) - - - list_result = [] - list_1 = [] - list_result.append(section) - self.section_class = self.input_section_classification[section][0] - print(f"Inside design_beam self.design_type:{self.design_type}") - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.It = self.input_section_classification[section][ 5 ] - self.hf = self.input_section_classification[section][ 6 ] - self.Iw = self.input_section_classification[section][ 7 ] - self.M_cr = self.input_section_classification[section][ 8 ] - self.beta_b_lt = self.input_section_classification[section][ 9 ] - self.lambda_lt = self.input_section_classification[section][ 10 ] - self.fcrb = self.input_section_classification[section][ 11 ] - print('self.design_type:',self.design_type, self.It, - self.hf, - self.Iw, - self.M_cr, - self.beta_b_lt, - self.lambda_lt) - - self.beam_web_buckling(self) - if self.web_buckling_check: - self.web_not_buckling_steps(self) - - # self.shear_strength = IS800_2007.cl_8_4_design_shear_strength( - # self.shear_area, - # self.material_property.fy - # ) / 10 ** 3 - # self.high_shear_check = IS800_2007.cl_8_2_1_2_high_shear_check( - # self.load.shear_force / 1000, self.shear_strength - # ) - # self.bending_strength_section = self.bending_strength() / 10 ** 6 - - # self.web_buckling_steps(self) - # self.high_shear_check = False - # self.bending_strength_section = self.bending_strength_girder(self) / 10 ** 6 - - # print(f"Common result {list_result, self.section_class, self.V_d, self.high_shear_check, self.bending_strength_section}") - print('self.bending_strength_section',self.bending_strength_section,'self.shear_strength',self.shear_strength, 'self.load.moment',self.load.moment,'self.load.shear_force',self.load.shear_force) - # 2.8 - UR - self.ur = max((self.load.moment / self.bending_strength_section * 10 ** -6),(self.load.shear_force / self.shear_strength * 10 ** -3))# ( + round(self.load.axial_force / self.section_capacity, 3) - print("UR", self.ur) - # 2.9 - Cost of the section in INR - self.cost = ( - ( - self.section_property.unit_mass - * self.section_property.area - * 1e-4 - ) - * self.length - * self.steel_cost_per_kg - ) - self.optimum_section_cost.append(self.cost) - self.web_buckling = False # When Bearing length is provided - - if self.bearing_length != 'NA': #and self.web_crippling - print(f"Check for Web Buckling") - try: - self.bearing_length = float(design_dictionary[KEY_BEARING_LENGTH]) - self.web_buckling = True # WEB BUCKLING - self.I_eff_web = self.bearing_length * self.section_property.web_thickness ** 3 / 12 - self.A_eff_web = self.bearing_length * self.section_property.web_thickness - self.r = math.sqrt(self.I_eff_web / self.A_eff_web) - self.slenderness = 0.7 * self.effective_depth / self.r - self.common_checks_1(self, section, step=3) - # step == 4 - self.common_checks_1( - self, section, step=4, list_result=["Concentric"] - ) - # 2.7 - Capacity of the section for web_buckling - self.section_capacity = ( - self.design_compressive_stress * ( - self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness - * 10 ** -3) # N - print(self.design_compressive_stress, self.bearing_length, self.section_property.depth, - self.section_property.web_thickness) - - print(self.bending_strength_section, self.shear_strength, self.section_capacity) - - self.F_wb = (self.bearing_length + 2.5 * ( - self.section_property.root_radius + self.section_property.flange_thickness)) * self.section_property.web_thickness * self.material_property.fy / ( - self.gamma_m0 * 10 ** 3) - if self.bending_strength_section > self.load.moment * 10 ** -6 and self.shear_strength > self.load.shear_force * 10 ** -3 and self.section_capacity > self.load.shear_force * 10 ** -3 and self.F_wb > self.load.shear_force * 10 ** -3: - list_result, list_1 = self.list_changer(self, change='Web Buckling', check=True, - list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - else: - list_result, list_1 = self.list_changer(self, change='Web Buckling', check=True, - list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - except: - logger.warning('Bearing length is invalid.') - logger.info('Ignoring web Buckling and Crippling check') - self.bearing_length = 'NA' - self.web_buckling = False - # 2.8 - UR - print(self.bending_strength_section, self.shear_strength) - if self.bending_strength_section > self.load.moment * 10 ** -6 and self.shear_strength > self.load.shear_force * 10 ** -3: - list_result, list_1 = self.list_changer(self, change='', check=True,list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - - - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - else: - list_result, list_1 = self.list_changer(self, change='', check=True,list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) + return False - else: - self.web_buckling = False - # 2.8 - UR - print(self.bending_strength_section, self.shear_strength) - if self.bending_strength_section > self.load.moment * 10**-6 and self.shear_strength > self.load.shear_force * 10**-3: - self.optimum_section_ur.append(self.ur) - list_result, list_1 = self.list_changer(self, change=' ', check=True, list=list_result, list_name=list_1) + def shear_buckling_check_intermediate_stiffener( + self, + d, + tw, + c, + e, + IntStiffThickness, + IntStiffenerWidth, + V_cr, + V_ed, + gamma_m0, + fy, + E +): + """ + Performs global and shear buckling checks for an intermediate stiffener. - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - else: - self.optimum_section_ur.append(self.ur) - list_result, list_1 = self.list_changer(self, change=' ', check=True, list=list_result, list_name=list_1) + Parameters: + d : float : depth of web panel (mm) + tw : float : thickness of web (mm) + c : float : stiffener spacing (mm) + e : float : outstand ratio factor + IntStiffThickness : float : thickness of intermediate stiffener (mm) + IntStiffenerWidth : float : width of intermediate stiffener leg (mm) + V_cr : float : critical shear buckling force (kN) + V_ed : float : design shear force on panel (kN) + gamma_m0 : float : partial safety factor for material + fy : float : yield strength of steel (MPa) + E : float : modulus of elasticity of steel (MPa) - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - print('self.optimum_section_ur', self.optimum_section_ur) + Returns: + bool : True if stiffener passes both global and shear buckling checks, False otherwise. + """ + # 1. Global buckling check of stiffener + cd_ratio = c / d + if cd_ratio >= math.sqrt(2): + I_min_global = 0.75 * d * tw**3 + else: + I_min_global = (1.5 * d * tw**3) / (c**2) - def beam_web_buckling(self): + # Moment of inertia of stiffener cross-section + I_s = (((2 * IntStiffenerWidth + tw)**3) * IntStiffThickness) / 12 + I_s -= (IntStiffThickness * tw**3) / 12 - print(f"Working web_buckling_check") - # 3 - web buckling under shear - self.web_buckling_check = IS800_2007.cl_8_2_1_web_buckling( - d=self.effective_depth, - tw=self.section_property.web_thickness, - e=self.epsilon, - ) - print(self.web_buckling_check, self.section_property.designation) - - if not self.web_buckling_check: - self.web_not_buckling_steps(self) - def web_buckling_steps(self): - print(f"Not using web_buckling_steps") - # logger.info(f"Considering {self.support_cndition_shear_buckling}") - # 5 - Web Buckling check(when high shear) -If user wants then only - # if web_buckling: - # b1 = input('Enter bearing') - # self.web_buckling_strength = self.section_property.web_thickness * (b1 + 1.25 * self.section_property.depth) - # self.V_d = pass - # web_buckling_message = 'Thin web' - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - self.K_v = IS800_2007.cl_8_4_2_2_K_v_Simple_postcritical('only support') - self.plate_girder_strength(self) - # logger.info('Section = {}, V_cr = {}'.format(self.section_property.designation, round(self.V_cr,2))) - self.shear_strength = self.V_cr / self.gamma_m0 - # if self.V_d > self.load.shear_force * 10**-3: - # - # return True - # else: - # return False - # self.V_d = IS800_2007.cl_8_4_2_2_ShearBuckling_Simple_postcritical((self.section_property.depth - 2 *(self.section_property.flange_thickness + self.section_property.root_radius), - # self.section_property.web_thickness,space,0.3, self.fyw)) - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - self.V_p = IS800_2007.cl_8_4_design_shear_strength( - self.shear_area, - self.material_property.fy - ) / 10 ** 3 * self.gamma_m0 - self.Mfr = IS800_2007.cl_8_4_2_2_Mfr_TensionField(self.section_property.flange_width, - self.section_property.flange_thickness, self.fyf, - self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness), - self.gamma_m0) - print('MFr', self.Mfr) - if self.Mfr > 0: - print('Starting loop', int(round(self.effective_length*10**4/self.effective_depth,-1)/10)) - # for c_d in range(3,self.effective_length/self.result_eff_d): - for c_d in reversed(list(range(3,int(round(self.effective_length * 1000/self.effective_depth,-1))))): - print('c_d',c_d,'c/d',self.effective_length * 1000/self.effective_depth) - c_d = c_d/10 + 0.1 - self.c = round(c_d * self.effective_depth, -1) - print('c',self.c) - self.K_v = IS800_2007.cl_8_4_2_2_K_v_Simple_postcritical('many support', self.c, self.effective_depth) - self.plate_girder_strength2(self) - - self.shear_strength = self.V_tf_girder / self.gamma_m0 * 10**-3 - logger.info('Intermediate Stiffeners required d ={}, c = {}, Section = {}, V_tf = {}, V_d = {}'.format(self.effective_depth,self.c, - self.section_property.designation, - self.V_tf_girder,self.shear_strength)) - if self.shear_strength > self.load.shear_force * 10**-3: - return - return - else: - self.shear_strength = 0.1 - def web_not_buckling_steps(self): - print(f"Working web_not_buckling_steps") - self.V_d = IS800_2007.cl_8_4_design_shear_strength( - self.shear_area, - self.material_property.fy - ) / 10 ** 3 - self.shear_strength = self.V_d - self.high_shear_check = IS800_2007.cl_8_2_1_2_high_shear_check( - self.load.shear_force / 1000, self.V_d - ) - print(f"self.V_d {self.V_d},{self.section_property.depth* self.section_property.web_thickness}, {self.material_property.fy}") - # 4 - design bending strength - self.bending_strength_section = self.bending_strength(self) / 10 ** 6 - - - - def bending_strength(self): - print('Inside bending_strength ','\n self.section_class', self.section_class) - # 4 - design bending strength - M_d = IS800_2007.cl_8_2_1_2_design_bending_strength( - self.section_class, - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - self.material_property.fy, - self.gamma_m0, - self.support, + # Maximum allowable outstand + max_outstand = 14 * IntStiffThickness * e + + # Fail global check if inertia or outstand insufficient + if I_s < I_min_global or max_outstand < IntStiffenerWidth: + return False + + # 2. Shear buckling (axial) check of stiffener + # Effective shear force on stiffener + F_q = (V_ed - V_cr) / gamma_m0 + + # Provided cross-sectional area + A_s = 2 * IntStiffenerWidth * IntStiffThickness + + # Combined area for axial buckling (stiffener + bearing area) + A_x = A_s + (20 * tw * 2) + + # Moment of inertia for axial buckling + I_x = (((2 * IntStiffenerWidth + tw)**3) * IntStiffThickness) / 12 + I_x += (20 * tw * 2 * tw**3) / 12 + I_x -= (IntStiffThickness * tw**3) / 12 + + # Radius of gyration + r_x = math.sqrt(I_x / A_x) + + # Slenderness ratio + Le = self.lefactor * d + slenderness_input = Le / r_x + + # Design compressive stress from IS 800 + fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + fy, gamma_m0, slenderness_input, E ) - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact : - self.beta_b_lt = 1 - else : - self.beta_b_lt = self.section_property.elast_sec_mod_z/self.section_property.plast_sec_mod_z - print('self.beta_b_lt: ',self.beta_b_lt) - self.M_d = M_d - if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: - if self.high_shear_check: - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self, M_d) - else: - bending_strength_section = ( - self.section_property.elast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ) + + # Critical buckling resistance (kN) + Pd = round(A_x * fcd / 1000, 2) + self.shear_ratio = max(self.load.shear_force / Pd , self.shear_ratio) + self.Critical_buckling_resistance = Pd + + # Debug prints + print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") + print("Critical buckling resistance Pd:", Pd, "kN") + + # Check axial capacity + return F_q < Pd + + def tension_field_end_stiffener(self, d, tw, fyw, V_tf, V_cr, shear_force, moment): + # Formula 1: H_q = 1.25·V_p·√[1 – (V_cr–V_p)/(V_tf–V_cr)] + V_dp = (d * tw * fyw * math.sqrt(3)) / 1000 + denom = V_tf - V_cr + rad = 1.0 - (V_cr - V_dp) / denom + if rad < 0: + raise ValueError(f"Negative radicand under sqrt: {rad:.3f}") + H_q = 1.25 * V_dp * math.sqrt(rad) + R_tf = H_q / 2 + A_v= d * tw + V_n= (fyw * A_v) /( 1000 * math.sqrt(3) * self.gamma_m0) + # Moment demand M_tf (kN·m) + M_tf = (H_q * d) / 10 + y = c / 2 + I = tw * c ** 3 / 12 + M_q = (I * fyw) / (self.gamma_m0 * y) + self.moment_ratio = max(M_tf / M_q , self.moment_ratio) + self.shear_ratio = max(self.load.shear_force / R_tf , self.shear_ratio) + if V_n >= R_tf: + if M_q >= M_tf: + return True + return False + + def shear_buckling_check_tension_field(self, eff_depth,D,tf_top,tf_bot,tw, c=0, Nf=0): + A_vg = (D - tf_top - tf_bot) * tw + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c / eff_depth < 1: + K_v = 4 + 5.35 / (c / eff_depth) ** 2 else: - bending_strength_section = M_d - print('Inside bending_strength 1', M_d, self.high_shear_check, bending_strength_section) + K_v = 5.35 + 4 / (c / eff_depth) ** 2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E, mu, eff_depth, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + phi, M_fr, s, w_tf, sai, fv, self.V_tf = IS800_2007.cl_8_4_2_2_TensionField(c, eff_depth, self.web_thickness, + self.material.fy, self.top_flange_width, + self.top_flange_thickness, + self.material.fy, Nf, self.gamma_m0, + A_vg, tau_b, self.load.shear_force) + print("vtf val",self.V_tf) + self.shear_ratio = max(self.load.shear_force / self.V_tf , self.shear_ratio) + if self.V_tf >= self.load.shear_force: + return True else: - print('self.design_type:',self.design_type, self.It, - self.hf, - self.Iw, - self.M_cr, - self.beta_b_lt, - self.lambda_lt, self.fcrb) - # self.It = ( - # 2 - # * self.section_property.flange_width - # * self.section_property.flange_thickness**3 - # ) / 3 + ( - # (self.section_property.depth - self.section_property.flange_thickness) - # * self.section_property.web_thickness**3 - # ) / 3 - # self.hf = self.section_property.depth - self.section_property.flange_thickness - # self.Iw = 0.5**2 * self.section_property.mom_inertia_y * self.hf**2 - # self.M_cr = IS800_2007.cl_8_2_2_Unsupported_beam_bending_non_slenderness( - # self.material_property.modulus_of_elasticity, - # 0.3, - # self.section_property.mom_inertia_y, - # self.It, - # self.Iw, - # self.effective_length * 1e3 - # ) - # - # if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - # self.beta_b_lt = 1.0 - # else: - # self.beta_b_lt = ( - # self.section_property.elast_sec_mod_z - # / self.section_property.plast_sec_mod_z - # ) - if self.section_property.type == "Rolled": - alpha_lt = 0.21 + return False + + + #PSO HELPER FUNCTIONS + + + # 1. Generate the “empirical” first particle + def generate_first_particle(self,L, M, fy,is_thick_web, is_symmetric,k=67): + D_empirical = L * 1000 / 25 # span in mm + d_opt = ((M * k) / fy) ** (1/3) # mm + D_final = max(D_empirical, d_opt) + + bf_top = 0.3 * D_final + bf_bot = 0.3 * D_final + bf = 0.3 * D_final + + + tf_top = bf / 24 + tf_bot = bf / 24 + tf = bf / 24 + + + d = D_final - 2 * tf + tw = d / 200 + c = 200 # min panel length (if used) + t_stiff = 6 # min stiffener thickness (if used) + # Order must match your variable list below + varlst = [] + if is_symmetric: + if is_thick_web: + varlst += [tf,tw,bf,D_final] else: - alpha_lt = 0.49 - # lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment( - # self.beta_b_lt, - # self.section_property.plast_sec_mod_z, - # self.section_property.elast_sec_mod_z, - # self.material_property.fy, - # self.M_cr - # ) - phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt( - alpha_lt, self.lambda_lt - ) - X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor( - phi_lt, self.lambda_lt - ) - fbd = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress( - X_lt, self.material_property.fy, self.gamma_m0 - ) - bending_strength_section = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength( - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - fcd=fbd, - section_class=self.section_class - ) - # self.beta_b_lt = beta_b - self.alpha_lt = alpha_lt - # self.lambda_lt = lambda_lt - self.phi_lt = phi_lt - self.X_lt = X_lt - self.fbd_lt = fbd - self.lateral_tb = self.M_cr * 10**-6 - print('Inside bending_strength 2.1', fbd, self.section_property.plast_sec_mod_z ) - if self.high_shear_check: - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self,Md=bending_strength_section - ) - else: - bending_strength_section = ( - self.beta_b_lt - * self.section_property.plast_sec_mod_z - * fbd - ) - print('Inside bending_strength 2',self.It,self.hf,self.Iw,self.M_cr ,self.beta_b_lt,alpha_lt,self.lambda_lt,phi_lt,X_lt,fbd,bending_strength_section) - self.bending_strength_section_reduced = bending_strength_section - return bending_strength_section - def bending_strength_girder(self): - print('Inside bending_strength of girder ') - web_class = IS800_2007.Table2_i( - (self.section_property.flange_width - self.section_property.web_thickness)/2, - self.section_property.flange_thickness, - self.material_property.fy, self.section_property.type - )[0] - flange_class_bottom = IS800_2007.Table2_i( - self.section_property.depth - 2 * self.section_property.flange_thickness, - self.section_property.web_thickness, - self.material_property.fy,self.section_property.type - )[0] - if flange_class_bottom == "Slender" or web_class == "Slender": - self.section_class_girder = "Slender" + varlst += [tf,tw,bf,D_final,c,t_stiff] else: - if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic: - self.section_class_girder = KEY_Plastic - elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact: - self.section_class_girder = KEY_Compact - elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic: - self.section_class_girder = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact: - self.section_class_girder = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact: - self.section_class_girder = KEY_SemiCompact - # 4 - design bending strength - I_flange = 2 * (self.section_property.flange_width * self.section_property.flange_thickness**3/12 + self.section_property.flange_width * self.section_property.flange_thickness * (self.section_property.depth/2 - self.section_property.flange_thickness/2)**2) - Zez_flange = I_flange / self.section_property.depth /2 - y_top = (self.section_property.flange_width * self.section_property.flange_thickness * (self.section_property.depth - self.section_property.flange_thickness)/2) / (self.section_property.flange_width * self.section_property.flange_thickness) - Zpz_flange = 2 * self.section_property.flange_width * self.section_property.flange_thickness * y_top - M_d = IS800_2007.cl_8_2_1_2_design_bending_strength( - self.section_class_girder, - Zpz_flange, - Zez_flange, - self.material_property.fy, - self.gamma_m0, - self.support, - ) - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact : - self.beta_b_lt = 1 - else : - self.beta_b_lt = Zez_flange/Zpz_flange - self.M_d = M_d - if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: - if self.high_shear_check: - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self, M_d) - else: - bending_strength_section = ( - self.section_property.elast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ) + if is_thick_web: + varlst += [tf_top,tf_bot,tw,bf_top,bf_bot,D_final] else: - bending_strength_section = M_d - print('Inside bending_strength 1', M_d, self.high_shear_check, bending_strength_section) + varlst += [tf_top,tf_bot,tw,bf_top,bf_bot,D_final,c,t_stiff] + print(varlst) + return varlst + + # 2. Build the list of variables + def build_variable_structure(self,is_thick_web=True, is_symmetric=True): + variables = [] + if is_symmetric: + # tf, tw, bf, D + variables += ['tf', 'tw', 'bf', 'D'] else: - # self.It = ( - # 2 - # * self.section_property.flange_width - # * self.section_property.flange_thickness**3 - # ) / 3 + ( - # (self.section_property.depth - self.section_property.flange_thickness) - # * self.section_property.web_thickness**3 - # ) / 3 - self.hf = self.section_property.depth - self.section_property.flange_thickness - # self.Iw = 0.5**2 * self.section_property.mom_inertia_y * self.hf**2 - self.fcrb = IS800_2007.cl_8_2_2_Unsupported_beam_bending_fcrb( - self.material_property.modulus_of_elasticity, - self.effective_length/self.section_property.rad_of_gy_y, - self.hf/self.section_property.flange_thickness - ) + variables += ['tf_top', 'tf_bot', 'tw', 'bf_top', 'bf_bot', 'D'] + + if not is_thick_web: + variables += ['c', 't_stiff'] + + return variables + + # 3. Create bounds array + def get_bounds(self,variable_list): + bounds_map = { + 'tf': (6, 100), + 'tf_top': (6, 100), + 'tf_bot': (6, 100), + 'tw': (6, 40), + 'bf': (100, 1000), + 'bf_top': (100, 1000), + 'bf_bot': (100, 1000), + 'D': (200, 2000), + 'c': (75, 3000), + 't_stiff': (6, 40) + } + lower = [bounds_map[v][0] for v in variable_list] + upper = [bounds_map[v][1] for v in variable_list] + return (np.array(lower), np.array(upper)) - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: - self.beta_b_lt = 1.0 + + # 4. Assign a particle vector to your section object + def assign_particle_to_section(self,particle, variable_list, section): + for name, value in zip(variable_list, particle): + setattr(section, name, value) + + # handle symmetric naming if needed + print("Particle",particle) + print("Variable list",variable_list) + if 'tf' in variable_list: + section.tf_top = section.tf_bot = section.tf + section.bf_top = section.bf_bot = section.bf + + self.top_flange_thickness = section.tf_top + self.bottom_flange_thickness = section.tf_bot + self.web_thickness = section.tw + self.top_flange_width = section.bf_top + self.bottom_flange_width = section.bf_bot + self.total_depth = section.D + self.c = section.c + self.IntStiffThickness = section.t_stiff + + # 5. Objective function + def objective_function(self,x, variable_list,design_dictionary,is_symmetric,is_thick_web): + """ + x: array of shape (n_particles, n_dimensions) + returns: 1D array of costs + """ + costs = [] + for particle in x: + sec = Section() + self.assign_particle_to_section(self,particle, variable_list, sec) + cost = self.run_design_checks(self,sec,design_dictionary,is_symmetric,is_thick_web) + costs.append(cost) + return np.array(costs) + + def run_design_checks(self,section,design_dictionary,is_symmetric,is_thick_web): + """ + Perform your area calculation + penalties here, + return a scalar cost. + """ + + if is_symmetric: + if is_thick_web: + weight = (2 * section.bf * section.tf) + (section.tw * (section.D - 2*section.tf)) * self.length * 7850 else: - self.beta_b_lt = ( - self.section_property.elast_sec_mod_z - / self.section_property.plast_sec_mod_z - ) - if self.section_property.type == "Rolled": - alpha_lt = 0.21 + weight = (2 * section.bf * section.tf) + (section.tw * (section.D - 2*section.tf)) * self.length * 7850 + ((self.length / section.c) - 1) * section.t_stiff * self.IntStiffnerwidth * self.eff_depth *7850 + else: + if is_thick_web: + + weight = ((section.bf_top * section.tf_top) + (section.bf_bot * section.tf_bot) + (section.tw * (section.D - section.tf_top - section.tf_bot)) ) * self.length * 7850 else: - alpha_lt = 0.49 - lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment_fcrb( - self.material_property.fy, self.fcrb - ) - phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt( - alpha_lt, lambda_lt - ) - X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor( - phi_lt, lambda_lt - ) - fbd = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress( - X_lt, self.material_property.fy, self.gamma_m0 - ) - bending_strength_section = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength( - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - fcd=fbd, - section_class=self.section_class_girder - ) - - - # self.beta_b_lt = beta_b - self.alpha_lt = alpha_lt - # self.lambda_lt = lambda_lt - self.phi_lt = phi_lt - self.X_lt = X_lt - self.fbd_lt = fbd - self.lateral_tb = self.fcrb * 10**-6 - print('Inside bending_strength 2.1', fbd, self.section_property.plast_sec_mod_z ) - if self.high_shear_check: - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self,Md=bending_strength_section - ) - else: - bending_strength_section = ( - self.beta_b_lt - * self.section_property.plast_sec_mod_z - * fbd - ) - print('Inside bending_strength 2',self.It,self.hf,self.Iw,self.fcrb ,self.beta_b_lt,alpha_lt,lambda_lt,phi_lt,X_lt,fbd,bending_strength_section) - self.bending_strength_section_reduced = bending_strength_section - return bending_strength_section - def bending_strength_reduction(self, Md): - Zfd = ( - self.section_property.plast_sec_mod_z - - (self.section_property.depth**2 * self.section_property.web_thickness / 4) - ) - Mfd = Zfd * self.material_property.fy / self.gamma_m0 - beta = ((2 * self.load.shear_force / (self.shear_strength * 10**3)) - 1) ** 2 - Mdv = (Md - beta * (Md - Mfd)) - print('Inside bending_strength_reduction',Mdv, Md, beta, Mfd, Zfd) - self.bending_strength_section_reducedby = Mfd - self.beta_reduced = beta - if ( - Mdv - <= 1.2 - * self.section_property.plast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ): - return Mdv + weight = ((section.bf_top * section.tf_top) + (section.bf_bot * section.tf_bot) + (section.tw * (section.D - section.tf_top - section.tf_bot)) ) * self.length * 7850 + ((self.length / section.c) - 1) * section.t_stiff * self.IntStiffnerwidth * self.eff_depth *7850 + + + + # placeholder penalty + penalty = 0 + if self.design_check_optimized_version(self,design_dictionary) > 1: + penalty = 1e7 else: - return ( - 1.2 - * self.section_property.plast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ) + penalty = (100 - (self.design_check_optimized_version(self,design_dictionary)/1000 * 100)) * 1e6 + + return weight + penalty + def design_check(self,design_dictionary): + self.design_flag = False + self.design_flag2 = False + self.shearflag1 = False + self.shearflag2 = False + self.shearflag3 = False + self.shearchecks = False + self.momentchecks = False + self.defl_check = False + self.design_flag = self.section_classification(self, design_dictionary) + if self.design_flag == False: + logger.error("slender section not allowed") + + else: + self.beta_value(self, design_dictionary,self.section_class) + if self.web_philosophy == 'Thick Web without ITS': + self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,"no_stiffener",0) + + if self.design_flag2 == True: + + #shear check + if self.shear_capacity_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness): + self.shearflag1 = True + logger.info("Shear Check passed") + + else: + self.shearflag1 = False + logger.error("Shear Check failed") - def effective_length_beam1(self, design_dictionary, length): - print(f"Inside effective_length_beam") - self.Loading = design_dictionary[KEY_LOAD] # 'Normal'or 'Destabilizing' - # self.Latex_length = design_dictionary[KEY_LENGTH_OVERWRITE] - if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': - if self.support == KEY_DISP_SUPPORT1: - self.torsional_res = design_dictionary[KEY_TORSIONAL_RES] - self.warping = design_dictionary[KEY_WARPING_RES] - self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported( - Torsional=self.Torsional_res, - Warping=self.Warping, - length=length, - depth=(self.section_property.depth/1000), - load=self.Loading, - ) - print(f"Working 1 {self.effective_length}") - elif self.support == KEY_DISP_SUPPORT2: - self.Support = design_dictionary[KEY_SUPPORT_TYPE] - self.Top = design_dictionary[KEY_SUPPORT_TYPE2] - self.effective_length = IS800_2007.cl_8_3_3_EffLen_Cantilever( - Support=self.Support, - Top=self.Top, - length=length, - load=self.Loading, - ) - print(f"Working 2 {self.effective_length}") - else: - if self.support == KEY_DISP_SUPPORT1: - self.Torsional_res = design_dictionary[KEY_TORSIONAL_RES] - self.Warping = design_dictionary[KEY_WARPING_RES] + + #web buckling check + if self.web_buckling_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.material.modulus_of_elasticity,self.b1): + self.shearflag2 = True + logger.info("Web Buckling Check passed") + else: + self.shearflag2 = False + logger.error("Web Buckling Check failed") + + #web crippling check + if self.web_crippling_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.web_thickness,self.top_flange_thickness,self.b1): + self.shearflag3 = False + logger.info("Web Crippling Check passed") + else: + self.shearflag3 = False + logger.error("Web Crippling Check failed") + + if self.shearflag1 == True and self.shearflag2 == True and self.shearflag3 == True: + self.shearchecks = True + else: + self.shearchecks = False + + #support type supp or unsupp + if self.support_type == 'Major Laterally Supported': - elif self.support == KEY_DISP_SUPPORT2: - self.Support = design_dictionary[KEY_SUPPORT_TYPE] - self.Top = design_dictionary[KEY_SUPPORT_TYPE2] + #moment check supp + if self.moment_capacity_laterally_supported(self,self.load.shear_force,self.plast_sec_mod_z,self.elast_sec_mod_z,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.section_class): + self.momentchecks = True + logger.info("Moment Check passed") + else: + self.momentchecks = False + logger.error("Moment Check failed") + + else: #unsupp - try: - if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: - design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' + #moment check unspp + if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): + self.momentchecks = True + logger.info("Moment Check passed") + else: + self.momentchecks = False + logger.error("Moment Check failed") else: - length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) + logger.error("Increase the web thickness") + + else: #thin web condition + stiffener_type = None + if self.long_Stiffner == 'Yes and 1 stiffener': + stiffener_type == "transverse_and_one_longitudinal_compression" + elif self.long_Stiffner == 'Yes and 2 stiffeners': + stiffener_type == "transverse_and_two_longitudinal_neutral" + else: + stiffener_type == "transverse_only" + + if self.c == 'NA': + logger.error("c value not provided") + self.c = 0 + else: + self.c = float(self.c) + self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,stiffener_type,self.c) + if self.design_flag2 == True: - self.effective_length = length - print(f"Working 3 {self.effective_length}") - except: - print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) - logger.warning("Invalid Effective Length Parameter.") - logger.info('Effective Length Parameter is set to default: 1.0') - design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' - self.effective_length_beam(self, design_dictionary, length) - print(f"Working 4 {self.effective_length}") - print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + #shear check + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.web_thickness,self.load.shear_force,self.c): + self.shearflag1 = True + logger.info("Shear Check passed") + else: + self.shearflag1 = False + logger.error("Shear Check failed") + + if self.shear_buckling_check_intermediate_stiffener(self,self.eff_depth,self.web_thickness,self.c,self.epsilon,self.IntStiffThickness,self.IntStiffnerwidth,self.V_cr,self.load.shear_force,self.gamma_m0,self.material.fy,self.material.modulus_of_elasticity): + self.shearflag2 = True + logger.info("Shear Buckling Check passed") + else: + self.shearflag2 = False + logger.error("Shear Buckling Check failed") + + else: #tension field + if self.shear_buckling_check_tension_field(self,self.eff_depth,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.web_thickness,self.c): + self.shearflag1 = True + logger.info("Shear Buckling Check passed") + else: + self.shearflag1 = False + logger.error("Shear Buckling Check failed") - def lambda_lt_check_member_type(self, Mcr=0, fcrb=0, Zp=0, f_y=0, Ze=0, beta_b=0): - lambda_lt_1 = math.sqrt(beta_b * Zp * f_y / Mcr) - lambda_lt_2 = math.sqrt(f_y / fcrb) - lambda_lt_check = math.sqrt(1.2 * Ze * f_y / Mcr) - if lambda_lt_1 == lambda_lt_2: - if lambda_lt_1 <= lambda_lt_check: - return lambda_lt_1 - logger.warning(" Issues with the non-dimensional slenderness ratio Lambda_lt") - - def common_checks_1(self, section, step=1, list_result=[], list_1=[]): - if step == 1: - print(f"Working correct here") - elif step == 2: - # reduction of the area based on the connection requirements (input from design preferences) - if self.effective_area_factor < 1.0: - self.effective_area = round( - self.effective_area * self.effective_area_factor, 2 - ) - - - elif step == 3: - # 2.1 - Buckling curve classification and Imperfection factor - if self.section_property.type == 'Rolled': - self.buckling_class = 'c' - self.imperfection_factor = IS800_2007.cl_7_1_2_1_imperfection_factor( - buckling_class=self.buckling_class - ) - elif step == 4: - # self.slenderness = self.effective_length / min(self.section_property.rad_of_gy_z, self.section_property.rad_of_gy_y) * 1000 - print( - f"\n data sent " - f" self.material_property.fy {self.material_property.fy}" - f"self.gamma_m0 {self.gamma_m0}" - f"self.slenderness {self.slenderness}" - f" self.imperfection_factor {self.imperfection_factor}" - f"self.section_property.modulus_of_elasticity {self.section_property.modulus_of_elasticity}" - ) + if self.tension_field_end_stiffener(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + self.shearflag2 = True + logger.info("Tension Field Check passed") + else: + self.shearflag2 = False + logger.error("Tension Field Check failed") + + if self.shearflag1 == True and self.shearflag2 == True: + self.shearchecks = True + else: + self.shearchecks = False - list_cl_7_1_2_1_design_compressisive_stress = ( - IS800_2007.cl_7_1_2_1_design_compressisive_stress( - self.material_property.fy, - self.gamma_m0, - self.slenderness, - self.imperfection_factor, - self.section_property.modulus_of_elasticity, - check_type=list_result, - ) - ) - for x in list_cl_7_1_2_1_design_compressisive_stress: - print(f"x {x} ") - self.euler_buckling_stress = list_cl_7_1_2_1_design_compressisive_stress[0] - self.nondimensional_effective_slenderness_ratio = ( - list_cl_7_1_2_1_design_compressisive_stress[1] - ) - self.phi = list_cl_7_1_2_1_design_compressisive_stress[2] - self.stress_reduction_factor = list_cl_7_1_2_1_design_compressisive_stress[ - 3 - ] - self.design_compressive_stress_fr = ( - list_cl_7_1_2_1_design_compressisive_stress[4] - ) - self.design_compressive_stress = ( - list_cl_7_1_2_1_design_compressisive_stress[5] - ) - self.design_compressive_stress_max = ( - list_cl_7_1_2_1_design_compressisive_stress[6] - ) - elif step == 5: - # 1- Based on optimum UR - self.optimum_section_ur_results[self.ur] = {} - list_2 = list_result.copy() - for j in list_1: - # k = 0 - for k in list_2: - self.optimum_section_ur_results[self.ur][j] = k - # k += 1 - list_2.pop(0) - break + + if self.support_type == 'Major Laterally Supported': + #moment check supp + if self.moment_capacity_laterally_supported(self,self.load.shear_force,self.plast_sec_mod_z,self.elast_sec_mod_z,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.section_class): + self.moment_checks = True + logger.info("Moment Check passed") + else: + self.moment_checks = False + logger.error("Moment Check failed") + + else: #unsupp - # 2- Based on optimum cost - self.optimum_section_cost_results[self.cost] = {} + #moment check unspp + if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): + self.moment_checks = True + logger.info("Moment Check passed") + else: + self.moment_checks = False + logger.error("Moment Check failed") + + + + - list_2 = list_result.copy() # Why? - for j in list_1: - for k in list_2: - self.optimum_section_cost_results[self.cost][j] = k - list_2.pop(0) - break - print( - f"\n self.optimum_section_cost_results {self.optimum_section_cost_results}" - f"\n self.optimum_section_ur_results {self.optimum_section_ur_results}" - ) - elif step == 6: - self.single_result[self.sec_profile] = {} - list_2 = list_result.copy() - for j in list_1: - # k = 0 - for k in list_2: - self.single_result[self.sec_profile][j] = k - # k += 1 - list_2.pop(0) - break - print(f"\n self.single_result {self.single_result}") - - def list_changer(self, change, list,list_name, check = True): - list_name.extend([ - "Designation"]) - if self.high_shear_check and self.section_class != 'Semi-Compact': - list.extend( - [self.bending_strength_section_reducedby, self.beta_reduced, self.M_d]) - list_name.extend([ - "Mfd", - "Beta_reduced", - 'M_d' - ]) - #Latex para also - list.extend( - [self.latex_tension_zone,self.web_buckling_check,self.effective_depth, self.web_buckling, self.section_class, self.effective_area, self.shear_strength, self.high_shear_check, - self.bending_strength_section, self.effective_length, self.ur, - self.cost, self.beta_b_lt]) - list_name.extend([ - 'latex.tension_zone', - 'Web.Buckling', - 'Reduced.depth', - 'Buckling.crippling', - "Section class", - "Effective area", - "Shear Strength", - "High Shear check", - "Bending Strength", - "Effective_length", - "UR", - "Cost", - "Beta_b" - ]) - #Web buckling parameters - # if self.web_buckling_check and (self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0] or self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1] ) : - # list.extend( - # [self.K_v, self.tau_crc, self.lambda_w, self.tau_b, - # self.V_cr]) - # list_name.extend([ - # 'Kv', - # 'tau_crc', - # 'lambda_w', - # 'tau_b', - # "V_cr" - # ]) - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1] and self.web_buckling_check: - list.extend( - [self.Mfr, self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness) - , self.c, self.phi_girder,self.s_girder ,self.wtf_girder,self.sai_girder, self.fv_girder,self.V_p,self.V_tf_girder]) - list_name.extend([ - 'Mfr', - 'Nf', - 'c', - 'phi_girder', - "s_girder", - 'wtf_girder', - 'sai_girder', - 'fv_girder', - 'V_p', - 'V_tf_girder' - ]) - if change == 'Web Buckling': - list.extend([self.I_eff_web, self.A_eff_web, self.r, self.buckling_class, - self.imperfection_factor, - self.slenderness, - self.euler_buckling_stress, - self.nondimensional_effective_slenderness_ratio, - self.phi, - self.stress_reduction_factor, - self.design_compressive_stress_fr, - self.design_compressive_stress_max, - self.design_compressive_stress, - self.section_capacity, - self.F_wb]) - - list_name.extend ([ - "WebBuckling.I_eff", - "WebBuckling.A_eff", - "WebBuckling.r_eff", - "Buckling_class", - "IF", - "Effective_SR", - "EBS", - "ND_ESR", - "phi", - "SRF", - "FCD_formula", - "FCD_max", - "FCD", - "Capacity", - "Web_crippling" - ]) - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - list.extend([self.It, - self.Iw, - self.alpha_lt, - self.lambda_lt, - self.phi_lt, - self.X_lt, - self.fbd_lt, - self.lateral_tb]) - - list_name.extend([ - "It", - "Iw", - "IF_lt", - "ND_ESR_lt", - "phi_lt", - "SRF_lt", - "FCD_lt", - "Mcr" - ]) - return list,list_name - - # def plate_girder_design(self, section): - # if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - # self.tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(self.K_v, - # self.material_property.modulus_of_elasticity, - # 0.3,self.effective_depth, - # self.section_property.web_thickness) - # self.lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.fyw,self.tau_crc) - # self.tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(self.lambda_w, self.fyw) - # self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(self.tau_b, self.effective_depth * self.section_property.web_thickness) - # d_red = self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius) - # tau_b = self.load.shear_force / (self.effective_depth * self.section_property.web_thickness) - # if tau_b <= self.fyw / math.sqrt(3): - # lambda_w = 0.8 - # else: - # lambda_w = min((tau_b*(math.sqrt(3)/self.fyw) - 1.64) / (-0.8), math.sqrt(tau_b*(math.sqrt(3)/self.fyw))) - # tau_crc = self.fyw / (math.sqrt(3) * lambda_w ** 2) - - def plate_girder_strength(self): - self.tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(self.K_v, - self.material_property.modulus_of_elasticity, - 0.3,self.effective_depth, - self.section_property.web_thickness) - self.lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.fyw,self.tau_crc) - self.tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(self.lambda_w, self.fyw) - self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(self.tau_b, self.effective_depth * self.section_property.web_thickness) / 10**3 - print('\n plate_girder_strength', '\n tau_crc',self.tau_crc,'\n self.lambda_w',self.lambda_w,'\n self.tau_b',self.tau_b,'\n self.V_cr',self.V_cr) - def plate_girder_strength2(self): - - self.plate_girder_strength(self) - self.phi_girder, self.M_fr_girder ,self.s_girder ,self.wtf_girder,self.sai_girder, self.fv_girder, self.V_tf_girder= IS800_2007.cl_8_4_2_2_TensionField(self.c, - self.effective_depth,self.section_property.web_thickness, - self.fyw,self.section_property.flange_width, - self.section_property.flange_thickness,self.fyf, - self.load.moment/(self.section_property.depth - self.section_property.flange_thickness), - self.gamma_m0,self.effective_depth * self.section_property.web_thickness,self.tau_b,self.V_p ) - - - def results(self, design_dictionary): - _ = [i for i in self.optimum_section_ur if i > 1.0] - print( '_ ',_) - if len(_)==1: - temp = _[0] - elif len(_)==0: - temp = None - else: - temp = sorted(_)[0] - self.failed_design_dict = self.optimum_section_ur_results[temp] if temp is not None else None - print('self.failed_design_dict ',self.failed_design_dict) - - # sorting results from the dataset - # if len(self.input_section_list) > 1: - # results based on UR - if self.optimization_parameter == "Utilization Ratio": - filter_UR = filter( - lambda x: x <= min(self.allowable_utilization_ratio, 1.0), - self.optimum_section_ur - ) - self.optimum_section_ur = list(filter_UR) - - self.optimum_section_ur.sort() - print(f"self.optimum_section_ur{self.optimum_section_ur} \n self.optimum_section_ur_results{self.optimum_section_ur_results}") - # print(f"self.result_UR{self.result_UR}") - - # selecting the section with most optimum UR - if len(self.optimum_section_ur) == 0: # no design was successful - logger.warning( - "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " - "criteria" - ) - logger.error( - "The solver did not find any adequate section from the defined list." - ) - - self.design_status = False - if len(self.failed_design_dict)>0: - logger.info( - "The details for the best section provided is being shown" - ) - self.result_UR = self.failed_design_dict['UR'] #temp TODO @Rutvik - self.common_result( - self, - list_result=self.failed_design_dict, - result_type=None, - ) - logger.warning( - "Re-define the list of sections or check the Design Preferences option and re-design." - ) else: - logger.warning( - "Plastic section modulus of selected sections is less than required." - ) - return - # self.design_status_list.append(self.design_status) + logger.error("Increase the web thickness") - else: - self.failed_design_dict = None - self.result_UR = self.optimum_section_ur[-1] # optimum section which passes the UR check - print(f"self.result_UR{self.result_UR}") - self.design_status = True - self.common_result( - self, - list_result=self.optimum_section_ur_results, - result_type=self.result_UR, - ) - - else: # results based on cost - self.optimum_section_cost.sort() - - # selecting the section with most optimum cost - self.result_cost = self.optimum_section_cost[0] - self.design_status = True - # print results - # if len(self.optimum_section_ur) == 0: - # logger.warning( - # "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " - # "criteria" - # ) - # logger.error( - # "The solver did not find any adequate section from the defined list." - # ) - # logger.info( - # "Re-define the list of sections or check the Design Preferences option and re-design." - # ) - # self.design_status = False - # self.design_status_list.append(self.design_status) - # pass - # else: - # if self.optimization_parameter == "Utilization Ratio": - # self.common_result( - # self, - # list_result=self.optimum_section_ur_results, - # result_type=self.result_UR, - # ) - # else: - # self.result_UR = self.optimum_section_cost_results[ - # self.result_cost - # ]["UR"] - # - # # checking if the selected section based on cost satisfies the UR - # if self.result_UR > min(self.allowable_utilization_ratio, 1.0): - # trial_cost = [] - # for cost in self.optimum_section_cost: - # self.result_UR = self.optimum_section_cost_results[ - # cost - # ]["UR"] - # if self.result_UR <= min( - # self.allowable_utilization_ratio, 1.0 - # ): - # trial_cost.append(cost) - # - # trial_cost.sort() - # - # if len(trial_cost) == 0: # no design was successful - # logger.warning( - # "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " - # "criteria" - # ) - # logger.error( - # "The solver did not find any adequate section from the defined list." - # ) - # logger.info( - # "Re-define the list of sections or check the Design Preferences option and re-design." - # ) - # self.design_status = False - # self.design_status_list.append(self.design_status) - # print(f"design_status_list{self.design_status} \n") - # else: - # self.result_cost = trial_cost[ - # 0 - # ] # optimum section based on cost which passes the UR check - # self.design_status = True - # - # # results - # self.common_result( - # self, - # list_result=self.optimum_section_cost_results, - # result_type=self.result_cost, - # ) - # - # print(f"design_status_list2{self.design_status}") - self.design_status_list.append(self.design_status) - for status in self.design_status_list: - print('status list', status) - if status is False: - self.design_status = False - break - else: - self.design_status = True + - def common_result(self, list_result, result_type, flag=1): - try: - self.result_designation = list_result[result_type]["Designation"] # TODO debug - logger.info( - "The section is {}. The {} section has {} flange({}) and {} web({}). [Reference: Cl 3.7, IS 800:2007].".format( - self.input_section_classification[self.result_designation][0] , - self.result_designation, - self.input_section_classification[self.result_designation][1], round(self.input_section_classification[self.result_designation][3],2), - self.input_section_classification[self.result_designation][2], round(self.input_section_classification[self.result_designation][4],2) - ) - ) - self.result_latex_tension_zone = list_result[result_type]["latex.tension_zone"] - self.result_web_buckling_check = list_result[result_type]["Web.Buckling"] - self.result_eff_d = list_result[result_type]["Reduced.depth"] - self.result_buckling_crippling = list_result[result_type]["Buckling.crippling"] - - self.result_section_class = list_result[result_type]["Section class"] - self.result_effective_area = round(list_result[result_type]["Effective area"],2) - if self.effective_area_factor < 1.0: - logger.info( - "The actual effective area is {} mm2 and the reduced effective area is {} mm2 [Reference: Cl. 7.3.2, IS 800:2007]".format( - round((self.result_effective_area / self.effective_area_factor), 2), - self.result_effective_area, - ) - ) - - self.result_shear = round(list_result[result_type]["Shear Strength"], 2) - self.result_high_shear = list_result[result_type]["High Shear check"] - self.result_bending = round(list_result[result_type]["Bending Strength"], 2) - self.result_eff_len = round(list_result[result_type]["Effective_length"], 2) - self.result_cost = list_result[result_type]["Cost"] - self.result_betab = list_result[result_type]["Beta_b"] - - if self.result_web_buckling_check : - logger.warning( - "Thin web so take flange to resist moment and web to resist shear[Reference: Cl 8.2.1.1, IS 800:2007]") - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - logger.info('Transverse Stiffeners at supports required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result[result_type]['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result[result_type]['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result[result_type]['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result[result_type]['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result[result_type]['V_cr'], 2) - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - logger.info('Transverse Stiffeners at supports and intermediate transverse stiffener required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result[result_type]['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result[result_type]['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result[result_type]['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result[result_type]['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result[result_type]['V_cr'], 2) - self.result_web_buckling_simple_Mfr = round(list_result[result_type]['Mfr']*10**-6, 2) - self.result_web_buckling_simple_Nf = round(list_result[result_type]['Nf'], 2) - self.result_web_buckling_simple_c = round(list_result[result_type]['c'], 2) - self.result_web_buckling_simple_phi_girder = round(list_result[result_type]['phi_girder'], 2) - self.result_web_buckling_simple_s_girder = round(list_result[result_type]['s_girder'], 2) - self.result_web_buckling_simple_wtf_girder = round(list_result[result_type]['wtf_girder'], 2) - self.result_web_buckling_simple_sai_girder = round(list_result[result_type]['sai_girder'], 2) - self.result_web_buckling_simple_fv_girder = round(list_result[result_type]['fv_girder'], 2) - self.result_web_buckling_simple_V_p_girder = round(list_result[result_type]['V_p'], 2) - self.result_web_buckling_simple_fV_tf_girder = round(list_result[result_type]['V_tf_girder'], 2) - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE : - self.result_mcr = round(list_result[result_type]['Mcr'], 2) - self.result_IF_lt = round(list_result[result_type]["IF_lt"], 2) - self.result_tc = round(list_result[result_type]["It"], 2) - self.result_wc = round(list_result[result_type]["Iw"], 2) - self.result_nd_esr_lt = round(list_result[result_type]["ND_ESR_lt"], 2) - self.result_phi_lt = round(list_result[result_type]["phi_lt"], 2) - self.result_srf_lt = round(list_result[result_type]["SRF_lt"], 2) - self.result_fcd__lt = round(list_result[result_type]["FCD_lt"], 2) - else: - self.result_mcr = 'NA' - self.result_IF_lt = 'NA' - self.result_tc = 'NA' - self.result_wc = 'NA' - self.result_nd_esr_lt = 'NA' - self.result_phi_lt = 'NA' - self.result_srf_lt = 'NA' - self.result_fcd__lt = 'NA' - - if self.web_buckling : - - self.result_bcI_eff = list_result[result_type]['WebBuckling.I_eff'] - self.result_bcA_eff = list_result[result_type]['WebBuckling.A_eff'] - self.result_bcr_eff = list_result[result_type]['WebBuckling.r_eff'] - self.result_bc = list_result[result_type]['Buckling_class'] - self.result_IF = round(list_result[result_type]["IF"], 2) - self.result_eff_sr = round(list_result[result_type]["Effective_SR"], 2) - self.result_ebs = round(list_result[result_type]["EBS"], 2) - self.result_nd_esr = round(list_result[result_type]["ND_ESR"], 2) - self.result_phi_zz = round(list_result[result_type]["phi"], 2) - self.result_srf = round(list_result[result_type]["SRF"], 2) - self.result_fcd_1_zz = round(list_result[result_type]["FCD_formula"], 2) - self.result_fcd_2 = round(list_result[result_type]["FCD_max"], 2) - self.result_fcd = round(list_result[result_type]["FCD"], 2) - self.result_capacity = round(list_result[result_type]["Capacity"], 2) - self.result_crippling = round(list_result[result_type]["Web_crippling"], 2) - else: - self.result_bc = 'NA' - self.result_IF = 'NA' - self.result_eff_sr = 'NA' - self.result_lambda_vv = 'NA' - self.result_lambda_psi = 'NA' - self.result_ebs = 'NA' - self.result_nd_esr = 'NA' - self.result_phi_zz = 'NA' - self.result_srf = 'NA' - self.result_fcd_1_zz = 'NA' - self.result_fcd_2 = 'NA' - self.result_fcd = 'NA' - self.result_capacity = 'NA' - self.result_crippling = 'NA' - if self.result_high_shear and self.input_section_classification[self.result_designation][0] != 'Semi-Compact': - self.result_mfd = list_result[result_type]["Mfd"] - self.result_beta_reduced = list_result[result_type]["Beta_reduced"] - self.result_Md= list_result[result_type]["M_d"] - except: - self.result_designation = list_result["Designation"] - logger.info( - "The section is {}. The {} section has {} flange({}) and {} web({}). [Reference: Cl 3.7, IS 800:2007].".format( - self.input_section_classification[self.result_designation][0] , - self.result_designation, - self.input_section_classification[self.result_designation][1], round(self.input_section_classification[self.result_designation][3],2), - self.input_section_classification[self.result_designation][2], round(self.input_section_classification[self.result_designation][4],2) - ) - ) - self.result_latex_tension_zone = list_result["latex.tension_zone"] - self.result_web_buckling_check = list_result["Web.Buckling"] - self.result_eff_d = list_result["Reduced.depth"] - self.result_buckling_crippling = list_result["Buckling.crippling"] - - self.result_section_class = list_result["Section class"] - self.result_effective_area = round(list_result["Effective area"],2) - if self.effective_area_factor < 1.0: - logger.info( - "The actual effective area is {} mm2 and the reduced effective area is {} mm2 [Reference: Cl. 7.3.2, IS 800:2007]".format( - round((self.result_effective_area / self.effective_area_factor), 2), - self.result_effective_area, - ) - ) - - self.result_shear = round(list_result["Shear Strength"], 2) - self.result_high_shear = list_result["High Shear check"] - self.result_bending = round(list_result["Bending Strength"], 2) - self.result_eff_len = round(list_result["Effective_length"], 2) - self.result_cost = list_result["Cost"] - self.result_betab = list_result["Beta_b"] - - if self.result_web_buckling_check : - logger.warning( - "Thin web so take flange to resist moment and web to resist shear[Reference: Cl 8.2.1.1, IS 800:2007]") - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - logger.info('Transverse Stiffeners at supports required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result['V_cr'], 2) - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - logger.info('Transverse Stiffeners at supports and intermediate transverse stiffener required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result['V_cr'], 2) - self.result_web_buckling_simple_Mfr = round(list_result['Mfr']*10**-6, 2) - self.result_web_buckling_simple_Nf = round(list_result['Nf'], 2) - self.result_web_buckling_simple_c = round(list_result['c'], 2) - self.result_web_buckling_simple_phi_girder = round(list_result['phi_girder'], 2) - self.result_web_buckling_simple_s_girder = round(list_result['s_girder'], 2) - self.result_web_buckling_simple_wtf_girder = round(list_result['wtf_girder'], 2) - self.result_web_buckling_simple_sai_girder = round(list_result['sai_girder'], 2) - self.result_web_buckling_simple_fv_girder = round(list_result['fv_girder'], 2) - self.result_web_buckling_simple_V_p_girder = round(list_result['V_p'], 2) - self.result_web_buckling_simple_fV_tf_girder = round(list_result['V_tf_girder'], 2) - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE : - self.result_mcr = round(list_result['Mcr'], 2) - self.result_IF_lt = round(list_result["IF_lt"], 2) - self.result_tc = round(list_result["It"], 2) - self.result_wc = round(list_result["Iw"], 2) - self.result_nd_esr_lt = round(list_result["ND_ESR_lt"], 2) - self.result_phi_lt = round(list_result["phi_lt"], 2) - self.result_srf_lt = round(list_result["SRF_lt"], 2) - self.result_fcd__lt = round(list_result["FCD_lt"], 2) - else: - self.result_mcr = 'NA' - self.result_IF_lt = 'NA' - self.result_tc = 'NA' - self.result_wc = 'NA' - self.result_nd_esr_lt = 'NA' - self.result_phi_lt = 'NA' - self.result_srf_lt = 'NA' - self.result_fcd__lt = 'NA' - - if self.web_buckling : - - self.result_bcI_eff = list_result['WebBuckling.I_eff'] - self.result_bcA_eff = list_result['WebBuckling.A_eff'] - self.result_bcr_eff = list_result['WebBuckling.r_eff'] - self.result_bc = list_result['Buckling_class'] - self.result_IF = round(list_result["IF"], 2) - self.result_eff_sr = round(list_result["Effective_SR"], 2) - self.result_ebs = round(list_result["EBS"], 2) - self.result_nd_esr = round(list_result["ND_ESR"], 2) - self.result_phi_zz = round(list_result["phi"], 2) - self.result_srf = round(list_result["SRF"], 2) - self.result_fcd_1_zz = round(list_result["FCD_formula"], 2) - self.result_fcd_2 = round(list_result["FCD_max"], 2) - self.result_fcd = round(list_result["FCD"], 2) - self.result_capacity = round(list_result["Capacity"], 2) - self.result_crippling = round(list_result["Web_crippling"], 2) - else: - self.result_bc = 'NA' - self.result_IF = 'NA' - self.result_eff_sr = 'NA' - self.result_lambda_vv = 'NA' - self.result_lambda_psi = 'NA' - self.result_ebs = 'NA' - self.result_nd_esr = 'NA' - self.result_phi_zz = 'NA' - self.result_srf = 'NA' - self.result_fcd_1_zz = 'NA' - self.result_fcd_2 = 'NA' - self.result_fcd = 'NA' - self.result_capacity = 'NA' - self.result_crippling = 'NA' - if self.result_high_shear and self.input_section_classification[self.result_designation][0] != 'Semi-Compact': - self.result_mfd = list_result["Mfd"] - self.result_beta_reduced = list_result["Beta_reduced"] - self.result_Md= list_result["M_d"] - - ### start writing save_design from here! - def save_design(self, popup_summary): - # print('self.design_status', self.design_status,'len(self.failed_design_dict)', len(self.failed_design_dict)) - if (self.design_status and self.failed_design_dict is None) or (not self.design_status and len(self.failed_design_dict)>0):# TODO @Rutvik - self.section_property = self.section_connect_database(self, self.result_designation) - if self.sec_profile=='Columns' or self.sec_profile=='Beams' or self.sec_profile == VALUES_SECTYPE[1]: - self.report_column = {KEY_DISP_SEC_PROFILE: "ISection", - KEY_DISP_SECSIZE_pg: (self.section_property.designation, self.sec_profile), - KEY_DISP_COLSEC_REPORT: self.section_property.designation, - KEY_DISP_MATERIAL: self.section_property.material, - # KEY_DISP_APPLIED_AXIAL_FORCE: self.section_property., - KEY_REPORT_MASS: self.section_property.mass, - KEY_REPORT_AREA: round(self.section_property.area * 1e-2, 2), - KEY_REPORT_DEPTH: self.section_property.depth, - KEY_REPORT_WIDTH: self.section_property.flange_width, - KEY_REPORT_WEB_THK: self.section_property.web_thickness, - KEY_REPORT_FLANGE_THK: self.section_property.flange_thickness, - KEY_DISP_FLANGE_S_REPORT: self.section_property.flange_slope, - KEY_REPORT_R1: self.section_property.root_radius, - KEY_REPORT_R2: self.section_property.toe_radius, - KEY_REPORT_IZ: round(self.section_property.mom_inertia_z * 1e-4, 2), - KEY_REPORT_IY: round(self.section_property.mom_inertia_y * 1e-4, 2), - KEY_REPORT_RZ: round(self.section_property.rad_of_gy_z * 1e-1, 2), - KEY_REPORT_RY: round(self.section_property.rad_of_gy_y * 1e-1, 2), - KEY_REPORT_ZEZ: round(self.section_property.elast_sec_mod_z * 1e-3, 2), - KEY_REPORT_ZEY: round(self.section_property.elast_sec_mod_y * 1e-3, 2), - KEY_REPORT_ZPZ: round(self.section_property.plast_sec_mod_z * 1e-3, 2), - KEY_REPORT_ZPY: round(self.section_property.plast_sec_mod_y * 1e-3, 2)} - - - - self.report_input = \ - {#KEY_MAIN_MODULE: self.mainmodule, - KEY_MODULE: self.module, #"Axial load on column " - KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, - KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, - KEY_DISP_LENGTH_BEAM: self.result_eff_len, - KEY_DISP_SEC_PROFILE: self.sec_profile, - KEY_DISP_SECSIZE_pg: str(self.sec_list), - KEY_MATERIAL: self.material, - "Selected Section Details": self.report_column, - KEY_BEAM_SUPP_TYPE: self.latex_design_type, - } - - # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0]: - # self.report_input.update({ - # KEY_DISP_BENDING: self.bending_type}) - # elif self.latex_design_type == VALUES_SUPP_TYPE_temp[1]: - # self.report_input.update({ - # KEY_BEAM_SUPP_TYPE_DESIGN: self.support, - # # KEY_DISP_BENDING: self.bending_type, - # }) - self.report_input.update({ - KEY_DISP_SUPPORT : self.support, - KEY_DISP_ULTIMATE_STRENGTH_REPORT: self.material_property.fu, - KEY_DISP_YIELD_STRENGTH_REPORT: self.material_property.fy, - "End Conditions - " + str(self.support): "TITLE", - }) - # if self.Latex_length == 'NA': - if self.support == KEY_DISP_SUPPORT1: - self.report_input.update({ - DISP_TORSIONAL_RES: self.Torsional_res, - DISP_WARPING_RES:self.Warping }) - else: - self.report_input.update({ - DISP_SUPPORT_RES: self.Support, - DISP_TOP_RES: self.Top}) - self.report_input.update({ - "Design Preference" : "TITLE", - KEY_DISP_EFFECTIVE_AREA_PARA: self.effective_area_factor, - KEY_DISP_CLASS: self.allow_class, - KEY_DISP_LOAD: self.Loading, - KEY_DISPP_LENGTH_OVERWRITE: self.latex_efp, - KEY_DISP_BEARING_LENGTH + ' (mm)': self.bearing_length, - - }) - # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0] and self.result_web_buckling_check: - # self.report_input.update({ - # KEY_ShearBuckling: self.support_cndition_shear_buckling - # }) - # self.report_input.update({ - # # KEY_DISP_SEC_PROFILE: self.sec_profile, - # "I Section - anical PropertiesMech": "TITLE", - # }) - self.report_input.update() - self.report_check = [] - - t1 = ('Selected', 'Selected Member Data', '|p{5cm}|p{2cm}|p{2cm}|p{2cm}|p{4cm}|') - self.report_check.append(t1) - - t1 = ('SubSection', 'Effective Area', '|p{4cm}|p{1.5cm}|p{9.5cm}|p{1cm}|') - self.report_check.append(t1) - t1 = ('Effective Area ($mm^2$)', ' ', - sectional_area_change(round(self.result_effective_area,2), round(self.section_property.area,2), - self.effective_area_factor), - ' ') - self.report_check.append(t1) - - # t1 = ('SubSection', 'Section parameters', '|p{4cm}|p{1.5cm}|p{9.5cm}|p{1cm}|') - # self.report_check.append(t1) - # t1 = ('d_{web}', ' ', - # sectional_area_change(round(self.result_effective_area,2), round(self.section_property.area,2), - # self.effective_area_factor), - # ' ') - # self.report_check.append(t1) - - t1 = ('SubSection', 'Section Classification', '|p{3cm}|p{3.5cm}|p{8.5cm}|p{1cm}|') - self.report_check.append(t1) - t1 = ('Web Class', 'Neutral Axis at Mid-Depth', - cl_3_7_2_section_classification_web(round(self.result_eff_d, 2), round(self.section_property.web_thickness, 2), round(self.input_section_classification[self.result_designation][4],2), - self.epsilon, self.section_property.type, - self.input_section_classification[self.result_designation][2]), - ' ') - self.report_check.append(t1) - t1 = ('Flange Class', self.section_property.type, - cl_3_7_2_section_classification_flange(round(self.section_property.flange_width/2, 2), - round(self.section_property.flange_thickness, 2), round( - self.input_section_classification[self.result_designation][3], 2), - self.epsilon, - self.input_section_classification[self.result_designation][1]), - ' ') - self.report_check.append(t1) - t1 = ('Section Class', ' ', - cl_3_7_2_section_classification( - self.input_section_classification[self.result_designation][0]), - ' ') - self.report_check.append(t1) - - t1 = ('SubSection', 'Web Slenderness Check', '|p{3cm}|p{4cm}|p{6cm}|p{3 cm}|') - self.report_check.append(t1) - t1 = (KEY_DISP_Web_Buckling, cl_8_2_1web_buckling_required(round(self.epsilon,2),round(67 * self.epsilon,2)), - cl_8_2_1web_buckling_1(self.result_eff_d, self.section_property.web_thickness, - round(self.result_eff_d / self.section_property.web_thickness,2), self.result_web_buckling_check), - get_pass_fail(67 * self.epsilon, round(self.result_eff_d / self.section_property.web_thickness,2), relation="Custom")) - self.report_check.append(t1) - if self.result_web_buckling_check: - t1 = ('SubSection', 'Shear Strength Results: ' + self.support_cndition_shear_buckling, '|p{3.5cm}|p{1.5cm}|p{10cm}|p{1cm}|') - self.report_check.append(t1) - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - t1 = (KEY_DISP_K_v_latex , ' ',cl_8_4_2_2_KV(self.result_web_buckling_simple_kv,self.support_cndition_shear_buckling), - - ' ') - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - t1 = (KEY_DISP_Transverse_Stiffener_spacing, ' ', - cl_8_4_2_2_Transverse_Stiffener_spacing(self.result_web_buckling_simple_c), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_K_v_latex, ' ',cl_8_4_2_2_KV(self.result_web_buckling_simple_kv,self.support_cndition_shear_buckling, self.result_web_buckling_simple_c,self.result_eff_d ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_Elastic_Critical_shear_stress_web, ' ', - cl_8_4_2_2_taucrc(self.result_web_buckling_simple_kv, 2 * 10 ** 5, 0.3, - self.result_eff_d, - self.section_property.web_thickness, - self.result_web_buckling_simple_tau_crc), - ' ') - self.report_check.append(t1) - - - - t1 = (KEY_DISP_slenderness_ratio_web, ' ', - cl_8_4_2_2_slenderness_ratio(self.fyw, self.result_web_buckling_simple_lambda_w, - self.result_web_buckling_simple_tau_crc), - ' ') - self.report_check.append(t1) - - t1 = (KEY_OUT_DISP_WELD_SHEAR_STRESS, ' ', - cl_8_4_2_2_shearstress_web(self.fyw, self.result_web_buckling_simple_lambda_w, self.result_web_buckling_simple_tau_b), - ' ') - self.report_check.append(t1) - - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR + '(V_{d})', self.load.shear_force * 10 ** -3, - cl_8_4_2_2_shearstrength(self.result_eff_d, self.section_property.web_thickness,self.result_web_buckling_simple_V_cr, - self.result_web_buckling_simple_tau_b, self.result_shear), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_ALLOW_SHEAR, ' ', - cl_8_2_1_2_shear_check(round(self.result_shear, 2), round(0.6 * self.result_shear, 2), - self.result_high_shear, self.load.shear_force * 10 ** -3), - get_pass_fail(self.load.shear_force * 10 ** -3, round(0.6 * self.result_shear, 2), - relation="Warn", M1=self.result_high_shear)) - self.report_check.append(t1) - - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - t1 = (KEY_DISP_BUCKLING_STRENGTH + '(V_p)', ' ', - cl_8_4_1_plastic_shear_resistance_Vp(self.result_eff_d,self.section_property.web_thickness,self.fyw, self.result_web_buckling_simple_V_p_girder - ), - ' ') - self.report_check.append(t1) - - t1 = ('N_f (N)', ' ', - cl_8_4_2_2_N_f(self.section_property.depth, - self.section_property.flange_thickness, - self.section_property.depth - self.section_property.flange_thickness, - round(self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness),2) , self.load.moment - ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_reduced_moment + '(M_{fr})', ' ', - cl_8_4_2_2_TensionField_reduced_moment(self.result_web_buckling_simple_Mfr, self.section_property.flange_width,self.section_property.flange_thickness, - self.fyf, round(self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness),2) - ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_tension_field_incline , ' ', - cl_8_4_2_2_TensionField_phi(self.result_web_buckling_simple_phi_girder, self.result_web_buckling_simple_c,self.result_eff_d - ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_AnchoragelengthTensionField, ' ', - cl_8_4_2_2_TensionField_anchorage_length(self.result_web_buckling_simple_s_girder, self.result_web_buckling_simple_phi_girder, - self.result_web_buckling_simple_Mfr, self.fyw, self.section_property.web_thickness - ), - ' ') - self.report_check.append(t1) - - - t1 = (KEY_DISP_WidthTensionField , ' ', - cl_8_4_2_2_KEY_DISP_WidthTensionField(self.result_eff_d,self.result_web_buckling_simple_phi_girder, - self.result_web_buckling_simple_c, - self.result_web_buckling_simple_s_girder,self.result_web_buckling_simple_wtf_girder - ), - ' ') - self.report_check.append(t1) - # t1 = (KEY_DISP_reduced_moment + '(M_{fr}', ' ', - # cl_8_4_2_2_TensionField_reduced_moment(self.result_eff_d, - # self.result_web_buckling_simple_phi_girder, - # self.result_web_buckling_simple_c, - # self.result_web_buckling_simple_s_girder,self.result_web_buckling_simple_wtf_girder - # ), - # ' ') - # self.report_check.append(t1) - t1 = (KEY_DISP_Yield_Strength_Tension_field, ' ', - cl_8_4_2_2_Yield_Strength_Tension_field(self.fyw, - self.result_web_buckling_simple_tau_b, - self.result_web_buckling_simple_phi_girder, - self.result_web_buckling_simple_fv_girder - ), - ' ') - self.report_check.append(t1) - t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR + '(V_{d})', self.load.shear_force * 10 ** -3, - cl_8_4_2_2_shearstrength_tensionfield(self.effective_depth * self.section_property.web_thickness, self.result_web_buckling_simple_tau_b,self.result_web_buckling_simple_V_p_girder, - self.result_shear,self.section_property.web_thickness, self.result_web_buckling_simple_wtf_girder, self.result_web_buckling_simple_fv_girder, - self.result_web_buckling_simple_phi_girder, round(self.result_web_buckling_simple_fV_tf_girder * 10**-3,2)), - ' ') - self.report_check.append(t1) + #deflection checks + if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case): + self.defl_check = True + logger.info("Deflection Check passed") + else: + self.defl_check = False + logger.error("Deflection Check failed") + + #in pso check for self.moment_checks and self.shearchecks + + #for customized + if self.design_flag == True and self.design_flag2 == True and self.defl_check == True: + pass + self.final_format(self,design_dictionary) + + def design_check_optimized_version(self,design_dictionary): + self.design_flag = False + self.design_flag2 = False + self.shearflag1 = False + self.shearflag2 = False + self.shearflag3 = False + self.shearchecks = False + self.momentchecks = False + self.defl_check = False + self.design_flag = self.section_classification(self, design_dictionary) + if self.design_flag == False: + pass + # logger.error("slender section not allowed") + + else: + self.beta_value(self, design_dictionary,self.section_class) - else: + if self.web_philosophy == 'Thick Web without ITS': + self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,"no_stiffener",0) + + if self.design_flag2 == True: + + #shear check + if self.shear_capacity_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness): + self.shearflag1 = True + # logger.info("Shear Check passed") + + else: + self.shearflag1 = False + # logger.error("Shear Check failed") + + + #web buckling check + if self.web_buckling_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.material.modulus_of_elasticity,self.b1): + self.shearflag2 = True + # logger.info("Web Buckling Check passed") + else: + self.shearflag2 = False + # logger.error("Web Buckling Check failed") + + #web crippling check + if self.web_crippling_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.web_thickness,self.top_flange_thickness,self.b1): + self.shearflag3 = False + # logger.info("Web Crippling Check passed") + else: + self.shearflag3 = False + # logger.error("Web Crippling Check failed") + + if self.shearflag1 == True and self.shearflag2 == True and self.shearflag3 == True: + self.shearchecks = True + else: + self.shearchecks = False + + #support type supp or unsupp + if self.support_type == 'Major Laterally Supported': - t1 = ('SubSection', 'Shear Strength Results', '|p{4cm}|p{5cm}|p{5.5cm}|p{1.5cm}|') - self.report_check.append(t1) - - t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR, self.load.shear_force * 10 ** -3, - cl_8_4_shear_yielding_capacity_member_(self.section_property.depth, - self.section_property.web_thickness, self.material_property.fy, - self.gamma_m0, round(self.result_shear, 2)), - get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_shear, 2), relation="lesser")) - self.report_check.append(t1) - - t1 = (KEY_DISP_ALLOW_SHEAR, ' ', - cl_8_2_1_2_shear_check(round(self.result_shear,2), round(0.6 * self.result_shear,2), self.result_high_shear,self.load.shear_force*10**-3), - get_pass_fail(self.load.shear_force*10**-3, round(0.6 * self.result_shear,2), relation="Warn",M1=self.result_high_shear)) - self.report_check.append(t1) - - # t1 = ('SubSection', 'Moment Strength Results', '|p{4cm}|p{4cm}|p{6.5cm}|p{1.5cm}|') - - t1 = ('SubSection', 'Moment Strength Results', '|p{4cm}|p{1.5cm}|p{9cm}|p{1.5cm}|') - self.report_check.append(t1) - if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: - if self.result_high_shear: - t1 = (KEY_DISP_Bending_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending_md_init( - self.section_property.elast_sec_mod_z, - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.support, - self.gamma_m0, round(self.result_betab, 2), - round(self.result_Md * 10 ** -6, 2), self.result_section_class - ), - ' ') - self.report_check.append(t1) - t1 = (KEY_DISP_PLASTIC_STRENGTH_MOMENT,' ', - cl_9_2_2_combine_shear_bending_mfd( - self.section_property.plast_sec_mod_z, - self.section_property.depth, - self.section_property.web_thickness, - self.material_property.fy, - self.gamma_m0, - round(self.result_mfd * 10 ** -6, 2)), - ' ') - self.report_check.append(t1) - - # temp = cl_8_2_1_2_plastic_moment_capacity_member(self.result_betab, - # self.section_property.plast_sec_mod_z, - # self.material_property.fy, self.gamma_m0, - # round(self.result_bending, 2)) - # print('tempt',temp) - - t1 = (KEY_DISP_DESIGN_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending(round(self.result_bending,2),self.section_property.elast_sec_mod_z, - self.material_property.fy,self.result_section_class,self.load.shear_force*10**-3, round(self.result_shear,2), - self.gamma_m0, round(self.result_beta_reduced,2),round(self.result_Md*10**-6,2),round(self.result_mfd*10**-6,2)), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) + #moment check supp + if self.moment_capacity_laterally_supported(self,self.load.shear_force,self.plast_sec_mod_z,self.elast_sec_mod_z,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.section_class): + self.momentchecks = True + # logger.info("Moment Check passed") + else: + self.momentchecks = False + # logger.error("Moment Check failed") + + else: #unsupp + #moment check unspp + if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): + self.momentchecks = True + # logger.info("Moment Check passed") + else: + self.momentchecks = False + # logger.error("Moment Check failed") else: - t1 = (KEY_DISP_DESIGN_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_8_2_1_2_moment_capacity_member(round(self.result_betab,3), - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.gamma_m0, - round(self.result_bending, 2), self.section_property.elast_sec_mod_z,self.result_section_class,self.support), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) - elif self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - # KEY_DISP_Elastic_CM_latex - t1 = (KEY_DISP_Elastic_CM_latex, ' ', - cl_8_2_2_1_Mcr( - self.result_mcr, - self.material_property.modulus_of_elasticity, - self.section_property.mom_inertia_y, - self.result_eff_len, self.material_property.modulus_of_elasticity/(2*1.3), - self.section_property.It, self.section_property.Iw - # round(self.result_Md * 10 ** -6, 2), self.result_section_class - ), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_I_eff_latex + '($mm^4$)', ' ', - # cl_8_7_3_Ieff_web_check(self.bearing_length, self.section_property.web_thickness, - # round(self.result_bcI_eff,2)), - # ' ') - # self.report_check.append(t1) - - # t1 = (KEY_DISP_A_eff_latex+ '($mm^2$)', ' ', - # cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, - # self.result_bcA_eff), - # ' ') - # self.report_check.append(t1) - - # t1 = (KEY_DISP_r_eff_latex+ '(mm)', ' ', - # cl_8_7_3_reff_web_check(round(self.result_bcr_eff,2), round(self.result_bcI_eff,2), - # self.result_bcA_eff), - # ' ') - # self.report_check.append(t1) - - t1 = (KEY_DISP_SLENDER + r'($\lambda_{LT}$)', ' ', - cl_8_2_2_slenderness(round(self.result_betab, 2),self.section_property.elast_sec_mod_z, - self.section_property.plast_sec_mod_z,self.result_mcr,self.material_property.fy, - self.result_nd_esr_lt), - ' ') - self.report_check.append(t1) - - # # t1 = (KEY_DISP_SLENDER, ' ', - # # cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), - # # self.result_eff_sr), - # # ' ') - # # self.report_check.append(t1) - - # t1 = (KEY_DISP_BUCKLING_CURVE_ZZ, ' ', - # cl_8_7_1_5_buckling_curve(), - # ' ') - # self.report_check.append(t1) - - t1 = (KEY_DISP_IMPERFECTION_FACTOR_ZZ + r'($\alpha_{LT}$)', ' ', - cl_8_7_1_5_imperfection_factor(self.result_IF_lt), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_EULER_BUCKLING_STRESS_ZZ, ' ', - # cl_8_7_1_5_buckling_stress(self.section_property.modulus_of_elasticity,self.result_eff_sr,self.result_ebs), - # ' ') - # self.report_check.append(t1) - - t1 = (r'$\phi_{LT}$', ' ', - cl_8_2_2_phi(self.result_IF_lt,self.result_nd_esr_lt, self.result_phi_lt), - ' ') - self.report_check.append(t1) - - t1 = ('Bending Compressive stress($N/mm^2$)', ' ', - cl_8_2_2_Bending_Compressive(self.material_property.fy,self.gamma_m0,self.result_nd_esr_lt,self.result_phi_lt,self.result_fcd__lt), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_BUCKLING_STRENGTH, self.load.shear_force * 10 ** -3, - # cl_7_1_2_design_compressive_strength(self.result_capacity,round(( - # self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness,2), self.result_fcd,self.load.shear_force * 10 ** -3), - # get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_capacity, 2), relation="leq")) - # self.report_check.append(t1) - - if self.result_high_shear: - t1 = (KEY_DISP_LTB_Bending_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending_md_init( - self.section_property.elast_sec_mod_z, - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.support, - self.gamma_m0, round(self.result_betab, 2), - round(self.result_Md * 10 ** -6, 2), self.result_section_class - ), - ' ') - self.report_check.append(t1) - t1 = (KEY_DISP_PLASTIC_STRENGTH_MOMENT,' ', - cl_9_2_2_combine_shear_bending_mfd( - self.section_property.plast_sec_mod_z, - self.section_property.depth, - self.section_property.web_thickness, - self.material_property.fy, - self.gamma_m0, - round(self.result_mfd * 10 ** -6, 2)), - ' ') - self.report_check.append(t1) - - # temp = cl_8_2_1_2_plastic_moment_capacity_member(self.result_betab, - # self.section_property.plast_sec_mod_z, - # self.material_property.fy, self.gamma_m0, - # round(self.result_bending, 2)) - # print('tempt',temp) - t1 = (KEY_DISP_REDUCE_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending(round(self.result_bending,2),self.section_property.elast_sec_mod_z, - self.material_property.fy,self.result_section_class,self.load.shear_force*10**-3, round(self.result_shear,2), - self.gamma_m0, round(self.result_betab,2),round(self.result_Md*10**-6,2),round(self.result_mfd*10**-6,2)), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) + # logger.error("Increase the web thickness") + pass + else: #thin web condition + stiffener_type = None + if self.long_Stiffner == 'Yes and 1 stiffener': + stiffener_type == "transverse_and_one_longitudinal_compression" + elif self.long_Stiffner == 'Yes and 2 stiffeners': + stiffener_type == "transverse_and_two_longitudinal_neutral" else: - t1 = ('Moment Strength (kNm)', self.load.moment*10**-6, - cl_8_2_2_moment_capacity_member(round(self.result_betab,2), - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.gamma_m0, - round(self.result_bending, 2),self.section_property.elast_sec_mod_z,self.result_section_class,self.support), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) - - if self.result_buckling_crippling: - t1 = ('SubSection', 'Web Buckling Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - self.report_check.append(t1) - - t1 = (KEY_DISP_I_eff_latex + '($mm^4$)', ' ', - cl_8_7_3_Ieff_web_check(self.bearing_length, self.section_property.web_thickness, - round(self.result_bcI_eff,2)), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_A_eff_latex+ '($mm^2$)', ' ', - cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, - self.result_bcA_eff), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_r_eff_latex+ '(mm)', ' ', - cl_8_7_3_reff_web_check(round(self.result_bcr_eff,2), round(self.result_bcI_eff,2), - self.result_bcA_eff), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_SLENDER + r'($\lambda$)', ' ', - cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), - self.result_eff_sr), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_SLENDER, ' ', - # cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), - # self.result_eff_sr), - # ' ') - # self.report_check.append(t1) - - t1 = (KEY_DISP_BUCKLING_CURVE_ZZ, ' ', - cl_8_7_1_5_buckling_curve(), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_IMPERFECTION_FACTOR_ZZ + r'($\alpha$)', ' ', - cl_8_7_1_5_imperfection_factor(self.result_IF), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_EULER_BUCKLING_STRESS_ZZ, ' ', - cl_8_7_1_5_buckling_stress(self.section_property.modulus_of_elasticity,self.result_eff_sr,self.result_ebs), - ' ') - self.report_check.append(t1) - - t1 = (r'$\phi$', ' ', - cl_8_7_1_5_phi(0.49,self.result_eff_sr, self.result_phi_zz), - ' ') - self.report_check.append(t1) - - t1 = ('Buckling stress($N/mm^2$)', ' ', - cl_8_7_1_5_Buckling(self.material_property.fy,self.gamma_m0,self.result_eff_sr,self.result_phi_zz,self.result_fcd_2,self.result_fcd), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_BUCKLING_STRENGTH, self.load.shear_force * 10 ** -3, - cl_7_1_2_design_compressive_strength(self.result_capacity,round(( - self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness,2), self.result_fcd,self.load.shear_force * 10 ** -3), - get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_capacity, 2), relation="leq")) - self.report_check.append(t1) - - t1 = ('SubSection', 'Web Bearing Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - self.report_check.append(t1) - - t1 = ('Bearing Strength(kN)', self.load.shear_force * 10 ** -3, - cl_8_7_4_Bearing_stiffener_check(self.bearing_length, round(2.5 * ( - self.section_property.root_radius + self.section_property.flange_thickness), 2), - self.section_property.web_thickness, - self.material_property.fy, self.gamma_m0, - round(self.result_crippling, 2), - self.section_property.root_radius, - self.section_property.flange_thickness), - get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_crippling, 2), relation="leq")) - - self.report_check.append(t1) - - t1 = ('SubSection', 'Utilization', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - self.report_check.append(t1) - # TODO - if self.result_buckling_crippling: - t1 = (KEY_DISP_Utilization_Ratio, 1.0, - Utilization_Ratio_Latex(self.load.shear_force * 10 ** -3,round(self.result_shear, 2), - self.load.moment*10**-6, round(self.result_bending, 2), - self.result_UR,type=2,Pd=self.result_capacity, fw=self.result_crippling), - get_pass_fail(1.0, self.result_UR, relation="geq")) - else: - t1 = (KEY_DISP_Utilization_Ratio, 1.0, - Utilization_Ratio_Latex(self.load.shear_force * 10 ** -3,round(self.result_shear, 2), - self.load.moment*10**-6, round(self.result_bending, 2), - self.result_UR), - get_pass_fail(1.0, self.result_UR, relation="geq")) - self.report_check.append(t1) -# - # elif not self.design_status or len(self.failed_design_dict)>0: - # self.section_property = self.section_connect_database(self, self.result_designation) - - # if self.sec_profile=='Columns' or self.sec_profile=='Beams' or self.sec_profile == VALUES_SECTYPE[1]: - # self.report_column = {KEY_DISP_SEC_PROFILE: "ISection", - # KEY_DISP_SECSIZE: (self.section_property.designation, self.sec_profile), - # KEY_DISP_COLSEC_REPORT: self.section_property.designation, - # KEY_DISP_MATERIAL: self.section_property.material, - # # KEY_DISP_APPLIED_AXIAL_FORCE: self.section_property., - # KEY_REPORT_MASS: self.section_property.mass, - # KEY_REPORT_AREA: round(self.section_property.area * 1e-2, 2), - # KEY_REPORT_DEPTH: self.section_property.depth, - # KEY_REPORT_WIDTH: self.section_property.flange_width, - # KEY_REPORT_WEB_THK: self.section_property.web_thickness, - # KEY_REPORT_FLANGE_THK: self.section_property.flange_thickness, - # KEY_DISP_FLANGE_S_REPORT: self.section_property.flange_slope, - # KEY_REPORT_R1: self.section_property.root_radius, - # KEY_REPORT_R2: self.section_property.toe_radius, - # KEY_REPORT_IZ: round(self.section_property.mom_inertia_z * 1e-4, 2), - # KEY_REPORT_IY: round(self.section_property.mom_inertia_y * 1e-4, 2), - # KEY_REPORT_RZ: round(self.section_property.rad_of_gy_z * 1e-1, 2), - # KEY_REPORT_RY: round(self.section_property.rad_of_gy_y * 1e-1, 2), - # KEY_REPORT_ZEZ: round(self.section_property.elast_sec_mod_z * 1e-3, 2), - # KEY_REPORT_ZEY: round(self.section_property.elast_sec_mod_y * 1e-3, 2), - # KEY_REPORT_ZPZ: round(self.section_property.plast_sec_mod_z * 1e-3, 2), - # KEY_REPORT_ZPY: round(self.section_property.plast_sec_mod_y * 1e-3, 2)} - - - - # self.report_input = \ - # {#KEY_MAIN_MODULE: self.mainmodule, - # KEY_MODULE: self.module, #"Axial load on column " - # KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, - # KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, - # KEY_DISP_LENGTH_BEAM: self.result_eff_len, - # KEY_DISP_SEC_PROFILE: self.sec_profile, - # KEY_DISP_SECSIZE: str(self.sec_list), - # KEY_MATERIAL: self.material, - # "Selected Section Details": self.report_column, - # KEY_BEAM_SUPP_TYPE: self.latex_design_type, - # } - - # if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - # t1 = ('SubSection', 'Lateral Torsional Buckling Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - # self.report_check.append(t1) - - # t1 = ('SubSection', 'Web Bearing Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - # self.report_check.append(t1) - - # t1 = ('Bearing Strength(kN)', self.load.shear_force * 10 ** -3, - # cl_8_7_4_Bearing_stiffener_check(self.bearing_length, round(2.5 * ( - # self.section_property.root_radius + self.section_property.flange_thickness), 2), - # self.section_property.web_thickness, - # self.material_property.fy, self.gamma_m0, - # round(self.result_crippling, 2), - # self.section_property.root_radius, - # self.section_property.flange_thickness), - # get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_crippling, 2), relation="leq")) - - # self.report_check.append(t1) - # t1 = (KEY_DISP_A_eff_latex + '(mm^2)', ' ', - # cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, - # self.result_bcA_eff), - # ' ') - # self.report_check.append(t1) - # if self.latex_tension_zone == True : - # t1 = (KEY_DISP_TENSION_HOLES, ' ', - # sectional_area_change(self.result_effective_area, self.section_property.area, - # self.effective_area_factor), - # ' ') - # self.report_check.append(t1) + stiffener_type == "transverse_only" + + if self.c == 'NA': + # logger.error("c value not provided") + self.c = 0 + else: + self.c = float(self.c) + self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,stiffener_type,self.c) + if self.design_flag2 == True: + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + #shear check + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.web_thickness,self.load.shear_force,self.c): + self.shearflag1 = True + # logger.info("Shear Check passed") + else: + self.shearflag1 = False + # logger.error("Shear Check failed") + + if self.shear_buckling_check_intermediate_stiffener(self,self.eff_depth,self.web_thickness,self.c,self.epsilon,self.IntStiffThickness,self.IntStiffnerwidth,self.V_cr,self.load.shear_force,self.gamma_m0,self.material.fy,self.material.modulus_of_elasticity): + self.shearflag2 = True + # logger.info("Shear Buckling Check passed") + else: + self.shearflag2 = False + # logger.error("Shear Buckling Check failed") + + else: #tension field + + if self.shear_buckling_check_tension_field(self,self.eff_depth,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.web_thickness,self.c): + self.shearflag1 = True + # logger.info("Shear Buckling Check passed") + else: + self.shearflag1 = False + # logger.error("Shear Buckling Check failed") + + if self.tension_field_end_stiffener(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + self.shearflag2 = True + # logger.info("Tension Field Check passed") + else: + self.shearflag2 = False + # logger.error("Tension Field Check failed") + + if self.shearflag1 == True and self.shearflag2 == True: + self.shearchecks = True + else: + self.shearchecks = False + + + if self.support_type == 'Major Laterally Supported': + #moment check supp + if self.moment_capacity_laterally_supported(self,self.load.shear_force,self.plast_sec_mod_z,self.elast_sec_mod_z,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.section_class): + self.moment_checks = True + # logger.info("Moment Check passed") + else: + self.moment_checks = False + # logger.error("Moment Check failed") + + else: #unsupp + + #moment check unspp + if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): + self.moment_checks = True + # logger.info("Moment Check passed") + else: + self.moment_checks = False + # logger.error("Moment Check failed") + + + + + + else: + # logger.error("Increase the web thickness") + pass + + + + + #deflection checks + if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case): + self.defl_check = True + # logger.info("Deflection Check passed") + else: + self.defl_check = False + # logger.error("Deflection Check failed") + + #in pso check for self.moment_checks and self.shearchecks + + #for customized + print(f"RATIOS moment {self.moment_ratio} shear {self.shear_ratio} deflection {self.deflection_ratio}") + return max(self.moment_ratio,self.shear_ratio) + + + + def optimized_method(self,design_dictionary,is_thick_web, is_symmetric): + # is_thick_web = False + # is_symmetric = False + # if self.web_philosophy == 'Thick Web without ITS': + # is_thick_web = True + # else: + # is_thick_web = False + # if design_dictionary[KEY_IS_IT_SYMMETRIC] == 'Symmetric Girder': + # is_symmetric = True # else: - # t1 = (KEY_DISP_ALLOW_SHEAR, self.load.shear_force, - # allow_shear_capacity(round(self.result_shear, 2), round(0.6 * self.result_shear, 2)), - # get_pass_fail(self.load.shear_force)) - # self.report_check.append(t1) + # is_symmetric = False + variable_list = self.build_variable_structure(self,is_thick_web, is_symmetric) + lb, ub = self.get_bounds(self,variable_list) + optimizer = GlobalBestPSO( + n_particles=500, + dimensions=len(variable_list), + options={'c1': 1.5, 'c2': 1.5, 'w': 0.4}, + bounds=(lb, ub) + ) + fp = self.generate_first_particle(self,float(self.length) * 1000, float(self.load.moment), float(self.material.fy),is_thick_web,is_symmetric) + optimizer.swarm.position[0] = np.clip(fp, lb, ub) + + best_cost, best_pos = optimizer.optimize( + objective_func=lambda swarm: self.objective_function(self,swarm, variable_list,design_dictionary,is_symmetric,is_thick_web), + iters=100 + ) + logger.info("PSO calculation successfully completed") + print("Best cost:", best_cost) + best_design_var = dict(zip(variable_list, best_pos)) + print("Best design variables:", best_design_var) + def ceil_to_nearest(x, multiple): + return float(math.ceil(x / multiple) * multiple) + if is_symmetric: + self.bottom_flange_thickness = self.top_flange_thickness = float(best_design_var['tf']) + for i in self.bottom_flange_thickness_list: + if float(i) > self.bottom_flange_thickness: + self.bottom_flange_thickness = float(i) + self.top_flange_thickness = float(i) + break + self.web_thickness = float(best_design_var['tw']) + for i in self.web_thickness_list: + if float(i) > self.web_thickness: + self.web_thickness = float(i) + break + self.top_flange_width = self.bottom_flange_width = round(float(best_design_var['bf']),0) + self.top_flange_width = self.bottom_flange_width = ceil_to_nearest(self.top_flange_width,25) + self.total_depth = round(float(best_design_var['D']),0) + self.total_depth = ceil_to_nearest(self.total_depth,25) - # self.h = (self.beam_D - (2 * self.beam_tf)) - # - # 1.1 Input sections display - # t1 = ('SubSection', 'List of Input Sections',self.sec_list), - # self.report_check.append(t1) - # - # # 2.2 CHECK: Buckling Class - Compatibility Check - # t1 = ('SubSection', 'Buckling Class - Compatibility Check', '|p{4cm}|p{3.5cm}|p{6.5cm}|p{2cm}|') - # self.report_check.append(t1) - # - # t1 = ("Section Class ", comp_column_class_section_check_required(self.result_section_class, self.h, self.bf), - # comp_column_class_section_check_provided(self.bucklingclass, self.h, self.bf, self.tf, self.var_h_bf), - # 'Compatible') # if self.bc_compatibility_status is True else 'Not compatible') - # self.report_check.append(t1) - - # t1 = ("h/bf , tf ", comp_column_class_section_check_required(self.bucklingclass, self.h, self.bf), - # comp_column_class_section_check_provided(self.bucklingclass, self.h, self.bf, self.tf, self.var_h_bf), - # 'Compatible') # if self.bc_compatibility_status is True else 'Not compatible') - # self.report_check.append(t1) - # - # # 2.3 CHECK: Cross-section classification - # t1 = ('SubSection', 'Cross-section classification', '|p{4.5cm}|p{3cm}|p{6.5cm}|p{1.5cm}|') - # self.report_check.append(t1) - # - # t1 = ("b/tf and d/tw ", cross_section_classification_required(self.section), - # cross_section_classification_provided(self.tf, self.b1, self.epsilon, self.section, self.b1_tf, - # self.d1_tw, self.ep1, self.ep2, self.ep3, self.ep4), - # 'b = bf / 2,d = h – 2 ( T + R1),έ = (250 / Fy )^0.5,Compatible') # if self.bc_compatibility_status is True else 'Not compatible') - # self.report_check.append(t1) - # - # # 2.4 CHECK : Member Check - # t1 = ("Slenderness", cl_7_2_2_slenderness_required(self.KL, self.ry, self.lamba), - # cl_7_2_2_slenderness_provided(self.KL, self.ry, self.lamba), 'PASS') - # self.report_check.append(t1) - # - # t1 = ( - # "Design Compressive stress (fcd)", cl_7_1_2_1_fcd_check_required(self.gamma_mo, self.f_y, self.f_y_gamma_mo), - # cl_7_1_2_1_fcd_check_provided(self.facd), 'PASS') - # self.report_check.append(t1) - # - # t1 = ("Design Compressive strength (Pd)", cl_7_1_2_design_comp_strength_required(self.axial), - # cl_7_1_2_design_comp_strength_provided(self.Aeff, self.facd, self.A_eff_facd), "PASS") - # self.report_check.append(t1) - # - # t1 = ('', '', '', '') - # self.report_check.append(t1) + # self.IntStiffThickness = float(best_design_var['']) + # for i in self.int_thickness_list: + # if float(i) > se else: - self.report_input = \ - {#KEY_MAIN_MODULE: self.mainmodule, - KEY_MODULE: self.module, #"Axial load on column " - KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, - KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, - KEY_DISP_LENGTH_BEAM: self.length, - KEY_DISP_SEC_PROFILE: self.sec_profile, - KEY_DISP_SECSIZE_pg: str(self.sec_list), - KEY_MATERIAL: self.material, - # "Failed Section Details": self.report_column, - KEY_BEAM_SUPP_TYPE: self.latex_design_type, - } - self.report_input.update({ - KEY_DISP_SUPPORT : self.support, - KEY_DISP_ULTIMATE_STRENGTH_REPORT: self.material_property.fu, - KEY_DISP_YIELD_STRENGTH_REPORT: self.material_property.fy, - "End Conditions - " + str(self.support): "TITLE", - }) - # if self.Latex_length == 'NA': - if self.support == KEY_DISP_SUPPORT1: - self.report_input.update({ - DISP_TORSIONAL_RES: self.Torsional_res, - DISP_WARPING_RES:self.Warping }) - else: - self.report_input.update({ - DISP_SUPPORT_RES: self.Support, - DISP_TOP_RES: self.Top}) - self.report_input.update({ - "Design Preference" : "TITLE", - KEY_DISP_EFFECTIVE_AREA_PARA: self.effective_area_factor, - KEY_DISP_CLASS: self.allow_class, - KEY_DISP_LOAD: self.Loading, - KEY_DISPP_LENGTH_OVERWRITE: self.latex_efp, - KEY_DISP_BEARING_LENGTH + ' (mm)': self.bearing_length, - - }) - # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0] and self.result_web_buckling_check: - # self.report_input.update({ - # KEY_ShearBuckling: self.support_cndition_shear_buckling - # }) - # self.report_input.update({ - # # KEY_DISP_SEC_PROFILE: self.sec_profile, - # "I Section - Mechanical Properties": "TITLE", - # }) - self.report_input.update() - self.report_check = [] - - t1 = ('Selected', 'All Members Failed', '|p{5cm}|p{2cm}|p{2cm}|p{2cm}|p{4cm}|') - self.report_check.append(t1) - - t1 = ('SubSection', 'Plastic Section Modulus', '|p{4cm}|p{1.5cm}|p{2.5cm}|p{8cm}|') - self.report_check.append(t1) - t1 = ('Plastic Section Modulus($mm^3$)', round(self.Zp_req,2), - ' ', - 'Select Sections with atleast required Plastic Section Modulus ') - self.report_check.append(t1) - - - Disp_2d_image = [] - Disp_3D_image = "/ResourceFiles/images/3d.png" - - print(sys.path[0]) - rel_path = str(sys.path[0]) - rel_path = os.path.abspath(".") # TEMP - rel_path = rel_path.replace("\\", "/") - fname_no_ext = popup_summary['filename'] - CreateLatex.save_latex(CreateLatex(), self.report_input, self.report_check, popup_summary, fname_no_ext, - rel_path, Disp_2d_image, Disp_3D_image, module=self.module) # + self.bottom_flange_thickness = float(best_design_var['tf_bot']) + for i in self.bottom_flange_thickness_list: + if float(i) > self.bottom_flange_thickness: + self.bottom_flange_thickness = float(i) + break + self.top_flange_thickness = float(best_design_var['tf_top']) + for i in self.top_flange_thickness_list: + if float(i) > self.top_flange_thickness: + self.top_flange_thickness = float(i) + break + self.web_thickness = float(best_design_var['tw']) + for i in self.web_thickness_list: + if float(i) > self.web_thickness: + self.web_thickness = float(i) + break + + self.bottom_flange_width = round(float(best_design_var['bf_bot']),0) + self.bottom_flange_width = ceil_to_nearest(self.bottom_flange_width,25) + self.top_flange_width = round(float(best_design_var['bf_top']),0) + self.top_flange_width = ceil_to_nearest(self.top_flange_width,25) + self.total_depth = round(float(best_design_var['D']),0) + self.total_depth = ceil_to_nearest(self.total_depth,25) + + + if not is_thick_web: + self.IntStiffThickness = float(best_design_var['t_stiff']) + for i in self.int_thickness_list: + if float(i) > self.IntStiffThickness: + self.IntStiffThickness = float(i) + break + + self.c = round(float(best_design_var['c']),0) + self.c = ceil_to_nearest(self.c,25) + + + logger.info(f"Optimized values : Flange width top and bottom {self.top_flange_width} {self.bottom_flange_width} flange thickness top and bottom {self.top_flange_thickness} { self.bottom_flange_thickness} web_thickness {self.web_thickness} total depth { self.total_depth} C value {self.c} thickness stiffener { self.IntStiffThickness}") + + self.design_check(self,design_dictionary) + + + + # logger.info(f"Web Thickness: {self.web_thickness}, Flange Thickness Top: {self.top_flange_thickness}, Flange Width Top: {self.top_flange_width}, Total Depth: {self.total_depth}") + + + + + + + + + + def final_format(self,design_dictionary): + + self.result_designation = (str(int(self.total_depth)) + " x " +str(int(self.web_thickness)) + " x " +str(int(self.bottom_flange_width)) + " x " +str(int(self.bottom_flange_thickness)) + " x " +str(int(self.top_flange_width)) + " x " +str(int(self.top_flange_thickness))) + if self.moment_ratio == None: + self.moment_ratio = 0 + if self.shear_ratio == None: + self.shear_ratio = 0 + print(self.moment_ratio, self.shear_ratio) + self.result_UR = max(self.moment_ratio,self.shear_ratio) * 100 + self.section_classification_val = self.section_class + if self.beta_b_lt == None: + self.beta_b_lt = 0 + self.betab = round(self.beta_b_lt,2) + self.effectivearea = Unsymmetrical_I_Section_Properties.calc_area(self,self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + if self.Md == None: + self.Md = 0 + + if self.M_cr == None: + self.M_cr = 0 + if self.V_cr == None: + self.V_cr = 0 + if self.shear_type == 'Low': + self.design_moment = round(self.Md/1000000,1) + else: + self.design_moment = round(self.Md/1000000,1) + if self.support_type == 'Major Laterally Unsupported': + self.critical_moment = round(self.M_cr/1000000,1) + self.torsion_cnst = round(self.It/10000,0) + self.warping_cnst = round(self.Iw/1000000,0) + self.intstiffener_thk = self.IntStiffThickness + self.longstiffener_thk = self.LongStiffThickness + self.intstiffener_spacing = self.c + self.design_status = True + +class Section: + def __init__(self): + self.tf = self.tw = self.bf = self.D = self.tf_top = self.tf_bot = self.bf_top = self.bf_bot = self.c = self.t_stiff = None + # ... add other properties as needed + + #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder_working.py b/src/osdag/design_type/plate_girder/weldedPlateGirder_working.py new file mode 100644 index 000000000..45d86fbd5 --- /dev/null +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder_working.py @@ -0,0 +1,4727 @@ +""" + +@Author: Rutvik Joshi - Osdag Team, IIT Bombay [(P) rutvikjoshi63@gmail.com / 30005086@iitb.ac.in] +12.03.2025 +Revised Design for GUI: Parth Karia - Osdag Team, IIT Bombay [30006096@iitb.ac.in] + +@Module - Beam Design- Simply Supported member + - Laterally Supported Beam [Moment + Shear] + - Laterally Unsupported Beam [Moment + Shear] + + +@Reference(s): 1) IS 800: 2007, General construction in steel - Code of practice (Third revision) + 2) IS 808: 1989, Dimensions for hot rolled steel beam, column, channel, and angle sections and + it's subsequent revision(s) + 3) Design of Steel Structures by N. Subramanian (Fifth impression, 2019, Chapter 15) + 4) Limit State Design of Steel Structures by S K Duggal (second edition, Chapter 11) + +other 8) +references 9) + +""" +import logging +import math +import numpy as np +from ...Common import * +# from ..connection.moment_connection import MomentConnection +from ...utils.common.material import * +from ...utils.common.load import Load +from ...utils.common.component import ISection, Material +from ...utils.common.component import * +from ..member import Member +from ...Report_functions import * +from ...design_report.reportGenerator_latex import CreateLatex +from ...utils.common.common_calculation import * +from ..tension_member import * +from ...utils.common.Section_Properties_Calculator import BBAngle_Properties +from ...utils.common import is800_2007 +from ...utils.common.component import * +from osdag.cad.items.plate import Plate +from ...utils.common.Unsymmetrical_Section_Properties import Unsymmetrical_I_Section_Properties + + +#GUI TO SELECT CUSTOM IN DESIGN PREFERENCES +from PyQt5 import QtCore, QtWidgets +from PyQt5.QtWidgets import QDialog, QListWidget, QListWidgetItem +import re + +scale = 1 # For resizing components + +class My_ListWidget(QListWidget): + def addItems(self, Iterable, p_str=None): + super().addItems(Iterable) + self.sortItems() + + def addItem(self, *__args): + super().addItem(My_ListWidgetItem(__args[0])) + self.sortItems() + +class My_ListWidgetItem(QListWidgetItem): + def __lt__(self, other): + try: + self_text = str(re.sub("[^0-9.]", "", self.text())) + other_text = str(re.sub("[^0-9.]", "", other.text())) + return float(self_text) < float(other_text) + except Exception: + return super().__lt__(other) + +class PopupDialog(QDialog): + def __init__(self, disabled_values=[], note="", parent=None): + super().__init__(parent) + self.disabled_values = disabled_values + self.note = note + self.setWindowTitle("Customized") + self.resize(int(scale*540), int(scale*470)) + self.init_ui() + self.set_styles() + + def init_ui(self): + self.label = QtWidgets.QLabel("Available:", self) + self.label.setGeometry(QtCore.QRect(20, 20, 150, 30)) + + self.label_2 = QtWidgets.QLabel("Selected:", self) + self.label_2.setGeometry(QtCore.QRect(int(scale * 320), 20, 150, 30)) + + self.listWidget = My_ListWidget(self) + self.listWidget.setGeometry(QtCore.QRect(20, 50, int(scale*180), int(scale*300))) + self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget.itemDoubleClicked.connect(self.move_to_selected) + + self.listWidget_2 = My_ListWidget(self) + self.listWidget_2.setGeometry(QtCore.QRect(int(scale*320), 50, int(scale*180), int(scale*300))) + self.listWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget_2.itemDoubleClicked.connect(self.move_to_available) + + self.pushButton = QtWidgets.QPushButton(">>", self) + self.pushButton.setGeometry(QtCore.QRect(int(scale*225), int(scale*140), int(scale*70), int(scale*30))) + + self.pushButton_2 = QtWidgets.QPushButton(">", self) + self.pushButton_2.setGeometry(QtCore.QRect(int(scale*225), int(scale*180), int(scale*70), int(scale*30))) + + self.pushButton_3 = QtWidgets.QPushButton("<", self) + self.pushButton_3.setGeometry(QtCore.QRect(int(scale*225), int(scale*220), int(scale*70), int(scale*30))) + + self.pushButton_4 = QtWidgets.QPushButton("<<", self) + self.pushButton_4.setGeometry(QtCore.QRect(int(scale*225), int(scale*260), int(scale*70), int(scale*30))) + + self.pushButton_5 = QtWidgets.QPushButton("Submit", self) + self.pushButton_5.setGeometry(QtCore.QRect(int(scale*190), int(scale*400), int(scale*140), int(scale*35))) + self.pushButton_5.setDefault(True) + + self.pushButton.clicked.connect(self.move_all_to_selected) + self.pushButton_2.clicked.connect(self.move_selected_to_selected) + self.pushButton_3.clicked.connect(self.move_selected_to_available) + self.pushButton_4.clicked.connect(self.move_all_to_available) + self.pushButton_5.clicked.connect(self.accept) + + self.listWidget.itemSelectionChanged.connect(self.update_buttons_status) + self.listWidget_2.itemSelectionChanged.connect(self.update_buttons_status) + + self.update_buttons_status() + + def update_buttons_status(self): + self.pushButton_2.setDisabled(not bool(self.listWidget.selectedItems())) + self.pushButton_3.setDisabled(not bool(self.listWidget_2.selectedItems())) + + def move_selected_to_selected(self): + for item in self.listWidget.selectedItems(): + self.listWidget_2.addItem(item.text()) + for item in self.listWidget.selectedItems(): + self.listWidget.takeItem(self.listWidget.row(item)) + + def move_selected_to_available(self): + for item in self.listWidget_2.selectedItems(): + self.listWidget.addItem(item.text()) + for item in self.listWidget_2.selectedItems(): + self.listWidget_2.takeItem(self.listWidget_2.row(item)) + + def move_all_to_selected(self): + while self.listWidget.count() > 0: + self.listWidget_2.addItem(self.listWidget.takeItem(0).text()) + + def move_all_to_available(self): + while self.listWidget_2.count() > 0: + self.listWidget.addItem(self.listWidget_2.takeItem(0).text()) + + def move_to_selected(self, item): + self.listWidget_2.addItem(item.text()) + self.listWidget.takeItem(self.listWidget.row(item)) + + def move_to_available(self, item): + self.listWidget.addItem(item.text()) + self.listWidget_2.takeItem(self.listWidget_2.row(item)) + + def get_selected_items(self): + return [self.listWidget_2.item(i).text() for i in range(self.listWidget_2.count())] + + def set_styles(self): + brown = "#925a5b" + grey = "#8e8e8e" + white = "#ffffff" + + button_style = f""" + QPushButton {{ + background-color: {brown}; + color: {white}; + border-radius: 6px; + font-size: 22px; + padding: 6px 18px; + border: none; + }} + QPushButton:disabled {{ + background-color: {grey}; + color: {white}; + }} + """ + for btn in [self.pushButton, self.pushButton_2, self.pushButton_3, self.pushButton_4, self.pushButton_5]: + btn.setStyleSheet(button_style) + + list_item_style = """ + QListWidget::item { + font-size: 24px; + color: black; + margin: 2px 0px; + } + """ + scrollbar_style = f""" + QScrollBar:vertical {{ + border: none; + background: #f5f5f5; + width: 12px; + border-radius: 6px; + }} + QScrollBar::handle:vertical {{ + background: {grey}; + min-height: 20px; + border-radius: 6px; + }} + QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {{ + background: none; + height: 0px; + }} + QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {{ + background: none; + }} + QScrollBar:horizontal {{ + height: 0px; + }} + """ + self.listWidget.setStyleSheet(list_item_style + scrollbar_style) + self.listWidget_2.setStyleSheet(list_item_style + scrollbar_style) + + + + + + + + +class PlateGirderWelded(Member): + int_thicklist = [] + long_thicklist = [] + + def __init__(self): + super(PlateGirderWelded, self).__init__() + self.design_status = False + + + + ############################################### + # Design Preference Functions Start + ############################################### + def tab_list(self): + + """ + + :return: This function returns the list of tuples. Each tuple will create a tab in design preferences, in the + order they are appended. Format of the Tuple is: + [Tab Title, Type of Tab, function for tab content) + Tab Title : Text which is displayed as Title of Tab, + Type of Tab: There are Three types of tab layouts. + Type_TAB_1: This have "Add", "Clear", "Download xlsx file" "Import xlsx file" + TYPE_TAB_2: This contains a Text box for side note. + TYPE_TAB_3: This is plain layout + function for tab content: All the values like labels, input widgets can be passed as list of tuples, + which will be displayed in chosen tab layout + + """ + tabs = [] + + t1 = (KEY_DISP_GIRDERSEC, TYPE_TAB_1, self.tab_girder_sec) + tabs.append(t1) + + t5 = ("Optimisation", TYPE_TAB_2, self.optimization_tab_welded_plate_girder_design) + tabs.append(t5) + + t1 = ("Stiffeners", TYPE_TAB_2, self.Stiffener_design) + tabs.append(t1) + + t1 = ("Additional Girder Data", TYPE_TAB_2, self.girder_geometry) + tabs.append(t1) + + t5 = ("Design", TYPE_TAB_2, self.design_values) + tabs.append(t5) + + t6 = ("Deflection" , TYPE_TAB_2, self.deflection_values) + tabs.append(t6) + + return tabs + + def tab_value_changed(self): + change_tab = [] + + t1 = (KEY_DISP_GIRDERSEC, [KEY_SEC_MATERIAL], [KEY_SEC_FU, KEY_SEC_FY], TYPE_TEXTBOX, self.get_fu_fy_I_section_plate_girder) + change_tab.append(t1) + + t4 = (KEY_DISP_GIRDERSEC, ['Label_6', 'Label_7', 'Label_8', 'Label_9', 'Label_10', 'Label_11'], + ['Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', + 'Label_19', 'Label_20', 'Label_21', 'Label_22','Label_23'], TYPE_TEXTBOX, self.Unsymm_I_Section_properties) + change_tab.append(t4) + + t9 = ("Deflection", [KEY_STR_TYPE], [KEY_MEMBER_OPTIONS], TYPE_COMBOBOX, self.member_options_change) + change_tab.append(t9) + t9 = ("Deflection", [KEY_MEMBER_OPTIONS], [KEY_SUPPORTING_OPTIONS], TYPE_COMBOBOX, self.supp_options_change) + change_tab.append(t9) + t9 = ("Deflection", [KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_SUPPORTING_OPTIONS], [KEY_MAX_DEFL], TYPE_TEXTBOX, self.max_defl_change) + change_tab.append(t9) + t10 = ("Stiffeners", [KEY_IntermediateStiffener_thickness], [KEY_IntermediateStiffener_thickness_val], TYPE_COMBOBOX, self.Int_stiffener_thickness_customized) + change_tab.append(t10) + t11 = ("Stiffeners", [KEY_LongitudnalStiffener_thickness], [KEY_LongitudnalStiffener_thickness_val], TYPE_COMBOBOX, self.Long_stiffener_thickness_customized) + change_tab.append(t11) + + + # t10 = ('Stiffeners',[KEY_WEB_PHILOSOPHY],[KEY_IntermediateStiffener_spacing],TYPE_TEXTBOX,self.Intm_stiffener_spacing_change) + # change_tab.append(t10) + + + + return change_tab + + def edit_tabs(self): + """ This function is required if the tab name changes based on connectivity or profile or any other key. + Not required for this module but empty list should be passed""" + return [] + + def input_dictionary_design_pref(self): + """ + + :return: This function is used to choose values of design preferences to be saved to design dictionary. + + It returns list of tuple which contains, tab name, input widget type of keys, keys whose values to be saved, + + [(Tab Name, input widget type of keys, [List of keys to be saved])] + + """ + design_input = [] + + t1 = (KEY_DISP_GIRDERSEC, TYPE_COMBOBOX, [KEY_SEC_MATERIAL])#Need to check + design_input.append(t1) + + t1 = (KEY_DISP_GIRDERSEC, TYPE_TEXTBOX, [KEY_SEC_FU, KEY_SEC_FY]) + design_input.append(t1) + + t2 = ("Optimisation", TYPE_TEXTBOX, [KEY_EFFECTIVE_AREA_PARA, KEY_LENGTH_OVERWRITE]) # , KEY_STEEL_COST + design_input.append(t2) + + t2 = ("Optimisation", TYPE_COMBOBOX, [KEY_ALLOW_CLASS, KEY_LOAD]) # , KEY_STEEL_COST + design_input.append(t2) + + t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_IntermediateStiffener,KEY_LongitudnalStiffener,KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness]) + design_input.append(t2) + + t2 = ("Stiffeners", TYPE_TEXTBOX, [KEY_IntermediateStiffener_spacing]) + design_input.append(t2) + + t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_ShearBucklingOption,KEY_IntermediateStiffener_thickness_val,KEY_LongitudnalStiffener_thickness_val]) + design_input.append(t2) + + t2 = ("Additional Girder Data", TYPE_COMBOBOX, [KEY_IS_IT_SYMMETRIC]) + design_input.append(t2) + + t6 = ("Design", TYPE_COMBOBOX, [KEY_DP_DESIGN_METHOD]) + design_input.append(t6) + + t7 = ("Deflection",TYPE_COMBOBOX, [KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_SUPPORTING_OPTIONS]) + design_input.append(t7) + t7 = ("Deflection",TYPE_TEXTBOX, [KEY_MAX_DEFL]) + design_input.append(t7) + + return design_input + + def input_dictionary_without_design_pref(self): + + design_input = [] + + t2 = (KEY_MATERIAL, [KEY_DP_DESIGN_METHOD], 'Input Dock') + design_input.append(t2) + + t2 = (None, [KEY_ALLOW_CLASS, KEY_EFFECTIVE_AREA_PARA, KEY_LENGTH_OVERWRITE, KEY_LOAD, KEY_DP_DESIGN_METHOD,KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_MAX_DEFL, + KEY_SUPPORTING_OPTIONS,KEY_ShearBucklingOption, KEY_IntermediateStiffener_spacing, KEY_IntermediateStiffener,KEY_LongitudnalStiffener,KEY_IntermediateStiffener_thickness_val,KEY_LongitudnalStiffener_thickness_val, + KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness, KEY_IS_IT_SYMMETRIC], '') + design_input.append(t2) + + return design_input + + def refresh_input_dock(self): + + add_buttons = [] + + return add_buttons + + def get_values_for_design_pref(self, key, design_dictionary): + # if design_dictionary[KEY_MATERIAL] != 'Select Material': + # material = Material(design_dictionary[KEY_MATERIAL], 41) + # material_grade = design_dictionary[KEY_MATERIAL] + # fu = material.fu + # fy = material.fy + # else: + # fu = '' + # fy = '' + + + + val = { + KEY_ALLOW_CLASS: 'Yes', + KEY_EFFECTIVE_AREA_PARA: '1.0', + KEY_LENGTH_OVERWRITE: 'NA', + KEY_LOAD: 'Normal', + KEY_DP_DESIGN_METHOD: "Limit State Design", + KEY_ShearBucklingOption: KEY_DISP_SB_Option[0], + KEY_IS_IT_SYMMETRIC: 'Symmetrical', + KEY_IntermediateStiffener_spacing:'NA', + KEY_IntermediateStiffener: 'No', + KEY_IntermediateStiffener_thickness:'All', + KEY_LongitudnalStiffener: 'Yes and 1 stiffener', + KEY_LongitudnalStiffener_thickness:'All', + KEY_STR_TYPE:'Highway Bridge', + KEY_DESIGN_LOAD:'Live Load', + KEY_MEMBER_OPTIONS :'Simple Span', + KEY_SUPPORTING_OPTIONS: 'NA', + KEY_MAX_DEFL : 'Span/600', + KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS, + KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS + }[key] + + return val + def member_options_change(self): + if self[0] == KEY_DISP_STR_TYP3: + return {KEY_MEMBER_OPTIONS : VALUES_MEMBER_OPTIONS[1]} + elif self[0] == KEY_DISP_STR_TYP4: + return {KEY_MEMBER_OPTIONS :VALUES_MEMBER_OPTIONS[2]} + else: + return {KEY_MEMBER_OPTIONS : VALUES_MEMBER_OPTIONS[0]} + + + def supp_options_change(self): + if self[0] in ['Purlin and Girts', 'Simple span', 'Cantilever span']: + return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_PSC} + elif self[0] == 'Rafter Supporting': + return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_RS} + elif self[0] == 'Gantry': + return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_GNT} + elif self[0] in ['Floor and roof', 'Cantilever']: + return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_FRC} + else: + return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_DEF} + + def max_defl_change(self): + if self[0] in ['Highway Bridge','Railway Bridge']: + if self[2] == 'Simple Span': + if self[1] == 'Live load': + return {KEY_MAX_DEFL :VALUES_MAX_DEFL[0]} + elif self[1] == 'Dead load': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[1]} + else: + return {KEY_MAX_DEFL : 'NA'} + + else: + if self[1] == 'Live load': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[2]} + elif self[1] == 'Dead load': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[1]} + else: + return {KEY_MAX_DEFL : 'NA'} + + elif self[0] == 'Other Building': + if self[1] == 'Live load': + if self[2] == 'Floor and roof': + if self[3] == 'Elements not susceptible to cracking': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[3]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[4]} + else: + if self[3] == 'Elements not susceptible to cracking': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[5]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[6]} + else: + return {KEY_MAX_DEFL : 'NA'} + else: + if self[2] == 'Purlin and Girts' and self[1] == 'Live load': + if self[3] == 'Elastic cladding': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[5]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[6]} + elif self[2] == 'Simple span' and self[1] == 'Live load': + if self[3] == 'Elastic cladding': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[7]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[3]} + elif self[2] == 'Cantilever span' and self[1] == 'Live load': + if self[3] == 'Elastic cladding': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[8]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[5]} + elif self[2] == 'Rafter Supporting' and self[1] == 'Live load': + if self[3] == 'Profiled Metal sheeting': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[6]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[7]} + elif self[2] == 'Gantry' and self[1] == 'Live load': + if self[1] == 'Crane Load(Manual operation)': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[9]} + elif self[1] == 'Crane load(Electric operation up to 50t)': + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[10]} + else: + return {KEY_MAX_DEFL : VALUES_MAX_DEFL[11]} + else: + return {KEY_MAX_DEFL : 'NA'} + + def Int_stiffener_thickness_customized(self): + selected_items = [] + if self[0] == 'All': + return {KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS} + else: + popup = PopupDialog() + popup.listWidget.addItems(VALUES_STIFFENER_THICKNESS) # Set available items + if popup.exec_() == QDialog.Accepted: + selected_items = popup.get_selected_items() + # print("Selected:", selected_items) + PlateGirderWelded.int_thicklist = selected_items + return {KEY_IntermediateStiffener_thickness_val : selected_items} + + def Long_stiffener_thickness_customized(self): + selected_items2 = [] + if self[0] == 'All': + return {KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS} + else: + popup = PopupDialog() + popup.listWidget.addItems(VALUES_STIFFENER_THICKNESS) # Set available items + if popup.exec_() == QDialog.Accepted: + selected_items2 = popup.get_selected_items() + # print("Selected:", selected_items2) + PlateGirderWelded.long_thicklist = selected_items2 + return {KEY_LongitudnalStiffener_thickness_val : selected_items2} + + #################################### + # Design Preference Functions End + #################################### + # Setting up logger and Input and Output Docks + #################################### + def module_name(self): + print('in module') + return KEY_DISP_PLATE_GIRDER_WELDED + + + def set_osdaglogger(key): + """ + Set logger for Column Design Module. + """ + global logger + logger = logging.getLogger('Osdag') + + logger.setLevel(logging.DEBUG) + handler = logging.StreamHandler() + formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + + handler.setFormatter(formatter) + logger.addHandler(handler) + handler = logging.FileHandler('logging_text.log') + + formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + handler.setFormatter(formatter) + logger.addHandler(handler) + + if key is not None: + handler = OurLog(key) + formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + handler.setFormatter(formatter) + logger.addHandler(handler) + + def customized_input(self): + + c_lst = [] + # t1 = (KEY_SECSIZE, self.fn_profile_section) + # c_lst.append(t1) + t1 = (KEY_TOP_FLANGE_THICKNESS_PG, self.plate_thick_customized) + c_lst.append(t1) + + t2 = (KEY_BOTTOM_FLANGE_THICKNESS_PG, self.plate_thick_customized) + c_lst.append(t2) + + t3= (KEY_WEB_THICKNESS_PG, self.plate_thick_customized) + c_lst.append(t3) + + # t4 = (KEY_LongitudnalStiffener_thickness,self.long_stf_thk_customized) + # c_lst.append(t4) + return c_lst + + + + def input_values(self): + + self.module = KEY_DISP_PLATE_GIRDER_WELDED + options_list = [] + + t1 = (None, KEY_DISP_PG_SectionDetail, TYPE_TITLE, None, True, 'No Validator') + options_list.append(t1) + + t1 = (KEY_MODULE, KEY_DISP_PLATE_GIRDER_WELDED, TYPE_MODULE, None, True, "No Validator") + options_list.append(t1) + + t4 = (KEY_MATERIAL, KEY_DISP_MATERIAL, TYPE_COMBOBOX, VALUES_MATERIAL, True, 'No Validator') + options_list.append(t4) + + t2 = (KEY_OVERALL_DEPTH_PG_TYPE, KEY_DISP_OVERALL_DEPTH_PG_TYPE, TYPE_COMBOBOX, VALUES_DEPTH_PG, True, 'No Validator') + options_list.append(t2) + t33 = (KEY_OVERALL_DEPTH_PG, KEY_DISP_OVERALL_DEPTH_PG, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t33) + + t4 = (KEY_WEB_THICKNESS_PG, KEY_DISP_WEB_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, + 'Int Validator') + options_list.append(t4) + + # t2 = (KEY_TOP_Bflange_PG_Type, KEY_DISP_TOP_Bflange_PG_Type, TYPE_COMBOBOX, VALUES_DEPTH_PG, True, 'No Validator') + # options_list.append(t2) + + t2 = (KEY_TOP_Bflange_PG, KEY_DISP_TOP_Bflange_PG, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t2) + + t4 = (KEY_TOP_FLANGE_THICKNESS_PG, KEY_DISP_TOP_FLANGE_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, 'Int Validator') + options_list.append(t4) + + # t2 = (KEY_BOTTOM_Bflange_PG_Type, KEY_DISP_BOTTOM_Bflange_PG_Type, TYPE_COMBOBOX, VALUES_DEPTH_PG, True, 'No Validator') + # options_list.append(t2) + t22 = (KEY_BOTTOM_Bflange_PG, KEY_DISP_BOTTOM_Bflange_PG, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t22) + + t4 = (KEY_BOTTOM_FLANGE_THICKNESS_PG, KEY_DISP_BOTTOM_FLANGE_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, + 'No Validator') + options_list.append(t4) + + t2 = (KEY_LENGTH, KEY_DISP_LENGTH, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t2) + + t1 = (None, KEY_DISP_SECTION_DATA_PG, TYPE_TITLE, None, True, 'No Validator') + options_list.append(t1) + + t2 = ( + KEY_DESIGN_TYPE_FLEXURE, + KEY_BEAM_SUPP_TYPE, + TYPE_COMBOBOX, + VALUES_SUPP_TYPE_temp, + True, + "No Validator", + ) + options_list.append(t2) + + #t4 = (KEY_STR_TYPE, KEY_DISP_STR_TYPE, TYPE_COMBOBOX, KEY_DISP_STR_TYPE_list, True, 'No Validator') + #options_list.append(t4) + t5 = (KEY_SUPPORT_WIDTH, KEY_DISP_SUPPORT_WIDTH, TYPE_TEXTBOX, None, True, 'Int Validator') + options_list.append(t5) + + t4 = (KEY_WEB_PHILOSOPHY, KEY_DISP_WEB_PHILOSOPHY, TYPE_COMBOBOX, WEB_PHILOSOPHY_list, True, 'No Validator') + options_list.append(t4) + + t10 = (KEY_TORSIONAL_RES, DISP_TORSIONAL_RES, TYPE_COMBOBOX, Torsion_Restraint_list, True, 'No Validator') + options_list.append(t10) + + t11 = (KEY_WARPING_RES, DISP_WARPING_RES, TYPE_COMBOBOX, Warping_Restraint_list, True, 'No Validator') + options_list.append(t11) + + t7 = (None, KEY_LOADING, TYPE_TITLE, None, True, 'No Validator') + options_list.append(t7) + + t8 = (KEY_MOMENT, KEY_DISP_MOMENT, TYPE_TEXTBOX, None, True, 'No Validator') + options_list.append(t8) + + t8 = (KEY_SHEAR, KEY_DISP_SHEAR, TYPE_TEXTBOX, None, True, 'No Validator') + options_list.append(t8) + + t8= (KEY_BENDING_MOMENT_SHAPE, KEY_DISP_BENDING_MOMENT_SHAPE, TYPE_COMBOBOX, Bending_moment_shape_list, True, + 'No Validator' ) + options_list.append(t8) + + t15 = (KEY_IMAGE, None, TYPE_IMAGE_BIGGER, VALUES_IMAGE_PLATEGIRDER[0], True,'No Validator') + options_list.append(t15) + return options_list + + def fn_torsion_warping(self): + print( 'Inside fn_torsion_warping', self) + if self[0] == Torsion_Restraint1: + return Warping_Restraint_list + elif self[0] == Torsion_Restraint2: + return [Warping_Restraint5] + else: + return [Warping_Restraint5] + + def axis_bending_change(self): + design = self[0] + print( 'Inside fn_supp_image', self) + if self[0] == KEY_DISP_DESIGN_TYPE_FLEXURE: + return ['NA'] + else: + return VALUES_BENDING_TYPE + + def fn_conn_image(self): + + "Function to populate section images based on the type of section " + img = self[0] + if img == Bending_moment_shape_list[0]: + return VALUES_IMAGE_PLATEGIRDER[0] + elif img ==Bending_moment_shape_list[1]: + return VALUES_IMAGE_PLATEGIRDER[1] + elif img ==Bending_moment_shape_list[2]: + return VALUES_IMAGE_PLATEGIRDER[2] + elif img ==Bending_moment_shape_list[3]: + return VALUES_IMAGE_PLATEGIRDER[3] + else: + return VALUES_IMAGE_PLATEGIRDER[4] + + def customized_dimensions(self): + conn = self[0] + if conn == "Customized": + return KEY_DISP_OVERALL_DEPTH_PG + else: + return '' + + def customized_dimensions_1(self): + conn = self[0] + if conn == "Customized": + return KEY_DISP_TOP_Bflange_PG + else: + return '' + + def customized_dimensions_2(self): + conn = self[0] + if conn == "Customized": + return KEY_DISP_BOTTOM_Bflange_PG + else: + return '' + + def customized_dims(self): + conn = self[0] + if conn == "Customized": + return TYPE_TEXTBOX + else: + return '' + + def customized_options(self): + conn = self[0] + if conn == "Customized": + return VALUES_PLATETHK + else: + return VALUES_OPT + + + def input_value_changed(self): + + lst = [] + t1 = ([KEY_BENDING_MOMENT_SHAPE], KEY_IMAGE, TYPE_IMAGE, self.fn_conn_image) + lst.append(t1) + + t3 = ([KEY_TORSIONAL_RES], KEY_WARPING_RES, TYPE_COMBOBOX, self.fn_torsion_warping) + lst.append(t3) + + t44 = ([KEY_OVERALL_DEPTH_PG_TYPE],KEY_OVERALL_DEPTH_PG, TYPE_LABEL, self.customized_dimensions) + lst.append(t44) + t45 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_OVERALL_DEPTH_PG, TYPE_TEXTBOX, self.customized_dims) + lst.append(t45) + t46 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_WEB_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) + lst.append(t46) + + t2 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_LABEL, self.customized_dimensions_1) + lst.append(t2) + t3 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) + lst.append(t3) + t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) + lst.append(t47) + + t23 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_Bflange_PG, TYPE_LABEL, self.customized_dimensions_2) + lst.append(t23) + t24 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) + lst.append(t24) + t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) + lst.append(t47) + + t3 = ([KEY_MATERIAL], KEY_MATERIAL, TYPE_CUSTOM_MATERIAL, self.new_material) + lst.append(t3) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_T_constatnt, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_T_constatnt, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_W_constatnt, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_W_constatnt, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_SR_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_SR_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_NON_DIM_ESR_LTB, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_NON_DIM_ESR_LTB, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_Elastic_CM, TYPE_OUT_LABEL, self.output_modifier) + lst.append(t18) + + t18 = ([KEY_DESIGN_TYPE_FLEXURE], + KEY_Elastic_CM, TYPE_OUT_DOCK, self.output_modifier) + lst.append(t18) + + t19 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_thickness,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t19) + + t20 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_thickness,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t20) + + t21 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_thickness,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t21) + + t22 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_thickness,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t22) + + t23 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_spacing,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t23) + + t24 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_spacing,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t24) + + t25 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t25) + + t26 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t26) + + return lst + + def warning_majorbending(self): + print(self) + if self[0] == VALUES_SUPP_TYPE_temp[2]: + return True + # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : + # return True + else: + return False + + def output_modifier(self): + print(self) + if self[0] == VALUES_SUPP_TYPE_temp[2]: + return False + # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : + # return True + else: + return True + + def output_modifier2(self): + print(self) + if self[0] == 'Thin Web with ITS': + return False + # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : + # return True + else: + return True + + def Design_pref_modifier(self): + print("Design_pref_modifier",self) + + + def output_values(self, flag): + + out_list = [] + + t0 = (None, DISP_TITLE_STRUT_SECTION, TYPE_TITLE, None, True) + out_list.append(t0) + + t1 = (KEY_TITLE_OPTIMUM_DESIGNATION, KEY_DISP_TITLE_OPTIMUM_DESIGNATION, TYPE_TEXTBOX, + self.result_designation if flag else '', True) + out_list.append(t1) + + t2 = ( + KEY_OPTIMUM_UR_COMPRESSION, KEY_DISP_OPTIMUM_UR_COMPRESSION, TYPE_TEXTBOX, round(self.result_UR,3) if flag else '', True) + out_list.append(t2) + + t3 = (KEY_OPTIMUM_SC, KEY_DISP_OPTIMUM_SC, TYPE_TEXTBOX, self.section_classification_val if flag else '', True) + out_list.append(t3) + + t4 = (KEY_betab_constatnt,KEY_DISP_betab_constatnt, TYPE_TEXTBOX, + self.betab if flag else '', True) + out_list.append(t4) + + t5 = ( + KEY_EFF_SEC_AREA, KEY_DISP_EFF_SEC_AREA, TYPE_TEXTBOX, self.effectivearea if flag else '', + True) + out_list.append(t5) + + # t6 = (None,"Design Results" , TYPE_TITLE, None, True) + # out_list.append(t6) + + + + + + # t9 = (None, KEY_DISP_DESIGN_STIFFER , TYPE_TITLE, None, True) + # out_list.append(t9) + + t10 = (KEY_IntermediateStiffener_thickness, KEY_DISP_IntermediateStiffener_thickness, TYPE_TEXTBOX, + self.intstiffener_thk if flag else '', True) + out_list.append(t10) + + t10 = (KEY_IntermediateStiffener_spacing, KEY_DISP_IntermediateStiffener_spacing, TYPE_TEXTBOX, + self.intstiffener_spacing if flag else '', True) + out_list.append(t10) + + t1 = (KEY_LongitudnalStiffener_thickness, KEY_DISP_LongitudnalStiffener_thickness, TYPE_TEXTBOX, + self.longstiffener_thk if flag else '', True) + out_list.append(t1) + + t1 = (KEY_LongitudnalStiffener_numbers, KEY_DISP_LongitudnalStiffener_numbers, TYPE_TEXTBOX, '', True) + out_list.append(t1) + + t2 = (KEY_EndpanelStiffener_thickness, KEY_DISP_EndpanelStiffener_thickness, TYPE_TEXTBOX, + '', True) + out_list.append(t2) + + t1 = (KEY_MOMENT_STRENGTH, KEY_DISP_MOMENT, TYPE_TEXTBOX, + self.design_moment if flag else '', True) + out_list.append(t1) + + # t1 = (None, KEY_DISP_WELD_DESIGN, TYPE_TITLE, None, True) + # out_list.append(t1) + + t1 = (KEY_WeldWebtoflange, KEY_DISP_WeldWebtoflange, TYPE_TEXTBOX, + '', True) + out_list.append(t1) + + t1 = (KEY_WeldStiffenertoweb, KEY_DISP_WeldStiffenertoweb, TYPE_TEXTBOX, + '', True) + out_list.append(t1) + + # t1 = (None, KEY_DISP_LTB, TYPE_TITLE, None, False) + # out_list.append(t1) + + t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, + self.torsion_cnst if flag else '', False) + out_list.append(t2) + + t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.warping_cnst if flag else '', False) + out_list.append(t2) + + t2 = ( + KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, '', + False) + out_list.append(t2) + + t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, '', False) + out_list.append(t2) + + t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, '', False) + out_list.append(t2) + + t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, + '', False) + out_list.append(t1) + + t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.critical_moment if flag else '', False) + out_list.append(t2) + + # TODO @Rutvik: can add tab button for asthetics + + # t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, + # self.result_tc if flag else '', False) + # out_list.append(t2) + + # t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.result_wc if flag else '', False) + # out_list.append(t2) + + # t2 = ( + # KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, self.result_IF_lt if flag else '', + # False) + # out_list.append(t2) + + # t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, self.result_srf_lt if flag else '', False) + # out_list.append(t2) + + # t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, self.result_nd_esr_lt if flag else '', False) + # out_list.append(t2) + + # t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, + # self.result_fcd__lt if flag else + # '', False) + # out_list.append(t1) + + # t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.result_mcr if flag else '', False) + # out_list.append(t2) + + # t1 = (None, KEY_PERFORMANCE_EVALUATION, TYPE_TITLE, None, True) + # out_list.append(t1) + # + # t2 = (KEY_ESR, KEY_DISP_UTILIZATION_RATION_PG , TYPE_TEXTBOX, self.result_eff_sr if flag else '', True) + # out_list.append(t2) + # + # t2 = (KEY_EULER_BUCKLING_STRESS, KEY_DISP_PERMISSIBLE_PG, TYPE_TEXTBOX, + # self.result_ebs if flag else '', True) + # out_list.append(t2) + # + # t2 = (KEY_BUCKLING_CURVE, KEY_DISP_DEFLECTION_PG, TYPE_TEXTBOX, self.result_bc if flag else '', True) + # out_list.append(t2) + + return out_list + def spacing(self, status): + + spacing = [] + + t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, + self.result_tc if status else '', False) + spacing.append(t2) + + t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.result_wc if status else '', False) + spacing.append(t2) + + t2 = ( + KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, self.result_IF_lt if status else '', + False) + spacing.append(t2) + + t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, self.result_srf_lt if status else '', False) + spacing.append(t2) + + t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, self.result_nd_esr_lt if status else '', False) + spacing.append(t2) + + t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, + self.result_fcd__lt if status else + '', False) + spacing.append(t1) + + t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.result_mcr if status else '', False) + spacing.append(t2) + + return spacing + + def func_for_validation(self, design_dictionary): + print(f"func_for_validation here") + all_errors = [] + self.design_status = False + flag = False + self.output_values(self, flag) + flag1 = False + flag2 = False + flag3 = False + option_list = self.input_values(self) + missing_fields_list = [] + print(f'func_for_validation option_list {option_list}' + f"\n design_dictionary {design_dictionary}" + ) + for option in option_list: + if option[2] == TYPE_TEXTBOX or option[0] == KEY_LENGTH or option[0] == KEY_SHEAR or option[0] == KEY_MOMENT: + try: + if design_dictionary[option[0]] == '': + if design_dictionary['Total.Design_Type'] == 'Optimized': + if design_dictionary[KEY_OVERALL_DEPTH_PG] == '' or design_dictionary[KEY_TOP_Bflange_PG] == '' or design_dictionary[KEY_BOTTOM_Bflange_PG] == '': + pass + else: + missing_fields_list.append(option[1]) + continue + + else: + missing_fields_list.append(option[1]) + continue + if option[0] == KEY_LENGTH: + if float(design_dictionary[option[0]]) <= 0.0: + print("Input value(s) cannot be equal or less than zero.") + error = "Input value(s) cannot be equal or less than zero." + all_errors.append(error) + + else: + flag1 = True + elif option[0] == KEY_SHEAR: + if float(design_dictionary[option[0]]) <= 0.0: + print("Input value(s) cannot be equal or less than zero.") + error = "Input value(s) cannot be equal or less than zero." + all_errors.append(error) + else: + flag2 = True + elif option[0] == KEY_MOMENT: + if float(design_dictionary[option[0]]) <= 0.0: + print("Input value(s) cannot be equal or less than zero.") + error = "Input value(s) cannot be equal or less than zero." + all_errors.append(error) + else: + flag3 = True + except: + error = "Input value(s) are not valid" + all_errors.append(error) + + if len(missing_fields_list) > 0: + error = self.generate_missing_fields_error_string(self, missing_fields_list) + all_errors.append(error) + else: + flag = True + + if flag and flag1 and flag2 and flag3: + print(f"\n design_dictionary{design_dictionary}") + self.set_input_values(self, design_dictionary) + print("WORKING VALIDATION") + # if self.design_status ==False and len(self.failed_design_dict)>0: + # logger.error( + # "Design Failed, Check Design Report" + # ) + # return # ['Design Failed, Check Design Report'] @TODO + # elif self.design_status: + # pass + # else: + # logger.error( + # "Design Failed. Selender Sections Selected" + # ) + # return # ['Design Failed. Selender Sections Selected'] + else: + return all_errors + + def get_3d_components(self): + + components = [] + t3 = ('Model', self.call_3DModel) + components.append(t3) + + # t3 = ('Column', self.call_3DColumn) + # components.append(t3) + + return components + + # warn if a beam of older version of IS 808 is selected + def warn_text(self): + """ give logger warning when a beam from the older version of IS 808 is selected """ + global logger + red_list = red_list_function() + + if (self.sec_profile == VALUES_SEC_PROFILE[0]) or (self.sec_profile == VALUES_SEC_PROFILE[1]): # Beams or Columns + for section in self.sec_list: + if section in red_list: + logger.warning(" : You are using a section ({}) (in red color) that is not available in latest version of IS 808".format(section)) + + # Setting inputs from the input dock GUI + def set_input_values(self, design_dictionary): + self.module = design_dictionary[KEY_MODULE] + self.design_type = design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE] + self.section_class = None + if self.design_type == 'Optimized': + self.total_depth = 1 + self.web_thickness = 1 + self.top_flange_width = 1 + self.top_flange_thickness = 1 + self.bottom_flange_width = 1 + self.bottom_flange_thickness = 1 + + else: + + self.total_depth = float(design_dictionary[KEY_OVERALL_DEPTH_PG]) + self.web_thickness = float(design_dictionary[KEY_WEB_THICKNESS_PG][0]) + self.top_flange_width = float(design_dictionary[KEY_TOP_Bflange_PG]) + self.top_flange_thickness = float(design_dictionary[KEY_TOP_FLANGE_THICKNESS_PG][0]) + self.bottom_flange_width = float(design_dictionary[KEY_BOTTOM_Bflange_PG]) + self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) + + #3 list loops for V inp= self.Zp_req: + print( 'self.section_property.plast_sec_mod_z More than Requires',self.plast_sec_mod_z,self.Zp_req) + if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: + self.beta_b_lt = 1.0 + else: + self.beta_b_lt = (self.elast_sec_mod_z/ self.plast_sec_mod_z) + print("Beta value",self.beta_b_lt) + A_vg = (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness) * self.web_thickness + self.V_d = ((A_vg * self.material.fy) / (math.sqrt(3) * self.gamma_m0)) + print("Shear check",self.V_d, self.material.fy) + print("shear force ",self.load.shear_force) #V value self.load.shear_force + if IS800_2007.cl_8_2_1_2_high_shear_check(self.load.shear_force,self.V_d): + self.shear_type = 'High' #high shear + if self.support_type == 'Major Laterally Supported': + if self.web_philosophy == 'Thick Web without ITS': + if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): + self.Mdv = self.calc_Mdv(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.moment_ratio = self.load.moment / self.Mdv + print("Ratio for moment", self.moment_ratio) + self.web_buckling_check(self) + print("Bending moment",self.Mdv/1000000) + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + self.material.fy, + self.gamma_m0, + slenderness_input, + self.material.modulus_of_elasticity + ) + + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + + + + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #buckling method + c = 0 + if self.c != 'NA': + c = float(self.c) + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): + print("Check passed") + else: + print("Check Failed") + else: #tension field + pass + #to add tension field check + + + + + else: + logger.error("Web thickness is not sufficient\n Re-enter new thickness") + + else: #thin web condition + + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + else: + # assuming stiffner thickness is a val for now - to add list parsing + # Simple post critical check + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): + print("Simple Post Critical Check passed") + else: + print("Simple Post Critical Check Failed") + # intermediate stiffner shear check + if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): + print("Shear Intermediate check passed") + else: + print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") + #end stiffener check + if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): + print("End stiffner check okay") + else: + print("CHECK THE NEXT THICKNESS") + + + #longitudnal stiffner check + if self.long_Stiffner == 'Yes': + print("Checking long stiffener") + if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): + logger.error("Longitudnal Stiffner thickess is less than required") + else: + print("Longitudnal Stiffner check passed") + + #Intermediate stiffner check + self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) + if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): + print("Stiffener provided is OKAY") + else: + print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") + + else: #tension field + + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + c = float(self.c) + if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): + print("Check passed") + else: + print("Check Failed") + + if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + print("End stiffner TF check okay") + else: + print("CHECK THE NEXT THICKNESS") + + + + + else: #unsupported type + if self.web_philosophy == 'Thick Web without ITS': + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + self.material.fy, + self.gamma_m0, + slenderness_input, + self.material.modulus_of_elasticity + ) + + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + + else: #thin web condition + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + else: + # assuming stiffner thickness is a val for now - to add list parsing + # Simple post critical check + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): + print("Simple Post Critical Check passed") + else: + print("Simple Post Critical Check Failed") + # intermediate stiffner shear check + if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): + print("Shear Intermediate check passed") + else: + print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") + #end stiffener check + if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): + print("End stiffner check okay") + else: + print("CHECK THE NEXT THICKNESS") + + + #longitudnal stiffner check + if self.long_Stiffner == 'Yes': + print("Checking long stiffener") + if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): + logger.error("Longitudnal Stiffner thickess is less than required") + else: + print("Longitudnal Stiffner check passed") + + #Intermediate stiffner check + self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) + if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): + print("Stiffener provided is OKAY") + else: + print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") + else: #tension field + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + c = float(self.c) + if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): + print("Check passed") + else: + print("Check Failed") + + if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + print("End stiffner TF check okay") + else: + print("CHECK THE NEXT THICKNESS") + + + G = 0.769 * 10**5 + Kw = self.get_K_from_warping_restraint(self,self.warping) + Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, self.It, self.Iw, self.effective_length, Kw, self.total_depth, + self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, + self.loading_case, self.warping) + print("Input moment",self.load.moment) + print("It VAL",self.It, self.Iw) + self.Md = self.bending_check_lat_unsupported(self,self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, self.material.fy, self.M_cr,self.section_class) + + self.Mdv = self.calc_Mdv_lat_unsupported(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness,self.Md) + self.moment_ratio = self.load.moment/ self.Mdv + print("Ratio for moment", self.moment_ratio) + print("MDV",self.Mdv) + # print("supp mdv",self.Mdv) + if self.Mdv >= self.load.moment: + print("Section is passed") + else: + logger.error("Change the section") + + + else: #low shear + self.shear_type = 'Low' + if self.support_type == 'Major Laterally Supported': + if self.web_philosophy == 'Thick Web without ITS': + if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): + self.Md =self.beta_b_lt * self.plast_sec_mod_z * self.material.fy / self.gamma_m0 + print("Moment Capacity Md",self.Md/1000000, self.plast_sec_mod_z) + self.web_buckling_check(self) + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + self.material.fy, + self.gamma_m0, + slenderness_input, + self.material.modulus_of_elasticity + ) + + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #bukling method + c = 0 + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1000000 / lever_arm + if self.c != 'NA': + c = float(self.c) + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): + print("Check passed") + else: + print("Check Failed") + self.shear_ratio = self.load.shear_force / self.V_cr + print("Ratio for shear",self.shear_ratio) + else: + pass + else: + logger.error("Web thickness is not sufficient\n Re-enter new thickness") + + else: #thin web condition + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + else: + # assuming stiffner thickness is a val for now - to add list parsing + # Simple post critical check + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): + print("Simple Post Critical Check passed") + else: + print("Simple Post Critical Check Failed") + self.shear_ratio = self.load.shear_force / self.V_cr + print("Ratio for shear",self.shear_ratio) + # intermediate stiffner shear check + if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): + print("Shear Intermediate check passed") + else: + print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") + #end stiffener check + if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): + print("End stiffner check okay") + else: + print("CHECK THE NEXT THICKNESS") + + + #longitudnal stiffner check + if self.long_Stiffner == 'Yes': + print("Checking long stiffener") + if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): + logger.error("Longitudnal Stiffner thickess is less than required") + else: + print("Longitudnal Stiffner check passed") + + #Intermediate stiffner check + self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) + if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): + print("Stiffener provided is OKAY") + else: + print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") + + else: #tension field + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + c = float(self.c) + if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): + print("Check passed") + else: + print("Check Failed") + + if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + print("End stiffner TF check okay") + else: + print("CHECK THE NEXT THICKNESS") + + else: #unsupported + if self.web_philosophy == 'Thick Web without ITS': + self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) + + n1 = self.eff_depth / 2 + Ac = (self.b1 + n1) * self.web_thickness + slenderness_input = 2.5 * self.eff_depth / self.web_thickness + self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + self.material.fy, + self.gamma_m0, + slenderness_input, + self.material.modulus_of_elasticity + ) + + print("Web Buckling at ") + print(f"fcd: {self.fcd}N/mm2") + Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + print(f"Critical buckling load: {Critical_buckling_load}kN") + + #Web Crippling + print("Web Crippling") + n2= 2.5*self.top_flange_thickness + Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) + print(f"Critical crippling load: {Critical_crippling_load}kN") + else: #thin web + if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + else: + # assuming stiffner thickness is a val for now - to add list parsing + # Simple post critical check + if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): + print("Simple Post Critical Check passed") + else: + print("Simple Post Critical Check Failed") + # intermediate stiffner shear check + if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): + print("Shear Intermediate check passed") + else: + print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") + #end stiffener check + if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): + print("End stiffner check okay") + else: + print("CHECK THE NEXT THICKNESS") + + + #longitudnal stiffner check + if self.long_Stiffner == 'Yes': + print("Checking long stiffener") + if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): + logger.error("Longitudnal Stiffner thickess is less than required") + else: + print("Longitudnal Stiffner check passed") + + #Intermediate stiffner check + self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) + if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): + print("Stiffener provided is OKAY") + else: + print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") + else: #tension field + lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm + Nf = self.load.moment * 1_000_000 / lever_arm + if self.c == 'NA': + logger.error("Intermediate Stiffner Spacing cannot be 'NA'") + c = float(self.c) + if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): + print("Check passed") + else: + print("Check Failed") + + if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + print("End stiffner TF check okay") + else: + print("CHECK THE NEXT THICKNESS") + + G = 0.769 * 10**5 + Kw = self.get_K_from_warping_restraint(self,self.warping) + Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, self.It, self.Iw, self.effective_length, Kw, self.total_depth, + self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, + self.loading_case, self.warping) + print("Input moment",self.load.moment) + print("It VAL", self.It, self.Iw) + print("MCR VAL",self.M_cr) + self.Md = self.bending_check_lat_unsupported(self,self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, self.material.fy, self.M_cr,self.section_class) + self.moment_ratio = self.load.moment/ self.Md + print("Ratio for moment", self.moment_ratio) + print("MD",self.Md) + if self.Md >= self.load.moment: + print("Section is passed") + else: + logger.error("update the section size") + + + + self.design_status = False + self.final_format(self,design_dictionary) + + + def final_format(self,design_dictionary): + + self.result_designation = (str(int(self.total_depth)) + " x " +str(int(self.web_thickness)) + " x " +str(int(self.bottom_flange_width)) + " x " +str(int(self.bottom_flange_thickness)) + " x " +str(int(self.top_flange_width)) + " x " +str(int(self.top_flange_thickness))) + if self.moment_ratio == None: + self.moment_ratio = 0 + if self.shear_ratio == None: + self.shear_ratio = 0 + print(self.moment_ratio, self.shear_ratio) + self.result_UR = max(self.moment_ratio,self.shear_ratio) * 100 + self.section_classification_val = self.section_class + self.betab = round(self.beta_b_lt,2) + self.effectivearea = Unsymmetrical_I_Section_Properties.calc_area(self,self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + if self.shear_type == 'Low': + self.design_moment = round(self.Md/1000000,1) + else: + self.design_moment = round(self.Mdv/1000000,1) + if self.support_type == 'Major Laterally Unsupported': + self.critical_moment = round(self.M_cr/1000000,1) + self.torsion_cnst = round(self.It/10000,0) + self.warping_cnst = round(self.Iw/1000000,0) + self.intstiffener_thk = self.IntStiffThickness + self.longstiffener_thk = self.LongStiffThickness + self.intstiffener_spacing = self.c + self.design_status = True + + + + + + def effective_length_beam(self, design_dictionary, length): + if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': + self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported(Torsional=self.torsional_res,Warping=self.warping, + length=length,depth=(self.total_depth/1000),load=self.loading_condition) + print(f"Working 1 {self.effective_length}") + else: + try: + if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: + design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' + else: + length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) + + self.effective_length = length + print(f"Working 2 {self.effective_length}") + except: + print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) + logger.warning("Invalid Effective Length Parameter.") + logger.info('Effective Length Parameter is set to default: 1.0') + design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' + self.effective_length_beam(self, design_dictionary, length) + print(f"Working 3 {self.effective_length}") + print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) + + + + def web_buckling_check(self): + self.web_buckling = IS800_2007.cl_8_2_1_web_buckling( + d=self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness), + tw=self.web_thickness, + e=self.epsilon,) + print("Web buckling",self.web_buckling) + + # if not self.web_buckling_check: + # self.web_not_buckling_steps(self) + + def shear_buckling_check_simple_postcritical(self,eff_depth,A_vg,V,c=0): + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c/eff_depth < 1: + K_v = 4 + 5.35/(c/eff_depth)**2 + else: + K_v = 5.35 + 4/(c/eff_depth)**2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + print("V_cr value",self.V_cr) + if self.V_cr > V: + return True + else: + return False + + def shear_buckling_check_intermediate_stiffner(self,d,IntStiffThickness,IntStiffnerwidth,V_cr,tw): + I_x = ((((IntStiffnerwidth * 2) + tw )** 3 * (IntStiffThickness )) / 12)-(IntStiffThickness * tw ** 3 / 12) + A_s = IntStiffnerwidth * IntStiffThickness * 2 + r_x = (I_x / A_s) ** 0.5 + le = self.lefactor * d + slenderness_input = le / r_x + dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() + interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) + fcd = round(interp_val, 2) + self.Critical_buckling_load = round(A_s * fcd / 1000, 2) + print("Shear force ",self.load.shear_force) + self.F_q = (self.load.shear_force - V_cr) /self.gamma_m0 + print("Shear intermeditate stiffner f_q , cbl",self.F_q,self.Critical_buckling_load) + if self.F_q < self.Critical_buckling_load: + return True + else: + return False + + + def design_longitudinal_stiffeners(self,d, tw, c, eps_w, second_stiffener=False): + """ + Determine whether horizontal (longitudinal) stiffeners are required in a plate girder + and compute the minimum required second moment of area Is. + + Parameters + ---------- + d : float + Clear depth of web (distance between flanges), in mm (or consistent units). + tw : float + Web thickness, in mm. + c : float + Clear distance from compression - flange angles to the neutral axis, in mm. + eps_w : float + Web slenderness parameter ε_w = √(E/Fy), unitless. + second_stiffener : bool, optional + If True, assume a stiffener at the neutral axis will be provided (enabling Eq. 2.39). + + Returns + ------- + dict + { + 'required' : bool, # Is any stiffener required? + 'slenderness' : float, # Governing slenderness ratio used + 'limit' : float, # Allowable slenderness limit + 'locations' : tuple, # (x1, x2), distances from comp. flange to stiffeners + 'I1_min' : float, # Eq. 2.40: first stiffener Is ≥ 4·c·t_w³ + 'I2_min' : float, # Eq. 2.41: second stiffener Is ≥ d2²·t_w³, where d2=2·c + 'Imin_global' : float, # Eqs. 2.42 - 2.43: overall minimum stiffener Is + 'Is_required' : float # Governing Is = max(I1_min, I2_min, Imin_global) + } + + Notes + ----- + - Uses Eq. 2.36 - 2.38 for the unstiffened web checks; if `second_stiffener=True`, uses + Eq. 2.39 (d/tw ≤ 400·ε_w) instead. + - Locations: x1 = c/5 from compression flange; x2 = 0 (neutral axis). + """ + # 1) determine slenderness check + if second_stiffener: + # Eq. 2.39: when a stiffener is at the neutral axis + slenderness = d / tw + limit = 400 * eps_w + else: + if 2.4*d >= c >= d: + # Eq. 2.36 + slenderness = d / tw + limit = 250 * eps_w + elif d > c >= 0.74*d: + # Eq. 2.37 + slenderness = c / tw + limit = 250 * eps_w + else: + # c < 0.74 d → Eq. 2.38 + slenderness = d / tw + limit = 340 * eps_w + + required = slenderness > limit + + # 2) stiffener locations + x1 = c / 5.0 # first stiffener at 1/5 of c + x2 = 0.0 # second stiffener at neutral axis + + # 3) design criteria for Is + I1_min = 4.0 * c * tw**3 # Eq. 2.40 + d2 = 2.0 * c # twice clear distance to NA + I2_min = d2**2 * tw**3 # Eq. 2.41 + + # 4) global minimum (Eqs. 2.42–2.43) + cd_ratio = c / d + if cd_ratio >= math.sqrt(2): + Imin_global = 0.75 * d * tw**3 + else: + Imin_global = (1.5 * d * tw**3) / (c**2) + + Is_required = max(I1_min, I2_min, Imin_global) + Is_provided = (self.eff_width_longitudnal * (self.LongStiffThickness ** 3)) / 12 + + print("Req",Is_required,"Prov",Is_provided) + print(f"'required': {required} 'slenderness': {slenderness} 'limit': {limit},'locations': {(x1, x2)} 'I1_min': {I1_min} 'I2_min': {I2_min} 'Imin_global': {Imin_global} 'Is_required': {Is_required}") + + if Is_required > Is_provided: + return True + else: + return False + + # return { + # 'required': required, + # 'slenderness': slenderness, + # 'limit': limit, + # 'locations': (x1, x2), + # 'I1_min': I1_min, + # 'I2_min': I2_min, + # 'Imin_global': Imin_global, + # 'Is_required': Is_required + # } + + + + def simple_post_critical_end_stiffener(self,d, tw, fyw, V_cr, gamma_m0, c): + """ + Calculates simple-post critical end-panel stiffener requirements. + Parameters: + d : float : depth of web panel (mm) + tw : float : thickness of web (mm) + fyw : float : yield stress of web (MPa or N/mm²) + flange_width : float : outstanding flange width (mm) + gamma_m0 : float : partial safety factor for material + c : float : Stiffener spacing (mm) + + V_cr: critical shear buckling force (kN) + V_dp: panel shear strength (kN) + H_q: horizontal anchor force (kN) + R_tf: reaction force at stiffener (kN) + M_tf: moment demand at stiffener (kN·m) + stiffener_width: recommended stiffener width (mm) + max_thickness: maximum allowable stiffener thickness (mm) + """# Panel shear strength V_dp (kN) + V_dp = (d * tw * fyw / math.sqrt(3)) / 1000 + # Horizontal anchor force H_q (kN) + if V_dp <= V_cr: + # raise ValueError("Stiffeners not required: V_dp <= V_cr") + logger.error("Stiffeners not required: V_dp <= V_cr") + H_q = 0 + else: + H_q = 1.25 * V_dp * math.sqrt(1 - (V_cr / V_dp)) + # Reaction force R_tf (kN) + R_tf = H_q / 2 + A_v= d * tw + V_n= (fyw * A_v) /( 1000 * math.sqrt(3) * gamma_m0) + # Moment demand M_tf (kN·m) + M_tf = (H_q * d) / 10 + y = c / 2 + I = tw * c ** 3 / 12 + M_q = (I * fyw) / (gamma_m0 * y) + if V_n >= R_tf: + if M_q >= M_tf: + return True + return False + + def tension_field_end_stiffner(self,d,tw,fyw,V_tf,V_cr,shear_force,moment): + # Formula 1: H_q = 1.25·V_p·√[1 – (V_cr–V_p)/(V_tf–V_cr)] + V_dp = (d * tw * fyw * math.sqrt(3)) / 1000 + denom = V_tf - V_cr + rad = 1.0 - (V_cr - V_dp) / denom + if rad < 0: + raise ValueError(f"Negative radicand under sqrt: {rad:.3f}") + H_q = 1.25 * V_dp * math.sqrt(rad) + R_tf = H_q / 2 + A_v= d * tw + V_n= (fyw * A_v) /( 1000 * math.sqrt(3) * self.gamma_m0) + # Moment demand M_tf (kN·m) + M_tf = (H_q * d) / 10 + y = c / 2 + I = tw * c ** 3 / 12 + M_q = (I * fyw) / (self.gamma_m0 * y) + if V_n >= R_tf: + if M_q >= M_tf: + return True + return False + + + + def shear_buckling_check_tension_field(self,eff_depth,A_vg,c=0,Nf = 0): + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c/eff_depth < 1: + K_v = 4 + 5.35/(c/eff_depth)**2 + else: + K_v = 5.35 + 4/(c/eff_depth)**2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + phi,M_fr,s, w_tf,sai,fv,self.V_tf = IS800_2007.cl_8_4_2_2_TensionField( c, eff_depth, self.web_thickness, self.material.fy, self.top_flange_width,self.top_flange_thickness, self.material.fy,Nf, self.gamma_m0, A_vg,tau_b,self.load.shear_force) + print("vtf val",self.V_tf) + if self.V_tf >= self.load.shear_force: + return True + else: + return False + + def bending_check_lat_unsupported(self,beta_b_lt, plast_sec_mod_z, elast_sec_mod_z, fy, M_cr,section_class): + self.lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment(beta_b_lt,plast_sec_mod_z,elast_sec_mod_z,fy,M_cr) + + self.phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt(self.alpha_lt, self.lambda_lt) + self.X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor(self.phi_lt, self.lambda_lt) + self.fbd_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress(self.X_lt,fy, self.gamma_m0) + self.Md = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength(plast_sec_mod_z,elast_sec_mod_z,self.fbd_lt,section_class) + + + return round(self.Md,2) + + + def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only for major laterally supp + """ + Calculate Mdv for high shear conditions. + + Parameters: + V : Factored applied shear force + Vd : Design shear strength governed by web yielding/buckling + Zp : Plastic section modulus of the section (Z-axis) + Ze : Elastic section modulus of the section (Z-axis) + Fy : Yield strength of material + gamma_m0 : Partial safety factor for material + D : Total depth of section + tw : Thickness of the web + tf_top : Thickness of the top flange + tf_bot : Thickness of the bottom flange + + Returns: + Mdv : Design bending strength under high shear condition + """ + + # Calculating beta + beta = (2 * V / Vd - 1) ** 2 + + # Calculating Aw and Zfd + d = D - (tf_top + tf_bot) + Aw = d * tw + Zfd = Zp - (Aw * D / 4) + print("Aw",Aw,"Zfd",Zfd) + + # Calculating Mfd + Mfd = Zfd * Fy / gamma_m0 + + + # Calculating Md (Plastic Design Moment) + Md = Zp * Fy / gamma_m0 + + # Calculating Mdv + Mdv = Md - beta * (Md - Mfd) + + # Limiting value as per the provided formula + Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 + print("Mfd",Mfd/1000000,"Mdv",Mdv/1000000, "Mdv_limit",Mdv_limit/1000000) + + return round(min(Mdv, Mdv_limit), 2) + + def calc_Mdv_lat_unsupported(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot,Md): #only for major laterally supp + """ + Calculate Mdv for high shear conditions. + + Parameters: + V : Factored applied shear force + Vd : Design shear strength governed by web yielding/buckling + Zp : Plastic section modulus of the section (Z-axis) + Ze : Elastic section modulus of the section (Z-axis) + Fy : Yield strength of material + gamma_m0 : Partial safety factor for material + D : Total depth of section + tw : Thickness of the web + tf_top : Thickness of the top flange + tf_bot : Thickness of the bottom flange + + Returns: + Mdv : Design bending strength under high shear condition + """ + + # Calculating beta + beta = (2 * V / Vd - 1) ** 2 + + # Calculating Aw and Zfd + d = D - (tf_top + tf_bot) + Aw = d * tw + Zfd = Zp - (Aw * D / 4) + print("Aw", Aw, "Zfd", Zfd) + # Calculating Mfd + Mfd = Zfd * Fy / gamma_m0 + + # Calculating Mdv + Mdv = Md - beta * (Md - Mfd) + + # Limiting value as per the provided formula + Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 + print("Mfd",Mfd,"Mdv",Mdv, "Mdv_limit",Mdv_limit) + return round(min(Mdv, Mdv_limit), 2) + + def get_K_from_warping_restraint(self,warping_condition): + """ + Return effective length factor K based on exact warping restraint description (IS 800:2007, Clause E.1). + """ + if warping_condition == "Both flanges fully restrained": + return 0.5 + elif warping_condition == "Compression flange fully restrained": + return 0.7 + elif warping_condition == "Compression flange partially restrained": + return 0.85 + elif warping_condition == "Warping not restrained in both flanges": + return 1.0 + else: + raise ValueError("Invalid warping restraint. Use one of the four standard conditions.") + + def calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D): + """ + Calculate yj per IS 800:2007 Clause E.3.2.2. Returns 0 for symmetric sections. + """ + if Bf_top == Bf_bot and tf_top == tf_bot: + return 0.0 # symmetric section + h = D - (tf_top + tf_bot) + Ift = (Bf_top * tf_top**3) / 12 + Ifc = (Bf_bot * tf_bot**3) / 12 + beta_f = Ifc / (Ifc + Ift) + alpha = 0.8 if beta_f > 0.5 else 1.0 + return alpha * (2 * beta_f - 1) * h / 2 + + def calc_Mcr_LoadingCase(self,E, G, Iy, It, Iw, LLT, Kw, D, + tf_top, tf_bot, Bf_top, Bf_bot, + LoadingCase, warping_condition): + """ + Calculate Elastic Critical Moment Mcr based on IS 800:2007 (Annex E or Eq 2.20 for symmetric). + Returns: + Mcr : Elastic Critical Moment in N·mm + """ + yg = D / 2 + yj = self.calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D) + K_value = 0 + # Constants from Table 42 (IS 800:2007) + if LoadingCase == KEY_DISP_UDL_PIN_PIN_PG: + K_value == 1.0 + c1, c2, c3 = 1.132, 0.459, 0.525 + elif LoadingCase == KEY_DISP_UDL_FIX_FIX_PG: + K_value == 0.5 + c1, c2, c3 = 0.712, 0.652, 1.070 + elif LoadingCase == KEY_DISP_PL_PIN_PIN_PG: + K_value == 1.0 + c1, c2, c3 = 1.365, 0.553, 1.780 + elif LoadingCase == KEY_DISP_PL_FIX_FIX_PG: + K_value == 0.5 + c1, c2, c3 = 0.938, 0.715, 4.800 + else: + raise ValueError("Invalid Loading Case.") + + # Symmetric section (Eq 2.20) + if Bf_top == Bf_bot and tf_top == tf_bot: + term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) + term2 = (Iw / Iy) + term3 = (G * It * LLT**2) / (math.pi**2 * E * Iy) + Mcr = term1 * math.sqrt(term2 + term3) + print("It", It, "Iw", Iw, "LLT", LLT, "E", E, "I", Iy, "G", G) + else: + # Unsymmetric case (Annex E full formula) + term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) + bracket = ((K_value / Kw) ** 2 * (Iw / Iy) + + (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + + (c2 * yg - c3 * yj) ** 2) + Mcr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) + print("It", It, "Iw", Iw, "LLT", LLT, "E", E, "I", Iy, "G", G) + return Mcr # in N·mm + + def shear_stress_unsym_I(self, V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w): + + # Part areas [mm^2] + A_t = b_ft * t_ft + A_b = b_fb * t_fb + A_w = t_w * h_w + + # Section total depth & area + D = t_fb + h_w + t_ft + A = A_t + A_b + A_w + + # Centroid y‐coords from bottom of bottom flange [mm] + y_b = t_fb/2 + y_w = t_fb + h_w/2 + y_t = t_fb + h_w + t_ft/2 + + # Neutral axis from bottom [mm] + y_na = (A_b*y_b + A_w*y_w + A_t*y_t) / A + + # Second moment I_z [mm^4] + I_b = b_fb*t_fb**3/12 + A_b*(y_b - y_na)**2 + I_w = t_w *h_w**3/12 + A_w*(y_w - y_na)**2 + I_t = b_ft*t_ft**3/12 + A_t*(y_t - y_na)**2 + I_z = I_b + I_w + I_t + + # First moments Q [mm^3] + Q_bot = A_b * abs(y_na - y_b) + Q_top = A_t * abs(y_t - y_na) + + # Shear flows q = V*Q / I [kN·mm^3 / mm^4 = kN/mm] + q_bot = V_ed * Q_bot / I_z + q_top = V_ed * Q_top / I_z + + return { + 'y_na_mm': y_na, 'I_z_mm4': I_z, + 'Q_top_mm3': Q_top,'Q_bot_mm3': Q_bot, + 'q_top_kN_per_mm': q_top, + 'q_bot_kN_per_mm': q_bot, + } + + def weld_leg_from_q_with_cl10(self, + q_kN_per_mm, # shear flow [kN/mm] + ultimate_stresses, # list of MPa + fabrication='shop' +): + """ + Compute fillet‐weld leg a [mm] from shear flow, + using f_wd from cl.10.5.7.1.1. + """ + # 1) get f_wd in MPa → convert to N/mm² + f_wd = IS800_2007.cl_10_5_7_1_1_fillet_weld_design_stress( + ultimate_stresses, fabrication + ) # MPa + + # 2) convert q to N/mm + q_N_per_mm = q_kN_per_mm * 1e3 + + # 3) throat thickness t = q / f_wd [mm] + t_throat = q_N_per_mm / f_wd + + # 4) leg size a = t·√2 + return t_throat * math.sqrt(2) + + def design_welds_with_strength_web_to_flange(self, + # section loads & geometry + V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w, + # material / weld properties + ultimate_stresses, fabrication, + # stiffener inputs + t_st, b_st, V_unstf, L_weld +): + # compute shear flows + sf = self.shear_stress_unsym_I(self,V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w) + + # weld legs using cl.10 strength + a_top = self.weld_leg_from_q_with_cl10(self, + sf['q_top'], ultimate_stresses, fabrication + ) + a_bot = self.weld_leg_from_q_with_cl10(self, + sf['q_bot'], ultimate_stresses, fabrication + ) + + # end‐stiffener check (unchanged) + + return { + **sf, + 'a_top_mm': a_top, + 'a_bot_mm': a_bot + } + + def weld_for_end_stiffener_autoL(self, + # stiffener + t_st, b_st, # thickness & height [mm] + # loads + V_ed, V_unstf, # design shear & unstiffened capacity [kN] + # section geometry + D, t_ft, t_fb # overall depth & flange thicknesses [mm] +): + """ + Automatically computes L_weld = D - t_ft - t_fb, + then returns: + q1_min = t_st^2/(5·b_st) + q2_ext = (V_ed–V_unstf)/L_weld + q_total = q1 + q2 + q_each_weld = q_total/2 + All in kN/mm. + """ + # 0) available weld length + L_weld = D - t_ft - t_fb + + # 1) min weld per side + q1 = t_st**2 / (5 * b_st) + + # 2) stiffener shear per unit length + delta_V = max(V_ed - V_unstf, 0) + q2 = delta_V / L_weld + + # 3) total on one side + q_tot = q1 + q2 + + # 4) split into two welds (each face) + q_each = q_tot / 2 + + return { + 'L_weld_mm': L_weld, + 'q1_min': q1, + 'q2_ext': q2, + 'q_total': q_tot, + 'q_each_weld': q_each + } + + def deflection_from_moment_kNm_mm(self,M_kNm, L_mm, E, I, case): + """ + Compute max mid-span deflection from bending moment, + converting M (kN·m) → N·m and L (mm) → m internally. + + Parameters + ---------- + M_kNm : float + Max bending moment in kN·m. + L_mm : float + Span length in mm. + E : float + Young’s modulus in Pa (N/m²). + I : float + Second moment of area in m^4. + case : str + One of 'simple_udl', 'fixed_udl', 'simple_point', 'fixed_point'. + + Returns + ------- + delta : float + Mid-span deflection in meters. + """ + # unit conversions + M = M_kNm * 1e3 # kN·m → N·m + L = L_mm / 1e3 # mm → m + + pref = M * L ** 2 / (E * I) + if case == 'simple_udl': + return (5 / 48) * pref + elif case == 'fixed_udl': + return (1 / 32) * pref + elif case == 'simple_point': + return (1 / 12) * pref + elif case == 'fixed_point': + return (1 / 24) * pref + else: + raise ValueError( + "Unknown case. Use 'simple_udl', 'fixed_udl', 'simple_point', or 'fixed_point'." + ) + + + def evaluate_deflection_kNm_mm(self, + M_kNm, L_mm, E, I, case, criteria_list=VALUES_MAX_DEFL + ): + """ + 1) Calculate deflection from moment (with unit conversions). + 2) Compare against span-based limits. + Returns (delta_m, results_dict, best_criterion). + """ + # 1) compute deflection in meters + delta = self.deflection_from_moment_kNm_mm(self,M_kNm, L_mm, E, I, case) + L = L_mm / 1e3 # span in meters + + # 2) compare against each 'Span/N' limit + results = {} + passed = [] + for crit in criteria_list: + try: + _, denom = crit.split('/') + n = float(denom) + except ValueError: + continue + allowable = L / n + ok = (delta <= allowable) + results[crit] = { + 'allowable_m': allowable, + 'actual_m': delta, + 'passes': ok + } + if ok: + passed.append((n, crit)) + + # pick most stringent (smallest denom) that still passes + best = min(passed)[1] if passed else None + + return delta, results + + #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + def section_classification1(self, design_dictionary,trial_section=""): + """Classify the sections based on Table 2 of IS 800:2007""" + print(f"Inside section_classification") + local_flag = True + self.input_modified = [] + self.input_section_list = [] + self.input_section_classification = {} + lambda_check = False + for trial_section in self.sec_list: + trial_section = trial_section.strip("'") + self.section_property = self.section_connect_database(self, trial_section) + print(f"Type of section{self.section_property.designation}") + if self.section_property.type == "Rolled": + web_class = IS800_2007.Table2_iii( + self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius), + self.section_property.web_thickness, + self.material_property.fy, + ) + flange_class_bottom = IS800_2007.Table2_i( + self.section_property.flange_width / 2, + self.section_property.flange_thickness, + self.material_property.fy,self.section_property.type + )[0] + web_ratio = (self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius)) / self.section_property.web_thickness + flange_ratio = self.section_property.flange_width / 2 /self.section_property.flange_thickness + else: + flange_class_bottom = IS800_2007.Table2_i( + ( + (self.section_property.flange_width / 2) + # - (self.section_property.web_thickness / 2) + ), + self.section_property.flange_thickness, + self.section_property.fy, + self.section_property.type, + )[0] + + web_class = IS800_2007.Table2_iii( + ( + self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius) + ), + self.section_property.web_thickness, + self.material_property.fy, # classification_type="Axial compression", + ) + web_ratio = (self.section_property.depth - 2 * ( + self.section_property.flange_thickness + self.section_property.root_radius)) / self.section_property.web_thickness + flange_ratio = self.section_property.flange_width / 2 / self.section_property.flange_thickness + print(f"\n \n \n flange_class_bottom {flange_class_bottom} \n web_class{web_class} \n \n") + if flange_class_bottom == "Slender" or web_class == "Slender": + self.section_class = "Slender" + else: + if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic: + self.section_class = KEY_Plastic + elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact: + self.section_class = KEY_Compact + elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact: + self.section_class = KEY_SemiCompact + elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic: + self.section_class = KEY_Compact + elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact: + self.section_class = KEY_Compact + elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact: + self.section_class = KEY_SemiCompact + elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic: + self.section_class = KEY_SemiCompact + elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact: + self.section_class = KEY_SemiCompact + elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact: + self.section_class = KEY_SemiCompact + + self.Zp_req = self.load.moment * self.gamma_m0 / self.material_property.fy + self.effective_length_beam(self, design_dictionary, self.length) # mm + + print( 'self.allow_class', self.allow_class) + if self.section_property.plast_sec_mod_z >= self.Zp_req: + print( 'self.section_property.plast_sec_mod_z More than Requires') + + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + self.It = self.section_property.It + # ( + # 2 + # * self.section_property.flange_width + # * self.section_property.flange_thickness ** 3 + # ) / 3 + ( + # (self.section_property.depth - self.section_property.flange_thickness) + # * self.section_property.web_thickness ** 3 + # ) / 3 + self.hf = self.section_property.depth - self.section_property.flange_thickness + self.Iw = self.section_property.Iw + # 0.5 ** 2 * self.section_property.mom_inertia_y * self.hf ** 2 + + + if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: + self.beta_b_lt = 1.0 + else: + self.beta_b_lt = ( + self.section_property.elast_sec_mod_z + / self.section_property.plast_sec_mod_z + ) + _ = IS800_2007.cl_8_2_2_Unsupported_beam_bending_non_slenderness( + self.material_property.modulus_of_elasticity, + 0.3, + self.section_property.mom_inertia_y, + self.It, + self.Iw, + self.effective_length * 1e3, self.beta_b_lt, self.section_property.plast_sec_mod_z, self.hf, self.section_property.rad_of_gy_y, self.section_property.flange_thickness + ) + self.M_cr = _[0] + self.fcrb = _[1] + lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment( + self.beta_b_lt, + self.section_property.plast_sec_mod_z, + self.section_property.elast_sec_mod_z, + self.material_property.fy, + self.M_cr + ) + if lambda_lt < 0.4: + lambda_check = True + continue + if self.allow_class != 'No': + if ( + self.section_class == KEY_SemiCompact + or self.section_class == KEY_Compact + or self.section_class == KEY_Plastic + ): + + self.input_section_list.append(trial_section) + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio,self.It,self.hf,self.Iw,self.M_cr,self.beta_b_lt,lambda_lt,self.fcrb]}) + else: + self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio]}) + + elif self.section_class == "Slender": + logger.warning(f"The section.{trial_section} is Slender. Ignoring") + else: + if self.section_class == KEY_Compact or self.section_class == KEY_Plastic: + self.input_section_list.append(trial_section) + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio,self.It,self.hf,self.Iw,self.M_cr,self.beta_b_lt,lambda_lt, self.fcrb]}) + else: + self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio]}) + elif self.section_class == "Slender": + logger.warning(f"The section.{trial_section} is Slender. Ignoring") + # self.design_status = False + # self.design_status_list.append(self.design_status) + elif self.section_class == KEY_SemiCompact: + logger.warning( + f"The section.{trial_section} is Semi-Compact. Ignoring" + ) + # self.design_status = False + # self.design_status_list.append(self.design_status) + if lambda_check: + logger.info("After checking Non-dimensional slenderness ratio for given sections, some sections maybe be ignored by Osdag.[Ref IS 8.2.2] ") + if len(self.input_section_list) == 0: + local_flag = False + else: + local_flag = True + return local_flag + + def design(self, design_dictionary, flag=0): + ''' + TODO optimimation_tab_check changes to include self.material_property = Material(material_grade=self.material, thickness=0) + for each section + ''' + + self.optimization_tab_check(self) + + self.design_beam(self, design_dictionary) + + def optimization_tab_check(self): + ''' + TODO add button to give user option to take Tension holes or not + ''' + print(f"\n Inside optimization_tab_check") + self.latex_tension_zone = False + if (self.effective_area_factor <= 0.10) or (self.effective_area_factor > 1.0): + logger.error( + "The defined value of Effective Area Factor in the design preferences tab is out of the suggested range." + ) + logger.info("Provide an appropriate input and re-design.") + logger.warning("Assuming a default value of 1.0.") + self.effective_area_factor = 1.0 + # self.design_status = False + # self.design_status_list.append(self.design_status) + self.optimization_tab_check(self) + elif (self.steel_cost_per_kg < 0.10) or (self.effective_area_factor > 1.0) or (self.effective_area_factor < 0): + # No suggested range in Description + logger.warning( + "The defined value of the effective area factor in the design preferences tab is out of the suggested range." + ) + # logger.info("Provide an appropriate input and re-design.") + logger.info("Assuming a default value of 1.0") + self.steel_cost_per_kg = 50 + self.effective_area_factor = 1 + self.design_status = False + # self.design_status_list.append(self.design_status) + else: + if self.latex_tension_zone: + if self.effective_area_factor >= (self.material_property.fy * self.gamma_m0 / (self.material_property.fu * 0.9 * self.gamma_m1)): + pass + else: + self.latex_tension_zone = True + print(f'self.latex_tension_zone: {self.latex_tension_zone}') + # self.effective_area_factor = ( + # self.material_property.fy + # * self.gamma_m0 + # / (self.material_property.fu * 0.9 * self.gamma_m1) + # ) + # logger.info( + # f"The effect of holes in the tension flange is considered on the design bending strength. The ratio of net to gross area of the flange in tension is considered {self.effective_area_factor}" + # ) + + logger.info("Provided appropriate design preference, now checking input.") + + def input_modifier(self): + """Classify the sections based on Table 2 of IS 800:2007""" + print(f"Inside input_modifier") + local_flag = True + self.input_modified = [] + self.input_section_list = [] + # self.input_section_classification = {} + + for section in self.sec_list: + section = section.strip("'") + self.section_property = self.section_connect_database(self, section) + + self.Zp_req = self.load.moment * self.gamma_m0 / self.material_property.fy + print('Inside input_modifier not allow_class',self.allow_class,self.load.moment, self.gamma_m0, self.material_property.fy) + if self.section_property.plast_sec_mod_z >= self.Zp_req: + + self.input_modified.append(section) + # logger.info( + # f"Required self.Zp_req = {round(self.Zp_req * 10**-3,2)} x 10^3 mm^3 and Zp of section {self.section_property.designation} = {round(self.section_property.plast_sec_mod_z* 10**-3,2)} x 10^3 mm^3.Section satisfy Min self.Zp_req value") + # else: + # local_flag = False + + # logger.warning( + # f"Required self.Zp_req = {round(self.Zp_req* 10**-3,2)} x 10^3 mm^3 and Zp of section {self.section_property.designation} = {round(self.section_property.plast_sec_mod_z* 10**-3,2)} x 10^3 mm^3.Section dosen't satisfy Min self.Zp_req value") + # logger.info("") + print("self.input_modified", self.input_modified) + + def section_connect_database(self, section): + print(f"section_connect_database{section}") + print(section) + # print(self.sec_profile) + if ( + self.sec_profile == VALUES_SECTYPE[1] + or self.sec_profile == "I-section" + ): # I-section + self.section_property = ISection( + designation=section, material_grade=self.material + ) + self.material_property.connect_to_database_to_get_fy_fu( + self.material, max(self.section_property.flange_thickness, self.section_property.web_thickness) + ) + print(f"section_connect_database material_property.fy{self.material_property.fy}") + self.epsilon = math.sqrt(250 / self.material_property.fy) + return self.section_property + + def design_beam(self, design_dictionary): + # 1- Based on optimum UR + self.optimum_section_ur_results = {} + self.optimum_section_ur = [] + + # 2 - Based on optimum cost + self.optimum_section_cost_results = {} + self.optimum_section_cost = [] + + # 1 - section classification + self.flag = self.section_classification(self,design_dictionary) + + print('self.flag:',self.flag) + if self.effective_area_factor < 1.0: + logger.warning( + "Reducing the effective sectional area as per the definition in the Design Preferences tab." + ) + else: + logger.info( + "The effective sectional area is taken as 100% of the cross-sectional area [Reference: Cl. 7.3.2, IS 800:2007]." + ) + # Effective length + print( + f"self.effective_length {self.effective_length} \n self.input_section_classification{self.input_section_classification} ") + print('self.input_section_list:',self.input_section_list) + if self.flag: + for section in self.input_section_list: + # initialize lists for updating the results dictionary + self.section_property = self.section_connect_database(self, section) + if self.section_property.type == 'Rolled': + self.effective_depth = (self.section_property.depth - 2 * ( + self.section_property.flange_thickness + self.section_property.root_radius)) + else: + self.effective_depth = (self.section_property.depth - 2 *self.section_property.flange_thickness ) + print('self.section_property.type:',self.section_property.type, self.bending_type) + + if self.sec_profile == 'Beams' or self.sec_profile == 'Columns' or self.sec_profile == VALUES_SECTYPE[1]: + if self.section_property.type == "Rolled" and self.bending_type == KEY_DISP_BENDING1: + self.shear_area = self.section_property.depth * self.section_property.web_thickness + elif self.section_property.type != "Rolled" and self.bending_type == KEY_DISP_BENDING1: + self.shear_area = self.effective_depth * self.section_property.web_thickness + elif self.bending_type == KEY_DISP_BENDING2: + self.shear_area = 2 * self.section_property.flange_width * self.section_property.flange_thickness + + self.effective_length_beam(self, design_dictionary, self.length) # mm + + # Step 1.1 - computing the effective sectional area + self.effective_area = self.section_property.area + self.common_checks_1(self, section, step=2) + + + list_result = [] + list_1 = [] + list_result.append(section) + self.section_class = self.input_section_classification[section][0] + print(f"Inside design_beam self.design_type:{self.design_type}") + + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + self.It = self.input_section_classification[section][ 5 ] + self.hf = self.input_section_classification[section][ 6 ] + self.Iw = self.input_section_classification[section][ 7 ] + self.M_cr = self.input_section_classification[section][ 8 ] + self.beta_b_lt = self.input_section_classification[section][ 9 ] + self.lambda_lt = self.input_section_classification[section][ 10 ] + self.fcrb = self.input_section_classification[section][ 11 ] + print('self.design_type:',self.design_type, self.It, + self.hf, + self.Iw, + self.M_cr, + self.beta_b_lt, + self.lambda_lt) + + self.beam_web_buckling(self) + if self.web_buckling_check: + self.web_not_buckling_steps(self) + + # self.shear_strength = IS800_2007.cl_8_4_design_shear_strength( + # self.shear_area, + # self.material_property.fy + # ) / 10 ** 3 + # self.high_shear_check = IS800_2007.cl_8_2_1_2_high_shear_check( + # self.load.shear_force / 1000, self.shear_strength + # ) + # self.bending_strength_section = self.bending_strength() / 10 ** 6 + + # self.web_buckling_steps(self) + # self.high_shear_check = False + # self.bending_strength_section = self.bending_strength_girder(self) / 10 ** 6 + + # print(f"Common result {list_result, self.section_class, self.V_d, self.high_shear_check, self.bending_strength_section}") + print('self.bending_strength_section',self.bending_strength_section,'self.shear_strength',self.shear_strength, 'self.load.moment',self.load.moment,'self.load.shear_force',self.load.shear_force) + # 2.8 - UR + self.ur = max((self.load.moment / self.bending_strength_section * 10 ** -6),(self.load.shear_force / self.shear_strength * 10 ** -3))# ( + round(self.load.axial_force / self.section_capacity, 3) + print("UR", self.ur) + # 2.9 - Cost of the section in INR + self.cost = ( + ( + self.section_property.unit_mass + * self.section_property.area + * 1e-4 + ) + * self.length + * self.steel_cost_per_kg + ) + self.optimum_section_cost.append(self.cost) + self.web_buckling = False # When Bearing length is provided + + if self.bearing_length != 'NA': #and self.web_crippling + print(f"Check for Web Buckling") + try: + self.bearing_length = float(design_dictionary[KEY_BEARING_LENGTH]) + self.web_buckling = True # WEB BUCKLING + self.I_eff_web = self.bearing_length * self.section_property.web_thickness ** 3 / 12 + self.A_eff_web = self.bearing_length * self.section_property.web_thickness + self.r = math.sqrt(self.I_eff_web / self.A_eff_web) + self.slenderness = 0.7 * self.effective_depth / self.r + self.common_checks_1(self, section, step=3) + # step == 4 + self.common_checks_1( + self, section, step=4, list_result=["Concentric"] + ) + # 2.7 - Capacity of the section for web_buckling + self.section_capacity = ( + self.design_compressive_stress * ( + self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness + * 10 ** -3) # N + print(self.design_compressive_stress, self.bearing_length, self.section_property.depth, + self.section_property.web_thickness) + + print(self.bending_strength_section, self.shear_strength, self.section_capacity) + + self.F_wb = (self.bearing_length + 2.5 * ( + self.section_property.root_radius + self.section_property.flange_thickness)) * self.section_property.web_thickness * self.material_property.fy / ( + self.gamma_m0 * 10 ** 3) + if self.bending_strength_section > self.load.moment * 10 ** -6 and self.shear_strength > self.load.shear_force * 10 ** -3 and self.section_capacity > self.load.shear_force * 10 ** -3 and self.F_wb > self.load.shear_force * 10 ** -3: + list_result, list_1 = self.list_changer(self, change='Web Buckling', check=True, + list=list_result, list_name=list_1) + self.optimum_section_ur.append(self.ur) + else: + list_result, list_1 = self.list_changer(self, change='Web Buckling', check=True, + list=list_result, list_name=list_1) + self.optimum_section_ur.append(self.ur) + # Step 3 - Storing the optimum results to a list in a descending order + self.common_checks_1(self, section, 5, list_result, list_1) + except: + logger.warning('Bearing length is invalid.') + logger.info('Ignoring web Buckling and Crippling check') + self.bearing_length = 'NA' + self.web_buckling = False + # 2.8 - UR + print(self.bending_strength_section, self.shear_strength) + if self.bending_strength_section > self.load.moment * 10 ** -6 and self.shear_strength > self.load.shear_force * 10 ** -3: + list_result, list_1 = self.list_changer(self, change='', check=True,list=list_result, list_name=list_1) + self.optimum_section_ur.append(self.ur) + + + # Step 3 - Storing the optimum results to a list in a descending order + self.common_checks_1(self, section, 5, list_result, list_1) + else: + list_result, list_1 = self.list_changer(self, change='', check=True,list=list_result, list_name=list_1) + self.optimum_section_ur.append(self.ur) + # Step 3 - Storing the optimum results to a list in a descending order + self.common_checks_1(self, section, 5, list_result, list_1) + + else: + self.web_buckling = False + # 2.8 - UR + print(self.bending_strength_section, self.shear_strength) + if self.bending_strength_section > self.load.moment * 10**-6 and self.shear_strength > self.load.shear_force * 10**-3: + + self.optimum_section_ur.append(self.ur) + list_result, list_1 = self.list_changer(self, change=' ', check=True, list=list_result, list_name=list_1) + + # Step 3 - Storing the optimum results to a list in a descending order + self.common_checks_1(self, section, 5, list_result, list_1) + else: + self.optimum_section_ur.append(self.ur) + list_result, list_1 = self.list_changer(self, change=' ', check=True, list=list_result, list_name=list_1) + + # Step 3 - Storing the optimum results to a list in a descending order + self.common_checks_1(self, section, 5, list_result, list_1) + print('self.optimum_section_ur', self.optimum_section_ur) + + def beam_web_buckling(self): + + print(f"Working web_buckling_check") + # 3 - web buckling under shear + self.web_buckling_check = IS800_2007.cl_8_2_1_web_buckling( + d=self.effective_depth, + tw=self.section_property.web_thickness, + e=self.epsilon, + ) + print(self.web_buckling_check, self.section_property.designation) + + if not self.web_buckling_check: + self.web_not_buckling_steps(self) + def web_buckling_steps(self): + print(f"Not using web_buckling_steps") + # logger.info(f"Considering {self.support_cndition_shear_buckling}") + # 5 - Web Buckling check(when high shear) -If user wants then only + # if web_buckling: + # b1 = input('Enter bearing') + # self.web_buckling_strength = self.section_property.web_thickness * (b1 + 1.25 * self.section_property.depth) + # self.V_d = pass + # web_buckling_message = 'Thin web' + if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: + self.K_v = IS800_2007.cl_8_4_2_2_K_v_Simple_postcritical('only support') + self.plate_girder_strength(self) + # logger.info('Section = {}, V_cr = {}'.format(self.section_property.designation, round(self.V_cr,2))) + self.shear_strength = self.V_cr / self.gamma_m0 + # if self.V_d > self.load.shear_force * 10**-3: + # + # return True + # else: + # return False + # self.V_d = IS800_2007.cl_8_4_2_2_ShearBuckling_Simple_postcritical((self.section_property.depth - 2 *(self.section_property.flange_thickness + self.section_property.root_radius), + # self.section_property.web_thickness,space,0.3, self.fyw)) + elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: + self.V_p = IS800_2007.cl_8_4_design_shear_strength( + self.shear_area, + self.material_property.fy + ) / 10 ** 3 * self.gamma_m0 + self.Mfr = IS800_2007.cl_8_4_2_2_Mfr_TensionField(self.section_property.flange_width, + self.section_property.flange_thickness, self.fyf, + self.load.moment / ( + self.section_property.depth - self.section_property.flange_thickness), + self.gamma_m0) + print('MFr', self.Mfr) + if self.Mfr > 0: + print('Starting loop', int(round(self.effective_length*10**4/self.effective_depth,-1)/10)) + # for c_d in range(3,self.effective_length/self.result_eff_d): + for c_d in reversed(list(range(3,int(round(self.effective_length * 1000/self.effective_depth,-1))))): + print('c_d',c_d,'c/d',self.effective_length * 1000/self.effective_depth) + c_d = c_d/10 + 0.1 + self.c = round(c_d * self.effective_depth, -1) + print('c',self.c) + self.K_v = IS800_2007.cl_8_4_2_2_K_v_Simple_postcritical('many support', self.c, self.effective_depth) + self.plate_girder_strength2(self) + + self.shear_strength = self.V_tf_girder / self.gamma_m0 * 10**-3 + logger.info('Intermediate Stiffeners required d ={}, c = {}, Section = {}, V_tf = {}, V_d = {}'.format(self.effective_depth,self.c, + self.section_property.designation, + self.V_tf_girder,self.shear_strength)) + if self.shear_strength > self.load.shear_force * 10**-3: + return + return + else: + self.shear_strength = 0.1 + def web_not_buckling_steps(self): + print(f"Working web_not_buckling_steps") + self.V_d = IS800_2007.cl_8_4_design_shear_strength( + self.shear_area, + self.material_property.fy + ) / 10 ** 3 + self.shear_strength = self.V_d + self.high_shear_check = IS800_2007.cl_8_2_1_2_high_shear_check( + self.load.shear_force / 1000, self.V_d + ) + print(f"self.V_d {self.V_d},{self.section_property.depth* self.section_property.web_thickness}, {self.material_property.fy}") + # 4 - design bending strength + self.bending_strength_section = self.bending_strength(self) / 10 ** 6 + + + + def bending_strength(self): + print('Inside bending_strength ','\n self.section_class', self.section_class) + # 4 - design bending strength + M_d = IS800_2007.cl_8_2_1_2_design_bending_strength( + self.section_class, + self.section_property.plast_sec_mod_z, + self.section_property.elast_sec_mod_z, + self.material_property.fy, + self.gamma_m0, + self.support, + ) + if self.section_class == KEY_Plastic or self.section_class == KEY_Compact : + self.beta_b_lt = 1 + else : + self.beta_b_lt = self.section_property.elast_sec_mod_z/self.section_property.plast_sec_mod_z + print('self.beta_b_lt: ',self.beta_b_lt) + self.M_d = M_d + if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: + if self.high_shear_check: + if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: + bending_strength_section = self.bending_strength_reduction(self, M_d) + else: + bending_strength_section = ( + self.section_property.elast_sec_mod_z + * self.material_property.fy + / self.gamma_m0 + ) + else: + bending_strength_section = M_d + print('Inside bending_strength 1', M_d, self.high_shear_check, bending_strength_section) + else: + print('self.design_type:',self.design_type, self.It, + self.hf, + self.Iw, + self.M_cr, + self.beta_b_lt, + self.lambda_lt, self.fcrb) + # self.It = ( + # 2 + # * self.section_property.flange_width + # * self.section_property.flange_thickness**3 + # ) / 3 + ( + # (self.section_property.depth - self.section_property.flange_thickness) + # * self.section_property.web_thickness**3 + # ) / 3 + # self.hf = self.section_property.depth - self.section_property.flange_thickness + # self.Iw = 0.5**2 * self.section_property.mom_inertia_y * self.hf**2 + # self.M_cr = IS800_2007.cl_8_2_2_Unsupported_beam_bending_non_slenderness( + # self.material_property.modulus_of_elasticity, + # 0.3, + # self.section_property.mom_inertia_y, + # self.It, + # self.Iw, + # self.effective_length * 1e3 + # ) + # + # if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: + # self.beta_b_lt = 1.0 + # else: + # self.beta_b_lt = ( + # self.section_property.elast_sec_mod_z + # / self.section_property.plast_sec_mod_z + # ) + if self.section_property.type == "Rolled": + alpha_lt = 0.21 + else: + alpha_lt = 0.49 + # lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment( + # self.beta_b_lt, + # self.section_property.plast_sec_mod_z, + # self.section_property.elast_sec_mod_z, + # self.material_property.fy, + # self.M_cr + # ) + phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt( + alpha_lt, self.lambda_lt + ) + X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor( + phi_lt, self.lambda_lt + ) + fbd = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress( + X_lt, self.material_property.fy, self.gamma_m0 + ) + bending_strength_section = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength( + self.section_property.plast_sec_mod_z, + self.section_property.elast_sec_mod_z, + fcd=fbd, + section_class=self.section_class + ) + # self.beta_b_lt = beta_b + self.alpha_lt = alpha_lt + # self.lambda_lt = lambda_lt + self.phi_lt = phi_lt + self.X_lt = X_lt + self.fbd_lt = fbd + self.lateral_tb = self.M_cr * 10**-6 + print('Inside bending_strength 2.1', fbd, self.section_property.plast_sec_mod_z ) + if self.high_shear_check: + if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: + bending_strength_section = self.bending_strength_reduction(self,Md=bending_strength_section + ) + else: + bending_strength_section = ( + self.beta_b_lt + * self.section_property.plast_sec_mod_z + * fbd + ) + print('Inside bending_strength 2',self.It,self.hf,self.Iw,self.M_cr ,self.beta_b_lt,alpha_lt,self.lambda_lt,phi_lt,X_lt,fbd,bending_strength_section) + self.bending_strength_section_reduced = bending_strength_section + return bending_strength_section + def bending_strength_girder(self): + print('Inside bending_strength of girder ') + web_class = IS800_2007.Table2_i( + (self.section_property.flange_width - self.section_property.web_thickness)/2, + self.section_property.flange_thickness, + self.material_property.fy, self.section_property.type + )[0] + flange_class_bottom = IS800_2007.Table2_i( + self.section_property.depth - 2 * self.section_property.flange_thickness, + self.section_property.web_thickness, + self.material_property.fy,self.section_property.type + )[0] + if flange_class_bottom == "Slender" or web_class == "Slender": + self.section_class_girder = "Slender" + else: + if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic: + self.section_class_girder = KEY_Plastic + elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact: + self.section_class_girder = KEY_Compact + elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact: + self.section_class_girder = KEY_SemiCompact + elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic: + self.section_class_girder = KEY_Compact + elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact: + self.section_class_girder = KEY_Compact + elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact: + self.section_class_girder = KEY_SemiCompact + elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic: + self.section_class_girder = KEY_SemiCompact + elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact: + self.section_class_girder = KEY_SemiCompact + elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact: + self.section_class_girder = KEY_SemiCompact + # 4 - design bending strength + I_flange = 2 * (self.section_property.flange_width * self.section_property.flange_thickness**3/12 + self.section_property.flange_width * self.section_property.flange_thickness * (self.section_property.depth/2 - self.section_property.flange_thickness/2)**2) + Zez_flange = I_flange / self.section_property.depth /2 + y_top = (self.section_property.flange_width * self.section_property.flange_thickness * (self.section_property.depth - self.section_property.flange_thickness)/2) / (self.section_property.flange_width * self.section_property.flange_thickness) + Zpz_flange = 2 * self.section_property.flange_width * self.section_property.flange_thickness * y_top + M_d = IS800_2007.cl_8_2_1_2_design_bending_strength( + self.section_class_girder, + Zpz_flange, + Zez_flange, + self.material_property.fy, + self.gamma_m0, + self.support, + ) + if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact : + self.beta_b_lt = 1 + else : + self.beta_b_lt = Zez_flange/Zpz_flange + self.M_d = M_d + if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: + if self.high_shear_check: + if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: + bending_strength_section = self.bending_strength_reduction(self, M_d) + else: + bending_strength_section = ( + self.section_property.elast_sec_mod_z + * self.material_property.fy + / self.gamma_m0 + ) + else: + bending_strength_section = M_d + print('Inside bending_strength 1', M_d, self.high_shear_check, bending_strength_section) + else: + # self.It = ( + # 2 + # * self.section_property.flange_width + # * self.section_property.flange_thickness**3 + # ) / 3 + ( + # (self.section_property.depth - self.section_property.flange_thickness) + # * self.section_property.web_thickness**3 + # ) / 3 + self.hf = self.section_property.depth - self.section_property.flange_thickness + # self.Iw = 0.5**2 * self.section_property.mom_inertia_y * self.hf**2 + self.fcrb = IS800_2007.cl_8_2_2_Unsupported_beam_bending_fcrb( + self.material_property.modulus_of_elasticity, + self.effective_length/self.section_property.rad_of_gy_y, + self.hf/self.section_property.flange_thickness + ) + + if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: + self.beta_b_lt = 1.0 + else: + self.beta_b_lt = ( + self.section_property.elast_sec_mod_z + / self.section_property.plast_sec_mod_z + ) + if self.section_property.type == "Rolled": + alpha_lt = 0.21 + else: + alpha_lt = 0.49 + lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment_fcrb( + self.material_property.fy, self.fcrb + ) + phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt( + alpha_lt, lambda_lt + ) + X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor( + phi_lt, lambda_lt + ) + fbd = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress( + X_lt, self.material_property.fy, self.gamma_m0 + ) + bending_strength_section = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength( + self.section_property.plast_sec_mod_z, + self.section_property.elast_sec_mod_z, + fcd=fbd, + section_class=self.section_class_girder + ) + + + # self.beta_b_lt = beta_b + self.alpha_lt = alpha_lt + # self.lambda_lt = lambda_lt + self.phi_lt = phi_lt + self.X_lt = X_lt + self.fbd_lt = fbd + self.lateral_tb = self.fcrb * 10**-6 + print('Inside bending_strength 2.1', fbd, self.section_property.plast_sec_mod_z ) + if self.high_shear_check: + if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: + bending_strength_section = self.bending_strength_reduction(self,Md=bending_strength_section + ) + else: + bending_strength_section = ( + self.beta_b_lt + * self.section_property.plast_sec_mod_z + * fbd + ) + print('Inside bending_strength 2',self.It,self.hf,self.Iw,self.fcrb ,self.beta_b_lt,alpha_lt,lambda_lt,phi_lt,X_lt,fbd,bending_strength_section) + self.bending_strength_section_reduced = bending_strength_section + return bending_strength_section + def bending_strength_reduction(self, Md): + Zfd = ( + self.section_property.plast_sec_mod_z + - (self.section_property.depth**2 * self.section_property.web_thickness / 4) + ) + Mfd = Zfd * self.material_property.fy / self.gamma_m0 + beta = ((2 * self.load.shear_force / (self.shear_strength * 10**3)) - 1) ** 2 + Mdv = (Md - beta * (Md - Mfd)) + print('Inside bending_strength_reduction',Mdv, Md, beta, Mfd, Zfd) + self.bending_strength_section_reducedby = Mfd + self.beta_reduced = beta + if ( + Mdv + <= 1.2 + * self.section_property.plast_sec_mod_z + * self.material_property.fy + / self.gamma_m0 + ): + return Mdv + else: + return ( + 1.2 + * self.section_property.plast_sec_mod_z + * self.material_property.fy + / self.gamma_m0 + ) + + + + + + def effective_length_beam1(self, design_dictionary, length): + print(f"Inside effective_length_beam") + self.Loading = design_dictionary[KEY_LOAD] # 'Normal'or 'Destabilizing' + # self.Latex_length = design_dictionary[KEY_LENGTH_OVERWRITE] + if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': + if self.support == KEY_DISP_SUPPORT1: + self.torsional_res = design_dictionary[KEY_TORSIONAL_RES] + self.warping = design_dictionary[KEY_WARPING_RES] + self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported( + Torsional=self.Torsional_res, + Warping=self.Warping, + length=length, + depth=(self.section_property.depth/1000), + load=self.Loading, + ) + print(f"Working 1 {self.effective_length}") + elif self.support == KEY_DISP_SUPPORT2: + self.Support = design_dictionary[KEY_SUPPORT_TYPE] + self.Top = design_dictionary[KEY_SUPPORT_TYPE2] + self.effective_length = IS800_2007.cl_8_3_3_EffLen_Cantilever( + Support=self.Support, + Top=self.Top, + length=length, + load=self.Loading, + ) + print(f"Working 2 {self.effective_length}") + else: + if self.support == KEY_DISP_SUPPORT1: + self.Torsional_res = design_dictionary[KEY_TORSIONAL_RES] + self.Warping = design_dictionary[KEY_WARPING_RES] + + elif self.support == KEY_DISP_SUPPORT2: + self.Support = design_dictionary[KEY_SUPPORT_TYPE] + self.Top = design_dictionary[KEY_SUPPORT_TYPE2] + + try: + if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: + design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' + else: + length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) + + self.effective_length = length + print(f"Working 3 {self.effective_length}") + except: + print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) + logger.warning("Invalid Effective Length Parameter.") + logger.info('Effective Length Parameter is set to default: 1.0') + design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' + self.effective_length_beam(self, design_dictionary, length) + print(f"Working 4 {self.effective_length}") + print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) + + + def lambda_lt_check_member_type(self, Mcr=0, fcrb=0, Zp=0, f_y=0, Ze=0, beta_b=0): + lambda_lt_1 = math.sqrt(beta_b * Zp * f_y / Mcr) + lambda_lt_2 = math.sqrt(f_y / fcrb) + lambda_lt_check = math.sqrt(1.2 * Ze * f_y / Mcr) + if lambda_lt_1 == lambda_lt_2: + if lambda_lt_1 <= lambda_lt_check: + return lambda_lt_1 + logger.warning(" Issues with the non-dimensional slenderness ratio Lambda_lt") + + def common_checks_1(self, section, step=1, list_result=[], list_1=[]): + if step == 1: + print(f"Working correct here") + elif step == 2: + # reduction of the area based on the connection requirements (input from design preferences) + if self.effective_area_factor < 1.0: + self.effective_area = round( + self.effective_area * self.effective_area_factor, 2 + ) + + + elif step == 3: + # 2.1 - Buckling curve classification and Imperfection factor + if self.section_property.type == 'Rolled': + self.buckling_class = 'c' + self.imperfection_factor = IS800_2007.cl_7_1_2_1_imperfection_factor( + buckling_class=self.buckling_class + ) + elif step == 4: + # self.slenderness = self.effective_length / min(self.section_property.rad_of_gy_z, self.section_property.rad_of_gy_y) * 1000 + print( + f"\n data sent " + f" self.material_property.fy {self.material_property.fy}" + f"self.gamma_m0 {self.gamma_m0}" + f"self.slenderness {self.slenderness}" + f" self.imperfection_factor {self.imperfection_factor}" + f"self.section_property.modulus_of_elasticity {self.section_property.modulus_of_elasticity}" + ) + + list_cl_7_1_2_1_design_compressisive_stress = ( + IS800_2007.cl_7_1_2_1_design_compressisive_stress( + self.material_property.fy, + self.gamma_m0, + self.slenderness, + self.imperfection_factor, + self.section_property.modulus_of_elasticity, + check_type=list_result, + ) + ) + for x in list_cl_7_1_2_1_design_compressisive_stress: + print(f"x {x} ") + self.euler_buckling_stress = list_cl_7_1_2_1_design_compressisive_stress[0] + self.nondimensional_effective_slenderness_ratio = ( + list_cl_7_1_2_1_design_compressisive_stress[1] + ) + self.phi = list_cl_7_1_2_1_design_compressisive_stress[2] + self.stress_reduction_factor = list_cl_7_1_2_1_design_compressisive_stress[ + 3 + ] + self.design_compressive_stress_fr = ( + list_cl_7_1_2_1_design_compressisive_stress[4] + ) + self.design_compressive_stress = ( + list_cl_7_1_2_1_design_compressisive_stress[5] + ) + self.design_compressive_stress_max = ( + list_cl_7_1_2_1_design_compressisive_stress[6] + ) + elif step == 5: + # 1- Based on optimum UR + self.optimum_section_ur_results[self.ur] = {} + list_2 = list_result.copy() + for j in list_1: + # k = 0 + for k in list_2: + self.optimum_section_ur_results[self.ur][j] = k + # k += 1 + list_2.pop(0) + break + + # 2- Based on optimum cost + self.optimum_section_cost_results[self.cost] = {} + + list_2 = list_result.copy() # Why? + for j in list_1: + for k in list_2: + self.optimum_section_cost_results[self.cost][j] = k + list_2.pop(0) + break + print( + f"\n self.optimum_section_cost_results {self.optimum_section_cost_results}" + f"\n self.optimum_section_ur_results {self.optimum_section_ur_results}" + ) + elif step == 6: + self.single_result[self.sec_profile] = {} + list_2 = list_result.copy() + for j in list_1: + # k = 0 + for k in list_2: + self.single_result[self.sec_profile][j] = k + # k += 1 + list_2.pop(0) + break + print(f"\n self.single_result {self.single_result}") + + def list_changer(self, change, list,list_name, check = True): + list_name.extend([ + "Designation"]) + if self.high_shear_check and self.section_class != 'Semi-Compact': + list.extend( + [self.bending_strength_section_reducedby, self.beta_reduced, self.M_d]) + list_name.extend([ + "Mfd", + "Beta_reduced", + 'M_d' + ]) + #Latex para also + list.extend( + [self.latex_tension_zone,self.web_buckling_check,self.effective_depth, self.web_buckling, self.section_class, self.effective_area, self.shear_strength, self.high_shear_check, + self.bending_strength_section, self.effective_length, self.ur, + self.cost, self.beta_b_lt]) + list_name.extend([ + 'latex.tension_zone', + 'Web.Buckling', + 'Reduced.depth', + 'Buckling.crippling', + "Section class", + "Effective area", + "Shear Strength", + "High Shear check", + "Bending Strength", + "Effective_length", + "UR", + "Cost", + "Beta_b" + ]) + #Web buckling parameters + # if self.web_buckling_check and (self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0] or self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1] ) : + # list.extend( + # [self.K_v, self.tau_crc, self.lambda_w, self.tau_b, + # self.V_cr]) + # list_name.extend([ + # 'Kv', + # 'tau_crc', + # 'lambda_w', + # 'tau_b', + # "V_cr" + # ]) + if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1] and self.web_buckling_check: + list.extend( + [self.Mfr, self.load.moment / ( + self.section_property.depth - self.section_property.flange_thickness) + , self.c, self.phi_girder,self.s_girder ,self.wtf_girder,self.sai_girder, self.fv_girder,self.V_p,self.V_tf_girder]) + list_name.extend([ + 'Mfr', + 'Nf', + 'c', + 'phi_girder', + "s_girder", + 'wtf_girder', + 'sai_girder', + 'fv_girder', + 'V_p', + 'V_tf_girder' + ]) + if change == 'Web Buckling': + list.extend([self.I_eff_web, self.A_eff_web, self.r, self.buckling_class, + self.imperfection_factor, + self.slenderness, + self.euler_buckling_stress, + self.nondimensional_effective_slenderness_ratio, + self.phi, + self.stress_reduction_factor, + self.design_compressive_stress_fr, + self.design_compressive_stress_max, + self.design_compressive_stress, + self.section_capacity, + self.F_wb]) + + list_name.extend ([ + "WebBuckling.I_eff", + "WebBuckling.A_eff", + "WebBuckling.r_eff", + "Buckling_class", + "IF", + "Effective_SR", + "EBS", + "ND_ESR", + "phi", + "SRF", + "FCD_formula", + "FCD_max", + "FCD", + "Capacity", + "Web_crippling" + ]) + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + list.extend([self.It, + self.Iw, + self.alpha_lt, + self.lambda_lt, + self.phi_lt, + self.X_lt, + self.fbd_lt, + self.lateral_tb]) + + list_name.extend([ + "It", + "Iw", + "IF_lt", + "ND_ESR_lt", + "phi_lt", + "SRF_lt", + "FCD_lt", + "Mcr" + ]) + return list,list_name + + # def plate_girder_design(self, section): + # if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: + # self.tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(self.K_v, + # self.material_property.modulus_of_elasticity, + # 0.3,self.effective_depth, + # self.section_property.web_thickness) + # self.lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.fyw,self.tau_crc) + # self.tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(self.lambda_w, self.fyw) + # self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(self.tau_b, self.effective_depth * self.section_property.web_thickness) + # d_red = self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius) + # tau_b = self.load.shear_force / (self.effective_depth * self.section_property.web_thickness) + # if tau_b <= self.fyw / math.sqrt(3): + # lambda_w = 0.8 + # else: + # lambda_w = min((tau_b*(math.sqrt(3)/self.fyw) - 1.64) / (-0.8), math.sqrt(tau_b*(math.sqrt(3)/self.fyw))) + # tau_crc = self.fyw / (math.sqrt(3) * lambda_w ** 2) + + def plate_girder_strength(self): + self.tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(self.K_v, + self.material_property.modulus_of_elasticity, + 0.3,self.effective_depth, + self.section_property.web_thickness) + self.lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.fyw,self.tau_crc) + self.tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(self.lambda_w, self.fyw) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(self.tau_b, self.effective_depth * self.section_property.web_thickness) / 10**3 + print('\n plate_girder_strength', '\n tau_crc',self.tau_crc,'\n self.lambda_w',self.lambda_w,'\n self.tau_b',self.tau_b,'\n self.V_cr',self.V_cr) + def plate_girder_strength2(self): + + self.plate_girder_strength(self) + self.phi_girder, self.M_fr_girder ,self.s_girder ,self.wtf_girder,self.sai_girder, self.fv_girder, self.V_tf_girder= IS800_2007.cl_8_4_2_2_TensionField(self.c, + self.effective_depth,self.section_property.web_thickness, + self.fyw,self.section_property.flange_width, + self.section_property.flange_thickness,self.fyf, + self.load.moment/(self.section_property.depth - self.section_property.flange_thickness), + self.gamma_m0,self.effective_depth * self.section_property.web_thickness,self.tau_b,self.V_p ) + + + def results(self, design_dictionary): + _ = [i for i in self.optimum_section_ur if i > 1.0] + print( '_ ',_) + if len(_)==1: + temp = _[0] + elif len(_)==0: + temp = None + else: + temp = sorted(_)[0] + self.failed_design_dict = self.optimum_section_ur_results[temp] if temp is not None else None + print('self.failed_design_dict ',self.failed_design_dict) + + # sorting results from the dataset + # if len(self.input_section_list) > 1: + # results based on UR + if self.optimization_parameter == "Utilization Ratio": + filter_UR = filter( + lambda x: x <= min(self.allowable_utilization_ratio, 1.0), + self.optimum_section_ur + ) + self.optimum_section_ur = list(filter_UR) + + self.optimum_section_ur.sort() + print(f"self.optimum_section_ur{self.optimum_section_ur} \n self.optimum_section_ur_results{self.optimum_section_ur_results}") + # print(f"self.result_UR{self.result_UR}") + + # selecting the section with most optimum UR + if len(self.optimum_section_ur) == 0: # no design was successful + logger.warning( + "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " + "criteria" + ) + logger.error( + "The solver did not find any adequate section from the defined list." + ) + + self.design_status = False + if len(self.failed_design_dict)>0: + logger.info( + "The details for the best section provided is being shown" + ) + self.result_UR = self.failed_design_dict['UR'] #temp TODO @Rutvik + self.common_result( + self, + list_result=self.failed_design_dict, + result_type=None, + ) + logger.warning( + "Re-define the list of sections or check the Design Preferences option and re-design." + ) + else: + logger.warning( + "Plastic section modulus of selected sections is less than required." + ) + return + # self.design_status_list.append(self.design_status) + + else: + self.failed_design_dict = None + self.result_UR = self.optimum_section_ur[-1] # optimum section which passes the UR check + print(f"self.result_UR{self.result_UR}") + self.design_status = True + self.common_result( + self, + list_result=self.optimum_section_ur_results, + result_type=self.result_UR, + ) + + else: # results based on cost + self.optimum_section_cost.sort() + + # selecting the section with most optimum cost + self.result_cost = self.optimum_section_cost[0] + self.design_status = True + # print results + # if len(self.optimum_section_ur) == 0: + # logger.warning( + # "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " + # "criteria" + # ) + # logger.error( + # "The solver did not find any adequate section from the defined list." + # ) + # logger.info( + # "Re-define the list of sections or check the Design Preferences option and re-design." + # ) + # self.design_status = False + # self.design_status_list.append(self.design_status) + # pass + # else: + # if self.optimization_parameter == "Utilization Ratio": + # self.common_result( + # self, + # list_result=self.optimum_section_ur_results, + # result_type=self.result_UR, + # ) + # else: + # self.result_UR = self.optimum_section_cost_results[ + # self.result_cost + # ]["UR"] + # + # # checking if the selected section based on cost satisfies the UR + # if self.result_UR > min(self.allowable_utilization_ratio, 1.0): + # trial_cost = [] + # for cost in self.optimum_section_cost: + # self.result_UR = self.optimum_section_cost_results[ + # cost + # ]["UR"] + # if self.result_UR <= min( + # self.allowable_utilization_ratio, 1.0 + # ): + # trial_cost.append(cost) + # + # trial_cost.sort() + # + # if len(trial_cost) == 0: # no design was successful + # logger.warning( + # "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " + # "criteria" + # ) + # logger.error( + # "The solver did not find any adequate section from the defined list." + # ) + # logger.info( + # "Re-define the list of sections or check the Design Preferences option and re-design." + # ) + # self.design_status = False + # self.design_status_list.append(self.design_status) + # print(f"design_status_list{self.design_status} \n") + # else: + # self.result_cost = trial_cost[ + # 0 + # ] # optimum section based on cost which passes the UR check + # self.design_status = True + # + # # results + # self.common_result( + # self, + # list_result=self.optimum_section_cost_results, + # result_type=self.result_cost, + # ) + # + # print(f"design_status_list2{self.design_status}") + self.design_status_list.append(self.design_status) + for status in self.design_status_list: + print('status list', status) + if status is False: + self.design_status = False + break + else: + self.design_status = True + + def common_result(self, list_result, result_type, flag=1): + try: + self.result_designation = list_result[result_type]["Designation"] # TODO debug + logger.info( + "The section is {}. The {} section has {} flange({}) and {} web({}). [Reference: Cl 3.7, IS 800:2007].".format( + self.input_section_classification[self.result_designation][0] , + self.result_designation, + self.input_section_classification[self.result_designation][1], round(self.input_section_classification[self.result_designation][3],2), + self.input_section_classification[self.result_designation][2], round(self.input_section_classification[self.result_designation][4],2) + ) + ) + self.result_latex_tension_zone = list_result[result_type]["latex.tension_zone"] + self.result_web_buckling_check = list_result[result_type]["Web.Buckling"] + self.result_eff_d = list_result[result_type]["Reduced.depth"] + self.result_buckling_crippling = list_result[result_type]["Buckling.crippling"] + + self.result_section_class = list_result[result_type]["Section class"] + self.result_effective_area = round(list_result[result_type]["Effective area"],2) + if self.effective_area_factor < 1.0: + logger.info( + "The actual effective area is {} mm2 and the reduced effective area is {} mm2 [Reference: Cl. 7.3.2, IS 800:2007]".format( + round((self.result_effective_area / self.effective_area_factor), 2), + self.result_effective_area, + ) + ) + + self.result_shear = round(list_result[result_type]["Shear Strength"], 2) + self.result_high_shear = list_result[result_type]["High Shear check"] + self.result_bending = round(list_result[result_type]["Bending Strength"], 2) + self.result_eff_len = round(list_result[result_type]["Effective_length"], 2) + self.result_cost = list_result[result_type]["Cost"] + self.result_betab = list_result[result_type]["Beta_b"] + + if self.result_web_buckling_check : + logger.warning( + "Thin web so take flange to resist moment and web to resist shear[Reference: Cl 8.2.1.1, IS 800:2007]") + if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: + logger.info('Transverse Stiffeners at supports required. Design not done for them') + self.result_web_buckling_simple_kv = round(list_result[result_type]['Kv'], 2) + self.result_web_buckling_simple_tau_crc = round(list_result[result_type]['tau_crc'], 2) + self.result_web_buckling_simple_lambda_w = round(list_result[result_type]['lambda_w'], 2) + self.result_web_buckling_simple_tau_b = round(list_result[result_type]['tau_b'], 2) + self.result_web_buckling_simple_V_cr = round(list_result[result_type]['V_cr'], 2) + elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: + logger.info('Transverse Stiffeners at supports and intermediate transverse stiffener required. Design not done for them') + self.result_web_buckling_simple_kv = round(list_result[result_type]['Kv'], 2) + self.result_web_buckling_simple_tau_crc = round(list_result[result_type]['tau_crc'], 2) + self.result_web_buckling_simple_lambda_w = round(list_result[result_type]['lambda_w'], 2) + self.result_web_buckling_simple_tau_b = round(list_result[result_type]['tau_b'], 2) + self.result_web_buckling_simple_V_cr = round(list_result[result_type]['V_cr'], 2) + self.result_web_buckling_simple_Mfr = round(list_result[result_type]['Mfr']*10**-6, 2) + self.result_web_buckling_simple_Nf = round(list_result[result_type]['Nf'], 2) + self.result_web_buckling_simple_c = round(list_result[result_type]['c'], 2) + self.result_web_buckling_simple_phi_girder = round(list_result[result_type]['phi_girder'], 2) + self.result_web_buckling_simple_s_girder = round(list_result[result_type]['s_girder'], 2) + self.result_web_buckling_simple_wtf_girder = round(list_result[result_type]['wtf_girder'], 2) + self.result_web_buckling_simple_sai_girder = round(list_result[result_type]['sai_girder'], 2) + self.result_web_buckling_simple_fv_girder = round(list_result[result_type]['fv_girder'], 2) + self.result_web_buckling_simple_V_p_girder = round(list_result[result_type]['V_p'], 2) + self.result_web_buckling_simple_fV_tf_girder = round(list_result[result_type]['V_tf_girder'], 2) + + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE : + self.result_mcr = round(list_result[result_type]['Mcr'], 2) + self.result_IF_lt = round(list_result[result_type]["IF_lt"], 2) + self.result_tc = round(list_result[result_type]["It"], 2) + self.result_wc = round(list_result[result_type]["Iw"], 2) + self.result_nd_esr_lt = round(list_result[result_type]["ND_ESR_lt"], 2) + self.result_phi_lt = round(list_result[result_type]["phi_lt"], 2) + self.result_srf_lt = round(list_result[result_type]["SRF_lt"], 2) + self.result_fcd__lt = round(list_result[result_type]["FCD_lt"], 2) + else: + self.result_mcr = 'NA' + self.result_IF_lt = 'NA' + self.result_tc = 'NA' + self.result_wc = 'NA' + self.result_nd_esr_lt = 'NA' + self.result_phi_lt = 'NA' + self.result_srf_lt = 'NA' + self.result_fcd__lt = 'NA' + + if self.web_buckling : + + self.result_bcI_eff = list_result[result_type]['WebBuckling.I_eff'] + self.result_bcA_eff = list_result[result_type]['WebBuckling.A_eff'] + self.result_bcr_eff = list_result[result_type]['WebBuckling.r_eff'] + self.result_bc = list_result[result_type]['Buckling_class'] + self.result_IF = round(list_result[result_type]["IF"], 2) + self.result_eff_sr = round(list_result[result_type]["Effective_SR"], 2) + self.result_ebs = round(list_result[result_type]["EBS"], 2) + self.result_nd_esr = round(list_result[result_type]["ND_ESR"], 2) + self.result_phi_zz = round(list_result[result_type]["phi"], 2) + self.result_srf = round(list_result[result_type]["SRF"], 2) + self.result_fcd_1_zz = round(list_result[result_type]["FCD_formula"], 2) + self.result_fcd_2 = round(list_result[result_type]["FCD_max"], 2) + self.result_fcd = round(list_result[result_type]["FCD"], 2) + self.result_capacity = round(list_result[result_type]["Capacity"], 2) + self.result_crippling = round(list_result[result_type]["Web_crippling"], 2) + else: + self.result_bc = 'NA' + self.result_IF = 'NA' + self.result_eff_sr = 'NA' + self.result_lambda_vv = 'NA' + self.result_lambda_psi = 'NA' + self.result_ebs = 'NA' + self.result_nd_esr = 'NA' + self.result_phi_zz = 'NA' + self.result_srf = 'NA' + self.result_fcd_1_zz = 'NA' + self.result_fcd_2 = 'NA' + self.result_fcd = 'NA' + self.result_capacity = 'NA' + self.result_crippling = 'NA' + if self.result_high_shear and self.input_section_classification[self.result_designation][0] != 'Semi-Compact': + self.result_mfd = list_result[result_type]["Mfd"] + self.result_beta_reduced = list_result[result_type]["Beta_reduced"] + self.result_Md= list_result[result_type]["M_d"] + except: + self.result_designation = list_result["Designation"] + logger.info( + "The section is {}. The {} section has {} flange({}) and {} web({}). [Reference: Cl 3.7, IS 800:2007].".format( + self.input_section_classification[self.result_designation][0] , + self.result_designation, + self.input_section_classification[self.result_designation][1], round(self.input_section_classification[self.result_designation][3],2), + self.input_section_classification[self.result_designation][2], round(self.input_section_classification[self.result_designation][4],2) + ) + ) + self.result_latex_tension_zone = list_result["latex.tension_zone"] + self.result_web_buckling_check = list_result["Web.Buckling"] + self.result_eff_d = list_result["Reduced.depth"] + self.result_buckling_crippling = list_result["Buckling.crippling"] + + self.result_section_class = list_result["Section class"] + self.result_effective_area = round(list_result["Effective area"],2) + if self.effective_area_factor < 1.0: + logger.info( + "The actual effective area is {} mm2 and the reduced effective area is {} mm2 [Reference: Cl. 7.3.2, IS 800:2007]".format( + round((self.result_effective_area / self.effective_area_factor), 2), + self.result_effective_area, + ) + ) + + self.result_shear = round(list_result["Shear Strength"], 2) + self.result_high_shear = list_result["High Shear check"] + self.result_bending = round(list_result["Bending Strength"], 2) + self.result_eff_len = round(list_result["Effective_length"], 2) + self.result_cost = list_result["Cost"] + self.result_betab = list_result["Beta_b"] + + if self.result_web_buckling_check : + logger.warning( + "Thin web so take flange to resist moment and web to resist shear[Reference: Cl 8.2.1.1, IS 800:2007]") + if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: + logger.info('Transverse Stiffeners at supports required. Design not done for them') + self.result_web_buckling_simple_kv = round(list_result['Kv'], 2) + self.result_web_buckling_simple_tau_crc = round(list_result['tau_crc'], 2) + self.result_web_buckling_simple_lambda_w = round(list_result['lambda_w'], 2) + self.result_web_buckling_simple_tau_b = round(list_result['tau_b'], 2) + self.result_web_buckling_simple_V_cr = round(list_result['V_cr'], 2) + elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: + logger.info('Transverse Stiffeners at supports and intermediate transverse stiffener required. Design not done for them') + self.result_web_buckling_simple_kv = round(list_result['Kv'], 2) + self.result_web_buckling_simple_tau_crc = round(list_result['tau_crc'], 2) + self.result_web_buckling_simple_lambda_w = round(list_result['lambda_w'], 2) + self.result_web_buckling_simple_tau_b = round(list_result['tau_b'], 2) + self.result_web_buckling_simple_V_cr = round(list_result['V_cr'], 2) + self.result_web_buckling_simple_Mfr = round(list_result['Mfr']*10**-6, 2) + self.result_web_buckling_simple_Nf = round(list_result['Nf'], 2) + self.result_web_buckling_simple_c = round(list_result['c'], 2) + self.result_web_buckling_simple_phi_girder = round(list_result['phi_girder'], 2) + self.result_web_buckling_simple_s_girder = round(list_result['s_girder'], 2) + self.result_web_buckling_simple_wtf_girder = round(list_result['wtf_girder'], 2) + self.result_web_buckling_simple_sai_girder = round(list_result['sai_girder'], 2) + self.result_web_buckling_simple_fv_girder = round(list_result['fv_girder'], 2) + self.result_web_buckling_simple_V_p_girder = round(list_result['V_p'], 2) + self.result_web_buckling_simple_fV_tf_girder = round(list_result['V_tf_girder'], 2) + + if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE : + self.result_mcr = round(list_result['Mcr'], 2) + self.result_IF_lt = round(list_result["IF_lt"], 2) + self.result_tc = round(list_result["It"], 2) + self.result_wc = round(list_result["Iw"], 2) + self.result_nd_esr_lt = round(list_result["ND_ESR_lt"], 2) + self.result_phi_lt = round(list_result["phi_lt"], 2) + self.result_srf_lt = round(list_result["SRF_lt"], 2) + self.result_fcd__lt = round(list_result["FCD_lt"], 2) + else: + self.result_mcr = 'NA' + self.result_IF_lt = 'NA' + self.result_tc = 'NA' + self.result_wc = 'NA' + self.result_nd_esr_lt = 'NA' + self.result_phi_lt = 'NA' + self.result_srf_lt = 'NA' + self.result_fcd__lt = 'NA' + + if self.web_buckling : + + self.result_bcI_eff = list_result['WebBuckling.I_eff'] + self.result_bcA_eff = list_result['WebBuckling.A_eff'] + self.result_bcr_eff = list_result['WebBuckling.r_eff'] + self.result_bc = list_result['Buckling_class'] + self.result_IF = round(list_result["IF"], 2) + self.result_eff_sr = round(list_result["Effective_SR"], 2) + self.result_ebs = round(list_result["EBS"], 2) + self.result_nd_esr = round(list_result["ND_ESR"], 2) + self.result_phi_zz = round(list_result["phi"], 2) + self.result_srf = round(list_result["SRF"], 2) + self.result_fcd_1_zz = round(list_result["FCD_formula"], 2) + self.result_fcd_2 = round(list_result["FCD_max"], 2) + self.result_fcd = round(list_result["FCD"], 2) + self.result_capacity = round(list_result["Capacity"], 2) + self.result_crippling = round(list_result["Web_crippling"], 2) + else: + self.result_bc = 'NA' + self.result_IF = 'NA' + self.result_eff_sr = 'NA' + self.result_lambda_vv = 'NA' + self.result_lambda_psi = 'NA' + self.result_ebs = 'NA' + self.result_nd_esr = 'NA' + self.result_phi_zz = 'NA' + self.result_srf = 'NA' + self.result_fcd_1_zz = 'NA' + self.result_fcd_2 = 'NA' + self.result_fcd = 'NA' + self.result_capacity = 'NA' + self.result_crippling = 'NA' + if self.result_high_shear and self.input_section_classification[self.result_designation][0] != 'Semi-Compact': + self.result_mfd = list_result["Mfd"] + self.result_beta_reduced = list_result["Beta_reduced"] + self.result_Md= list_result["M_d"] + + ### start writing save_design from here! + def save_design(self, popup_summary): + # print('self.design_status', self.design_status,'len(self.failed_design_dict)', len(self.failed_design_dict)) + if (self.design_status and self.failed_design_dict is None) or (not self.design_status and len(self.failed_design_dict)>0):# TODO @Rutvik + self.section_property = self.section_connect_database(self, self.result_designation) + if self.sec_profile=='Columns' or self.sec_profile=='Beams' or self.sec_profile == VALUES_SECTYPE[1]: + self.report_column = {KEY_DISP_SEC_PROFILE: "ISection", + KEY_DISP_SECSIZE_pg: (self.section_property.designation, self.sec_profile), + KEY_DISP_COLSEC_REPORT: self.section_property.designation, + KEY_DISP_MATERIAL: self.section_property.material, + # KEY_DISP_APPLIED_AXIAL_FORCE: self.section_property., + KEY_REPORT_MASS: self.section_property.mass, + KEY_REPORT_AREA: round(self.section_property.area * 1e-2, 2), + KEY_REPORT_DEPTH: self.section_property.depth, + KEY_REPORT_WIDTH: self.section_property.flange_width, + KEY_REPORT_WEB_THK: self.section_property.web_thickness, + KEY_REPORT_FLANGE_THK: self.section_property.flange_thickness, + KEY_DISP_FLANGE_S_REPORT: self.section_property.flange_slope, + KEY_REPORT_R1: self.section_property.root_radius, + KEY_REPORT_R2: self.section_property.toe_radius, + KEY_REPORT_IZ: round(self.section_property.mom_inertia_z * 1e-4, 2), + KEY_REPORT_IY: round(self.section_property.mom_inertia_y * 1e-4, 2), + KEY_REPORT_RZ: round(self.section_property.rad_of_gy_z * 1e-1, 2), + KEY_REPORT_RY: round(self.section_property.rad_of_gy_y * 1e-1, 2), + KEY_REPORT_ZEZ: round(self.section_property.elast_sec_mod_z * 1e-3, 2), + KEY_REPORT_ZEY: round(self.section_property.elast_sec_mod_y * 1e-3, 2), + KEY_REPORT_ZPZ: round(self.section_property.plast_sec_mod_z * 1e-3, 2), + KEY_REPORT_ZPY: round(self.section_property.plast_sec_mod_y * 1e-3, 2)} + + + + self.report_input = \ + {#KEY_MAIN_MODULE: self.mainmodule, + KEY_MODULE: self.module, #"Axial load on column " + KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, + KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, + KEY_DISP_LENGTH_BEAM: self.result_eff_len, + KEY_DISP_SEC_PROFILE: self.sec_profile, + KEY_DISP_SECSIZE_pg: str(self.sec_list), + KEY_MATERIAL: self.material, + "Selected Section Details": self.report_column, + KEY_BEAM_SUPP_TYPE: self.latex_design_type, + } + + # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0]: + # self.report_input.update({ + # KEY_DISP_BENDING: self.bending_type}) + # elif self.latex_design_type == VALUES_SUPP_TYPE_temp[1]: + # self.report_input.update({ + # KEY_BEAM_SUPP_TYPE_DESIGN: self.support, + # # KEY_DISP_BENDING: self.bending_type, + # }) + self.report_input.update({ + KEY_DISP_SUPPORT : self.support, + KEY_DISP_ULTIMATE_STRENGTH_REPORT: self.material_property.fu, + KEY_DISP_YIELD_STRENGTH_REPORT: self.material_property.fy, + "End Conditions - " + str(self.support): "TITLE", + }) + # if self.Latex_length == 'NA': + if self.support == KEY_DISP_SUPPORT1: + self.report_input.update({ + DISP_TORSIONAL_RES: self.Torsional_res, + DISP_WARPING_RES:self.Warping }) + else: + self.report_input.update({ + DISP_SUPPORT_RES: self.Support, + DISP_TOP_RES: self.Top}) + self.report_input.update({ + "Design Preference" : "TITLE", + KEY_DISP_EFFECTIVE_AREA_PARA: self.effective_area_factor, + KEY_DISP_CLASS: self.allow_class, + KEY_DISP_LOAD: self.Loading, + KEY_DISPP_LENGTH_OVERWRITE: self.latex_efp, + KEY_DISP_BEARING_LENGTH + ' (mm)': self.bearing_length, + + }) + # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0] and self.result_web_buckling_check: + # self.report_input.update({ + # KEY_ShearBuckling: self.support_cndition_shear_buckling + # }) + # self.report_input.update({ + # # KEY_DISP_SEC_PROFILE: self.sec_profile, + # "I Section - anical PropertiesMech": "TITLE", + # }) + self.report_input.update() + self.report_check = [] + + t1 = ('Selected', 'Selected Member Data', '|p{5cm}|p{2cm}|p{2cm}|p{2cm}|p{4cm}|') + self.report_check.append(t1) + + t1 = ('SubSection', 'Effective Area', '|p{4cm}|p{1.5cm}|p{9.5cm}|p{1cm}|') + self.report_check.append(t1) + t1 = ('Effective Area ($mm^2$)', ' ', + sectional_area_change(round(self.result_effective_area,2), round(self.section_property.area,2), + self.effective_area_factor), + ' ') + self.report_check.append(t1) + + # t1 = ('SubSection', 'Section parameters', '|p{4cm}|p{1.5cm}|p{9.5cm}|p{1cm}|') + # self.report_check.append(t1) + # t1 = ('d_{web}', ' ', + # sectional_area_change(round(self.result_effective_area,2), round(self.section_property.area,2), + # self.effective_area_factor), + # ' ') + # self.report_check.append(t1) + + t1 = ('SubSection', 'Section Classification', '|p{3cm}|p{3.5cm}|p{8.5cm}|p{1cm}|') + self.report_check.append(t1) + t1 = ('Web Class', 'Neutral Axis at Mid-Depth', + cl_3_7_2_section_classification_web(round(self.result_eff_d, 2), round(self.section_property.web_thickness, 2), round(self.input_section_classification[self.result_designation][4],2), + self.epsilon, self.section_property.type, + self.input_section_classification[self.result_designation][2]), + ' ') + self.report_check.append(t1) + t1 = ('Flange Class', self.section_property.type, + cl_3_7_2_section_classification_flange(round(self.section_property.flange_width/2, 2), + round(self.section_property.flange_thickness, 2), round( + self.input_section_classification[self.result_designation][3], 2), + self.epsilon, + self.input_section_classification[self.result_designation][1]), + ' ') + self.report_check.append(t1) + t1 = ('Section Class', ' ', + cl_3_7_2_section_classification( + self.input_section_classification[self.result_designation][0]), + ' ') + self.report_check.append(t1) + + t1 = ('SubSection', 'Web Slenderness Check', '|p{3cm}|p{4cm}|p{6cm}|p{3 cm}|') + self.report_check.append(t1) + t1 = (KEY_DISP_Web_Buckling, cl_8_2_1web_buckling_required(round(self.epsilon,2),round(67 * self.epsilon,2)), + cl_8_2_1web_buckling_1(self.result_eff_d, self.section_property.web_thickness, + round(self.result_eff_d / self.section_property.web_thickness,2), self.result_web_buckling_check), + get_pass_fail(67 * self.epsilon, round(self.result_eff_d / self.section_property.web_thickness,2), relation="Custom")) + self.report_check.append(t1) + if self.result_web_buckling_check: + t1 = ('SubSection', 'Shear Strength Results: ' + self.support_cndition_shear_buckling, '|p{3.5cm}|p{1.5cm}|p{10cm}|p{1cm}|') + self.report_check.append(t1) + if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: + t1 = (KEY_DISP_K_v_latex , ' ',cl_8_4_2_2_KV(self.result_web_buckling_simple_kv,self.support_cndition_shear_buckling), + + ' ') + elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: + t1 = (KEY_DISP_Transverse_Stiffener_spacing, ' ', + cl_8_4_2_2_Transverse_Stiffener_spacing(self.result_web_buckling_simple_c), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_K_v_latex, ' ',cl_8_4_2_2_KV(self.result_web_buckling_simple_kv,self.support_cndition_shear_buckling, self.result_web_buckling_simple_c,self.result_eff_d ), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_Elastic_Critical_shear_stress_web, ' ', + cl_8_4_2_2_taucrc(self.result_web_buckling_simple_kv, 2 * 10 ** 5, 0.3, + self.result_eff_d, + self.section_property.web_thickness, + self.result_web_buckling_simple_tau_crc), + ' ') + self.report_check.append(t1) + + + + t1 = (KEY_DISP_slenderness_ratio_web, ' ', + cl_8_4_2_2_slenderness_ratio(self.fyw, self.result_web_buckling_simple_lambda_w, + self.result_web_buckling_simple_tau_crc), + ' ') + self.report_check.append(t1) + + t1 = (KEY_OUT_DISP_WELD_SHEAR_STRESS, ' ', + cl_8_4_2_2_shearstress_web(self.fyw, self.result_web_buckling_simple_lambda_w, self.result_web_buckling_simple_tau_b), + ' ') + self.report_check.append(t1) + + if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: + t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR + '(V_{d})', self.load.shear_force * 10 ** -3, + cl_8_4_2_2_shearstrength(self.result_eff_d, self.section_property.web_thickness,self.result_web_buckling_simple_V_cr, + self.result_web_buckling_simple_tau_b, self.result_shear), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_ALLOW_SHEAR, ' ', + cl_8_2_1_2_shear_check(round(self.result_shear, 2), round(0.6 * self.result_shear, 2), + self.result_high_shear, self.load.shear_force * 10 ** -3), + get_pass_fail(self.load.shear_force * 10 ** -3, round(0.6 * self.result_shear, 2), + relation="Warn", M1=self.result_high_shear)) + self.report_check.append(t1) + + elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: + t1 = (KEY_DISP_BUCKLING_STRENGTH + '(V_p)', ' ', + cl_8_4_1_plastic_shear_resistance_Vp(self.result_eff_d,self.section_property.web_thickness,self.fyw, self.result_web_buckling_simple_V_p_girder + ), + ' ') + self.report_check.append(t1) + + t1 = ('N_f (N)', ' ', + cl_8_4_2_2_N_f(self.section_property.depth, + self.section_property.flange_thickness, + self.section_property.depth - self.section_property.flange_thickness, + round(self.load.moment / ( + self.section_property.depth - self.section_property.flange_thickness),2) , self.load.moment + ), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_reduced_moment + '(M_{fr})', ' ', + cl_8_4_2_2_TensionField_reduced_moment(self.result_web_buckling_simple_Mfr, self.section_property.flange_width,self.section_property.flange_thickness, + self.fyf, round(self.load.moment / ( + self.section_property.depth - self.section_property.flange_thickness),2) + ), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_tension_field_incline , ' ', + cl_8_4_2_2_TensionField_phi(self.result_web_buckling_simple_phi_girder, self.result_web_buckling_simple_c,self.result_eff_d + ), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_AnchoragelengthTensionField, ' ', + cl_8_4_2_2_TensionField_anchorage_length(self.result_web_buckling_simple_s_girder, self.result_web_buckling_simple_phi_girder, + self.result_web_buckling_simple_Mfr, self.fyw, self.section_property.web_thickness + ), + ' ') + self.report_check.append(t1) + + + t1 = (KEY_DISP_WidthTensionField , ' ', + cl_8_4_2_2_KEY_DISP_WidthTensionField(self.result_eff_d,self.result_web_buckling_simple_phi_girder, + self.result_web_buckling_simple_c, + self.result_web_buckling_simple_s_girder,self.result_web_buckling_simple_wtf_girder + ), + ' ') + self.report_check.append(t1) + # t1 = (KEY_DISP_reduced_moment + '(M_{fr}', ' ', + # cl_8_4_2_2_TensionField_reduced_moment(self.result_eff_d, + # self.result_web_buckling_simple_phi_girder, + # self.result_web_buckling_simple_c, + # self.result_web_buckling_simple_s_girder,self.result_web_buckling_simple_wtf_girder + # ), + # ' ') + # self.report_check.append(t1) + t1 = (KEY_DISP_Yield_Strength_Tension_field, ' ', + cl_8_4_2_2_Yield_Strength_Tension_field(self.fyw, + self.result_web_buckling_simple_tau_b, + self.result_web_buckling_simple_phi_girder, + self.result_web_buckling_simple_fv_girder + ), + ' ') + self.report_check.append(t1) + t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR + '(V_{d})', self.load.shear_force * 10 ** -3, + cl_8_4_2_2_shearstrength_tensionfield(self.effective_depth * self.section_property.web_thickness, self.result_web_buckling_simple_tau_b,self.result_web_buckling_simple_V_p_girder, + self.result_shear,self.section_property.web_thickness, self.result_web_buckling_simple_wtf_girder, self.result_web_buckling_simple_fv_girder, + self.result_web_buckling_simple_phi_girder, round(self.result_web_buckling_simple_fV_tf_girder * 10**-3,2)), + ' ') + self.report_check.append(t1) + + + else: + + t1 = ('SubSection', 'Shear Strength Results', '|p{4cm}|p{5cm}|p{5.5cm}|p{1.5cm}|') + self.report_check.append(t1) + + t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR, self.load.shear_force * 10 ** -3, + cl_8_4_shear_yielding_capacity_member_(self.section_property.depth, + self.section_property.web_thickness, self.material_property.fy, + self.gamma_m0, round(self.result_shear, 2)), + get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_shear, 2), relation="lesser")) + self.report_check.append(t1) + + t1 = (KEY_DISP_ALLOW_SHEAR, ' ', + cl_8_2_1_2_shear_check(round(self.result_shear,2), round(0.6 * self.result_shear,2), self.result_high_shear,self.load.shear_force*10**-3), + get_pass_fail(self.load.shear_force*10**-3, round(0.6 * self.result_shear,2), relation="Warn",M1=self.result_high_shear)) + self.report_check.append(t1) + + # t1 = ('SubSection', 'Moment Strength Results', '|p{4cm}|p{4cm}|p{6.5cm}|p{1.5cm}|') + + t1 = ('SubSection', 'Moment Strength Results', '|p{4cm}|p{1.5cm}|p{9cm}|p{1.5cm}|') + self.report_check.append(t1) + if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: + if self.result_high_shear: + t1 = (KEY_DISP_Bending_STRENGTH_MOMENT, self.load.moment*10**-6, + cl_9_2_2_combine_shear_bending_md_init( + self.section_property.elast_sec_mod_z, + self.section_property.plast_sec_mod_z, + self.material_property.fy, self.support, + self.gamma_m0, round(self.result_betab, 2), + round(self.result_Md * 10 ** -6, 2), self.result_section_class + ), + ' ') + self.report_check.append(t1) + t1 = (KEY_DISP_PLASTIC_STRENGTH_MOMENT,' ', + cl_9_2_2_combine_shear_bending_mfd( + self.section_property.plast_sec_mod_z, + self.section_property.depth, + self.section_property.web_thickness, + self.material_property.fy, + self.gamma_m0, + round(self.result_mfd * 10 ** -6, 2)), + ' ') + self.report_check.append(t1) + + # temp = cl_8_2_1_2_plastic_moment_capacity_member(self.result_betab, + # self.section_property.plast_sec_mod_z, + # self.material_property.fy, self.gamma_m0, + # round(self.result_bending, 2)) + # print('tempt',temp) + + t1 = (KEY_DISP_DESIGN_STRENGTH_MOMENT, self.load.moment*10**-6, + cl_9_2_2_combine_shear_bending(round(self.result_bending,2),self.section_property.elast_sec_mod_z, + self.material_property.fy,self.result_section_class,self.load.shear_force*10**-3, round(self.result_shear,2), + self.gamma_m0, round(self.result_beta_reduced,2),round(self.result_Md*10**-6,2),round(self.result_mfd*10**-6,2)), + get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) + self.report_check.append(t1) + + else: + t1 = (KEY_DISP_DESIGN_STRENGTH_MOMENT, self.load.moment*10**-6, + cl_8_2_1_2_moment_capacity_member(round(self.result_betab,3), + self.section_property.plast_sec_mod_z, + self.material_property.fy, self.gamma_m0, + round(self.result_bending, 2), self.section_property.elast_sec_mod_z,self.result_section_class,self.support), + get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) + self.report_check.append(t1) + elif self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + # KEY_DISP_Elastic_CM_latex + t1 = (KEY_DISP_Elastic_CM_latex, ' ', + cl_8_2_2_1_Mcr( + self.result_mcr, + self.material_property.modulus_of_elasticity, + self.section_property.mom_inertia_y, + self.result_eff_len, self.material_property.modulus_of_elasticity/(2*1.3), + self.section_property.It, self.section_property.Iw + # round(self.result_Md * 10 ** -6, 2), self.result_section_class + ), + ' ') + self.report_check.append(t1) + + # t1 = (KEY_DISP_I_eff_latex + '($mm^4$)', ' ', + # cl_8_7_3_Ieff_web_check(self.bearing_length, self.section_property.web_thickness, + # round(self.result_bcI_eff,2)), + # ' ') + # self.report_check.append(t1) + + # t1 = (KEY_DISP_A_eff_latex+ '($mm^2$)', ' ', + # cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, + # self.result_bcA_eff), + # ' ') + # self.report_check.append(t1) + + # t1 = (KEY_DISP_r_eff_latex+ '(mm)', ' ', + # cl_8_7_3_reff_web_check(round(self.result_bcr_eff,2), round(self.result_bcI_eff,2), + # self.result_bcA_eff), + # ' ') + # self.report_check.append(t1) + + t1 = (KEY_DISP_SLENDER + r'($\lambda_{LT}$)', ' ', + cl_8_2_2_slenderness(round(self.result_betab, 2),self.section_property.elast_sec_mod_z, + self.section_property.plast_sec_mod_z,self.result_mcr,self.material_property.fy, + self.result_nd_esr_lt), + ' ') + self.report_check.append(t1) + + # # t1 = (KEY_DISP_SLENDER, ' ', + # # cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), + # # self.result_eff_sr), + # # ' ') + # # self.report_check.append(t1) + + # t1 = (KEY_DISP_BUCKLING_CURVE_ZZ, ' ', + # cl_8_7_1_5_buckling_curve(), + # ' ') + # self.report_check.append(t1) + + t1 = (KEY_DISP_IMPERFECTION_FACTOR_ZZ + r'($\alpha_{LT}$)', ' ', + cl_8_7_1_5_imperfection_factor(self.result_IF_lt), + ' ') + self.report_check.append(t1) + + # t1 = (KEY_DISP_EULER_BUCKLING_STRESS_ZZ, ' ', + # cl_8_7_1_5_buckling_stress(self.section_property.modulus_of_elasticity,self.result_eff_sr,self.result_ebs), + # ' ') + # self.report_check.append(t1) + + t1 = (r'$\phi_{LT}$', ' ', + cl_8_2_2_phi(self.result_IF_lt,self.result_nd_esr_lt, self.result_phi_lt), + ' ') + self.report_check.append(t1) + + t1 = ('Bending Compressive stress($N/mm^2$)', ' ', + cl_8_2_2_Bending_Compressive(self.material_property.fy,self.gamma_m0,self.result_nd_esr_lt,self.result_phi_lt,self.result_fcd__lt), + ' ') + self.report_check.append(t1) + + # t1 = (KEY_DISP_BUCKLING_STRENGTH, self.load.shear_force * 10 ** -3, + # cl_7_1_2_design_compressive_strength(self.result_capacity,round(( + # self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness,2), self.result_fcd,self.load.shear_force * 10 ** -3), + # get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_capacity, 2), relation="leq")) + # self.report_check.append(t1) + + if self.result_high_shear: + t1 = (KEY_DISP_LTB_Bending_STRENGTH_MOMENT, self.load.moment*10**-6, + cl_9_2_2_combine_shear_bending_md_init( + self.section_property.elast_sec_mod_z, + self.section_property.plast_sec_mod_z, + self.material_property.fy, self.support, + self.gamma_m0, round(self.result_betab, 2), + round(self.result_Md * 10 ** -6, 2), self.result_section_class + ), + ' ') + self.report_check.append(t1) + t1 = (KEY_DISP_PLASTIC_STRENGTH_MOMENT,' ', + cl_9_2_2_combine_shear_bending_mfd( + self.section_property.plast_sec_mod_z, + self.section_property.depth, + self.section_property.web_thickness, + self.material_property.fy, + self.gamma_m0, + round(self.result_mfd * 10 ** -6, 2)), + ' ') + self.report_check.append(t1) + + # temp = cl_8_2_1_2_plastic_moment_capacity_member(self.result_betab, + # self.section_property.plast_sec_mod_z, + # self.material_property.fy, self.gamma_m0, + # round(self.result_bending, 2)) + # print('tempt',temp) + t1 = (KEY_DISP_REDUCE_STRENGTH_MOMENT, self.load.moment*10**-6, + cl_9_2_2_combine_shear_bending(round(self.result_bending,2),self.section_property.elast_sec_mod_z, + self.material_property.fy,self.result_section_class,self.load.shear_force*10**-3, round(self.result_shear,2), + self.gamma_m0, round(self.result_betab,2),round(self.result_Md*10**-6,2),round(self.result_mfd*10**-6,2)), + get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) + self.report_check.append(t1) + + else: + t1 = ('Moment Strength (kNm)', self.load.moment*10**-6, + cl_8_2_2_moment_capacity_member(round(self.result_betab,2), + self.section_property.plast_sec_mod_z, + self.material_property.fy, self.gamma_m0, + round(self.result_bending, 2),self.section_property.elast_sec_mod_z,self.result_section_class,self.support), + get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) + self.report_check.append(t1) + + if self.result_buckling_crippling: + t1 = ('SubSection', 'Web Buckling Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') + self.report_check.append(t1) + + t1 = (KEY_DISP_I_eff_latex + '($mm^4$)', ' ', + cl_8_7_3_Ieff_web_check(self.bearing_length, self.section_property.web_thickness, + round(self.result_bcI_eff,2)), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_A_eff_latex+ '($mm^2$)', ' ', + cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, + self.result_bcA_eff), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_r_eff_latex+ '(mm)', ' ', + cl_8_7_3_reff_web_check(round(self.result_bcr_eff,2), round(self.result_bcI_eff,2), + self.result_bcA_eff), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_SLENDER + r'($\lambda$)', ' ', + cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), + self.result_eff_sr), + ' ') + self.report_check.append(t1) + + # t1 = (KEY_DISP_SLENDER, ' ', + # cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), + # self.result_eff_sr), + # ' ') + # self.report_check.append(t1) + + t1 = (KEY_DISP_BUCKLING_CURVE_ZZ, ' ', + cl_8_7_1_5_buckling_curve(), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_IMPERFECTION_FACTOR_ZZ + r'($\alpha$)', ' ', + cl_8_7_1_5_imperfection_factor(self.result_IF), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_EULER_BUCKLING_STRESS_ZZ, ' ', + cl_8_7_1_5_buckling_stress(self.section_property.modulus_of_elasticity,self.result_eff_sr,self.result_ebs), + ' ') + self.report_check.append(t1) + + t1 = (r'$\phi$', ' ', + cl_8_7_1_5_phi(0.49,self.result_eff_sr, self.result_phi_zz), + ' ') + self.report_check.append(t1) + + t1 = ('Buckling stress($N/mm^2$)', ' ', + cl_8_7_1_5_Buckling(self.material_property.fy,self.gamma_m0,self.result_eff_sr,self.result_phi_zz,self.result_fcd_2,self.result_fcd), + ' ') + self.report_check.append(t1) + + t1 = (KEY_DISP_BUCKLING_STRENGTH, self.load.shear_force * 10 ** -3, + cl_7_1_2_design_compressive_strength(self.result_capacity,round(( + self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness,2), self.result_fcd,self.load.shear_force * 10 ** -3), + get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_capacity, 2), relation="leq")) + self.report_check.append(t1) + + t1 = ('SubSection', 'Web Bearing Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') + self.report_check.append(t1) + + t1 = ('Bearing Strength(kN)', self.load.shear_force * 10 ** -3, + cl_8_7_4_Bearing_stiffener_check(self.bearing_length, round(2.5 * ( + self.section_property.root_radius + self.section_property.flange_thickness), 2), + self.section_property.web_thickness, + self.material_property.fy, self.gamma_m0, + round(self.result_crippling, 2), + self.section_property.root_radius, + self.section_property.flange_thickness), + get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_crippling, 2), relation="leq")) + + self.report_check.append(t1) + + t1 = ('SubSection', 'Utilization', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') + self.report_check.append(t1) + # TODO + if self.result_buckling_crippling: + t1 = (KEY_DISP_Utilization_Ratio, 1.0, + Utilization_Ratio_Latex(self.load.shear_force * 10 ** -3,round(self.result_shear, 2), + self.load.moment*10**-6, round(self.result_bending, 2), + self.result_UR,type=2,Pd=self.result_capacity, fw=self.result_crippling), + get_pass_fail(1.0, self.result_UR, relation="geq")) + else: + t1 = (KEY_DISP_Utilization_Ratio, 1.0, + Utilization_Ratio_Latex(self.load.shear_force * 10 ** -3,round(self.result_shear, 2), + self.load.moment*10**-6, round(self.result_bending, 2), + self.result_UR), + get_pass_fail(1.0, self.result_UR, relation="geq")) + self.report_check.append(t1) +# + # elif not self.design_status or len(self.failed_design_dict)>0: + # self.section_property = self.section_connect_database(self, self.result_designation) + + # if self.sec_profile=='Columns' or self.sec_profile=='Beams' or self.sec_profile == VALUES_SECTYPE[1]: + # self.report_column = {KEY_DISP_SEC_PROFILE: "ISection", + # KEY_DISP_SECSIZE: (self.section_property.designation, self.sec_profile), + # KEY_DISP_COLSEC_REPORT: self.section_property.designation, + # KEY_DISP_MATERIAL: self.section_property.material, + # # KEY_DISP_APPLIED_AXIAL_FORCE: self.section_property., + # KEY_REPORT_MASS: self.section_property.mass, + # KEY_REPORT_AREA: round(self.section_property.area * 1e-2, 2), + # KEY_REPORT_DEPTH: self.section_property.depth, + # KEY_REPORT_WIDTH: self.section_property.flange_width, + # KEY_REPORT_WEB_THK: self.section_property.web_thickness, + # KEY_REPORT_FLANGE_THK: self.section_property.flange_thickness, + # KEY_DISP_FLANGE_S_REPORT: self.section_property.flange_slope, + # KEY_REPORT_R1: self.section_property.root_radius, + # KEY_REPORT_R2: self.section_property.toe_radius, + # KEY_REPORT_IZ: round(self.section_property.mom_inertia_z * 1e-4, 2), + # KEY_REPORT_IY: round(self.section_property.mom_inertia_y * 1e-4, 2), + # KEY_REPORT_RZ: round(self.section_property.rad_of_gy_z * 1e-1, 2), + # KEY_REPORT_RY: round(self.section_property.rad_of_gy_y * 1e-1, 2), + # KEY_REPORT_ZEZ: round(self.section_property.elast_sec_mod_z * 1e-3, 2), + # KEY_REPORT_ZEY: round(self.section_property.elast_sec_mod_y * 1e-3, 2), + # KEY_REPORT_ZPZ: round(self.section_property.plast_sec_mod_z * 1e-3, 2), + # KEY_REPORT_ZPY: round(self.section_property.plast_sec_mod_y * 1e-3, 2)} + + + + # self.report_input = \ + # {#KEY_MAIN_MODULE: self.mainmodule, + # KEY_MODULE: self.module, #"Axial load on column " + # KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, + # KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, + # KEY_DISP_LENGTH_BEAM: self.result_eff_len, + # KEY_DISP_SEC_PROFILE: self.sec_profile, + # KEY_DISP_SECSIZE: str(self.sec_list), + # KEY_MATERIAL: self.material, + # "Selected Section Details": self.report_column, + # KEY_BEAM_SUPP_TYPE: self.latex_design_type, + # } + + # if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: + # t1 = ('SubSection', 'Lateral Torsional Buckling Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') + # self.report_check.append(t1) + + # t1 = ('SubSection', 'Web Bearing Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') + # self.report_check.append(t1) + + # t1 = ('Bearing Strength(kN)', self.load.shear_force * 10 ** -3, + # cl_8_7_4_Bearing_stiffener_check(self.bearing_length, round(2.5 * ( + # self.section_property.root_radius + self.section_property.flange_thickness), 2), + # self.section_property.web_thickness, + # self.material_property.fy, self.gamma_m0, + # round(self.result_crippling, 2), + # self.section_property.root_radius, + # self.section_property.flange_thickness), + # get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_crippling, 2), relation="leq")) + + # self.report_check.append(t1) + # t1 = (KEY_DISP_A_eff_latex + '(mm^2)', ' ', + # cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, + # self.result_bcA_eff), + # ' ') + # self.report_check.append(t1) + # if self.latex_tension_zone == True : + # t1 = (KEY_DISP_TENSION_HOLES, ' ', + # sectional_area_change(self.result_effective_area, self.section_property.area, + # self.effective_area_factor), + # ' ') + # self.report_check.append(t1) + + # else: + # t1 = (KEY_DISP_ALLOW_SHEAR, self.load.shear_force, + # allow_shear_capacity(round(self.result_shear, 2), round(0.6 * self.result_shear, 2)), + # get_pass_fail(self.load.shear_force)) + # self.report_check.append(t1) + + + + # self.h = (self.beam_D - (2 * self.beam_tf)) + # + # 1.1 Input sections display + # t1 = ('SubSection', 'List of Input Sections',self.sec_list), + # self.report_check.append(t1) + # + # # 2.2 CHECK: Buckling Class - Compatibility Check + # t1 = ('SubSection', 'Buckling Class - Compatibility Check', '|p{4cm}|p{3.5cm}|p{6.5cm}|p{2cm}|') + # self.report_check.append(t1) + # + # t1 = ("Section Class ", comp_column_class_section_check_required(self.result_section_class, self.h, self.bf), + # comp_column_class_section_check_provided(self.bucklingclass, self.h, self.bf, self.tf, self.var_h_bf), + # 'Compatible') # if self.bc_compatibility_status is True else 'Not compatible') + # self.report_check.append(t1) + + # t1 = ("h/bf , tf ", comp_column_class_section_check_required(self.bucklingclass, self.h, self.bf), + # comp_column_class_section_check_provided(self.bucklingclass, self.h, self.bf, self.tf, self.var_h_bf), + # 'Compatible') # if self.bc_compatibility_status is True else 'Not compatible') + # self.report_check.append(t1) + # + # # 2.3 CHECK: Cross-section classification + # t1 = ('SubSection', 'Cross-section classification', '|p{4.5cm}|p{3cm}|p{6.5cm}|p{1.5cm}|') + # self.report_check.append(t1) + # + # t1 = ("b/tf and d/tw ", cross_section_classification_required(self.section), + # cross_section_classification_provided(self.tf, self.b1, self.epsilon, self.section, self.b1_tf, + # self.d1_tw, self.ep1, self.ep2, self.ep3, self.ep4), + # 'b = bf / 2,d = h – 2 ( T + R1),έ = (250 / Fy )^0.5,Compatible') # if self.bc_compatibility_status is True else 'Not compatible') + # self.report_check.append(t1) + # + # # 2.4 CHECK : Member Check + # t1 = ("Slenderness", cl_7_2_2_slenderness_required(self.KL, self.ry, self.lamba), + # cl_7_2_2_slenderness_provided(self.KL, self.ry, self.lamba), 'PASS') + # self.report_check.append(t1) + # + # t1 = ( + # "Design Compressive stress (fcd)", cl_7_1_2_1_fcd_check_required(self.gamma_mo, self.f_y, self.f_y_gamma_mo), + # cl_7_1_2_1_fcd_check_provided(self.facd), 'PASS') + # self.report_check.append(t1) + # + # t1 = ("Design Compressive strength (Pd)", cl_7_1_2_design_comp_strength_required(self.axial), + # cl_7_1_2_design_comp_strength_provided(self.Aeff, self.facd, self.A_eff_facd), "PASS") + # self.report_check.append(t1) + # + # t1 = ('', '', '', '') + # self.report_check.append(t1) + else: + self.report_input = \ + {#KEY_MAIN_MODULE: self.mainmodule, + KEY_MODULE: self.module, #"Axial load on column " + KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, + KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, + KEY_DISP_LENGTH_BEAM: self.length, + KEY_DISP_SEC_PROFILE: self.sec_profile, + KEY_DISP_SECSIZE_pg: str(self.sec_list), + KEY_MATERIAL: self.material, + # "Failed Section Details": self.report_column, + KEY_BEAM_SUPP_TYPE: self.latex_design_type, + } + self.report_input.update({ + KEY_DISP_SUPPORT : self.support, + KEY_DISP_ULTIMATE_STRENGTH_REPORT: self.material_property.fu, + KEY_DISP_YIELD_STRENGTH_REPORT: self.material_property.fy, + "End Conditions - " + str(self.support): "TITLE", + }) + # if self.Latex_length == 'NA': + if self.support == KEY_DISP_SUPPORT1: + self.report_input.update({ + DISP_TORSIONAL_RES: self.Torsional_res, + DISP_WARPING_RES:self.Warping }) + else: + self.report_input.update({ + DISP_SUPPORT_RES: self.Support, + DISP_TOP_RES: self.Top}) + self.report_input.update({ + "Design Preference" : "TITLE", + KEY_DISP_EFFECTIVE_AREA_PARA: self.effective_area_factor, + KEY_DISP_CLASS: self.allow_class, + KEY_DISP_LOAD: self.Loading, + KEY_DISPP_LENGTH_OVERWRITE: self.latex_efp, + KEY_DISP_BEARING_LENGTH + ' (mm)': self.bearing_length, + + }) + # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0] and self.result_web_buckling_check: + # self.report_input.update({ + # KEY_ShearBuckling: self.support_cndition_shear_buckling + # }) + # self.report_input.update({ + # # KEY_DISP_SEC_PROFILE: self.sec_profile, + # "I Section - Mechanical Properties": "TITLE", + # }) + self.report_input.update() + self.report_check = [] + + t1 = ('Selected', 'All Members Failed', '|p{5cm}|p{2cm}|p{2cm}|p{2cm}|p{4cm}|') + self.report_check.append(t1) + + t1 = ('SubSection', 'Plastic Section Modulus', '|p{4cm}|p{1.5cm}|p{2.5cm}|p{8cm}|') + self.report_check.append(t1) + t1 = ('Plastic Section Modulus($mm^3$)', round(self.Zp_req,2), + ' ', + 'Select Sections with atleast required Plastic Section Modulus ') + self.report_check.append(t1) + + + Disp_2d_image = [] + Disp_3D_image = "/ResourceFiles/images/3d.png" + + print(sys.path[0]) + rel_path = str(sys.path[0]) + rel_path = os.path.abspath(".") # TEMP + rel_path = rel_path.replace("\\", "/") + fname_no_ext = popup_summary['filename'] + CreateLatex.save_latex(CreateLatex(), self.report_input, self.report_check, popup_summary, fname_no_ext, + rel_path, Disp_2d_image, Disp_3D_image, module=self.module) # + diff --git a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py index 4bfe26b20..d9a120451 100644 --- a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py +++ b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py @@ -72,19 +72,79 @@ def calc_ElasticModulusZy(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): return round(Z_ey, 2) - def calc_PlasticModulusZ(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): - y_neutral = Unsymmetrical_I_Section_Properties.calc_centroid(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - A_top = B_top * t_f_top - A_bot = B_bot * t_f_bot - A_web_top = t_w * (D - y_neutral - t_f_top) - A_web_bot = t_w * (y_neutral - t_f_bot) - - Zpz = (A_top * (D - y_neutral - t_f_top / 2) + A_web_top * ( - D - y_neutral - t_f_top - (D - y_neutral - t_f_top) / 2) + - A_bot * (y_neutral - t_f_bot / 2) + A_web_bot * ((y_neutral - t_f_bot) / 2)) - - return round(Zpz, 2) - + def calc_PlasticModulusZ(self, D, bf_top, bf_bot, tw, tf_top, tf_bot, eps): + """ + Plastic section modulus Zp about strong axis for unequal flanges: + + D : total section depth between outer flange faces (mm) + bf_top : top flange width (mm) + bf_bot : bottom flange width (mm) + tw : web thickness (mm) + tf_top : top flange thickness (mm) + tf_bot : bottom flange thickness (mm) + """ + # clear web height between flange faces + h_w = D - tf_top - tf_bot + # print("Inside plastic modulus Z function",h_w, tw, tf_top, tf_bot) + # print("Epsilon", eps) + # thin-web check + if h_w/tw < 67 * eps: + print("Inside thin web check",h_w/tw) + A_top = bf_top * tf_top + A_bot = bf_bot * tf_bot + A = A_top + A_bot + + # Centroid location from top fiber + # top rectangle centroid at tf_top/2, bottom at D - tf_bot/2 + c = (A_top * (tf_top / 2) + A_bot * (D - tf_bot / 2)) / A + # print("C value inside pLASMod",c) + c1 = D - c + + # Distances from each rectangle's centroid to the composite centroid + y_top_centroid = abs((tf_top / 2) - c) + y_bot_centroid = abs((D - tf_bot / 2) - c) + + # Second moment of area of each rectangle about its own centroid + I_top = (bf_top * tf_top ** 3) / 12.0 + I_bot = (bf_bot * tf_bot ** 3) / 12.0 + + # Parallel-axis theorem + I = I_top + A_top * y_top_centroid ** 2 + I_bot + A_bot * y_bot_centroid ** 2 + + # Section moduli + # print("Zp value",I) + Zp = I / c + return round(Zp, 2) + + + else: + print("THICK WEB CHECK",h_w/tw) + + A_u = bf_top * tf_top + A_d = bf_bot * tf_bot + A_w = h_w * tw + A = A_u + A_d + A_w + if h_w / tw <= 67.0 * eps: + y = (A_u * tf_top/2 + A_d * (D - tf_bot/2))/(A_u + A_d) + y1 = D - y + + # centroids measured from bottom face + y_d = tf_bot / 2.0 + y_w = tf_bot + h_w / 2.0 + y_u = tf_bot + h_w + tf_top / 2.0 + # plastic neutral axis from bottom face + if A_d < A / 2.0 and A_u < A / 2.0: + y_pna = tf_bot + (A - 2 * A_d) / (2 * tw) + elif A_d >= A / 2.0: + y_pna = A / (2 * bf_bot) + else: + y_pna = D - A / (2 * bf_top) + # compute Zp as sum of Ai * distance from plastic axis + Zp = ( + (bf_bot * y_pna ** 2 - (bf_bot - tw) * (y_pna - tf_bot) ** 2) + + (bf_top * (D - y_pna) ** 2 - (bf_top - tw) * (D - tf_top - y_pna) ** 2) + ) / 2.0 + return round(Zp, 2) def calc_PlasticModulusY(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): Zpy = (t_f_top * B_top ** 2 / 4 + t_f_bot * B_bot ** 2 / 4 + (D - t_f_top - t_f_bot) * t_w ** 2 / 4) diff --git a/src/osdag/utils/common/is800_2007.py b/src/osdag/utils/common/is800_2007.py index 9895aadd3..a183b00b3 100644 --- a/src/osdag/utils/common/is800_2007.py +++ b/src/osdag/utils/common/is800_2007.py @@ -842,51 +842,35 @@ def cl_7_1_2_2_buckling_class_of_crosssections(b, h, t_f, cross_section='Rolled return buckling_class @staticmethod - def cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c(): - data = { - 200: [182.00, 182.00, 172.00, 163.00, 153.00, 142.00, 131.00, 120.00, 108.00, 97.50, 87.30, 78.20, 70.00, 62.90, - 56.60, 51.10, 46.40, 42.20, 38.50, 35.30, 32.40, 29.90, 27.60, 25.60, 23.80], - 210: [191.00, 190.00, 180.00, 170.00, 159.00, 148.00, 136.00, 123.00, 111.00, 100.00, 89.00, 79.40, 71.00, 63.60, - 57.20, 51.60, 46.80, 42.50, 38.80, 35.50, 32.60, 30.10, 27.80, 25.70, 23.90], - 220: [200.00, 199.00, 188.00, 177.00, 165.00, 153.00, 140.00, 127.00, 114.00, 102.00, 90.50, 80.60, 71.90, 64.40, - 57.80, 52.10, 47.10, 42.80, 39.00, 35.70, 32.80, 30.20, 27.90, 25.90, 24.00], - 230: [209.00, 207.00, 196.00, 184.00, 172.00, 158.00, 144.00, 130.00, 116.00, 104.00, 92.00, 81.70, 72.80, 65.00, - 58.30, 52.50, 47.50, 43.10, 39.30, 35.90, 33.00, 30.40, 28.00, 26.00, 24.10], - 240: [218.00, 216.00, 204.00, 191.00, 178.00, 163.00, 148.00, 133.00, 119.00, 105.00, 93.30, 82.70, 73.50, 65.60, - 58.80, 52.90, 47.80, 43.40, 39.50, 36.10, 33.10, 30.50, 28.20, 26.10, 24.20], - 250: [227.00, 224.00, 211.00, 198.00, 183.00, 168.00, 152.00, 136.00, 121.00, 107.00, 94.60, 83.70, 74.30, 66.20, - 59.20, 53.30, 48.10, 43.60, 39.70, 36.30, 33.30, 30.60, 28.30, 26.20, 24.30], - 260: [236.00, 233.00, 219.00, 205.00, 189.00, 173.00, 156.00, 139.00, 123.00, 109.00, 95.70, 84.60, 75.00, 66.70, - 59.70, 53.60, 48.40, 43.90, 39.90, 36.50, 33.40, 30.80, 28.40, 26.30, 24.40], - 280: [255.00, 250.00, 234.00, 218.00, 201.00, 182.00, 163.00, 145.00, 127.00, 112.00, 97.90, 86.20, 76.20, 67.70, - 60.40, 54.20, 48.90, 44.30, 40.30, 36.80, 33.70, 31.00, 28.60, 26.40, 24.50], - 300: [273.00, 266.00, 249.00, 231.00, 212.00, 191.00, 170.00, 149.00, 131.00, 114.00, 100.00, 87.60, 77.30, 68.60, - 61.10, 54.80, 49.30, 44.70, 40.60, 37.00, 33.90, 31.20, 28.80, 26.60, 24.70], - 320: [291.00, 283.00, 264.00, 244.00, 222.00, 199.00, 176.00, 154.00, 134.00, 116.00, 102.00, 88.90, 78.30, 69.30, - 61.70, 55.30, 49.80, 45.00, 40.90, 37.30, 34.10, 31.40, 28.90, 26.70, 24.80], - 340: [309.00, 299.00, 278.00, 256.00, 232.00, 207.00, 182.00, 158.00, 137.00, 119.00, 103.00, 90.10, 79.20, 70.00, - 62.30, 55.70, 50.10, 45.30, 41.10, 37.50, 34.30, 31.50, 29.10, 26.90, 24.90], - 360: [327.00, 316.00, 293.00, 268.00, 242.00, 215.00, 187.00, 162.00, 140.00, 120.00, 104.00, 91.10, 80.00, 70.70, - 62.80, 56.10, 50.50, 45.60, 41.40, 37.70, 34.50, 31.70, 29.20, 27.00, 25.00], - 380: [345.00, 332.00, 307.00, 280.00, 252.00, 222.00, 192.00, 165.00, 142.00, 122.00, 106.00, 92.10, 80.70, 71.20, - 63.30, 56.50, 50.80, 45.80, 41.60, 37.90, 34.70, 31.80, 29.30, 27.10, 25.10], - 400: [364.00, 348.00, 321.00, 292.00, 261.00, 228.00, 197.00, 169.00, 144.00, 124.00, 107.00, 93.00, 81.40, 71.80, - 63.70, 56.90, 51.10, 46.10, 41.80, 38.10, 34.80, 31.90, 29.40, 27.20, 25.20], - 420: [382.00, 364.00, 335.00, 304.00, 270.00, 235.00, 202.00, 172.00, 146.00, 125.00, 108.00, 93.80, 82.00, 72.30, - 64.10, 57.20, 51.30, 46.30, 42.00, 38.20, 34.90, 32.10, 29.50, 27.30, 25.30], - 450: [409.00, 388.00, 355.00, 320.00, 282.00, 244.00, 208.00, 176.00, 149.00, 127.00, 110.00, 94.90, 82.90, 72.90, - 64.60, 57.60, 51.70, 46.60, 42.20, 38.40, 35.10, 32.20, 29.70, 27.40, 25.40], - 480: [436.00, 412.00, 376.00, 337.00, 295.00, 252.00, 213.00, 180.00, 152.00, 129.00, 111.00, 95.90, 83.60, 73.50, - 65.10, 58.00, 52.00, 46.90, 42.50, 38.60, 35.30, 32.40, 29.80, 27.50, 25.50], - 510: [464.00, 435.00, 395.00, 352.00, 306.00, 260.00, 218.00, 183.00, 154.00, 131.00, 112.00, 96.80, 84.30, 74.10, - 65.50, 58.40, 52.30, 47.10, 42.70, 38.80, 35.40, 32.50, 29.90, 27.60, 25.60], - 540: [491.00, 458.00, 415.00, 367.00, 317.00, 267.00, 223.00, 186.00, 156.00, 132.00, 113.00, 97.60, 84.90, 74.60, - 65.90, 58.70, 52.60, 47.30, 42.90, 39.00, 35.60, 32.60, 30.00, 27.70, 25.70] -} - slenderness_ratios = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, - 220, 230, 240, 250] - df = pd.DataFrame(data, index=slenderness_ratios) - return df + def cl_7_1_2_1_design_compressisive_stress_plategirder(f_y, gamma_mo, effective_slenderness_ratio, + modulus_of_elasticity): + """ + Args: + f_y:Yield stress (float) + gamma_mo:Effective length of member (float) + effective_slenderness_ratio:Euler buckling class (float) + imperfection_factor + modulus_of_elasticity + + Returns: + list of euler_buckling_stress, nondimensional_effective_slenderness_ratio, phi, stress_reduction_factor, design_compressive_stress_fr .design_compressive_stress, design_compressive_stress_min + Note: + Reference: IS 800 pg34 + @author:Rutvik Joshi + """ + # 2.4 - Euler buckling stress + imperfection_factor = 0.49 + euler_buckling_stress = (math.pi ** 2 * modulus_of_elasticity) / effective_slenderness_ratio ** 2 + nondimensional_effective_slenderness_ratio = math.sqrt(f_y / euler_buckling_stress) + phi = 0.5 * (1 + imperfection_factor * ( + nondimensional_effective_slenderness_ratio - 0.2) + nondimensional_effective_slenderness_ratio ** 2) + # 2.6 - Design compressive stress + stress_reduction_factor = 1 / (phi + math.sqrt(phi ** 2 - nondimensional_effective_slenderness_ratio ** 2)) + design_compressive_stress_fr = f_y * stress_reduction_factor / gamma_mo + design_compressive_stress_max = f_y / gamma_mo + design_compressive_stress = min(design_compressive_stress_fr, design_compressive_stress_max) + print(f"euler_buckling_stress {euler_buckling_stress} , nondimensional_effective_slenderness_ratio {nondimensional_effective_slenderness_ratio} , phi {phi} , stress_reduction_factor {stress_reduction_factor} , design_compressive_stress_fr {design_compressive_stress_fr} , design_compressive_stress_max {design_compressive_stress_max} , design_compressive_stress {design_compressive_stress}") + return design_compressive_stress @@ -1391,6 +1375,67 @@ def cl_8_4_2_2_TensionField( c, d, tw, fyw, bf,tf, fyf,Nf, gamma_mo, A_v,tau_b,V V_tf == V_p print('phi',phi,'\n M_fr',M_fr,'\n s',s, '\n c',c, '\n w_tf', w_tf, '\n sai',sai,'\n fv',fv,'\n V_tf',V_tf,'\n V_p',V_p) return phi,M_fr,s, w_tf,sai,fv,V_tf + + @staticmethod + def cl_8_4_2_2_TensionField_unequal_Isection( + c, d, tw, fyw, + bf_top, tf_top, bf_bot, tf_bot, + Nf, gamma_m0, A_v, tau_b, V_p +): + """ + Tension‐field method per IS 800:2007 Cl. 8.4.2.2 for unequal flanges. + + Parameters: + c : float : panel width (mm) + d : float : web depth (mm) + tw : float : web thickness (mm) + fyw : float : web yield stress (N/mm²) + bf_top : float : top flange width (mm) + tf_top : float : top flange thickness (mm) + bf_bot : float : bottom flange width (mm) + tf_bot : float : bottom flange thickness (mm) + Nf : float : axial force in each flange (kN → N·mm units consistent) + gamma_m0: float : partial safety factor + A_v : float : gross web area = d*tw (mm²) + tau_b : float : post‐buckling shear stress of web (N/mm²) + V_p : float : plastic shear strength V_np (kN) + + Returns: + tuple: (phi, Mfr_top, Mfr_bot, s_top, s_bot, w_tf, psi, fv, V_tf) + """ + + # 1) Tension‐field angle φ + if c == 0: + phi = 90.0 + else: + phi = math.degrees(math.atan(d / c)) + + # 2) Reduced plastic moment of each flange + def Mfr(bf, tf): + Mp = 0.25 * bf * tf**2 * fyw + ratio = Nf * 1e3 / (bf * tf * fyw / gamma_m0) # Nf in kN → multiply by 1e3 + return Mp * (1 - ratio**2) + + Mfr_t = Mfr(bf_top, tf_top) + Mfr_b = Mfr(bf_bot, tf_bot) + + # 3) s‐values for each flange, limited to c + sinφ = math.sin(math.radians(phi)) + s_t = min(2 * math.sqrt(Mfr_t / (fyw * tw)) / sinφ, c) + s_b = min(2 * math.sqrt(Mfr_b / (fyw * tw)) / sinφ, c) + + # 4) Width of the tension field w_tf + w_tf = d * math.cos(math.radians(phi)) - (c - s_t - s_b) * sinφ + + # 5) Field yield strength f_v + psi = 1.5 * tau_b * math.sin(2 * math.radians(phi)) + fv = math.sqrt(fyw**2 - 3 * tau_b**2 + psi**2) - psi + + # 6) Nominal shear resistance V_tf (kN) + V_tf = (A_v * tau_b + 0.9 * w_tf * tw * fv * sinφ) / 1e3 + V_tf = min(V_tf, V_p) + + return phi, Mfr_t, Mfr_b, s_t, s_b, w_tf, psi, fv, V_tf @staticmethod def cl_8_5_1_EndPanel(c, d, tw, fyw, bf, tf, fyf, Nf, gamma_mo, A_v, tau_b, V_p): @@ -1427,6 +1472,110 @@ def cl_8_6_1_1_plate_girder_minimum_web_a(D,tw,epsilon,tf_top,tf_bot): return True else: return False + + @staticmethod + def cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffener_type, c=None): + """ + Check minimum web thickness requirements as per IS 800:2007 Cl. 8.6.1.1 & 8.6.1.2 + + Parameters: + d (float): Depth of web (mm) + tw (float): Thickness of web (mm) + eps (float): ε = sqrt(250/fy) where fy is yield strength of steel (N/mm^2) + stiffener_type (str): Type of stiffening provided. Options: + - "no_stiffener" + - "transverse_only" + - "transverse_and_two_longitudinal_neutral" + - "transverse_and_one_longitudinal_compression" + c (float): Spacing of transverse stiffeners (mm), required for some types + + Returns: + dict: Dictionary with result of the web thickness check. + """ + + results = {} + + if stiffener_type == "no_stiffener": + ratio = d / tw + limit_serv = 200 * eps + limit_buckling = 345 * (eps ** 2) + limit = min(limit_serv, limit_buckling) + results["Limit"] = limit + if ratio <= limit: + return True + else: + return False + + elif stiffener_type == "transverse_only": + if c is None: + return False #{"Error": "Spacing 'c' is required for 'transverse_only' stiffeners."} + + if 3 * d >= c >= 1.5 * d: + ratio = d / tw + limit_serv = 200 * eps + limit_buckling = 345 * (eps ** 2) + elif 1.5 * d > c >= d: + ratio = d / tw + limit_serv = 200 * eps + limit_buckling = 345 * eps + elif 0.74 * d <= c < d: + ratio = c / tw + limit_serv = 200 * eps + limit_buckling = 345 * eps + elif c < 0.74 * d: + ratio = d / tw + limit_serv = 270 * eps + limit_buckling = 345 * eps + else: + return False #{"Error": "Invalid range for spacing 'c'."} + + limit = min(limit_serv, limit_buckling) + results["Limit"] = limit + results["Pass"] = ratio <= limit + + elif stiffener_type == "transverse_and_two_longitudinal_neutral": + ratio = d / tw + limit = 400 * eps + results["Limit"] = limit + results["Pass"] = ratio <= limit + + elif stiffener_type == "transverse_and_one_longitudinal_compression": + if c is None: + return False #{"Error": "Spacing 'c' is required for compression flange restraint."} + + if 2.4 * d >= c >= 1.5 * d: + ratio = d / tw + limit_serv = 250 * eps + limit_buckling = 345 * (eps ** 2) + elif 1.5 * d > c >= d: + ratio = d / tw + limit_serv = 200 * eps + limit_buckling = 345 * eps + elif 0.74 * d <= c < d: + ratio = c / tw + limit_serv = 250 * eps + limit_buckling = 345 * eps + elif c < 0.74 * d: + ratio = d / tw + limit_serv = 340 * eps + limit_buckling = 345 * eps + else: + return False #{"Error": "Invalid range for spacing 'c'."} + + limit = min(limit_serv, limit_buckling) + results["Limit"] = limit + results["Pass"] = ratio <= limit + + else: + return False #{"Error": "Invalid stiffener_type provided."} + + if 'c' in locals() and ratio == c / tw: + results["c/tw"] = ratio + else: + results["d/tw"] = ratio + + results["ε"] = eps + return True # ========================================================================== """ SECTION 9 MEMBER SUBJECTED TO COMBINED FORCES """ From c9dced05a4c93fe01b2a815a7e665dc1c3908479 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Thu, 22 May 2025 10:59:42 +0530 Subject: [PATCH 19/23] PSO ratios checks improved --- .../plate_girder/weldedPlateGirder.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder.py b/src/osdag/design_type/plate_girder/weldedPlateGirder.py index 93ff1f3c0..a7b50ca3e 100644 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder.py +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder.py @@ -1592,7 +1592,7 @@ def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top Ac = (b1 + n1) * tw slenderness_input = 2.5 * self.eff_depth / tw self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder(Fy, gamma_m0, slenderness_input, E) - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) + Critical_buckling_load = round(Ac * self.fcd, 2) self.shear_ratio = max(self.load.shear_force / Critical_buckling_load , self.shear_ratio) if Critical_buckling_load>= self.load.shear_force: return True @@ -1602,7 +1602,7 @@ def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top #check 5 Web crippling for major laterally supported and unsupported & thick web def web_crippling_laterally_supported_thick_web(self, Fy, gamma_m0, tw, tf_top, b1): n2 = 2.5 * tf_top - Critical_crippling_load = round((b1 + n2) * tw * Fy / (gamma_m0 * 1000), 2) + Critical_crippling_load = round((b1 + n2) * tw * Fy / (gamma_m0), 2) self.shear_ratio = max(self.load.shear_force / Critical_crippling_load , self.shear_ratio) if Critical_crippling_load >= self.load.shear_force: return True @@ -1933,7 +1933,7 @@ def deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case): Mid-span deflection in meters. """ # unit conversions - M = M_kNm * 1e3 # kN·m → N·m + M = M_kNm # kN·m → N·m pref = M * L ** 2 / (E * I) if case == KEY_DISP_UDL_PIN_PIN_PG: @@ -2418,10 +2418,8 @@ def run_design_checks(self,section,design_dictionary,is_symmetric,is_thick_web): # placeholder penalty penalty = 0 - if self.design_check_optimized_version(self,design_dictionary) > 1: - penalty = 1e7 - else: - penalty = (100 - (self.design_check_optimized_version(self,design_dictionary)/1000 * 100)) * 1e6 + + penalty = abs(100 - (self.design_check_optimized_version(self,design_dictionary) * 100)) * 1e6 return weight + penalty @@ -2516,6 +2514,7 @@ def design_check(self,design_dictionary): self.c = 0 else: self.c = float(self.c) + print("c value",self.c) self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,stiffener_type,self.c) if self.design_flag2 == True: @@ -2775,7 +2774,7 @@ def design_check_optimized_version(self,design_dictionary): #for customized print(f"RATIOS moment {self.moment_ratio} shear {self.shear_ratio} deflection {self.deflection_ratio}") - return max(self.moment_ratio,self.shear_ratio) + return max(self.moment_ratio,self.shear_ratio,self.deflection_ratio) @@ -2793,7 +2792,7 @@ def optimized_method(self,design_dictionary,is_thick_web, is_symmetric): variable_list = self.build_variable_structure(self,is_thick_web, is_symmetric) lb, ub = self.get_bounds(self,variable_list) optimizer = GlobalBestPSO( - n_particles=500, + n_particles=50, dimensions=len(variable_list), options={'c1': 1.5, 'c2': 1.5, 'w': 0.4}, bounds=(lb, ub) From 109b0e3f155429aa393e517529a08b199a47f33a Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Sat, 31 May 2025 20:07:22 +0530 Subject: [PATCH 20/23] PSO Updated version --- src/osdag/Common.py | 25 +- .../connection/lap_joint_bolted.py | 4 +- src/osdag/design_type/main.py | 3 + src/osdag/design_type/member.py | 47 +- .../design_type/plate_girder/__init__.py | 15 + src/osdag/design_type/plate_girder/pso.py | 98 + src/osdag/design_type/plate_girder/temp.py | 188 - .../plate_girder/weldedPlateGirder.py | 1716 +++++- .../plate_girder/weldedPlateGirder_working.py | 4727 ----------------- src/osdag/gui/popup_customized_design_pref.py | 173 + src/osdag/gui/popup_display_pg.py | 45 + src/osdag/gui/popup_input_bounds_read.py | 88 + .../popup_input_bounds_read_write.py} | 0 src/osdag/gui/ui_template.py | 78 + src/osdag/gui/ui_template_for_mac.py | 3 + .../Unsymmetrical_Section_Properties.py | 12 +- src/osdag/utils/common/is800_2007.py | 114 +- 17 files changed, 2070 insertions(+), 5266 deletions(-) create mode 100644 src/osdag/design_type/plate_girder/pso.py delete mode 100644 src/osdag/design_type/plate_girder/temp.py delete mode 100644 src/osdag/design_type/plate_girder/weldedPlateGirder_working.py create mode 100644 src/osdag/gui/popup_customized_design_pref.py create mode 100644 src/osdag/gui/popup_display_pg.py create mode 100644 src/osdag/gui/popup_input_bounds_read.py rename src/osdag/{design_type/plate_girder/sample.py => gui/popup_input_bounds_read_write.py} (100%) diff --git a/src/osdag/Common.py b/src/osdag/Common.py index b20f3ae48..a9d49f782 100644 --- a/src/osdag/Common.py +++ b/src/osdag/Common.py @@ -748,7 +748,7 @@ def is_valid_custom(self): VALUES_SUPPORTING_OPTIONS_DEF = ['NA'] KEY_MAX_DEFL = 'Deflection.Max' KEY_DISP_MAX_DEFL = 'Maximum Deflection' -VALUES_MAX_DEFL = ['Span/600','Span/800','Span/400','Span/300','Span/360','Span/150','Span/180','Span/240','Span/120','Span/500','Span/750','Span/1000'] +VALUES_MAX_DEFL = ['600','800','400','300','360','150','180','240','120','500','750','1000'] KEY_SUPPORT_WIDTH = 'Support.Width' KEY_DISP_SUPPORT_WIDTH = 'Support Width (mm)' VALUES_STIFFENER_THICKNESS = ['8', '10', '12', '14', '16', '18', '20', '22', '25', '28', '32', '36', '40', '45', '50', '56', '63', '75', '80', '90', '100', @@ -757,6 +757,10 @@ def is_valid_custom(self): KEY_DISP_EndpanelStiffener_thickness = 'End Panel Stiffener Thickness (mm)' KEY_LongitudnalStiffener_numbers = 'LongitudnalStiffener.Numbers' KEY_DISP_LongitudnalStiffener_numbers = 'Number of Longitudnal Stiffeners' +KEY_LongitudinalStiffener1_pos = 'LongitudnalStiffener1.Position' +KEY_DISP_LongitudinalStiffener1_pos = 'Position of Longitudnal Stiffener 1 from NA (mm) ' +KEY_LongitudinalStiffener2_pos = 'LongitudnalStiffener2.Position' +KEY_DISP_LongitudinalStiffener2_pos = 'Position of Longitudnal Stiffener 2 from NA (mm)' ################################### # All Input Keys @@ -2717,6 +2721,25 @@ def get_leg_lengths(designation): "


\n") Shear_Buckling_Para = str( "

The Shear Buckling is only applicable when the input sections are susceptible to shear buckling.. The default value of this parameter is set at Simple Post Critical Method. ReferClause IS 8.4.2.2for understanding which method is applicable in your case.

\n" "


\n") +Stiffener_Plategirder_para = str( + "

" + "Types of Stiffeners in Plate Girders (IS 800:2007):" + "

" + "
    " + "
  • Intermediate Transverse Stiffeners: Provided at intervals to prevent web buckling due to shear forces.
  • " + "
  • Load-bearing Stiffeners: Provided at points of concentrated loads to transfer load effectively to the web.
  • " + "
  • Bearing Stiffeners: Placed at supports to transfer reactions to the supports and ensure stability.
  • " + "
  • Longitudinal Stiffeners: Used horizontally along the length to increase web resistance against bending.
  • " + "
  • End Stiffeners: Located at girder ends to strengthen web plates and transfer forces effectively.
  • " + "
" + "

" + "Methods for Plate Girder Design:" + "

" + "
    " + "
  • Simple Post-Critical Method: In this method, the girder web is allowed to buckle at certain loading conditions. The design assumes that the web can carry loads post-buckling, using the stable equilibrium formed after initial buckling.
  • " + "
  • Tension Field Method: This method accounts explicitly for the tensile stresses that develop diagonally across the web post-buckling. The web, supported by stiffeners, forms a tension field action, substantially increasing shear-carrying capacity beyond initial web buckling.
  • " + "
" +) OPTIMIZATION_TABLE_UI = str("""
diff --git a/src/osdag/design_type/connection/lap_joint_bolted.py b/src/osdag/design_type/connection/lap_joint_bolted.py index c846ee4f4..23e23bd2b 100644 --- a/src/osdag/design_type/connection/lap_joint_bolted.py +++ b/src/osdag/design_type/connection/lap_joint_bolted.py @@ -702,4 +702,6 @@ def warn_text(self): logger.info( " : You are using a section (in red color) that is not available in latest version of IS 808") - \ No newline at end of file + def save_design(self, popup_summary): + print("\n\n\n\n Enterend save design") + logger.info(" :=========Start Of design Saving Button pressed===========") \ No newline at end of file diff --git a/src/osdag/design_type/main.py b/src/osdag/design_type/main.py index 413938417..ecec640ba 100644 --- a/src/osdag/design_type/main.py +++ b/src/osdag/design_type/main.py @@ -131,6 +131,9 @@ def design_values(self, input_dictionary): values[KEY_DP_DESIGN_METHOD]) design.append(t1) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, Stiffener_Plategirder_para , None) + design.append(t9) + return design def plate_connector_values(self, input_dictionary): diff --git a/src/osdag/design_type/member.py b/src/osdag/design_type/member.py index 9713b1cbf..fde86956c 100644 --- a/src/osdag/design_type/member.py +++ b/src/osdag/design_type/member.py @@ -2864,7 +2864,7 @@ def optimization_tab_plate_girder_design(self, input_dictionary): optimum.append(t1) t2 = (KEY_ShearBucklingOption, KEY_ShearBuckling, TYPE_COMBOBOX, KEY_DISP_SB_Option, values[KEY_ShearBucklingOption]) optimum.append(t2) - t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, FLEXURE_OPTIMIZATION_DESCRIPTION , None) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, FLEXURE_OPTIMIZATION_DESCRIPTION_SimplySupp , None) optimum.append(t9) return optimum @@ -2897,7 +2897,7 @@ def optimization_tab_welded_plate_girder_design(self, input_dictionary): - t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, "DUMMYTEXT TODO: replace" , None) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, FLEXURE_OPTIMIZATION_DESCRIPTION_SimplySupp , None) optimum.append(t9) return optimum @@ -2931,7 +2931,7 @@ def Stiffener_design(self, input_dictionary): optimum.append(t1) t2 = (KEY_ShearBucklingOption, KEY_ShearBuckling, TYPE_COMBOBOX, KEY_DISP_SB_Option, values[KEY_ShearBucklingOption]) optimum.append(t2) - t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, "DUMMYTEXT TODO: replace" , None) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, Stiffener_Plategirder_para , None) optimum.append(t9) return optimum @@ -2948,6 +2948,8 @@ def girder_geometry(self, input_dictionary): t2 = (KEY_IS_IT_SYMMETRIC, KEY_DISP_IS_IT_SYMMETRIC, TYPE_COMBOBOX, KEY_DISP_SYMMETRIC_list, values[KEY_IS_IT_SYMMETRIC]) optimum.append(t2) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, Stiffener_Plategirder_para , None) + optimum.append(t9) return optimum @@ -3149,13 +3151,22 @@ def Unsymm_I_Section_properties(self): plast_sec_mod_y = '' torsion_const = '' warping_const = '' - + + # print("\n\n\n\n\n") + # print(self[6]) + # print("\n FROM NOW OBJECT 6") + # for i in self: + # print(i) + # print("\n") + t_d = float(self[0]) w_t = float(self[1]) t_f_w = float(self[2]) t_f_t = float(self[3]) b_f_w = float(self[4]) b_f_t = float(self[5]) + eps = math.sqrt(250/float(self[6])) # Assuming self[6] is the yield strength in MPa + pc = Unsymmetrical_I_Section_Properties() @@ -3167,7 +3178,7 @@ def Unsymm_I_Section_properties(self): rad_of_gy_y = pc.calc_RadiusOfGyrationY(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) elast_sec_mod_z = pc.calc_ElasticModulusZz(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) elast_sec_mod_y = pc.calc_ElasticModulusZy(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) - plast_sec_mod_z = pc.calc_PlasticModulusZ(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) + plast_sec_mod_z = pc.calc_PlasticModulusZ(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t,eps) plast_sec_mod_y = pc.calc_PlasticModulusY(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) torsion_const = pc.calc_TorsionConstantIt(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) warping_const = pc.calc_WarpingConstantIw(t_d,t_f_w,b_f_w,w_t,t_f_t,b_f_t) @@ -3178,21 +3189,21 @@ def Unsymm_I_Section_properties(self): - return {'Label_11': str(mass), - 'Label_12': str(area), - 'Label_13': str(mom_inertia_z), - 'Label_14': str(mom_inertia_y), - 'Label_15': str(rad_of_gy_z), - 'Label_16': str(rad_of_gy_y), - 'Label_17': str(elast_sec_mod_z), - 'Label_18': str(elast_sec_mod_y), - 'Label_19': str(plast_sec_mod_z), - 'Label_20': str(plast_sec_mod_y), - 'Label_21': str(torsion_const), - 'Label_22': str(warping_const) + return { + 'Label_12': str(int(round(mass, 0))), + 'Label_13': str(int(round(area / 100, 0))), + 'Label_14': str(int(round(mom_inertia_z / 10000, 0))), + 'Label_15': str(int(round(mom_inertia_y / 10000, 0))), + 'Label_16': str(int(round(rad_of_gy_z / 10, 0))), + 'Label_17': str(int(round(rad_of_gy_y / 10, 0))), + 'Label_18': str(int(round(elast_sec_mod_z / 1000, 0))), + 'Label_19': str(int(round(elast_sec_mod_y / 1000, 0))), + 'Label_20': str(int(round(plast_sec_mod_z / 1000, 0))), + 'Label_21': str(int(round(plast_sec_mod_y / 1000, 0))), + 'Label_22': str(int(round(torsion_const / 10000, 0))), + 'Label_23': str(int(round(warping_const / 1000000, 0))) } - @staticmethod def grdval_customized(): b = VALUES_GRD_CUSTOMIZED diff --git a/src/osdag/design_type/plate_girder/__init__.py b/src/osdag/design_type/plate_girder/__init__.py index e69de29bb..eecdf78e3 100644 --- a/src/osdag/design_type/plate_girder/__init__.py +++ b/src/osdag/design_type/plate_girder/__init__.py @@ -0,0 +1,15 @@ +""" +================================================================================ +pyswarm: Particl swarm optimization (PSO) with constraint support +================================================================================ + +Author: Abraham Lee +Copyright: 2013-2014 + +""" +# from __future__ import absolute_import + +__author__ = 'Abraham Lee' +__version__ = '0.6' + +from pyswarm.pso import * \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/pso.py b/src/osdag/design_type/plate_girder/pso.py new file mode 100644 index 000000000..9fa969dbd --- /dev/null +++ b/src/osdag/design_type/plate_girder/pso.py @@ -0,0 +1,98 @@ +import numpy as np + +def pso(func, lb, ub, ieqcons=[], f_ieqcons=None, args=(), kwargs={}, + swarmsize=600, omega=0.5, phip=0.5, phig=0.5, maxiter=1000, + minstep=1e-8, minfunc=1e-8, debug=False): + assert len(lb) == len(ub) + lb = np.array(lb) + ub = np.array(ub) + vhigh = np.abs(ub - lb) + vlow = -vhigh + + obj = lambda x: func(x, *args, **kwargs) + if f_ieqcons is None: + cons = (lambda x: np.array([0])) if not len(ieqcons) \ + else (lambda x: np.array([y(x, *args, **kwargs) for y in ieqcons])) + else: + cons = lambda x: np.array(f_ieqcons(x, *args, **kwargs)) + + def is_feasible(x, eps=1e-12): + cons_val = cons(x) + print(f'Constraint values: {cons_val}') + return np.all(cons_val >= -eps) # strictly >=0; small epsilon for numeric tolerance + + # Helper: generate a feasible position + def random_feasible_point(): + for _ in range(10000): + candidate = lb + np.random.rand(len(lb)) * (ub - lb) + if is_feasible(candidate): + return candidate + raise RuntimeError("Cannot find feasible initial particle!") + + # Initialize + S, D = swarmsize, len(lb) + x = np.zeros((S, D)) + v = np.zeros_like(x) + p = np.zeros_like(x) + fp = np.full(S, np.inf) + g = None + fg = np.inf + + # Feasible initialization + for i in range(S): + x[i, :] = random_feasible_point() + p[i, :] = x[i, :].copy() + fp[i] = obj(p[i, :]) + if i == 0 or (fp[i] < fg and is_feasible(p[i, :])): + g = p[i, :].copy() + fg = fp[i] + v[i, :] = vlow + np.random.rand(D) * (vhigh - vlow) + + # Main loop + it = 1 + while it <= maxiter: + rp = np.random.uniform(size=(S, D)) + rg = np.random.uniform(size=(S, D)) + for i in range(S): + v[i, :] = omega * v[i, :] + phip * rp[i, :] * (p[i, :] - x[i, :]) + phig * rg[i, :] * (g - x[i, :]) + x[i, :] = x[i, :] + v[i, :] + + # Project to bounds + x[i, :] = np.clip(x[i, :], lb, ub) + + # Ensure feasibility + if not is_feasible(x[i, :]): + # Option 1: resample until feasible + x[i, :] = random_feasible_point() + # Option 2 (alternative): reflect or repair (optional) + + fx = obj(x[i, :]) + + # Personal best update + if is_feasible(x[i, :]) and (fx < fp[i] or not is_feasible(p[i, :])): + p[i, :] = x[i, :].copy() + fp[i] = fx + + # Global best update + if fx < fg or not is_feasible(g): + if debug: + print(f'New best for swarm at iteration {it}: {x[i, :]} {fx}') + tmp = x[i, :].copy() + stepsize = np.sqrt(np.sum((g - tmp) ** 2)) if g is not None else np.inf + if np.abs(fg - fx) <= minfunc: + print(f'Stopping search: Swarm best objective change less than {minfunc}') + return tmp, fx + elif stepsize <= minstep: + print(f'Stopping search: Swarm best position change less than {minstep}') + return tmp, fx + else: + g = tmp.copy() + fg = fx + if debug: + print(f'Best after iteration {it}: {g} {fg}') + it += 1 + + print(f'Stopping search: maximum iterations reached --> {maxiter}') + if not is_feasible(g): + print("However, the optimization couldn't find a feasible design. Sorry") + return g, fg diff --git a/src/osdag/design_type/plate_girder/temp.py b/src/osdag/design_type/plate_girder/temp.py deleted file mode 100644 index bfc174871..000000000 --- a/src/osdag/design_type/plate_girder/temp.py +++ /dev/null @@ -1,188 +0,0 @@ -def tab_girder_sec(self, input_dictionary): - # if not input_dictionary or input_dictionary[KEY_SECSIZE] == 'Select Section' or \ - # input_dictionary[KEY_MATERIAL] == 'Select Material': - # if not input_dictionary or input_dictionary[KEY_MATERIAL] == 'Select Material': - designation = '' - material_grade = '' - source = 'Custom' - fu = '' - fy = '' - depth = '' - flange_width = '' - flange_thickness = '' - web_thickness = '' - flange_slope = '' - root_radius = '' - toe_radius = '' - m_o_e = "200" - m_o_r = "76.9" - p_r = "0.3" - t_e = "12" - mass = '' - area = '' - mom_inertia_z = '' - mom_inertia_y = '' - rad_of_gy_z = '' - rad_of_gy_y = '' - elast_sec_mod_z = '' - elast_sec_mod_y = '' - plast_sec_mod_z = '' - plast_sec_mod_y = '' - torsion_const = '' - warping_const = '' - - image = '' - - - # else: - # designation = 'NA' - # material_grade = str(input_dictionary[KEY_MATERIAL]) - # m_o_e = "200" - # m_o_r = "76.9" - # p_r = "0.3" - # t_e = "12" - # image = VALUES_IMG_BEAM[0] - # I_sec_attributes = ISection(designation) - # table = "Beams" if designation in connectdb("Beams", "popup") else "Columns" - # I_sec_attributes.connect_to_database_update_other_attributes(table, designation, material_grade) - # source = str(I_sec_attributes.source) - # fu = str(I_sec_attributes.fu) - # fy = str(I_sec_attributes.fy) - # depth = str(I_sec_attributes.depth) - # flange_width = str(I_sec_attributes.flange_width) - # flange_thickness = str(I_sec_attributes.flange_thickness) - # web_thickness = str(I_sec_attributes.web_thickness) - # flange_slope = float(I_sec_attributes.flange_slope) - # root_radius = str(I_sec_attributes.root_radius) - # toe_radius = str(I_sec_attributes.toe_radius) - # mass = str(I_sec_attributes.mass) - # area = str(round((I_sec_attributes.area / 10 ** 2), 2)) - # mom_inertia_z = str(round((I_sec_attributes.mom_inertia_z / 10 ** 4), 2)) - # mom_inertia_y = str(round((I_sec_attributes.mom_inertia_y / 10 ** 4), 2)) - # rad_of_gy_z = str(round((I_sec_attributes.rad_of_gy_z / 10), 2)) - # rad_of_gy_y = str(round((I_sec_attributes.rad_of_gy_y / 10), 2)) - # elast_sec_mod_z = str(round((I_sec_attributes.elast_sec_mod_z / 10 ** 3), 2)) - # elast_sec_mod_y = str(round((I_sec_attributes.elast_sec_mod_y / 10 ** 3), 2)) - # plast_sec_mod_z = str(round((I_sec_attributes.plast_sec_mod_z / 10 ** 3), 2)) - # plast_sec_mod_y = str(round((I_sec_attributes.plast_sec_mod_y / 10 ** 3), 2)) - # torsion_const = str(round((I_sec_attributes.It / 10 ** 4), 2)) - # warping_const = str(round((I_sec_attributes.Iw / 10 ** 6), 2)) - # if flange_slope != 90: - # image = VALUES_IMG_BEAM[0] - # else: - # image = VALUES_IMG_BEAM[1] - - # if KEY_SEC_MATERIAL in input_dictionary.keys(): - # material_grade = input_dictionary[KEY_SEC_MATERIAL] - # material_attributes = Material(material_grade) - # fu = material_attributes.fu - # fy = material_attributes.fy - section = [] - # if input_dictionary: - # designation_list = input_dictionary[KEY_SECSIZE] - # else: - designation_list = [] - - t2 = (None, KEY_DISP_MECH_PROP, TYPE_TITLE, None, None) - section.append(t2) - - material = connectdb("Material", call_type="popup") - t34 = (KEY_SEC_MATERIAL, KEY_DISP_MATERIAL, TYPE_COMBOBOX, material, material_grade) - section.append(t34) - - t3 = (KEY_SEC_FU, KEY_DISP_FU, TYPE_TEXTBOX, None, fu) - section.append(t3) - - t4 = (KEY_SEC_FY, KEY_DISP_FY, TYPE_TEXTBOX, None, fy) - section.append(t4) - - t15 = ('Label_9', KEY_DISP_MOD_OF_ELAST, TYPE_TEXTBOX, None, m_o_e) - section.append(t15) - - t16 = ('Label_10', KEY_DISP_MOD_OF_RIGID, TYPE_TEXTBOX, None, m_o_r) - section.append(t16) - - t31 = ('Label_24', KEY_DISP_POISSON_RATIO, TYPE_TEXTBOX, None, p_r) - section.append(t31) - - t32 = ('Label_23', KEY_DISP_THERMAL_EXP, TYPE_TEXTBOX, None, t_e) - section.append(t32) - - t14 = ('Label_8', KEY_DISP_TYPE, TYPE_COMBOBOX, ['Welded'], 'Welded') - section.append(t14) - - # t13 = (None, None, TYPE_BREAK, None, None) - # section.append(t13) - - t5 = (None, KEY_DISP_DIMENSIONS, TYPE_TITLE, None, None) - section.append(t5) - t6 = ('Label_1', KEY_DISP_DEPTH, TYPE_TEXTBOX, None, depth) - section.append(t6) - - t7 = ('Label_2', KEY_DISP_FLANGE_W, TYPE_TEXTBOX, None, flange_width) - section.append(t7) - - t8 = ('Label_3', KEY_DISP_FLANGE_T, TYPE_TEXTBOX, None, flange_thickness) - section.append(t8) - - t9 = ('Label_4', KEY_DISP_WEB_T, TYPE_TEXTBOX, None, web_thickness) - section.append(t9) - - t10 = ('Label_5', KEY_DISP_FLANGE_S, TYPE_TEXTBOX, None, flange_slope) - section.append(t10) - - t11 = ('Label_6', KEY_DISP_ROOT_R, TYPE_TEXTBOX, None, root_radius) - section.append(t11) - - # t12 = ('Label_7', KEY_DISP_TOE_R, TYPE_TEXTBOX, None, toe_radius) - # section.append(t12) - - t17 = (None, KEY_DISP_SEC_PROP, TYPE_TITLE, None, None) - section.append(t17) - - t18 = ('Label_11', KEY_DISP_MASS, TYPE_TEXTBOX, None, mass) - section.append(t18) - - t19 = ('Label_12', KEY_DISP_AREA, TYPE_TEXTBOX, None, area) - section.append(t19) - - t20 = ('Label_13', KEY_DISP_MOA_IZ, TYPE_TEXTBOX, None, mom_inertia_z) - section.append(t20) - - t21 = ('Label_14', KEY_DISP_MOA_IY, TYPE_TEXTBOX, None, mom_inertia_y) - section.append(t21) - - t22 = ('Label_15', KEY_DISP_ROG_RZ, TYPE_TEXTBOX, None, rad_of_gy_z) - section.append(t22) - - t23 = ('Label_16', KEY_DISP_ROG_RY, TYPE_TEXTBOX, None, rad_of_gy_y) - section.append(t23) - - t24 = ('Label_17', KEY_DISP_EM_ZZ, TYPE_TEXTBOX, None, elast_sec_mod_z) - section.append(t24) - - t25 = ('Label_18', KEY_DISP_EM_ZY, TYPE_TEXTBOX, None, elast_sec_mod_y) - section.append(t25) - - t28 = (None, None, TYPE_BREAK, None, None) - section.append(t28) - - t33 = (KEY_IMAGE, None, TYPE_IMAGE, None, image) - section.append(t33) - - t17 = (None, KEY_DISP_SEC_PROP, TYPE_TITLE, None, None) - section.append(t17) - - t26 = ('Label_19', KEY_DISP_PM_ZPZ, TYPE_TEXTBOX, None, plast_sec_mod_z) - section.append(t26) - - t27 = ('Label_20', KEY_DISP_PM_ZPY, TYPE_TEXTBOX, None, plast_sec_mod_y) - section.append(t27) - - t26 = ('Label_21', KEY_DISP_It, TYPE_TEXTBOX, None, torsion_const) - section.append(t26) - - t27 = ('Label_22', KEY_DISP_Iw, TYPE_TEXTBOX, None, warping_const) - section.append(t27) - - return section \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder.py b/src/osdag/design_type/plate_girder/weldedPlateGirder.py index a7b50ca3e..a47af3552 100644 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder.py +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder.py @@ -21,8 +21,12 @@ """ import logging import math + + +import pyswarm import numpy as np from pyswarms.single.global_best import GlobalBestPSO +from pyswarm import pso from ...Common import * # from ..connection.moment_connection import MomentConnection from ...utils.common.material import * @@ -379,7 +383,7 @@ def tab_value_changed(self): t1 = (KEY_DISP_GIRDERSEC, [KEY_SEC_MATERIAL], [KEY_SEC_FU, KEY_SEC_FY], TYPE_TEXTBOX, self.get_fu_fy_I_section_plate_girder) change_tab.append(t1) - t4 = (KEY_DISP_GIRDERSEC, ['Label_6', 'Label_7', 'Label_8', 'Label_9', 'Label_10', 'Label_11'], + t4 = (KEY_DISP_GIRDERSEC, ['Label_6', 'Label_7', 'Label_8', 'Label_9', 'Label_10', 'Label_11',KEY_SEC_FY], ['Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', 'Label_19', 'Label_20', 'Label_21', 'Label_22','Label_23'], TYPE_TEXTBOX, self.Unsymm_I_Section_properties) change_tab.append(t4) @@ -503,7 +507,7 @@ def get_values_for_design_pref(self, key, design_dictionary): KEY_DESIGN_LOAD:'Live Load', KEY_MEMBER_OPTIONS :'Simple Span', KEY_SUPPORTING_OPTIONS: 'NA', - KEY_MAX_DEFL : 'Span/600', + KEY_MAX_DEFL : 600, KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS, KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS }[key] @@ -628,7 +632,6 @@ def module_name(self): print('in module') return KEY_DISP_PLATE_GIRDER_WELDED - def set_osdaglogger(key): """ Set logger for Column Design Module. @@ -693,6 +696,9 @@ def input_values(self): t33 = (KEY_OVERALL_DEPTH_PG, KEY_DISP_OVERALL_DEPTH_PG, TYPE_TEXTBOX, None, True, 'Int Validator') options_list.append(t33) + # t33 = (KEY_OVERALL_DEPTH_PG_CST, KEY_DISP_OVERALL_DEPTH_PG, TYPE_COMBOBOX, ['No Inp','Bound Values'], True, 'No Validator') + # options_list.append(t33) + t4 = (KEY_WEB_THICKNESS_PG, KEY_DISP_WEB_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, 'Int Validator') options_list.append(t4) @@ -715,7 +721,7 @@ def input_values(self): 'No Validator') options_list.append(t4) - t2 = (KEY_LENGTH, KEY_DISP_LENGTH, TYPE_TEXTBOX, None, True, 'Int Validator') + t2 = (KEY_LENGTH, KEY_DISP_LENGTH, TYPE_TEXTBOX ,None, True, 'No Validator') options_list.append(t2) t1 = (None, KEY_DISP_SECTION_DATA_PG, TYPE_TITLE, None, True, 'No Validator') @@ -758,9 +764,12 @@ def input_values(self): 'No Validator' ) options_list.append(t8) - t15 = (KEY_IMAGE, None, TYPE_IMAGE_BIGGER, VALUES_IMAGE_PLATEGIRDER[0], True,'No Validator') - options_list.append(t15) + # t15 = (KEY_IMAGE, None, TYPE_IMAGE_BIGGER, VALUES_IMAGE_PLATEGIRDER[0], True,'No Validator') + # options_list.append(t15) return options_list + + + def fn_torsion_warping(self): print( 'Inside fn_torsion_warping', self) @@ -827,13 +836,35 @@ def customized_options(self): return VALUES_PLATETHK else: return VALUES_OPT + + def customized_dimensions_cst(self): + conn = self[0] + if conn == "Optimized": + return KEY_OVERALL_DEPTH_PG_CST + else: + return '' + + def customized_dims_cst(self): + conn = self[0] + if conn == "Optimized": + return True + else: + return False + + def pop_up_bounds(self): + if self[0] == "Bound Values": + dialog = RangeInputDialog() + if dialog.exec_() == QDialog.Accepted: + print("Returned values:", dialog.get_values()) + return str(dialog.get_values()) + def input_value_changed(self): lst = [] - t1 = ([KEY_BENDING_MOMENT_SHAPE], KEY_IMAGE, TYPE_IMAGE, self.fn_conn_image) - lst.append(t1) + # t1 = ([KEY_BENDING_MOMENT_SHAPE], KEY_IMAGE, TYPE_IMAGE, self.fn_conn_image) + # lst.append(t1) t3 = ([KEY_TORSIONAL_RES], KEY_WARPING_RES, TYPE_COMBOBOX, self.fn_torsion_warping) lst.append(t3) @@ -845,6 +876,17 @@ def input_value_changed(self): # t46 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_WEB_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) # lst.append(t46) + # t45 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_OVERALL_DEPTH_PG_CST, TYPE_LABEL, self.customized_dimensions_cst) + # lst.append(t45) + + # t45 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_OVERALL_DEPTH_PG_CST, TYPE_COM, self.customized_dims_cst) + # lst.append(t45) + + + # t45 = ([KEY_OVERALL_DEPTH_PG_CST], KEY_OVERALL_DEPTH_PG_CST, TYPE_COMBOBOX, self.pop_up_bounds) + lst.append(t45) + + t2 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_LABEL, self.customized_dimensions_1) lst.append(t2) t3 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) @@ -878,37 +920,37 @@ def input_value_changed(self): KEY_W_constatnt, TYPE_OUT_DOCK, self.output_modifier) lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_SR_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_SR_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_SR_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_SR_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_NON_DIM_ESR_LTB, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_NON_DIM_ESR_LTB, TYPE_OUT_LABEL, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_NON_DIM_ESR_LTB, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_NON_DIM_ESR_LTB, TYPE_OUT_DOCK, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_LABEL, self.output_modifier) + # lst.append(t18) - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) + # t18 = ([KEY_DESIGN_TYPE_FLEXURE], + # KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_DOCK, self.output_modifier) + # lst.append(t18) t18 = ([KEY_DESIGN_TYPE_FLEXURE], KEY_Elastic_CM, TYPE_OUT_LABEL, self.output_modifier) @@ -942,6 +984,19 @@ def input_value_changed(self): t26 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_DOCK,self.output_modifier2) lst.append(t26) + t27 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudinalStiffener1_pos,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t27) + + t27 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudinalStiffener1_pos,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t27) + + t27 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudinalStiffener2_pos,TYPE_OUT_LABEL,self.output_modifier2) + lst.append(t27) + + t27 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudinalStiffener2_pos,TYPE_OUT_DOCK,self.output_modifier2) + lst.append(t27) + + return lst def warning_majorbending(self): @@ -962,6 +1017,12 @@ def output_modifier(self): else: return True + def output_modifier_long_stiffener(self): + if self[0] == 'Thin we': + return False + else: + return True + def output_modifier2(self): print(self) if self[0] == 'Thin Web with ITS': @@ -1024,11 +1085,10 @@ def output_values(self, flag): self.longstiffener_thk if flag else '', True) out_list.append(t1) - t1 = (KEY_LongitudnalStiffener_numbers, KEY_DISP_LongitudnalStiffener_numbers, TYPE_TEXTBOX, '', True) + t1 = (KEY_LongitudnalStiffener_numbers, KEY_DISP_LongitudnalStiffener_numbers, TYPE_TEXTBOX, self.longstiffener_no if flag else '', True) out_list.append(t1) - t2 = (KEY_EndpanelStiffener_thickness, KEY_DISP_EndpanelStiffener_thickness, TYPE_TEXTBOX, - '', True) + t2 = (KEY_EndpanelStiffener_thickness, KEY_DISP_EndpanelStiffener_thickness, TYPE_TEXTBOX, self.end_panel_stiffener_thickness if flag else '', True) out_list.append(t2) t1 = (KEY_MOMENT_STRENGTH, KEY_DISP_MOMENT, TYPE_TEXTBOX, @@ -1039,11 +1099,11 @@ def output_values(self, flag): # out_list.append(t1) t1 = (KEY_WeldWebtoflange, KEY_DISP_WeldWebtoflange, TYPE_TEXTBOX, - '', True) + max(self.atop, self.abot) if flag else '', True) out_list.append(t1) t1 = (KEY_WeldStiffenertoweb, KEY_DISP_WeldStiffenertoweb, TYPE_TEXTBOX, - '', True) + self.weld_stiff if flag else '', True) out_list.append(t1) # t1 = (None, KEY_DISP_LTB, TYPE_TITLE, None, False) @@ -1056,20 +1116,21 @@ def output_values(self, flag): t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.warping_cnst if flag else '', False) out_list.append(t2) - t2 = ( - KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, '', - False) + t2 = (KEY_LongitudinalStiffener1_pos, KEY_DISP_LongitudinalStiffener1_pos, TYPE_TEXTBOX, self.x1 if flag else '',True) out_list.append(t2) - t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, '', False) + t2 = (KEY_LongitudinalStiffener2_pos, KEY_DISP_LongitudinalStiffener2_pos, TYPE_TEXTBOX, self.x2 if flag else '',True) out_list.append(t2) - t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, '', False) - out_list.append(t2) + # t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, '', False) + # out_list.append(t2) - t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, - '', False) - out_list.append(t1) + # t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, '', False) + # out_list.append(t2) + + # t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, + # '', False) + # out_list.append(t1) t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.critical_moment if flag else '', False) out_list.append(t2) @@ -1149,6 +1210,7 @@ def spacing(self, status): return spacing def func_for_validation(self, design_dictionary): + # print("DESIGN",design_dictionary) print(f"func_for_validation here") all_errors = [] self.design_status = False @@ -1207,7 +1269,7 @@ def func_for_validation(self, design_dictionary): all_errors.append(error) else: flag = True - + print(f"flag {flag} flag1 {flag1} flag2 {flag2} flag3 {flag3}") if flag and flag1 and flag2 and flag3: print(f"\n design_dictionary{design_dictionary}") self.set_input_values(self, design_dictionary) @@ -1251,10 +1313,13 @@ def warn_text(self): # Setting inputs from the input dock GUI def set_input_values(self, design_dictionary): + self.module = design_dictionary[KEY_MODULE] self.design_type = design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE] + print('design_type', design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE]) self.section_class = None if self.design_type == 'Optimized': + print('Optimized Design') self.total_depth = 1 self.web_thickness_list = design_dictionary[KEY_WEB_THICKNESS_PG] self.top_flange_width = 1 @@ -1267,13 +1332,16 @@ def set_input_values(self, design_dictionary): self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) else: - + print('Cus Design') self.total_depth = float(design_dictionary[KEY_OVERALL_DEPTH_PG]) + self.web_thickness_list = design_dictionary[KEY_WEB_THICKNESS_PG] self.web_thickness = float(design_dictionary[KEY_WEB_THICKNESS_PG][0]) self.top_flange_width = float(design_dictionary[KEY_TOP_Bflange_PG]) self.top_flange_thickness = float(design_dictionary[KEY_TOP_FLANGE_THICKNESS_PG][0]) + self.top_flange_thickness_list = design_dictionary[KEY_TOP_FLANGE_THICKNESS_PG] self.bottom_flange_width = float(design_dictionary[KEY_BOTTOM_Bflange_PG]) self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) + self.bottom_flange_thickness_list = design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG] #3 list loops for V inp= self.Zp_req: print( 'self.section_property.plast_sec_mod_z More than Requires',self.plast_sec_mod_z,self.Zp_req) @@ -1553,22 +1636,31 @@ def beta_value(self,design_dictionary,section_class): #-----add a check function to call everything. #checks thick web thickness - def min_web_thickness_thick_web(self, d, tw, eps, stiffner_type,c): - if IS800_2007.cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffner_type, c): + def min_web_thickness_thick_web(self, d, tw, eps, stiffener_type, c): + + if IS800_2007.cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffener_type, c): + print("Web thickness is sufficient for thick web") return True else: + print("Web thickness is not sufficient for thick web") return False + #check 2 moment capacity for major laterally supported & thick web and thin web def moment_capacity_laterally_supported(self, V,Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot, section_class) : A_vg = (D - tf_top - tf_bot) * tw self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) if V > 0.6 * self.V_d: #high shear(Mdv calculation for high shear. Naming kept Md for compatibility) + print("High shear condition") self.Md = self.calc_Mdv(self, V, self.V_d, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot) + print("Md", self.Md) else: #low shear + print("Low shear condition") self.Md = IS800_2007.cl_8_2_1_2_design_bending_strength(section_class, Zp, Ze, Fy, gamma_m0, self.support_condition) + print("Md", self.Md) self.moment_ratio = self.load.moment/ self.Md + print("moment", self.Md) if self.Md >= self.load.moment: return True else: @@ -1578,7 +1670,10 @@ def moment_capacity_laterally_supported(self, V,Zp, Ze, Fy, gamma_m0, D, tw, tf_ def shear_capacity_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top, tf_bot): A_vg = (D - tf_top - tf_bot) * tw self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) - self.shear_ratio = max(self.load.shear_force / self.V_d,self.shear_ratio) + print("V_d", self.V_d) + self.shear_ratio = self.load.shear_force / self.V_d + print("Shear force", self.load.shear_force) + print("shear_ratio", self.shear_ratio) if self.V_d >= self.load.shear_force: return True else: @@ -1593,6 +1688,8 @@ def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top slenderness_input = 2.5 * self.eff_depth / tw self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder(Fy, gamma_m0, slenderness_input, E) Critical_buckling_load = round(Ac * self.fcd, 2) + print("Critical buckling load", Critical_buckling_load) + self.web_buckling_ratio = self.load.shear_force / Critical_buckling_load self.shear_ratio = max(self.load.shear_force / Critical_buckling_load , self.shear_ratio) if Critical_buckling_load>= self.load.shear_force: return True @@ -1603,6 +1700,8 @@ def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top def web_crippling_laterally_supported_thick_web(self, Fy, gamma_m0, tw, tf_top, b1): n2 = 2.5 * tf_top Critical_crippling_load = round((b1 + n2) * tw * Fy / (gamma_m0), 2) + print("Critical crippling load", Critical_crippling_load) + self.web_crippling_ratio = self.load.shear_force / Critical_crippling_load self.shear_ratio = max(self.load.shear_force / Critical_crippling_load , self.shear_ratio) if Critical_crippling_load >= self.load.shear_force: return True @@ -1635,11 +1734,11 @@ def bending_check_lat_unsupported(self, beta_b_lt, plast_sec_mod_z, elast_sec_mo self.fbd_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress(self.X_lt, fy, self.gamma_m0) self.Md = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength(plast_sec_mod_z, elast_sec_mod_z, self.fbd_lt, section_class) - + print("Md", self.Md, "zp", plast_sec_mod_z, "fbd_lt", self.fbd_lt, "phi_lt", self.phi_lt, "X_lt", self.X_lt, "lambda_lt", self.lambda_lt) return round(self.Md, 2) - + def calc_Mdv_lat_unsupported(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot, - Md): # only for major laterally supp + Md): # only for major laterally supp """ Calculate Mdv for high shear conditions. @@ -1727,34 +1826,44 @@ def calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D): Calculate yj per IS 800:2007 Clause E.3.2.2. Returns 0 for symmetric sections. """ if Bf_top == Bf_bot and tf_top == tf_bot: - return 0.0 # symmetric section + yj = 0 # symmetric section h = D - (tf_top + tf_bot) Ift = (Bf_top * tf_top**3) / 12 Ifc = (Bf_bot * tf_bot**3) / 12 beta_f = Ifc / (Ifc + Ift) alpha = 0.8 if beta_f > 0.5 else 1.0 - return alpha * (2 * beta_f - 1) * h / 2 - - def moment_capacity_laterally_unsupported(self,E, LLT, D, - tf_top, tf_bot, Bf_top, Bf_bot,tw, - LoadingCase,gamma_m0, Fy,shear_force): + yj= alpha * (2 * beta_f - 1) * h / 2 + return yj + + def moment_capacity_laterally_unsupported(self, E, LLT, D, + tf_top, tf_bot, Bf_top, Bf_bot, tw, + LoadingCase, gamma_m0, Fy, shear_force): if Bf_top == Bf_bot and tf_top == tf_bot: - return 0.0 # symmetric section + yj = 0 + # symmetric section h = D - (tf_top + tf_bot) Ift = (Bf_top * tf_top ** 3) / 12 Ifc = (Bf_bot * tf_bot ** 3) / 12 beta_f = Ifc / (Ifc + Ift) alpha = 0.8 if beta_f > 0.5 else 1.0 - alpha * (2 * beta_f - 1) * h / 2 - - - G = 0.769 * 10**5 - Kw = self.get_K_from_warping_restraint(self,self.warping) - Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - - #Mcr calc + yj= alpha * (2 * beta_f - 1) * h / 2 + + G = 0.769 * 10 ** 5 + Kw = self.get_K_from_warping_restraint(self, self.warping) + Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, + self.bottom_flange_width, self.web_thickness, + self.top_flange_thickness, + self.bottom_flange_thickness) + self.It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, + self.bottom_flange_width, self.web_thickness, + self.top_flange_thickness, + self.bottom_flange_thickness) + self.Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, + self.bottom_flange_width, self.web_thickness, + self.top_flange_thickness, + self.bottom_flange_thickness) + + # Mcr calc yg = D / 2 yj = self.calc_yj(self, Bf_top, tf_top, Bf_bot, tf_bot, D) K_value = 0 @@ -1777,32 +1886,41 @@ def moment_capacity_laterally_unsupported(self,E, LLT, D, # Symmetric section (Eq 2.20) if Bf_top == Bf_bot and tf_top == tf_bot: term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) - term2 = (Iw / Iy) - term3 = (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + term2 = (self.Iw / Iy) + term3 = (G * self.It * LLT ** 2) / (math.pi ** 2 * E * Iy) self.M_cr = term1 * math.sqrt(term2 + term3) else: # Unsymmetric case (Annex E full formula) term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) - bracket = ((K_value / Kw) ** 2 * (Iw / Iy) + - (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + - (c2 * yg - c3 * yj) ** 2) + bracket = ((K_value / Kw) ** 2 * (self.Iw / Iy) + + (G * self.It * LLT ** 2) / (math.pi ** 2 * E * Iy) + + (c2 * yg - c3 * yj) ** 2) self.M_cr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) - - print("Input moment",self.load.moment) - print("MCR VAL",self.M_cr) + + print("Input moment", self.load.moment) + print("MCR VAL", self.M_cr) A_vg = (D - tf_top - tf_bot) * tw self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) + Zp = self.plast_sec_mod_z + self.lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment(self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, Fy, + self.M_cr) + + self.phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt(self.alpha_lt, self.lambda_lt) + self.X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor(self.phi_lt, self.lambda_lt) + self.fbd_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress(self.X_lt, Fy, self.gamma_m0) + self.Md = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength(self.plast_sec_mod_z, self.elast_sec_mod_z, self.fbd_lt, + self.section_class) if shear_force > 0.6 * self.V_d: # high shear(Mdv calculation for high shear. Naming kept Md for compatibility) self.Md = self.calc_Mdv_lat_unsupported(self, self.load.shear_force, self.V_d, self.plast_sec_mod_z, self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness, self.Md) else: # low shear - self.Md = self.bending_check_lat_unsupported(self, self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, - self.material.fy, self.M_cr, self.section_class) - + self.Md = self.bending_check_lat_unsupported(self, self.beta_b_lt, self.plast_sec_mod_z, + self.elast_sec_mod_z, + self.material.fy, self.M_cr, self.section_class) - self.moment_ratio = self.load.moment/ self.Md + self.moment_ratio = self.load.moment / self.Md print("Ratio for moment", self.moment_ratio) # # print("supp mdv",self.Mdv) if self.Md >= self.load.moment: @@ -1834,11 +1952,10 @@ def effective_length_beam(self, design_dictionary, length): print(f"Working 3 {self.effective_length}") print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) - def end_panel_stiffener_calc(self, - Bf_top, Bf_bot, tw, tq, fy, gamma_m0, effective_depth, - tf_top, total_depth, effective_length, tf_bot, E, eps -): + Bf_top, Bf_bot, tw, tq, fy, gamma_m0, d, + tf_top, total_depth, effective_length, tf_bot, E, eps, c + ): """ Calculate end panel stiffener properties. @@ -1861,53 +1978,161 @@ def end_panel_stiffener_calc(self, Returns: dict: Dictionary of results including buckling resistance, bearing capacity, and torsion check. """ + A_vg = d * tw + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c / d < 1: + K_v = 4 + 5.35 / (c / d) ** 2 + else: + K_v = 5.35 + 4 / (c / d) ** 2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, self.material.modulus_of_elasticity, mu, d, + tw) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + Nf = self.load.moment / d + phi, M_fr_t, M_fr_b, s_t, s_b, w_tf, sai, fv, self.V_tf = IS800_2007.cl_8_4_2_2_TensionField_unequal_Isection(c, d, tw, + fy, Bf_top, + tf_top, Bf_bot, tf_bot, + Nf, gamma_m0, + A_vg, tau_b) + V_dp = (d * tw * fy / math.sqrt(3)) + + rad = 1.0 - (self.V_cr / V_dp) + if rad < 0: + return False - # Geometrical properties - net_outstand = min(Bf_top, Bf_bot) - tq - width_stiffener = min(max(net_outstand, 14 * tq * eps), 20 * tq * eps) - - # Core area and moment of inertia for buckling resistance - A_core = (14 * tq * epsilon * 2) + (20 * tw * tw) - Ixx = ((tq * (14 * tq * epsilon * 2) ** 3) / 12) + ((20 * tw * tw ** 3) / 12) - r = math.sqrt(Ixx / A_core) - # Slenderness ratio - slenderness_input = 0.7 * effective_depth / r - self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( - fy, - gamma_m0, - slenderness_input, - E ) - buckling_resistance = self.fcd * A_core - - # Bearing capacity - chamfered_width = 15 # mm - Aq = 2 * (width_stiffener - chamfered_width) * tq - bearing_capacity = (Aq * fy) / (0.8 * gamma_m0) + H_q = 1.25 * V_dp * math.sqrt(rad) + R_tf = H_q / 2 + A_v = d * tw + V_n = (fy * A_v) / (math.sqrt(3) * gamma_m0) + # Moment demand M_tf (kN·m) + M_tf = (H_q * d) / 10 + y = c / 2 + I = tw * (c ** 3) / 12 + M_q = (I * fy) / (gamma_m0 * y) + self.moment_ratio = max(M_tf / M_q, self.moment_ratio) + self.endshear_ratio = max(R_tf / V_n, self.endshear_ratio ) + print('moment ratio', self.moment_ratio, 'end panel shear ratio 1', self.endshear_ratio ) + + # if V_n >= R_tf: + # if M_q >= M_tf: + Fm = M_tf / c + Fc = Fm + self.load.shear_force + bearing_area = 0.8 * Fc * self.gamma_m0 / self.material.fy + Bearing_capacity = 0 + Bearing_stiffenerforce = -1 + thickness_list= ['8', '10', '12', '14', '16', '18', '20', '22', '25', '28', '32', '36', '40', '45', '50', '56', '63', '75', '80', '90', '100', + '110', '120'] + if len(self.int_thickness_list) == 0: + return False + for self.end_stiffthickness in thickness_list: + + self.end_stiffthickness = float(self.end_stiffthickness) + Aq = 2 * self.end_stiffthickness * self.end_stiffwidth + print('Aq',Aq) + max_outstand = 14 * self.end_stiffthickness * self.epsilon + if self.end_stiffwidth <= max_outstand: + self.end_stiffwidth = max_outstand + I_x = (((2 * self.end_stiffwidth + tw) ** 3) * self.end_stiffthickness) / 12 + I_x += (20 * tw * 2 * tw ** 3) / 12 + I_x -= (self.end_stiffthickness * tw ** 3) / 12 + + # Radius of gyration + r_x = math.sqrt(I_x / Aq) + + # Slenderness ratio + Le = self.lefactor * d + slenderness_input = Le / r_x + + # Design compressive stress from IS 800 + fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + self.material.fy, self.gamma_m0, slenderness_input, self.material.modulus_of_elasticity + ) - # Torsional restraint - ry = Unsymmetrical_I_Section_Properties.calc_RadiusOfGyrationY(self, total_depth, Bf_top, Bf_bot, tw, tf_top, tf_bot) - slender_torsion = effective_length / ry + # Critical buckling resistance (kN) + Pd = Aq * fcd + + print('moment ratio', self.moment_ratio, 'end panel shear ratio 2', self.endshear_ratio ) + self.Critical_buckling_resistance = Pd + n2 = 2.5 * self.bottom_flange_thickness + Fw = n2 * tw * self.material.fy / (self.gamma_m0) + Bearing_stiffenerforce = Fc - Fw + Bearing_capacity = self.material.fy * Aq / (self.gamma_m0) + # print('stiff width', self.end_stiffwidth, 'stiff thick', self.end_stiffthickness, 'D', d, 'Vcr', + # self.V_cr, 'Vdp', V_dp, rad, 'Hq', H_q, 'Rtf', R_tf, 'Av', A_v, 'Vn', V_n, 'Mtf', M_tf, 'I', I, + # 'Mq', M_q, 'Fm', Fm, 'Fc', Fc, 'bearing_area', bearing_area, 'Aq', Aq, 'max_outstand', + # max_outstand, 'I_x', I_x, 'r_x', r_x, 'slenderness_input', slenderness_input, 'fcd', fcd, 'Pd', + # Pd, 'Fw', Fw, 'Bearing_stiffenerforce', Bearing_stiffenerforce, 'Bearing_capacity', + # Bearing_capacity) + print('fcd', fcd, 'Pd', Pd, 'FC', Fc) + self.endshear_ratio = max(Bearing_stiffenerforce / Bearing_capacity, Fc / Pd, R_tf / V_n ) + print('moment ratio', self.moment_ratio, 'end panel shear ratio 3', self.endshear_ratio ) + + if self.endshear_ratio <= 1: + break + else: + continue + self.shear_ratio = max(self.endshear_ratio, self.shear_ratio) + if self.endshear_ratio <= 1: + print("end stiffener check passed") - if slender_torsion <= 50: - alpha_s = 0.006 - elif slender_torsion <= 100: - alpha_s = 0.3 / slender_torsion + return True else: - alpha_s = 30 / (slender_torsion ** 2) + print("Tension field end stiffener check failed: Bearing capacity insufficient") + self.end_stiffthickness = 0 - torsion_check = 0.34 * alpha_s * (total_depth ** 3) * tf_top - Is = (tq * (2 * width_stiffener) ** 3) / 12 - torsion_ok = Is >= torsion_check + return False - return { - "Buckling Resistance (N)": buckling_resistance, - "Bearing Capacity (N)": bearing_capacity, - "Slenderness Ratio": slenderness_input, - "Design Compressive Strength fcd (MPa)": self.fcd, - "Moment of Inertia Is (mm^4)": Is, - "Torsion Check (mm^4)": torsion_check, - "Torsion OK": torsion_ok - } + # # Geometrical properties + # net_outstand = min(Bf_top, Bf_bot) - tq + # width_stiffener = min(max(net_outstand, 14 * tq * eps), 20 * tq * eps) + # + # # Core area and moment of inertia for buckling resistance + # A_core = (14 * tq * epsilon * 2) + (20 * tw * tw) + # Ixx = ((tq * (14 * tq * epsilon * 2) ** 3) / 12) + ((20 * tw * tw ** 3) / 12) + # r = math.sqrt(Ixx / A_core) + # # Slenderness ratio + # slenderness_input = 0.7 * effective_depth / r + # self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + # fy, + # gamma_m0, + # slenderness_input, + # E ) + # buckling_resistance = self.fcd * A_core + # + # # Bearing capacity + # chamfered_width = 15 # mm + # Aq = 2 * (width_stiffener - chamfered_width) * tq + # bearing_capacity = (Aq * fy) / (0.8 * gamma_m0) + # + # # Torsional restraint + # ry = Unsymmetrical_I_Section_Properties.calc_RadiusOfGyrationY(self, total_depth, Bf_top, Bf_bot, tw, tf_top, tf_bot) + # slender_torsion = effective_length / ry + # + # if slender_torsion <= 50: + # alpha_s = 0.006 + # elif slender_torsion <= 100: + # alpha_s = 0.3 / slender_torsion + # else: + # alpha_s = 30 / (slender_torsion ** 2) + # + # torsion_check = 0.34 * alpha_s * (total_depth ** 3) * tf_top + # Is = (tq * (2 * width_stiffener) ** 3) / 12 + # torsion_ok = Is >= torsion_check + # + # return { + # "Buckling Resistance (N)": buckling_resistance, + # "Bearing Capacity (N)": bearing_capacity, + # "Slenderness Ratio": slenderness_input, + # "Design Compressive Strength fcd (MPa)": self.fcd, + # "Moment of Inertia Is (mm^4)": Is, + # "Torsion Check (mm^4)": torsion_check, + # "Torsion OK": torsion_ok + # } def deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case): """ @@ -1950,7 +2175,7 @@ def deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case): ) def evaluate_deflection_kNm_mm(self, - M_kNm, L, E, case, criteria_list=VALUES_MAX_DEFL + M_kNm, L, E, case, criteria ): """ 1) Calculate deflection from moment (with unit conversions). @@ -1961,23 +2186,16 @@ def evaluate_deflection_kNm_mm(self, I = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaZ(self,self.total_depth,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness) delta = self.deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case) - # 2) compare against each 'Span/N' limit - results = {} - passed = [] - for crit in criteria_list: - try: - _, denom = crit.split('/') - n = float(denom) - except ValueError: - continue - allowable = L / n - ok = (delta <= allowable) - self.deflection_ratio = max(delta / allowable, self.deflection_ratio) + n = float(criteria) + allowable = L / n + print(L, n, allowable, delta) + ok = (delta <= allowable) + self.deflection_ratio = delta / allowable - if ok: - return True - else: - return False + if ok: + return True + else: + return False # results[crit] = { # 'allowable_m': allowable, # 'actual_m': delta, @@ -2042,11 +2260,11 @@ def weld_leg_from_q_with_cl10(self, """ # 1) get f_wd in MPa → convert to N/mm² f_wd = IS800_2007.cl_10_5_7_1_1_fillet_weld_design_stress( - ultimate_stresses, fabrication + ultimate_stresses ) # MPa # 2) convert q to N/mm - q_N_per_mm = q_kN_per_mm * 1e3 + q_N_per_mm = q_kN_per_mm # 3) throat thickness t = q / f_wd [mm] t_throat = q_N_per_mm / f_wd @@ -2056,33 +2274,36 @@ def weld_leg_from_q_with_cl10(self, def design_welds_with_strength_web_to_flange(self, - # section loads & geometry + V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w, - # material / weld properties - ultimate_stresses, fabrication, - # stiffener inputs - t_st, b_st, V_unstf, L_weld + + ultimate_stresses + ): # compute shear flows sf = self.shear_stress_unsym_I(self, V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w) - + min_weld_legtop = IS800_2007.cl_10_5_2_3_min_weld_size(t_ft, t_w) + min_weld_legbot = IS800_2007.cl_10_5_2_3_min_weld_size(t_fb, t_w) + max_weld_legtop = IS800_2007.cl_10_5_3_1_max_weld_throat_thickness(t_ft, t_w) + max_weld_legbot = IS800_2007.cl_10_5_3_1_max_weld_throat_thickness(t_fb, t_w) # weld legs using cl.10 strength - a_top = self.weld_leg_from_q_with_cl10(self, - sf['q_top'], ultimate_stresses, fabrication - ) - a_bot = self.weld_leg_from_q_with_cl10(self, - sf['q_bot'], ultimate_stresses, fabrication - ) + a_top = round_up(max(self.weld_leg_from_q_with_cl10(self, + sf['q_top_kN_per_mm'], ultimate_stresses + ), min_weld_legtop) and min(self.weld_leg_from_q_with_cl10(self, + sf['q_top_kN_per_mm'], ultimate_stresses + ), max_weld_legtop),1) + + a_bot = round_up(max(self.weld_leg_from_q_with_cl10(self, + sf['q_bot_kN_per_mm'], ultimate_stresses + ), min_weld_legbot) and min(self.weld_leg_from_q_with_cl10(self, sf['q_bot_kN_per_mm'], ultimate_stresses + ), max_weld_legbot),1) # end‐stiffener check (unchanged) - return { - **sf, - 'a_top_mm': a_top, - 'a_bot_mm': a_bot - } + return a_top, a_bot - def weld_for_end_stiffener(self, t_st, b_st, V_ed, V_unstf, D, t_ft, t_fb, tw): + + def weld_for_end_stiffener(self, t_st, b_st, V_ed, V_unstf, D, t_ft, t_fb, tw, ultimate_stresses): """ t_st : thickness of stiffener b_st : width of stiffener @@ -2116,18 +2337,26 @@ def weld_for_end_stiffener(self, t_st, b_st, V_ed, V_unstf, D, t_ft, t_fb, tw): # 4) split into two welds (each face) q_each = q_tot / 2 - return { - 'L_weld_mm': L_weld, - 'q1_min': q1, - 'q2_ext': q2, - 'q_total': q_tot, - 'q_each_weld': q_each - } + min_weld_legtop = IS800_2007.cl_10_5_2_3_min_weld_size(t_st, tw) + + max_weld_legtop = IS800_2007.cl_10_5_3_1_max_weld_throat_thickness(t_st, tw) + + # weld legs using cl.10 strength + weld_stiff = self.weld_leg_from_q_with_cl10(self, q_each, ultimate_stresses) + print("weld_stiff", weld_stiff, "min_weld_legtop", min_weld_legtop, "max_weld_legtop", max_weld_legtop) + if weld_stiff < min_weld_legtop: + weld_stiff = min_weld_legtop + if weld_stiff > max_weld_legtop: + weld_stiff = max_weld_legtop + #weld_stiff = round_up(max(weld_stiff, min_weld_legtop) and min(weld_stiff, max_weld_legtop), 1) + + return weld_stiff + #-------------Thin Web (Simple post critical method)------------------------# def shear_buckling_check_simple_postcritical(self, eff_depth,D,tf_top,tf_bot,tw, V, c=0): - A_vg = (D - tf_top - tf_bot) * tw + A_vg = eff_depth * tw if self.web_philosophy == 'Thick Web without ITS': K_v = 5.35 else: @@ -2142,8 +2371,9 @@ def shear_buckling_check_simple_postcritical(self, eff_depth,D,tf_top,tf_bot,tw, tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) print("V_cr value", self.V_cr) - self.shear_ratio = max(self.load.shear_force / self.V_cr , self.shear_ratio) + #self.shear_ratio = max(self.load.shear_force / self.V_cr , self.shear_ratio) if self.V_cr > V: + self.shear_ratio = max(self.load.shear_force / self.V_cr, self.shear_ratio) return True else: return False @@ -2157,7 +2387,6 @@ def shear_buckling_check_intermediate_stiffener( e, IntStiffThickness, IntStiffenerWidth, - V_cr, V_ed, gamma_m0, fy, @@ -2182,33 +2411,49 @@ def shear_buckling_check_intermediate_stiffener( Returns: bool : True if stiffener passes both global and shear buckling checks, False otherwise. """ + A_vg = d * tw + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c / d < 1: + K_v = 4 + 5.35 / (c / d) ** 2 + else: + K_v = 5.35 + 4 / (c / d) ** 2 + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E, mu, d, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) # 1. Global buckling check of stiffener cd_ratio = c / d if cd_ratio >= math.sqrt(2): I_min_global = 0.75 * d * tw**3 + else: - I_min_global = (1.5 * d * tw**3) / (c**2) + I_min_global = (1.5 * d**3 * tw**3) / (c**2) - # Moment of inertia of stiffener cross-section - I_s = (((2 * IntStiffenerWidth + tw)**3) * IntStiffThickness) / 12 - I_s -= (IntStiffThickness * tw**3) / 12 # Maximum allowable outstand max_outstand = 14 * IntStiffThickness * e # Fail global check if inertia or outstand insufficient - if I_s < I_min_global or max_outstand < IntStiffenerWidth: - return False + if max_outstand < IntStiffenerWidth: + #print('I_s > I_min_global or max_outstand > IntStiffenerWidth') + IntStiffenerWidth= max_outstand + + # Moment of inertia of stiffener cross-section + I_s = (((2 * IntStiffenerWidth + tw) ** 3) * IntStiffThickness) / 12 + I_s -= (IntStiffThickness * tw ** 3) / 12 # 2. Shear buckling (axial) check of stiffener # Effective shear force on stiffener - F_q = (V_ed - V_cr) / gamma_m0 + F_q = (V_ed - self.V_cr) / gamma_m0 # Provided cross-sectional area A_s = 2 * IntStiffenerWidth * IntStiffThickness # Combined area for axial buckling (stiffener + bearing area) - A_x = A_s + (20 * tw * 2) + A_x = A_s + (20 * tw * 2 * tw) # Moment of inertia for axial buckling I_x = (((2 * IntStiffenerWidth + tw)**3) * IntStiffThickness) / 12 @@ -2228,41 +2473,126 @@ def shear_buckling_check_intermediate_stiffener( ) # Critical buckling resistance (kN) - Pd = round(A_x * fcd / 1000, 2) + Pd = round(A_x * fcd , 2) self.shear_ratio = max(self.load.shear_force / Pd , self.shear_ratio) + print('moment ratio', self.moment_ratio, 'inter shear ratio', self.shear_ratio) self.Critical_buckling_resistance = Pd + print("Intermediate stiffener shear buckling check:", 'stiff width', IntStiffenerWidth, 'stiff thick', IntStiffThickness, 'cd_ratio', cd_ratio, 'I_min_global', I_min_global, 'I_s', I_s, 'max_outstand', max_outstand, 'F_q', F_q, 'As', A_s, 'Ax', A_x, 'Ix', I_x, 'rx', r_x, 'Le', Le, 'slenderness input', slenderness_input, 'fcd', fcd, 'Pd', Pd, 'V_cr', self.V_cr, 'V_ed', V_ed, 'gamma_m0', gamma_m0, 'fy', fy, 'E', E) + # Debug prints print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") print("Critical buckling resistance Pd:", Pd, "kN") # Check axial capacity - return F_q < Pd + # if F_q < Pd: + # print("Intermediate stiffener shear buckling check passed") + return True + # else: + # return False + - def tension_field_end_stiffener(self, d, tw, fyw, V_tf, V_cr, shear_force, moment): + def tension_field_end_stiffener(self, d, tw, fyw, shear_force, moment, c): # Formula 1: H_q = 1.25·V_p·√[1 – (V_cr–V_p)/(V_tf–V_cr)] - V_dp = (d * tw * fyw * math.sqrt(3)) / 1000 - denom = V_tf - V_cr - rad = 1.0 - (V_cr - V_dp) / denom + + A_vg = d * tw + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c / d < 1: + K_v = 4 + 5.35 / (c / d) ** 2 + else: + K_v = 5.35 + 4 / (c / d) ** 2 + E = self.material.modulus_of_elasticity + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, self.material.modulus_of_elasticity, mu, d, tw) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + Nf = self.load.moment / (d + (self.top_flange_thickness + self.bottom_flange_thickness) / 2) + result= IS800_2007.cl_8_4_2_2_TensionField_unequal_Isection(c, d, tw, + fyw, self.top_flange_width, + self.top_flange_thickness, self.bottom_flange_width, + self.bottom_flange_thickness, + Nf, self.gamma_m0, + A_vg, tau_b) + V_tf= result[8] + V_dp = (d * tw * fyw * math.sqrt(3)) + denom = V_tf - self.V_cr + rad = 1.0 - (self.V_cr - V_dp) / denom if rad < 0: - raise ValueError(f"Negative radicand under sqrt: {rad:.3f}") - H_q = 1.25 * V_dp * math.sqrt(rad) + return False # Avoid negative radicand under sqrt + H_q = (shear_force - self.V_cr) / denom R_tf = H_q / 2 A_v= d * tw - V_n= (fyw * A_v) /( 1000 * math.sqrt(3) * self.gamma_m0) + V_n= (fyw * A_v) /( math.sqrt(3) * self.gamma_m0) # Moment demand M_tf (kN·m) M_tf = (H_q * d) / 10 y = c / 2 I = tw * c ** 3 / 12 M_q = (I * fyw) / (self.gamma_m0 * y) self.moment_ratio = max(M_tf / M_q , self.moment_ratio) - self.shear_ratio = max(self.load.shear_force / R_tf , self.shear_ratio) + self.endshear_ratio = max(R_tf / V_n, self.endshear_ratio) if V_n >= R_tf: if M_q >= M_tf: - return True - return False - - def shear_buckling_check_tension_field(self, eff_depth,D,tf_top,tf_bot,tw, c=0, Nf=0): + Fm= M_tf/c + Fc= Fm + shear_force + bearing_area = 0.8 * Fc * self.gamma_m0 / self.material.fy + thickness_list = ['8', '10', '12', '14', '16', '18', '20', '22', '25', '28', '32', '36', '40', '45', + '50', '56', '63', '75', '80', '90', '100', + '110', '120'] + if len(self.int_thickness_list) == 0: + return False + for self.end_stiffthickness in thickness_list: + self.end_stiffthickness = float(self.end_stiffthickness) + Aq= 2 * self.IntStiffnerwidth* self.IntStiffThickness + Aq>= bearing_area + max_outstand = 14 * self.IntStiffThickness * self.epsilon + if self.IntStiffnerwidth > max_outstand: + self.IntStiffnerwidth = max_outstand + I_x = (((2 * self.IntStiffnerwidth + tw) ** 3) * self.IntStiffThickness) / 12 + I_x += (20 * tw * 2 * tw ** 3) / 12 + I_x -= (self.IntStiffThickness * tw ** 3) / 12 + + # Radius of gyration + r_x = math.sqrt(I_x / Aq) + + # Slenderness ratio + Le = self.lefactor * d + slenderness_input = Le / r_x + + # Design compressive stress from IS 800 + fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + self.material.fy, self.gamma_m0, slenderness_input, self.material.modulus_of_elasticity + ) + + # Critical buckling resistance (kN) + Pd = round(Aq * fcd , 2) + + self.Critical_buckling_resistance = Pd + + n2= 2.5 * self.bottom_flange_thickness + Fw= n2 * tw * self.material.fy / (self.gamma_m0) + Bearing_stiffenerforce= Fc - Fw + Bearing_capacity= self.material.fy * Aq / (1.1 * self.gamma_m0) + self.endshear_ratio = max(Bearing_stiffenerforce / Bearing_capacity, Fc / Pd, R_tf / V_n) + + if self.endshear_ratio <= 1: + break + else: + continue + self.shear_ratio = max(self.endshear_ratio, self.shear_ratio) + if self.endshear_ratio <= 1: + print("end stiffener check passed") + + return True + else: + print("Tension field end stiffener check failed: Bearing capacity insufficient") + self.end_stiffthickness = 0 + + return False + + def shear_buckling_check_tension_field(self, eff_depth,D,tf_top,tf_bot,tw, c=0): A_vg = (D - tf_top - tf_bot) * tw if self.web_philosophy == 'Thick Web without ITS': K_v = 5.35 @@ -2277,25 +2607,222 @@ def shear_buckling_check_tension_field(self, eff_depth,D,tf_top,tf_bot,tw, c=0, lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) - phi, M_fr, s, w_tf, sai, fv, self.V_tf = IS800_2007.cl_8_4_2_2_TensionField(c, eff_depth, self.web_thickness, + Nf = self.load.moment / (eff_depth + (tf_top + tf_bot) / 2) + phi, M_fr_t, M_fr_b, s_t, s_b, w_tf, sai, fv, self.V_tf = IS800_2007.cl_8_4_2_2_TensionField_unequal_Isection(c, eff_depth, self.web_thickness, self.material.fy, self.top_flange_width, - self.top_flange_thickness, - self.material.fy, Nf, self.gamma_m0, - A_vg, tau_b, self.load.shear_force) - print("vtf val",self.V_tf) + self.top_flange_thickness, self.bottom_flange_width, self.bottom_flange_thickness, + Nf, self.gamma_m0, + A_vg, tau_b) + #print("vtf val",self.V_tf) + #print('eff depth', eff_depth, 'nf', Nf, 'tau_crc', tau_crc, 'tau_b', tau_b, 'V_cr', self.V_cr, 'phi', phi, 'M_fr_t', M_fr_t, 'M_fr_b', M_fr_b, 's_t', s_t, 's_b', s_b, 'w_tf', w_tf, 'sai', sai, 'fv', fv, 'V_tf', self.V_tf) self.shear_ratio = max(self.load.shear_force / self.V_tf , self.shear_ratio) if self.V_tf >= self.load.shear_force: return True else: return False + + def tension_field_intermediate_stiffener( + self, + d, + tw, + c, + e, + IntStiffThickness, + IntStiffenerWidth, + V_ed, + gamma_m0, + fy, + E + ): + """ + Performs global and shear buckling checks for an intermediate stiffener. + + Parameters: + d : float : depth of web panel (mm) + tw : float : thickness of web (mm) + c : float : stiffener spacing (mm) + e : float : outstand ratio factor + IntStiffThickness : float : thickness of intermediate stiffener (mm) + IntStiffenerWidth : float : width of intermediate stiffener leg (mm) + V_cr : float : critical shear buckling force (kN) + V_ed : float : design shear force on panel (kN) + gamma_m0 : float : partial safety factor for material + fy : float : yield strength of steel (MPa) + E : float : modulus of elasticity of steel (MPa) + + Returns: + bool : True if stiffener passes both global and shear buckling checks, False otherwise. + """ + A_vg = d * tw + if self.web_philosophy == 'Thick Web without ITS': + K_v = 5.35 + else: + if c / d < 1: + K_v = 4 + 5.35 / (c / d) ** 2 + else: + K_v = 5.35 + 4 / (c / d) ** 2 + mu = 0.3 + tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E, mu, d, self.web_thickness) + lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) + tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) + self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) + # 1. Global buckling check of stiffener + cd_ratio = c / d + if cd_ratio >= math.sqrt(2): + I_min_global = 0.75 * d * tw ** 3 + + else: + I_min_global = (1.5 * d ** 3 * tw ** 3) / (c ** 2) + + # Maximum allowable outstand + max_outstand = 14 * IntStiffThickness * e + + # Fail global check if inertia or outstand insufficient + if max_outstand < IntStiffenerWidth: + # print('I_s > I_min_global or max_outstand > IntStiffenerWidth') + IntStiffenerWidth = max_outstand + + # Moment of inertia of stiffener cross-section + I_s = (((2 * IntStiffenerWidth + tw) ** 3) * IntStiffThickness) / 12 + I_s -= (IntStiffThickness * tw ** 3) / 12 + + # 2. Shear buckling (axial) check of stiffener + # Effective shear force on stiffener + F_q = (V_ed - self.V_cr) / gamma_m0 + + # Provided cross-sectional area + A_s = 2 * IntStiffenerWidth * IntStiffThickness + + # Combined area for axial buckling (stiffener + bearing area) + A_x = A_s + (20 * tw * 2 * tw) + + # Moment of inertia for axial buckling + I_x = (((2 * IntStiffenerWidth + tw) ** 3) * IntStiffThickness) / 12 + I_x += (20 * tw * 2 * tw ** 3) / 12 + I_x -= (IntStiffThickness * tw ** 3) / 12 + + # Radius of gyration + r_x = math.sqrt(I_x / A_x) + + # Slenderness ratio + Le = self.lefactor * d + slenderness_input = Le / r_x + + # Design compressive stress from IS 800 + fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( + fy, gamma_m0, slenderness_input, E + ) + + # Critical buckling resistance (kN) + Pd = round(A_x * fcd, 2) + self.shear_ratio = max(self.load.shear_force / Pd, self.shear_ratio) + print('moment ratio', self.moment_ratio, 'inter shear ratio', self.shear_ratio) + self.Critical_buckling_resistance = Pd + + print("Intermediate stiffener shear buckling check:", 'stiff width', IntStiffenerWidth, 'stiff thick', + IntStiffThickness, 'cd_ratio', cd_ratio, 'I_min_global', I_min_global, 'I_s', I_s, 'max_outstand', + max_outstand, 'F_q', F_q, 'As', A_s, 'Ax', A_x, 'Ix', I_x, 'rx', r_x, 'Le', Le, 'slenderness input', + slenderness_input, 'fcd', fcd, 'Pd', Pd, 'V_cr', self.V_cr, 'V_ed', V_ed, 'gamma_m0', gamma_m0, 'fy', + fy, 'E', E) + + # Debug prints + print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") + print("Critical buckling resistance Pd:", Pd, "kN") + + # Check axial capacity + # if F_q < Pd: + # print("Intermediate stiffener shear buckling check passed") + return True + # else: + # return False + + def design_longitudinal_stiffeners(self, d, tw, c, eps_w, second_stiffener=False): + """ + Determine whether horizontal (longitudinal) stiffeners are required in a plate girder + and compute the minimum required second moment of area Is. + + Parameters + ---------- + d : float + Clear depth of web (distance between flanges), in mm (or consistent units). + tw : float + Web thickness, in mm. + c : float + Clear distance from compression - flange angles to the neutral axis, in mm. + eps_w : float + Web slenderness parameter ε_w = √(E/Fy), unitless. + second_stiffener : bool, optional + If True, assume a stiffener at the neutral axis will be provided (enabling Eq. 2.39). + + Returns + ------- + dict + { + 'required' : bool, # Is any stiffener required? + 'slenderness' : float, # Governing slenderness ratio used + 'limit' : float, # Allowable slenderness limit + 'locations' : tuple, # (x1, x2), distances from comp. flange to stiffeners + 'I1_min' : float, # Eq. 2.40: first stiffener Is ≥ 4·c·t_w³ + 'I2_min' : float, # Eq. 2.41: second stiffener Is ≥ d2²·t_w³, where d2=2·c + 'Imin_global' : float, # Eqs. 2.42 - 2.43: overall minimum stiffener Is + 'Is_required' : float # Governing Is = max(I1_min, I2_min, Imin_global) + } + + Notes + ----- + - Uses Eq. 2.36 - 2.38 for the unstiffened web checks; if `second_stiffener=True`, uses + Eq. 2.39 (d/tw ≤ 400·ε_w) instead. + - Locations: x1 = c/5 from compression flange; x2 = 0 (neutral axis). + """ + c = float(c) + tw = float(tw) + d_na= Unsymmetrical_I_Section_Properties.calc_centroid(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + print('d_na', d_na) + # 2) stiffener locations + self.x1 = int(round(d_na / 5.0 ,0)) # first stiffener at 1/5 of neutral axis from compression flange + self.x2 = 0.0 # second stiffener at neutral axis + + # 3) design criteria for Is + I1_min = 4.0 * c * tw ** 3 # Eq. 2.40 + d2 = 2.0 * d_na # twice clear distance to NA + I2_min = d2 ** 2 * tw ** 3 # Eq. 2.41 + + # 4) global minimum (Eqs. 2.42–2.43) + cd_ratio = c / d + if cd_ratio >= math.sqrt(2): + Imin_global = 0.75 * d * tw ** 3 + else: + Imin_global = (1.5 * (d **3 )* tw ** 3) / (c ** 2) + + Is_required_firststiff = max(I1_min, Imin_global) + Is_required_secondstiff = max(I2_min, Imin_global) + Is_provided = (self.eff_width_longitudnal * (self.LongStiffThickness ** 3)) / 12 + + # print("Req", Is_required, "Prov", Is_provided) + + if second_stiffener is False : + if Is_required_firststiff > Is_provided: + return True + else: + return False + else: + + if Is_required_firststiff > Is_provided and Is_required_secondstiff > Is_provided: + return True + else: + return False #PSO HELPER FUNCTIONS + ##### NEW PSO ##### + + + # def initialize(self, design_dictionary): # 1. Generate the “empirical” first particle def generate_first_particle(self,L, M, fy,is_thick_web, is_symmetric,k=67): - D_empirical = L * 1000 / 25 # span in mm + D_empirical = L / 25 # span in mm d_opt = ((M * k) / fy) ** (1/3) # mm D_final = max(D_empirical, d_opt) @@ -2303,14 +2830,19 @@ def generate_first_particle(self,L, M, fy,is_thick_web, is_symmetric,k=67): bf_bot = 0.3 * D_final bf = 0.3 * D_final - - tf_top = bf / 24 - tf_bot = bf / 24 - tf = bf / 24 + e = math.sqrt(250 / fy) + tf_top = max(bf_top / 24 , bf_top / 8.4 * e ) + tf_bot = max(bf_bot / 24 , bf_bot / 8.4 * e) + tf = max(bf / 24, bf_bot / 8.4 * e) d = D_final - 2 * tf - tw = d / 200 + if is_thick_web: + tw = max(d / 200, d /( 84 * e ), 8) + else: + tw = max( d / 200, d / ( 105 * e ), 8) + + c = 200 # min panel length (if used) t_stiff = 6 # min stiffener thickness (if used) # Order must match your variable list below @@ -2379,9 +2911,437 @@ def assign_particle_to_section(self,particle, variable_list, section): self.top_flange_width = section.bf_top self.bottom_flange_width = section.bf_bot self.total_depth = section.D + self.eff_depth = section.D - section.tf_top - section.tf_bot + self.IntStiffnerwidth = min(self.top_flange_width,self.bottom_flange_width) - self.web_thickness/2 - 10 + self.end_stiffwidth = self.IntStiffnerwidth self.c = section.c self.IntStiffThickness = section.t_stiff + + + # def optimized_method_newmod(self, design_dictionary, is_thick_web, is_symmetric): + + + # # 1. Setup variables + # variable_list = self.build_variable_structure(self,is_thick_web, is_symmetric) + # lb, ub = self.get_bounds(self,variable_list) + # dimensions = len(variable_list) + + # # 2. Generate first particle + # first_particle = self.generate_first_particle(self,self.length, self.load.moment, self.material.fy, is_thick_web, is_symmetric) + # print("###########FIRST PARTICLE -" ,first_particle) + # first_particle = np.clip(first_particle, lb, ub) + + # # 3. PSO config + # n_particles = 50 + # optimizer = GlobalBestPSO( + # n_particles=n_particles, + # dimensions=dimensions, + # options={'c1': 1.2, 'c2': 1.2, 'w': 0.6}, + # bounds=(lb, ub) + # ) + + # # 4. Overwrite the first particle + # optimizer.swarm.position[0] = first_particle + # optimizer.swarm.velocity[0] = np.zeros(dimensions) + # optimizer.swarm.current_cost = self.evaluate_particle_cost(self,first_particle, variable_list, design_dictionary, is_symmetric, is_thick_web) + + # # 5. Run PSO + # best_cost, best_pos = optimizer.optimize( + # lambda swarm: self.evaluate_swarm(self,swarm, variable_list, design_dictionary, is_symmetric, is_thick_web), + # iters=100, + # verbose=True + # ) + + # logger.info("PSO calculation successfully completed") + # print("Best cost:", best_cost) + # best_design_var = dict(zip(variable_list, best_pos)) + # print("Best design variables:", best_design_var) + # def ceil_to_nearest(x, multiple): + # return float(math.ceil(x / multiple) * multiple) + # if is_symmetric: + # self.bottom_flange_thickness = self.top_flange_thickness = float(best_design_var['tf']) + # for i in self.bottom_flange_thickness_list: + # if float(i) > self.bottom_flange_thickness: + # self.bottom_flange_thickness = float(i) + # self.top_flange_thickness = float(i) + # break + # self.web_thickness = float(best_design_var['tw']) + # for i in self.web_thickness_list: + # if float(i) > self.web_thickness: + # self.web_thickness = float(i) + # break + + # self.top_flange_width = self.bottom_flange_width = round(float(best_design_var['bf']),0) + # self.top_flange_width = self.bottom_flange_width = ceil_to_nearest(self.top_flange_width,25) + # self.total_depth = round(float(best_design_var['D']),0) + # self.total_depth = ceil_to_nearest(self.total_depth,25) + + + # # self.IntStiffThickness = float(best_design_var['']) + # # for i in self.int_thickness_list: + # # if float(i) > se + # else: + # self.bottom_flange_thickness = float(best_design_var['tf_bot']) + # for i in self.bottom_flange_thickness_list: + # if float(i) > self.bottom_flange_thickness: + # self.bottom_flange_thickness = float(i) + # break + # self.top_flange_thickness = float(best_design_var['tf_top']) + # for i in self.top_flange_thickness_list: + # if float(i) > self.top_flange_thickness: + # self.top_flange_thickness = float(i) + # break + # self.web_thickness = float(best_design_var['tw']) + # for i in self.web_thickness_list: + # if float(i) > self.web_thickness: + # self.web_thickness = float(i) + # break + + # self.bottom_flange_width = round(float(best_design_var['bf_bot']),0) + # self.bottom_flange_width = ceil_to_nearest(self.bottom_flange_width,25) + # self.top_flange_width = round(float(best_design_var['bf_top']),0) + # self.top_flange_width = ceil_to_nearest(self.top_flange_width,25) + # self.total_depth = round(float(best_design_var['D']),0) + # self.total_depth = ceil_to_nearest(self.total_depth,25) + + + # if not is_thick_web: + # self.IntStiffThickness = float(best_design_var['t_stiff']) + # for i in self.int_thickness_list: + # if float(i) > self.IntStiffThickness: + # self.IntStiffThickness = float(i) + # break + + # self.c = round(float(best_design_var['c']),0) + # self.c = ceil_to_nearest(self.c,25) + + + # logger.info(f"Optimized values : Flange width top and bottom {self.top_flange_width} {self.bottom_flange_width} flange thickness top and bottom {self.top_flange_thickness} { self.bottom_flange_thickness} web_thickness {self.web_thickness} total depth { self.total_depth} C value {self.c} thickness stiffener { self.IntStiffThickness}") + + # # 6. Assign best result + # best_section = Section() + # self.assign_particle_to_section(self,best_pos, variable_list, best_section) + # # self.set_input_values(design_dictionary) + # self.design_check(self,design_dictionary) + # def evaluate_particle_cost(self, particle, variable_list, design_dictionary, is_symmetric, is_thick_web): + # section = Section() + # self.assign_particle_to_section(self,particle, variable_list, section) + # if is_symmetric: + # if is_thick_web: + # weight = (2 * section.bf * section.tf) + (section.tw * (section.D - 2*section.tf)) * self.length * 7850 + # else: + # weight = (2 * section.bf * section.tf) + (section.tw * (section.D - 2*section.tf)) * self.length * 7850 + ((self.length / section.c) - 1) * section.t_stiff * self.IntStiffnerwidth * self.eff_depth *7850 + # else: + # if is_thick_web: + + # weight = ((section.bf_top * section.tf_top) + (section.bf_bot * section.tf_bot) + (section.tw * (section.D - section.tf_top - section.tf_bot)) ) * self.length * 7850 + # else: + # weight = ((section.bf_top * section.tf_top) + (section.bf_bot * section.tf_bot) + (section.tw * (section.D - section.tf_top - section.tf_bot)) ) * self.length * 7850 + ((self.length / section.c) - 1) * section.t_stiff * self.IntStiffnerwidth * self.eff_depth *7850 + + + + # # placeholder penalty + # penalty = 0 + # maxiratio, slendercheck, thicknesscheck = self.design_check_optimized_version(self,design_dictionary) + + # if slendercheck == False: + # penalty += 1e10 + # if thicknesscheck == False: + # penalty += 1e10 + # penalty += abs(1-maxiratio) * 1e6 + + # return weight + penalty + + # def evaluate_swarm(self, swarm, variable_list, design_dictionary, is_symmetric, is_thick_web): + # return np.array([ + # self.evaluate_particle_cost(self,p, variable_list, design_dictionary, is_symmetric, is_thick_web) + # for p in swarm + # ]) + + + #### NEW PSO ### + + def evaluate_particle_cost(self, particle, variable_list, design_dictionary, is_symmetric, is_thick_web): + sec = Section() + self.assign_particle_to_section(self,particle, variable_list, sec) + self.design_check(design_dictionary) + max_ratio, slender_ok, thickness_ok = self.design_check_optimized_version(self,design_dictionary) + + area = ((self.top_flange_thickness * self.top_flange_width) + + (self.bottom_flange_thickness * self.bottom_flange_width) + + (self.web_thickness * (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness))) + volume = area * self.length # mm³ + mass = volume * 7.85e-6 # kg + P = 1e6 # penalty coefficient (tune as needed) + penalty = 0.0 + + # Shear capacity (shear_ratio > 1.0 means failure) + if self.shear_ratio > 1.0: + penalty += (self.shear_ratio - 1.0) + + # Moment capacity (moment_ratio > 1.0 means failure) + if self.moment_ratio > 1.0: + penalty += (self.moment_ratio - 1.0) + + # Web buckling & crippling (shearchecks==False means any web failure) + if not self.shearchecks: + penalty += 1.0 + + # Deflection serviceability + if not self.defl_check: + penalty += 1.0 + + # (Optional) any other flags: e.g. slenderness or plate-thickness, + # but those are already implicit in design_check for PSO—no need to repeat. + + # 5) Return penalized objective + return mass + P * penalty + + + def optimized_method(self, design_dictionary, is_thick_web, is_symmetric): + + + variable_list = self.build_variable_structure(self,is_thick_web, is_symmetric) + lb, ub = self.get_bounds(self,variable_list) + lb = np.array(lb) + ub = np.array(ub) + + # 1) Compute normalized bounds [0…1] + lb_norm = np.zeros_like(lb) + ub_norm = np.ones_like(ub) + + # 2) Denormalize helper: map u∈[0,1]^n → x∈[lb,ub] + def denormalize(u): + return lb + u * (ub - lb) + + # 3) Wrap your existing constraint to accept u + def cons_norm(u): + x = denormalize(u) + return constraint(x) # calls your original constraint + + # 4) Wrap your existing obj_fn_single to accept u + def obj_norm(u): + x = denormalize(u) + return obj_fn_single(x) + + # 5) Generate & normalize your initial swarm + init_real = self.generate_first_particle( + self, self.length, self.load.moment, self.material.fy, + is_thick_web, is_symmetric + ) + init_norm = (init_real - lb) / (ub - lb) + + # ───────────── END ADD ───────────── + + + def constraint(particle): + sec = Section() + self.assign_particle_to_section(self,particle, variable_list, sec) + + # 2) Rebuild design inputs so checks use this particle’s geometry + design = dict(design_dictionary) + for var in variable_list: + design[var] = getattr(sec, var) + + # 3) Run your optimized capacity/deflection/slenderness check + max_ratio, slender_ok, thickness_ok = self.design_check_optimized_version(self,design) + + # 4) Grab the other ratios set as attributes + + μ_shear = getattr(self, 'shear_ratio', float('inf')) + μ_moment = getattr(self, 'moment_ratio', float('inf')) + μ_defl = getattr(self, 'deflection_ratio', float('inf')) + + # 5) Compute ε = sqrt(E/Fy) for IS800:2007 + E, Fy = self.material.modulus_of_elasticity, self.material.fy + ε = math.sqrt(E / Fy) + # 6) Extract the 4 key geometric values + depth = sec.D + + tw = sec.tw + bf_top = sec.bf_top + tf_top = sec.tf_top + bf_bot = sec.bf_bot + tf_bot = sec.tf_bot + eff_depth = sec.D - sec.tf_top - sec.tf_bot + + # 7) Compute semi-compact margins: + # flange: b_f/t_f <= 13.6·ε → (13.6 ε·t_f – b_f) ≥ 0 + # web: d/t_w <= 126·ε → (126 ε·t_w – d) ≥ 0 + + m_web = (126.0 * ε) * tw - depth + m_fl_top = max((13.6 * ε) * tf_top - bf_top, 3 * m_web) + m_fl_bot = max((13.6 * ε) * tf_bot - bf_bot, 3 * m_web) + + # 8) Build a fixed-length list of margins (negative = violate) + margins = [ + 1.0 - max_ratio, # moment capacity + m_fl_top, # top-flange slenderness + m_fl_bot, # bot-flange slenderness + m_web, # web slenderness + (1.0 if thickness_ok else -1.0), # plate thickness limits + 1.0 - μ_shear, # shear ratio + 1.0 - μ_moment, # moment ratio + 1.0 - μ_defl # deflection ratio + ] + + # (Optional) debug print to see which constraint is worst + worst = min(range(len(margins)), key=lambda i: margins[i]) + print(f" constraint: worst margin #{worst} = {margins[worst]:.3f}") + + return margins + + def obj_fn(x): + results = [] + for particle in x: + sec = Section() + self.assign_particle_to_section(self,particle, variable_list, sec) + area = ((self.top_flange_thickness * self.top_flange_width) + + (self.bottom_flange_thickness * self.bottom_flange_width) + + (self.web_thickness * (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness))) + volume = area * self.length # mm³ + mass = volume * 7.85e-6 # kg + results.append(mass) + return np.array(results) + + # def obj_fn_single(x): + # sec = Section() + # self.assign_particle_to_section(self,x, variable_list, sec) + # area = ((self.top_flange_thickness * self.top_flange_width) + + # (self.bottom_flange_thickness * self.bottom_flange_width) + + # (self.web_thickness * (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness))) + # volume = area * self.length # mm³ + # mass = volume * 7.85e-6 # kg + # + # if self.c is None or self.t_stiff is None: + # mass_stiff = 0 + # else: + # # Number of stiffeners = length/c minus one at each end + # n_stiff = max(self.length / sec.c - 1, 0) + # # Volume of all stiffeners (mm³): thickness × width × effective depth × count + # vol_stiff = n_stiff * 2 * (min(self.top_flange_width,self.bottom_flange_width) - self.web_thickness/2 - 10) * self.t_stiff * (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness) + # mass_stiff = vol_stiff * 7.85e-6 + # mass += mass_stiff + # + # return mass + def obj_fn_single(x): + sec = Section() + self.assign_particle_to_section(self,x, variable_list, sec) + area = (sec.bf_top * sec.tf_top + + sec.bf_bot * sec.tf_bot + + sec.tw * (sec.D - sec.tf_top - sec.tf_bot)) + + volume = area * self.length # mm³ + mass = volume * 7.85e-6 # kg + + if sec.c is None or sec.t_stiff is None: + mass_stiff = 0.0 + else: + # how many stiffeners fit (minus one at each end) + n_stiff = max(self.length / sec.c - 1, 0) + + # approximate stiffener cross-section: + # 2 stiffeners per bay, width as the smaller flange minus half the web minus 10 mm clearance, + # height as the clear web depth + width_stiff = min(sec.bf_top, sec.bf_bot) - sec.tw / 2 - 10 + height_stiff = sec.D - sec.tf_top - sec.tf_bot + + vol_stiff = n_stiff * 2 * width_stiff * sec.t_stiff * height_stiff # mm³ + mass_stiff = vol_stiff * 7.85e-6 # kg + + # 4) Return total + return mass + mass_stiff + + best_u, best_cost = pso( + obj_norm, + lb_norm, ub_norm, + f_ieqcons=cons_norm, + swarmsize=20, # keep your original settings + maxiter=80, + debug=True, + # init_pos=init_norm + ) + # Denormalize the PSO result back to real units: + best_pos = denormalize(best_u) + #best_pos, best_cost = pso(obj_fn_single, lb, ub, f_ieqcons=constraint, swarmsize=100, maxiter=500, debug=True, init_pos=self.generate_first_particle(self,self.length, self.load.moment, self.material.fy, is_thick_web, is_symmetric)) + margins = constraint(best_pos) + best_section = Section() + self.assign_particle_to_section(self,best_pos, variable_list, best_section) + logger.info("PSO calculation successfully completed") + print("Best cost:", best_cost) + best_design_var = dict(zip(variable_list, best_pos)) + print("Best design variables:", best_design_var) + def ceil_to_nearest(x, multiple): + return float(math.ceil(x / multiple) * multiple) + if is_symmetric: + self.bottom_flange_thickness = self.top_flange_thickness = float(best_design_var['tf']) + for i in self.bottom_flange_thickness_list: + if float(i) > self.bottom_flange_thickness: + self.bottom_flange_thickness = float(i) + self.top_flange_thickness = float(i) + break + self.web_thickness = float(best_design_var['tw']) + for i in self.web_thickness_list: + if float(i) > self.web_thickness: + self.web_thickness = float(i) + break + + self.top_flange_width = self.bottom_flange_width = round(float(best_design_var['bf']),0) + self.top_flange_width = self.bottom_flange_width = ceil_to_nearest(self.top_flange_width,10) + self.total_depth = round(float(best_design_var['D']),0) + self.total_depth = ceil_to_nearest(self.total_depth,25) + + + # self.IntStiffThickness = float(best_design_var['']) + # for i in self.int_thickness_list: + # if float(i) > se + else: + self.bottom_flange_thickness = float(best_design_var['tf_bot']) + for i in self.bottom_flange_thickness_list: + if float(i) > self.bottom_flange_thickness: + self.bottom_flange_thickness = float(i) + break + self.top_flange_thickness = float(best_design_var['tf_top']) + for i in self.top_flange_thickness_list: + if float(i) > self.top_flange_thickness: + self.top_flange_thickness = float(i) + break + self.web_thickness = float(best_design_var['tw']) + for i in self.web_thickness_list: + if float(i) > self.web_thickness: + self.web_thickness = float(i) + break + + self.bottom_flange_width = round(float(best_design_var['bf_bot']),0) + self.bottom_flange_width = ceil_to_nearest(self.bottom_flange_width,10) + self.top_flange_width = round(float(best_design_var['bf_top']),0) + self.top_flange_width = ceil_to_nearest(self.top_flange_width,10) + self.total_depth = round(float(best_design_var['D']),0) + self.total_depth = ceil_to_nearest(self.total_depth,25) + + + if not is_thick_web: + self.IntStiffThickness = float(best_design_var['t_stiff']) + for i in self.int_thickness_list: + if float(i) > self.IntStiffThickness: + self.IntStiffThickness = float(i) + break + + self.c = round(float(best_design_var['c']),0) + self.c = ceil_to_nearest(self.c,10) + + # logger.info("NEW PSO RUNNING") + logger.info(f"Optimized values : Flange width top and bottom {self.top_flange_width} {self.bottom_flange_width} flange thickness top and bottom {self.top_flange_thickness} { self.bottom_flange_thickness} web_thickness {self.web_thickness} total depth { self.total_depth} C value {self.c} thickness stiffener { self.IntStiffThickness}") + self.design_check(self,design_dictionary) + # self.final_format(self,design_dictionary) + self.design_status = True + + + + + + # 5. Objective function def objective_function(self,x, variable_list,design_dictionary,is_symmetric,is_thick_web): """ @@ -2418,8 +3378,13 @@ def run_design_checks(self,section,design_dictionary,is_symmetric,is_thick_web): # placeholder penalty penalty = 0 + maxiratio, slendercheck, thicknesscheck = self.design_check_optimized_version(self,design_dictionary) - penalty = abs(100 - (self.design_check_optimized_version(self,design_dictionary) * 100)) * 1e6 + if slendercheck == False: + penalty += 1e10 + if thicknesscheck == False: + penalty += 1e10 + penalty += abs(1-maxiratio) * 1e6 return weight + penalty @@ -2434,6 +3399,7 @@ def design_check(self,design_dictionary): self.shearchecks = False self.momentchecks = False self.defl_check = False + self.long_check = False self.design_flag = self.section_classification(self, design_dictionary) if self.design_flag == False: logger.error("slender section not allowed") @@ -2466,7 +3432,7 @@ def design_check(self,design_dictionary): #web crippling check if self.web_crippling_laterally_supported_thick_web(self,self.material.fy,self.gamma_m0,self.web_thickness,self.top_flange_thickness,self.b1): - self.shearflag3 = False + self.shearflag3 = True logger.info("Web Crippling Check passed") else: self.shearflag3 = False @@ -2492,31 +3458,43 @@ def design_check(self,design_dictionary): #moment check unspp if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): + print("M", self.Md) self.momentchecks = True logger.info("Moment Check passed") else: self.momentchecks = False + print("M", self.Md) logger.error("Moment Check failed") else: logger.error("Increase the web thickness") else: #thin web condition - stiffener_type = None + self.shear_ratio= 0 if self.long_Stiffner == 'Yes and 1 stiffener': - stiffener_type == "transverse_and_one_longitudinal_compression" + self.stiffener_type = "transverse_and_one_longitudinal_compression" elif self.long_Stiffner == 'Yes and 2 stiffeners': - stiffener_type == "transverse_and_two_longitudinal_neutral" + self.stiffener_type = "transverse_and_two_longitudinal_neutral" else: - stiffener_type == "transverse_only" - + self.stiffener_type = "transverse_only" + if self.stiffener_type != "transverse_only": + second_stiffener = False + if self.stiffener_type == "transverse_and_two_longitudinal_neutral": + second_stiffener = True + if self.design_longitudinal_stiffeners(self, self.eff_depth, self.web_thickness, self.c,self.epsilon, second_stiffener): + logger.info("Longitudinal Stiffener Check passed") + else: + logger.error("Longitudinal Stiffener Check failed") + if self.c == 'NA': logger.error("c value not provided") self.c = 0 else: self.c = float(self.c) print("c value",self.c) - self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,stiffener_type,self.c) + self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,self.stiffener_type,self.c) if self.design_flag2 == True: + self.x= design_dictionary[KEY_ShearBucklingOption] + print("shear buckling option",self.x) if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #shear check @@ -2524,15 +3502,23 @@ def design_check(self,design_dictionary): self.shearflag1 = True logger.info("Shear Check passed") else: - self.shearflag1 = False - logger.error("Shear Check failed") + logger.info("Shear Check Failed, add end stiffeners") + if self.end_panel_stiffener_calc(self, self.top_flange_width, self.bottom_flange_width, + self.web_thickness, self.end_stiffthickness, + self.material.fy, self.gamma_m0, self.eff_depth, + self.top_flange_thickness, self.total_depth, + self.effective_length, self.bottom_flange_thickness, + self.material.modulus_of_elasticity, self.epsilon, self.c): + logger.info("End Panel Stiffener Check passed") + else: + logger.error("End Panel Stiffener Check failed") - if self.shear_buckling_check_intermediate_stiffener(self,self.eff_depth,self.web_thickness,self.c,self.epsilon,self.IntStiffThickness,self.IntStiffnerwidth,self.V_cr,self.load.shear_force,self.gamma_m0,self.material.fy,self.material.modulus_of_elasticity): + if self.shear_buckling_check_intermediate_stiffener(self,self.eff_depth,self.web_thickness,self.c,self.epsilon,self.IntStiffThickness,self.IntStiffnerwidth,self.load.shear_force,self.gamma_m0,self.material.fy,self.material.modulus_of_elasticity): self.shearflag2 = True - logger.info("Shear Buckling Check passed") + logger.info("Shear Buckling Check passed with intermediate stiffeners") else: self.shearflag2 = False - logger.error("Shear Buckling Check failed") + logger.error("Shear Buckling Check failed with intermediate stiffeners, increase stiffener thickness") else: #tension field @@ -2540,16 +3526,24 @@ def design_check(self,design_dictionary): self.shearflag1 = True logger.info("Shear Buckling Check passed") else: - self.shearflag1 = False - logger.error("Shear Buckling Check failed") - if self.tension_field_end_stiffener(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + logger.error("Shear Buckling Check failed, provide end panel stiffeners") + if self.tension_field_end_stiffener(self, self.eff_depth, self.web_thickness, self.material.fy, + self.load.shear_force, self.load.moment, + self.c): + self.shearflag1 = True + logger.info("Tension Field Check passed with stiffeners") + else: + self.shearflag1 = False + logger.error("Tension Field Check failed, increase stiffener thickness") + + if self.tension_field_intermediate_stiffener(self,self.eff_depth, self.web_thickness, self.c, self.epsilon, self.IntStiffThickness, self.IntStiffnerwidth, self.load.shear_force, self.gamma_m0, self.material.fy, self.material.modulus_of_elasticity): self.shearflag2 = True - logger.info("Tension Field Check passed") + logger.info("Shear Buckling Check passed with intermediate stiffeners") else: self.shearflag2 = False - logger.error("Tension Field Check failed") - + logger.error("Shear Buckling Check failed, increase stiffener thickness") + if self.shearflag1 == True and self.shearflag2 == True: self.shearchecks = True else: @@ -2559,34 +3553,34 @@ def design_check(self,design_dictionary): if self.support_type == 'Major Laterally Supported': #moment check supp if self.moment_capacity_laterally_supported(self,self.load.shear_force,self.plast_sec_mod_z,self.elast_sec_mod_z,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.section_class): - self.moment_checks = True + self.momentchecks = True logger.info("Moment Check passed") else: - self.moment_checks = False + self.momentchecks = False logger.error("Moment Check failed") else: #unsupp #moment check unspp if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): - self.moment_checks = True + self.momentchecks = True logger.info("Moment Check passed") else: - self.moment_checks = False + self.momentchecks = False logger.error("Moment Check failed") - - - - - else: - logger.error("Increase the web thickness") + #end panel stiffener checks + # if self.end_panel_stiffener_calc(self, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.intstiffener_thk, self.material.fy, self.gamma_m0, self.eff_depth, self.top_flange_thickness, self.total_depth, self.effective_length, self.bottom_flange_thickness, self.material.modulus_of_elasticity, self.epsilon): + # if self.end_panel_stiffener_calc(self, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.end_stiffthickness, self.material.fy, self.gamma_m0, self.eff_depth, self.top_flange_thickness, self.total_depth, self.effective_length, self.bottom_flange_thickness, self.material.modulus_of_elasticity, self.epsilon, self.c): + # logger.info("End Panel Stiffener Check passed") + # else: + # logger.error("End Panel Stiffener Check failed") #deflection checks - if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case): + if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case, self.deflection_criteria): self.defl_check = True logger.info("Deflection Check passed") else: @@ -2609,7 +3603,9 @@ def design_check_optimized_version(self,design_dictionary): self.shearchecks = False self.momentchecks = False self.defl_check = False + self.long_check = False self.design_flag = self.section_classification(self, design_dictionary) + #print('DEISGN FLAG',self.design_flag) if self.design_flag == False: pass # logger.error("slender section not allowed") @@ -2618,6 +3614,7 @@ def design_check_optimized_version(self,design_dictionary): self.beta_value(self, design_dictionary,self.section_class) if self.web_philosophy == 'Thick Web without ITS': + print('THICK WEB') self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,"no_stiffener",0) if self.design_flag2 == True: @@ -2678,35 +3675,60 @@ def design_check_optimized_version(self,design_dictionary): pass else: #thin web condition - stiffener_type = None + self.shear_ratio = 0 if self.long_Stiffner == 'Yes and 1 stiffener': - stiffener_type == "transverse_and_one_longitudinal_compression" + self.stiffener_type = "transverse_and_one_longitudinal_compression" elif self.long_Stiffner == 'Yes and 2 stiffeners': - stiffener_type == "transverse_and_two_longitudinal_neutral" + self.stiffener_type = "transverse_and_two_longitudinal_neutral" else: - stiffener_type == "transverse_only" + self.stiffener_type = "transverse_only" + if self.stiffener_type != "transverse_only": + second_stiffener = False + if self.stiffener_type == "transverse_and_two_longitudinal_neutral": + second_stiffener = True + if self.design_longitudinal_stiffeners(self, self.eff_depth, self.web_thickness, self.c, + self.epsilon, second_stiffener): + #logger.info("Longitudinal Stiffener Check passed") + self.long_check = True + else: + #logger.error("Longitudinal Stiffener Check failed") + self.long_check = False if self.c == 'NA': # logger.error("c value not provided") self.c = 0 else: self.c = float(self.c) - self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,stiffener_type,self.c) + self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,self.stiffener_type,self.c) + print('DESIGN FLAG2',self.design_flag2) if self.design_flag2 == True: if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #shear check if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.web_thickness,self.load.shear_force,self.c): self.shearflag1 = True + # logger.info("Shear Check passed") else: - self.shearflag1 = False - # logger.error("Shear Check failed") + + if self.end_panel_stiffener_calc(self, self.top_flange_width, self.bottom_flange_width, + self.web_thickness, self.end_stiffthickness, + self.material.fy, self.gamma_m0, self.eff_depth, + self.top_flange_thickness, self.total_depth, + self.effective_length, self.bottom_flange_thickness, + self.material.modulus_of_elasticity, self.epsilon, self.c): + self.shearflag1 = True + else: + + self.shearflag1 = False + # logger.error("End Panel Stiffener Check failed") - if self.shear_buckling_check_intermediate_stiffener(self,self.eff_depth,self.web_thickness,self.c,self.epsilon,self.IntStiffThickness,self.IntStiffnerwidth,self.V_cr,self.load.shear_force,self.gamma_m0,self.material.fy,self.material.modulus_of_elasticity): + if self.shear_buckling_check_intermediate_stiffener(self,self.eff_depth,self.web_thickness,self.c,self.epsilon,self.IntStiffThickness,self.IntStiffnerwidth,self.load.shear_force,self.gamma_m0,self.material.fy,self.material.modulus_of_elasticity): self.shearflag2 = True - # logger.info("Shear Buckling Check passed") + + # logger.info("Shear Buckling Check passed"). else: + self.shearflag2 = False # logger.error("Shear Buckling Check failed") @@ -2716,39 +3738,49 @@ def design_check_optimized_version(self,design_dictionary): self.shearflag1 = True # logger.info("Shear Buckling Check passed") else: - self.shearflag1 = False - # logger.error("Shear Buckling Check failed") - - if self.tension_field_end_stiffener(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): + if self.tension_field_end_stiffener(self, self.eff_depth, self.web_thickness, self.material.fy, + self.load.shear_force, self.load.moment, + self.c): + self.shearflag1 = True + else: + self.shearflag1 = False + # logger.error("Tension Field Check failed, increase stiffener thickness") + if self.tension_field_intermediate_stiffener(self, self.eff_depth, self.web_thickness, self.c, + self.epsilon, self.IntStiffThickness, + self.IntStiffnerwidth, self.load.shear_force, + self.gamma_m0, self.material.fy, + self.material.modulus_of_elasticity): self.shearflag2 = True - # logger.info("Tension Field Check passed") else: self.shearflag2 = False - # logger.error("Tension Field Check failed") - + if self.shearflag1 == True and self.shearflag2 == True: self.shearchecks = True else: self.shearchecks = False - + # support type supp or unsupp if self.support_type == 'Major Laterally Supported': #moment check supp if self.moment_capacity_laterally_supported(self,self.load.shear_force,self.plast_sec_mod_z,self.elast_sec_mod_z,self.material.fy,self.gamma_m0,self.total_depth,self.web_thickness,self.top_flange_thickness,self.bottom_flange_thickness,self.section_class): - self.moment_checks = True + self.momentchecks = True + # logger.info("Moment Check passed") else: - self.moment_checks = False + self.momentchecks = False + # logger.error("Moment Check failed") else: #unsupp #moment check unspp if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): - self.moment_checks = True + self.momentchecks = True + # logger.info("Moment Check passed") else: - self.moment_checks = False + self.momentchecks = False + # logger.error("Moment Check failed") @@ -2759,26 +3791,24 @@ def design_check_optimized_version(self,design_dictionary): # logger.error("Increase the web thickness") pass - #deflection checks - if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case): + if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case, self.deflection_criteria): self.defl_check = True # logger.info("Deflection Check passed") else: self.defl_check = False - # logger.error("Deflection Check failed") + # logger.error("Deflection Check failed")d #in pso check for self.moment_checks and self.shearchecks #for customized print(f"RATIOS moment {self.moment_ratio} shear {self.shear_ratio} deflection {self.deflection_ratio}") - return max(self.moment_ratio,self.shear_ratio,self.deflection_ratio) - + return max(self.moment_ratio,self.shear_ratio,self.deflection_ratio),self.design_flag,self.design_flag2 - def optimized_method(self,design_dictionary,is_thick_web, is_symmetric): + def optimized_method_working(self,design_dictionary,is_thick_web, is_symmetric): # is_thick_web = False # is_symmetric = False # if self.web_philosophy == 'Thick Web without ITS': @@ -2797,13 +3827,16 @@ def optimized_method(self,design_dictionary,is_thick_web, is_symmetric): options={'c1': 1.5, 'c2': 1.5, 'w': 0.4}, bounds=(lb, ub) ) + fp = self.generate_first_particle(self,float(self.length) * 1000, float(self.load.moment), float(self.material.fy),is_thick_web,is_symmetric) optimizer.swarm.position[0] = np.clip(fp, lb, ub) + best_cost, best_pos = optimizer.optimize( objective_func=lambda swarm: self.objective_function(self,swarm, variable_list,design_dictionary,is_symmetric,is_thick_web), iters=100 ) + logger.info("PSO calculation successfully completed") print("Best cost:", best_cost) best_design_var = dict(zip(variable_list, best_pos)) @@ -2866,7 +3899,7 @@ def ceil_to_nearest(x, multiple): self.c = round(float(best_design_var['c']),0) self.c = ceil_to_nearest(self.c,25) - + print('vdfgbdfhb') logger.info(f"Optimized values : Flange width top and bottom {self.top_flange_width} {self.bottom_flange_width} flange thickness top and bottom {self.top_flange_thickness} { self.bottom_flange_thickness} web_thickness {self.web_thickness} total depth { self.total_depth} C value {self.c} thickness stiffener { self.IntStiffThickness}") @@ -2874,7 +3907,7 @@ def ceil_to_nearest(x, multiple): - # logger.info(f"Web Thickness: {self.web_thickness}, Flange Thickness Top: {self.top_flange_thickness}, Flange Width Top: {self.top_flange_width}, Total Depth: {self.total_depth}") + # # logger.info(f"Web Thickness: {self.web_thickness}, Flange Thickness Top: {self.top_flange_thickness}, Flange Width Top: {self.top_flange_width}, Total Depth: {self.total_depth}") @@ -2892,8 +3925,15 @@ def final_format(self,design_dictionary): self.moment_ratio = 0 if self.shear_ratio == None: self.shear_ratio = 0 + # if self.deflection_ratio == None: + # self.deflection_ratio = 0 + # if self.web_buckling_ratio == None: + # self.web_buckling_ratio = 0 + # if self.web_crippling_ratio == None: + # self.web_crippling_ratio = 0 + print("RATIOS",'moment ratio', self.moment_ratio, 'shear ratio', self.shear_ratio, 'deflection ratio', self.deflection_ratio) print(self.moment_ratio, self.shear_ratio) - self.result_UR = max(self.moment_ratio,self.shear_ratio) * 100 + self.result_UR = max(self.moment_ratio,self.shear_ratio, self.deflection_ratio) self.section_classification_val = self.section_class if self.beta_b_lt == None: self.beta_b_lt = 0 @@ -2906,19 +3946,39 @@ def final_format(self,design_dictionary): self.M_cr = 0 if self.V_cr == None: self.V_cr = 0 + if self.It == None: + self.It = 0 + if self.Iw == None: + self.Iw = 0 + if self.shear_type == 'Low': self.design_moment = round(self.Md/1000000,1) else: self.design_moment = round(self.Md/1000000,1) if self.support_type == 'Major Laterally Unsupported': - self.critical_moment = round(self.M_cr/1000000,1) - self.torsion_cnst = round(self.It/10000,0) - self.warping_cnst = round(self.Iw/1000000,0) + self.critical_moment = round(self.M_cr/1000000,1) + self.torsion_cnst = round(self.It/10000,1) + self.warping_cnst = round(self.Iw/1000000,1) self.intstiffener_thk = self.IntStiffThickness self.longstiffener_thk = self.LongStiffThickness + self.longstiffener_no = 0 + if self.long_Stiffner == 'Yes and 1 stiffener': + self.longstiffener_no = 1 + elif self.long_Stiffner == 'Yes and 2 stiffeners': + self.longstiffener_no = 2 self.intstiffener_spacing = self.c + self.end_panel_stiffener_thickness = self.end_stiffthickness + self.atop= 0 + self.abot= 0 + self.weld_stiff= None + self.atop, self.abot= self.design_welds_with_strength_web_to_flange(self, self.load.shear_force, self.top_flange_width, self.top_flange_thickness, self.bottom_flange_width, self.bottom_flange_thickness, self.web_thickness, self.eff_depth, [self.material.fu]) + self.weld_stiff = self.weld_for_end_stiffener(self, self.end_stiffthickness, self.end_stiffwidth, self.load.shear_force, self.V_d, self.total_depth, self.top_flange_thickness, self.bottom_flange_thickness, self.web_thickness, [self.material.fu]) self.design_status = True + def save_design(self, popup_summary): + print("\n\n\n\n Enterend save design") + logger.info(" :=========Start Of design Saving Button pressed===========") + class Section: def __init__(self): self.tf = self.tw = self.bf = self.D = self.tf_top = self.tf_bot = self.bf_top = self.bf_bot = self.c = self.t_stiff = None @@ -2926,3 +3986,101 @@ def __init__(self): #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + +def pso(func, lb, ub, ieqcons=[], f_ieqcons=None, args=(), kwargs={}, + swarmsize=600, omega=0.5, phip=0.5, phig=0.5, maxiter=1000, + minstep=1e-8, minfunc=1e-8, debug=False): + assert len(lb) == len(ub) + lb = np.array(lb) + ub = np.array(ub) + vhigh = np.abs(ub - lb) + vlow = -vhigh + + obj = lambda x: func(x, *args, **kwargs) + if f_ieqcons is None: + cons = (lambda x: np.array([0])) if not len(ieqcons) \ + else (lambda x: np.array([y(x, *args, **kwargs) for y in ieqcons])) + else: + cons = lambda x: np.array(f_ieqcons(x, *args, **kwargs)) + + def is_feasible(x, eps=1e-12): + cons_val = cons(x) + print(f'Constraint values: {cons_val}') + return np.all(cons_val >= -eps) # strictly >=0; small epsilon for numeric tolerance + + # Helper: generate a feasible position + def random_feasible_point(): + for _ in range(10000): + candidate = lb + np.random.rand(len(lb)) * (ub - lb) + if is_feasible(candidate): + return candidate + raise RuntimeError("Cannot find feasible initial particle!") + + # Initialize + S, D = swarmsize, len(lb) + x = np.zeros((S, D)) + v = np.zeros_like(x) + p = np.zeros_like(x) + fp = np.full(S, np.inf) + g = None + fg = np.inf + + # Feasible initialization + for i in range(S): + x[i, :] = random_feasible_point() + p[i, :] = x[i, :].copy() + fp[i] = obj(p[i, :]) + if i == 0 or (fp[i] < fg and is_feasible(p[i, :])): + g = p[i, :].copy() + fg = fp[i] + v[i, :] = vlow + np.random.rand(D) * (vhigh - vlow) + + # Main loop + it = 1 + while it <= maxiter: + rp = np.random.uniform(size=(S, D)) + rg = np.random.uniform(size=(S, D)) + for i in range(S): + v[i, :] = omega * v[i, :] + phip * rp[i, :] * (p[i, :] - x[i, :]) + phig * rg[i, :] * (g - x[i, :]) + x[i, :] = x[i, :] + v[i, :] + + # Project to bounds + x[i, :] = np.clip(x[i, :], lb, ub) + + # Ensure feasibility + if not is_feasible(x[i, :]): + # Option 1: resample until feasible + x[i, :] = random_feasible_point() + # Option 2 (alternative): reflect or repair (optional) + + fx = obj(x[i, :]) + + # Personal best update + if is_feasible(x[i, :]) and (fx < fp[i] or not is_feasible(p[i, :])): + p[i, :] = x[i, :].copy() + fp[i] = fx + + # Global best update + if fx < fg or not is_feasible(g): + if debug: + print(f'New best for swarm at iteration {it}: {x[i, :]} {fx}') + tmp = x[i, :].copy() + stepsize = np.sqrt(np.sum((g - tmp) ** 2)) if g is not None else np.inf + if np.abs(fg - fx) <= minfunc: + print(f'Stopping search: Swarm best objective change less than {minfunc}') + return tmp, fx + elif stepsize <= minstep: + print(f'Stopping search: Swarm best position change less than {minstep}') + return tmp, fx + else: + g = tmp.copy() + fg = fx + if debug: + print(f'Best after iteration {it}: {g} {fg}') + it += 1 + + print(f'Stopping search: maximum iterations reached --> {maxiter}') + if not is_feasible(g): + print("However, the optimization couldn't find a feasible design. Sorry") + return g, fg \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder_working.py b/src/osdag/design_type/plate_girder/weldedPlateGirder_working.py deleted file mode 100644 index 45d86fbd5..000000000 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder_working.py +++ /dev/null @@ -1,4727 +0,0 @@ -""" - -@Author: Rutvik Joshi - Osdag Team, IIT Bombay [(P) rutvikjoshi63@gmail.com / 30005086@iitb.ac.in] -12.03.2025 -Revised Design for GUI: Parth Karia - Osdag Team, IIT Bombay [30006096@iitb.ac.in] - -@Module - Beam Design- Simply Supported member - - Laterally Supported Beam [Moment + Shear] - - Laterally Unsupported Beam [Moment + Shear] - - -@Reference(s): 1) IS 800: 2007, General construction in steel - Code of practice (Third revision) - 2) IS 808: 1989, Dimensions for hot rolled steel beam, column, channel, and angle sections and - it's subsequent revision(s) - 3) Design of Steel Structures by N. Subramanian (Fifth impression, 2019, Chapter 15) - 4) Limit State Design of Steel Structures by S K Duggal (second edition, Chapter 11) - -other 8) -references 9) - -""" -import logging -import math -import numpy as np -from ...Common import * -# from ..connection.moment_connection import MomentConnection -from ...utils.common.material import * -from ...utils.common.load import Load -from ...utils.common.component import ISection, Material -from ...utils.common.component import * -from ..member import Member -from ...Report_functions import * -from ...design_report.reportGenerator_latex import CreateLatex -from ...utils.common.common_calculation import * -from ..tension_member import * -from ...utils.common.Section_Properties_Calculator import BBAngle_Properties -from ...utils.common import is800_2007 -from ...utils.common.component import * -from osdag.cad.items.plate import Plate -from ...utils.common.Unsymmetrical_Section_Properties import Unsymmetrical_I_Section_Properties - - -#GUI TO SELECT CUSTOM IN DESIGN PREFERENCES -from PyQt5 import QtCore, QtWidgets -from PyQt5.QtWidgets import QDialog, QListWidget, QListWidgetItem -import re - -scale = 1 # For resizing components - -class My_ListWidget(QListWidget): - def addItems(self, Iterable, p_str=None): - super().addItems(Iterable) - self.sortItems() - - def addItem(self, *__args): - super().addItem(My_ListWidgetItem(__args[0])) - self.sortItems() - -class My_ListWidgetItem(QListWidgetItem): - def __lt__(self, other): - try: - self_text = str(re.sub("[^0-9.]", "", self.text())) - other_text = str(re.sub("[^0-9.]", "", other.text())) - return float(self_text) < float(other_text) - except Exception: - return super().__lt__(other) - -class PopupDialog(QDialog): - def __init__(self, disabled_values=[], note="", parent=None): - super().__init__(parent) - self.disabled_values = disabled_values - self.note = note - self.setWindowTitle("Customized") - self.resize(int(scale*540), int(scale*470)) - self.init_ui() - self.set_styles() - - def init_ui(self): - self.label = QtWidgets.QLabel("Available:", self) - self.label.setGeometry(QtCore.QRect(20, 20, 150, 30)) - - self.label_2 = QtWidgets.QLabel("Selected:", self) - self.label_2.setGeometry(QtCore.QRect(int(scale * 320), 20, 150, 30)) - - self.listWidget = My_ListWidget(self) - self.listWidget.setGeometry(QtCore.QRect(20, 50, int(scale*180), int(scale*300))) - self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - self.listWidget.itemDoubleClicked.connect(self.move_to_selected) - - self.listWidget_2 = My_ListWidget(self) - self.listWidget_2.setGeometry(QtCore.QRect(int(scale*320), 50, int(scale*180), int(scale*300))) - self.listWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - self.listWidget_2.itemDoubleClicked.connect(self.move_to_available) - - self.pushButton = QtWidgets.QPushButton(">>", self) - self.pushButton.setGeometry(QtCore.QRect(int(scale*225), int(scale*140), int(scale*70), int(scale*30))) - - self.pushButton_2 = QtWidgets.QPushButton(">", self) - self.pushButton_2.setGeometry(QtCore.QRect(int(scale*225), int(scale*180), int(scale*70), int(scale*30))) - - self.pushButton_3 = QtWidgets.QPushButton("<", self) - self.pushButton_3.setGeometry(QtCore.QRect(int(scale*225), int(scale*220), int(scale*70), int(scale*30))) - - self.pushButton_4 = QtWidgets.QPushButton("<<", self) - self.pushButton_4.setGeometry(QtCore.QRect(int(scale*225), int(scale*260), int(scale*70), int(scale*30))) - - self.pushButton_5 = QtWidgets.QPushButton("Submit", self) - self.pushButton_5.setGeometry(QtCore.QRect(int(scale*190), int(scale*400), int(scale*140), int(scale*35))) - self.pushButton_5.setDefault(True) - - self.pushButton.clicked.connect(self.move_all_to_selected) - self.pushButton_2.clicked.connect(self.move_selected_to_selected) - self.pushButton_3.clicked.connect(self.move_selected_to_available) - self.pushButton_4.clicked.connect(self.move_all_to_available) - self.pushButton_5.clicked.connect(self.accept) - - self.listWidget.itemSelectionChanged.connect(self.update_buttons_status) - self.listWidget_2.itemSelectionChanged.connect(self.update_buttons_status) - - self.update_buttons_status() - - def update_buttons_status(self): - self.pushButton_2.setDisabled(not bool(self.listWidget.selectedItems())) - self.pushButton_3.setDisabled(not bool(self.listWidget_2.selectedItems())) - - def move_selected_to_selected(self): - for item in self.listWidget.selectedItems(): - self.listWidget_2.addItem(item.text()) - for item in self.listWidget.selectedItems(): - self.listWidget.takeItem(self.listWidget.row(item)) - - def move_selected_to_available(self): - for item in self.listWidget_2.selectedItems(): - self.listWidget.addItem(item.text()) - for item in self.listWidget_2.selectedItems(): - self.listWidget_2.takeItem(self.listWidget_2.row(item)) - - def move_all_to_selected(self): - while self.listWidget.count() > 0: - self.listWidget_2.addItem(self.listWidget.takeItem(0).text()) - - def move_all_to_available(self): - while self.listWidget_2.count() > 0: - self.listWidget.addItem(self.listWidget_2.takeItem(0).text()) - - def move_to_selected(self, item): - self.listWidget_2.addItem(item.text()) - self.listWidget.takeItem(self.listWidget.row(item)) - - def move_to_available(self, item): - self.listWidget.addItem(item.text()) - self.listWidget_2.takeItem(self.listWidget_2.row(item)) - - def get_selected_items(self): - return [self.listWidget_2.item(i).text() for i in range(self.listWidget_2.count())] - - def set_styles(self): - brown = "#925a5b" - grey = "#8e8e8e" - white = "#ffffff" - - button_style = f""" - QPushButton {{ - background-color: {brown}; - color: {white}; - border-radius: 6px; - font-size: 22px; - padding: 6px 18px; - border: none; - }} - QPushButton:disabled {{ - background-color: {grey}; - color: {white}; - }} - """ - for btn in [self.pushButton, self.pushButton_2, self.pushButton_3, self.pushButton_4, self.pushButton_5]: - btn.setStyleSheet(button_style) - - list_item_style = """ - QListWidget::item { - font-size: 24px; - color: black; - margin: 2px 0px; - } - """ - scrollbar_style = f""" - QScrollBar:vertical {{ - border: none; - background: #f5f5f5; - width: 12px; - border-radius: 6px; - }} - QScrollBar::handle:vertical {{ - background: {grey}; - min-height: 20px; - border-radius: 6px; - }} - QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {{ - background: none; - height: 0px; - }} - QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {{ - background: none; - }} - QScrollBar:horizontal {{ - height: 0px; - }} - """ - self.listWidget.setStyleSheet(list_item_style + scrollbar_style) - self.listWidget_2.setStyleSheet(list_item_style + scrollbar_style) - - - - - - - - -class PlateGirderWelded(Member): - int_thicklist = [] - long_thicklist = [] - - def __init__(self): - super(PlateGirderWelded, self).__init__() - self.design_status = False - - - - ############################################### - # Design Preference Functions Start - ############################################### - def tab_list(self): - - """ - - :return: This function returns the list of tuples. Each tuple will create a tab in design preferences, in the - order they are appended. Format of the Tuple is: - [Tab Title, Type of Tab, function for tab content) - Tab Title : Text which is displayed as Title of Tab, - Type of Tab: There are Three types of tab layouts. - Type_TAB_1: This have "Add", "Clear", "Download xlsx file" "Import xlsx file" - TYPE_TAB_2: This contains a Text box for side note. - TYPE_TAB_3: This is plain layout - function for tab content: All the values like labels, input widgets can be passed as list of tuples, - which will be displayed in chosen tab layout - - """ - tabs = [] - - t1 = (KEY_DISP_GIRDERSEC, TYPE_TAB_1, self.tab_girder_sec) - tabs.append(t1) - - t5 = ("Optimisation", TYPE_TAB_2, self.optimization_tab_welded_plate_girder_design) - tabs.append(t5) - - t1 = ("Stiffeners", TYPE_TAB_2, self.Stiffener_design) - tabs.append(t1) - - t1 = ("Additional Girder Data", TYPE_TAB_2, self.girder_geometry) - tabs.append(t1) - - t5 = ("Design", TYPE_TAB_2, self.design_values) - tabs.append(t5) - - t6 = ("Deflection" , TYPE_TAB_2, self.deflection_values) - tabs.append(t6) - - return tabs - - def tab_value_changed(self): - change_tab = [] - - t1 = (KEY_DISP_GIRDERSEC, [KEY_SEC_MATERIAL], [KEY_SEC_FU, KEY_SEC_FY], TYPE_TEXTBOX, self.get_fu_fy_I_section_plate_girder) - change_tab.append(t1) - - t4 = (KEY_DISP_GIRDERSEC, ['Label_6', 'Label_7', 'Label_8', 'Label_9', 'Label_10', 'Label_11'], - ['Label_12', 'Label_13', 'Label_14', 'Label_15', 'Label_16', 'Label_17', 'Label_18', - 'Label_19', 'Label_20', 'Label_21', 'Label_22','Label_23'], TYPE_TEXTBOX, self.Unsymm_I_Section_properties) - change_tab.append(t4) - - t9 = ("Deflection", [KEY_STR_TYPE], [KEY_MEMBER_OPTIONS], TYPE_COMBOBOX, self.member_options_change) - change_tab.append(t9) - t9 = ("Deflection", [KEY_MEMBER_OPTIONS], [KEY_SUPPORTING_OPTIONS], TYPE_COMBOBOX, self.supp_options_change) - change_tab.append(t9) - t9 = ("Deflection", [KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_SUPPORTING_OPTIONS], [KEY_MAX_DEFL], TYPE_TEXTBOX, self.max_defl_change) - change_tab.append(t9) - t10 = ("Stiffeners", [KEY_IntermediateStiffener_thickness], [KEY_IntermediateStiffener_thickness_val], TYPE_COMBOBOX, self.Int_stiffener_thickness_customized) - change_tab.append(t10) - t11 = ("Stiffeners", [KEY_LongitudnalStiffener_thickness], [KEY_LongitudnalStiffener_thickness_val], TYPE_COMBOBOX, self.Long_stiffener_thickness_customized) - change_tab.append(t11) - - - # t10 = ('Stiffeners',[KEY_WEB_PHILOSOPHY],[KEY_IntermediateStiffener_spacing],TYPE_TEXTBOX,self.Intm_stiffener_spacing_change) - # change_tab.append(t10) - - - - return change_tab - - def edit_tabs(self): - """ This function is required if the tab name changes based on connectivity or profile or any other key. - Not required for this module but empty list should be passed""" - return [] - - def input_dictionary_design_pref(self): - """ - - :return: This function is used to choose values of design preferences to be saved to design dictionary. - - It returns list of tuple which contains, tab name, input widget type of keys, keys whose values to be saved, - - [(Tab Name, input widget type of keys, [List of keys to be saved])] - - """ - design_input = [] - - t1 = (KEY_DISP_GIRDERSEC, TYPE_COMBOBOX, [KEY_SEC_MATERIAL])#Need to check - design_input.append(t1) - - t1 = (KEY_DISP_GIRDERSEC, TYPE_TEXTBOX, [KEY_SEC_FU, KEY_SEC_FY]) - design_input.append(t1) - - t2 = ("Optimisation", TYPE_TEXTBOX, [KEY_EFFECTIVE_AREA_PARA, KEY_LENGTH_OVERWRITE]) # , KEY_STEEL_COST - design_input.append(t2) - - t2 = ("Optimisation", TYPE_COMBOBOX, [KEY_ALLOW_CLASS, KEY_LOAD]) # , KEY_STEEL_COST - design_input.append(t2) - - t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_IntermediateStiffener,KEY_LongitudnalStiffener,KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness]) - design_input.append(t2) - - t2 = ("Stiffeners", TYPE_TEXTBOX, [KEY_IntermediateStiffener_spacing]) - design_input.append(t2) - - t2 = ("Stiffeners", TYPE_COMBOBOX, [KEY_ShearBucklingOption,KEY_IntermediateStiffener_thickness_val,KEY_LongitudnalStiffener_thickness_val]) - design_input.append(t2) - - t2 = ("Additional Girder Data", TYPE_COMBOBOX, [KEY_IS_IT_SYMMETRIC]) - design_input.append(t2) - - t6 = ("Design", TYPE_COMBOBOX, [KEY_DP_DESIGN_METHOD]) - design_input.append(t6) - - t7 = ("Deflection",TYPE_COMBOBOX, [KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_SUPPORTING_OPTIONS]) - design_input.append(t7) - t7 = ("Deflection",TYPE_TEXTBOX, [KEY_MAX_DEFL]) - design_input.append(t7) - - return design_input - - def input_dictionary_without_design_pref(self): - - design_input = [] - - t2 = (KEY_MATERIAL, [KEY_DP_DESIGN_METHOD], 'Input Dock') - design_input.append(t2) - - t2 = (None, [KEY_ALLOW_CLASS, KEY_EFFECTIVE_AREA_PARA, KEY_LENGTH_OVERWRITE, KEY_LOAD, KEY_DP_DESIGN_METHOD,KEY_STR_TYPE,KEY_DESIGN_LOAD,KEY_MEMBER_OPTIONS,KEY_MAX_DEFL, - KEY_SUPPORTING_OPTIONS,KEY_ShearBucklingOption, KEY_IntermediateStiffener_spacing, KEY_IntermediateStiffener,KEY_LongitudnalStiffener,KEY_IntermediateStiffener_thickness_val,KEY_LongitudnalStiffener_thickness_val, - KEY_IntermediateStiffener_thickness,KEY_LongitudnalStiffener_thickness, KEY_IS_IT_SYMMETRIC], '') - design_input.append(t2) - - return design_input - - def refresh_input_dock(self): - - add_buttons = [] - - return add_buttons - - def get_values_for_design_pref(self, key, design_dictionary): - # if design_dictionary[KEY_MATERIAL] != 'Select Material': - # material = Material(design_dictionary[KEY_MATERIAL], 41) - # material_grade = design_dictionary[KEY_MATERIAL] - # fu = material.fu - # fy = material.fy - # else: - # fu = '' - # fy = '' - - - - val = { - KEY_ALLOW_CLASS: 'Yes', - KEY_EFFECTIVE_AREA_PARA: '1.0', - KEY_LENGTH_OVERWRITE: 'NA', - KEY_LOAD: 'Normal', - KEY_DP_DESIGN_METHOD: "Limit State Design", - KEY_ShearBucklingOption: KEY_DISP_SB_Option[0], - KEY_IS_IT_SYMMETRIC: 'Symmetrical', - KEY_IntermediateStiffener_spacing:'NA', - KEY_IntermediateStiffener: 'No', - KEY_IntermediateStiffener_thickness:'All', - KEY_LongitudnalStiffener: 'Yes and 1 stiffener', - KEY_LongitudnalStiffener_thickness:'All', - KEY_STR_TYPE:'Highway Bridge', - KEY_DESIGN_LOAD:'Live Load', - KEY_MEMBER_OPTIONS :'Simple Span', - KEY_SUPPORTING_OPTIONS: 'NA', - KEY_MAX_DEFL : 'Span/600', - KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS, - KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS - }[key] - - return val - def member_options_change(self): - if self[0] == KEY_DISP_STR_TYP3: - return {KEY_MEMBER_OPTIONS : VALUES_MEMBER_OPTIONS[1]} - elif self[0] == KEY_DISP_STR_TYP4: - return {KEY_MEMBER_OPTIONS :VALUES_MEMBER_OPTIONS[2]} - else: - return {KEY_MEMBER_OPTIONS : VALUES_MEMBER_OPTIONS[0]} - - - def supp_options_change(self): - if self[0] in ['Purlin and Girts', 'Simple span', 'Cantilever span']: - return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_PSC} - elif self[0] == 'Rafter Supporting': - return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_RS} - elif self[0] == 'Gantry': - return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_GNT} - elif self[0] in ['Floor and roof', 'Cantilever']: - return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_FRC} - else: - return {KEY_SUPPORTING_OPTIONS : VALUES_SUPPORTING_OPTIONS_DEF} - - def max_defl_change(self): - if self[0] in ['Highway Bridge','Railway Bridge']: - if self[2] == 'Simple Span': - if self[1] == 'Live load': - return {KEY_MAX_DEFL :VALUES_MAX_DEFL[0]} - elif self[1] == 'Dead load': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[1]} - else: - return {KEY_MAX_DEFL : 'NA'} - - else: - if self[1] == 'Live load': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[2]} - elif self[1] == 'Dead load': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[1]} - else: - return {KEY_MAX_DEFL : 'NA'} - - elif self[0] == 'Other Building': - if self[1] == 'Live load': - if self[2] == 'Floor and roof': - if self[3] == 'Elements not susceptible to cracking': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[3]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[4]} - else: - if self[3] == 'Elements not susceptible to cracking': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[5]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[6]} - else: - return {KEY_MAX_DEFL : 'NA'} - else: - if self[2] == 'Purlin and Girts' and self[1] == 'Live load': - if self[3] == 'Elastic cladding': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[5]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[6]} - elif self[2] == 'Simple span' and self[1] == 'Live load': - if self[3] == 'Elastic cladding': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[7]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[3]} - elif self[2] == 'Cantilever span' and self[1] == 'Live load': - if self[3] == 'Elastic cladding': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[8]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[5]} - elif self[2] == 'Rafter Supporting' and self[1] == 'Live load': - if self[3] == 'Profiled Metal sheeting': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[6]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[7]} - elif self[2] == 'Gantry' and self[1] == 'Live load': - if self[1] == 'Crane Load(Manual operation)': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[9]} - elif self[1] == 'Crane load(Electric operation up to 50t)': - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[10]} - else: - return {KEY_MAX_DEFL : VALUES_MAX_DEFL[11]} - else: - return {KEY_MAX_DEFL : 'NA'} - - def Int_stiffener_thickness_customized(self): - selected_items = [] - if self[0] == 'All': - return {KEY_IntermediateStiffener_thickness_val : VALUES_STIFFENER_THICKNESS} - else: - popup = PopupDialog() - popup.listWidget.addItems(VALUES_STIFFENER_THICKNESS) # Set available items - if popup.exec_() == QDialog.Accepted: - selected_items = popup.get_selected_items() - # print("Selected:", selected_items) - PlateGirderWelded.int_thicklist = selected_items - return {KEY_IntermediateStiffener_thickness_val : selected_items} - - def Long_stiffener_thickness_customized(self): - selected_items2 = [] - if self[0] == 'All': - return {KEY_LongitudnalStiffener_thickness_val : VALUES_STIFFENER_THICKNESS} - else: - popup = PopupDialog() - popup.listWidget.addItems(VALUES_STIFFENER_THICKNESS) # Set available items - if popup.exec_() == QDialog.Accepted: - selected_items2 = popup.get_selected_items() - # print("Selected:", selected_items2) - PlateGirderWelded.long_thicklist = selected_items2 - return {KEY_LongitudnalStiffener_thickness_val : selected_items2} - - #################################### - # Design Preference Functions End - #################################### - # Setting up logger and Input and Output Docks - #################################### - def module_name(self): - print('in module') - return KEY_DISP_PLATE_GIRDER_WELDED - - - def set_osdaglogger(key): - """ - Set logger for Column Design Module. - """ - global logger - logger = logging.getLogger('Osdag') - - logger.setLevel(logging.DEBUG) - handler = logging.StreamHandler() - formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') - - handler.setFormatter(formatter) - logger.addHandler(handler) - handler = logging.FileHandler('logging_text.log') - - formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') - handler.setFormatter(formatter) - logger.addHandler(handler) - - if key is not None: - handler = OurLog(key) - formatter = logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') - handler.setFormatter(formatter) - logger.addHandler(handler) - - def customized_input(self): - - c_lst = [] - # t1 = (KEY_SECSIZE, self.fn_profile_section) - # c_lst.append(t1) - t1 = (KEY_TOP_FLANGE_THICKNESS_PG, self.plate_thick_customized) - c_lst.append(t1) - - t2 = (KEY_BOTTOM_FLANGE_THICKNESS_PG, self.plate_thick_customized) - c_lst.append(t2) - - t3= (KEY_WEB_THICKNESS_PG, self.plate_thick_customized) - c_lst.append(t3) - - # t4 = (KEY_LongitudnalStiffener_thickness,self.long_stf_thk_customized) - # c_lst.append(t4) - return c_lst - - - - def input_values(self): - - self.module = KEY_DISP_PLATE_GIRDER_WELDED - options_list = [] - - t1 = (None, KEY_DISP_PG_SectionDetail, TYPE_TITLE, None, True, 'No Validator') - options_list.append(t1) - - t1 = (KEY_MODULE, KEY_DISP_PLATE_GIRDER_WELDED, TYPE_MODULE, None, True, "No Validator") - options_list.append(t1) - - t4 = (KEY_MATERIAL, KEY_DISP_MATERIAL, TYPE_COMBOBOX, VALUES_MATERIAL, True, 'No Validator') - options_list.append(t4) - - t2 = (KEY_OVERALL_DEPTH_PG_TYPE, KEY_DISP_OVERALL_DEPTH_PG_TYPE, TYPE_COMBOBOX, VALUES_DEPTH_PG, True, 'No Validator') - options_list.append(t2) - t33 = (KEY_OVERALL_DEPTH_PG, KEY_DISP_OVERALL_DEPTH_PG, TYPE_TEXTBOX, None, True, 'Int Validator') - options_list.append(t33) - - t4 = (KEY_WEB_THICKNESS_PG, KEY_DISP_WEB_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, - 'Int Validator') - options_list.append(t4) - - # t2 = (KEY_TOP_Bflange_PG_Type, KEY_DISP_TOP_Bflange_PG_Type, TYPE_COMBOBOX, VALUES_DEPTH_PG, True, 'No Validator') - # options_list.append(t2) - - t2 = (KEY_TOP_Bflange_PG, KEY_DISP_TOP_Bflange_PG, TYPE_TEXTBOX, None, True, 'Int Validator') - options_list.append(t2) - - t4 = (KEY_TOP_FLANGE_THICKNESS_PG, KEY_DISP_TOP_FLANGE_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, 'Int Validator') - options_list.append(t4) - - # t2 = (KEY_BOTTOM_Bflange_PG_Type, KEY_DISP_BOTTOM_Bflange_PG_Type, TYPE_COMBOBOX, VALUES_DEPTH_PG, True, 'No Validator') - # options_list.append(t2) - t22 = (KEY_BOTTOM_Bflange_PG, KEY_DISP_BOTTOM_Bflange_PG, TYPE_TEXTBOX, None, True, 'Int Validator') - options_list.append(t22) - - t4 = (KEY_BOTTOM_FLANGE_THICKNESS_PG, KEY_DISP_BOTTOM_FLANGE_THICKNESS_PG, TYPE_COMBOBOX_CUSTOMIZED, VALUES_PLATETHK, True, - 'No Validator') - options_list.append(t4) - - t2 = (KEY_LENGTH, KEY_DISP_LENGTH, TYPE_TEXTBOX, None, True, 'Int Validator') - options_list.append(t2) - - t1 = (None, KEY_DISP_SECTION_DATA_PG, TYPE_TITLE, None, True, 'No Validator') - options_list.append(t1) - - t2 = ( - KEY_DESIGN_TYPE_FLEXURE, - KEY_BEAM_SUPP_TYPE, - TYPE_COMBOBOX, - VALUES_SUPP_TYPE_temp, - True, - "No Validator", - ) - options_list.append(t2) - - #t4 = (KEY_STR_TYPE, KEY_DISP_STR_TYPE, TYPE_COMBOBOX, KEY_DISP_STR_TYPE_list, True, 'No Validator') - #options_list.append(t4) - t5 = (KEY_SUPPORT_WIDTH, KEY_DISP_SUPPORT_WIDTH, TYPE_TEXTBOX, None, True, 'Int Validator') - options_list.append(t5) - - t4 = (KEY_WEB_PHILOSOPHY, KEY_DISP_WEB_PHILOSOPHY, TYPE_COMBOBOX, WEB_PHILOSOPHY_list, True, 'No Validator') - options_list.append(t4) - - t10 = (KEY_TORSIONAL_RES, DISP_TORSIONAL_RES, TYPE_COMBOBOX, Torsion_Restraint_list, True, 'No Validator') - options_list.append(t10) - - t11 = (KEY_WARPING_RES, DISP_WARPING_RES, TYPE_COMBOBOX, Warping_Restraint_list, True, 'No Validator') - options_list.append(t11) - - t7 = (None, KEY_LOADING, TYPE_TITLE, None, True, 'No Validator') - options_list.append(t7) - - t8 = (KEY_MOMENT, KEY_DISP_MOMENT, TYPE_TEXTBOX, None, True, 'No Validator') - options_list.append(t8) - - t8 = (KEY_SHEAR, KEY_DISP_SHEAR, TYPE_TEXTBOX, None, True, 'No Validator') - options_list.append(t8) - - t8= (KEY_BENDING_MOMENT_SHAPE, KEY_DISP_BENDING_MOMENT_SHAPE, TYPE_COMBOBOX, Bending_moment_shape_list, True, - 'No Validator' ) - options_list.append(t8) - - t15 = (KEY_IMAGE, None, TYPE_IMAGE_BIGGER, VALUES_IMAGE_PLATEGIRDER[0], True,'No Validator') - options_list.append(t15) - return options_list - - def fn_torsion_warping(self): - print( 'Inside fn_torsion_warping', self) - if self[0] == Torsion_Restraint1: - return Warping_Restraint_list - elif self[0] == Torsion_Restraint2: - return [Warping_Restraint5] - else: - return [Warping_Restraint5] - - def axis_bending_change(self): - design = self[0] - print( 'Inside fn_supp_image', self) - if self[0] == KEY_DISP_DESIGN_TYPE_FLEXURE: - return ['NA'] - else: - return VALUES_BENDING_TYPE - - def fn_conn_image(self): - - "Function to populate section images based on the type of section " - img = self[0] - if img == Bending_moment_shape_list[0]: - return VALUES_IMAGE_PLATEGIRDER[0] - elif img ==Bending_moment_shape_list[1]: - return VALUES_IMAGE_PLATEGIRDER[1] - elif img ==Bending_moment_shape_list[2]: - return VALUES_IMAGE_PLATEGIRDER[2] - elif img ==Bending_moment_shape_list[3]: - return VALUES_IMAGE_PLATEGIRDER[3] - else: - return VALUES_IMAGE_PLATEGIRDER[4] - - def customized_dimensions(self): - conn = self[0] - if conn == "Customized": - return KEY_DISP_OVERALL_DEPTH_PG - else: - return '' - - def customized_dimensions_1(self): - conn = self[0] - if conn == "Customized": - return KEY_DISP_TOP_Bflange_PG - else: - return '' - - def customized_dimensions_2(self): - conn = self[0] - if conn == "Customized": - return KEY_DISP_BOTTOM_Bflange_PG - else: - return '' - - def customized_dims(self): - conn = self[0] - if conn == "Customized": - return TYPE_TEXTBOX - else: - return '' - - def customized_options(self): - conn = self[0] - if conn == "Customized": - return VALUES_PLATETHK - else: - return VALUES_OPT - - - def input_value_changed(self): - - lst = [] - t1 = ([KEY_BENDING_MOMENT_SHAPE], KEY_IMAGE, TYPE_IMAGE, self.fn_conn_image) - lst.append(t1) - - t3 = ([KEY_TORSIONAL_RES], KEY_WARPING_RES, TYPE_COMBOBOX, self.fn_torsion_warping) - lst.append(t3) - - t44 = ([KEY_OVERALL_DEPTH_PG_TYPE],KEY_OVERALL_DEPTH_PG, TYPE_LABEL, self.customized_dimensions) - lst.append(t44) - t45 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_OVERALL_DEPTH_PG, TYPE_TEXTBOX, self.customized_dims) - lst.append(t45) - t46 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_WEB_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) - lst.append(t46) - - t2 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_LABEL, self.customized_dimensions_1) - lst.append(t2) - t3 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) - lst.append(t3) - t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_TOP_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) - lst.append(t47) - - t23 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_Bflange_PG, TYPE_LABEL, self.customized_dimensions_2) - lst.append(t23) - t24 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_Bflange_PG, TYPE_TEXTBOX, self.customized_dims) - lst.append(t24) - t47 = ([KEY_OVERALL_DEPTH_PG_TYPE], KEY_BOTTOM_FLANGE_THICKNESS_PG, TYPE_COMBOBOX, self.customized_options) - lst.append(t47) - - t3 = ([KEY_MATERIAL], KEY_MATERIAL, TYPE_CUSTOM_MATERIAL, self.new_material) - lst.append(t3) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_T_constatnt, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_T_constatnt, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_W_constatnt, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_W_constatnt, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_IMPERFECTION_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_SR_FACTOR_LTB, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_SR_FACTOR_LTB, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_NON_DIM_ESR_LTB, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_NON_DIM_ESR_LTB, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_DESIGN_STRENGTH_COMPRESSION, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_Elastic_CM, TYPE_OUT_LABEL, self.output_modifier) - lst.append(t18) - - t18 = ([KEY_DESIGN_TYPE_FLEXURE], - KEY_Elastic_CM, TYPE_OUT_DOCK, self.output_modifier) - lst.append(t18) - - t19 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_thickness,TYPE_OUT_LABEL,self.output_modifier2) - lst.append(t19) - - t20 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_thickness,TYPE_OUT_DOCK,self.output_modifier2) - lst.append(t20) - - t21 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_thickness,TYPE_OUT_LABEL,self.output_modifier2) - lst.append(t21) - - t22 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_thickness,TYPE_OUT_DOCK,self.output_modifier2) - lst.append(t22) - - t23 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_spacing,TYPE_OUT_LABEL,self.output_modifier2) - lst.append(t23) - - t24 = ([KEY_WEB_PHILOSOPHY],KEY_IntermediateStiffener_spacing,TYPE_OUT_DOCK,self.output_modifier2) - lst.append(t24) - - t25 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_LABEL,self.output_modifier2) - lst.append(t25) - - t26 = ([KEY_WEB_PHILOSOPHY],KEY_LongitudnalStiffener_numbers,TYPE_OUT_DOCK,self.output_modifier2) - lst.append(t26) - - return lst - - def warning_majorbending(self): - print(self) - if self[0] == VALUES_SUPP_TYPE_temp[2]: - return True - # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : - # return True - else: - return False - - def output_modifier(self): - print(self) - if self[0] == VALUES_SUPP_TYPE_temp[2]: - return False - # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : - # return True - else: - return True - - def output_modifier2(self): - print(self) - if self[0] == 'Thin Web with ITS': - return False - # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : - # return True - else: - return True - - def Design_pref_modifier(self): - print("Design_pref_modifier",self) - - - def output_values(self, flag): - - out_list = [] - - t0 = (None, DISP_TITLE_STRUT_SECTION, TYPE_TITLE, None, True) - out_list.append(t0) - - t1 = (KEY_TITLE_OPTIMUM_DESIGNATION, KEY_DISP_TITLE_OPTIMUM_DESIGNATION, TYPE_TEXTBOX, - self.result_designation if flag else '', True) - out_list.append(t1) - - t2 = ( - KEY_OPTIMUM_UR_COMPRESSION, KEY_DISP_OPTIMUM_UR_COMPRESSION, TYPE_TEXTBOX, round(self.result_UR,3) if flag else '', True) - out_list.append(t2) - - t3 = (KEY_OPTIMUM_SC, KEY_DISP_OPTIMUM_SC, TYPE_TEXTBOX, self.section_classification_val if flag else '', True) - out_list.append(t3) - - t4 = (KEY_betab_constatnt,KEY_DISP_betab_constatnt, TYPE_TEXTBOX, - self.betab if flag else '', True) - out_list.append(t4) - - t5 = ( - KEY_EFF_SEC_AREA, KEY_DISP_EFF_SEC_AREA, TYPE_TEXTBOX, self.effectivearea if flag else '', - True) - out_list.append(t5) - - # t6 = (None,"Design Results" , TYPE_TITLE, None, True) - # out_list.append(t6) - - - - - - # t9 = (None, KEY_DISP_DESIGN_STIFFER , TYPE_TITLE, None, True) - # out_list.append(t9) - - t10 = (KEY_IntermediateStiffener_thickness, KEY_DISP_IntermediateStiffener_thickness, TYPE_TEXTBOX, - self.intstiffener_thk if flag else '', True) - out_list.append(t10) - - t10 = (KEY_IntermediateStiffener_spacing, KEY_DISP_IntermediateStiffener_spacing, TYPE_TEXTBOX, - self.intstiffener_spacing if flag else '', True) - out_list.append(t10) - - t1 = (KEY_LongitudnalStiffener_thickness, KEY_DISP_LongitudnalStiffener_thickness, TYPE_TEXTBOX, - self.longstiffener_thk if flag else '', True) - out_list.append(t1) - - t1 = (KEY_LongitudnalStiffener_numbers, KEY_DISP_LongitudnalStiffener_numbers, TYPE_TEXTBOX, '', True) - out_list.append(t1) - - t2 = (KEY_EndpanelStiffener_thickness, KEY_DISP_EndpanelStiffener_thickness, TYPE_TEXTBOX, - '', True) - out_list.append(t2) - - t1 = (KEY_MOMENT_STRENGTH, KEY_DISP_MOMENT, TYPE_TEXTBOX, - self.design_moment if flag else '', True) - out_list.append(t1) - - # t1 = (None, KEY_DISP_WELD_DESIGN, TYPE_TITLE, None, True) - # out_list.append(t1) - - t1 = (KEY_WeldWebtoflange, KEY_DISP_WeldWebtoflange, TYPE_TEXTBOX, - '', True) - out_list.append(t1) - - t1 = (KEY_WeldStiffenertoweb, KEY_DISP_WeldStiffenertoweb, TYPE_TEXTBOX, - '', True) - out_list.append(t1) - - # t1 = (None, KEY_DISP_LTB, TYPE_TITLE, None, False) - # out_list.append(t1) - - t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, - self.torsion_cnst if flag else '', False) - out_list.append(t2) - - t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.warping_cnst if flag else '', False) - out_list.append(t2) - - t2 = ( - KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, '', - False) - out_list.append(t2) - - t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, '', False) - out_list.append(t2) - - t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, '', False) - out_list.append(t2) - - t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, - '', False) - out_list.append(t1) - - t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.critical_moment if flag else '', False) - out_list.append(t2) - - # TODO @Rutvik: can add tab button for asthetics - - # t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, - # self.result_tc if flag else '', False) - # out_list.append(t2) - - # t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.result_wc if flag else '', False) - # out_list.append(t2) - - # t2 = ( - # KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, self.result_IF_lt if flag else '', - # False) - # out_list.append(t2) - - # t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, self.result_srf_lt if flag else '', False) - # out_list.append(t2) - - # t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, self.result_nd_esr_lt if flag else '', False) - # out_list.append(t2) - - # t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, - # self.result_fcd__lt if flag else - # '', False) - # out_list.append(t1) - - # t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.result_mcr if flag else '', False) - # out_list.append(t2) - - # t1 = (None, KEY_PERFORMANCE_EVALUATION, TYPE_TITLE, None, True) - # out_list.append(t1) - # - # t2 = (KEY_ESR, KEY_DISP_UTILIZATION_RATION_PG , TYPE_TEXTBOX, self.result_eff_sr if flag else '', True) - # out_list.append(t2) - # - # t2 = (KEY_EULER_BUCKLING_STRESS, KEY_DISP_PERMISSIBLE_PG, TYPE_TEXTBOX, - # self.result_ebs if flag else '', True) - # out_list.append(t2) - # - # t2 = (KEY_BUCKLING_CURVE, KEY_DISP_DEFLECTION_PG, TYPE_TEXTBOX, self.result_bc if flag else '', True) - # out_list.append(t2) - - return out_list - def spacing(self, status): - - spacing = [] - - t2 = (KEY_T_constatnt, KEY_DISP_T_constatnt, TYPE_TEXTBOX, - self.result_tc if status else '', False) - spacing.append(t2) - - t2 = (KEY_W_constatnt, KEY_DISP_W_constatnt, TYPE_TEXTBOX, self.result_wc if status else '', False) - spacing.append(t2) - - t2 = ( - KEY_IMPERFECTION_FACTOR_LTB, KEY_DISP_IMPERFECTION_FACTOR, TYPE_TEXTBOX, self.result_IF_lt if status else '', - False) - spacing.append(t2) - - t2 = (KEY_SR_FACTOR_LTB, KEY_DISP_SR_FACTOR, TYPE_TEXTBOX, self.result_srf_lt if status else '', False) - spacing.append(t2) - - t2 = (KEY_NON_DIM_ESR_LTB, KEY_DISP_NON_DIM_ESR, TYPE_TEXTBOX, self.result_nd_esr_lt if status else '', False) - spacing.append(t2) - - t1 = (KEY_DESIGN_STRENGTH_COMPRESSION, KEY_DISP_COMP_STRESS, TYPE_TEXTBOX, - self.result_fcd__lt if status else - '', False) - spacing.append(t1) - - t2 = (KEY_Elastic_CM, KEY_DISP_Elastic_CM, TYPE_TEXTBOX, self.result_mcr if status else '', False) - spacing.append(t2) - - return spacing - - def func_for_validation(self, design_dictionary): - print(f"func_for_validation here") - all_errors = [] - self.design_status = False - flag = False - self.output_values(self, flag) - flag1 = False - flag2 = False - flag3 = False - option_list = self.input_values(self) - missing_fields_list = [] - print(f'func_for_validation option_list {option_list}' - f"\n design_dictionary {design_dictionary}" - ) - for option in option_list: - if option[2] == TYPE_TEXTBOX or option[0] == KEY_LENGTH or option[0] == KEY_SHEAR or option[0] == KEY_MOMENT: - try: - if design_dictionary[option[0]] == '': - if design_dictionary['Total.Design_Type'] == 'Optimized': - if design_dictionary[KEY_OVERALL_DEPTH_PG] == '' or design_dictionary[KEY_TOP_Bflange_PG] == '' or design_dictionary[KEY_BOTTOM_Bflange_PG] == '': - pass - else: - missing_fields_list.append(option[1]) - continue - - else: - missing_fields_list.append(option[1]) - continue - if option[0] == KEY_LENGTH: - if float(design_dictionary[option[0]]) <= 0.0: - print("Input value(s) cannot be equal or less than zero.") - error = "Input value(s) cannot be equal or less than zero." - all_errors.append(error) - - else: - flag1 = True - elif option[0] == KEY_SHEAR: - if float(design_dictionary[option[0]]) <= 0.0: - print("Input value(s) cannot be equal or less than zero.") - error = "Input value(s) cannot be equal or less than zero." - all_errors.append(error) - else: - flag2 = True - elif option[0] == KEY_MOMENT: - if float(design_dictionary[option[0]]) <= 0.0: - print("Input value(s) cannot be equal or less than zero.") - error = "Input value(s) cannot be equal or less than zero." - all_errors.append(error) - else: - flag3 = True - except: - error = "Input value(s) are not valid" - all_errors.append(error) - - if len(missing_fields_list) > 0: - error = self.generate_missing_fields_error_string(self, missing_fields_list) - all_errors.append(error) - else: - flag = True - - if flag and flag1 and flag2 and flag3: - print(f"\n design_dictionary{design_dictionary}") - self.set_input_values(self, design_dictionary) - print("WORKING VALIDATION") - # if self.design_status ==False and len(self.failed_design_dict)>0: - # logger.error( - # "Design Failed, Check Design Report" - # ) - # return # ['Design Failed, Check Design Report'] @TODO - # elif self.design_status: - # pass - # else: - # logger.error( - # "Design Failed. Selender Sections Selected" - # ) - # return # ['Design Failed. Selender Sections Selected'] - else: - return all_errors - - def get_3d_components(self): - - components = [] - t3 = ('Model', self.call_3DModel) - components.append(t3) - - # t3 = ('Column', self.call_3DColumn) - # components.append(t3) - - return components - - # warn if a beam of older version of IS 808 is selected - def warn_text(self): - """ give logger warning when a beam from the older version of IS 808 is selected """ - global logger - red_list = red_list_function() - - if (self.sec_profile == VALUES_SEC_PROFILE[0]) or (self.sec_profile == VALUES_SEC_PROFILE[1]): # Beams or Columns - for section in self.sec_list: - if section in red_list: - logger.warning(" : You are using a section ({}) (in red color) that is not available in latest version of IS 808".format(section)) - - # Setting inputs from the input dock GUI - def set_input_values(self, design_dictionary): - self.module = design_dictionary[KEY_MODULE] - self.design_type = design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE] - self.section_class = None - if self.design_type == 'Optimized': - self.total_depth = 1 - self.web_thickness = 1 - self.top_flange_width = 1 - self.top_flange_thickness = 1 - self.bottom_flange_width = 1 - self.bottom_flange_thickness = 1 - - else: - - self.total_depth = float(design_dictionary[KEY_OVERALL_DEPTH_PG]) - self.web_thickness = float(design_dictionary[KEY_WEB_THICKNESS_PG][0]) - self.top_flange_width = float(design_dictionary[KEY_TOP_Bflange_PG]) - self.top_flange_thickness = float(design_dictionary[KEY_TOP_FLANGE_THICKNESS_PG][0]) - self.bottom_flange_width = float(design_dictionary[KEY_BOTTOM_Bflange_PG]) - self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) - - #3 list loops for V inp= self.Zp_req: - print( 'self.section_property.plast_sec_mod_z More than Requires',self.plast_sec_mod_z,self.Zp_req) - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - self.beta_b_lt = 1.0 - else: - self.beta_b_lt = (self.elast_sec_mod_z/ self.plast_sec_mod_z) - print("Beta value",self.beta_b_lt) - A_vg = (self.total_depth - self.top_flange_thickness - self.bottom_flange_thickness) * self.web_thickness - self.V_d = ((A_vg * self.material.fy) / (math.sqrt(3) * self.gamma_m0)) - print("Shear check",self.V_d, self.material.fy) - print("shear force ",self.load.shear_force) #V value self.load.shear_force - if IS800_2007.cl_8_2_1_2_high_shear_check(self.load.shear_force,self.V_d): - self.shear_type = 'High' #high shear - if self.support_type == 'Major Laterally Supported': - if self.web_philosophy == 'Thick Web without ITS': - if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): - self.Mdv = self.calc_Mdv(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.moment_ratio = self.load.moment / self.Mdv - print("Ratio for moment", self.moment_ratio) - self.web_buckling_check(self) - print("Bending moment",self.Mdv/1000000) - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( - self.material.fy, - self.gamma_m0, - slenderness_input, - self.material.modulus_of_elasticity - ) - - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - - - - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #buckling method - c = 0 - if self.c != 'NA': - c = float(self.c) - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): - print("Check passed") - else: - print("Check Failed") - else: #tension field - pass - #to add tension field check - - - - - else: - logger.error("Web thickness is not sufficient\n Re-enter new thickness") - - else: #thin web condition - - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - else: - # assuming stiffner thickness is a val for now - to add list parsing - # Simple post critical check - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): - print("Simple Post Critical Check passed") - else: - print("Simple Post Critical Check Failed") - # intermediate stiffner shear check - if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): - print("Shear Intermediate check passed") - else: - print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") - #end stiffener check - if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): - print("End stiffner check okay") - else: - print("CHECK THE NEXT THICKNESS") - - - #longitudnal stiffner check - if self.long_Stiffner == 'Yes': - print("Checking long stiffener") - if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): - logger.error("Longitudnal Stiffner thickess is less than required") - else: - print("Longitudnal Stiffner check passed") - - #Intermediate stiffner check - self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) - if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): - print("Stiffener provided is OKAY") - else: - print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") - - else: #tension field - - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - c = float(self.c) - if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): - print("Check passed") - else: - print("Check Failed") - - if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): - print("End stiffner TF check okay") - else: - print("CHECK THE NEXT THICKNESS") - - - - - else: #unsupported type - if self.web_philosophy == 'Thick Web without ITS': - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( - self.material.fy, - self.gamma_m0, - slenderness_input, - self.material.modulus_of_elasticity - ) - - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - - else: #thin web condition - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': - - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - else: - # assuming stiffner thickness is a val for now - to add list parsing - # Simple post critical check - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): - print("Simple Post Critical Check passed") - else: - print("Simple Post Critical Check Failed") - # intermediate stiffner shear check - if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): - print("Shear Intermediate check passed") - else: - print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") - #end stiffener check - if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): - print("End stiffner check okay") - else: - print("CHECK THE NEXT THICKNESS") - - - #longitudnal stiffner check - if self.long_Stiffner == 'Yes': - print("Checking long stiffener") - if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): - logger.error("Longitudnal Stiffner thickess is less than required") - else: - print("Longitudnal Stiffner check passed") - - #Intermediate stiffner check - self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) - if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): - print("Stiffener provided is OKAY") - else: - print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") - else: #tension field - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - c = float(self.c) - if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): - print("Check passed") - else: - print("Check Failed") - - if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): - print("End stiffner TF check okay") - else: - print("CHECK THE NEXT THICKNESS") - - - G = 0.769 * 10**5 - Kw = self.get_K_from_warping_restraint(self,self.warping) - Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, self.It, self.Iw, self.effective_length, Kw, self.total_depth, - self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, - self.loading_case, self.warping) - print("Input moment",self.load.moment) - print("It VAL",self.It, self.Iw) - self.Md = self.bending_check_lat_unsupported(self,self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, self.material.fy, self.M_cr,self.section_class) - - self.Mdv = self.calc_Mdv_lat_unsupported(self,self.load.shear_force,self.V_d, self.plast_sec_mod_z,self.elast_sec_mod_z, self.material.fy, self.gamma_m0, self.total_depth, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness,self.Md) - self.moment_ratio = self.load.moment/ self.Mdv - print("Ratio for moment", self.moment_ratio) - print("MDV",self.Mdv) - # print("supp mdv",self.Mdv) - if self.Mdv >= self.load.moment: - print("Section is passed") - else: - logger.error("Change the section") - - - else: #low shear - self.shear_type = 'Low' - if self.support_type == 'Major Laterally Supported': - if self.web_philosophy == 'Thick Web without ITS': - if IS800_2007.cl_8_6_1_1_plate_girder_minimum_web_a(self.total_depth,self.web_thickness,self.epsilon,self.top_flange_thickness,self.bottom_flange_thickness): - self.Md =self.beta_b_lt * self.plast_sec_mod_z * self.material.fy / self.gamma_m0 - print("Moment Capacity Md",self.Md/1000000, self.plast_sec_mod_z) - self.web_buckling_check(self) - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( - self.material.fy, - self.gamma_m0, - slenderness_input, - self.material.modulus_of_elasticity - ) - - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #bukling method - c = 0 - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1000000 / lever_arm - if self.c != 'NA': - c = float(self.c) - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,c): - print("Check passed") - else: - print("Check Failed") - self.shear_ratio = self.load.shear_force / self.V_cr - print("Ratio for shear",self.shear_ratio) - else: - pass - else: - logger.error("Web thickness is not sufficient\n Re-enter new thickness") - - else: #thin web condition - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - else: - # assuming stiffner thickness is a val for now - to add list parsing - # Simple post critical check - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): - print("Simple Post Critical Check passed") - else: - print("Simple Post Critical Check Failed") - self.shear_ratio = self.load.shear_force / self.V_cr - print("Ratio for shear",self.shear_ratio) - # intermediate stiffner shear check - if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): - print("Shear Intermediate check passed") - else: - print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") - #end stiffener check - if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): - print("End stiffner check okay") - else: - print("CHECK THE NEXT THICKNESS") - - - #longitudnal stiffner check - if self.long_Stiffner == 'Yes': - print("Checking long stiffener") - if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): - logger.error("Longitudnal Stiffner thickess is less than required") - else: - print("Longitudnal Stiffner check passed") - - #Intermediate stiffner check - self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) - if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): - print("Stiffener provided is OKAY") - else: - print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") - - else: #tension field - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - c = float(self.c) - if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): - print("Check passed") - else: - print("Check Failed") - - if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): - print("End stiffner TF check okay") - else: - print("CHECK THE NEXT THICKNESS") - - else: #unsupported - if self.web_philosophy == 'Thick Web without ITS': - self.eff_depth = self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness) - - n1 = self.eff_depth / 2 - Ac = (self.b1 + n1) * self.web_thickness - slenderness_input = 2.5 * self.eff_depth / self.web_thickness - self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder( - self.material.fy, - self.gamma_m0, - slenderness_input, - self.material.modulus_of_elasticity - ) - - print("Web Buckling at ") - print(f"fcd: {self.fcd}N/mm2") - Critical_buckling_load = round(Ac * self.fcd / 1000, 2) - print(f"Critical buckling load: {Critical_buckling_load}kN") - - #Web Crippling - print("Web Crippling") - n2= 2.5*self.top_flange_thickness - Critical_crippling_load= round((self.b1+n2)*self.web_thickness*self.material.fy/(1.1*1000),2) - print(f"Critical crippling load: {Critical_crippling_load}kN") - else: #thin web - if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - else: - # assuming stiffner thickness is a val for now - to add list parsing - # Simple post critical check - if self.shear_buckling_check_simple_postcritical(self,self.eff_depth,A_vg,self.load.shear_force,float(self.c)): - print("Simple Post Critical Check passed") - else: - print("Simple Post Critical Check Failed") - # intermediate stiffner shear check - if self.shear_buckling_check_intermediate_stiffner(self,self.eff_depth,float(self.IntStiffThickness),float(self.IntStiffnerwidth),self.V_cr,self.web_thickness): - print("Shear Intermediate check passed") - else: - print("Intermediate Stiffner thickness needs to be increased or Intermediate Stiffner spacing needs to be reduced") - #end stiffener check - if self.simple_post_critical_end_stiffener(self,self.eff_depth, self.web_thickness, self.material.fy, self.load.moment,self.V_cr,self.load.shear_force): - print("End stiffner check okay") - else: - print("CHECK THE NEXT THICKNESS") - - - #longitudnal stiffner check - if self.long_Stiffner == 'Yes': - print("Checking long stiffener") - if self.design_longitudinal_stiffeners(self,self.eff_depth, self.web_thickness, float(self.c), self.epsilon): - logger.error("Longitudnal Stiffner thickess is less than required") - else: - print("Longitudnal Stiffner check passed") - - #Intermediate stiffner check - self.Is = float((self.IntStiffThickness) * (((self.IntStiffnerwidth * 2) + self.web_thickness) ** 3)/ 12)-(((self.IntStiffThickness) * ((( self.web_thickness) ** 3)/ 12))) - if IS800_2007.cl_8_7_2_4_min_stiffners(float(self.c),self.eff_depth,self.web_thickness,self.Is): - print("Stiffener provided is OKAY") - else: - print("As per minimum stiffener required by IS 800 clause 8.7.2.4 is not satisfied. Reduce spacing or increase the thickness of the stiffener") - else: #tension field - lever_arm = self.total_depth - (self.top_flange_thickness / 2) - (self.bottom_flange_thickness / 2) # in mm - Nf = self.load.moment * 1_000_000 / lever_arm - if self.c == 'NA': - logger.error("Intermediate Stiffner Spacing cannot be 'NA'") - c = float(self.c) - if self.shear_buckling_check_tension_field(self,self.eff_depth,A_vg,c,Nf): - print("Check passed") - else: - print("Check Failed") - - if self.tension_field_end_stiffner(self,self.eff_depth,self.web_thickness,self.material.fy,self.V_tf,self.V_cr,self.load.shear_force,self.load.moment): - print("End stiffner TF check okay") - else: - print("CHECK THE NEXT THICKNESS") - - G = 0.769 * 10**5 - Kw = self.get_K_from_warping_restraint(self,self.warping) - Iy = Unsymmetrical_I_Section_Properties.calc_MomentOfAreaY(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.It = Unsymmetrical_I_Section_Properties.calc_TorsionConstantIt(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.Iw = Unsymmetrical_I_Section_Properties.calc_WarpingConstantIw(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - self.M_cr = self.calc_Mcr_LoadingCase(self,self.material.modulus_of_elasticity, G, Iy, self.It, self.Iw, self.effective_length, Kw, self.total_depth, - self.top_flange_thickness, self.bottom_flange_thickness, self.top_flange_width, self.bottom_flange_width, - self.loading_case, self.warping) - print("Input moment",self.load.moment) - print("It VAL", self.It, self.Iw) - print("MCR VAL",self.M_cr) - self.Md = self.bending_check_lat_unsupported(self,self.beta_b_lt, self.plast_sec_mod_z, self.elast_sec_mod_z, self.material.fy, self.M_cr,self.section_class) - self.moment_ratio = self.load.moment/ self.Md - print("Ratio for moment", self.moment_ratio) - print("MD",self.Md) - if self.Md >= self.load.moment: - print("Section is passed") - else: - logger.error("update the section size") - - - - self.design_status = False - self.final_format(self,design_dictionary) - - - def final_format(self,design_dictionary): - - self.result_designation = (str(int(self.total_depth)) + " x " +str(int(self.web_thickness)) + " x " +str(int(self.bottom_flange_width)) + " x " +str(int(self.bottom_flange_thickness)) + " x " +str(int(self.top_flange_width)) + " x " +str(int(self.top_flange_thickness))) - if self.moment_ratio == None: - self.moment_ratio = 0 - if self.shear_ratio == None: - self.shear_ratio = 0 - print(self.moment_ratio, self.shear_ratio) - self.result_UR = max(self.moment_ratio,self.shear_ratio) * 100 - self.section_classification_val = self.section_class - self.betab = round(self.beta_b_lt,2) - self.effectivearea = Unsymmetrical_I_Section_Properties.calc_area(self,self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - if self.shear_type == 'Low': - self.design_moment = round(self.Md/1000000,1) - else: - self.design_moment = round(self.Mdv/1000000,1) - if self.support_type == 'Major Laterally Unsupported': - self.critical_moment = round(self.M_cr/1000000,1) - self.torsion_cnst = round(self.It/10000,0) - self.warping_cnst = round(self.Iw/1000000,0) - self.intstiffener_thk = self.IntStiffThickness - self.longstiffener_thk = self.LongStiffThickness - self.intstiffener_spacing = self.c - self.design_status = True - - - - - - def effective_length_beam(self, design_dictionary, length): - if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': - self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported(Torsional=self.torsional_res,Warping=self.warping, - length=length,depth=(self.total_depth/1000),load=self.loading_condition) - print(f"Working 1 {self.effective_length}") - else: - try: - if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: - design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' - else: - length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) - - self.effective_length = length - print(f"Working 2 {self.effective_length}") - except: - print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) - logger.warning("Invalid Effective Length Parameter.") - logger.info('Effective Length Parameter is set to default: 1.0') - design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' - self.effective_length_beam(self, design_dictionary, length) - print(f"Working 3 {self.effective_length}") - print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) - - - - def web_buckling_check(self): - self.web_buckling = IS800_2007.cl_8_2_1_web_buckling( - d=self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness), - tw=self.web_thickness, - e=self.epsilon,) - print("Web buckling",self.web_buckling) - - # if not self.web_buckling_check: - # self.web_not_buckling_steps(self) - - def shear_buckling_check_simple_postcritical(self,eff_depth,A_vg,V,c=0): - if self.web_philosophy == 'Thick Web without ITS': - K_v = 5.35 - else: - if c/eff_depth < 1: - K_v = 4 + 5.35/(c/eff_depth)**2 - else: - K_v = 5.35 + 4/(c/eff_depth)**2 - E = self.material.modulus_of_elasticity - mu = 0.3 - tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) - lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) - tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) - self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) - print("V_cr value",self.V_cr) - if self.V_cr > V: - return True - else: - return False - - def shear_buckling_check_intermediate_stiffner(self,d,IntStiffThickness,IntStiffnerwidth,V_cr,tw): - I_x = ((((IntStiffnerwidth * 2) + tw )** 3 * (IntStiffThickness )) / 12)-(IntStiffThickness * tw ** 3 / 12) - A_s = IntStiffnerwidth * IntStiffThickness * 2 - r_x = (I_x / A_s) ** 0.5 - le = self.lefactor * d - slenderness_input = le / r_x - dataframe = IS800_2007.cl_7_1_2_1_design_compressisive_stress_fcd_buckling_class_c() - interp_val = self.interpolate_value(self,slenderness_input, self.material.fy,dataframe) - fcd = round(interp_val, 2) - self.Critical_buckling_load = round(A_s * fcd / 1000, 2) - print("Shear force ",self.load.shear_force) - self.F_q = (self.load.shear_force - V_cr) /self.gamma_m0 - print("Shear intermeditate stiffner f_q , cbl",self.F_q,self.Critical_buckling_load) - if self.F_q < self.Critical_buckling_load: - return True - else: - return False - - - def design_longitudinal_stiffeners(self,d, tw, c, eps_w, second_stiffener=False): - """ - Determine whether horizontal (longitudinal) stiffeners are required in a plate girder - and compute the minimum required second moment of area Is. - - Parameters - ---------- - d : float - Clear depth of web (distance between flanges), in mm (or consistent units). - tw : float - Web thickness, in mm. - c : float - Clear distance from compression - flange angles to the neutral axis, in mm. - eps_w : float - Web slenderness parameter ε_w = √(E/Fy), unitless. - second_stiffener : bool, optional - If True, assume a stiffener at the neutral axis will be provided (enabling Eq. 2.39). - - Returns - ------- - dict - { - 'required' : bool, # Is any stiffener required? - 'slenderness' : float, # Governing slenderness ratio used - 'limit' : float, # Allowable slenderness limit - 'locations' : tuple, # (x1, x2), distances from comp. flange to stiffeners - 'I1_min' : float, # Eq. 2.40: first stiffener Is ≥ 4·c·t_w³ - 'I2_min' : float, # Eq. 2.41: second stiffener Is ≥ d2²·t_w³, where d2=2·c - 'Imin_global' : float, # Eqs. 2.42 - 2.43: overall minimum stiffener Is - 'Is_required' : float # Governing Is = max(I1_min, I2_min, Imin_global) - } - - Notes - ----- - - Uses Eq. 2.36 - 2.38 for the unstiffened web checks; if `second_stiffener=True`, uses - Eq. 2.39 (d/tw ≤ 400·ε_w) instead. - - Locations: x1 = c/5 from compression flange; x2 = 0 (neutral axis). - """ - # 1) determine slenderness check - if second_stiffener: - # Eq. 2.39: when a stiffener is at the neutral axis - slenderness = d / tw - limit = 400 * eps_w - else: - if 2.4*d >= c >= d: - # Eq. 2.36 - slenderness = d / tw - limit = 250 * eps_w - elif d > c >= 0.74*d: - # Eq. 2.37 - slenderness = c / tw - limit = 250 * eps_w - else: - # c < 0.74 d → Eq. 2.38 - slenderness = d / tw - limit = 340 * eps_w - - required = slenderness > limit - - # 2) stiffener locations - x1 = c / 5.0 # first stiffener at 1/5 of c - x2 = 0.0 # second stiffener at neutral axis - - # 3) design criteria for Is - I1_min = 4.0 * c * tw**3 # Eq. 2.40 - d2 = 2.0 * c # twice clear distance to NA - I2_min = d2**2 * tw**3 # Eq. 2.41 - - # 4) global minimum (Eqs. 2.42–2.43) - cd_ratio = c / d - if cd_ratio >= math.sqrt(2): - Imin_global = 0.75 * d * tw**3 - else: - Imin_global = (1.5 * d * tw**3) / (c**2) - - Is_required = max(I1_min, I2_min, Imin_global) - Is_provided = (self.eff_width_longitudnal * (self.LongStiffThickness ** 3)) / 12 - - print("Req",Is_required,"Prov",Is_provided) - print(f"'required': {required} 'slenderness': {slenderness} 'limit': {limit},'locations': {(x1, x2)} 'I1_min': {I1_min} 'I2_min': {I2_min} 'Imin_global': {Imin_global} 'Is_required': {Is_required}") - - if Is_required > Is_provided: - return True - else: - return False - - # return { - # 'required': required, - # 'slenderness': slenderness, - # 'limit': limit, - # 'locations': (x1, x2), - # 'I1_min': I1_min, - # 'I2_min': I2_min, - # 'Imin_global': Imin_global, - # 'Is_required': Is_required - # } - - - - def simple_post_critical_end_stiffener(self,d, tw, fyw, V_cr, gamma_m0, c): - """ - Calculates simple-post critical end-panel stiffener requirements. - Parameters: - d : float : depth of web panel (mm) - tw : float : thickness of web (mm) - fyw : float : yield stress of web (MPa or N/mm²) - flange_width : float : outstanding flange width (mm) - gamma_m0 : float : partial safety factor for material - c : float : Stiffener spacing (mm) - - V_cr: critical shear buckling force (kN) - V_dp: panel shear strength (kN) - H_q: horizontal anchor force (kN) - R_tf: reaction force at stiffener (kN) - M_tf: moment demand at stiffener (kN·m) - stiffener_width: recommended stiffener width (mm) - max_thickness: maximum allowable stiffener thickness (mm) - """# Panel shear strength V_dp (kN) - V_dp = (d * tw * fyw / math.sqrt(3)) / 1000 - # Horizontal anchor force H_q (kN) - if V_dp <= V_cr: - # raise ValueError("Stiffeners not required: V_dp <= V_cr") - logger.error("Stiffeners not required: V_dp <= V_cr") - H_q = 0 - else: - H_q = 1.25 * V_dp * math.sqrt(1 - (V_cr / V_dp)) - # Reaction force R_tf (kN) - R_tf = H_q / 2 - A_v= d * tw - V_n= (fyw * A_v) /( 1000 * math.sqrt(3) * gamma_m0) - # Moment demand M_tf (kN·m) - M_tf = (H_q * d) / 10 - y = c / 2 - I = tw * c ** 3 / 12 - M_q = (I * fyw) / (gamma_m0 * y) - if V_n >= R_tf: - if M_q >= M_tf: - return True - return False - - def tension_field_end_stiffner(self,d,tw,fyw,V_tf,V_cr,shear_force,moment): - # Formula 1: H_q = 1.25·V_p·√[1 – (V_cr–V_p)/(V_tf–V_cr)] - V_dp = (d * tw * fyw * math.sqrt(3)) / 1000 - denom = V_tf - V_cr - rad = 1.0 - (V_cr - V_dp) / denom - if rad < 0: - raise ValueError(f"Negative radicand under sqrt: {rad:.3f}") - H_q = 1.25 * V_dp * math.sqrt(rad) - R_tf = H_q / 2 - A_v= d * tw - V_n= (fyw * A_v) /( 1000 * math.sqrt(3) * self.gamma_m0) - # Moment demand M_tf (kN·m) - M_tf = (H_q * d) / 10 - y = c / 2 - I = tw * c ** 3 / 12 - M_q = (I * fyw) / (self.gamma_m0 * y) - if V_n >= R_tf: - if M_q >= M_tf: - return True - return False - - - - def shear_buckling_check_tension_field(self,eff_depth,A_vg,c=0,Nf = 0): - if self.web_philosophy == 'Thick Web without ITS': - K_v = 5.35 - else: - if c/eff_depth < 1: - K_v = 4 + 5.35/(c/eff_depth)**2 - else: - K_v = 5.35 + 4/(c/eff_depth)**2 - E = self.material.modulus_of_elasticity - mu = 0.3 - tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(K_v, E,mu, eff_depth, self.web_thickness) - lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.material.fy, tau_crc) - tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(lambda_w, self.material.fy) - self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(tau_b, A_vg) - phi,M_fr,s, w_tf,sai,fv,self.V_tf = IS800_2007.cl_8_4_2_2_TensionField( c, eff_depth, self.web_thickness, self.material.fy, self.top_flange_width,self.top_flange_thickness, self.material.fy,Nf, self.gamma_m0, A_vg,tau_b,self.load.shear_force) - print("vtf val",self.V_tf) - if self.V_tf >= self.load.shear_force: - return True - else: - return False - - def bending_check_lat_unsupported(self,beta_b_lt, plast_sec_mod_z, elast_sec_mod_z, fy, M_cr,section_class): - self.lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment(beta_b_lt,plast_sec_mod_z,elast_sec_mod_z,fy,M_cr) - - self.phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt(self.alpha_lt, self.lambda_lt) - self.X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor(self.phi_lt, self.lambda_lt) - self.fbd_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress(self.X_lt,fy, self.gamma_m0) - self.Md = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength(plast_sec_mod_z,elast_sec_mod_z,self.fbd_lt,section_class) - - - return round(self.Md,2) - - - def calc_Mdv(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): #only for major laterally supp - """ - Calculate Mdv for high shear conditions. - - Parameters: - V : Factored applied shear force - Vd : Design shear strength governed by web yielding/buckling - Zp : Plastic section modulus of the section (Z-axis) - Ze : Elastic section modulus of the section (Z-axis) - Fy : Yield strength of material - gamma_m0 : Partial safety factor for material - D : Total depth of section - tw : Thickness of the web - tf_top : Thickness of the top flange - tf_bot : Thickness of the bottom flange - - Returns: - Mdv : Design bending strength under high shear condition - """ - - # Calculating beta - beta = (2 * V / Vd - 1) ** 2 - - # Calculating Aw and Zfd - d = D - (tf_top + tf_bot) - Aw = d * tw - Zfd = Zp - (Aw * D / 4) - print("Aw",Aw,"Zfd",Zfd) - - # Calculating Mfd - Mfd = Zfd * Fy / gamma_m0 - - - # Calculating Md (Plastic Design Moment) - Md = Zp * Fy / gamma_m0 - - # Calculating Mdv - Mdv = Md - beta * (Md - Mfd) - - # Limiting value as per the provided formula - Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 - print("Mfd",Mfd/1000000,"Mdv",Mdv/1000000, "Mdv_limit",Mdv_limit/1000000) - - return round(min(Mdv, Mdv_limit), 2) - - def calc_Mdv_lat_unsupported(self,V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot,Md): #only for major laterally supp - """ - Calculate Mdv for high shear conditions. - - Parameters: - V : Factored applied shear force - Vd : Design shear strength governed by web yielding/buckling - Zp : Plastic section modulus of the section (Z-axis) - Ze : Elastic section modulus of the section (Z-axis) - Fy : Yield strength of material - gamma_m0 : Partial safety factor for material - D : Total depth of section - tw : Thickness of the web - tf_top : Thickness of the top flange - tf_bot : Thickness of the bottom flange - - Returns: - Mdv : Design bending strength under high shear condition - """ - - # Calculating beta - beta = (2 * V / Vd - 1) ** 2 - - # Calculating Aw and Zfd - d = D - (tf_top + tf_bot) - Aw = d * tw - Zfd = Zp - (Aw * D / 4) - print("Aw", Aw, "Zfd", Zfd) - # Calculating Mfd - Mfd = Zfd * Fy / gamma_m0 - - # Calculating Mdv - Mdv = Md - beta * (Md - Mfd) - - # Limiting value as per the provided formula - Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 - print("Mfd",Mfd,"Mdv",Mdv, "Mdv_limit",Mdv_limit) - return round(min(Mdv, Mdv_limit), 2) - - def get_K_from_warping_restraint(self,warping_condition): - """ - Return effective length factor K based on exact warping restraint description (IS 800:2007, Clause E.1). - """ - if warping_condition == "Both flanges fully restrained": - return 0.5 - elif warping_condition == "Compression flange fully restrained": - return 0.7 - elif warping_condition == "Compression flange partially restrained": - return 0.85 - elif warping_condition == "Warping not restrained in both flanges": - return 1.0 - else: - raise ValueError("Invalid warping restraint. Use one of the four standard conditions.") - - def calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D): - """ - Calculate yj per IS 800:2007 Clause E.3.2.2. Returns 0 for symmetric sections. - """ - if Bf_top == Bf_bot and tf_top == tf_bot: - return 0.0 # symmetric section - h = D - (tf_top + tf_bot) - Ift = (Bf_top * tf_top**3) / 12 - Ifc = (Bf_bot * tf_bot**3) / 12 - beta_f = Ifc / (Ifc + Ift) - alpha = 0.8 if beta_f > 0.5 else 1.0 - return alpha * (2 * beta_f - 1) * h / 2 - - def calc_Mcr_LoadingCase(self,E, G, Iy, It, Iw, LLT, Kw, D, - tf_top, tf_bot, Bf_top, Bf_bot, - LoadingCase, warping_condition): - """ - Calculate Elastic Critical Moment Mcr based on IS 800:2007 (Annex E or Eq 2.20 for symmetric). - Returns: - Mcr : Elastic Critical Moment in N·mm - """ - yg = D / 2 - yj = self.calc_yj(self,Bf_top, tf_top, Bf_bot, tf_bot, D) - K_value = 0 - # Constants from Table 42 (IS 800:2007) - if LoadingCase == KEY_DISP_UDL_PIN_PIN_PG: - K_value == 1.0 - c1, c2, c3 = 1.132, 0.459, 0.525 - elif LoadingCase == KEY_DISP_UDL_FIX_FIX_PG: - K_value == 0.5 - c1, c2, c3 = 0.712, 0.652, 1.070 - elif LoadingCase == KEY_DISP_PL_PIN_PIN_PG: - K_value == 1.0 - c1, c2, c3 = 1.365, 0.553, 1.780 - elif LoadingCase == KEY_DISP_PL_FIX_FIX_PG: - K_value == 0.5 - c1, c2, c3 = 0.938, 0.715, 4.800 - else: - raise ValueError("Invalid Loading Case.") - - # Symmetric section (Eq 2.20) - if Bf_top == Bf_bot and tf_top == tf_bot: - term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) - term2 = (Iw / Iy) - term3 = (G * It * LLT**2) / (math.pi**2 * E * Iy) - Mcr = term1 * math.sqrt(term2 + term3) - print("It", It, "Iw", Iw, "LLT", LLT, "E", E, "I", Iy, "G", G) - else: - # Unsymmetric case (Annex E full formula) - term1 = (math.pi ** 2 * E * Iy) / (LLT ** 2) - bracket = ((K_value / Kw) ** 2 * (Iw / Iy) + - (G * It * LLT ** 2) / (math.pi ** 2 * E * Iy) + - (c2 * yg - c3 * yj) ** 2) - Mcr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) - print("It", It, "Iw", Iw, "LLT", LLT, "E", E, "I", Iy, "G", G) - return Mcr # in N·mm - - def shear_stress_unsym_I(self, V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w): - - # Part areas [mm^2] - A_t = b_ft * t_ft - A_b = b_fb * t_fb - A_w = t_w * h_w - - # Section total depth & area - D = t_fb + h_w + t_ft - A = A_t + A_b + A_w - - # Centroid y‐coords from bottom of bottom flange [mm] - y_b = t_fb/2 - y_w = t_fb + h_w/2 - y_t = t_fb + h_w + t_ft/2 - - # Neutral axis from bottom [mm] - y_na = (A_b*y_b + A_w*y_w + A_t*y_t) / A - - # Second moment I_z [mm^4] - I_b = b_fb*t_fb**3/12 + A_b*(y_b - y_na)**2 - I_w = t_w *h_w**3/12 + A_w*(y_w - y_na)**2 - I_t = b_ft*t_ft**3/12 + A_t*(y_t - y_na)**2 - I_z = I_b + I_w + I_t - - # First moments Q [mm^3] - Q_bot = A_b * abs(y_na - y_b) - Q_top = A_t * abs(y_t - y_na) - - # Shear flows q = V*Q / I [kN·mm^3 / mm^4 = kN/mm] - q_bot = V_ed * Q_bot / I_z - q_top = V_ed * Q_top / I_z - - return { - 'y_na_mm': y_na, 'I_z_mm4': I_z, - 'Q_top_mm3': Q_top,'Q_bot_mm3': Q_bot, - 'q_top_kN_per_mm': q_top, - 'q_bot_kN_per_mm': q_bot, - } - - def weld_leg_from_q_with_cl10(self, - q_kN_per_mm, # shear flow [kN/mm] - ultimate_stresses, # list of MPa - fabrication='shop' -): - """ - Compute fillet‐weld leg a [mm] from shear flow, - using f_wd from cl.10.5.7.1.1. - """ - # 1) get f_wd in MPa → convert to N/mm² - f_wd = IS800_2007.cl_10_5_7_1_1_fillet_weld_design_stress( - ultimate_stresses, fabrication - ) # MPa - - # 2) convert q to N/mm - q_N_per_mm = q_kN_per_mm * 1e3 - - # 3) throat thickness t = q / f_wd [mm] - t_throat = q_N_per_mm / f_wd - - # 4) leg size a = t·√2 - return t_throat * math.sqrt(2) - - def design_welds_with_strength_web_to_flange(self, - # section loads & geometry - V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w, - # material / weld properties - ultimate_stresses, fabrication, - # stiffener inputs - t_st, b_st, V_unstf, L_weld -): - # compute shear flows - sf = self.shear_stress_unsym_I(self,V_ed, b_ft, t_ft, b_fb, t_fb, t_w, h_w) - - # weld legs using cl.10 strength - a_top = self.weld_leg_from_q_with_cl10(self, - sf['q_top'], ultimate_stresses, fabrication - ) - a_bot = self.weld_leg_from_q_with_cl10(self, - sf['q_bot'], ultimate_stresses, fabrication - ) - - # end‐stiffener check (unchanged) - - return { - **sf, - 'a_top_mm': a_top, - 'a_bot_mm': a_bot - } - - def weld_for_end_stiffener_autoL(self, - # stiffener - t_st, b_st, # thickness & height [mm] - # loads - V_ed, V_unstf, # design shear & unstiffened capacity [kN] - # section geometry - D, t_ft, t_fb # overall depth & flange thicknesses [mm] -): - """ - Automatically computes L_weld = D - t_ft - t_fb, - then returns: - q1_min = t_st^2/(5·b_st) - q2_ext = (V_ed–V_unstf)/L_weld - q_total = q1 + q2 - q_each_weld = q_total/2 - All in kN/mm. - """ - # 0) available weld length - L_weld = D - t_ft - t_fb - - # 1) min weld per side - q1 = t_st**2 / (5 * b_st) - - # 2) stiffener shear per unit length - delta_V = max(V_ed - V_unstf, 0) - q2 = delta_V / L_weld - - # 3) total on one side - q_tot = q1 + q2 - - # 4) split into two welds (each face) - q_each = q_tot / 2 - - return { - 'L_weld_mm': L_weld, - 'q1_min': q1, - 'q2_ext': q2, - 'q_total': q_tot, - 'q_each_weld': q_each - } - - def deflection_from_moment_kNm_mm(self,M_kNm, L_mm, E, I, case): - """ - Compute max mid-span deflection from bending moment, - converting M (kN·m) → N·m and L (mm) → m internally. - - Parameters - ---------- - M_kNm : float - Max bending moment in kN·m. - L_mm : float - Span length in mm. - E : float - Young’s modulus in Pa (N/m²). - I : float - Second moment of area in m^4. - case : str - One of 'simple_udl', 'fixed_udl', 'simple_point', 'fixed_point'. - - Returns - ------- - delta : float - Mid-span deflection in meters. - """ - # unit conversions - M = M_kNm * 1e3 # kN·m → N·m - L = L_mm / 1e3 # mm → m - - pref = M * L ** 2 / (E * I) - if case == 'simple_udl': - return (5 / 48) * pref - elif case == 'fixed_udl': - return (1 / 32) * pref - elif case == 'simple_point': - return (1 / 12) * pref - elif case == 'fixed_point': - return (1 / 24) * pref - else: - raise ValueError( - "Unknown case. Use 'simple_udl', 'fixed_udl', 'simple_point', or 'fixed_point'." - ) - - - def evaluate_deflection_kNm_mm(self, - M_kNm, L_mm, E, I, case, criteria_list=VALUES_MAX_DEFL - ): - """ - 1) Calculate deflection from moment (with unit conversions). - 2) Compare against span-based limits. - Returns (delta_m, results_dict, best_criterion). - """ - # 1) compute deflection in meters - delta = self.deflection_from_moment_kNm_mm(self,M_kNm, L_mm, E, I, case) - L = L_mm / 1e3 # span in meters - - # 2) compare against each 'Span/N' limit - results = {} - passed = [] - for crit in criteria_list: - try: - _, denom = crit.split('/') - n = float(denom) - except ValueError: - continue - allowable = L / n - ok = (delta <= allowable) - results[crit] = { - 'allowable_m': allowable, - 'actual_m': delta, - 'passes': ok - } - if ok: - passed.append((n, crit)) - - # pick most stringent (smallest denom) that still passes - best = min(passed)[1] if passed else None - - return delta, results - - #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - def section_classification1(self, design_dictionary,trial_section=""): - """Classify the sections based on Table 2 of IS 800:2007""" - print(f"Inside section_classification") - local_flag = True - self.input_modified = [] - self.input_section_list = [] - self.input_section_classification = {} - lambda_check = False - for trial_section in self.sec_list: - trial_section = trial_section.strip("'") - self.section_property = self.section_connect_database(self, trial_section) - print(f"Type of section{self.section_property.designation}") - if self.section_property.type == "Rolled": - web_class = IS800_2007.Table2_iii( - self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius), - self.section_property.web_thickness, - self.material_property.fy, - ) - flange_class_bottom = IS800_2007.Table2_i( - self.section_property.flange_width / 2, - self.section_property.flange_thickness, - self.material_property.fy,self.section_property.type - )[0] - web_ratio = (self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius)) / self.section_property.web_thickness - flange_ratio = self.section_property.flange_width / 2 /self.section_property.flange_thickness - else: - flange_class_bottom = IS800_2007.Table2_i( - ( - (self.section_property.flange_width / 2) - # - (self.section_property.web_thickness / 2) - ), - self.section_property.flange_thickness, - self.section_property.fy, - self.section_property.type, - )[0] - - web_class = IS800_2007.Table2_iii( - ( - self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius) - ), - self.section_property.web_thickness, - self.material_property.fy, # classification_type="Axial compression", - ) - web_ratio = (self.section_property.depth - 2 * ( - self.section_property.flange_thickness + self.section_property.root_radius)) / self.section_property.web_thickness - flange_ratio = self.section_property.flange_width / 2 / self.section_property.flange_thickness - print(f"\n \n \n flange_class_bottom {flange_class_bottom} \n web_class{web_class} \n \n") - if flange_class_bottom == "Slender" or web_class == "Slender": - self.section_class = "Slender" - else: - if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic: - self.section_class = KEY_Plastic - elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact: - self.section_class = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact: - self.section_class = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact: - self.section_class = KEY_SemiCompact - - self.Zp_req = self.load.moment * self.gamma_m0 / self.material_property.fy - self.effective_length_beam(self, design_dictionary, self.length) # mm - - print( 'self.allow_class', self.allow_class) - if self.section_property.plast_sec_mod_z >= self.Zp_req: - print( 'self.section_property.plast_sec_mod_z More than Requires') - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.It = self.section_property.It - # ( - # 2 - # * self.section_property.flange_width - # * self.section_property.flange_thickness ** 3 - # ) / 3 + ( - # (self.section_property.depth - self.section_property.flange_thickness) - # * self.section_property.web_thickness ** 3 - # ) / 3 - self.hf = self.section_property.depth - self.section_property.flange_thickness - self.Iw = self.section_property.Iw - # 0.5 ** 2 * self.section_property.mom_inertia_y * self.hf ** 2 - - - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - self.beta_b_lt = 1.0 - else: - self.beta_b_lt = ( - self.section_property.elast_sec_mod_z - / self.section_property.plast_sec_mod_z - ) - _ = IS800_2007.cl_8_2_2_Unsupported_beam_bending_non_slenderness( - self.material_property.modulus_of_elasticity, - 0.3, - self.section_property.mom_inertia_y, - self.It, - self.Iw, - self.effective_length * 1e3, self.beta_b_lt, self.section_property.plast_sec_mod_z, self.hf, self.section_property.rad_of_gy_y, self.section_property.flange_thickness - ) - self.M_cr = _[0] - self.fcrb = _[1] - lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment( - self.beta_b_lt, - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - self.material_property.fy, - self.M_cr - ) - if lambda_lt < 0.4: - lambda_check = True - continue - if self.allow_class != 'No': - if ( - self.section_class == KEY_SemiCompact - or self.section_class == KEY_Compact - or self.section_class == KEY_Plastic - ): - - self.input_section_list.append(trial_section) - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio,self.It,self.hf,self.Iw,self.M_cr,self.beta_b_lt,lambda_lt,self.fcrb]}) - else: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio]}) - - elif self.section_class == "Slender": - logger.warning(f"The section.{trial_section} is Slender. Ignoring") - else: - if self.section_class == KEY_Compact or self.section_class == KEY_Plastic: - self.input_section_list.append(trial_section) - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio,self.It,self.hf,self.Iw,self.M_cr,self.beta_b_lt,lambda_lt, self.fcrb]}) - else: - self.input_section_classification.update({trial_section: [self.section_class, flange_class_bottom, web_class, flange_ratio, web_ratio]}) - elif self.section_class == "Slender": - logger.warning(f"The section.{trial_section} is Slender. Ignoring") - # self.design_status = False - # self.design_status_list.append(self.design_status) - elif self.section_class == KEY_SemiCompact: - logger.warning( - f"The section.{trial_section} is Semi-Compact. Ignoring" - ) - # self.design_status = False - # self.design_status_list.append(self.design_status) - if lambda_check: - logger.info("After checking Non-dimensional slenderness ratio for given sections, some sections maybe be ignored by Osdag.[Ref IS 8.2.2] ") - if len(self.input_section_list) == 0: - local_flag = False - else: - local_flag = True - return local_flag - - def design(self, design_dictionary, flag=0): - ''' - TODO optimimation_tab_check changes to include self.material_property = Material(material_grade=self.material, thickness=0) - for each section - ''' - - self.optimization_tab_check(self) - - self.design_beam(self, design_dictionary) - - def optimization_tab_check(self): - ''' - TODO add button to give user option to take Tension holes or not - ''' - print(f"\n Inside optimization_tab_check") - self.latex_tension_zone = False - if (self.effective_area_factor <= 0.10) or (self.effective_area_factor > 1.0): - logger.error( - "The defined value of Effective Area Factor in the design preferences tab is out of the suggested range." - ) - logger.info("Provide an appropriate input and re-design.") - logger.warning("Assuming a default value of 1.0.") - self.effective_area_factor = 1.0 - # self.design_status = False - # self.design_status_list.append(self.design_status) - self.optimization_tab_check(self) - elif (self.steel_cost_per_kg < 0.10) or (self.effective_area_factor > 1.0) or (self.effective_area_factor < 0): - # No suggested range in Description - logger.warning( - "The defined value of the effective area factor in the design preferences tab is out of the suggested range." - ) - # logger.info("Provide an appropriate input and re-design.") - logger.info("Assuming a default value of 1.0") - self.steel_cost_per_kg = 50 - self.effective_area_factor = 1 - self.design_status = False - # self.design_status_list.append(self.design_status) - else: - if self.latex_tension_zone: - if self.effective_area_factor >= (self.material_property.fy * self.gamma_m0 / (self.material_property.fu * 0.9 * self.gamma_m1)): - pass - else: - self.latex_tension_zone = True - print(f'self.latex_tension_zone: {self.latex_tension_zone}') - # self.effective_area_factor = ( - # self.material_property.fy - # * self.gamma_m0 - # / (self.material_property.fu * 0.9 * self.gamma_m1) - # ) - # logger.info( - # f"The effect of holes in the tension flange is considered on the design bending strength. The ratio of net to gross area of the flange in tension is considered {self.effective_area_factor}" - # ) - - logger.info("Provided appropriate design preference, now checking input.") - - def input_modifier(self): - """Classify the sections based on Table 2 of IS 800:2007""" - print(f"Inside input_modifier") - local_flag = True - self.input_modified = [] - self.input_section_list = [] - # self.input_section_classification = {} - - for section in self.sec_list: - section = section.strip("'") - self.section_property = self.section_connect_database(self, section) - - self.Zp_req = self.load.moment * self.gamma_m0 / self.material_property.fy - print('Inside input_modifier not allow_class',self.allow_class,self.load.moment, self.gamma_m0, self.material_property.fy) - if self.section_property.plast_sec_mod_z >= self.Zp_req: - - self.input_modified.append(section) - # logger.info( - # f"Required self.Zp_req = {round(self.Zp_req * 10**-3,2)} x 10^3 mm^3 and Zp of section {self.section_property.designation} = {round(self.section_property.plast_sec_mod_z* 10**-3,2)} x 10^3 mm^3.Section satisfy Min self.Zp_req value") - # else: - # local_flag = False - - # logger.warning( - # f"Required self.Zp_req = {round(self.Zp_req* 10**-3,2)} x 10^3 mm^3 and Zp of section {self.section_property.designation} = {round(self.section_property.plast_sec_mod_z* 10**-3,2)} x 10^3 mm^3.Section dosen't satisfy Min self.Zp_req value") - # logger.info("") - print("self.input_modified", self.input_modified) - - def section_connect_database(self, section): - print(f"section_connect_database{section}") - print(section) - # print(self.sec_profile) - if ( - self.sec_profile == VALUES_SECTYPE[1] - or self.sec_profile == "I-section" - ): # I-section - self.section_property = ISection( - designation=section, material_grade=self.material - ) - self.material_property.connect_to_database_to_get_fy_fu( - self.material, max(self.section_property.flange_thickness, self.section_property.web_thickness) - ) - print(f"section_connect_database material_property.fy{self.material_property.fy}") - self.epsilon = math.sqrt(250 / self.material_property.fy) - return self.section_property - - def design_beam(self, design_dictionary): - # 1- Based on optimum UR - self.optimum_section_ur_results = {} - self.optimum_section_ur = [] - - # 2 - Based on optimum cost - self.optimum_section_cost_results = {} - self.optimum_section_cost = [] - - # 1 - section classification - self.flag = self.section_classification(self,design_dictionary) - - print('self.flag:',self.flag) - if self.effective_area_factor < 1.0: - logger.warning( - "Reducing the effective sectional area as per the definition in the Design Preferences tab." - ) - else: - logger.info( - "The effective sectional area is taken as 100% of the cross-sectional area [Reference: Cl. 7.3.2, IS 800:2007]." - ) - # Effective length - print( - f"self.effective_length {self.effective_length} \n self.input_section_classification{self.input_section_classification} ") - print('self.input_section_list:',self.input_section_list) - if self.flag: - for section in self.input_section_list: - # initialize lists for updating the results dictionary - self.section_property = self.section_connect_database(self, section) - if self.section_property.type == 'Rolled': - self.effective_depth = (self.section_property.depth - 2 * ( - self.section_property.flange_thickness + self.section_property.root_radius)) - else: - self.effective_depth = (self.section_property.depth - 2 *self.section_property.flange_thickness ) - print('self.section_property.type:',self.section_property.type, self.bending_type) - - if self.sec_profile == 'Beams' or self.sec_profile == 'Columns' or self.sec_profile == VALUES_SECTYPE[1]: - if self.section_property.type == "Rolled" and self.bending_type == KEY_DISP_BENDING1: - self.shear_area = self.section_property.depth * self.section_property.web_thickness - elif self.section_property.type != "Rolled" and self.bending_type == KEY_DISP_BENDING1: - self.shear_area = self.effective_depth * self.section_property.web_thickness - elif self.bending_type == KEY_DISP_BENDING2: - self.shear_area = 2 * self.section_property.flange_width * self.section_property.flange_thickness - - self.effective_length_beam(self, design_dictionary, self.length) # mm - - # Step 1.1 - computing the effective sectional area - self.effective_area = self.section_property.area - self.common_checks_1(self, section, step=2) - - - list_result = [] - list_1 = [] - list_result.append(section) - self.section_class = self.input_section_classification[section][0] - print(f"Inside design_beam self.design_type:{self.design_type}") - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - self.It = self.input_section_classification[section][ 5 ] - self.hf = self.input_section_classification[section][ 6 ] - self.Iw = self.input_section_classification[section][ 7 ] - self.M_cr = self.input_section_classification[section][ 8 ] - self.beta_b_lt = self.input_section_classification[section][ 9 ] - self.lambda_lt = self.input_section_classification[section][ 10 ] - self.fcrb = self.input_section_classification[section][ 11 ] - print('self.design_type:',self.design_type, self.It, - self.hf, - self.Iw, - self.M_cr, - self.beta_b_lt, - self.lambda_lt) - - self.beam_web_buckling(self) - if self.web_buckling_check: - self.web_not_buckling_steps(self) - - # self.shear_strength = IS800_2007.cl_8_4_design_shear_strength( - # self.shear_area, - # self.material_property.fy - # ) / 10 ** 3 - # self.high_shear_check = IS800_2007.cl_8_2_1_2_high_shear_check( - # self.load.shear_force / 1000, self.shear_strength - # ) - # self.bending_strength_section = self.bending_strength() / 10 ** 6 - - # self.web_buckling_steps(self) - # self.high_shear_check = False - # self.bending_strength_section = self.bending_strength_girder(self) / 10 ** 6 - - # print(f"Common result {list_result, self.section_class, self.V_d, self.high_shear_check, self.bending_strength_section}") - print('self.bending_strength_section',self.bending_strength_section,'self.shear_strength',self.shear_strength, 'self.load.moment',self.load.moment,'self.load.shear_force',self.load.shear_force) - # 2.8 - UR - self.ur = max((self.load.moment / self.bending_strength_section * 10 ** -6),(self.load.shear_force / self.shear_strength * 10 ** -3))# ( + round(self.load.axial_force / self.section_capacity, 3) - print("UR", self.ur) - # 2.9 - Cost of the section in INR - self.cost = ( - ( - self.section_property.unit_mass - * self.section_property.area - * 1e-4 - ) - * self.length - * self.steel_cost_per_kg - ) - self.optimum_section_cost.append(self.cost) - self.web_buckling = False # When Bearing length is provided - - if self.bearing_length != 'NA': #and self.web_crippling - print(f"Check for Web Buckling") - try: - self.bearing_length = float(design_dictionary[KEY_BEARING_LENGTH]) - self.web_buckling = True # WEB BUCKLING - self.I_eff_web = self.bearing_length * self.section_property.web_thickness ** 3 / 12 - self.A_eff_web = self.bearing_length * self.section_property.web_thickness - self.r = math.sqrt(self.I_eff_web / self.A_eff_web) - self.slenderness = 0.7 * self.effective_depth / self.r - self.common_checks_1(self, section, step=3) - # step == 4 - self.common_checks_1( - self, section, step=4, list_result=["Concentric"] - ) - # 2.7 - Capacity of the section for web_buckling - self.section_capacity = ( - self.design_compressive_stress * ( - self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness - * 10 ** -3) # N - print(self.design_compressive_stress, self.bearing_length, self.section_property.depth, - self.section_property.web_thickness) - - print(self.bending_strength_section, self.shear_strength, self.section_capacity) - - self.F_wb = (self.bearing_length + 2.5 * ( - self.section_property.root_radius + self.section_property.flange_thickness)) * self.section_property.web_thickness * self.material_property.fy / ( - self.gamma_m0 * 10 ** 3) - if self.bending_strength_section > self.load.moment * 10 ** -6 and self.shear_strength > self.load.shear_force * 10 ** -3 and self.section_capacity > self.load.shear_force * 10 ** -3 and self.F_wb > self.load.shear_force * 10 ** -3: - list_result, list_1 = self.list_changer(self, change='Web Buckling', check=True, - list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - else: - list_result, list_1 = self.list_changer(self, change='Web Buckling', check=True, - list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - except: - logger.warning('Bearing length is invalid.') - logger.info('Ignoring web Buckling and Crippling check') - self.bearing_length = 'NA' - self.web_buckling = False - # 2.8 - UR - print(self.bending_strength_section, self.shear_strength) - if self.bending_strength_section > self.load.moment * 10 ** -6 and self.shear_strength > self.load.shear_force * 10 ** -3: - list_result, list_1 = self.list_changer(self, change='', check=True,list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - - - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - else: - list_result, list_1 = self.list_changer(self, change='', check=True,list=list_result, list_name=list_1) - self.optimum_section_ur.append(self.ur) - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - - else: - self.web_buckling = False - # 2.8 - UR - print(self.bending_strength_section, self.shear_strength) - if self.bending_strength_section > self.load.moment * 10**-6 and self.shear_strength > self.load.shear_force * 10**-3: - - self.optimum_section_ur.append(self.ur) - list_result, list_1 = self.list_changer(self, change=' ', check=True, list=list_result, list_name=list_1) - - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - else: - self.optimum_section_ur.append(self.ur) - list_result, list_1 = self.list_changer(self, change=' ', check=True, list=list_result, list_name=list_1) - - # Step 3 - Storing the optimum results to a list in a descending order - self.common_checks_1(self, section, 5, list_result, list_1) - print('self.optimum_section_ur', self.optimum_section_ur) - - def beam_web_buckling(self): - - print(f"Working web_buckling_check") - # 3 - web buckling under shear - self.web_buckling_check = IS800_2007.cl_8_2_1_web_buckling( - d=self.effective_depth, - tw=self.section_property.web_thickness, - e=self.epsilon, - ) - print(self.web_buckling_check, self.section_property.designation) - - if not self.web_buckling_check: - self.web_not_buckling_steps(self) - def web_buckling_steps(self): - print(f"Not using web_buckling_steps") - # logger.info(f"Considering {self.support_cndition_shear_buckling}") - # 5 - Web Buckling check(when high shear) -If user wants then only - # if web_buckling: - # b1 = input('Enter bearing') - # self.web_buckling_strength = self.section_property.web_thickness * (b1 + 1.25 * self.section_property.depth) - # self.V_d = pass - # web_buckling_message = 'Thin web' - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - self.K_v = IS800_2007.cl_8_4_2_2_K_v_Simple_postcritical('only support') - self.plate_girder_strength(self) - # logger.info('Section = {}, V_cr = {}'.format(self.section_property.designation, round(self.V_cr,2))) - self.shear_strength = self.V_cr / self.gamma_m0 - # if self.V_d > self.load.shear_force * 10**-3: - # - # return True - # else: - # return False - # self.V_d = IS800_2007.cl_8_4_2_2_ShearBuckling_Simple_postcritical((self.section_property.depth - 2 *(self.section_property.flange_thickness + self.section_property.root_radius), - # self.section_property.web_thickness,space,0.3, self.fyw)) - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - self.V_p = IS800_2007.cl_8_4_design_shear_strength( - self.shear_area, - self.material_property.fy - ) / 10 ** 3 * self.gamma_m0 - self.Mfr = IS800_2007.cl_8_4_2_2_Mfr_TensionField(self.section_property.flange_width, - self.section_property.flange_thickness, self.fyf, - self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness), - self.gamma_m0) - print('MFr', self.Mfr) - if self.Mfr > 0: - print('Starting loop', int(round(self.effective_length*10**4/self.effective_depth,-1)/10)) - # for c_d in range(3,self.effective_length/self.result_eff_d): - for c_d in reversed(list(range(3,int(round(self.effective_length * 1000/self.effective_depth,-1))))): - print('c_d',c_d,'c/d',self.effective_length * 1000/self.effective_depth) - c_d = c_d/10 + 0.1 - self.c = round(c_d * self.effective_depth, -1) - print('c',self.c) - self.K_v = IS800_2007.cl_8_4_2_2_K_v_Simple_postcritical('many support', self.c, self.effective_depth) - self.plate_girder_strength2(self) - - self.shear_strength = self.V_tf_girder / self.gamma_m0 * 10**-3 - logger.info('Intermediate Stiffeners required d ={}, c = {}, Section = {}, V_tf = {}, V_d = {}'.format(self.effective_depth,self.c, - self.section_property.designation, - self.V_tf_girder,self.shear_strength)) - if self.shear_strength > self.load.shear_force * 10**-3: - return - return - else: - self.shear_strength = 0.1 - def web_not_buckling_steps(self): - print(f"Working web_not_buckling_steps") - self.V_d = IS800_2007.cl_8_4_design_shear_strength( - self.shear_area, - self.material_property.fy - ) / 10 ** 3 - self.shear_strength = self.V_d - self.high_shear_check = IS800_2007.cl_8_2_1_2_high_shear_check( - self.load.shear_force / 1000, self.V_d - ) - print(f"self.V_d {self.V_d},{self.section_property.depth* self.section_property.web_thickness}, {self.material_property.fy}") - # 4 - design bending strength - self.bending_strength_section = self.bending_strength(self) / 10 ** 6 - - - - def bending_strength(self): - print('Inside bending_strength ','\n self.section_class', self.section_class) - # 4 - design bending strength - M_d = IS800_2007.cl_8_2_1_2_design_bending_strength( - self.section_class, - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - self.material_property.fy, - self.gamma_m0, - self.support, - ) - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact : - self.beta_b_lt = 1 - else : - self.beta_b_lt = self.section_property.elast_sec_mod_z/self.section_property.plast_sec_mod_z - print('self.beta_b_lt: ',self.beta_b_lt) - self.M_d = M_d - if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: - if self.high_shear_check: - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self, M_d) - else: - bending_strength_section = ( - self.section_property.elast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ) - else: - bending_strength_section = M_d - print('Inside bending_strength 1', M_d, self.high_shear_check, bending_strength_section) - else: - print('self.design_type:',self.design_type, self.It, - self.hf, - self.Iw, - self.M_cr, - self.beta_b_lt, - self.lambda_lt, self.fcrb) - # self.It = ( - # 2 - # * self.section_property.flange_width - # * self.section_property.flange_thickness**3 - # ) / 3 + ( - # (self.section_property.depth - self.section_property.flange_thickness) - # * self.section_property.web_thickness**3 - # ) / 3 - # self.hf = self.section_property.depth - self.section_property.flange_thickness - # self.Iw = 0.5**2 * self.section_property.mom_inertia_y * self.hf**2 - # self.M_cr = IS800_2007.cl_8_2_2_Unsupported_beam_bending_non_slenderness( - # self.material_property.modulus_of_elasticity, - # 0.3, - # self.section_property.mom_inertia_y, - # self.It, - # self.Iw, - # self.effective_length * 1e3 - # ) - # - # if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - # self.beta_b_lt = 1.0 - # else: - # self.beta_b_lt = ( - # self.section_property.elast_sec_mod_z - # / self.section_property.plast_sec_mod_z - # ) - if self.section_property.type == "Rolled": - alpha_lt = 0.21 - else: - alpha_lt = 0.49 - # lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment( - # self.beta_b_lt, - # self.section_property.plast_sec_mod_z, - # self.section_property.elast_sec_mod_z, - # self.material_property.fy, - # self.M_cr - # ) - phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt( - alpha_lt, self.lambda_lt - ) - X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor( - phi_lt, self.lambda_lt - ) - fbd = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress( - X_lt, self.material_property.fy, self.gamma_m0 - ) - bending_strength_section = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength( - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - fcd=fbd, - section_class=self.section_class - ) - # self.beta_b_lt = beta_b - self.alpha_lt = alpha_lt - # self.lambda_lt = lambda_lt - self.phi_lt = phi_lt - self.X_lt = X_lt - self.fbd_lt = fbd - self.lateral_tb = self.M_cr * 10**-6 - print('Inside bending_strength 2.1', fbd, self.section_property.plast_sec_mod_z ) - if self.high_shear_check: - if self.section_class == KEY_Plastic or self.section_class == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self,Md=bending_strength_section - ) - else: - bending_strength_section = ( - self.beta_b_lt - * self.section_property.plast_sec_mod_z - * fbd - ) - print('Inside bending_strength 2',self.It,self.hf,self.Iw,self.M_cr ,self.beta_b_lt,alpha_lt,self.lambda_lt,phi_lt,X_lt,fbd,bending_strength_section) - self.bending_strength_section_reduced = bending_strength_section - return bending_strength_section - def bending_strength_girder(self): - print('Inside bending_strength of girder ') - web_class = IS800_2007.Table2_i( - (self.section_property.flange_width - self.section_property.web_thickness)/2, - self.section_property.flange_thickness, - self.material_property.fy, self.section_property.type - )[0] - flange_class_bottom = IS800_2007.Table2_i( - self.section_property.depth - 2 * self.section_property.flange_thickness, - self.section_property.web_thickness, - self.material_property.fy,self.section_property.type - )[0] - if flange_class_bottom == "Slender" or web_class == "Slender": - self.section_class_girder = "Slender" - else: - if flange_class_bottom == KEY_Plastic and web_class == KEY_Plastic: - self.section_class_girder = KEY_Plastic - elif flange_class_bottom == KEY_Plastic and web_class == KEY_Compact: - self.section_class_girder = KEY_Compact - elif flange_class_bottom == KEY_Plastic and web_class == KEY_SemiCompact: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Plastic: - self.section_class_girder = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_Compact: - self.section_class_girder = KEY_Compact - elif flange_class_bottom == KEY_Compact and web_class == KEY_SemiCompact: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Plastic: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_Compact: - self.section_class_girder = KEY_SemiCompact - elif flange_class_bottom == KEY_SemiCompact and web_class == KEY_SemiCompact: - self.section_class_girder = KEY_SemiCompact - # 4 - design bending strength - I_flange = 2 * (self.section_property.flange_width * self.section_property.flange_thickness**3/12 + self.section_property.flange_width * self.section_property.flange_thickness * (self.section_property.depth/2 - self.section_property.flange_thickness/2)**2) - Zez_flange = I_flange / self.section_property.depth /2 - y_top = (self.section_property.flange_width * self.section_property.flange_thickness * (self.section_property.depth - self.section_property.flange_thickness)/2) / (self.section_property.flange_width * self.section_property.flange_thickness) - Zpz_flange = 2 * self.section_property.flange_width * self.section_property.flange_thickness * y_top - M_d = IS800_2007.cl_8_2_1_2_design_bending_strength( - self.section_class_girder, - Zpz_flange, - Zez_flange, - self.material_property.fy, - self.gamma_m0, - self.support, - ) - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact : - self.beta_b_lt = 1 - else : - self.beta_b_lt = Zez_flange/Zpz_flange - self.M_d = M_d - if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: - if self.high_shear_check: - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self, M_d) - else: - bending_strength_section = ( - self.section_property.elast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ) - else: - bending_strength_section = M_d - print('Inside bending_strength 1', M_d, self.high_shear_check, bending_strength_section) - else: - # self.It = ( - # 2 - # * self.section_property.flange_width - # * self.section_property.flange_thickness**3 - # ) / 3 + ( - # (self.section_property.depth - self.section_property.flange_thickness) - # * self.section_property.web_thickness**3 - # ) / 3 - self.hf = self.section_property.depth - self.section_property.flange_thickness - # self.Iw = 0.5**2 * self.section_property.mom_inertia_y * self.hf**2 - self.fcrb = IS800_2007.cl_8_2_2_Unsupported_beam_bending_fcrb( - self.material_property.modulus_of_elasticity, - self.effective_length/self.section_property.rad_of_gy_y, - self.hf/self.section_property.flange_thickness - ) - - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: - self.beta_b_lt = 1.0 - else: - self.beta_b_lt = ( - self.section_property.elast_sec_mod_z - / self.section_property.plast_sec_mod_z - ) - if self.section_property.type == "Rolled": - alpha_lt = 0.21 - else: - alpha_lt = 0.49 - lambda_lt = IS800_2007.cl_8_2_2_1_elastic_buckling_moment_fcrb( - self.material_property.fy, self.fcrb - ) - phi_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_phi_lt( - alpha_lt, lambda_lt - ) - X_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_stress_reduction_factor( - phi_lt, lambda_lt - ) - fbd = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress( - X_lt, self.material_property.fy, self.gamma_m0 - ) - bending_strength_section = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength( - self.section_property.plast_sec_mod_z, - self.section_property.elast_sec_mod_z, - fcd=fbd, - section_class=self.section_class_girder - ) - - - # self.beta_b_lt = beta_b - self.alpha_lt = alpha_lt - # self.lambda_lt = lambda_lt - self.phi_lt = phi_lt - self.X_lt = X_lt - self.fbd_lt = fbd - self.lateral_tb = self.fcrb * 10**-6 - print('Inside bending_strength 2.1', fbd, self.section_property.plast_sec_mod_z ) - if self.high_shear_check: - if self.section_class_girder == KEY_Plastic or self.section_class_girder == KEY_Compact: - bending_strength_section = self.bending_strength_reduction(self,Md=bending_strength_section - ) - else: - bending_strength_section = ( - self.beta_b_lt - * self.section_property.plast_sec_mod_z - * fbd - ) - print('Inside bending_strength 2',self.It,self.hf,self.Iw,self.fcrb ,self.beta_b_lt,alpha_lt,lambda_lt,phi_lt,X_lt,fbd,bending_strength_section) - self.bending_strength_section_reduced = bending_strength_section - return bending_strength_section - def bending_strength_reduction(self, Md): - Zfd = ( - self.section_property.plast_sec_mod_z - - (self.section_property.depth**2 * self.section_property.web_thickness / 4) - ) - Mfd = Zfd * self.material_property.fy / self.gamma_m0 - beta = ((2 * self.load.shear_force / (self.shear_strength * 10**3)) - 1) ** 2 - Mdv = (Md - beta * (Md - Mfd)) - print('Inside bending_strength_reduction',Mdv, Md, beta, Mfd, Zfd) - self.bending_strength_section_reducedby = Mfd - self.beta_reduced = beta - if ( - Mdv - <= 1.2 - * self.section_property.plast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ): - return Mdv - else: - return ( - 1.2 - * self.section_property.plast_sec_mod_z - * self.material_property.fy - / self.gamma_m0 - ) - - - - - - def effective_length_beam1(self, design_dictionary, length): - print(f"Inside effective_length_beam") - self.Loading = design_dictionary[KEY_LOAD] # 'Normal'or 'Destabilizing' - # self.Latex_length = design_dictionary[KEY_LENGTH_OVERWRITE] - if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': - if self.support == KEY_DISP_SUPPORT1: - self.torsional_res = design_dictionary[KEY_TORSIONAL_RES] - self.warping = design_dictionary[KEY_WARPING_RES] - self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported( - Torsional=self.Torsional_res, - Warping=self.Warping, - length=length, - depth=(self.section_property.depth/1000), - load=self.Loading, - ) - print(f"Working 1 {self.effective_length}") - elif self.support == KEY_DISP_SUPPORT2: - self.Support = design_dictionary[KEY_SUPPORT_TYPE] - self.Top = design_dictionary[KEY_SUPPORT_TYPE2] - self.effective_length = IS800_2007.cl_8_3_3_EffLen_Cantilever( - Support=self.Support, - Top=self.Top, - length=length, - load=self.Loading, - ) - print(f"Working 2 {self.effective_length}") - else: - if self.support == KEY_DISP_SUPPORT1: - self.Torsional_res = design_dictionary[KEY_TORSIONAL_RES] - self.Warping = design_dictionary[KEY_WARPING_RES] - - elif self.support == KEY_DISP_SUPPORT2: - self.Support = design_dictionary[KEY_SUPPORT_TYPE] - self.Top = design_dictionary[KEY_SUPPORT_TYPE2] - - try: - if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: - design_dictionary[KEY_LENGTH_OVERWRITE] = 'NA' - else: - length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) - - self.effective_length = length - print(f"Working 3 {self.effective_length}") - except: - print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) - logger.warning("Invalid Effective Length Parameter.") - logger.info('Effective Length Parameter is set to default: 1.0') - design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' - self.effective_length_beam(self, design_dictionary, length) - print(f"Working 4 {self.effective_length}") - print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) - - - def lambda_lt_check_member_type(self, Mcr=0, fcrb=0, Zp=0, f_y=0, Ze=0, beta_b=0): - lambda_lt_1 = math.sqrt(beta_b * Zp * f_y / Mcr) - lambda_lt_2 = math.sqrt(f_y / fcrb) - lambda_lt_check = math.sqrt(1.2 * Ze * f_y / Mcr) - if lambda_lt_1 == lambda_lt_2: - if lambda_lt_1 <= lambda_lt_check: - return lambda_lt_1 - logger.warning(" Issues with the non-dimensional slenderness ratio Lambda_lt") - - def common_checks_1(self, section, step=1, list_result=[], list_1=[]): - if step == 1: - print(f"Working correct here") - elif step == 2: - # reduction of the area based on the connection requirements (input from design preferences) - if self.effective_area_factor < 1.0: - self.effective_area = round( - self.effective_area * self.effective_area_factor, 2 - ) - - - elif step == 3: - # 2.1 - Buckling curve classification and Imperfection factor - if self.section_property.type == 'Rolled': - self.buckling_class = 'c' - self.imperfection_factor = IS800_2007.cl_7_1_2_1_imperfection_factor( - buckling_class=self.buckling_class - ) - elif step == 4: - # self.slenderness = self.effective_length / min(self.section_property.rad_of_gy_z, self.section_property.rad_of_gy_y) * 1000 - print( - f"\n data sent " - f" self.material_property.fy {self.material_property.fy}" - f"self.gamma_m0 {self.gamma_m0}" - f"self.slenderness {self.slenderness}" - f" self.imperfection_factor {self.imperfection_factor}" - f"self.section_property.modulus_of_elasticity {self.section_property.modulus_of_elasticity}" - ) - - list_cl_7_1_2_1_design_compressisive_stress = ( - IS800_2007.cl_7_1_2_1_design_compressisive_stress( - self.material_property.fy, - self.gamma_m0, - self.slenderness, - self.imperfection_factor, - self.section_property.modulus_of_elasticity, - check_type=list_result, - ) - ) - for x in list_cl_7_1_2_1_design_compressisive_stress: - print(f"x {x} ") - self.euler_buckling_stress = list_cl_7_1_2_1_design_compressisive_stress[0] - self.nondimensional_effective_slenderness_ratio = ( - list_cl_7_1_2_1_design_compressisive_stress[1] - ) - self.phi = list_cl_7_1_2_1_design_compressisive_stress[2] - self.stress_reduction_factor = list_cl_7_1_2_1_design_compressisive_stress[ - 3 - ] - self.design_compressive_stress_fr = ( - list_cl_7_1_2_1_design_compressisive_stress[4] - ) - self.design_compressive_stress = ( - list_cl_7_1_2_1_design_compressisive_stress[5] - ) - self.design_compressive_stress_max = ( - list_cl_7_1_2_1_design_compressisive_stress[6] - ) - elif step == 5: - # 1- Based on optimum UR - self.optimum_section_ur_results[self.ur] = {} - list_2 = list_result.copy() - for j in list_1: - # k = 0 - for k in list_2: - self.optimum_section_ur_results[self.ur][j] = k - # k += 1 - list_2.pop(0) - break - - # 2- Based on optimum cost - self.optimum_section_cost_results[self.cost] = {} - - list_2 = list_result.copy() # Why? - for j in list_1: - for k in list_2: - self.optimum_section_cost_results[self.cost][j] = k - list_2.pop(0) - break - print( - f"\n self.optimum_section_cost_results {self.optimum_section_cost_results}" - f"\n self.optimum_section_ur_results {self.optimum_section_ur_results}" - ) - elif step == 6: - self.single_result[self.sec_profile] = {} - list_2 = list_result.copy() - for j in list_1: - # k = 0 - for k in list_2: - self.single_result[self.sec_profile][j] = k - # k += 1 - list_2.pop(0) - break - print(f"\n self.single_result {self.single_result}") - - def list_changer(self, change, list,list_name, check = True): - list_name.extend([ - "Designation"]) - if self.high_shear_check and self.section_class != 'Semi-Compact': - list.extend( - [self.bending_strength_section_reducedby, self.beta_reduced, self.M_d]) - list_name.extend([ - "Mfd", - "Beta_reduced", - 'M_d' - ]) - #Latex para also - list.extend( - [self.latex_tension_zone,self.web_buckling_check,self.effective_depth, self.web_buckling, self.section_class, self.effective_area, self.shear_strength, self.high_shear_check, - self.bending_strength_section, self.effective_length, self.ur, - self.cost, self.beta_b_lt]) - list_name.extend([ - 'latex.tension_zone', - 'Web.Buckling', - 'Reduced.depth', - 'Buckling.crippling', - "Section class", - "Effective area", - "Shear Strength", - "High Shear check", - "Bending Strength", - "Effective_length", - "UR", - "Cost", - "Beta_b" - ]) - #Web buckling parameters - # if self.web_buckling_check and (self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0] or self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1] ) : - # list.extend( - # [self.K_v, self.tau_crc, self.lambda_w, self.tau_b, - # self.V_cr]) - # list_name.extend([ - # 'Kv', - # 'tau_crc', - # 'lambda_w', - # 'tau_b', - # "V_cr" - # ]) - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1] and self.web_buckling_check: - list.extend( - [self.Mfr, self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness) - , self.c, self.phi_girder,self.s_girder ,self.wtf_girder,self.sai_girder, self.fv_girder,self.V_p,self.V_tf_girder]) - list_name.extend([ - 'Mfr', - 'Nf', - 'c', - 'phi_girder', - "s_girder", - 'wtf_girder', - 'sai_girder', - 'fv_girder', - 'V_p', - 'V_tf_girder' - ]) - if change == 'Web Buckling': - list.extend([self.I_eff_web, self.A_eff_web, self.r, self.buckling_class, - self.imperfection_factor, - self.slenderness, - self.euler_buckling_stress, - self.nondimensional_effective_slenderness_ratio, - self.phi, - self.stress_reduction_factor, - self.design_compressive_stress_fr, - self.design_compressive_stress_max, - self.design_compressive_stress, - self.section_capacity, - self.F_wb]) - - list_name.extend ([ - "WebBuckling.I_eff", - "WebBuckling.A_eff", - "WebBuckling.r_eff", - "Buckling_class", - "IF", - "Effective_SR", - "EBS", - "ND_ESR", - "phi", - "SRF", - "FCD_formula", - "FCD_max", - "FCD", - "Capacity", - "Web_crippling" - ]) - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - list.extend([self.It, - self.Iw, - self.alpha_lt, - self.lambda_lt, - self.phi_lt, - self.X_lt, - self.fbd_lt, - self.lateral_tb]) - - list_name.extend([ - "It", - "Iw", - "IF_lt", - "ND_ESR_lt", - "phi_lt", - "SRF_lt", - "FCD_lt", - "Mcr" - ]) - return list,list_name - - # def plate_girder_design(self, section): - # if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - # self.tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(self.K_v, - # self.material_property.modulus_of_elasticity, - # 0.3,self.effective_depth, - # self.section_property.web_thickness) - # self.lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.fyw,self.tau_crc) - # self.tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(self.lambda_w, self.fyw) - # self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(self.tau_b, self.effective_depth * self.section_property.web_thickness) - # d_red = self.section_property.depth - 2*(self.section_property.flange_thickness + self.section_property.root_radius) - # tau_b = self.load.shear_force / (self.effective_depth * self.section_property.web_thickness) - # if tau_b <= self.fyw / math.sqrt(3): - # lambda_w = 0.8 - # else: - # lambda_w = min((tau_b*(math.sqrt(3)/self.fyw) - 1.64) / (-0.8), math.sqrt(tau_b*(math.sqrt(3)/self.fyw))) - # tau_crc = self.fyw / (math.sqrt(3) * lambda_w ** 2) - - def plate_girder_strength(self): - self.tau_crc = IS800_2007.cl_8_4_2_2_tau_crc_Simple_postcritical(self.K_v, - self.material_property.modulus_of_elasticity, - 0.3,self.effective_depth, - self.section_property.web_thickness) - self.lambda_w = IS800_2007.cl_8_4_2_2_lambda_w_Simple_postcritical(self.fyw,self.tau_crc) - self.tau_b = IS800_2007.cl_8_4_2_2_tau_b_Simple_postcritical(self.lambda_w, self.fyw) - self.V_cr = IS800_2007.cl_8_4_2_2_Vcr_Simple_postcritical(self.tau_b, self.effective_depth * self.section_property.web_thickness) / 10**3 - print('\n plate_girder_strength', '\n tau_crc',self.tau_crc,'\n self.lambda_w',self.lambda_w,'\n self.tau_b',self.tau_b,'\n self.V_cr',self.V_cr) - def plate_girder_strength2(self): - - self.plate_girder_strength(self) - self.phi_girder, self.M_fr_girder ,self.s_girder ,self.wtf_girder,self.sai_girder, self.fv_girder, self.V_tf_girder= IS800_2007.cl_8_4_2_2_TensionField(self.c, - self.effective_depth,self.section_property.web_thickness, - self.fyw,self.section_property.flange_width, - self.section_property.flange_thickness,self.fyf, - self.load.moment/(self.section_property.depth - self.section_property.flange_thickness), - self.gamma_m0,self.effective_depth * self.section_property.web_thickness,self.tau_b,self.V_p ) - - - def results(self, design_dictionary): - _ = [i for i in self.optimum_section_ur if i > 1.0] - print( '_ ',_) - if len(_)==1: - temp = _[0] - elif len(_)==0: - temp = None - else: - temp = sorted(_)[0] - self.failed_design_dict = self.optimum_section_ur_results[temp] if temp is not None else None - print('self.failed_design_dict ',self.failed_design_dict) - - # sorting results from the dataset - # if len(self.input_section_list) > 1: - # results based on UR - if self.optimization_parameter == "Utilization Ratio": - filter_UR = filter( - lambda x: x <= min(self.allowable_utilization_ratio, 1.0), - self.optimum_section_ur - ) - self.optimum_section_ur = list(filter_UR) - - self.optimum_section_ur.sort() - print(f"self.optimum_section_ur{self.optimum_section_ur} \n self.optimum_section_ur_results{self.optimum_section_ur_results}") - # print(f"self.result_UR{self.result_UR}") - - # selecting the section with most optimum UR - if len(self.optimum_section_ur) == 0: # no design was successful - logger.warning( - "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " - "criteria" - ) - logger.error( - "The solver did not find any adequate section from the defined list." - ) - - self.design_status = False - if len(self.failed_design_dict)>0: - logger.info( - "The details for the best section provided is being shown" - ) - self.result_UR = self.failed_design_dict['UR'] #temp TODO @Rutvik - self.common_result( - self, - list_result=self.failed_design_dict, - result_type=None, - ) - logger.warning( - "Re-define the list of sections or check the Design Preferences option and re-design." - ) - else: - logger.warning( - "Plastic section modulus of selected sections is less than required." - ) - return - # self.design_status_list.append(self.design_status) - - else: - self.failed_design_dict = None - self.result_UR = self.optimum_section_ur[-1] # optimum section which passes the UR check - print(f"self.result_UR{self.result_UR}") - self.design_status = True - self.common_result( - self, - list_result=self.optimum_section_ur_results, - result_type=self.result_UR, - ) - - else: # results based on cost - self.optimum_section_cost.sort() - - # selecting the section with most optimum cost - self.result_cost = self.optimum_section_cost[0] - self.design_status = True - # print results - # if len(self.optimum_section_ur) == 0: - # logger.warning( - # "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " - # "criteria" - # ) - # logger.error( - # "The solver did not find any adequate section from the defined list." - # ) - # logger.info( - # "Re-define the list of sections or check the Design Preferences option and re-design." - # ) - # self.design_status = False - # self.design_status_list.append(self.design_status) - # pass - # else: - # if self.optimization_parameter == "Utilization Ratio": - # self.common_result( - # self, - # list_result=self.optimum_section_ur_results, - # result_type=self.result_UR, - # ) - # else: - # self.result_UR = self.optimum_section_cost_results[ - # self.result_cost - # ]["UR"] - # - # # checking if the selected section based on cost satisfies the UR - # if self.result_UR > min(self.allowable_utilization_ratio, 1.0): - # trial_cost = [] - # for cost in self.optimum_section_cost: - # self.result_UR = self.optimum_section_cost_results[ - # cost - # ]["UR"] - # if self.result_UR <= min( - # self.allowable_utilization_ratio, 1.0 - # ): - # trial_cost.append(cost) - # - # trial_cost.sort() - # - # if len(trial_cost) == 0: # no design was successful - # logger.warning( - # "The sections selected by the solver from the defined list of sections did not satisfy the Utilization Ratio (UR) " - # "criteria" - # ) - # logger.error( - # "The solver did not find any adequate section from the defined list." - # ) - # logger.info( - # "Re-define the list of sections or check the Design Preferences option and re-design." - # ) - # self.design_status = False - # self.design_status_list.append(self.design_status) - # print(f"design_status_list{self.design_status} \n") - # else: - # self.result_cost = trial_cost[ - # 0 - # ] # optimum section based on cost which passes the UR check - # self.design_status = True - # - # # results - # self.common_result( - # self, - # list_result=self.optimum_section_cost_results, - # result_type=self.result_cost, - # ) - # - # print(f"design_status_list2{self.design_status}") - self.design_status_list.append(self.design_status) - for status in self.design_status_list: - print('status list', status) - if status is False: - self.design_status = False - break - else: - self.design_status = True - - def common_result(self, list_result, result_type, flag=1): - try: - self.result_designation = list_result[result_type]["Designation"] # TODO debug - logger.info( - "The section is {}. The {} section has {} flange({}) and {} web({}). [Reference: Cl 3.7, IS 800:2007].".format( - self.input_section_classification[self.result_designation][0] , - self.result_designation, - self.input_section_classification[self.result_designation][1], round(self.input_section_classification[self.result_designation][3],2), - self.input_section_classification[self.result_designation][2], round(self.input_section_classification[self.result_designation][4],2) - ) - ) - self.result_latex_tension_zone = list_result[result_type]["latex.tension_zone"] - self.result_web_buckling_check = list_result[result_type]["Web.Buckling"] - self.result_eff_d = list_result[result_type]["Reduced.depth"] - self.result_buckling_crippling = list_result[result_type]["Buckling.crippling"] - - self.result_section_class = list_result[result_type]["Section class"] - self.result_effective_area = round(list_result[result_type]["Effective area"],2) - if self.effective_area_factor < 1.0: - logger.info( - "The actual effective area is {} mm2 and the reduced effective area is {} mm2 [Reference: Cl. 7.3.2, IS 800:2007]".format( - round((self.result_effective_area / self.effective_area_factor), 2), - self.result_effective_area, - ) - ) - - self.result_shear = round(list_result[result_type]["Shear Strength"], 2) - self.result_high_shear = list_result[result_type]["High Shear check"] - self.result_bending = round(list_result[result_type]["Bending Strength"], 2) - self.result_eff_len = round(list_result[result_type]["Effective_length"], 2) - self.result_cost = list_result[result_type]["Cost"] - self.result_betab = list_result[result_type]["Beta_b"] - - if self.result_web_buckling_check : - logger.warning( - "Thin web so take flange to resist moment and web to resist shear[Reference: Cl 8.2.1.1, IS 800:2007]") - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - logger.info('Transverse Stiffeners at supports required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result[result_type]['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result[result_type]['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result[result_type]['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result[result_type]['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result[result_type]['V_cr'], 2) - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - logger.info('Transverse Stiffeners at supports and intermediate transverse stiffener required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result[result_type]['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result[result_type]['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result[result_type]['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result[result_type]['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result[result_type]['V_cr'], 2) - self.result_web_buckling_simple_Mfr = round(list_result[result_type]['Mfr']*10**-6, 2) - self.result_web_buckling_simple_Nf = round(list_result[result_type]['Nf'], 2) - self.result_web_buckling_simple_c = round(list_result[result_type]['c'], 2) - self.result_web_buckling_simple_phi_girder = round(list_result[result_type]['phi_girder'], 2) - self.result_web_buckling_simple_s_girder = round(list_result[result_type]['s_girder'], 2) - self.result_web_buckling_simple_wtf_girder = round(list_result[result_type]['wtf_girder'], 2) - self.result_web_buckling_simple_sai_girder = round(list_result[result_type]['sai_girder'], 2) - self.result_web_buckling_simple_fv_girder = round(list_result[result_type]['fv_girder'], 2) - self.result_web_buckling_simple_V_p_girder = round(list_result[result_type]['V_p'], 2) - self.result_web_buckling_simple_fV_tf_girder = round(list_result[result_type]['V_tf_girder'], 2) - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE : - self.result_mcr = round(list_result[result_type]['Mcr'], 2) - self.result_IF_lt = round(list_result[result_type]["IF_lt"], 2) - self.result_tc = round(list_result[result_type]["It"], 2) - self.result_wc = round(list_result[result_type]["Iw"], 2) - self.result_nd_esr_lt = round(list_result[result_type]["ND_ESR_lt"], 2) - self.result_phi_lt = round(list_result[result_type]["phi_lt"], 2) - self.result_srf_lt = round(list_result[result_type]["SRF_lt"], 2) - self.result_fcd__lt = round(list_result[result_type]["FCD_lt"], 2) - else: - self.result_mcr = 'NA' - self.result_IF_lt = 'NA' - self.result_tc = 'NA' - self.result_wc = 'NA' - self.result_nd_esr_lt = 'NA' - self.result_phi_lt = 'NA' - self.result_srf_lt = 'NA' - self.result_fcd__lt = 'NA' - - if self.web_buckling : - - self.result_bcI_eff = list_result[result_type]['WebBuckling.I_eff'] - self.result_bcA_eff = list_result[result_type]['WebBuckling.A_eff'] - self.result_bcr_eff = list_result[result_type]['WebBuckling.r_eff'] - self.result_bc = list_result[result_type]['Buckling_class'] - self.result_IF = round(list_result[result_type]["IF"], 2) - self.result_eff_sr = round(list_result[result_type]["Effective_SR"], 2) - self.result_ebs = round(list_result[result_type]["EBS"], 2) - self.result_nd_esr = round(list_result[result_type]["ND_ESR"], 2) - self.result_phi_zz = round(list_result[result_type]["phi"], 2) - self.result_srf = round(list_result[result_type]["SRF"], 2) - self.result_fcd_1_zz = round(list_result[result_type]["FCD_formula"], 2) - self.result_fcd_2 = round(list_result[result_type]["FCD_max"], 2) - self.result_fcd = round(list_result[result_type]["FCD"], 2) - self.result_capacity = round(list_result[result_type]["Capacity"], 2) - self.result_crippling = round(list_result[result_type]["Web_crippling"], 2) - else: - self.result_bc = 'NA' - self.result_IF = 'NA' - self.result_eff_sr = 'NA' - self.result_lambda_vv = 'NA' - self.result_lambda_psi = 'NA' - self.result_ebs = 'NA' - self.result_nd_esr = 'NA' - self.result_phi_zz = 'NA' - self.result_srf = 'NA' - self.result_fcd_1_zz = 'NA' - self.result_fcd_2 = 'NA' - self.result_fcd = 'NA' - self.result_capacity = 'NA' - self.result_crippling = 'NA' - if self.result_high_shear and self.input_section_classification[self.result_designation][0] != 'Semi-Compact': - self.result_mfd = list_result[result_type]["Mfd"] - self.result_beta_reduced = list_result[result_type]["Beta_reduced"] - self.result_Md= list_result[result_type]["M_d"] - except: - self.result_designation = list_result["Designation"] - logger.info( - "The section is {}. The {} section has {} flange({}) and {} web({}). [Reference: Cl 3.7, IS 800:2007].".format( - self.input_section_classification[self.result_designation][0] , - self.result_designation, - self.input_section_classification[self.result_designation][1], round(self.input_section_classification[self.result_designation][3],2), - self.input_section_classification[self.result_designation][2], round(self.input_section_classification[self.result_designation][4],2) - ) - ) - self.result_latex_tension_zone = list_result["latex.tension_zone"] - self.result_web_buckling_check = list_result["Web.Buckling"] - self.result_eff_d = list_result["Reduced.depth"] - self.result_buckling_crippling = list_result["Buckling.crippling"] - - self.result_section_class = list_result["Section class"] - self.result_effective_area = round(list_result["Effective area"],2) - if self.effective_area_factor < 1.0: - logger.info( - "The actual effective area is {} mm2 and the reduced effective area is {} mm2 [Reference: Cl. 7.3.2, IS 800:2007]".format( - round((self.result_effective_area / self.effective_area_factor), 2), - self.result_effective_area, - ) - ) - - self.result_shear = round(list_result["Shear Strength"], 2) - self.result_high_shear = list_result["High Shear check"] - self.result_bending = round(list_result["Bending Strength"], 2) - self.result_eff_len = round(list_result["Effective_length"], 2) - self.result_cost = list_result["Cost"] - self.result_betab = list_result["Beta_b"] - - if self.result_web_buckling_check : - logger.warning( - "Thin web so take flange to resist moment and web to resist shear[Reference: Cl 8.2.1.1, IS 800:2007]") - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - logger.info('Transverse Stiffeners at supports required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result['V_cr'], 2) - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - logger.info('Transverse Stiffeners at supports and intermediate transverse stiffener required. Design not done for them') - self.result_web_buckling_simple_kv = round(list_result['Kv'], 2) - self.result_web_buckling_simple_tau_crc = round(list_result['tau_crc'], 2) - self.result_web_buckling_simple_lambda_w = round(list_result['lambda_w'], 2) - self.result_web_buckling_simple_tau_b = round(list_result['tau_b'], 2) - self.result_web_buckling_simple_V_cr = round(list_result['V_cr'], 2) - self.result_web_buckling_simple_Mfr = round(list_result['Mfr']*10**-6, 2) - self.result_web_buckling_simple_Nf = round(list_result['Nf'], 2) - self.result_web_buckling_simple_c = round(list_result['c'], 2) - self.result_web_buckling_simple_phi_girder = round(list_result['phi_girder'], 2) - self.result_web_buckling_simple_s_girder = round(list_result['s_girder'], 2) - self.result_web_buckling_simple_wtf_girder = round(list_result['wtf_girder'], 2) - self.result_web_buckling_simple_sai_girder = round(list_result['sai_girder'], 2) - self.result_web_buckling_simple_fv_girder = round(list_result['fv_girder'], 2) - self.result_web_buckling_simple_V_p_girder = round(list_result['V_p'], 2) - self.result_web_buckling_simple_fV_tf_girder = round(list_result['V_tf_girder'], 2) - - if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE : - self.result_mcr = round(list_result['Mcr'], 2) - self.result_IF_lt = round(list_result["IF_lt"], 2) - self.result_tc = round(list_result["It"], 2) - self.result_wc = round(list_result["Iw"], 2) - self.result_nd_esr_lt = round(list_result["ND_ESR_lt"], 2) - self.result_phi_lt = round(list_result["phi_lt"], 2) - self.result_srf_lt = round(list_result["SRF_lt"], 2) - self.result_fcd__lt = round(list_result["FCD_lt"], 2) - else: - self.result_mcr = 'NA' - self.result_IF_lt = 'NA' - self.result_tc = 'NA' - self.result_wc = 'NA' - self.result_nd_esr_lt = 'NA' - self.result_phi_lt = 'NA' - self.result_srf_lt = 'NA' - self.result_fcd__lt = 'NA' - - if self.web_buckling : - - self.result_bcI_eff = list_result['WebBuckling.I_eff'] - self.result_bcA_eff = list_result['WebBuckling.A_eff'] - self.result_bcr_eff = list_result['WebBuckling.r_eff'] - self.result_bc = list_result['Buckling_class'] - self.result_IF = round(list_result["IF"], 2) - self.result_eff_sr = round(list_result["Effective_SR"], 2) - self.result_ebs = round(list_result["EBS"], 2) - self.result_nd_esr = round(list_result["ND_ESR"], 2) - self.result_phi_zz = round(list_result["phi"], 2) - self.result_srf = round(list_result["SRF"], 2) - self.result_fcd_1_zz = round(list_result["FCD_formula"], 2) - self.result_fcd_2 = round(list_result["FCD_max"], 2) - self.result_fcd = round(list_result["FCD"], 2) - self.result_capacity = round(list_result["Capacity"], 2) - self.result_crippling = round(list_result["Web_crippling"], 2) - else: - self.result_bc = 'NA' - self.result_IF = 'NA' - self.result_eff_sr = 'NA' - self.result_lambda_vv = 'NA' - self.result_lambda_psi = 'NA' - self.result_ebs = 'NA' - self.result_nd_esr = 'NA' - self.result_phi_zz = 'NA' - self.result_srf = 'NA' - self.result_fcd_1_zz = 'NA' - self.result_fcd_2 = 'NA' - self.result_fcd = 'NA' - self.result_capacity = 'NA' - self.result_crippling = 'NA' - if self.result_high_shear and self.input_section_classification[self.result_designation][0] != 'Semi-Compact': - self.result_mfd = list_result["Mfd"] - self.result_beta_reduced = list_result["Beta_reduced"] - self.result_Md= list_result["M_d"] - - ### start writing save_design from here! - def save_design(self, popup_summary): - # print('self.design_status', self.design_status,'len(self.failed_design_dict)', len(self.failed_design_dict)) - if (self.design_status and self.failed_design_dict is None) or (not self.design_status and len(self.failed_design_dict)>0):# TODO @Rutvik - self.section_property = self.section_connect_database(self, self.result_designation) - if self.sec_profile=='Columns' or self.sec_profile=='Beams' or self.sec_profile == VALUES_SECTYPE[1]: - self.report_column = {KEY_DISP_SEC_PROFILE: "ISection", - KEY_DISP_SECSIZE_pg: (self.section_property.designation, self.sec_profile), - KEY_DISP_COLSEC_REPORT: self.section_property.designation, - KEY_DISP_MATERIAL: self.section_property.material, - # KEY_DISP_APPLIED_AXIAL_FORCE: self.section_property., - KEY_REPORT_MASS: self.section_property.mass, - KEY_REPORT_AREA: round(self.section_property.area * 1e-2, 2), - KEY_REPORT_DEPTH: self.section_property.depth, - KEY_REPORT_WIDTH: self.section_property.flange_width, - KEY_REPORT_WEB_THK: self.section_property.web_thickness, - KEY_REPORT_FLANGE_THK: self.section_property.flange_thickness, - KEY_DISP_FLANGE_S_REPORT: self.section_property.flange_slope, - KEY_REPORT_R1: self.section_property.root_radius, - KEY_REPORT_R2: self.section_property.toe_radius, - KEY_REPORT_IZ: round(self.section_property.mom_inertia_z * 1e-4, 2), - KEY_REPORT_IY: round(self.section_property.mom_inertia_y * 1e-4, 2), - KEY_REPORT_RZ: round(self.section_property.rad_of_gy_z * 1e-1, 2), - KEY_REPORT_RY: round(self.section_property.rad_of_gy_y * 1e-1, 2), - KEY_REPORT_ZEZ: round(self.section_property.elast_sec_mod_z * 1e-3, 2), - KEY_REPORT_ZEY: round(self.section_property.elast_sec_mod_y * 1e-3, 2), - KEY_REPORT_ZPZ: round(self.section_property.plast_sec_mod_z * 1e-3, 2), - KEY_REPORT_ZPY: round(self.section_property.plast_sec_mod_y * 1e-3, 2)} - - - - self.report_input = \ - {#KEY_MAIN_MODULE: self.mainmodule, - KEY_MODULE: self.module, #"Axial load on column " - KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, - KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, - KEY_DISP_LENGTH_BEAM: self.result_eff_len, - KEY_DISP_SEC_PROFILE: self.sec_profile, - KEY_DISP_SECSIZE_pg: str(self.sec_list), - KEY_MATERIAL: self.material, - "Selected Section Details": self.report_column, - KEY_BEAM_SUPP_TYPE: self.latex_design_type, - } - - # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0]: - # self.report_input.update({ - # KEY_DISP_BENDING: self.bending_type}) - # elif self.latex_design_type == VALUES_SUPP_TYPE_temp[1]: - # self.report_input.update({ - # KEY_BEAM_SUPP_TYPE_DESIGN: self.support, - # # KEY_DISP_BENDING: self.bending_type, - # }) - self.report_input.update({ - KEY_DISP_SUPPORT : self.support, - KEY_DISP_ULTIMATE_STRENGTH_REPORT: self.material_property.fu, - KEY_DISP_YIELD_STRENGTH_REPORT: self.material_property.fy, - "End Conditions - " + str(self.support): "TITLE", - }) - # if self.Latex_length == 'NA': - if self.support == KEY_DISP_SUPPORT1: - self.report_input.update({ - DISP_TORSIONAL_RES: self.Torsional_res, - DISP_WARPING_RES:self.Warping }) - else: - self.report_input.update({ - DISP_SUPPORT_RES: self.Support, - DISP_TOP_RES: self.Top}) - self.report_input.update({ - "Design Preference" : "TITLE", - KEY_DISP_EFFECTIVE_AREA_PARA: self.effective_area_factor, - KEY_DISP_CLASS: self.allow_class, - KEY_DISP_LOAD: self.Loading, - KEY_DISPP_LENGTH_OVERWRITE: self.latex_efp, - KEY_DISP_BEARING_LENGTH + ' (mm)': self.bearing_length, - - }) - # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0] and self.result_web_buckling_check: - # self.report_input.update({ - # KEY_ShearBuckling: self.support_cndition_shear_buckling - # }) - # self.report_input.update({ - # # KEY_DISP_SEC_PROFILE: self.sec_profile, - # "I Section - anical PropertiesMech": "TITLE", - # }) - self.report_input.update() - self.report_check = [] - - t1 = ('Selected', 'Selected Member Data', '|p{5cm}|p{2cm}|p{2cm}|p{2cm}|p{4cm}|') - self.report_check.append(t1) - - t1 = ('SubSection', 'Effective Area', '|p{4cm}|p{1.5cm}|p{9.5cm}|p{1cm}|') - self.report_check.append(t1) - t1 = ('Effective Area ($mm^2$)', ' ', - sectional_area_change(round(self.result_effective_area,2), round(self.section_property.area,2), - self.effective_area_factor), - ' ') - self.report_check.append(t1) - - # t1 = ('SubSection', 'Section parameters', '|p{4cm}|p{1.5cm}|p{9.5cm}|p{1cm}|') - # self.report_check.append(t1) - # t1 = ('d_{web}', ' ', - # sectional_area_change(round(self.result_effective_area,2), round(self.section_property.area,2), - # self.effective_area_factor), - # ' ') - # self.report_check.append(t1) - - t1 = ('SubSection', 'Section Classification', '|p{3cm}|p{3.5cm}|p{8.5cm}|p{1cm}|') - self.report_check.append(t1) - t1 = ('Web Class', 'Neutral Axis at Mid-Depth', - cl_3_7_2_section_classification_web(round(self.result_eff_d, 2), round(self.section_property.web_thickness, 2), round(self.input_section_classification[self.result_designation][4],2), - self.epsilon, self.section_property.type, - self.input_section_classification[self.result_designation][2]), - ' ') - self.report_check.append(t1) - t1 = ('Flange Class', self.section_property.type, - cl_3_7_2_section_classification_flange(round(self.section_property.flange_width/2, 2), - round(self.section_property.flange_thickness, 2), round( - self.input_section_classification[self.result_designation][3], 2), - self.epsilon, - self.input_section_classification[self.result_designation][1]), - ' ') - self.report_check.append(t1) - t1 = ('Section Class', ' ', - cl_3_7_2_section_classification( - self.input_section_classification[self.result_designation][0]), - ' ') - self.report_check.append(t1) - - t1 = ('SubSection', 'Web Slenderness Check', '|p{3cm}|p{4cm}|p{6cm}|p{3 cm}|') - self.report_check.append(t1) - t1 = (KEY_DISP_Web_Buckling, cl_8_2_1web_buckling_required(round(self.epsilon,2),round(67 * self.epsilon,2)), - cl_8_2_1web_buckling_1(self.result_eff_d, self.section_property.web_thickness, - round(self.result_eff_d / self.section_property.web_thickness,2), self.result_web_buckling_check), - get_pass_fail(67 * self.epsilon, round(self.result_eff_d / self.section_property.web_thickness,2), relation="Custom")) - self.report_check.append(t1) - if self.result_web_buckling_check: - t1 = ('SubSection', 'Shear Strength Results: ' + self.support_cndition_shear_buckling, '|p{3.5cm}|p{1.5cm}|p{10cm}|p{1cm}|') - self.report_check.append(t1) - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - t1 = (KEY_DISP_K_v_latex , ' ',cl_8_4_2_2_KV(self.result_web_buckling_simple_kv,self.support_cndition_shear_buckling), - - ' ') - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - t1 = (KEY_DISP_Transverse_Stiffener_spacing, ' ', - cl_8_4_2_2_Transverse_Stiffener_spacing(self.result_web_buckling_simple_c), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_K_v_latex, ' ',cl_8_4_2_2_KV(self.result_web_buckling_simple_kv,self.support_cndition_shear_buckling, self.result_web_buckling_simple_c,self.result_eff_d ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_Elastic_Critical_shear_stress_web, ' ', - cl_8_4_2_2_taucrc(self.result_web_buckling_simple_kv, 2 * 10 ** 5, 0.3, - self.result_eff_d, - self.section_property.web_thickness, - self.result_web_buckling_simple_tau_crc), - ' ') - self.report_check.append(t1) - - - - t1 = (KEY_DISP_slenderness_ratio_web, ' ', - cl_8_4_2_2_slenderness_ratio(self.fyw, self.result_web_buckling_simple_lambda_w, - self.result_web_buckling_simple_tau_crc), - ' ') - self.report_check.append(t1) - - t1 = (KEY_OUT_DISP_WELD_SHEAR_STRESS, ' ', - cl_8_4_2_2_shearstress_web(self.fyw, self.result_web_buckling_simple_lambda_w, self.result_web_buckling_simple_tau_b), - ' ') - self.report_check.append(t1) - - if self.support_cndition_shear_buckling == KEY_DISP_SB_Option[0]: - t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR + '(V_{d})', self.load.shear_force * 10 ** -3, - cl_8_4_2_2_shearstrength(self.result_eff_d, self.section_property.web_thickness,self.result_web_buckling_simple_V_cr, - self.result_web_buckling_simple_tau_b, self.result_shear), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_ALLOW_SHEAR, ' ', - cl_8_2_1_2_shear_check(round(self.result_shear, 2), round(0.6 * self.result_shear, 2), - self.result_high_shear, self.load.shear_force * 10 ** -3), - get_pass_fail(self.load.shear_force * 10 ** -3, round(0.6 * self.result_shear, 2), - relation="Warn", M1=self.result_high_shear)) - self.report_check.append(t1) - - elif self.support_cndition_shear_buckling == KEY_DISP_SB_Option[1]: - t1 = (KEY_DISP_BUCKLING_STRENGTH + '(V_p)', ' ', - cl_8_4_1_plastic_shear_resistance_Vp(self.result_eff_d,self.section_property.web_thickness,self.fyw, self.result_web_buckling_simple_V_p_girder - ), - ' ') - self.report_check.append(t1) - - t1 = ('N_f (N)', ' ', - cl_8_4_2_2_N_f(self.section_property.depth, - self.section_property.flange_thickness, - self.section_property.depth - self.section_property.flange_thickness, - round(self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness),2) , self.load.moment - ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_reduced_moment + '(M_{fr})', ' ', - cl_8_4_2_2_TensionField_reduced_moment(self.result_web_buckling_simple_Mfr, self.section_property.flange_width,self.section_property.flange_thickness, - self.fyf, round(self.load.moment / ( - self.section_property.depth - self.section_property.flange_thickness),2) - ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_tension_field_incline , ' ', - cl_8_4_2_2_TensionField_phi(self.result_web_buckling_simple_phi_girder, self.result_web_buckling_simple_c,self.result_eff_d - ), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_AnchoragelengthTensionField, ' ', - cl_8_4_2_2_TensionField_anchorage_length(self.result_web_buckling_simple_s_girder, self.result_web_buckling_simple_phi_girder, - self.result_web_buckling_simple_Mfr, self.fyw, self.section_property.web_thickness - ), - ' ') - self.report_check.append(t1) - - - t1 = (KEY_DISP_WidthTensionField , ' ', - cl_8_4_2_2_KEY_DISP_WidthTensionField(self.result_eff_d,self.result_web_buckling_simple_phi_girder, - self.result_web_buckling_simple_c, - self.result_web_buckling_simple_s_girder,self.result_web_buckling_simple_wtf_girder - ), - ' ') - self.report_check.append(t1) - # t1 = (KEY_DISP_reduced_moment + '(M_{fr}', ' ', - # cl_8_4_2_2_TensionField_reduced_moment(self.result_eff_d, - # self.result_web_buckling_simple_phi_girder, - # self.result_web_buckling_simple_c, - # self.result_web_buckling_simple_s_girder,self.result_web_buckling_simple_wtf_girder - # ), - # ' ') - # self.report_check.append(t1) - t1 = (KEY_DISP_Yield_Strength_Tension_field, ' ', - cl_8_4_2_2_Yield_Strength_Tension_field(self.fyw, - self.result_web_buckling_simple_tau_b, - self.result_web_buckling_simple_phi_girder, - self.result_web_buckling_simple_fv_girder - ), - ' ') - self.report_check.append(t1) - t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR + '(V_{d})', self.load.shear_force * 10 ** -3, - cl_8_4_2_2_shearstrength_tensionfield(self.effective_depth * self.section_property.web_thickness, self.result_web_buckling_simple_tau_b,self.result_web_buckling_simple_V_p_girder, - self.result_shear,self.section_property.web_thickness, self.result_web_buckling_simple_wtf_girder, self.result_web_buckling_simple_fv_girder, - self.result_web_buckling_simple_phi_girder, round(self.result_web_buckling_simple_fV_tf_girder * 10**-3,2)), - ' ') - self.report_check.append(t1) - - - else: - - t1 = ('SubSection', 'Shear Strength Results', '|p{4cm}|p{5cm}|p{5.5cm}|p{1.5cm}|') - self.report_check.append(t1) - - t1 = (KEY_DISP_DESIGN_STRENGTH_SHEAR, self.load.shear_force * 10 ** -3, - cl_8_4_shear_yielding_capacity_member_(self.section_property.depth, - self.section_property.web_thickness, self.material_property.fy, - self.gamma_m0, round(self.result_shear, 2)), - get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_shear, 2), relation="lesser")) - self.report_check.append(t1) - - t1 = (KEY_DISP_ALLOW_SHEAR, ' ', - cl_8_2_1_2_shear_check(round(self.result_shear,2), round(0.6 * self.result_shear,2), self.result_high_shear,self.load.shear_force*10**-3), - get_pass_fail(self.load.shear_force*10**-3, round(0.6 * self.result_shear,2), relation="Warn",M1=self.result_high_shear)) - self.report_check.append(t1) - - # t1 = ('SubSection', 'Moment Strength Results', '|p{4cm}|p{4cm}|p{6.5cm}|p{1.5cm}|') - - t1 = ('SubSection', 'Moment Strength Results', '|p{4cm}|p{1.5cm}|p{9cm}|p{1.5cm}|') - self.report_check.append(t1) - if self.design_type == KEY_DISP_DESIGN_TYPE_FLEXURE: - if self.result_high_shear: - t1 = (KEY_DISP_Bending_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending_md_init( - self.section_property.elast_sec_mod_z, - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.support, - self.gamma_m0, round(self.result_betab, 2), - round(self.result_Md * 10 ** -6, 2), self.result_section_class - ), - ' ') - self.report_check.append(t1) - t1 = (KEY_DISP_PLASTIC_STRENGTH_MOMENT,' ', - cl_9_2_2_combine_shear_bending_mfd( - self.section_property.plast_sec_mod_z, - self.section_property.depth, - self.section_property.web_thickness, - self.material_property.fy, - self.gamma_m0, - round(self.result_mfd * 10 ** -6, 2)), - ' ') - self.report_check.append(t1) - - # temp = cl_8_2_1_2_plastic_moment_capacity_member(self.result_betab, - # self.section_property.plast_sec_mod_z, - # self.material_property.fy, self.gamma_m0, - # round(self.result_bending, 2)) - # print('tempt',temp) - - t1 = (KEY_DISP_DESIGN_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending(round(self.result_bending,2),self.section_property.elast_sec_mod_z, - self.material_property.fy,self.result_section_class,self.load.shear_force*10**-3, round(self.result_shear,2), - self.gamma_m0, round(self.result_beta_reduced,2),round(self.result_Md*10**-6,2),round(self.result_mfd*10**-6,2)), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) - - else: - t1 = (KEY_DISP_DESIGN_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_8_2_1_2_moment_capacity_member(round(self.result_betab,3), - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.gamma_m0, - round(self.result_bending, 2), self.section_property.elast_sec_mod_z,self.result_section_class,self.support), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) - elif self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - # KEY_DISP_Elastic_CM_latex - t1 = (KEY_DISP_Elastic_CM_latex, ' ', - cl_8_2_2_1_Mcr( - self.result_mcr, - self.material_property.modulus_of_elasticity, - self.section_property.mom_inertia_y, - self.result_eff_len, self.material_property.modulus_of_elasticity/(2*1.3), - self.section_property.It, self.section_property.Iw - # round(self.result_Md * 10 ** -6, 2), self.result_section_class - ), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_I_eff_latex + '($mm^4$)', ' ', - # cl_8_7_3_Ieff_web_check(self.bearing_length, self.section_property.web_thickness, - # round(self.result_bcI_eff,2)), - # ' ') - # self.report_check.append(t1) - - # t1 = (KEY_DISP_A_eff_latex+ '($mm^2$)', ' ', - # cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, - # self.result_bcA_eff), - # ' ') - # self.report_check.append(t1) - - # t1 = (KEY_DISP_r_eff_latex+ '(mm)', ' ', - # cl_8_7_3_reff_web_check(round(self.result_bcr_eff,2), round(self.result_bcI_eff,2), - # self.result_bcA_eff), - # ' ') - # self.report_check.append(t1) - - t1 = (KEY_DISP_SLENDER + r'($\lambda_{LT}$)', ' ', - cl_8_2_2_slenderness(round(self.result_betab, 2),self.section_property.elast_sec_mod_z, - self.section_property.plast_sec_mod_z,self.result_mcr,self.material_property.fy, - self.result_nd_esr_lt), - ' ') - self.report_check.append(t1) - - # # t1 = (KEY_DISP_SLENDER, ' ', - # # cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), - # # self.result_eff_sr), - # # ' ') - # # self.report_check.append(t1) - - # t1 = (KEY_DISP_BUCKLING_CURVE_ZZ, ' ', - # cl_8_7_1_5_buckling_curve(), - # ' ') - # self.report_check.append(t1) - - t1 = (KEY_DISP_IMPERFECTION_FACTOR_ZZ + r'($\alpha_{LT}$)', ' ', - cl_8_7_1_5_imperfection_factor(self.result_IF_lt), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_EULER_BUCKLING_STRESS_ZZ, ' ', - # cl_8_7_1_5_buckling_stress(self.section_property.modulus_of_elasticity,self.result_eff_sr,self.result_ebs), - # ' ') - # self.report_check.append(t1) - - t1 = (r'$\phi_{LT}$', ' ', - cl_8_2_2_phi(self.result_IF_lt,self.result_nd_esr_lt, self.result_phi_lt), - ' ') - self.report_check.append(t1) - - t1 = ('Bending Compressive stress($N/mm^2$)', ' ', - cl_8_2_2_Bending_Compressive(self.material_property.fy,self.gamma_m0,self.result_nd_esr_lt,self.result_phi_lt,self.result_fcd__lt), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_BUCKLING_STRENGTH, self.load.shear_force * 10 ** -3, - # cl_7_1_2_design_compressive_strength(self.result_capacity,round(( - # self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness,2), self.result_fcd,self.load.shear_force * 10 ** -3), - # get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_capacity, 2), relation="leq")) - # self.report_check.append(t1) - - if self.result_high_shear: - t1 = (KEY_DISP_LTB_Bending_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending_md_init( - self.section_property.elast_sec_mod_z, - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.support, - self.gamma_m0, round(self.result_betab, 2), - round(self.result_Md * 10 ** -6, 2), self.result_section_class - ), - ' ') - self.report_check.append(t1) - t1 = (KEY_DISP_PLASTIC_STRENGTH_MOMENT,' ', - cl_9_2_2_combine_shear_bending_mfd( - self.section_property.plast_sec_mod_z, - self.section_property.depth, - self.section_property.web_thickness, - self.material_property.fy, - self.gamma_m0, - round(self.result_mfd * 10 ** -6, 2)), - ' ') - self.report_check.append(t1) - - # temp = cl_8_2_1_2_plastic_moment_capacity_member(self.result_betab, - # self.section_property.plast_sec_mod_z, - # self.material_property.fy, self.gamma_m0, - # round(self.result_bending, 2)) - # print('tempt',temp) - t1 = (KEY_DISP_REDUCE_STRENGTH_MOMENT, self.load.moment*10**-6, - cl_9_2_2_combine_shear_bending(round(self.result_bending,2),self.section_property.elast_sec_mod_z, - self.material_property.fy,self.result_section_class,self.load.shear_force*10**-3, round(self.result_shear,2), - self.gamma_m0, round(self.result_betab,2),round(self.result_Md*10**-6,2),round(self.result_mfd*10**-6,2)), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) - - else: - t1 = ('Moment Strength (kNm)', self.load.moment*10**-6, - cl_8_2_2_moment_capacity_member(round(self.result_betab,2), - self.section_property.plast_sec_mod_z, - self.material_property.fy, self.gamma_m0, - round(self.result_bending, 2),self.section_property.elast_sec_mod_z,self.result_section_class,self.support), - get_pass_fail(self.load.moment*10**-6, round(self.result_bending, 2), relation="lesser")) - self.report_check.append(t1) - - if self.result_buckling_crippling: - t1 = ('SubSection', 'Web Buckling Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - self.report_check.append(t1) - - t1 = (KEY_DISP_I_eff_latex + '($mm^4$)', ' ', - cl_8_7_3_Ieff_web_check(self.bearing_length, self.section_property.web_thickness, - round(self.result_bcI_eff,2)), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_A_eff_latex+ '($mm^2$)', ' ', - cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, - self.result_bcA_eff), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_r_eff_latex+ '(mm)', ' ', - cl_8_7_3_reff_web_check(round(self.result_bcr_eff,2), round(self.result_bcI_eff,2), - self.result_bcA_eff), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_SLENDER + r'($\lambda$)', ' ', - cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), - self.result_eff_sr), - ' ') - self.report_check.append(t1) - - # t1 = (KEY_DISP_SLENDER, ' ', - # cl_8_7_1_5_slenderness(round(self.result_bcr_eff, 2), round(self.result_eff_d, 2), - # self.result_eff_sr), - # ' ') - # self.report_check.append(t1) - - t1 = (KEY_DISP_BUCKLING_CURVE_ZZ, ' ', - cl_8_7_1_5_buckling_curve(), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_IMPERFECTION_FACTOR_ZZ + r'($\alpha$)', ' ', - cl_8_7_1_5_imperfection_factor(self.result_IF), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_EULER_BUCKLING_STRESS_ZZ, ' ', - cl_8_7_1_5_buckling_stress(self.section_property.modulus_of_elasticity,self.result_eff_sr,self.result_ebs), - ' ') - self.report_check.append(t1) - - t1 = (r'$\phi$', ' ', - cl_8_7_1_5_phi(0.49,self.result_eff_sr, self.result_phi_zz), - ' ') - self.report_check.append(t1) - - t1 = ('Buckling stress($N/mm^2$)', ' ', - cl_8_7_1_5_Buckling(self.material_property.fy,self.gamma_m0,self.result_eff_sr,self.result_phi_zz,self.result_fcd_2,self.result_fcd), - ' ') - self.report_check.append(t1) - - t1 = (KEY_DISP_BUCKLING_STRENGTH, self.load.shear_force * 10 ** -3, - cl_7_1_2_design_compressive_strength(self.result_capacity,round(( - self.bearing_length + self.section_property.depth / 2) * self.section_property.web_thickness,2), self.result_fcd,self.load.shear_force * 10 ** -3), - get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_capacity, 2), relation="leq")) - self.report_check.append(t1) - - t1 = ('SubSection', 'Web Bearing Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - self.report_check.append(t1) - - t1 = ('Bearing Strength(kN)', self.load.shear_force * 10 ** -3, - cl_8_7_4_Bearing_stiffener_check(self.bearing_length, round(2.5 * ( - self.section_property.root_radius + self.section_property.flange_thickness), 2), - self.section_property.web_thickness, - self.material_property.fy, self.gamma_m0, - round(self.result_crippling, 2), - self.section_property.root_radius, - self.section_property.flange_thickness), - get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_crippling, 2), relation="leq")) - - self.report_check.append(t1) - - t1 = ('SubSection', 'Utilization', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - self.report_check.append(t1) - # TODO - if self.result_buckling_crippling: - t1 = (KEY_DISP_Utilization_Ratio, 1.0, - Utilization_Ratio_Latex(self.load.shear_force * 10 ** -3,round(self.result_shear, 2), - self.load.moment*10**-6, round(self.result_bending, 2), - self.result_UR,type=2,Pd=self.result_capacity, fw=self.result_crippling), - get_pass_fail(1.0, self.result_UR, relation="geq")) - else: - t1 = (KEY_DISP_Utilization_Ratio, 1.0, - Utilization_Ratio_Latex(self.load.shear_force * 10 ** -3,round(self.result_shear, 2), - self.load.moment*10**-6, round(self.result_bending, 2), - self.result_UR), - get_pass_fail(1.0, self.result_UR, relation="geq")) - self.report_check.append(t1) -# - # elif not self.design_status or len(self.failed_design_dict)>0: - # self.section_property = self.section_connect_database(self, self.result_designation) - - # if self.sec_profile=='Columns' or self.sec_profile=='Beams' or self.sec_profile == VALUES_SECTYPE[1]: - # self.report_column = {KEY_DISP_SEC_PROFILE: "ISection", - # KEY_DISP_SECSIZE: (self.section_property.designation, self.sec_profile), - # KEY_DISP_COLSEC_REPORT: self.section_property.designation, - # KEY_DISP_MATERIAL: self.section_property.material, - # # KEY_DISP_APPLIED_AXIAL_FORCE: self.section_property., - # KEY_REPORT_MASS: self.section_property.mass, - # KEY_REPORT_AREA: round(self.section_property.area * 1e-2, 2), - # KEY_REPORT_DEPTH: self.section_property.depth, - # KEY_REPORT_WIDTH: self.section_property.flange_width, - # KEY_REPORT_WEB_THK: self.section_property.web_thickness, - # KEY_REPORT_FLANGE_THK: self.section_property.flange_thickness, - # KEY_DISP_FLANGE_S_REPORT: self.section_property.flange_slope, - # KEY_REPORT_R1: self.section_property.root_radius, - # KEY_REPORT_R2: self.section_property.toe_radius, - # KEY_REPORT_IZ: round(self.section_property.mom_inertia_z * 1e-4, 2), - # KEY_REPORT_IY: round(self.section_property.mom_inertia_y * 1e-4, 2), - # KEY_REPORT_RZ: round(self.section_property.rad_of_gy_z * 1e-1, 2), - # KEY_REPORT_RY: round(self.section_property.rad_of_gy_y * 1e-1, 2), - # KEY_REPORT_ZEZ: round(self.section_property.elast_sec_mod_z * 1e-3, 2), - # KEY_REPORT_ZEY: round(self.section_property.elast_sec_mod_y * 1e-3, 2), - # KEY_REPORT_ZPZ: round(self.section_property.plast_sec_mod_z * 1e-3, 2), - # KEY_REPORT_ZPY: round(self.section_property.plast_sec_mod_y * 1e-3, 2)} - - - - # self.report_input = \ - # {#KEY_MAIN_MODULE: self.mainmodule, - # KEY_MODULE: self.module, #"Axial load on column " - # KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, - # KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, - # KEY_DISP_LENGTH_BEAM: self.result_eff_len, - # KEY_DISP_SEC_PROFILE: self.sec_profile, - # KEY_DISP_SECSIZE: str(self.sec_list), - # KEY_MATERIAL: self.material, - # "Selected Section Details": self.report_column, - # KEY_BEAM_SUPP_TYPE: self.latex_design_type, - # } - - # if self.design_type == KEY_DISP_DESIGN_TYPE2_FLEXURE: - # t1 = ('SubSection', 'Lateral Torsional Buckling Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - # self.report_check.append(t1) - - # t1 = ('SubSection', 'Web Bearing Checks', '|p{4cm}|p{2 cm}|p{7cm}|p{3 cm}|') - # self.report_check.append(t1) - - # t1 = ('Bearing Strength(kN)', self.load.shear_force * 10 ** -3, - # cl_8_7_4_Bearing_stiffener_check(self.bearing_length, round(2.5 * ( - # self.section_property.root_radius + self.section_property.flange_thickness), 2), - # self.section_property.web_thickness, - # self.material_property.fy, self.gamma_m0, - # round(self.result_crippling, 2), - # self.section_property.root_radius, - # self.section_property.flange_thickness), - # get_pass_fail(self.load.shear_force * 10 ** -3, round(self.result_crippling, 2), relation="leq")) - - # self.report_check.append(t1) - # t1 = (KEY_DISP_A_eff_latex + '(mm^2)', ' ', - # cl_8_7_3_Aeff_web_check(self.bearing_length, self.section_property.web_thickness, - # self.result_bcA_eff), - # ' ') - # self.report_check.append(t1) - # if self.latex_tension_zone == True : - # t1 = (KEY_DISP_TENSION_HOLES, ' ', - # sectional_area_change(self.result_effective_area, self.section_property.area, - # self.effective_area_factor), - # ' ') - # self.report_check.append(t1) - - # else: - # t1 = (KEY_DISP_ALLOW_SHEAR, self.load.shear_force, - # allow_shear_capacity(round(self.result_shear, 2), round(0.6 * self.result_shear, 2)), - # get_pass_fail(self.load.shear_force)) - # self.report_check.append(t1) - - - - # self.h = (self.beam_D - (2 * self.beam_tf)) - # - # 1.1 Input sections display - # t1 = ('SubSection', 'List of Input Sections',self.sec_list), - # self.report_check.append(t1) - # - # # 2.2 CHECK: Buckling Class - Compatibility Check - # t1 = ('SubSection', 'Buckling Class - Compatibility Check', '|p{4cm}|p{3.5cm}|p{6.5cm}|p{2cm}|') - # self.report_check.append(t1) - # - # t1 = ("Section Class ", comp_column_class_section_check_required(self.result_section_class, self.h, self.bf), - # comp_column_class_section_check_provided(self.bucklingclass, self.h, self.bf, self.tf, self.var_h_bf), - # 'Compatible') # if self.bc_compatibility_status is True else 'Not compatible') - # self.report_check.append(t1) - - # t1 = ("h/bf , tf ", comp_column_class_section_check_required(self.bucklingclass, self.h, self.bf), - # comp_column_class_section_check_provided(self.bucklingclass, self.h, self.bf, self.tf, self.var_h_bf), - # 'Compatible') # if self.bc_compatibility_status is True else 'Not compatible') - # self.report_check.append(t1) - # - # # 2.3 CHECK: Cross-section classification - # t1 = ('SubSection', 'Cross-section classification', '|p{4.5cm}|p{3cm}|p{6.5cm}|p{1.5cm}|') - # self.report_check.append(t1) - # - # t1 = ("b/tf and d/tw ", cross_section_classification_required(self.section), - # cross_section_classification_provided(self.tf, self.b1, self.epsilon, self.section, self.b1_tf, - # self.d1_tw, self.ep1, self.ep2, self.ep3, self.ep4), - # 'b = bf / 2,d = h – 2 ( T + R1),έ = (250 / Fy )^0.5,Compatible') # if self.bc_compatibility_status is True else 'Not compatible') - # self.report_check.append(t1) - # - # # 2.4 CHECK : Member Check - # t1 = ("Slenderness", cl_7_2_2_slenderness_required(self.KL, self.ry, self.lamba), - # cl_7_2_2_slenderness_provided(self.KL, self.ry, self.lamba), 'PASS') - # self.report_check.append(t1) - # - # t1 = ( - # "Design Compressive stress (fcd)", cl_7_1_2_1_fcd_check_required(self.gamma_mo, self.f_y, self.f_y_gamma_mo), - # cl_7_1_2_1_fcd_check_provided(self.facd), 'PASS') - # self.report_check.append(t1) - # - # t1 = ("Design Compressive strength (Pd)", cl_7_1_2_design_comp_strength_required(self.axial), - # cl_7_1_2_design_comp_strength_provided(self.Aeff, self.facd, self.A_eff_facd), "PASS") - # self.report_check.append(t1) - # - # t1 = ('', '', '', '') - # self.report_check.append(t1) - else: - self.report_input = \ - {#KEY_MAIN_MODULE: self.mainmodule, - KEY_MODULE: self.module, #"Axial load on column " - KEY_DISP_SHEAR+'*': self.load.shear_force * 10 ** -3, - KEY_DISP_BEAM_MOMENT_Latex+'*': self.load.moment * 10 ** -6, - KEY_DISP_LENGTH_BEAM: self.length, - KEY_DISP_SEC_PROFILE: self.sec_profile, - KEY_DISP_SECSIZE_pg: str(self.sec_list), - KEY_MATERIAL: self.material, - # "Failed Section Details": self.report_column, - KEY_BEAM_SUPP_TYPE: self.latex_design_type, - } - self.report_input.update({ - KEY_DISP_SUPPORT : self.support, - KEY_DISP_ULTIMATE_STRENGTH_REPORT: self.material_property.fu, - KEY_DISP_YIELD_STRENGTH_REPORT: self.material_property.fy, - "End Conditions - " + str(self.support): "TITLE", - }) - # if self.Latex_length == 'NA': - if self.support == KEY_DISP_SUPPORT1: - self.report_input.update({ - DISP_TORSIONAL_RES: self.Torsional_res, - DISP_WARPING_RES:self.Warping }) - else: - self.report_input.update({ - DISP_SUPPORT_RES: self.Support, - DISP_TOP_RES: self.Top}) - self.report_input.update({ - "Design Preference" : "TITLE", - KEY_DISP_EFFECTIVE_AREA_PARA: self.effective_area_factor, - KEY_DISP_CLASS: self.allow_class, - KEY_DISP_LOAD: self.Loading, - KEY_DISPP_LENGTH_OVERWRITE: self.latex_efp, - KEY_DISP_BEARING_LENGTH + ' (mm)': self.bearing_length, - - }) - # if self.latex_design_type == VALUES_SUPP_TYPE_temp[0] and self.result_web_buckling_check: - # self.report_input.update({ - # KEY_ShearBuckling: self.support_cndition_shear_buckling - # }) - # self.report_input.update({ - # # KEY_DISP_SEC_PROFILE: self.sec_profile, - # "I Section - Mechanical Properties": "TITLE", - # }) - self.report_input.update() - self.report_check = [] - - t1 = ('Selected', 'All Members Failed', '|p{5cm}|p{2cm}|p{2cm}|p{2cm}|p{4cm}|') - self.report_check.append(t1) - - t1 = ('SubSection', 'Plastic Section Modulus', '|p{4cm}|p{1.5cm}|p{2.5cm}|p{8cm}|') - self.report_check.append(t1) - t1 = ('Plastic Section Modulus($mm^3$)', round(self.Zp_req,2), - ' ', - 'Select Sections with atleast required Plastic Section Modulus ') - self.report_check.append(t1) - - - Disp_2d_image = [] - Disp_3D_image = "/ResourceFiles/images/3d.png" - - print(sys.path[0]) - rel_path = str(sys.path[0]) - rel_path = os.path.abspath(".") # TEMP - rel_path = rel_path.replace("\\", "/") - fname_no_ext = popup_summary['filename'] - CreateLatex.save_latex(CreateLatex(), self.report_input, self.report_check, popup_summary, fname_no_ext, - rel_path, Disp_2d_image, Disp_3D_image, module=self.module) # - diff --git a/src/osdag/gui/popup_customized_design_pref.py b/src/osdag/gui/popup_customized_design_pref.py new file mode 100644 index 000000000..8046a2319 --- /dev/null +++ b/src/osdag/gui/popup_customized_design_pref.py @@ -0,0 +1,173 @@ + +from PyQt5 import QtCore, QtWidgets +from PyQt5.QtWidgets import QDialog, QListWidget, QListWidgetItem +from PyQt5.QtWidgets import ( + QDialog, QLabel, QLineEdit, QPushButton, QFormLayout, + QApplication, QMessageBox +) +from PyQt5.QtGui import QFont +from PyQt5.QtCore import Qt +import re +import sys +scale = 1 # For resizing components +class My_ListWidget(QListWidget): + def addItems(self, Iterable, p_str=None): + super().addItems(Iterable) + self.sortItems() + + def addItem(self, *__args): + super().addItem(My_ListWidgetItem(__args[0])) + self.sortItems() + +class My_ListWidgetItem(QListWidgetItem): + def __lt__(self, other): + try: + self_text = str(re.sub("[^0-9.]", "", self.text())) + other_text = str(re.sub("[^0-9.]", "", other.text())) + return float(self_text) < float(other_text) + except Exception: + return super().__lt__(other) + +class PopupDialog(QDialog): + def __init__(self, disabled_values=[], note="", parent=None): + super().__init__(parent) + self.disabled_values = disabled_values + self.note = note + self.setWindowTitle("Customized") + self.resize(int(scale*540), int(scale*470)) + self.init_ui() + self.set_styles() + + def init_ui(self): + self.label = QtWidgets.QLabel("Available:", self) + self.label.setGeometry(QtCore.QRect(20, 20, 150, 30)) + + self.label_2 = QtWidgets.QLabel("Selected:", self) + self.label_2.setGeometry(QtCore.QRect(int(scale * 320), 20, 150, 30)) + + self.listWidget = My_ListWidget(self) + self.listWidget.setGeometry(QtCore.QRect(20, 50, int(scale*180), int(scale*300))) + self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget.itemDoubleClicked.connect(self.move_to_selected) + + self.listWidget_2 = My_ListWidget(self) + self.listWidget_2.setGeometry(QtCore.QRect(int(scale*320), 50, int(scale*180), int(scale*300))) + self.listWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget_2.itemDoubleClicked.connect(self.move_to_available) + + self.pushButton = QtWidgets.QPushButton(">>", self) + self.pushButton.setGeometry(QtCore.QRect(int(scale*225), int(scale*140), int(scale*70), int(scale*30))) + + self.pushButton_2 = QtWidgets.QPushButton(">", self) + self.pushButton_2.setGeometry(QtCore.QRect(int(scale*225), int(scale*180), int(scale*70), int(scale*30))) + + self.pushButton_3 = QtWidgets.QPushButton("<", self) + self.pushButton_3.setGeometry(QtCore.QRect(int(scale*225), int(scale*220), int(scale*70), int(scale*30))) + + self.pushButton_4 = QtWidgets.QPushButton("<<", self) + self.pushButton_4.setGeometry(QtCore.QRect(int(scale*225), int(scale*260), int(scale*70), int(scale*30))) + + self.pushButton_5 = QtWidgets.QPushButton("Submit", self) + self.pushButton_5.setGeometry(QtCore.QRect(int(scale*190), int(scale*400), int(scale*140), int(scale*35))) + self.pushButton_5.setDefault(True) + + self.pushButton.clicked.connect(self.move_all_to_selected) + self.pushButton_2.clicked.connect(self.move_selected_to_selected) + self.pushButton_3.clicked.connect(self.move_selected_to_available) + self.pushButton_4.clicked.connect(self.move_all_to_available) + self.pushButton_5.clicked.connect(self.accept) + + self.listWidget.itemSelectionChanged.connect(self.update_buttons_status) + self.listWidget_2.itemSelectionChanged.connect(self.update_buttons_status) + + self.update_buttons_status() + + def update_buttons_status(self): + self.pushButton_2.setDisabled(not bool(self.listWidget.selectedItems())) + self.pushButton_3.setDisabled(not bool(self.listWidget_2.selectedItems())) + + def move_selected_to_selected(self): + for item in self.listWidget.selectedItems(): + self.listWidget_2.addItem(item.text()) + for item in self.listWidget.selectedItems(): + self.listWidget.takeItem(self.listWidget.row(item)) + + def move_selected_to_available(self): + for item in self.listWidget_2.selectedItems(): + self.listWidget.addItem(item.text()) + for item in self.listWidget_2.selectedItems(): + self.listWidget_2.takeItem(self.listWidget_2.row(item)) + + def move_all_to_selected(self): + while self.listWidget.count() > 0: + self.listWidget_2.addItem(self.listWidget.takeItem(0).text()) + + def move_all_to_available(self): + while self.listWidget_2.count() > 0: + self.listWidget.addItem(self.listWidget_2.takeItem(0).text()) + + def move_to_selected(self, item): + self.listWidget_2.addItem(item.text()) + self.listWidget.takeItem(self.listWidget.row(item)) + + def move_to_available(self, item): + self.listWidget.addItem(item.text()) + self.listWidget_2.takeItem(self.listWidget_2.row(item)) + + def get_selected_items(self): + return [self.listWidget_2.item(i).text() for i in range(self.listWidget_2.count())] + + def set_styles(self): + brown = "#925a5b" + grey = "#8e8e8e" + white = "#ffffff" + + button_style = f""" + QPushButton {{ + background-color: {brown}; + color: {white}; + border-radius: 6px; + font-size: 22px; + padding: 6px 18px; + border: none; + }} + QPushButton:disabled {{ + background-color: {grey}; + color: {white}; + }} + """ + for btn in [self.pushButton, self.pushButton_2, self.pushButton_3, self.pushButton_4, self.pushButton_5]: + btn.setStyleSheet(button_style) + + list_item_style = """ + QListWidget::item { + font-size: 24px; + color: black; + margin: 2px 0px; + } + """ + scrollbar_style = f""" + QScrollBar:vertical {{ + border: none; + background: #f5f5f5; + width: 12px; + border-radius: 6px; + }} + QScrollBar::handle:vertical {{ + background: {grey}; + min-height: 20px; + border-radius: 6px; + }} + QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {{ + background: none; + height: 0px; + }} + QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {{ + background: none; + }} + QScrollBar:horizontal {{ + height: 0px; + }} + """ + self.listWidget.setStyleSheet(list_item_style + scrollbar_style) + self.listWidget_2.setStyleSheet(list_item_style + scrollbar_style) \ No newline at end of file diff --git a/src/osdag/gui/popup_display_pg.py b/src/osdag/gui/popup_display_pg.py new file mode 100644 index 000000000..03f4b21ec --- /dev/null +++ b/src/osdag/gui/popup_display_pg.py @@ -0,0 +1,45 @@ +from PyQt5.QtWidgets import ( + QDialog, QVBoxLayout, QLabel, QApplication +) +from PyQt5.QtGui import QFont +from PyQt5.QtCore import Qt +import sys + + +class AvailableThicknessDialog(QDialog): + def __init__(self, thickness_list): + super().__init__() + self.setWindowTitle("Available Thicknesses") + self.setFixedSize(1000, 200) # Wider dialog box + self.init_ui(thickness_list) + self.set_styles() + + def init_ui(self, thickness_list): + layout = QVBoxLayout() + + message = f"Available thicknesses by default - {thickness_list}" + self.label = QLabel(message) + self.label.setWordWrap(True) + self.label.setFont(QFont("Segoe UI", 12)) + self.label.setAlignment(Qt.AlignLeft | Qt.AlignTop) + + layout.addWidget(self.label) + self.setLayout(layout) + + def set_styles(self): + self.setStyleSheet(""" + QDialog { + background-color: white; + } + QLabel { + font-size: 12pt; + color: #333; + padding: 10px; + } + """) +if __name__ == "__main__": + app = QApplication(sys.argv) + default_thicknesses = ['8', '10', '12', '14', '16', '18', '20', '22', '25', '28', '32', '36', '40', '45', '50', '56', '63', '75', '80', '90', '100', + '110', '120'] + dialog = AvailableThicknessDialog(default_thicknesses) + dialog.exec_() diff --git a/src/osdag/gui/popup_input_bounds_read.py b/src/osdag/gui/popup_input_bounds_read.py new file mode 100644 index 000000000..20a993fcb --- /dev/null +++ b/src/osdag/gui/popup_input_bounds_read.py @@ -0,0 +1,88 @@ +from PyQt5.QtWidgets import ( + QDialog, QLineEdit, QFormLayout, QLabel, QMessageBox +) +from PyQt5.QtGui import QFont +from PyQt5.QtCore import Qt + + +class RangeInputDialogRead(QDialog): + def __init__(self): + super().__init__() + self.setWindowTitle("Custom Range Input") + self.setFixedSize(350, 230) # Increased height to accommodate larger inputs + self.set_styles() + + self.values = [] + + self.lower_input = QLineEdit() + self.upper_input = QLineEdit() + self.step_input = QLineEdit() + + # Set font and height for better clarity + for widget in [self.lower_input, self.upper_input, self.step_input]: + widget.setFont(QFont("Segoe UI", 13)) # Larger font + widget.setFixedHeight(44) # Taller input box + + form_layout = QFormLayout() + form_layout.setLabelAlignment(Qt.AlignRight) + form_layout.setFormAlignment(Qt.AlignCenter) + + lower_label = QLabel("Lower Bound:") + upper_label = QLabel("Upper Bound:") + step_label = QLabel("Step:") + + for label in [lower_label, upper_label, step_label]: + label.setFont(QFont("Segoe UI", 11)) + + form_layout.addRow(lower_label, self.lower_input) + form_layout.addRow(upper_label, self.upper_input) + form_layout.addRow(step_label, self.step_input) + + self.setLayout(form_layout) + + def set_styles(self): + self.setStyleSheet(""" + QDialog { + background-color: white; + } + QLabel { + font-size: 11pt; + } + QLineEdit { + font-size: 13pt; + padding: 6px 10px; + border: 1px solid #aaa; + border-radius: 4px; + } + """) + + def show_error(self, message): + QMessageBox.warning(self, "Input Error", message) + + def get_values(self): + return self.values + + def set_read_only_values(self, lower, upper, step): + """Populates the fields with given values and makes them uneditable.""" + self.lower_input.setText(str(lower)) + self.upper_input.setText(str(upper)) + self.step_input.setText(str(step)) + + self.lower_input.setReadOnly(True) + self.upper_input.setReadOnly(True) + self.step_input.setReadOnly(True) + + def set_custom_title(self, title): + """Sets a custom title for the dialog window.""" + self.setWindowTitle(title) + + +if __name__ == "__main__": + import sys + from PyQt5.QtWidgets import QApplication + + app = QApplication(sys.argv) + dialog = RangeInputDialogRead() + dialog.set_custom_title("Display Sensor Range") + dialog.set_read_only_values(10.0, 100, 10) + dialog.exec_() \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/sample.py b/src/osdag/gui/popup_input_bounds_read_write.py similarity index 100% rename from src/osdag/design_type/plate_girder/sample.py rename to src/osdag/gui/popup_input_bounds_read_write.py diff --git a/src/osdag/gui/ui_template.py b/src/osdag/gui/ui_template.py index e862d39fb..d2e203b7c 100644 --- a/src/osdag/gui/ui_template.py +++ b/src/osdag/gui/ui_template.py @@ -33,6 +33,7 @@ from OCC.Core.StlAPI import StlAPI_Writer from OCC.Core import BRepTools from OCC.Core import IGESControl +from .popup_input_bounds_read_write import RangeInputDialog from ..cad.cad3dconnection import cadconnection from ..design_type.connection.fin_plate_connection import FinPlateConnection from ..design_type.connection.column_cover_plate import ColumnCoverPlate @@ -58,6 +59,10 @@ from ..gusset_connection import GussetConnection import logging import subprocess +from .popup_input_bounds_read import RangeInputDialogRead +from .popup_display_pg import AvailableThicknessDialog +from .popup_input_bounds_read_write import RangeInputDialog +from .popup_customized_design_pref import PopupDialog from ..get_DPI_scale import scale,height,width from ..cad.cad3dconnection import cadconnection from pynput.mouse import Button, Controller @@ -176,6 +181,7 @@ def closeEvent(self, event): event.ignore() class Window(QMainWindow): + input_button_values_dictionary = {} closed = QtCore.pyqtSignal() def center(self): frameGm = self.frameGeometry() @@ -538,6 +544,7 @@ def setupUi(self, MainWindow, main,folder): self.inputDock.setObjectName("inputDock") self.dockWidgetContents = QtWidgets.QWidget() self.dockWidgetContents.setObjectName("dockWidgetContents") + button_list = [] # palette = QtGui.QPalette() # brush = QtGui.QBrush(QtGui.QColor(0, 0, 127)) @@ -743,6 +750,25 @@ def setupUi(self, MainWindow, main,folder): l.setFixedSize(l.size()) in_layout2.addWidget(l, j, 2, 1, 1) + + if type == TYPE_IN_BUTTON: + # fields = 0 + v = option[3] + b = QtWidgets.QPushButton(self.dockWidgetContents) + b.setObjectName(option[0]) + #b.setFixedSize(b.size()) + b.resize(b.sizeHint().width(), b.sizeHint().height()+100) + b.setText(v[0]) + b.setDisabled(False) + b.setVisible(True if option[4] else False) + # fields += 1 + # self.output_title_fields[current_key][1] = fields + #b.setFixedSize(b.size()) + button_list.append(option) + in_layout2.addWidget(b, j, 2, 1, 1) + maxi_width_right = max(maxi_width_right, b.sizeHint().width()) + #b.clicked.connect(lambda: self.output_button_dialog(main, out_list)) + if type == TYPE_IMAGE: im = QtWidgets.QLabel(self.dockWidgetContents) im.setGeometry(QtCore.QRect(190, 10 + i, 100, 100)) @@ -795,6 +821,11 @@ def setupUi(self, MainWindow, main,folder): maxi_width = max(maxi_width, int(scale*350)) # In case there is no widget self.inputDock.setFixedWidth(maxi_width) self.in_widget.setFixedWidth(maxi_width) + if button_list: + for button_key in button_list: + button = self.dockWidgetContents.findChild(QtWidgets.QWidget, button_key[0]) + print("\n\n\n button_key", button_key) + self.inp_button_connect(main, button_list, button) for option in option_list: key = self.dockWidgetContents.findChild(QtWidgets.QWidget, option[0]) @@ -1372,6 +1403,14 @@ def setupUi(self, MainWindow, main,folder): last_design_dictionary = yaml.safe_load(last_design) print(f'last_design_dictionary {last_design_dictionary}') if isinstance(last_design_dictionary, dict): + + for k,val in self.input_button_values_dictionary.items(): + print("\n\n\n VALUES ", k, val) + if k not in last_design_dictionary.keys(): + last_design_dictionary[k] = val + else: + last_design_dictionary[k] = val + print("\n \n LAST DESIGN DICTIONARY", last_design_dictionary) self.setDictToUserInputs(last_design_dictionary, option_list, data, new_list) if "out_titles_status" in last_design_dictionary.keys(): title_status = last_design_dictionary["out_titles_status"] @@ -1570,6 +1609,29 @@ def change(self, k1, new, data, main): elif typ == TYPE_CUSTOM_SECTION: if val: self.import_custom_section() + # elif typ == TYPE_CUSTOM_BOUNDS: + # k2.clear() + # if val == 'Default Bounds': + # # dialog = RangeInputDialogRead() + # # dialog.set_custom_title("Display Sensor Range") + # # dialog.set_read_only_values(10.0, 100, 10) + # # dialog.exec_() + # # for values in dialog.get_values(): + # for values in ["10.0", "100", "10"]: + # k2.addItem(values) + # k2.setCurrentIndex(0) + # elif val == 'Custom Bounds': + # dialog = RangeInputDialog() + # if dialog.exec_() == QDialog.Accepted: + # print("Returned values:", dialog.get_values()) + # for values in dialog.get_values(): + # k2.addItem(str(values)) + # k2.setCurrentIndex(0) + # else: + # k2.clear() + # for values in val: + # k2.addItem(str(values)) + # k2.setCurrentIndex(0) elif typ == TYPE_LABEL: k2.setText(val) @@ -2185,6 +2247,22 @@ def osdag_header(self): shutil.copyfile(image_path, os.path.join(str(self.folder), "images_html", "OsdagHeader.png")) shutil.copyfile(image_path2, os.path.join(str(self.folder), "images_html", "ColumnsBeams.png")) + def inp_button_connect(self, main, button_list, b): + # Connect button's clicked signal to call handler using lambda + print("\n\n\n\n BUTTON TYPE DETAILS",button_list, b, b.objectName()) + b.clicked.connect(lambda: self.inp_button_call(main, button_list, b)) + + def inp_button_call(self, main, button_list, button): + # Loop through button list to find the button match + for v in button_list: + if v[0] == button.objectName(): + dialog = RangeInputDialog() + if dialog.exec_() == QDialog.Accepted: + values = dialog.get_values() + print("Returned values:", values) + # You can handle values here or emit a signal if needed + self.input_button_values_dictionary[button.objectName()] = values + def output_button_connect(self, main, button_list, b): b.clicked.connect(lambda: self.output_button_dialog(main, button_list, b)) diff --git a/src/osdag/gui/ui_template_for_mac.py b/src/osdag/gui/ui_template_for_mac.py index 81c6ecce8..062a1e68b 100644 --- a/src/osdag/gui/ui_template_for_mac.py +++ b/src/osdag/gui/ui_template_for_mac.py @@ -703,6 +703,9 @@ def setupUi(self, MainWindow, main,folder): i = i + 30 im.setFixedSize(im.size()) in_layout2.addWidget(im, j, 2, 1, 1) + + + if type == TYPE_IMAGE_COMPRESSION: imc = QtWidgets.QLabel(self.dockWidgetContents) diff --git a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py index d9a120451..ea101d8fd 100644 --- a/src/osdag/utils/common/Unsymmetrical_Section_Properties.py +++ b/src/osdag/utils/common/Unsymmetrical_Section_Properties.py @@ -14,7 +14,7 @@ class Unsymmetrical_I_Section_Properties: def calc_mass(self, D, B_top, B_bot, t_w, t_f_top, t_f_bot): A = Unsymmetrical_I_Section_Properties.calc_area(self,D, B_top, B_bot, t_w, t_f_top, t_f_bot) - M = (7850 * A) / 10000 + M = (7850 * A) / 1000000 # Convert to kg from mm^2 return round(M, 2) @@ -85,11 +85,9 @@ def calc_PlasticModulusZ(self, D, bf_top, bf_bot, tw, tf_top, tf_bot, eps): """ # clear web height between flange faces h_w = D - tf_top - tf_bot - # print("Inside plastic modulus Z function",h_w, tw, tf_top, tf_bot) - # print("Epsilon", eps) # thin-web check - if h_w/tw < 67 * eps: - print("Inside thin web check",h_w/tw) + if h_w/tw > 67 * eps: + print("Thin web condition, using rectangular section properties", h_w/tw) A_top = bf_top * tf_top A_bot = bf_bot * tf_bot A = A_top + A_bot @@ -97,7 +95,6 @@ def calc_PlasticModulusZ(self, D, bf_top, bf_bot, tw, tf_top, tf_bot, eps): # Centroid location from top fiber # top rectangle centroid at tf_top/2, bottom at D - tf_bot/2 c = (A_top * (tf_top / 2) + A_bot * (D - tf_bot / 2)) / A - # print("C value inside pLASMod",c) c1 = D - c # Distances from each rectangle's centroid to the composite centroid @@ -112,13 +109,10 @@ def calc_PlasticModulusZ(self, D, bf_top, bf_bot, tw, tf_top, tf_bot, eps): I = I_top + A_top * y_top_centroid ** 2 + I_bot + A_bot * y_bot_centroid ** 2 # Section moduli - # print("Zp value",I) Zp = I / c return round(Zp, 2) - else: - print("THICK WEB CHECK",h_w/tw) A_u = bf_top * tf_top A_d = bf_bot * tf_bot diff --git a/src/osdag/utils/common/is800_2007.py b/src/osdag/utils/common/is800_2007.py index a183b00b3..8eee5c195 100644 --- a/src/osdag/utils/common/is800_2007.py +++ b/src/osdag/utils/common/is800_2007.py @@ -1380,7 +1380,7 @@ def cl_8_4_2_2_TensionField( c, d, tw, fyw, bf,tf, fyf,Nf, gamma_mo, A_v,tau_b,V def cl_8_4_2_2_TensionField_unequal_Isection( c, d, tw, fyw, bf_top, tf_top, bf_bot, tf_bot, - Nf, gamma_m0, A_v, tau_b, V_p + Nf, gamma_m0, A_v, tau_b ): """ Tension‐field method per IS 800:2007 Cl. 8.4.2.2 for unequal flanges. @@ -1408,21 +1408,30 @@ def cl_8_4_2_2_TensionField_unequal_Isection( if c == 0: phi = 90.0 else: - phi = math.degrees(math.atan(d / c)) + phi = math.degrees(math.atan((d / c) / 1.5)) # 2) Reduced plastic moment of each flange def Mfr(bf, tf): Mp = 0.25 * bf * tf**2 * fyw - ratio = Nf * 1e3 / (bf * tf * fyw / gamma_m0) # Nf in kN → multiply by 1e3 - return Mp * (1 - ratio**2) + ratio = Nf / (bf * tf * fyw / gamma_m0) + if ratio >= 1: + return 0 + else: + return Mp * (1 - ratio**2) Mfr_t = Mfr(bf_top, tf_top) Mfr_b = Mfr(bf_bot, tf_bot) # 3) s‐values for each flange, limited to c + sinφ = math.sin(math.radians(phi)) - s_t = min(2 * math.sqrt(Mfr_t / (fyw * tw)) / sinφ, c) - s_b = min(2 * math.sqrt(Mfr_b / (fyw * tw)) / sinφ, c) + if sinφ == 0: + s_t= 0 + s_b= 0 + else: + s_t = min(2 * math.sqrt(Mfr_t / (fyw * tw)) / sinφ, c) + s_b = min(2 * math.sqrt(Mfr_b / (fyw * tw)) / sinφ, c) + # 4) Width of the tension field w_tf w_tf = d * math.cos(math.radians(phi)) - (c - s_t - s_b) * sinφ @@ -1432,7 +1441,8 @@ def Mfr(bf, tf): fv = math.sqrt(fyw**2 - 3 * tau_b**2 + psi**2) - psi # 6) Nominal shear resistance V_tf (kN) - V_tf = (A_v * tau_b + 0.9 * w_tf * tw * fv * sinφ) / 1e3 + V_tf = (A_v * tau_b + 0.9 * w_tf * tw * fv * sinφ) + V_p = d * tw * fyw / (math.sqrt(3) * gamma_m0) # Plastic shear strength V_tf = min(V_tf, V_p) return phi, Mfr_t, Mfr_b, s_t, s_b, w_tf, psi, fv, V_tf @@ -1494,9 +1504,10 @@ def cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffener_type, c=Non """ results = {} - - if stiffener_type == "no_stiffener": + print(stiffener_type) + if stiffener_type == "no_stiffener" or c > 3 * d: ratio = d / tw + print("Web Ratio:", ratio) limit_serv = 200 * eps limit_buckling = 345 * (eps ** 2) limit = min(limit_serv, limit_buckling) @@ -1508,75 +1519,92 @@ def cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffener_type, c=Non elif stiffener_type == "transverse_only": if c is None: - return False #{"Error": "Spacing 'c' is required for 'transverse_only' stiffeners."} - if 3 * d >= c >= 1.5 * d: - ratio = d / tw + return False #{"Error": "Spacing 'c' is required for 'transverse_only' stiffeners."} + print("c:", c, "d:", d, "tw:", tw, "eps:", eps) + if 3 * d >= c and c >= 1.5 * d: + ratio_serv = d / tw + ratio_buckling = d / tw limit_serv = 200 * eps limit_buckling = 345 * (eps ** 2) - elif 1.5 * d > c >= d: - ratio = d / tw + elif 1.5 * d > c and c >= d: + ratio_serv = d / tw + ratio_buckling = d / tw limit_serv = 200 * eps limit_buckling = 345 * eps - elif 0.74 * d <= c < d: - ratio = c / tw + elif 0.74 * d <= c and c < d: + ratio_serv = c / tw + ratio_buckling = d / tw limit_serv = 200 * eps limit_buckling = 345 * eps elif c < 0.74 * d: - ratio = d / tw + ratio_serv = d / tw + ratio_buckling = d / tw limit_serv = 270 * eps limit_buckling = 345 * eps else: + print('Transverse only') return False #{"Error": "Invalid range for spacing 'c'."} - limit = min(limit_serv, limit_buckling) - results["Limit"] = limit - results["Pass"] = ratio <= limit + + if ratio_serv <= limit_serv and ratio_buckling <= limit_buckling: + return True + else: + return False elif stiffener_type == "transverse_and_two_longitudinal_neutral": - ratio = d / tw - limit = 400 * eps - results["Limit"] = limit - results["Pass"] = ratio <= limit + if c >= 1.5 * d : + ratio = d / tw + limit_serv = 400 * eps + limit_buckling = 345 * (eps ** 2) + limit = min(limit_serv, limit_buckling) + + else: + ratio = d / tw + limit_serv = 400 * eps + limit_buckling = 345 * eps + limit = min(limit_serv, limit_buckling) + + if ratio <= limit: + return True + else: + return False elif stiffener_type == "transverse_and_one_longitudinal_compression": if c is None: return False #{"Error": "Spacing 'c' is required for compression flange restraint."} - if 2.4 * d >= c >= 1.5 * d: - ratio = d / tw + if 2.4 * d >= c and c >= 1.5 * d: + ratio_serv = d / tw + ratio_buckling = d / tw limit_serv = 250 * eps limit_buckling = 345 * (eps ** 2) - elif 1.5 * d > c >= d: - ratio = d / tw - limit_serv = 200 * eps + elif 1.5 * d > c and c >= d: + ratio_serv = d / tw + ratio_buckling = d / tw + limit_serv = 250 * eps limit_buckling = 345 * eps - elif 0.74 * d <= c < d: - ratio = c / tw + elif 0.74 * d <= c and c < d: + ratio_serv = c / tw + ratio_buckling = d / tw limit_serv = 250 * eps limit_buckling = 345 * eps elif c < 0.74 * d: - ratio = d / tw + ratio_serv = d / tw + ratio_buckling = d / tw limit_serv = 340 * eps limit_buckling = 345 * eps else: return False #{"Error": "Invalid range for spacing 'c'."} - limit = min(limit_serv, limit_buckling) - results["Limit"] = limit - results["Pass"] = ratio <= limit + if ratio_serv <= limit_serv and ratio_buckling <= limit_buckling: + return True + else: + return False else: return False #{"Error": "Invalid stiffener_type provided."} - if 'c' in locals() and ratio == c / tw: - results["c/tw"] = ratio - else: - results["d/tw"] = ratio - - results["ε"] = eps - return True - # ========================================================================== """ SECTION 9 MEMBER SUBJECTED TO COMBINED FORCES """ From 6b638ad4e58049b3db917a2281624931dd91f184 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Sun, 1 Jun 2025 13:20:08 +0530 Subject: [PATCH 21/23] TO check the cad diagram loading --- src/osdag/Common.py | 2 +- src/osdag/cad/common_logic.py | 67 +++ src/osdag/cad/items/plate_girder.py | 433 ++++++++++++++++++ .../plate_girder/weldedPlateGirder.py | 1 + src/osdag/gui/ui_template.py | 7 +- 5 files changed, 507 insertions(+), 3 deletions(-) create mode 100644 src/osdag/cad/items/plate_girder.py diff --git a/src/osdag/Common.py b/src/osdag/Common.py index a9d49f782..4641fb55b 100644 --- a/src/osdag/Common.py +++ b/src/osdag/Common.py @@ -649,7 +649,7 @@ def is_valid_custom(self): ################################### # Plate Girder ################################### -KEY_PLATE_GIRDER_MAIN_MODULE = 'PLATE GIRDER' +# KEY_PLATE_GIRDER_MAIN_MODULE = 'PLATE GIRDER' KEY_DISP_PLATE_GIRDER_WELDED = 'PLATE GIRDER' KEY_DISP_PG_SectionDetail = 'Section Details' KEY_tf = 'TF.Data' diff --git a/src/osdag/cad/common_logic.py b/src/osdag/cad/common_logic.py index 8be3d21dc..2e9feeb5b 100644 --- a/src/osdag/cad/common_logic.py +++ b/src/osdag/cad/common_logic.py @@ -21,6 +21,7 @@ from .items.angle import Angle from .items.channel import Channel from .items.Gasset_plate import GassetPlate +from .items.plate_girder import PlateGirder from .items.stiffener_flange import Stiffener_flange from .items.rect_hollow import RectHollow from .items.circular_hollow import CircularHollow @@ -1982,6 +1983,54 @@ def createStrutsInTrusses(self): return shape + def createPlateGirder(self): #im working here + + # Val_obj = self.module_class + # Val_obj.section_property = Val_obj.section_connect_database(Val_obj, Val_obj.result_designation) + + Val_obj = self.module_class + print("THIS IS Val_obj") + print(Val_obj) + for attr in dir(Val_obj): + if not callable(getattr(Val_obj, attr)) and not attr.startswith("__"): + print(f"{attr}: {getattr(Val_obj, attr)}") + + design_type = Val_obj.design_type + print("Design type : ", design_type) + length = int(Val_obj.length) + print("Total Length : ", length) + + D = int(Val_obj.total_depth) + print("Total Depth : ", D) + + tw = int(Val_obj.web_thickness) + print("Web Thickness : ", tw) + + B_ft = int(Val_obj.top_flange_width) + print("Top Flange Width : ", B_ft) + + T_ft = int(Val_obj.top_flange_thickness) + print("Top Flange Thickness : ", T_ft) + + B_fb = int(Val_obj.bottom_flange_width) + print("Bottom Flange Width : ", B_fb) + + T_fb = int(Val_obj.bottom_flange_thickness) + print("Bottom Flange Thickness : ", T_fb) + + gap = int(Val_obj.c) + print("Gap Between Stiffener : ", gap) + + + + + plate_girder_model = PlateGirder(D, tw, length, gap, T_ft, T_fb, B_ft, B_fb) + + model = plate_girder_model.createPlateGirder() + + return model + + def display_3DModel(self, component, bgcolor): self.component = component @@ -2335,6 +2384,14 @@ def display_3DModel(self, component, bgcolor): if self.component == "Model": osdag_display_shape(self.display, self.ColObj, update=True) + + elif self.mainmodule == KEY_DISP_PLATE_GIRDER_WELDED: #im working here + self.col = self.module_class() + self.ColObj = self.createPlateGirder() + + if self.component == "Model": + osdag_display_shape(self.display, self.ColObj, update=True) + else: if self.connection == KEY_DISP_TENSION_BOLTED: self.T = self.module_class() @@ -2528,6 +2585,16 @@ def call_3DModel(self, flag, module_class): # Done else: self.display.EraseAll() + + elif self.mainmodule == KEY_DISP_PLATE_GIRDER_WELDED:#im working here + if flag is True: + self.ColObj = self.createPlateGirder() + + self.display_3DModel("Model", "gradient_bg") + + else: + self.display.EraseAll() + else: if self.connection == KEY_DISP_TENSION_BOLTED or self.connection == KEY_DISP_TENSION_WELDED: diff --git a/src/osdag/cad/items/plate_girder.py b/src/osdag/cad/items/plate_girder.py new file mode 100644 index 000000000..63809f30d --- /dev/null +++ b/src/osdag/cad/items/plate_girder.py @@ -0,0 +1,433 @@ +from .plate import Plate +from .filletweld import FilletWeld +import math +import numpy + +# OCC Imports +from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Trsf, gp_Ax1, gp_Dir +from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakePolygon, BRepBuilderAPI_MakeFace, BRepBuilderAPI_Transform, BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire +from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakePrism +from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Fuse, BRepAlgoAPI_Cut +from OCC.Core.AIS import AIS_Shape +from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB +from OCC.Core.Graphic3d import Graphic3d_NOM_ALUMINIUM, Graphic3d_MaterialAspect +from OCC.Display.SimpleGui import init_display + + + + + + +class PlateGirder: + + def __init__(self,D,tw,length,gap,T_ft,T_fb,B_ft,B_fb): + super(PlateGirder, self).__init__() + self.D =D + self.tw =tw + self.length =length + self.gap =gap + self.T_ft =T_ft + self.T_fb =T_fb + self.B_ft =B_ft + self.B_fb =B_fb + + def createPlateGirder(self): + #central plate + #self.D = self.total_depth # total depth + #self.tw = self.web_thickness #web thickness + # length = self.length #length along Y axis or length of the section + + # gap = self.c #space between each stiffner plate + chamfer_length = 20 #traingular chamfer length hard coding the value + + + L_top = self.length #length of top plate of I section + L_bottom = self.length #length of bottom plate of I section + + bottom_outstand = 30 #bottom outstand + top_outstand = 50 #top outstand + + + stiffener_weld_height = None + web_flange_weld_height = 5 #height of weld for web flange hard coding the value + + + # #top and bottom flange + # T_ft = self.top_flange_thickness #top flange thickness + # T_fb = self.bottom_flange_thickness #bottom flange thickness + # B_ft = self.top_flange_width #breadth or width of top flange + # B_fb = self.bottom_flange_width #breadth or width of bottom flange + + + + # stiffener's dimensions + L = (min(self.B_ft, self.B_fb)-self.tw)/2 -10 #horizontal length + T_is = 5 #thickness of stiffener # need to check this + W = self.D - (self.T_fb+self.T_ft) #vertical height + + #weld dimensions + b = 5 + h = 5 + h=b + l = L - chamfer_length + + + # Define the colors using Quantity_Color + center_plate_color = Quantity_Color(5/255, 5/255, 255/255, Quantity_TOC_RGB) + top_bottom_plate_color = Quantity_Color(137/255, 95/255, 16/255, Quantity_TOC_RGB) + + def plate_model_with_color(origin, l, b, h, color): + plate_origin = origin + plate_uDir = numpy.array([0.,0.,1.]) + plate_wDir = numpy.array([0.,1.,0.]) + plate = Plate(l, b, h) + _place = plate.place(plate_origin, plate_uDir, plate_wDir) + plate_point = plate.compute_params() + plate_shape = plate.create_model() + + # Apply the color to the plate shape using AIS_Shape + ais_shape = AIS_Shape(plate_shape) + ais_shape.SetColor(color) + display.Context.Display(ais_shape, True) + + return plate_shape + + + + print("model generating......") + + + + start_gap = end_gap = self.gap # gap at front and back + + + #initialisation of the display method to display the 3D model + display, start_display, add_menu, add_function_to_menu = init_display() + display.set_bg_gradient_color([51, 51, 102], [150, 150, 170]) + + + + center_plate = plate_model_with_color(numpy.array([0., 0., 0.]) ,self.tw, self.length,self.D, center_plate_color) + top_plate = plate_model_with_color(numpy.array([0, 0, (self.D + self.T_ft) // 2]) , self.B_ft, L_top, self.T_ft, top_bottom_plate_color) + bottom_plate = plate_model_with_color(numpy.array([0, 0, -(self.D+self.T_fb) // 2]) , self.B_fb, L_bottom, self.T_fb, top_bottom_plate_color) + + + ISection_model = BRepAlgoAPI_Fuse(bottom_plate, top_plate).Shape() + #ISection_model = BRepAlgoAPI_Fuse(ISection_model, bottom_plate).Shape() + + def translation_movement(x,y,z, model): + trsf = gp_Trsf() + translation_vector = gp_Vec(x, y, z) + trsf.SetTranslation(translation_vector) + model = BRepBuilderAPI_Transform(model, trsf).Shape() + return model + + def translation_rotation(angle,axis, model): + trsf = gp_Trsf() + trsf.SetRotation(axis, math.radians(angle)) + model = BRepBuilderAPI_Transform(model, trsf).Shape() + return model + + def triangle_model(p1,p2,p3, thickness): + + polygon = BRepBuilderAPI_MakePolygon() + polygon.Add(p1) + polygon.Add(p2) + polygon.Add(p3) + polygon.Close() + face = BRepBuilderAPI_MakeFace(polygon.Shape()).Face() + direction = gp_Vec(0, 3*thickness, 0) + extrusion = BRepPrimAPI_MakePrism(face, direction) + triangle_3d = extrusion.Shape() + ais_shape = AIS_Shape(triangle_3d) + + return ais_shape.Shape() + + + def create_weld_model(thickness, width, position, direction): + origin = position + + if direction=='y': + uDir = numpy.array([0., 0., 1.]) + shaftDir = numpy.array([0., 1., 0.]) + + elif direction=='x': + uDir = numpy.array([0., 0., 1.]) + shaftDir = numpy.array([1., 0., 0.]) + + elif direction=='z': + uDir = numpy.array([1., 0., 0.]) + shaftDir = numpy.array([0., 0., 1.]) + + FWeld = FilletWeld(thickness, thickness, width) + _place = FWeld.place(origin, uDir, shaftDir) + point = FWeld.compute_params() + prism = FWeld.create_model(0) + + return prism + + + def create_corner_cutout(model, coordinates, thickness, side): + + x = coordinates[0] + y = coordinates[1] + z = coordinates[2] + # extra_gap = chamfer_length+4 + if side=="right": + #top triangle cutout + t_p1 = gp_Pnt(self.tw//2, y-thickness,self.D//2) + t_p2 = gp_Pnt(self.tw//2, y-thickness, (self.D//2)-chamfer_length) + t_p3 = gp_Pnt((self.tw//2)+chamfer_length, y-thickness,self.D//2) + + top_triangle = triangle_model(t_p1,t_p2,t_p3, thickness) + model = BRepAlgoAPI_Cut(model, top_triangle).Shape() + + + #bottom triangle cutout + b_p1 = gp_Pnt(self.tw//2, y-thickness, -self.D//2) + b_p2 = gp_Pnt(self.tw//2, y-thickness, -(self.D//2)+chamfer_length) + b_p3 = gp_Pnt((self.tw//2)+chamfer_length, y-thickness, -self.D//2) + + bottom_triangle= triangle_model(b_p1,b_p2,b_p3, thickness) + final_model = BRepAlgoAPI_Cut(model, bottom_triangle).Shape() + + + if side=="left": + #top triangle cutout + t_p1 = gp_Pnt(-self.tw//2, y-thickness,self.D//2) + t_p2 = gp_Pnt(-self.tw//2, y-thickness, (self.D//2)-chamfer_length) + t_p3 = gp_Pnt(-(self.tw//2)-chamfer_length, y-thickness,self.D//2) + + top_triangle = triangle_model(t_p1,t_p2,t_p3, thickness) + model = BRepAlgoAPI_Cut(model, top_triangle).Shape() + + + #bottom triangle cutout + b_p1 = gp_Pnt(-self.tw//2, y-thickness, -(self.D//2)) + b_p2 = gp_Pnt(-self.tw//2, y-thickness, -(self.D//2)+chamfer_length) + b_p3 = gp_Pnt(-(self.tw//2)-chamfer_length, y-thickness, -(self.D//2)) + + bottom_triangle= triangle_model(b_p1,b_p2,b_p3, thickness) + final_model = BRepAlgoAPI_Cut(model, bottom_triangle).Shape() + + + return final_model + + + def stiffner_plate(position, L,D, T_is, direction): + ''' + this function returns stiffner plate with corner cutout, hence this function can be called multiple times inside for loop + ''' + + #creating stiffner plate model + + #plate_origin = numpy.array([-L//2-self.tw//2,remaining_gap,-D//2]) + plate_origin = position + plate_uDir = numpy.array([0.,1.,0.]) + plate_wDir = numpy.array([0.,0.,1.]) + plate = Plate(L,self.D, T_is) + _place = plate.place(plate_origin, plate_uDir, plate_wDir) + point = plate.compute_params() + stiffner_plate_model = plate.create_model() + + #punching cutouts in the stiffner plate + stiffner_plate_model = create_corner_cutout(stiffner_plate_model, plate_origin, T_is, direction) + + return stiffner_plate_model + + + def vertical_weld(weld_height, length): + ''' + this function creates vertical weld between stiffner plate and the vertical plate of the I section plate + ''' + p1 = gp_Pnt(0, 0, 0) + p2 = gp_Pnt(weld_height, 0, 0) + p3 = gp_Pnt(0, -weld_height, 0) + edge1 = BRepBuilderAPI_MakeEdge(p1, p2).Edge() + edge2 = BRepBuilderAPI_MakeEdge(p2, p3).Edge() + edge3 = BRepBuilderAPI_MakeEdge(p3, p1).Edge() + wire = BRepBuilderAPI_MakeWire(edge1, edge2, edge3).Wire() + face = BRepBuilderAPI_MakeFace(wire).Face() + extrude_vec = gp_Vec(0, 0, length) + solid = BRepPrimAPI_MakePrism(face, extrude_vec).Shape() + return solid + + + def filletWeld_model(b, h, l, y, position, T_is): + origin = numpy.array([0., 0., 0.]) + uDir = numpy.array([0., 0., 1.]) + shaftDir = numpy.array([1., 0., 0.]) + FWeld = FilletWeld(b, h, l) + _place = FWeld.place(origin, uDir, shaftDir) + point = FWeld.compute_params() + prism = FWeld.create_model(0) + angle = 0 + axis = gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)) + x=0 + ''' + position if statement for right and left weld + ''' + if position=="right": + x=self.tw//2+chamfer_length + + if position=="left": + x=(-self.tw//2)-l-chamfer_length + + + #formation of front weld + + + #down + trsf = gp_Trsf() + angle = 0 + trsf.SetRotation(axis, math.radians(angle)) + prism_down = BRepBuilderAPI_Transform(prism, trsf).Shape() + + #up + trsf = gp_Trsf() + angle = 90 + trsf.SetRotation(axis, math.radians(angle)) + prism_up = BRepBuilderAPI_Transform(prism, trsf).Shape() + + #translation + prism_up = translation_movement(x, y-T_is//2,self.D//2, prism_up) + + prism_down = translation_movement( x, y-T_is//2, -(self.D//2), prism_down) + + + weld_fused_forward= BRepAlgoAPI_Fuse(prism_up, prism_down).Shape() + + #for behind weld + + #down + trsf = gp_Trsf() + angle = 270 + trsf.SetRotation(axis, math.radians(angle)) + prism_down = BRepBuilderAPI_Transform(prism, trsf).Shape() + + #up + trsf = gp_Trsf() + angle = 180 + trsf.SetRotation(axis, math.radians(angle)) + prism_up = BRepBuilderAPI_Transform(prism, trsf).Shape() + + #translation + prism_up = translation_movement( x, y+T_is//2,self.D//2, prism_up) + + prism_down = translation_movement( x, y+T_is//2, -self.D//2, prism_down) + + weld_fused_behind= BRepAlgoAPI_Fuse(prism_up, prism_down) + if weld_fused_behind.IsDone(): + weld_fused_behind = weld_fused_behind.Shape() + + weld_fused = BRepAlgoAPI_Fuse(weld_fused_forward,weld_fused_behind) + if weld_fused.IsDone(): + weld_fused = weld_fused.Shape() + + return weld_fused + + #bottom weld across longitudinal direction + right_bottom_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([self.tw//2, 0.,(-self.D//2)]), "y") + left_bottom_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([-self.tw//2, 0.,(-self.D//2)]),"y") + axis = gp_Ax1(gp_Pnt(-self.tw//2, 0.,(-self.D//2)), gp_Dir(0, 1, 0)) + trsf = gp_Trsf() + angle = -90 + trsf.SetRotation(axis, math.radians(angle)) + left_bottom_weld = BRepBuilderAPI_Transform(left_bottom_weld, trsf).Shape() + + #top weld across longitudinal direction + right_top_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([self.tw//2, 0.,(self.D//2)]), "y") + axis = gp_Ax1(gp_Pnt(self.tw//2, 0.,(self.D//2)), gp_Dir(0, 1, 0)) + trsf = gp_Trsf() + angle = 90 + trsf.SetRotation(axis, math.radians(angle)) + right_top_weld = BRepBuilderAPI_Transform(right_top_weld, trsf).Shape() + + left_top_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([-self.tw//2, 0.,(self.D//2)]),"y") + axis = gp_Ax1(gp_Pnt(-self.tw//2, 0.,(self.D//2)), gp_Dir(0, 1, 0)) + trsf = gp_Trsf() + angle = 180 + trsf.SetRotation(axis, math.radians(angle)) + left_top_weld = BRepBuilderAPI_Transform(left_top_weld, trsf).Shape() + + longitudinal_weld = BRepAlgoAPI_Fuse(right_bottom_weld, left_bottom_weld).Shape() + longitudinal_weld = BRepAlgoAPI_Fuse(longitudinal_weld, right_top_weld).Shape() + longitudinal_weld = BRepAlgoAPI_Fuse(longitudinal_weld, left_top_weld).Shape() + + #vertical weld test + vertical_weld_height = 0.5*chamfer_length #vertical weld height is fixed as 0.5*chamfer_length + stiffner_vertical_weld = vertical_weld(vertical_weld_height,self.D-(2*chamfer_length)) + + + for y in range(self.gap, self.length, self.gap): + + right_stiffner_plate = stiffner_plate(numpy.array([(L/2)+self.tw/2,y,-self.D/2]), L,self.D, T_is, "right") + left_stiffner_plate = stiffner_plate(numpy.array([-L/2-self.tw/2,y,-self.D/2]), L,self.D, T_is, "left") + + right_horizontal_stiffner_weld = filletWeld_model(b,h,l,y,"right", T_is) + left_horizontal_stiffner_weld = filletWeld_model(b,h,l,y,"left", T_is) + + right_vertical_front_weld = translation_movement(self.tw/2 ,y , (-self.D/2) + chamfer_length, stiffner_vertical_weld) + right_vertical_rear_weld = translation_rotation(180, gp_Ax1(gp_Pnt(0., 0., 0.), gp_Dir(0, 0, 1)), stiffner_vertical_weld) + right_vertical_rear_weld = translation_movement((self.tw/2)+vertical_weld_height ,y+(T_is/2) , (-self.D/2) + chamfer_length , right_vertical_rear_weld) + + left_vertical_front_weld = translation_rotation(-90, gp_Ax1(gp_Pnt(0., 0., 0.), gp_Dir(0, 0, 1)), stiffner_vertical_weld) + left_vertical_front_weld = translation_movement(-self.tw/2 ,y , (-self.D/2) + chamfer_length, left_vertical_front_weld) + left_vertical_rear_weld = translation_rotation(-180, gp_Ax1(gp_Pnt(0., 0., 0.), gp_Dir(0, 0, 1)), stiffner_vertical_weld) + left_vertical_rear_weld = translation_movement((-self.tw/2) ,y+(T_is/2) , (-self.D/2) + chamfer_length , left_vertical_rear_weld) + + + if y==self.gap: + stiffner_plate_model = BRepAlgoAPI_Fuse(right_stiffner_plate, left_stiffner_plate).Shape() + stiffner_horizontal_weld = BRepAlgoAPI_Fuse(right_horizontal_stiffner_weld, left_horizontal_stiffner_weld).Shape() + right_vertical_weld = BRepAlgoAPI_Fuse(right_vertical_front_weld, right_vertical_rear_weld).Shape() + left_vertical_weld = BRepAlgoAPI_Fuse(left_vertical_front_weld, left_vertical_rear_weld).Shape() + + else: + stiffner_plate_model = BRepAlgoAPI_Fuse(stiffner_plate_model, right_stiffner_plate).Shape() + stiffner_plate_model = BRepAlgoAPI_Fuse(stiffner_plate_model, left_stiffner_plate).Shape() + stiffner_horizontal_weld = BRepAlgoAPI_Fuse(stiffner_horizontal_weld, right_horizontal_stiffner_weld).Shape() + stiffner_horizontal_weld = BRepAlgoAPI_Fuse(stiffner_horizontal_weld, left_horizontal_stiffner_weld).Shape() + right_vertical_weld = BRepAlgoAPI_Fuse(right_vertical_weld, right_vertical_rear_weld).Shape() + right_vertical_weld = BRepAlgoAPI_Fuse(right_vertical_weld, right_vertical_front_weld).Shape() + left_vertical_weld = BRepAlgoAPI_Fuse(left_vertical_weld, left_vertical_front_weld).Shape() + left_vertical_weld = BRepAlgoAPI_Fuse(left_vertical_weld, left_vertical_rear_weld).Shape() + + + # #displaying the model + # display.DisplayShape(ISection_model, update=True) + # display.DisplayShape(center_plate, update=True) + # display.DisplayShape(stiffner_plate_model,material=Graphic3d_NOM_ALUMINIUM, update=True) + # display.DisplayShape(longitudinal_weld,color="red", update=True) + # display.DisplayShape(right_vertical_weld,color="red", update=True) + # display.DisplayShape(left_vertical_weld,color="red", update=True) + # display.DisplayShape(stiffner_horizontal_weld,color="red", update=True) + + # start_display() + + + #fusing only weld + weld = BRepAlgoAPI_Fuse(longitudinal_weld, right_vertical_weld) + weld = BRepAlgoAPI_Fuse(weld, left_vertical_weld) + weld = BRepAlgoAPI_Fuse(weld, stiffner_horizontal_weld) + + weld_color = Quantity_Color(255/255, 0/255, 0/255, Quantity_TOC_RGB) + + ais_weld_shape = AIS_Shape(weld) + ais_weld_shape.SetColor(weld_color) + display.Context.Display(ais_weld_shape, True) + + + #fusing only the I girder + girder = BRepAlgoAPI_Fuse(ISection_model, center_plate) + + #stiffener plates + ais_box = AIS_Shape(stiffner_plate_model) + ais_box.SetMaterial(Graphic3d_NOM_ALUMINIUM) + display.Context.Display(ais_box, True) + + plate_girder_model = BRepAlgoAPI_Fuse(weld, girder) + plate_girder_model = BRepAlgoAPI_Fuse(plate_girder_model, stiffner_plate_model) + + return plate_girder_model + \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder.py b/src/osdag/design_type/plate_girder/weldedPlateGirder.py index a47af3552..ca56ccbbe 100644 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder.py +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder.py @@ -1315,6 +1315,7 @@ def warn_text(self): def set_input_values(self, design_dictionary): self.module = design_dictionary[KEY_MODULE] + self.mainmodule = 'PLATE GIRDER' self.design_type = design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE] print('design_type', design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE]) self.section_class = None diff --git a/src/osdag/gui/ui_template.py b/src/osdag/gui/ui_template.py index d2e203b7c..41c1ead72 100644 --- a/src/osdag/gui/ui_template.py +++ b/src/osdag/gui/ui_template.py @@ -48,6 +48,7 @@ from ..design_type.connection.column_cover_plate_weld import ColumnCoverPlateWeld from ..design_type.connection.base_plate_connection import BasePlateConnection from ..design_type.connection.lap_joint_bolted import LapJointBolted +from ..design_type.plate_girder.weldedPlateGirder import PlateGirderWelded from ..design_type.tension_member.tension_bolted import Tension_bolted from ..design_type.tension_member.tension_welded import Tension_welded from ..design_type.connection.beam_column_end_plate import BeamColumnEndPlate @@ -1941,6 +1942,8 @@ def return_class(self,name): return Flexure_Misc elif name == KEY_DISP_LAPJOINTBOLTED: return LapJointBolted + elif name == KEY_DISP_PLATE_GIRDER_WELDED: #im working here + return PlateGirderWelded else: return GussetConnection # Function for getting inputs from a file @@ -2180,10 +2183,10 @@ def common_function_for_save_and_design(self, main, data, trigger_type): KEY_DISP_ENDPLATE, KEY_DISP_BASE_PLATE, KEY_DISP_SEATED_ANGLE, KEY_DISP_TENSION_BOLTED, KEY_DISP_TENSION_WELDED, KEY_DISP_COLUMNCOVERPLATE, KEY_DISP_COLUMNCOVERPLATEWELD, KEY_DISP_COLUMNENDPLATE, KEY_DISP_BCENDPLATE, KEY_DISP_BB_EP_SPLICE, - KEY_DISP_COMPRESSION_COLUMN,KEY_DISP_FLEXURE,KEY_DISP_FLEXURE2,KEY_DISP_COMPRESSION_Strut,KEY_DISP_LAPJOINTBOLTED]: # , KEY_DISP_FLEXURE + KEY_DISP_COMPRESSION_COLUMN,KEY_DISP_FLEXURE,KEY_DISP_FLEXURE2,KEY_DISP_COMPRESSION_Strut,KEY_DISP_LAPJOINTBOLTED,KEY_DISP_PLATE_GIRDER_WELDED]: # , KEY_DISP_FLEXURE # print(self.display, self.folder, main.module, main.mainmodule) print("common start") - print(f"main object type: {type(main)}") + print(f"main object type: {type(main)}")`` print(f"main attributes: {dir(main)}") print("main.mainmodule",main.mainmodule) From b09491fa3dbf493021ce194e95127c5b6b4e9ad0 Mon Sep 17 00:00:00 2001 From: AmanAg744 Date: Tue, 1 Jul 2025 19:11:26 +0530 Subject: [PATCH 22/23] Latest changes fetched to the branch --- src/osdag/Common.py | 186 ++++++++- src/osdag/design_type/main.py | 4 +- src/osdag/design_type/member.py | 4 +- .../plate_girder/weldedPlateGirder.py | 383 ++++++------------ src/osdag/gui/ui_template.py | 2 +- 5 files changed, 297 insertions(+), 282 deletions(-) diff --git a/src/osdag/Common.py b/src/osdag/Common.py index 4641fb55b..e597ace07 100644 --- a/src/osdag/Common.py +++ b/src/osdag/Common.py @@ -649,7 +649,7 @@ def is_valid_custom(self): ################################### # Plate Girder ################################### -# KEY_PLATE_GIRDER_MAIN_MODULE = 'PLATE GIRDER' +KEY_PLATE_GIRDER_MAIN_MODULE = 'PLATE GIRDER' KEY_DISP_PLATE_GIRDER_WELDED = 'PLATE GIRDER' KEY_DISP_PG_SectionDetail = 'Section Details' KEY_tf = 'TF.Data' @@ -2629,6 +2629,8 @@ def get_leg_lengths(designation): "


\n") + + COLUMN_OPTIMIZATION_DESCRIPTION = str("\n" "\n" + + "

Stiffener Details

\n" + + "

1. Types of Stiffeners in Plate Girders

\n" + + "

a. Intermediate (Transverse) Stiffeners

\n" + "
    \n" + "
  • Purpose: Prevent web buckling due to shear or compression.
  • \n" + "
  • Location: Placed vertically, perpendicular to the web, between the flanges at regular intervals.
  • \n" + "
  • Application: Needed when the web is slender (large depth-to-thickness ratio).
  • \n" + "
\n" + + "

b. End Bearing Stiffeners

\n" + "
    \n" + "
  • Purpose: Strengthen the web at supports or concentrated loads to resist high bearing forces and prevent web crippling.
  • \n" + "
  • Location: Placed at the ends (supports) or under concentrated loads.
  • \n" + "
  • Application: Always provided at supports and where heavy loads are applied.
  • \n" + "
\n" + + "

c. Longitudinal Stiffeners

\n" + "
    \n" + "
  • Purpose: Increase web buckling resistance along the length, especially for very deep or slender webs.
  • \n" + "
  • Location: Placed horizontally at a certain distance from the compression flange or web neutral axis.
  • \n" + "
  • Application: Used when the web depth-to-thickness ratio is very high and transverse stiffeners alone are not sufficient.
  • \n" + "
\n" + + "
\n" + + "

2. Web Buckling Design Methods (as per IS 800:2007)

\n" + "

IS 800:2007 recommends two principal methods for evaluating the web’s shear resistance when web slenderness is high:

\n" + + "

a. Simple Post-Critical Method

\n" + "
    \n" + "
  • Concept:
    " + "Assumes that after initial buckling of the web (critical shear), the web still provides some shear strength due to diagonal tension across the buckled panels.
    " + "For webs with intermediate stiffeners, this method allows for some reserve strength beyond initial buckling, but does not fully utilize tension field action.
  • \n" + "
  • Calculation:
    " + "The shear strength is based on the post-buckling strength of the web panel, up to the critical shear buckling stress, using the post-buckling formula provided in IS 800:2007 (Clause 8.4.2.2).
  • \n" + "
  • Usage:
    " + "Suitable for webs with intermediate stiffeners, but where the web is not very slender or where full tension field action is not mobilized.
  • \n" + "
\n" + + "

b. Tension Field Method

\n" + "
    \n" + "
  • Concept:
    " + "After buckling, the web develops a diagonal tension field, supported by the flanges and stiffeners, which significantly increases the web’s shear capacity beyond the critical value.
    " + "This method fully utilizes the tension field action in the post-buckled web panel.
  • \n" + "
  • Calculation:
    " + "The web’s ultimate shear strength is based on the ability of the web to develop this tension field and is given by the formulae in IS 800:2007 (Clause 8.4.2.3).
    " + "The design shear strength includes both the contribution of the buckled web (tension field action) and the flanges/stiffeners.
  • \n" + "
  • Usage:
    " + "Used for panels with sufficient intermediate stiffeners, flanges, and connections that can develop and sustain the tension field.
    " + "Allows for greater economy and higher shear capacities in plate girders.
  • \n" + "
\n" + + "" ) OPTIMIZATION_TABLE_UI = str(""" @@ -2944,6 +2992,61 @@ def get_leg_lengths(designation): "\n" ) + Allowable_Utilization_Para + Effective_Area_Para + Effective_Length_Para + OPTIMIZATION_TABLE_UI + Bearing_Length_Para + +ADDITIONAL_GIRDER_DESCRIPTION = str( + "\n" + "" + "\n" + + "

Symmetrical I Girder

\n" + "

A symmetrical I girder (or beam) is an I-shaped structural member " + "in which the top and bottom flanges are identical in shape, size, and thickness. " + "The web (the vertical part) is centered between the flanges, making the whole section " + "mirrored about its central axis.

\n" + + "

Key Features

\n" + "
    \n" + "
  • Identical Flanges: Both top and bottom flanges have equal dimensions and thickness.
  • \n" + "
  • Web Centered: The web is exactly in the middle, so the cross-section is mirrored " + "about the horizontal and vertical axis.
  • \n" + "
\n" + + "

Advantages

\n" + "
    \n" + "
  • Standardization: Easier to design and fabricate.
  • \n" + "
  • Common Use: Widely used in bridges, buildings, and frames where loads are mostly vertical " + "and evenly applied.
  • \n" + "
\n" + + "
\n" + + "

Unsymmetrical I Girder

\n" + "

An unsymmetrical I girder is an I-shaped structural member where the top " + "and bottom flanges are not identical—meaning they differ in width, thickness, or shape. " + "The web may not be centered.

\n" + + "

Key Features

\n" + "
    \n" + "
  • Different Flanges: The top and bottom flanges have different sizes or thicknesses.
  • \n" + "
  • Non-uniform Properties: Section modulus and moment of inertia differ for the top and bottom.
  • \n" + "
\n" + + "

Advantages

\n" + "
    \n" + "
  • Optimized Design: Useful where the loading is not symmetrical (e.g., composite construction with a " + "concrete slab on top, or for cantilever situations).
  • \n" + "
  • Material Savings: Material can be saved by providing a larger flange where stresses are higher, " + "usually on the compression side.
  • \n" + "
\n" + + "" +) + + PLATE_GIRDER_DEFLECTION_TABLE = str(""" @@ -3026,4 +3129,49 @@ def get_leg_lengths(designation): -""") \ No newline at end of file +""") + +DESIGN_METHOD_DESCRIPTION = str( + "\n" + "" + "\n" + + "

Design Method

\n" + "

The \"Design Method\" dropdown allows you to choose the basis on which the structural design calculations for the girder will be performed. The main options are:

\n" + + "

Limit State Design (LSD)

\n" + "

Description:

\n" + "

Limit State Design is the modern design philosophy adopted by most current codes (including IS 800:2007). In this method, the structure is designed to withstand all possible limit states, primarily:

\n" + "
    \n" + "
  • Ultimate Limit State (ULS): Safety against collapse due to strength failure.
  • \n" + "
  • Serviceability Limit State (SLS): Ensures acceptable performance under normal use (deflections, vibrations, cracks).
  • \n" + "
\n" + "

Advantages:

\n" + "
    \n" + "
  • Optimizes material usage.
  • \n" + "
  • Balances safety and serviceability.
  • \n" + "
  • Incorporates factors of safety for both loads and material strengths.
  • \n" + "
\n" + + "

Working Stress Design (WSD)

\n" + "

Description:

\n" + "

Also known as the elastic method, Working Stress Design ensures that stresses induced by service loads do not exceed specified allowable values. It uses a single factor of safety applied to material strength.

\n" + + "

Advantages:

\n" + "
    \n" + "
  • Simple and conservative.
  • \n" + "
  • Suitable for structures where performance under service loads is more critical than ultimate strength.
  • \n" + "
\n" + + "

Limitations:

\n" + "
    \n" + "
  • Less economical than LSD.
  • \n" + "
  • Not as widely used in modern codes for steel structures.
  • \n" + "
\n" + + "" +) \ No newline at end of file diff --git a/src/osdag/design_type/main.py b/src/osdag/design_type/main.py index ecec640ba..cab5f623f 100644 --- a/src/osdag/design_type/main.py +++ b/src/osdag/design_type/main.py @@ -131,7 +131,7 @@ def design_values(self, input_dictionary): values[KEY_DP_DESIGN_METHOD]) design.append(t1) - t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, Stiffener_Plategirder_para , None) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, DESIGN_METHOD_DESCRIPTION , None) design.append(t9) return design @@ -513,4 +513,4 @@ def call_3DModel(self, ui, bgcolor): continue if isinstance(chkbox, QCheckBox): chkbox.setChecked(Qt.Unchecked) - ui.commLogicObj.display_3DModel("Model", bgcolor) + ui.commLogicObj.display_3DModel("Model", bgcolor) \ No newline at end of file diff --git a/src/osdag/design_type/member.py b/src/osdag/design_type/member.py index fde86956c..dd3e239a7 100644 --- a/src/osdag/design_type/member.py +++ b/src/osdag/design_type/member.py @@ -2948,7 +2948,7 @@ def girder_geometry(self, input_dictionary): t2 = (KEY_IS_IT_SYMMETRIC, KEY_DISP_IS_IT_SYMMETRIC, TYPE_COMBOBOX, KEY_DISP_SYMMETRIC_list, values[KEY_IS_IT_SYMMETRIC]) optimum.append(t2) - t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, Stiffener_Plategirder_para , None) + t9 = ("textBrowser", "", TYPE_TEXT_BROWSER, ADDITIONAL_GIRDER_DESCRIPTION , None) optimum.append(t9) return optimum @@ -3300,4 +3300,4 @@ def call_3DEndplate(self, ui, bgcolor): continue if isinstance(chkbox, QCheckBox): chkbox.setChecked(Qt.Unchecked) - ui.commLogicObj.display_3DModel("Endplate", bgcolor) + ui.commLogicObj.display_3DModel("Endplate", bgcolor) \ No newline at end of file diff --git a/src/osdag/design_type/plate_girder/weldedPlateGirder.py b/src/osdag/design_type/plate_girder/weldedPlateGirder.py index ca56ccbbe..de9d2d93d 100644 --- a/src/osdag/design_type/plate_girder/weldedPlateGirder.py +++ b/src/osdag/design_type/plate_girder/weldedPlateGirder.py @@ -629,7 +629,7 @@ def Long_stiffener_thickness_customized(self): # Setting up logger and Input and Output Docks #################################### def module_name(self): - print('in module') + # print('in module') return KEY_DISP_PLATE_GIRDER_WELDED def set_osdaglogger(key): @@ -772,7 +772,7 @@ def input_values(self): def fn_torsion_warping(self): - print( 'Inside fn_torsion_warping', self) + # print( 'Inside fn_torsion_warping', self) if self[0] == Torsion_Restraint1: return Warping_Restraint_list elif self[0] == Torsion_Restraint2: @@ -782,7 +782,7 @@ def fn_torsion_warping(self): def axis_bending_change(self): design = self[0] - print( 'Inside fn_supp_image', self) + # print( 'Inside fn_supp_image', self) if self[0] == KEY_DISP_DESIGN_TYPE_FLEXURE: return ['NA'] else: @@ -855,7 +855,7 @@ def pop_up_bounds(self): if self[0] == "Bound Values": dialog = RangeInputDialog() if dialog.exec_() == QDialog.Accepted: - print("Returned values:", dialog.get_values()) + # print("Returned values:", dialog.get_values()) return str(dialog.get_values()) @@ -1000,7 +1000,7 @@ def input_value_changed(self): return lst def warning_majorbending(self): - print(self) + # print(self) if self[0] == VALUES_SUPP_TYPE_temp[2]: return True # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : @@ -1009,7 +1009,7 @@ def warning_majorbending(self): return False def output_modifier(self): - print(self) + # print(self) if self[0] == VALUES_SUPP_TYPE_temp[2]: return False # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : @@ -1024,7 +1024,7 @@ def output_modifier_long_stiffener(self): return True def output_modifier2(self): - print(self) + # print(self) if self[0] == 'Thin Web with ITS': return False # elif self[0] == VALUES_SUPP_TYPE_temp[0] or self[0] == VALUES_SUPP_TYPE_temp[1] : @@ -1032,8 +1032,8 @@ def output_modifier2(self): else: return True - def Design_pref_modifier(self): - print("Design_pref_modifier",self) + # def Design_pref_modifier(self): + # print("Design_pref_modifier",self) def output_values(self, flag): @@ -1211,7 +1211,7 @@ def spacing(self, status): def func_for_validation(self, design_dictionary): # print("DESIGN",design_dictionary) - print(f"func_for_validation here") + # print(f"func_for_validation here") all_errors = [] self.design_status = False flag = False @@ -1221,9 +1221,9 @@ def func_for_validation(self, design_dictionary): flag3 = False option_list = self.input_values(self) missing_fields_list = [] - print(f'func_for_validation option_list {option_list}' - f"\n design_dictionary {design_dictionary}" - ) + # print(f'func_for_validation option_list {option_list}' + # f"\n design_dictionary {design_dictionary}" + # ) for option in option_list: if option[2] == TYPE_TEXTBOX or option[0] == KEY_LENGTH or option[0] == KEY_SHEAR or option[0] == KEY_MOMENT: try: @@ -1240,7 +1240,7 @@ def func_for_validation(self, design_dictionary): continue if option[0] == KEY_LENGTH: if float(design_dictionary[option[0]]) <= 0.0: - print("Input value(s) cannot be equal or less than zero.") + # print("Input value(s) cannot be equal or less than zero.") error = "Input value(s) cannot be equal or less than zero." all_errors.append(error) @@ -1248,14 +1248,14 @@ def func_for_validation(self, design_dictionary): flag1 = True elif option[0] == KEY_SHEAR: if float(design_dictionary[option[0]]) <= 0.0: - print("Input value(s) cannot be equal or less than zero.") + # print("Input value(s) cannot be equal or less than zero.") error = "Input value(s) cannot be equal or less than zero." all_errors.append(error) else: flag2 = True elif option[0] == KEY_MOMENT: if float(design_dictionary[option[0]]) <= 0.0: - print("Input value(s) cannot be equal or less than zero.") + # print("Input value(s) cannot be equal or less than zero.") error = "Input value(s) cannot be equal or less than zero." all_errors.append(error) else: @@ -1269,11 +1269,11 @@ def func_for_validation(self, design_dictionary): all_errors.append(error) else: flag = True - print(f"flag {flag} flag1 {flag1} flag2 {flag2} flag3 {flag3}") + # print(f"flag {flag} flag1 {flag1} flag2 {flag2} flag3 {flag3}") if flag and flag1 and flag2 and flag3: - print(f"\n design_dictionary{design_dictionary}") + # print(f"\n design_dictionary{design_dictionary}") self.set_input_values(self, design_dictionary) - print("WORKING VALIDATION") + # print("WORKING VALIDATION") # if self.design_status ==False and len(self.failed_design_dict)>0: # logger.error( # "Design Failed, Check Design Report" @@ -1317,10 +1317,10 @@ def set_input_values(self, design_dictionary): self.module = design_dictionary[KEY_MODULE] self.mainmodule = 'PLATE GIRDER' self.design_type = design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE] - print('design_type', design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE]) + # print('design_type', design_dictionary[KEY_OVERALL_DEPTH_PG_TYPE]) self.section_class = None if self.design_type == 'Optimized': - print('Optimized Design') + # print('Optimized Design') self.total_depth = 1 self.web_thickness_list = design_dictionary[KEY_WEB_THICKNESS_PG] self.top_flange_width = 1 @@ -1333,7 +1333,7 @@ def set_input_values(self, design_dictionary): self.bottom_flange_thickness = float(design_dictionary[KEY_BOTTOM_FLANGE_THICKNESS_PG][0]) else: - print('Cus Design') + # print('Cus Design') self.total_depth = float(design_dictionary[KEY_OVERALL_DEPTH_PG]) self.web_thickness_list = design_dictionary[KEY_WEB_THICKNESS_PG] self.web_thickness = float(design_dictionary[KEY_WEB_THICKNESS_PG][0]) @@ -1565,7 +1565,7 @@ def section_classification(self,design_dictionary): web_ratio = (self.total_depth - (self.top_flange_thickness + self.bottom_flange_thickness)) / self.web_thickness flange_ratio_top = self.top_flange_width / (2 *self.top_flange_thickness) flange_ratio_bottom = self.bottom_flange_width / (2 *self.bottom_flange_thickness) - print("Section classification- top flange, bottom flange, Web",flange_class_top, flange_class_bottom,web_class,web_ratio,flange_ratio_top,flange_ratio_bottom) + # print("Section classification- top flange, bottom flange, Web",flange_class_top, flange_class_bottom,web_class,web_ratio,flange_ratio_top,flange_ratio_bottom) if flange_class_bottom == "Slender" or web_class == "Slender" or flange_class_top == 'Slender': self.section_class = "Slender" else: @@ -1601,11 +1601,11 @@ def section_classification(self,design_dictionary): else: # flange_class_top == SemiCompact self.section_class = KEY_SemiCompact - print("overall section class", self.section_class) + # print("overall section class", self.section_class) self.Zp_req = self.load.moment * self.gamma_m0 / self.material.fy self.effective_length_beam(self, design_dictionary, self.length) - print( 'self.allow_class', self.allow_class) + # print( 'self.allow_class', self.allow_class) if self.section_class == 'Slender' and self.web_philosophy == 'Thick Web without ITS': return False @@ -1626,12 +1626,13 @@ def beta_value(self,design_dictionary,section_class): # print("self.elast_sec_mod_z",self.elast_sec_mod_z) self.Zp_req = self.load.moment * self.gamma_m0 / self.material.fy if self.plast_sec_mod_z >= self.Zp_req: - print( 'self.section_property.plast_sec_mod_z More than Requires',self.plast_sec_mod_z,self.Zp_req) + pass + # logger.info( 'self.section_property.plast_sec_mod_z More than Requires',self.plast_sec_mod_z,self.Zp_req) if section_class == KEY_Plastic or section_class == KEY_Compact: self.beta_b_lt = 1.0 else: self.beta_b_lt = (self.elast_sec_mod_z/ self.plast_sec_mod_z) - print("Beta value",self.beta_b_lt) + # print("Beta value",self.beta_b_lt) #-----add a check function to call everything. @@ -1640,10 +1641,10 @@ def beta_value(self,design_dictionary,section_class): def min_web_thickness_thick_web(self, d, tw, eps, stiffener_type, c): if IS800_2007.cl_8_6_1_1_and_8_6_1_2_web_thickness_check(d, tw, eps, stiffener_type, c): - print("Web thickness is sufficient for thick web") + # print("Web thickness is sufficient for thick web") return True else: - print("Web thickness is not sufficient for thick web") + # print("Web thickness is not sufficient for thick web") return False @@ -1653,15 +1654,15 @@ def moment_capacity_laterally_supported(self, V,Zp, Ze, Fy, gamma_m0, D, tw, tf_ A_vg = (D - tf_top - tf_bot) * tw self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) if V > 0.6 * self.V_d: #high shear(Mdv calculation for high shear. Naming kept Md for compatibility) - print("High shear condition") + # print("High shear condition") self.Md = self.calc_Mdv(self, V, self.V_d, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot) - print("Md", self.Md) + # print("Md", self.Md) else: #low shear - print("Low shear condition") + # print("Low shear condition") self.Md = IS800_2007.cl_8_2_1_2_design_bending_strength(section_class, Zp, Ze, Fy, gamma_m0, self.support_condition) - print("Md", self.Md) + # print("Md", self.Md) self.moment_ratio = self.load.moment/ self.Md - print("moment", self.Md) + # print("moment", self.Md) if self.Md >= self.load.moment: return True else: @@ -1671,10 +1672,10 @@ def moment_capacity_laterally_supported(self, V,Zp, Ze, Fy, gamma_m0, D, tw, tf_ def shear_capacity_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top, tf_bot): A_vg = (D - tf_top - tf_bot) * tw self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) - print("V_d", self.V_d) + # print("V_d", self.V_d) self.shear_ratio = self.load.shear_force / self.V_d - print("Shear force", self.load.shear_force) - print("shear_ratio", self.shear_ratio) + # print("Shear force", self.load.shear_force) + # print("shear_ratio", self.shear_ratio) if self.V_d >= self.load.shear_force: return True else: @@ -1689,7 +1690,7 @@ def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top slenderness_input = 2.5 * self.eff_depth / tw self.fcd = IS800_2007.cl_7_1_2_1_design_compressisive_stress_plategirder(Fy, gamma_m0, slenderness_input, E) Critical_buckling_load = round(Ac * self.fcd, 2) - print("Critical buckling load", Critical_buckling_load) + # print("Critical buckling load", Critical_buckling_load) self.web_buckling_ratio = self.load.shear_force / Critical_buckling_load self.shear_ratio = max(self.load.shear_force / Critical_buckling_load , self.shear_ratio) if Critical_buckling_load>= self.load.shear_force: @@ -1701,7 +1702,7 @@ def web_buckling_laterally_supported_thick_web(self, Fy, gamma_m0, D, tw, tf_top def web_crippling_laterally_supported_thick_web(self, Fy, gamma_m0, tw, tf_top, b1): n2 = 2.5 * tf_top Critical_crippling_load = round((b1 + n2) * tw * Fy / (gamma_m0), 2) - print("Critical crippling load", Critical_crippling_load) + # print("Critical crippling load", Critical_crippling_load) self.web_crippling_ratio = self.load.shear_force / Critical_crippling_load self.shear_ratio = max(self.load.shear_force / Critical_crippling_load , self.shear_ratio) if Critical_crippling_load >= self.load.shear_force: @@ -1735,7 +1736,7 @@ def bending_check_lat_unsupported(self, beta_b_lt, plast_sec_mod_z, elast_sec_mo self.fbd_lt = IS800_2007.cl_8_2_2_Unsupported_beam_bending_compressive_stress(self.X_lt, fy, self.gamma_m0) self.Md = IS800_2007.cl_8_2_2_Unsupported_beam_bending_strength(plast_sec_mod_z, elast_sec_mod_z, self.fbd_lt, section_class) - print("Md", self.Md, "zp", plast_sec_mod_z, "fbd_lt", self.fbd_lt, "phi_lt", self.phi_lt, "X_lt", self.X_lt, "lambda_lt", self.lambda_lt) + # print("Md", self.Md, "zp", plast_sec_mod_z, "fbd_lt", self.fbd_lt, "phi_lt", self.phi_lt, "X_lt", self.X_lt, "lambda_lt", self.lambda_lt) return round(self.Md, 2) def calc_Mdv_lat_unsupported(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot, @@ -1766,7 +1767,7 @@ def calc_Mdv_lat_unsupported(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, t d = D - (tf_top + tf_bot) Aw = d * tw Zfd = Zp - (Aw * D / 4) - print("Aw", Aw, "Zfd", Zfd) + # print("Aw", Aw, "Zfd", Zfd) # Calculating Mfd Mfd = Zfd * Fy / gamma_m0 @@ -1775,7 +1776,7 @@ def calc_Mdv_lat_unsupported(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, t # Limiting value as per the provided formula Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 - print("Mfd", Mfd, "Mdv", Mdv, "Mdv_limit", Mdv_limit) + # print("Mfd", Mfd, "Mdv", Mdv, "Mdv_limit", Mdv_limit) return round(min(Mdv, Mdv_limit), 2) def calc_Mdv(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): # only for major laterally supp @@ -1805,7 +1806,7 @@ def calc_Mdv(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): # only d = D - (tf_top + tf_bot) Aw = d * tw Zfd = Zp - (Aw * D / 4) - print("Aw", Aw, "Zfd", Zfd) + # print("Aw", Aw, "Zfd", Zfd) # Calculating Mfd Mfd = Zfd * Fy / gamma_m0 @@ -1818,7 +1819,7 @@ def calc_Mdv(self, V, Vd, Zp, Ze, Fy, gamma_m0, D, tw, tf_top, tf_bot): # only # Limiting value as per the provided formula Mdv_limit = (1.2 * Ze * Fy) / gamma_m0 - print("Mfd", Mfd / 1000000, "Mdv", Mdv / 1000000, "Mdv_limit", Mdv_limit / 1000000) + # print("Mfd", Mfd / 1000000, "Mdv", Mdv / 1000000, "Mdv_limit", Mdv_limit / 1000000) return round(min(Mdv, Mdv_limit), 2) @@ -1898,8 +1899,8 @@ def moment_capacity_laterally_unsupported(self, E, LLT, D, (c2 * yg - c3 * yj) ** 2) self.M_cr = c1 * term1 * math.sqrt(bracket) - term1 * (c2 * yg - c3 * yj) - print("Input moment", self.load.moment) - print("MCR VAL", self.M_cr) + # print("Input moment", self.load.moment) + # print("MCR VAL", self.M_cr) A_vg = (D - tf_top - tf_bot) * tw self.V_d = ((A_vg * Fy) / (math.sqrt(3) * gamma_m0)) Zp = self.plast_sec_mod_z @@ -1922,7 +1923,7 @@ def moment_capacity_laterally_unsupported(self, E, LLT, D, self.material.fy, self.M_cr, self.section_class) self.moment_ratio = self.load.moment / self.Md - print("Ratio for moment", self.moment_ratio) + # print("Ratio for moment", self.moment_ratio) # # print("supp mdv",self.Mdv) if self.Md >= self.load.moment: return True @@ -1934,7 +1935,7 @@ def effective_length_beam(self, design_dictionary, length): if design_dictionary[KEY_LENGTH_OVERWRITE] == 'NA': self.effective_length = IS800_2007.cl_8_3_1_EffLen_Simply_Supported(Torsional=self.torsional_res,Warping=self.warping, length=length,depth=(self.total_depth/1000),load=self.loading_condition) - print(f"Working 1 {self.effective_length}") + # print(f"Working 1 {self.effective_length}") else: try: if float(design_dictionary[KEY_LENGTH_OVERWRITE]) <= 0: @@ -1943,15 +1944,15 @@ def effective_length_beam(self, design_dictionary, length): length = length * float(design_dictionary[KEY_LENGTH_OVERWRITE]) self.effective_length = length - print(f"Working 2 {self.effective_length}") + # print(f"Working 2 {self.effective_length}") except: - print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) + # print(f"Inside effective_length_beam",type(design_dictionary[KEY_LENGTH_OVERWRITE])) logger.warning("Invalid Effective Length Parameter.") logger.info('Effective Length Parameter is set to default: 1.0') design_dictionary[KEY_LENGTH_OVERWRITE] = '1.0' self.effective_length_beam(self, design_dictionary, length) - print(f"Working 3 {self.effective_length}") - print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) + # print(f"Working 3 {self.effective_length}") + # print(f"Inside effective_length_beam",self.effective_length, design_dictionary[KEY_LENGTH_OVERWRITE]) def end_panel_stiffener_calc(self, Bf_top, Bf_bot, tw, tq, fy, gamma_m0, d, @@ -2017,7 +2018,7 @@ def end_panel_stiffener_calc(self, M_q = (I * fy) / (gamma_m0 * y) self.moment_ratio = max(M_tf / M_q, self.moment_ratio) self.endshear_ratio = max(R_tf / V_n, self.endshear_ratio ) - print('moment ratio', self.moment_ratio, 'end panel shear ratio 1', self.endshear_ratio ) + # print('moment ratio', self.moment_ratio, 'end panel shear ratio 1', self.endshear_ratio ) # if V_n >= R_tf: # if M_q >= M_tf: @@ -2034,7 +2035,7 @@ def end_panel_stiffener_calc(self, self.end_stiffthickness = float(self.end_stiffthickness) Aq = 2 * self.end_stiffthickness * self.end_stiffwidth - print('Aq',Aq) + # print('Aq',Aq) max_outstand = 14 * self.end_stiffthickness * self.epsilon if self.end_stiffwidth <= max_outstand: self.end_stiffwidth = max_outstand @@ -2057,7 +2058,7 @@ def end_panel_stiffener_calc(self, # Critical buckling resistance (kN) Pd = Aq * fcd - print('moment ratio', self.moment_ratio, 'end panel shear ratio 2', self.endshear_ratio ) + # print('moment ratio', self.moment_ratio, 'end panel shear ratio 2', self.endshear_ratio ) self.Critical_buckling_resistance = Pd n2 = 2.5 * self.bottom_flange_thickness Fw = n2 * tw * self.material.fy / (self.gamma_m0) @@ -2069,9 +2070,9 @@ def end_panel_stiffener_calc(self, # max_outstand, 'I_x', I_x, 'r_x', r_x, 'slenderness_input', slenderness_input, 'fcd', fcd, 'Pd', # Pd, 'Fw', Fw, 'Bearing_stiffenerforce', Bearing_stiffenerforce, 'Bearing_capacity', # Bearing_capacity) - print('fcd', fcd, 'Pd', Pd, 'FC', Fc) + # print('fcd', fcd, 'Pd', Pd, 'FC', Fc) self.endshear_ratio = max(Bearing_stiffenerforce / Bearing_capacity, Fc / Pd, R_tf / V_n ) - print('moment ratio', self.moment_ratio, 'end panel shear ratio 3', self.endshear_ratio ) + # print('moment ratio', self.moment_ratio, 'end panel shear ratio 3', self.endshear_ratio ) if self.endshear_ratio <= 1: break @@ -2079,11 +2080,11 @@ def end_panel_stiffener_calc(self, continue self.shear_ratio = max(self.endshear_ratio, self.shear_ratio) if self.endshear_ratio <= 1: - print("end stiffener check passed") + # print("end stiffener check passed") return True else: - print("Tension field end stiffener check failed: Bearing capacity insufficient") + # print("Tension field end stiffener check failed: Bearing capacity insufficient") self.end_stiffthickness = 0 return False @@ -2161,7 +2162,7 @@ def deflection_from_moment_kNm_mm(self,M_kNm, L, E, I, case): # unit conversions M = M_kNm # kN·m → N·m - pref = M * L ** 2 / (E * I) + pref = M * L ** 2 / (E * I * 1.5) if case == KEY_DISP_UDL_PIN_PIN_PG: return (5 / 48) * pref elif case == KEY_DISP_UDL_FIX_FIX_PG: @@ -2189,7 +2190,7 @@ def evaluate_deflection_kNm_mm(self, n = float(criteria) allowable = L / n - print(L, n, allowable, delta) + # print(L, n, allowable, delta) ok = (delta <= allowable) self.deflection_ratio = delta / allowable @@ -2344,7 +2345,7 @@ def weld_for_end_stiffener(self, t_st, b_st, V_ed, V_unstf, D, t_ft, t_fb, tw, u # weld legs using cl.10 strength weld_stiff = self.weld_leg_from_q_with_cl10(self, q_each, ultimate_stresses) - print("weld_stiff", weld_stiff, "min_weld_legtop", min_weld_legtop, "max_weld_legtop", max_weld_legtop) + # print("weld_stiff", weld_stiff, "min_weld_legtop", min_weld_legtop, "max_weld_legtop", max_weld_legtop) if weld_stiff < min_weld_legtop: weld_stiff = min_weld_legtop if weld_stiff > max_weld_legtop: @@ -2476,14 +2477,14 @@ def shear_buckling_check_intermediate_stiffener( # Critical buckling resistance (kN) Pd = round(A_x * fcd , 2) self.shear_ratio = max(self.load.shear_force / Pd , self.shear_ratio) - print('moment ratio', self.moment_ratio, 'inter shear ratio', self.shear_ratio) + # print('moment ratio', self.moment_ratio, 'inter shear ratio', self.shear_ratio) self.Critical_buckling_resistance = Pd - print("Intermediate stiffener shear buckling check:", 'stiff width', IntStiffenerWidth, 'stiff thick', IntStiffThickness, 'cd_ratio', cd_ratio, 'I_min_global', I_min_global, 'I_s', I_s, 'max_outstand', max_outstand, 'F_q', F_q, 'As', A_s, 'Ax', A_x, 'Ix', I_x, 'rx', r_x, 'Le', Le, 'slenderness input', slenderness_input, 'fcd', fcd, 'Pd', Pd, 'V_cr', self.V_cr, 'V_ed', V_ed, 'gamma_m0', gamma_m0, 'fy', fy, 'E', E) + # print("Intermediate stiffener shear buckling check:", 'stiff width', IntStiffenerWidth, 'stiff thick', IntStiffThickness, 'cd_ratio', cd_ratio, 'I_min_global', I_min_global, 'I_s', I_s, 'max_outstand', max_outstand, 'F_q', F_q, 'As', A_s, 'Ax', A_x, 'Ix', I_x, 'rx', r_x, 'Le', Le, 'slenderness input', slenderness_input, 'fcd', fcd, 'Pd', Pd, 'V_cr', self.V_cr, 'V_ed', V_ed, 'gamma_m0', gamma_m0, 'fy', fy, 'E', E) # Debug prints - print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") - print("Critical buckling resistance Pd:", Pd, "kN") + # print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") + # print("Critical buckling resistance Pd:", Pd, "kN") # Check axial capacity # if F_q < Pd: @@ -2584,11 +2585,11 @@ def tension_field_end_stiffener(self, d, tw, fyw, shear_force, moment, c): continue self.shear_ratio = max(self.endshear_ratio, self.shear_ratio) if self.endshear_ratio <= 1: - print("end stiffener check passed") + # print("end stiffener check passed") return True else: - print("Tension field end stiffener check failed: Bearing capacity insufficient") + # print("Tension field end stiffener check failed: Bearing capacity insufficient") self.end_stiffthickness = 0 return False @@ -2717,18 +2718,18 @@ def tension_field_intermediate_stiffener( # Critical buckling resistance (kN) Pd = round(A_x * fcd, 2) self.shear_ratio = max(self.load.shear_force / Pd, self.shear_ratio) - print('moment ratio', self.moment_ratio, 'inter shear ratio', self.shear_ratio) + # print('moment ratio', self.moment_ratio, 'inter shear ratio', self.shear_ratio) self.Critical_buckling_resistance = Pd - print("Intermediate stiffener shear buckling check:", 'stiff width', IntStiffenerWidth, 'stiff thick', - IntStiffThickness, 'cd_ratio', cd_ratio, 'I_min_global', I_min_global, 'I_s', I_s, 'max_outstand', - max_outstand, 'F_q', F_q, 'As', A_s, 'Ax', A_x, 'Ix', I_x, 'rx', r_x, 'Le', Le, 'slenderness input', - slenderness_input, 'fcd', fcd, 'Pd', Pd, 'V_cr', self.V_cr, 'V_ed', V_ed, 'gamma_m0', gamma_m0, 'fy', - fy, 'E', E) + # print("Intermediate stiffener shear buckling check:", 'stiff width', IntStiffenerWidth, 'stiff thick', + # IntStiffThickness, 'cd_ratio', cd_ratio, 'I_min_global', I_min_global, 'I_s', I_s, 'max_outstand', + # max_outstand, 'F_q', F_q, 'As', A_s, 'Ax', A_x, 'Ix', I_x, 'rx', r_x, 'Le', Le, 'slenderness input', + # slenderness_input, 'fcd', fcd, 'Pd', Pd, 'V_cr', self.V_cr, 'V_ed', V_ed, 'gamma_m0', gamma_m0, 'fy', + # fy, 'E', E) # Debug prints - print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") - print("Critical buckling resistance Pd:", Pd, "kN") + # print("Design shear force on stiffener F_q:", round(F_q, 2), "kN") + # print("Critical buckling resistance Pd:", Pd, "kN") # Check axial capacity # if F_q < Pd: @@ -2778,7 +2779,7 @@ def design_longitudinal_stiffeners(self, d, tw, c, eps_w, second_stiffener=False c = float(c) tw = float(tw) d_na= Unsymmetrical_I_Section_Properties.calc_centroid(self, self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) - print('d_na', d_na) + # print('d_na', d_na) # 2) stiffener locations self.x1 = int(round(d_na / 5.0 ,0)) # first stiffener at 1/5 of neutral axis from compression flange self.x2 = 0.0 # second stiffener at neutral axis @@ -2858,7 +2859,7 @@ def generate_first_particle(self,L, M, fy,is_thick_web, is_symmetric,k=67): varlst += [tf_top,tf_bot,tw,bf_top,bf_bot,D_final] else: varlst += [tf_top,tf_bot,tw,bf_top,bf_bot,D_final,c,t_stiff] - print(varlst) + # print(varlst) return varlst # 2. Build the list of variables @@ -2900,8 +2901,8 @@ def assign_particle_to_section(self,particle, variable_list, section): setattr(section, name, value) # handle symmetric naming if needed - print("Particle",particle) - print("Variable list",variable_list) + # print("Particle",particle) + # print("Variable list",variable_list) if 'tf' in variable_list: section.tf_top = section.tf_bot = section.tf section.bf_top = section.bf_bot = section.bf @@ -2919,147 +2920,6 @@ def assign_particle_to_section(self,particle, variable_list, section): self.IntStiffThickness = section.t_stiff - # def optimized_method_newmod(self, design_dictionary, is_thick_web, is_symmetric): - - - # # 1. Setup variables - # variable_list = self.build_variable_structure(self,is_thick_web, is_symmetric) - # lb, ub = self.get_bounds(self,variable_list) - # dimensions = len(variable_list) - - # # 2. Generate first particle - # first_particle = self.generate_first_particle(self,self.length, self.load.moment, self.material.fy, is_thick_web, is_symmetric) - # print("###########FIRST PARTICLE -" ,first_particle) - # first_particle = np.clip(first_particle, lb, ub) - - # # 3. PSO config - # n_particles = 50 - # optimizer = GlobalBestPSO( - # n_particles=n_particles, - # dimensions=dimensions, - # options={'c1': 1.2, 'c2': 1.2, 'w': 0.6}, - # bounds=(lb, ub) - # ) - - # # 4. Overwrite the first particle - # optimizer.swarm.position[0] = first_particle - # optimizer.swarm.velocity[0] = np.zeros(dimensions) - # optimizer.swarm.current_cost = self.evaluate_particle_cost(self,first_particle, variable_list, design_dictionary, is_symmetric, is_thick_web) - - # # 5. Run PSO - # best_cost, best_pos = optimizer.optimize( - # lambda swarm: self.evaluate_swarm(self,swarm, variable_list, design_dictionary, is_symmetric, is_thick_web), - # iters=100, - # verbose=True - # ) - - # logger.info("PSO calculation successfully completed") - # print("Best cost:", best_cost) - # best_design_var = dict(zip(variable_list, best_pos)) - # print("Best design variables:", best_design_var) - # def ceil_to_nearest(x, multiple): - # return float(math.ceil(x / multiple) * multiple) - # if is_symmetric: - # self.bottom_flange_thickness = self.top_flange_thickness = float(best_design_var['tf']) - # for i in self.bottom_flange_thickness_list: - # if float(i) > self.bottom_flange_thickness: - # self.bottom_flange_thickness = float(i) - # self.top_flange_thickness = float(i) - # break - # self.web_thickness = float(best_design_var['tw']) - # for i in self.web_thickness_list: - # if float(i) > self.web_thickness: - # self.web_thickness = float(i) - # break - - # self.top_flange_width = self.bottom_flange_width = round(float(best_design_var['bf']),0) - # self.top_flange_width = self.bottom_flange_width = ceil_to_nearest(self.top_flange_width,25) - # self.total_depth = round(float(best_design_var['D']),0) - # self.total_depth = ceil_to_nearest(self.total_depth,25) - - - # # self.IntStiffThickness = float(best_design_var['']) - # # for i in self.int_thickness_list: - # # if float(i) > se - # else: - # self.bottom_flange_thickness = float(best_design_var['tf_bot']) - # for i in self.bottom_flange_thickness_list: - # if float(i) > self.bottom_flange_thickness: - # self.bottom_flange_thickness = float(i) - # break - # self.top_flange_thickness = float(best_design_var['tf_top']) - # for i in self.top_flange_thickness_list: - # if float(i) > self.top_flange_thickness: - # self.top_flange_thickness = float(i) - # break - # self.web_thickness = float(best_design_var['tw']) - # for i in self.web_thickness_list: - # if float(i) > self.web_thickness: - # self.web_thickness = float(i) - # break - - # self.bottom_flange_width = round(float(best_design_var['bf_bot']),0) - # self.bottom_flange_width = ceil_to_nearest(self.bottom_flange_width,25) - # self.top_flange_width = round(float(best_design_var['bf_top']),0) - # self.top_flange_width = ceil_to_nearest(self.top_flange_width,25) - # self.total_depth = round(float(best_design_var['D']),0) - # self.total_depth = ceil_to_nearest(self.total_depth,25) - - - # if not is_thick_web: - # self.IntStiffThickness = float(best_design_var['t_stiff']) - # for i in self.int_thickness_list: - # if float(i) > self.IntStiffThickness: - # self.IntStiffThickness = float(i) - # break - - # self.c = round(float(best_design_var['c']),0) - # self.c = ceil_to_nearest(self.c,25) - - - # logger.info(f"Optimized values : Flange width top and bottom {self.top_flange_width} {self.bottom_flange_width} flange thickness top and bottom {self.top_flange_thickness} { self.bottom_flange_thickness} web_thickness {self.web_thickness} total depth { self.total_depth} C value {self.c} thickness stiffener { self.IntStiffThickness}") - - # # 6. Assign best result - # best_section = Section() - # self.assign_particle_to_section(self,best_pos, variable_list, best_section) - # # self.set_input_values(design_dictionary) - # self.design_check(self,design_dictionary) - - # def evaluate_particle_cost(self, particle, variable_list, design_dictionary, is_symmetric, is_thick_web): - # section = Section() - # self.assign_particle_to_section(self,particle, variable_list, section) - # if is_symmetric: - # if is_thick_web: - # weight = (2 * section.bf * section.tf) + (section.tw * (section.D - 2*section.tf)) * self.length * 7850 - # else: - # weight = (2 * section.bf * section.tf) + (section.tw * (section.D - 2*section.tf)) * self.length * 7850 + ((self.length / section.c) - 1) * section.t_stiff * self.IntStiffnerwidth * self.eff_depth *7850 - # else: - # if is_thick_web: - - # weight = ((section.bf_top * section.tf_top) + (section.bf_bot * section.tf_bot) + (section.tw * (section.D - section.tf_top - section.tf_bot)) ) * self.length * 7850 - # else: - # weight = ((section.bf_top * section.tf_top) + (section.bf_bot * section.tf_bot) + (section.tw * (section.D - section.tf_top - section.tf_bot)) ) * self.length * 7850 + ((self.length / section.c) - 1) * section.t_stiff * self.IntStiffnerwidth * self.eff_depth *7850 - - - - # # placeholder penalty - # penalty = 0 - # maxiratio, slendercheck, thicknesscheck = self.design_check_optimized_version(self,design_dictionary) - - # if slendercheck == False: - # penalty += 1e10 - # if thicknesscheck == False: - # penalty += 1e10 - # penalty += abs(1-maxiratio) * 1e6 - - # return weight + penalty - - # def evaluate_swarm(self, swarm, variable_list, design_dictionary, is_symmetric, is_thick_web): - # return np.array([ - # self.evaluate_particle_cost(self,p, variable_list, design_dictionary, is_symmetric, is_thick_web) - # for p in swarm - # ]) - #### NEW PSO ### @@ -3189,7 +3049,7 @@ def constraint(particle): # (Optional) debug print to see which constraint is worst worst = min(range(len(margins)), key=lambda i: margins[i]) - print(f" constraint: worst margin #{worst} = {margins[worst]:.3f}") + # print(f" constraint: worst margin #{worst} = {margins[worst]:.3f}") return margins @@ -3254,25 +3114,29 @@ def obj_fn_single(x): # 4) Return total return mass + mass_stiff - best_u, best_cost = pso( - obj_norm, - lb_norm, ub_norm, - f_ieqcons=cons_norm, - swarmsize=20, # keep your original settings - maxiter=80, - debug=True, - # init_pos=init_norm - ) - # Denormalize the PSO result back to real units: - best_pos = denormalize(best_u) + results = [] + for run in range(5): + # Call PSO as usual + best_u, best_cost = pso( + obj_norm, + lb_norm, ub_norm, + f_ieqcons=cons_norm, + swarmsize=20, + maxiter=80, + debug=False # (set True if you want debug output + ) + best_pos = denormalize(best_u) + results.append((best_pos, best_cost)) + + best_pos, best_cost = min(results, key=lambda x: x[1]) #best_pos, best_cost = pso(obj_fn_single, lb, ub, f_ieqcons=constraint, swarmsize=100, maxiter=500, debug=True, init_pos=self.generate_first_particle(self,self.length, self.load.moment, self.material.fy, is_thick_web, is_symmetric)) margins = constraint(best_pos) best_section = Section() self.assign_particle_to_section(self,best_pos, variable_list, best_section) logger.info("PSO calculation successfully completed") - print("Best cost:", best_cost) + # print("Best cost:", best_cost) best_design_var = dict(zip(variable_list, best_pos)) - print("Best design variables:", best_design_var) + # print("Best design variables:", best_design_var) def ceil_to_nearest(x, multiple): return float(math.ceil(x / multiple) * multiple) if is_symmetric: @@ -3459,12 +3323,12 @@ def design_check(self,design_dictionary): #moment check unspp if self.moment_capacity_laterally_unsupported(self,self.material.modulus_of_elasticity,self.effective_length,self.total_depth,self.top_flange_thickness,self.bottom_flange_thickness,self.top_flange_width,self.bottom_flange_width,self.web_thickness,self.loading_case,self.gamma_m0,self.material.fy,self.load.shear_force): - print("M", self.Md) + # print("M", self.Md) self.momentchecks = True logger.info("Moment Check passed") else: self.momentchecks = False - print("M", self.Md) + # print("M", self.Md) logger.error("Moment Check failed") else: logger.error("Increase the web thickness") @@ -3491,11 +3355,11 @@ def design_check(self,design_dictionary): self.c = 0 else: self.c = float(self.c) - print("c value",self.c) + # print("c value",self.c) self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,self.stiffener_type,self.c) if self.design_flag2 == True: self.x= design_dictionary[KEY_ShearBucklingOption] - print("shear buckling option",self.x) + # print("shear buckling option",self.x) if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': #shear check @@ -3581,7 +3445,7 @@ def design_check(self,design_dictionary): #deflection checks - if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case, self.deflection_criteria): + if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.length, self.material.modulus_of_elasticity, self.loading_case, self.deflection_criteria): self.defl_check = True logger.info("Deflection Check passed") else: @@ -3615,7 +3479,7 @@ def design_check_optimized_version(self,design_dictionary): self.beta_value(self, design_dictionary,self.section_class) if self.web_philosophy == 'Thick Web without ITS': - print('THICK WEB') + # print('THICK WEB') self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,"no_stiffener",0) if self.design_flag2 == True: @@ -3701,7 +3565,7 @@ def design_check_optimized_version(self,design_dictionary): else: self.c = float(self.c) self.design_flag2 = self.min_web_thickness_thick_web(self,self.eff_depth,self.web_thickness,self.epsilon,self.stiffener_type,self.c) - print('DESIGN FLAG2',self.design_flag2) + # print('DESIGN FLAG2',self.design_flag2) if self.design_flag2 == True: if design_dictionary[KEY_ShearBucklingOption] == 'Simple Post Critical': @@ -3795,7 +3659,7 @@ def design_check_optimized_version(self,design_dictionary): #deflection checks - if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.effective_length, self.material.modulus_of_elasticity, self.loading_case, self.deflection_criteria): + if self.evaluate_deflection_kNm_mm(self,self.load.moment, self.length, self.material.modulus_of_elasticity, self.loading_case, self.deflection_criteria): self.defl_check = True # logger.info("Deflection Check passed") else: @@ -3805,7 +3669,7 @@ def design_check_optimized_version(self,design_dictionary): #in pso check for self.moment_checks and self.shearchecks #for customized - print(f"RATIOS moment {self.moment_ratio} shear {self.shear_ratio} deflection {self.deflection_ratio}") + # print(f"RATIOS moment {self.moment_ratio} shear {self.shear_ratio} deflection {self.deflection_ratio}") return max(self.moment_ratio,self.shear_ratio,self.deflection_ratio),self.design_flag,self.design_flag2 @@ -3839,9 +3703,9 @@ def optimized_method_working(self,design_dictionary,is_thick_web, is_symmetric): ) logger.info("PSO calculation successfully completed") - print("Best cost:", best_cost) + # print("Best cost:", best_cost) best_design_var = dict(zip(variable_list, best_pos)) - print("Best design variables:", best_design_var) + # print("Best design variables:", best_design_var) def ceil_to_nearest(x, multiple): return float(math.ceil(x / multiple) * multiple) if is_symmetric: @@ -3900,7 +3764,7 @@ def ceil_to_nearest(x, multiple): self.c = round(float(best_design_var['c']),0) self.c = ceil_to_nearest(self.c,25) - print('vdfgbdfhb') + # print('vdfgbdfhb') logger.info(f"Optimized values : Flange width top and bottom {self.top_flange_width} {self.bottom_flange_width} flange thickness top and bottom {self.top_flange_thickness} { self.bottom_flange_thickness} web_thickness {self.web_thickness} total depth { self.total_depth} C value {self.c} thickness stiffener { self.IntStiffThickness}") @@ -3932,14 +3796,14 @@ def final_format(self,design_dictionary): # self.web_buckling_ratio = 0 # if self.web_crippling_ratio == None: # self.web_crippling_ratio = 0 - print("RATIOS",'moment ratio', self.moment_ratio, 'shear ratio', self.shear_ratio, 'deflection ratio', self.deflection_ratio) - print(self.moment_ratio, self.shear_ratio) + # print("RATIOS",'moment ratio', self.moment_ratio, 'shear ratio', self.shear_ratio, 'deflection ratio', self.deflection_ratio) + # print(self.moment_ratio, self.shear_ratio) self.result_UR = max(self.moment_ratio,self.shear_ratio, self.deflection_ratio) self.section_classification_val = self.section_class if self.beta_b_lt == None: self.beta_b_lt = 0 self.betab = round(self.beta_b_lt,2) - self.effectivearea = Unsymmetrical_I_Section_Properties.calc_area(self,self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness) + self.effectivearea = Unsymmetrical_I_Section_Properties.calc_area(self,self.total_depth, self.top_flange_width, self.bottom_flange_width, self.web_thickness, self.top_flange_thickness, self.bottom_flange_thickness)/100 if self.Md == None: self.Md = 0 @@ -3977,7 +3841,7 @@ def final_format(self,design_dictionary): self.design_status = True def save_design(self, popup_summary): - print("\n\n\n\n Enterend save design") + # print("\n\n\n\n Enterend save design") logger.info(" :=========Start Of design Saving Button pressed===========") class Section: @@ -4007,7 +3871,7 @@ def pso(func, lb, ub, ieqcons=[], f_ieqcons=None, args=(), kwargs={}, def is_feasible(x, eps=1e-12): cons_val = cons(x) - print(f'Constraint values: {cons_val}') + # print(f'Constraint values: {cons_val}') return np.all(cons_val >= -eps) # strictly >=0; small epsilon for numeric tolerance # Helper: generate a feasible position @@ -4065,23 +3929,26 @@ def random_feasible_point(): # Global best update if fx < fg or not is_feasible(g): if debug: - print(f'New best for swarm at iteration {it}: {x[i, :]} {fx}') + # print(f'New best for swarm at iteration {it}: {x[i, :]} {fx}') + pass tmp = x[i, :].copy() stepsize = np.sqrt(np.sum((g - tmp) ** 2)) if g is not None else np.inf if np.abs(fg - fx) <= minfunc: - print(f'Stopping search: Swarm best objective change less than {minfunc}') + # print(f'Stopping search: Swarm best objective change less than {minfunc}') return tmp, fx elif stepsize <= minstep: - print(f'Stopping search: Swarm best position change less than {minstep}') + # print(f'Stopping search: Swarm best position change less than {minstep}') return tmp, fx else: g = tmp.copy() fg = fx if debug: - print(f'Best after iteration {it}: {g} {fg}') + # print(f'Best after iteration {it}: {g} {fg}') + pass it += 1 - print(f'Stopping search: maximum iterations reached --> {maxiter}') + # print(f'Stopping search: maximum iterations reached --> {maxiter}') if not is_feasible(g): - print("However, the optimization couldn't find a feasible design. Sorry") + # print("However, the optimization couldn't find a feasible design. Sorry") + pass return g, fg \ No newline at end of file diff --git a/src/osdag/gui/ui_template.py b/src/osdag/gui/ui_template.py index 41c1ead72..8b529ae2d 100644 --- a/src/osdag/gui/ui_template.py +++ b/src/osdag/gui/ui_template.py @@ -2186,7 +2186,7 @@ def common_function_for_save_and_design(self, main, data, trigger_type): KEY_DISP_COMPRESSION_COLUMN,KEY_DISP_FLEXURE,KEY_DISP_FLEXURE2,KEY_DISP_COMPRESSION_Strut,KEY_DISP_LAPJOINTBOLTED,KEY_DISP_PLATE_GIRDER_WELDED]: # , KEY_DISP_FLEXURE # print(self.display, self.folder, main.module, main.mainmodule) print("common start") - print(f"main object type: {type(main)}")`` + print(f"main object type: {type(main)}") print(f"main attributes: {dir(main)}") print("main.mainmodule",main.mainmodule) From 62d2db45e27e77beccc144bb5ad927b4cfa42c1f Mon Sep 17 00:00:00 2001 From: Harshan S Date: Tue, 1 Jul 2025 13:48:10 +0530 Subject: [PATCH 23/23] optimised plate girder cad model --- src/osdag/cad/items/plate_girder.py | 531 ++++++++-------------------- 1 file changed, 140 insertions(+), 391 deletions(-) diff --git a/src/osdag/cad/items/plate_girder.py b/src/osdag/cad/items/plate_girder.py index 63809f30d..cf7e85f39 100644 --- a/src/osdag/cad/items/plate_girder.py +++ b/src/osdag/cad/items/plate_girder.py @@ -1,433 +1,182 @@ +# optimised_plate_girder_refactored.py + +from .ISection import ISection +from .notch import Notch from .plate import Plate from .filletweld import FilletWeld import math -import numpy - -# OCC Imports -from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Trsf, gp_Ax1, gp_Dir -from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakePolygon, BRepBuilderAPI_MakeFace, BRepBuilderAPI_Transform, BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire -from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakePrism -from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Fuse, BRepAlgoAPI_Cut +import time + +from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Trsf, gp_Ax1, gp_Dir, gp_Ax3 +from OCC.Core.BRepBuilderAPI import ( + BRepBuilderAPI_MakePolygon, BRepBuilderAPI_MakeFace, BRepBuilderAPI_Transform, + BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire +) +from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakePrism +from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Fuse +from OCC.Core.BRep import BRep_Builder +from OCC.Core.TopoDS import TopoDS_Compound from OCC.Core.AIS import AIS_Shape from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB -from OCC.Core.Graphic3d import Graphic3d_NOM_ALUMINIUM, Graphic3d_MaterialAspect +from OCC.Core.Graphic3d import Graphic3d_NOM_ALUMINIUM from OCC.Display.SimpleGui import init_display - - - - class PlateGirder: + def __init__(self, D, tw, length, gap, T_ft, T_fb, B_ft, B_fb): + self.D = D + self.tw = tw + self.length = length + self.gap = gap + self.T_ft = T_ft + self.T_fb = T_fb + self.B_ft = B_ft + self.B_fb = B_fb - def __init__(self,D,tw,length,gap,T_ft,T_fb,B_ft,B_fb): - super(PlateGirder, self).__init__() - self.D =D - self.tw =tw - self.length =length - self.gap =gap - self.T_ft =T_ft - self.T_fb =T_fb - self.B_ft =B_ft - self.B_fb =B_fb - def createPlateGirder(self): - #central plate - #self.D = self.total_depth # total depth - #self.tw = self.web_thickness #web thickness - # length = self.length #length along Y axis or length of the section - - # gap = self.c #space between each stiffner plate - chamfer_length = 20 #traingular chamfer length hard coding the value - - - L_top = self.length #length of top plate of I section - L_bottom = self.length #length of bottom plate of I section - - bottom_outstand = 30 #bottom outstand - top_outstand = 50 #top outstand - - - stiffener_weld_height = None - web_flange_weld_height = 5 #height of weld for web flange hard coding the value - - - # #top and bottom flange - # T_ft = self.top_flange_thickness #top flange thickness - # T_fb = self.bottom_flange_thickness #bottom flange thickness - # B_ft = self.top_flange_width #breadth or width of top flange - # B_fb = self.bottom_flange_width #breadth or width of bottom flange - - - - # stiffener's dimensions - L = (min(self.B_ft, self.B_fb)-self.tw)/2 -10 #horizontal length - T_is = 5 #thickness of stiffener # need to check this - W = self.D - (self.T_fb+self.T_ft) #vertical height - - #weld dimensions - b = 5 - h = 5 - h=b + chamfer_length = 30 + T_is = 15 + L = (min(self.B_ft, self.B_fb) - self.tw) / 2 + b = h = 15 l = L - chamfer_length + vertical_weld_height = 0.5 * chamfer_length + center_plate_color = Quantity_Color(5/255, 5/255, 255/255, Quantity_TOC_RGB) + top_bottom_plate_color = Quantity_Color(137/255, 95/255, 16/255, Quantity_TOC_RGB) - # Define the colors using Quantity_Color - center_plate_color = Quantity_Color(5/255, 5/255, 255/255, Quantity_TOC_RGB) - top_bottom_plate_color = Quantity_Color(137/255, 95/255, 16/255, Quantity_TOC_RGB) + display, start_display, *_ = init_display() + display.set_bg_gradient_color([51, 51, 102], [150, 150, 170]) def plate_model_with_color(origin, l, b, h, color): - plate_origin = origin - plate_uDir = numpy.array([0.,0.,1.]) - plate_wDir = numpy.array([0.,1.,0.]) plate = Plate(l, b, h) - _place = plate.place(plate_origin, plate_uDir, plate_wDir) - plate_point = plate.compute_params() - plate_shape = plate.create_model() - - # Apply the color to the plate shape using AIS_Shape - ais_shape = AIS_Shape(plate_shape) + plate.place(origin, [0., 0., 1.], [0., 1., 0.]) + shape = plate.create_model() + ais_shape = AIS_Shape(shape) ais_shape.SetColor(color) display.Context.Display(ais_shape, True) + return shape - return plate_shape - - - - print("model generating......") - - - - start_gap = end_gap = self.gap # gap at front and back - + def fuse_models(models): + builder = BRep_Builder() + compound = TopoDS_Compound() + builder.MakeCompound(compound) + for m in models: + builder.Add(compound, m) + return compound - #initialisation of the display method to display the 3D model - display, start_display, add_menu, add_function_to_menu = init_display() - display.set_bg_gradient_color([51, 51, 102], [150, 150, 170]) - - - - center_plate = plate_model_with_color(numpy.array([0., 0., 0.]) ,self.tw, self.length,self.D, center_plate_color) - top_plate = plate_model_with_color(numpy.array([0, 0, (self.D + self.T_ft) // 2]) , self.B_ft, L_top, self.T_ft, top_bottom_plate_color) - bottom_plate = plate_model_with_color(numpy.array([0, 0, -(self.D+self.T_fb) // 2]) , self.B_fb, L_bottom, self.T_fb, top_bottom_plate_color) - - - ISection_model = BRepAlgoAPI_Fuse(bottom_plate, top_plate).Shape() - #ISection_model = BRepAlgoAPI_Fuse(ISection_model, bottom_plate).Shape() - - def translation_movement(x,y,z, model): + def translation_movement(x, y, z, model): trsf = gp_Trsf() - translation_vector = gp_Vec(x, y, z) - trsf.SetTranslation(translation_vector) - model = BRepBuilderAPI_Transform(model, trsf).Shape() - return model + trsf.SetTranslation(gp_Vec(x, y, z)) + return BRepBuilderAPI_Transform(model, trsf).Shape() - def translation_rotation(angle,axis, model): + def translation_rotation(angle, axis, model): trsf = gp_Trsf() trsf.SetRotation(axis, math.radians(angle)) - model = BRepBuilderAPI_Transform(model, trsf).Shape() - return model - - def triangle_model(p1,p2,p3, thickness): - - polygon = BRepBuilderAPI_MakePolygon() - polygon.Add(p1) - polygon.Add(p2) - polygon.Add(p3) - polygon.Close() - face = BRepBuilderAPI_MakeFace(polygon.Shape()).Face() - direction = gp_Vec(0, 3*thickness, 0) - extrusion = BRepPrimAPI_MakePrism(face, direction) - triangle_3d = extrusion.Shape() - ais_shape = AIS_Shape(triangle_3d) - - return ais_shape.Shape() - - - def create_weld_model(thickness, width, position, direction): - origin = position - - if direction=='y': - uDir = numpy.array([0., 0., 1.]) - shaftDir = numpy.array([0., 1., 0.]) - - elif direction=='x': - uDir = numpy.array([0., 0., 1.]) - shaftDir = numpy.array([1., 0., 0.]) - - elif direction=='z': - uDir = numpy.array([1., 0., 0.]) - shaftDir = numpy.array([0., 0., 1.]) - - FWeld = FilletWeld(thickness, thickness, width) - _place = FWeld.place(origin, uDir, shaftDir) - point = FWeld.compute_params() - prism = FWeld.create_model(0) - - return prism - - - def create_corner_cutout(model, coordinates, thickness, side): - - x = coordinates[0] - y = coordinates[1] - z = coordinates[2] - # extra_gap = chamfer_length+4 - if side=="right": - #top triangle cutout - t_p1 = gp_Pnt(self.tw//2, y-thickness,self.D//2) - t_p2 = gp_Pnt(self.tw//2, y-thickness, (self.D//2)-chamfer_length) - t_p3 = gp_Pnt((self.tw//2)+chamfer_length, y-thickness,self.D//2) - - top_triangle = triangle_model(t_p1,t_p2,t_p3, thickness) - model = BRepAlgoAPI_Cut(model, top_triangle).Shape() - - - #bottom triangle cutout - b_p1 = gp_Pnt(self.tw//2, y-thickness, -self.D//2) - b_p2 = gp_Pnt(self.tw//2, y-thickness, -(self.D//2)+chamfer_length) - b_p3 = gp_Pnt((self.tw//2)+chamfer_length, y-thickness, -self.D//2) - - bottom_triangle= triangle_model(b_p1,b_p2,b_p3, thickness) - final_model = BRepAlgoAPI_Cut(model, bottom_triangle).Shape() - - - if side=="left": - #top triangle cutout - t_p1 = gp_Pnt(-self.tw//2, y-thickness,self.D//2) - t_p2 = gp_Pnt(-self.tw//2, y-thickness, (self.D//2)-chamfer_length) - t_p3 = gp_Pnt(-(self.tw//2)-chamfer_length, y-thickness,self.D//2) - - top_triangle = triangle_model(t_p1,t_p2,t_p3, thickness) - model = BRepAlgoAPI_Cut(model, top_triangle).Shape() - - - #bottom triangle cutout - b_p1 = gp_Pnt(-self.tw//2, y-thickness, -(self.D//2)) - b_p2 = gp_Pnt(-self.tw//2, y-thickness, -(self.D//2)+chamfer_length) - b_p3 = gp_Pnt(-(self.tw//2)-chamfer_length, y-thickness, -(self.D//2)) - - bottom_triangle= triangle_model(b_p1,b_p2,b_p3, thickness) - final_model = BRepAlgoAPI_Cut(model, bottom_triangle).Shape() - - - return final_model - - - def stiffner_plate(position, L,D, T_is, direction): - ''' - this function returns stiffner plate with corner cutout, hence this function can be called multiple times inside for loop - ''' - - #creating stiffner plate model - - #plate_origin = numpy.array([-L//2-self.tw//2,remaining_gap,-D//2]) - plate_origin = position - plate_uDir = numpy.array([0.,1.,0.]) - plate_wDir = numpy.array([0.,0.,1.]) - plate = Plate(L,self.D, T_is) - _place = plate.place(plate_origin, plate_uDir, plate_wDir) - point = plate.compute_params() - stiffner_plate_model = plate.create_model() - - #punching cutouts in the stiffner plate - stiffner_plate_model = create_corner_cutout(stiffner_plate_model, plate_origin, T_is, direction) + return BRepBuilderAPI_Transform(model, trsf).Shape() + + def stiffner_plate(position, b, a, thickness, direction): + c = chamfer_length + x, y, z = map(float, position) + y -= thickness/2 + if direction == "right": + pts = [gp_Pnt(0, 0, (a/2)-c), gp_Pnt(c, 0, a/2), gp_Pnt(b, 0, a/2), + gp_Pnt(b, 0, -a/2), gp_Pnt(c, 0, -a/2), gp_Pnt(0, 0, (-a/2)+c)] + else: + pts = [gp_Pnt(0, 0, (a/2)-c), gp_Pnt(-c, 0, a/2), gp_Pnt(-b, 0, a/2), + gp_Pnt(-b, 0, -a/2), gp_Pnt(-c, 0, -a/2), gp_Pnt(0, 0, (-a/2)+c)] - return stiffner_plate_model + wire = BRepBuilderAPI_MakeWire() + for i in range(len(pts)): + wire.Add(BRepBuilderAPI_MakeEdge(pts[i], pts[(i+1) % len(pts)]).Edge()) + face = BRepBuilderAPI_MakeFace(wire.Wire()).Face() + prism = BRepPrimAPI_MakePrism(face, gp_Vec(0, thickness, 0)).Shape() + local_ax3 = gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(0, 1, 0)) + global_ax3 = gp_Ax3(gp_Pnt(x, y, z), gp_Dir(0, 0, 1), gp_Dir(0, 1, 0)) + trsf = gp_Trsf() + trsf.SetDisplacement(local_ax3, global_ax3) + return BRepBuilderAPI_Transform(prism, trsf, True).Shape() def vertical_weld(weld_height, length): - ''' - this function creates vertical weld between stiffner plate and the vertical plate of the I section plate - ''' - p1 = gp_Pnt(0, 0, 0) - p2 = gp_Pnt(weld_height, 0, 0) - p3 = gp_Pnt(0, -weld_height, 0) - edge1 = BRepBuilderAPI_MakeEdge(p1, p2).Edge() - edge2 = BRepBuilderAPI_MakeEdge(p2, p3).Edge() - edge3 = BRepBuilderAPI_MakeEdge(p3, p1).Edge() - wire = BRepBuilderAPI_MakeWire(edge1, edge2, edge3).Wire() + p1, p2, p3 = gp_Pnt(0, 0, 0), gp_Pnt(weld_height, 0, 0), gp_Pnt(0, -weld_height, 0) + edges = [BRepBuilderAPI_MakeEdge(p1, p2).Edge(), BRepBuilderAPI_MakeEdge(p2, p3).Edge(), + BRepBuilderAPI_MakeEdge(p3, p1).Edge()] + wire = BRepBuilderAPI_MakeWire(*edges).Wire() face = BRepBuilderAPI_MakeFace(wire).Face() - extrude_vec = gp_Vec(0, 0, length) - solid = BRepPrimAPI_MakePrism(face, extrude_vec).Shape() - return solid + return BRepPrimAPI_MakePrism(face, gp_Vec(0, 0, self.D - 2 * chamfer_length)).Shape() + def create_weld_model(thickness, width, position, direction): + uDir, shaftDir = ([0., 0., 1.], [0., 1., 0.]) if direction == 'y' else ([1., 0., 0.], [0., 0., 1.]) + FWeld = FilletWeld(thickness, thickness, width) + FWeld.place(position, uDir, shaftDir) + return FWeld.create_model(0) - def filletWeld_model(b, h, l, y, position, T_is): - origin = numpy.array([0., 0., 0.]) - uDir = numpy.array([0., 0., 1.]) - shaftDir = numpy.array([1., 0., 0.]) + def filletWeld_model(b, h, l, y, position): + x = self.tw//2 + chamfer_length if position == "right" else -self.tw//2 - l - chamfer_length FWeld = FilletWeld(b, h, l) - _place = FWeld.place(origin, uDir, shaftDir) - point = FWeld.compute_params() - prism = FWeld.create_model(0) - angle = 0 - axis = gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)) - x=0 - ''' - position if statement for right and left weld - ''' - if position=="right": - x=self.tw//2+chamfer_length - - if position=="left": - x=(-self.tw//2)-l-chamfer_length - - - #formation of front weld - - - #down - trsf = gp_Trsf() - angle = 0 - trsf.SetRotation(axis, math.radians(angle)) - prism_down = BRepBuilderAPI_Transform(prism, trsf).Shape() - - #up - trsf = gp_Trsf() - angle = 90 - trsf.SetRotation(axis, math.radians(angle)) - prism_up = BRepBuilderAPI_Transform(prism, trsf).Shape() - - #translation - prism_up = translation_movement(x, y-T_is//2,self.D//2, prism_up) - - prism_down = translation_movement( x, y-T_is//2, -(self.D//2), prism_down) + FWeld.place([0., 0., 0.], [0., 0., 1.], [1., 0., 0.]) + base = FWeld.create_model(0) + def rotate_and_translate(angle, dx, dy, dz): + shape = translation_rotation(angle, gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)), base) + return translation_movement(dx, dy, dz, shape) - weld_fused_forward= BRepAlgoAPI_Fuse(prism_up, prism_down).Shape() + front = BRepAlgoAPI_Fuse( + rotate_and_translate(0, x, y - T_is//2, self.D//2), + rotate_and_translate(90, x, y - T_is//2, -self.D//2) + ).Shape() - #for behind weld - - #down - trsf = gp_Trsf() - angle = 270 - trsf.SetRotation(axis, math.radians(angle)) - prism_down = BRepBuilderAPI_Transform(prism, trsf).Shape() - - #up - trsf = gp_Trsf() - angle = 180 - trsf.SetRotation(axis, math.radians(angle)) - prism_up = BRepBuilderAPI_Transform(prism, trsf).Shape() - - #translation - prism_up = translation_movement( x, y+T_is//2,self.D//2, prism_up) + back = BRepAlgoAPI_Fuse( + rotate_and_translate(180, x, y + T_is//2, self.D//2), + rotate_and_translate(270, x, y + T_is//2, -self.D//2) + ).Shape() - prism_down = translation_movement( x, y+T_is//2, -self.D//2, prism_down) + return BRepAlgoAPI_Fuse(front, back).Shape() - weld_fused_behind= BRepAlgoAPI_Fuse(prism_up, prism_down) - if weld_fused_behind.IsDone(): - weld_fused_behind = weld_fused_behind.Shape() - - weld_fused = BRepAlgoAPI_Fuse(weld_fused_forward,weld_fused_behind) - if weld_fused.IsDone(): - weld_fused = weld_fused.Shape() - - return weld_fused - - #bottom weld across longitudinal direction - right_bottom_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([self.tw//2, 0.,(-self.D//2)]), "y") - left_bottom_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([-self.tw//2, 0.,(-self.D//2)]),"y") - axis = gp_Ax1(gp_Pnt(-self.tw//2, 0.,(-self.D//2)), gp_Dir(0, 1, 0)) - trsf = gp_Trsf() - angle = -90 - trsf.SetRotation(axis, math.radians(angle)) - left_bottom_weld = BRepBuilderAPI_Transform(left_bottom_weld, trsf).Shape() - - #top weld across longitudinal direction - right_top_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([self.tw//2, 0.,(self.D//2)]), "y") - axis = gp_Ax1(gp_Pnt(self.tw//2, 0.,(self.D//2)), gp_Dir(0, 1, 0)) - trsf = gp_Trsf() - angle = 90 - trsf.SetRotation(axis, math.radians(angle)) - right_top_weld = BRepBuilderAPI_Transform(right_top_weld, trsf).Shape() - - left_top_weld = create_weld_model(0.5*chamfer_length, self.length, numpy.array([-self.tw//2, 0.,(self.D//2)]),"y") - axis = gp_Ax1(gp_Pnt(-self.tw//2, 0.,(self.D//2)), gp_Dir(0, 1, 0)) - trsf = gp_Trsf() - angle = 180 - trsf.SetRotation(axis, math.radians(angle)) - left_top_weld = BRepBuilderAPI_Transform(left_top_weld, trsf).Shape() - - longitudinal_weld = BRepAlgoAPI_Fuse(right_bottom_weld, left_bottom_weld).Shape() - longitudinal_weld = BRepAlgoAPI_Fuse(longitudinal_weld, right_top_weld).Shape() - longitudinal_weld = BRepAlgoAPI_Fuse(longitudinal_weld, left_top_weld).Shape() - - #vertical weld test - vertical_weld_height = 0.5*chamfer_length #vertical weld height is fixed as 0.5*chamfer_length - stiffner_vertical_weld = vertical_weld(vertical_weld_height,self.D-(2*chamfer_length)) + # --- Begin assembling model --- + center_plate = plate_model_with_color(np.array([0., 0., 0.]), self.tw, self.length, self.D, center_plate_color) + top_plate = plate_model_with_color(np.array([0, 0, (self.D + self.T_ft) // 2]), self.B_ft, self.length, self.T_ft, top_bottom_plate_color) + bottom_plate = plate_model_with_color(np.array([0, 0, -(self.D + self.T_fb) // 2]), self.B_fb, self.length, self.T_fb, top_bottom_plate_color) + ISection_model = BRepAlgoAPI_Fuse(bottom_plate, top_plate).Shape() + # Longitudinal welds + welds = [ + create_weld_model(0.5 * chamfer_length, self.length, np.array([self.tw // 2, 0., -self.D // 2]), "y"), + create_weld_model(0.5 * chamfer_length, self.length, np.array([-self.tw // 2, 0., -self.D // 2]), "y"), + create_weld_model(0.5 * chamfer_length, self.length, np.array([self.tw // 2, 0., self.D // 2]), "y"), + create_weld_model(0.5 * chamfer_length, self.length, np.array([-self.tw // 2, 0., self.D // 2]), "y") + ] + longitudinal_weld = fuse_models(welds) + + stiffners, welds = [], [] + v_weld = vertical_weld(vertical_weld_height, self.D - 2 * chamfer_length) for y in range(self.gap, self.length, self.gap): - - right_stiffner_plate = stiffner_plate(numpy.array([(L/2)+self.tw/2,y,-self.D/2]), L,self.D, T_is, "right") - left_stiffner_plate = stiffner_plate(numpy.array([-L/2-self.tw/2,y,-self.D/2]), L,self.D, T_is, "left") - - right_horizontal_stiffner_weld = filletWeld_model(b,h,l,y,"right", T_is) - left_horizontal_stiffner_weld = filletWeld_model(b,h,l,y,"left", T_is) - - right_vertical_front_weld = translation_movement(self.tw/2 ,y , (-self.D/2) + chamfer_length, stiffner_vertical_weld) - right_vertical_rear_weld = translation_rotation(180, gp_Ax1(gp_Pnt(0., 0., 0.), gp_Dir(0, 0, 1)), stiffner_vertical_weld) - right_vertical_rear_weld = translation_movement((self.tw/2)+vertical_weld_height ,y+(T_is/2) , (-self.D/2) + chamfer_length , right_vertical_rear_weld) - - left_vertical_front_weld = translation_rotation(-90, gp_Ax1(gp_Pnt(0., 0., 0.), gp_Dir(0, 0, 1)), stiffner_vertical_weld) - left_vertical_front_weld = translation_movement(-self.tw/2 ,y , (-self.D/2) + chamfer_length, left_vertical_front_weld) - left_vertical_rear_weld = translation_rotation(-180, gp_Ax1(gp_Pnt(0., 0., 0.), gp_Dir(0, 0, 1)), stiffner_vertical_weld) - left_vertical_rear_weld = translation_movement((-self.tw/2) ,y+(T_is/2) , (-self.D/2) + chamfer_length , left_vertical_rear_weld) - - - if y==self.gap: - stiffner_plate_model = BRepAlgoAPI_Fuse(right_stiffner_plate, left_stiffner_plate).Shape() - stiffner_horizontal_weld = BRepAlgoAPI_Fuse(right_horizontal_stiffner_weld, left_horizontal_stiffner_weld).Shape() - right_vertical_weld = BRepAlgoAPI_Fuse(right_vertical_front_weld, right_vertical_rear_weld).Shape() - left_vertical_weld = BRepAlgoAPI_Fuse(left_vertical_front_weld, left_vertical_rear_weld).Shape() - - else: - stiffner_plate_model = BRepAlgoAPI_Fuse(stiffner_plate_model, right_stiffner_plate).Shape() - stiffner_plate_model = BRepAlgoAPI_Fuse(stiffner_plate_model, left_stiffner_plate).Shape() - stiffner_horizontal_weld = BRepAlgoAPI_Fuse(stiffner_horizontal_weld, right_horizontal_stiffner_weld).Shape() - stiffner_horizontal_weld = BRepAlgoAPI_Fuse(stiffner_horizontal_weld, left_horizontal_stiffner_weld).Shape() - right_vertical_weld = BRepAlgoAPI_Fuse(right_vertical_weld, right_vertical_rear_weld).Shape() - right_vertical_weld = BRepAlgoAPI_Fuse(right_vertical_weld, right_vertical_front_weld).Shape() - left_vertical_weld = BRepAlgoAPI_Fuse(left_vertical_weld, left_vertical_front_weld).Shape() - left_vertical_weld = BRepAlgoAPI_Fuse(left_vertical_weld, left_vertical_rear_weld).Shape() - - - # #displaying the model - # display.DisplayShape(ISection_model, update=True) - # display.DisplayShape(center_plate, update=True) - # display.DisplayShape(stiffner_plate_model,material=Graphic3d_NOM_ALUMINIUM, update=True) - # display.DisplayShape(longitudinal_weld,color="red", update=True) - # display.DisplayShape(right_vertical_weld,color="red", update=True) - # display.DisplayShape(left_vertical_weld,color="red", update=True) - # display.DisplayShape(stiffner_horizontal_weld,color="red", update=True) - - # start_display() - - - #fusing only weld - weld = BRepAlgoAPI_Fuse(longitudinal_weld, right_vertical_weld) - weld = BRepAlgoAPI_Fuse(weld, left_vertical_weld) - weld = BRepAlgoAPI_Fuse(weld, stiffner_horizontal_weld) - - weld_color = Quantity_Color(255/255, 0/255, 0/255, Quantity_TOC_RGB) - - ais_weld_shape = AIS_Shape(weld) - ais_weld_shape.SetColor(weld_color) - display.Context.Display(ais_weld_shape, True) - - - #fusing only the I girder - girder = BRepAlgoAPI_Fuse(ISection_model, center_plate) - - #stiffener plates - ais_box = AIS_Shape(stiffner_plate_model) - ais_box.SetMaterial(Graphic3d_NOM_ALUMINIUM) - display.Context.Display(ais_box, True) - - plate_girder_model = BRepAlgoAPI_Fuse(weld, girder) - plate_girder_model = BRepAlgoAPI_Fuse(plate_girder_model, stiffner_plate_model) - + stiffners.extend([ + stiffner_plate(np.array([self.tw/2, y, 0]), L, self.D, T_is, "right"), + stiffner_plate(np.array([-self.tw/2, y, 0]), L, self.D, T_is, "left") + ]) + welds.extend([ + filletWeld_model(b, h, l, y, "right"), + filletWeld_model(b, h, l, y, "left"), + translation_movement(self.tw/2, y, (-self.D/2)+chamfer_length, v_weld), + translation_movement(self.tw/2, y+T_is/2, (-self.D/2)+chamfer_length, + translation_rotation(90, gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), v_weld)), + translation_movement(-self.tw/2, y, (-self.D/2)+chamfer_length, + translation_rotation(-90, gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), v_weld)), + translation_movement(-self.tw/2, y+T_is/2, (-self.D/2)+chamfer_length, + translation_rotation(-180, gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), v_weld)) + ]) + + stiffners = fuse_models(stiffners) + welds = fuse_models(welds) + display.DisplayShape(ISection_model, update=True) + display.DisplayShape(center_plate, update=True) + display.DisplayShape(stiffners, material=Graphic3d_NOM_ALUMINIUM, update=True) + display.DisplayShape(longitudinal_weld, color="red", update=True) + display.DisplayShape(welds, color="red", update=True) + start_display() + + plate_girder_model = BRepAlgoAPI_Fuse(BRepAlgoAPI_Fuse(center_plate, ISection_model).Shape(), stiffners) + plate_girder_model = BRepAlgoAPI_Fuse(plate_girder_model, welds).Shape() return plate_girder_model - \ No newline at end of file