%subroutine constraint equations %file name = port_wood_con.m %optimization of redundant wood planar portal frame %Prof. Reyolando Brasil - May 2021 function [g,h]=port_wood_con(x,h,L,b,P) % %design variables x1=x(1);%column section d dimension, m x2=x(2);%beam section d dimension, m Ac=b*x1;%column section area, m² Av=b*x2;%beam section area, m² Wc=b*x1^2/6;%column section flexural modulus, m³ Wv=b*x2^2/6;%beam section flexural modulus, m³ Ic=b*x1^3/12;%column section moment of inertia, m^4 Iv=b*x2^3/12;%beam section moment of inertia, m^4 %wood parameters E=15e6;%efective Young's Modulus, KN/m² fcd=20e3;%design resistance, KN/m² %axial forces and bending moments X=(P*L^2*h/8/Iv)/(2*h^3/3/Ic+L*h^2/Iv); Nc=P/2;%KN Mc=X*h;%KNm % FE=pi^2*E*Ic/h^2;%Euler's buckling load e=(Mc/Nc+h/300)*(FE/(FE-Nc)); Mc=Nc*e; % Nv=X;%KN; Mv=P*L/4-X*h;%KNm % FE=pi^2*E*Iv/L^2;%Euler's buckling load e=(Mv/Nv+L/300)*(FE/(FE-Nv)); Mv=Nv*e; % %inequlitiy constraints g(1)=(Nc/Ac+Mc/Wc)/fcd-1; g(2)=(Nv/Av+Mv/Wv)/fcd-1; %equality constraints (none) h=[];