Gán các biến trong Matlab

Một phần của tài liệu Đề tài xây DỰNG PHẦN mềm TÍNH TOÁN CỐT THÉP BẰNG MATLAB (Trang 42 - 54)

VI. N hữ ng đ ĩng gĩp mới của đề tài và n hữ ng ấn đề mà đề tài chư ath ực hiện đượ c

2.2.2 Gán các biến trong Matlab

%MODUN: TINH DAM

%NGUOI VIET: NGUYEN DINH DU - NGUYEN BA NGOC THAO

clc; clear

%% THIET LAP FORM

Screen = get(0,'screensize'); W = 1000; H = 500; x = (Screen(3)-W)/2; y = (Screen(4)-H)/2; Main = figure(... 'Name', 'TÍNH THÉP DẦM',... 'NumberTitle', 'off',... 'Color', [0.92 0.92 0.85],... 'MenuBar', 'none',... 'Position', [x y W H],... 'Resize', 'off'); %% DU LIEU CHUNG FigColor=[0.92 0.92 0.85]; FrameColor = [0.847 0.161 0]; strUnits = 'pixels';

%Giao dien chung cho cac TEXT %Dung chung cho tat ca modun

Xtext.Style = 'text'; Xtext.FontName = 'VNI-Times'; Xtext.FontSize = 11; Xtext.BackgroundColor = FigColor; Xtext.ForegroundColor = [1 0 1]; Xtext.HorizontalAlignment = 'left';

%Giao dien chung cho cac EDIT %Dung chung cho tat ca cac modun

Xedit.Style = 'edit';

Xedit.FontName= 'VNI-Times'; Xedit.FontSize = 10;

Xedit.BackgroundColor = [1 1 1]; %mau trang

Xedit.HorizontalAlignment = 'center';

%Giao dien chung cho cac POP %Dung chung cho tat ca cac modun

Xpop.Style = 'popupmenu'; Xpop.FontName = 'VNI-Times';

Xpop.FontSize = 10;

Xpop.BackgroundColor= [1 1 1];

%Giao dien chung cho cac FRAME %Dung chung cho tat ca modun

Xframe.Units = strUnits;

Xframe.FontName = 'VNI-Times'; Xframe.FontSize = 14;

Xframe.FontWeight = 'normal'; Xframe.BackgroundColor = FigColor;

Xframe.ForegroundColor = FrameColor;% mau do tham

Xframe.TitlePosition = 'lefttop'; Xframe.Visible = 'on';

%Giao dien chung cho cac BUTTON %Dung chung cho tat ca modun %Nut ban chuc nang CHINH

Xbutton.Style = 'pushbutton'; Xbutton.FontName = 'VNI-Times'; Xbutton.FontSize = 11; Xbutton.FontWeight = 'normal'; Xbutton.ForegroundColor = [1 0 0]; Xbutton.HorizontalAlignment = 'right'; %% VAT LIEU ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ H2 = 175; W2 = 450;

frame_Ten = uipanel(Xframe, 'Units','pixels', 'Position',[25 500-H2 W2 H2],'Title','Vật Liệu');

%BE TONG~~~~~~~~~~~~~

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-50 100 20 ],

'String','BÊ TÔNG');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-80 100 20 ],

'String','Rb (MPa)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-110 100 20 ],

'String','Rt (MPa)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-140 100 20 ],

'String','E (MPa)');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pop_Betong = uicontrol(Xpop, 'Parent',frame_Ten, 'Position',[100 H2-47 90 20], 'String','B15(M200) |B20(M250) |B25(M350) |B30(M400) |B35(M450)',...

'Callback','pop_Rb_Rt_Eb');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

edit_Rb = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-79 90 20], 'String','8.5');

edit_Rt = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-109 90 20], 'String','0.75');

edit_Eb = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-139 90 20], 'String','23000');

% THEP~~~~~~~~~~~~~~~

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-50 100 20 ],

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-140 100 20 ],

'String','E (MPa)');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pop_Thep = uicontrol(Xpop, 'Parent',frame_Ten, 'Position',[325 H2-47 90 20], 'String','A-I |A-II |A-III |A-IV |A-V |C-I |C-II |C-III |C-IV |SD295A |SD295B |SD390 ',...

'Callback','pop_Rs_Rsc_Es');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

edit_Rs = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[325 H2-79 90 20], 'String','210');

edit_Rsc = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[325 H2-109 90 20], 'String','210');

edit_Es = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[325 H2-139 90 20], 'String','210000');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % Tinh si gioi han

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-170 100 20 ],

'String','Csi_R');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-170 100 20 ],

'String','anpha_R');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

edit_Csi = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-169 90 20], 'String','0.679');

edit_Anpha = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[325 H2-169 90 20], 'String','0.448');

%% NUT BAM ~~~~~~~~~~~~~~~~~~~

H3 = 45;W3=450;

frame_Nut = uipanel(Xframe, 'Units','pixels', 'Position',[25 10 450 H3]); button_TinhCotThep = uicontrol(Xbutton, 'Parent',frame_Nut, 'Position',[25 H3-35 140 25], 'String','Tính Cốt Thép Dọc','Callback','c_TinhCotThepDoc'); button_XuatKetQua = uicontrol(Xbutton, 'Parent',frame_Nut , 'Position',[175 H3-35 140 25], 'String','Tính Cốt Thép Đai', 'Callback','c_TinhCotThepDai'); button_Thoat = uicontrol(Xbutton, 'Parent',frame_Nut , 'Position',[325 H3-35 100 25], 'String','Thoát', 'Callback','close');

%% THONG SO TIET DIEN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

H1 = 175; W1 = 450;

frame_Ten = uipanel(Xframe, 'Units','pixels', 'Position',[W-W1-25 500-H1 W1 H1],'Title','Tiết Diện');

%~~~~~~~~~~~TEN~~~~~~~~

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H1-50 140 20 ],

'String','Chiều Cao h (cm)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H1-80 140 20 ],

'String','Chiều Rộng b (cm)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H1-110 140 20 ],

'String','Giả Thiết ak (cm)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H1-140 140 20 ],

'String','Giả Thiết an (cm)');

%~~~~~~~~~~~~~~~~~~~~~~

edit_h = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H1-50 90 20], 'String','30');

edit_b = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H1-80 90 20], 'String','20');

edit_a1 = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H1-110 90 20], 'String','3');

edit_a2 = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H1-140 90 20], 'String','3');

%% NOI LUC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

H4 = 175; W4 = 450;

frame_Ten = uipanel(Xframe, 'Units','pixels', 'Position',[25 100 W4 H4],'Title','Nội Lực');

%~~~~~~~~~~~TEN~~~~~~~~

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H4-50 140 20 ],

'String','Momen M (kNm)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H4-80 140 20 ],

'String','Lực Cắt (kN)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H4-110 140 20 ],

'String','Số nhánh đai n'); ;

%~~~~~~~~~~~~~~~~~~~~~~

edit_m = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H4-50 90 20], 'String','30');

edit_q = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H4-80 90 20], 'String','20');

edit_n = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H4-110 90 20], 'String','2');

%% KET QUA THEP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

H5 = 175; W5 = 450;

frame_Ten = uipanel(Xframe, 'Units','pixels', 'Position',[W-W5-25 100 W5 H5],'Title','Kết Quả');

%~~~~~~~~~~~TEN~~~~~~~~5

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H5-50 140 20 ],

'String','As1 (cm2)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H5-80 140 20 ],

'String','As2 (cm2)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H5-110 140 20 ],

'String','Ad (cm2/m)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H5-140 140 20 ],

'String','Smax (cm)');

%~~~~~~~~~~~~~~~~~~~~~~

edit_As1 = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H5-50 90 20], 'String','0');

edit_As2 = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[160 H5-80 90 20], 'String','0');

% Dùng ?? tra các thơng s? c?a bê tơng

Betong = get(pop_Betong, 'Value');

if Betong == 1; Rb = 8.5; Rt = 0.75; Eb=23000; %B15

elseif Betong == 2; Rb = 11.5; Rt = 0.9; Eb=27000; %B20

elseif Betong == 3; Rb = 14.5; Rt = 1.05; Eb=30000; %B25

elseif Betong == 4; Rb = 17; Rt = 1.2; Eb=32500; %B30

elseif Betong == 5; Rb = 19.5; Rt = 1.3; Eb=34500; %B35

end Rs = str2double(get(edit_Rs,'String')); w = 0.85-0.008*Rb; Csi1=w/(1+Rs*(1-w/1.1)/400); Anpha1 = (1-(1-Csi1)^2)/2; Csi = round(Csi1*1000)/1000; Anpha = round (Anpha1*1000)/1000; set(edit_Csi,'String',num2str(Csi)); set(edit_Anpha,'String',num2str(Anpha)); set(edit_Rb,'String',num2str(Rb));

set(edit_Rt,'String',num2str(Rt)); set(edit_Eb,'String',num2str(Eb)); clear Betong

%TINH THEP CHO DAM BETONG

clc; %% Load Du Lieu--- Rs = str2double(get(edit_Rs,'String')); Rb = str2double(get(edit_Rb,'String')); Rt = str2double(get(edit_Rt,'String')); b = str2double(get(edit_b,'String')); h = str2double(get(edit_h,'String')); a1 = str2double(get(edit_a1,'String')); a2 = str2double(get(edit_a2,'String')); m = str2double(get(edit_m,'String')); q = str2double(get(edit_q,'String'));

Anpha_R = str2double(get(edit_Anpha,'String')); Csi_R = str2double(get(edit_Csi,'String')); n=str2double(get(edit_n,'String'));

Ad=str2double(get(edit_Ad,'String'));

%% Tinh Toan thep doc---

ho=h-a1;

Anpha_m = m*1000/(Rb*b*ho*ho);

if Anpha_m <= Anpha_R ; Csi = 1-sqrt(1-2*Anpha_m); As = Csi*Rb*b*ho/Rs;

nguy=100*As/(b*ho); if nguy >= 0.1;As1 = As; else As1=0.001*b*ho; end

set(edit_As1, 'String',num2str(As1)); set(edit_As2, 'String','0');

else Csi = Csi_R;x=Csi*ho;

As2=(m*1000-Rb*b*x*(ho-x/2))/(Rs*(ho-a2)); As1=(Rb*x*b+Rs*As2)/Rs;

set(edit_As2, 'String',num2str(As2));

end

%TINH THEP DAI CHO BETONG

clc; %% Load Du Lieu--- Rs = str2double(get(edit_Rs,'String')); Rb = str2double(get(edit_Rb,'String')); Rt = str2double(get(edit_Rt,'String')); b = str2double(get(edit_b,'String')); h = str2double(get(edit_h,'String')); a1 = str2double(get(edit_a1,'String')); a2 = str2double(get(edit_a2,'String')); m = str2double(get(edit_m,'String')); q = str2double(get(edit_q,'String'));

Anpha_R = str2double(get(edit_Anpha,'String')); Csi_R = str2double(get(edit_Csi,'String')); n=str2double(get(edit_n,'String'));

Ad=str2double(get(edit_Ad,'String'));

%% Tinh Toan thep dai---

ho=h-a1;

aa=q*q*10000/(4*1.7*Rt*b*ho*ho*Rs*n); Smax=1.2*Rt*b*ho*ho*0.1/q;

aa1 = round (aa*100)/100; Smax1 = round (Smax*100)/100;

set(edit_Ad, 'String',num2str(aa1)); set(edit_Smax, 'String',num2str(Smax1));

%CHUONG TRINH: BTCT

%NGUOI VIET: NGUYEN DINH DU - NGUYEN BA NGOC THAO

clc; clear

%% THIET LAP FORM

Screen = get(0,'screensize'); W = 500; H = 400; x = (Screen(3)-W)/2; y = (Screen(4)-H)/2; Main = figure(... 'Name', 'TÍNH THÉP KHUNG',... 'NumberTitle', 'off',... 'Color', [0.92 0.92 0.85],... 'MenuBar', 'none',... 'Position', [x y W H],... 'Resize', 'off'); %% DU LIEU CHUNG FigColor=[0.92 0.92 0.85]; FrameColor = [0.847 0.161 0]; strUnits = 'pixels';

Xtext.BackgroundColor = FigColor; Xtext.ForegroundColor = [1 0 1];

Xtext.HorizontalAlignment = 'left';

%Giao dien chung cho cac EDIT %Dung chung cho tat ca cac modun

Xedit.Style = 'edit';

Xedit.FontName= 'VNI-Times'; Xedit.FontSize = 10;

Xedit.BackgroundColor = [1 1 1]; %mau trang

Xedit.HorizontalAlignment = 'center';

%Giao dien chung cho cac POP %Dung chung cho tat ca cac modun

Xpop.Style = 'popupmenu'; Xpop.FontName = 'VNI-Times'; Xpop.FontSize = 10;

Xpop.BackgroundColor= [1 1 1];

%Giao dien chung cho cac FRAME %Dung chung cho tat ca modun

Xframe.Units = strUnits;

Xframe.FontName = 'VNI-Times'; Xframe.FontSize = 14;

Xframe.FontWeight = 'normal'; Xframe.BackgroundColor = FigColor;

Xframe.ForegroundColor = FrameColor;% mau do tham

Xframe.TitlePosition = 'lefttop'; Xframe.Visible = 'on';

%Giao dien chung cho cac BUTTON %Dung chung cho tat ca modun %Nut ban chuc nang CHINH

Xbutton.Style = 'pushbutton'; Xbutton.FontName = 'VNI-Times'; Xbutton.FontSize = 11; Xbutton.FontWeight = 'normal'; Xbutton.ForegroundColor = [1 0 0]; Xbutton.HorizontalAlignment = 'right';

%% DU LIEU O DANG FILE TEXT

H1 = 130; W1 = 450;

frame_DuLieu = uipanel(Xframe, 'Units','pixels', 'Position',[25 120 W1 H1],'Title','File Dữ Liệu');

text = uicontrol(Xtext, 'Parent',frame_DuLieu, 'Position',[10 H1-55 90 20 ], 'String','Nội Lực');

text = uicontrol(Xtext, 'Parent',frame_DuLieu, 'Position',[10 H1-85 90 20 ], 'String','Tiết Diện');

edit_NoiLuc = uicontrol(Xedit, 'Parent',frame_DuLieu, 'Position',[70 H1-55 300 20], 'HorizontalAlignment','left');

edit_TietDien = uicontrol(Xedit, 'Parent',frame_DuLieu, 'Position',[70 H1-85 300 20], 'HorizontalAlignment','left');

button_NoiLuc = uicontrol(Xbutton, 'Parent',frame_DuLieu , 'Position',[380 H1-55 50 20], 'String','...', 'Callback','c1_GetFile');

button_TietDien = uicontrol(Xbutton, 'Parent',frame_DuLieu , 'Position',[380 H1-85 50 20], 'String','...', 'Callback','c2_GetFile');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~

button_ChuyenDuLieu = uicontrol(Xbutton, 'Parent',frame_DuLieu ,

'Position',[150 H1-120 150 25], 'String','Chuyển Dữ Liệu','Callback','Load_DuLieu');

%% VAT LIEU

H2 = 150; W2 = 450;

frame_Ten = uipanel(Xframe, 'Units','pixels', 'Position',[25 250 W2 H2],'Title','Vật Liệu');

%BE TONG~~~~~~~~~~~~~

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-50 100 20 ],

'String','BÊ TÔNG');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-80 100 20 ],

'String','Rb (MPa)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-110 100 20 ],

'String','Rt (MPa)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-140 100 20 ],

'String','E (MPa)');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pop_Betong = uicontrol(Xpop, 'Parent',frame_Ten, 'Position',[100 H2-47 90 20], 'String','B15(M200) |B20(M250) |B25(M350) |B30(M400) |B35(M450)',...

'Callback','pop_Rb_Rt_Eb');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

edit_Rb = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-79 90 20], 'String','8.5');

edit_Rt = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-109 90 20], 'String','0.75');

edit_Eb = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[100 H2-139 90 20], 'String','23000');

% THEP~~~~~~~~~~~~~~~

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-50 100 20 ],

'String','THÉP');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-80 100 20 ],

'String','Rs (MPa)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-110 100 20 ],

'String','Rsc (MPa)');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[250 H2-140 100 20 ],

'String','E (MPa)');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pop_Thep = uicontrol(Xpop, 'Parent',frame_Ten, 'Position',[325 H2-47 90 20], 'String','A-I |A-II |A-III |A-IV |A-V |C-I |C-II |C-III |C-IV |SD295A |SD295B |SD390 ',...

'Callback','pop_Rs_Rsc_Es');

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

edit_Rs = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[325 H2-79 90 20], 'String','210');

edit_Rsc = uicontrol(Xedit, 'Parent',frame_Ten, 'Position',[325 H2-109 90 20], 'String','210');

H3 = 45;W3=450;

frame_Nut = uipanel(Xframe, 'Units','pixels', 'Position',[25 10 450 H3]); button_TinhCotThep = uicontrol(Xbutton, 'Parent',frame_Nut, 'Position',[25 H3-35 100 25], 'String','Tính Cốt Thép','Callback','TinhToan');

button_XuatKetQua = uicontrol(Xbutton, 'Parent',frame_Nut , 'Position',[175 H3-35 100 25], 'String','Xuất KQ', 'Callback','KetQua');

button_Thoat = uicontrol(Xbutton, 'Parent',frame_Nut , 'Position',[325 H3-35 100 25], 'String','Thoát', 'Callback','close');

%% KET QUA ~~~~~~~~~~~~~~~~~~~

H4 = 45; W4=450;

frame_KetQua = uipanel(Xframe, 'Units','pixels', 'Position',[25 65 450 H4]); text = uicontrol(Xtext, 'Parent',frame_KetQua, 'Position',[10 10 70 20 ], 'String','File KQ');

edit_KetQua = uicontrol(Xedit, 'Parent',frame_KetQua, 'Position',[70 10 300 20], 'HorizontalAlignment','left');

button_Output = uicontrol(Xbutton, 'Parent',frame_KetQua , 'Position',[380 10 50 20], 'String','...', 'Callback','c_SetFile');

%Tinh toan cot thep cho khung %% Load Du Lieu--- Eb = str2double(get(edit_Eb,'String')); Rs = str2double(get(edit_Rs,'String')); Rb = str2double(get(edit_Rb,'String')); Rt = str2double(get(edit_Rt,'String')); w = 0.85-0.008*Rb; Csi=w/(1+Rs*(1-w/1.1)/400);

%% 1 - tach noi luc cho cot va dam

kt=size(NoiLuc,1); frame1=NoiLuc(1,1); frame4=NoiLuc(4,1); NoiLucCot=[]; i=0; while frame1~=frame4 i=i+1; j=i+3; frame1=NoiLuc(i,1); frame4=NoiLuc(j,1); NoiLucCot(i,1:4)=NoiLuc(i,1:4); end ktd=kt-i;

NoiLucCot(i,:)=[];% NoiLucDam = [frame,P,M2,M3]

NoiLucDam=NoiLuc(i:kt,:);

NoiLucDam(:,2:3)=[];% NoiLucDam = [frame,M3] %% tinh toan cot

thepcot=[]; Ass=zeros(size(NoiLucCot,1)/3,1); muyy=zeros(size(NoiLucCot,1)/3,1); for cc=1:size(NoiLucCot,1)/3 ii=0; Asi=zeros(1,3); muyi=zeros(1,3); cx=TietDien(cc,4);% don vi mm cy=TietDien(cc,3);% don vi mm lo=TietDien(cc,2)*1000;% don vi mm

for cci=(3*cc-2):3*cc ii=ii+1; n=NoiLucCot(cci,2); my=NoiLucCot(cci,3); mx=NoiLucCot(cci,4); [As,muy]=TinhThepCot(cx,cy,mx,my,n,lo,Rs,Rb,Eb,Csi); Asi(ii)=As; muyi(ii)=muy; end Ass(cc,1)=max(Asi); muyy(cc,1)=max(muyi); end thepcot=[(1:size(NoiLucCot,1)/3)',Ass,muyy];

%% tinh toan cho dam

errordlg('Da Tinh Toan Xong','Thông Báo','modal')

% Tinh Thep

function [As,muy]=TinhThepCot(cx,cy,mx,my,n,lo,Rs,Rb,Eb,Csi)

% Tinh do lech tam ngau nhien, don vi mm

eax=max(lo/600,cx/30);eax=round(eax+10); eay=max(lo/600,cy/30);eay=round(eay+10);

%1 - Xet uon doc hai phuong

% Phuong x lamdax=lo/cx; e1x=mx*1000/n; eox=max(eax,e1x); if lamdax < 8 nguyx=1; else

Ix=cx*cx*cx*cy/12; % moen quan tinh truc x

thetax=(0.2*eox+1.05*cx)/(1.5*eox+cx); Ncrx=2.5*thetax*Eb*Ix/(lo*lo*1000); nguyx=1/(1-n/Ncrx); end Mx_sao=n*nguyx*eox/1000; % don vi KNm % Phuong y lamday=lo/cy; e1y=my*1000/n; eoy=max(eay,e1y); if lamday<8 nguyy=1; else Iy=cy*cy*cy*cx/12; thetay=(0.2*eoy+1.05*cy)/(1.5*eoy+cy); Ncry=2.5*thetay*Eb*Iy/(lo*lo*1000); nguyy=1/(1-n/Ncry); end My_sao=n*nguyy*eoy/1000;% don vi KNm

else h=cy; b=cx; M1=My_sao; M2=Mx_sao; end % Gia thiet a=h/10; ho=h-a;za=h-2*a;xo=Csi*ho; % 3 - Tinh Toan x1=n*1000/Rb/b;% don vi mm if x1<ho mo=1-0.6*x1/ho; else mo=0.4; end M=M1+mo*M2*h/b; eo=M*1000/n; e=eo+0.5*h-a; if x1<xo x=x1; else efslon=eo/ho; x=(Csi+(1-Csi)/(1+50*efslon*efslon))*ho; end As1=(n*e*1000-Rb*b*x*(ho-x/2))/(Rs*za); % don vi mm2 As1=2.5*As1; % 4 - Su ly ket qua muyt=As1/h/b; % 5 - Xuat ket qua

As=As1;

muy=muyt*100;

% Load Du Lieu % Load Noi Luc

ten_NoiLuc = (get(edit_NoiLuc,'String')); NoiLuc = xlsread(ten_NoiLuc);

NoiLuc(:,2:4)=[]; % Loai bo cot 2, 3, 4

NoiLuc(:,3:5)=[]; NoiLuc(:,5:6)=[];

%NoiLuc=[ten fame, luc doc, momen M2, Momen M3] % Load Tiet Dien

ten_TietDien = (get(edit_TietDien,'String')); TietDien = xlsread(ten_TietDien);

TietDien(:,2:6)=[];

% Ket thuc load du lieu

errordlg('Da Chuyen Du Lieu Xong','Thông Báo','modal')

%CHUONG TRINH: BTCT

clc; clear

%% THIET LAP FORM

Screen = get(0,'screensize'); W = 650; H = 520; x = (Screen(3)-W)/2; y = (Screen(4)-H)/2; Main = figure(... 'Name', 'BTCT-KTCT',... 'NumberTitle', 'off',... 'Color', [0.92 0.92 0.85],... 'MenuBar', 'none',... 'Position', [x y W H],... 'Resize', 'off'); %% DU LIEU CHUNG FigColor=[0.92 0.92 0.85]; FrameColor = [0.847 0.161 0]; strUnits = 'pixels';

%Giao dien chung cho cac TEXT %Dung chung cho tat ca modun

Xtext.Style = 'text'; Xtext.FontName = 'VNI-Times'; Xtext.FontSize = 20; Xtext.BackgroundColor = FigColor; Xtext.ForegroundColor = [1 0 0]; Xtext.HorizontalAlignment = 'CENTER';

%Giao dien chung cho cac EDIT %Dung chung cho tat ca cac modun

Xedit.Style = 'edit';

Xedit.FontName= 'VNI-Times'; Xedit.FontSize = 9;

Xedit.BackgroundColor = [1 1 1]; %mau trang

Xedit.HorizontalAlignment = 'right';

%Giao dien chung cho cac POP %Dung chung cho tat ca cac modun

Xpop.Style = 'popupmenu'; Xpop.FontName = 'VNI-Times'; Xpop.FontSize = 9;

Xpop.BackgroundColor= [1 0 1];

%Giao dien chung cho cac FRAME %Dung chung cho tat ca modun

Xframe.Units = strUnits;

Xframe.FontName = 'VNI-Times'; Xframe.FontSize = 9;

Xframe.FontWeight = 'normal'; Xframe.BackgroundColor = FigColor;

Xframe.ForegroundColor = FrameColor;% mau do tham

%Dung chung cho tat ca modun %Nut ban chuc nang CHINH

Xbutton.Style = 'pushbutton'; Xbutton.FontName = 'VNI-Times'; Xbutton.FontSize = 11; Xbutton.FontWeight = 'normal'; Xbutton.ForegroundColor = [1 0 0]; Xbutton.HorizontalAlignment = 'right';

%% CAC MODUN TINH TOAN

H1 = 250; W1 = 600;

frame_Nut = uipanel(Xframe, 'Units','pixels', 'Position',[25 25 W1 H1]); button_TinhKhung = uicontrol(Xbutton, 'Parent',frame_Nut,

'Position',[100 H1-60 400 50], 'String','TÍNH THÉP KHUNG','callback','c_TinhKhung');

button_TinhVaKiemTraCot2D = uicontrol(Xbutton, 'Parent',frame_Nut ,

'Position',[100 H1-120 400 50], 'String','THIẾT KẾ CỘT 2D');

button_TinhVaKiemTraCot3D = uicontrol(Xbutton, 'Parent',frame_Nut ,

'Position',[100 H1-180 400 50], 'String','THIẾT KẾ CỘT 3D' );

button_TinhVaKiemTraDam = uicontrol(Xbutton, 'Parent',frame_Nut ,

'Position',[100 H1-240 400 50], 'String','THIẾT KẾ DẦM','callback','c_TinhDam'

);

%% TIEU DE

H2 = 200; W2 = 600;

frame_Ten = uipanel(Xframe, 'Units','pixels', 'Position',[25 300 W2 H2]); text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-65 550 50 ],

'String','NGHIÊN CỨU KHOA HỌC GIÁO VIÊN');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-125 550 50 ],

'String','CHƯƠNG TRÌNH TÍNH TOÁN');

text = uicontrol(Xtext,'Parent',frame_Ten, 'Position',[25 H2-185 550 50 ],

'String','BTCT-KTCT');

Một phần của tài liệu Đề tài xây DỰNG PHẦN mềm TÍNH TOÁN CỐT THÉP BẰNG MATLAB (Trang 42 - 54)

Tải bản đầy đủ (PDF)

(65 trang)