Page 5 - Demo
P. 5


                                    Planar Truss Example for Comrel Add-on RCP Consult, 2022-2025 Page 5 plot(XY(:,1), XY(:,2), 'k+'); // plot internal member force N for e = 1:nfe l=leng(e)/2 ; n=abs(N(e))*0.0000005; X=[-l l l -l]; Y=[-n -n n n]; c = cos(theta(e)); s = sin(theta(e)); Xrot = X*c - Y*s; Yrot = X*s + Y*c; x=(XY(IEN(e,1),1)+XY(IEN(e,2),1))/2; y=(XY(IEN(e,1),2)+XY(IEN(e,2),2))/2; if(N(e) >= 0) co=color(255, 155, 127); else co=color(127, 155, 255); end xfpoly(Xrot + x, Yrot + y, co); str=sprintf('$%0.1f\\\\,N
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

, N(e)); rect=stringbox(str, x, y); xstring(x-(rect(1,3)-rect(1,1))/2, y-(rect(2,2)-rect(2,1))/2, str); gce().font_size=2; end case 3 // plot for internal member tensile stress sigma_u scf(nf); figure(nf,'Name',tit,'position',[pxl(3)/4 pxl(4)/4 pxl(3)/2 pxl(4)/2]); // plot frame replot([-2 -2 26 10]); mtlb_axis('equal'); xgrid(2); // set a main subtitle of plot xstring(5.5,8.0,'$Internal\\,member\\,von\\,Mises\\,stress\\,\\sigma_v\\,[MPa]
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

); gce().font_size=6; plot(XY(:,1), XY(:,2), 'k+'); // plot for internal member von Mises stress minA=min(abs([N]'./Area*1e-6)); maxA=max(abs([N]'./Area*1e-6)); ddA=maxA-minA; dA=ddA/20; // Color bar cmap=jetcolormap(21); // prepare color mapping gcf().color_map=cmap; colorbar(minA,maxA); for e = 1:nfe Su=abs(N(e)/Area(e)*1e-6); l=leng(e)/2 ; n=Su/ddA*0.2; // height of rectangle X=[-l l l -l]; Y=[-n -n n n]; c = cos(theta(e)); s = sin(theta(e)); Xrot = X*c - Y*s; Yrot = X*s + Y*c; x=(XY(IEN(e,1),1)+XY(IEN(e,2),1))/2; y=(XY(IEN(e,1),2)+XY(IEN(e,2),2))/2; nc=int32((Su-minA)/dA-0.01)+1; co=color(int(cmap(nc,1)*255),int(cmap(nc,2)*255),int(cmap(nc,3)*255)); // color xfpoly(Xrot + x, Yrot + y, co); str=sprintf('$%0.0f
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

, Su); rect=stringbox(str, x, y); xstring(x-(rect(1,3)-rect(1,1))/2, y-(rect(2,2)-rect(2,1))/2, str); gce().font_size=2; end end // do rest for all plots xtitle(tit); gce().title.font_size=6; // plot values of input data xstring(22, 6.5, sprintf('$A1=%g\\\\,m^2
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

,A1)); gce().font_size=3; xstring(22, 6.1, sprintf('$A2=%g\\\\,m^2
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

,A2)); gce().font_size=3; xstring(22, 5.7, sprintf('$E1=%g\\\\,N/m^2
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

,E1)); gce().font_size=3; xstring(22, 5.3, sprintf('$E2=%g\\\\,N/m^2
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

,E2)); gce().font_size=3; // plot a main title of plot xstring(-1.0, 6.5, sprintf('%s %s %s', StrurelName, StrurelModule, StrurelVersion)); gce().font_size=5; select StrurelMode case int32(0) xstring(-1.0, 6.0, 'State at Mean Values'); gce().font_size=4; case int32(2) xstring(-1.0, 6.0, sprintf('%s, %s', StrurelIMET, StrurelIOPT)); gce().font_size=4; xstring(-1.0, 5.5, sprintf('$beta=%g,\\\\,Pf=%g
   1   2   3   4   5   6   7   8   9   10

 

 

 

 

 

, StrurelBeta, StrurelPf)); gce().font_size=3; // calculated beta and Pf end xstring(-1.9, -1.8, StrurelEngine); gce().font_size=2; gce().alignment='center' // invoked version of engine end endend // begin of plot blockendfunction // end of function
   1   2   3   4   5   6   7   8   9   10