Code covered by the BSD License  

Highlights from
Direct strength method calculator for columns at ambient temperature

image thumbnail

Direct strength method calculator for columns at ambient temperature

by

 

03 Apr 2013 (Updated )

simple tool for calculating ultimate capacity of thin-walled column by DSM

DSM_for_Columns(varargin)
%DSM calculator for sections at ambient temperature.
%This program calculates ultimate load capacity of columns based on DSM (AISI 2007).
%
%By:Ashkan Shahbazian  Date: 02/12/2010.

function varargout = DSM_for_Columns(varargin)
% DSM_FOR_COLUMNS M-file for DSM_for_Columns.fig
%      DSM_FOR_COLUMNS, by itself, creates a new DSM_FOR_COLUMNS or raises the existing
%      singleton*.
%
%      H = DSM_FOR_COLUMNS returns the handle to a new DSM_FOR_COLUMNS or the handle to
%      the existing singleton*.
%
%      DSM_FOR_COLUMNS('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DSM_FOR_COLUMNS.M with the given input arguments.
%
%      DSM_FOR_COLUMNS('Property','Value',...) creates a new DSM_FOR_COLUMNS or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before DSM_for_Columns_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to DSM_for_Columns_OpeningFcn via varargin.
%      Last Modified by GUIDE v2.5 02-Dec-2010 11:42:41

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @DSM_for_Columns_OpeningFcn, ...
                   'gui_OutputFcn',  @DSM_for_Columns_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before DSM_for_Columns is made visible.
%
function DSM_for_Columns_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes DSM_for_Columns wait for user response 
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = DSM_for_Columns_OutputFcn(hObject, eventdata, handles) 

% Get default command line output from handles structure
varargout{1} = handles.output;

function GPy_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of GPy as text
%        str2double(get(hObject,'String')) returns contents of GPy as a double
input=str2num(get(hObject,'String'));
if (isempty(input))
    set(hObject,'String','0')
end
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function GPy_CreateFcn(hObject, eventdata, handles)
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function GPcrl_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of GPcrl as text
%        str2double(get(hObject,'String')) returns contents of GPcrl as a double
input=str2num(get(hObject,'String'));
if (isempty(input))
    set(hObject,'String','0')
end
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function GPcrl_CreateFcn(hObject, eventdata, handles)
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function GPcrd_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of GPcrd as text
%        str2double(get(hObject,'String')) returns contents of GPcrd as a double
input=str2num(get(hObject,'String'));
if (isempty(input))
    set(hObject,'String','0')
end
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function GPcrd_CreateFcn(hObject, eventdata, handles)

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function GPcre_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of GPcre as text
%        str2double(get(hObject,'String')) returns contents of GPcre as a double
input=str2num(get(hObject,'String'));
if (isempty(input))
    set(hObject,'String','0')
end
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function GPcre_CreateFcn(hObject, eventdata, handles)
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in Calculate.
function Calculate_Callback(hObject, eventdata, handles)

GGPy=get(handles.GPy,'String');
GGPcrl=get(handles.GPcrl,'String');
GGPcrd=get(handles.GPcrd,'String');
GGPcre=get(handles.GPcre,'String');
% GGPY and others are variables of string type, and need to be converted to
% variables of number type before the other calculations can be done.
GGGPy=str2num(GGPy);
GGGPcrl=str2num(GGPcrl);
GGGPcrd=str2num(GGPcrd);
GGGPcre=str2num(GGPcre);
%now they converted to numbers. other calculations can be done after this
%block of code.
%The last version of program (DSM calculator without GUI) has been added below.
%---
% Ag=226; %aera of cross section
% Fy=350; %yield stress (N/mm2)
% Py=Ag*Fy %squash Load
Pcrl=GGGPcrl; %critical local (elastic) buckling
Pcrd=GGGPcrd; %critical distortional (elastic) buckling
Pcre=GGGPcre; %critical global or Euler (elastic) buckling
Py=GGGPy; %Squash Load(N)
%flexural, torsional, or torsional-flexural buckling (Global Buckling)
Lc=(Py/Pcre)^0.5;
disp 'Landa c=';disp (Lc);
if Lc<=1.5
   Pne=((0.658)^((Lc)^2))*Py;
   elseif Lc>1.5
    Pne=(0.877/(Lc^2))*Py;
end
disp 'Global Buckling; Pne=';disp (Pne);
%need to convert the answers back into string type to display it.
GGPne=num2str(Pne);
set(handles.GPne,'String',GGPne);
guidata(hObject,handles);
%*********************
%local buckling
Ll=(Pne/Pcrl)^0.5;
disp 'Landa L=';disp (Ll);
if Ll<=0.776
    Pnl=Pne;
elseif Ll>0.776
    Pnl=(1-0.15*((Pcrl/Pne)^0.4))*((Pcrl/Pne)^0.4)*Pne;
end
disp 'Local Buckling; Pnl=';disp (Pnl);
%need to convert the answers back into string type to display it.
GGPnl=num2str(Pnl);
set(handles.GPnl,'String',GGPnl);
guidata(hObject,handles);
%*********************
%distortional buckling
Ld=(Py/Pcrd)^0.5;
disp 'Landa d=';disp (Ld);
if Ld<=0.561
    Pnd=Py;
elseif Ld>0.561
    Pnd=(1-0.25*((Pcrd/Py)^0.6))*((Pcrd/Py)^0.6)*Py;
end
disp 'Distortional Buckling; Pnd=';disp (Pnd);
%need to convert the answers back into string type to display it.
GGPnd=num2str(Pnd);
set(handles.GPnd,'String',GGPnd);
guidata(hObject,handles);
%*********************
P1=min(Pne,Pnl);
Pu=min(P1,Pnd);
disp 'Pu=min(Pne,Pnl,Pnd)';disp (Pu);
%need to convert the answers back into string type to display it.
GGPu=num2str(Pu);
set(handles.GPu,'String',GGPu);
guidata(hObject,handles);
if Pu==Pne;
    disp 'Global Buckling Controls'
    elseif Pu==Pnl;
    disp 'Local and Global Buckling Controls'
    else Pu==Pnd;
    disp 'Distortional Buckling Controls'
end

Contact us