xsdcaifu 发表于 2006-12-6 21:50

转-网架设计程序APDL

网架设计程序APDL

!昨天设计一个平板网架,正放四角锥,一时之间找不到软件,所以只好用ANSYS的A
!DPL写了一个程序
!    功能:
!    1.方便的进行正方四角锥网架的建模
!    2.可以自动选杆件截面
!    计算中假设杆件均为铰接,压杆采用钢结构设计规范GBJ17-88的a曲线验算
!    注:本文纯属个人资料,如采用本文进行网架设计出现问题,概不负责
/prep7
!-------------------------------------------
!定义截面类型(共6种钢管)
*dim,DOUT,,6 !外径
*dim,DIN,,6 !内径
DOUT(1)=45 !管45X4
DIN(1)=37
DOUT(2)=63 !管63X4
DIN(2)=55
DOUT(3)=89 !管89X5
DIN(3)=79
DOUT(4)=113 !管113X6
DIN(4)=101
DOUT(5)=140 !管140X6
DIN(5)=128
DOUT(6)=159 !管159X8
DIN(6)=143
*dim,AREA,,6 !截面积
*dim,RI,,6 !回转半径
*do,i,1,6
AREA(i)=3.1415926*(DOUT(i)*DOUT(i)-DIN(i)*DIN(i))/4
RI(i)=0.25*sqrt((DOUT(i)*DOUT(i) DIN(i)*DIN(i)))
*enddo
!------------------------------------------
!结构基本参数输入
DX=2000 !横向网格尺寸
DY=2000 !纵向网格尺寸
DZ=2000 !网架截面高度
NX=30 !横向网格数量
NY=28 !纵向网格数量
DLOAD=1.06e-3 !屋面均布荷载设计值
FD=215 !钢材强度设计值
FY=235 ! 植 屈服强度
RATIO1=0.85 !应力比上限
RATIO2=0.7 !应力比下限
EE=2.06e5 !弹性模量
NEALL=8*NX*NY !单元总数
!------------------------------------------
!定义实常数
*do,i,1,6
r,i,AREA(i)
*enddo
!------------------------------------------
!定义单元类型-杆单元
ET,1,LINK8
!-----------------------------------------------------
!定义材料特性
MP, EX, 1, EE !钢材
MP, NUXY, 1, 0.3
MP, DENS, 1, 7.85e-6
!------------------------------------------
!节点定义
!上弦节点
*do,i,1,NY 1
*do,j,1,NX 1
k=(i-1)*(NX 1) j
n,k,(j-1)*DX,(i-1)*DY
*enddo
*enddo
NNUP=k !记录上弦节点总数
!下弦节点
*do,i,1,NY
*do,j,1,NX
k=(i-1)*NX j NNUP
n,k,(j-1)*DX DX/2,(i-1)*DY DY/2,-DZ
*enddo
*enddo
NNALL=k !记录节点总数
NNBOT=NNALL-NNUP !记录下弦节点总数
!------------------------------------------
!单元定义,最初定义为1号截面
!横向上弦杆件
NEUP1=0 !记录横向上弦杆件总数
*do,i,1,NY 1
*do,j,1,NX
k=(i-1)*(NX 1) j
e,k,k 1
NEUP1=NEUP1 1
*enddo
*enddo
!纵向上弦杆件
NEUP2=0 !记录纵向上弦杆件总数
*do,i,1,NY
*do,j,1,NX 1
k=(i-1)*(NX 1) j
e,k,k NX 1
NEUP2=NEUP2 1
*enddo
*enddo
!横向下弦杆件
NEBOT1=0 !记录横向下弦杆件总数
*do,i,1,NY
*do,j,1,NX-1
k=(i-1)*NX j NNUP
e,k,k 1
NEBOT1=NEBOT1 1
*enddo
*enddo
!纵向下弦杆件
NEBOT2=0 !记录纵向下弦杆件总数
*do,i,1,NY-1
*do,j,1,NX
k=(i-1)*NX j NNUP
e,k,k NX
NEBOT2=NEBOT2 1
*enddo
*enddo
!斜腹杆
NEMID=0 !记录纵向下弦杆件总数
*do,i,1,NY
*do,j,1,NX
k1=(i-1)*NX j NNUP
k2=k1-NNUP (i-1)
e,k1,k2
e,k1,k2 1
e,k1,k2 NX 1
e,k1,k2 NX 2
NEMID=NEMID 4
*enddo
*enddo
!------------------------------------------
!施加节点约束
!这一步宜在GUI界面中进行,然后将边界条件写入文件load1.txt
/input,load1,txt
!------------------------------------------
!施加节点约束
!这一步宜在GUI界面中进行,然后将边界条件写入文件boundary.txt
/input,boundary,txt
!------------------------------------------
!求解
/solu
solve
!------------------------------------------
!下面开始优化截面
!首先定义数组,得到一些常量
*dim,FORCE,,NEALL !定义杆件内力数组
*dim,LENGTH,,NEALL !定义杆件长度数组
*do,i,1,NEALL !得出杆件长度
*get,LENGTH(i),elem,i,leng
*enddo
!------------------------------------------
*dim,NSECTION,,NEALL !定义杆件截面号数组
*do,i,1,NEALL !初始值为1
NSECTION(i)=1
*enddo
!
!******************************************************
!开始循环调整杆件截面
*do,NNN,1,15 !共调整15次
!------------------------------------------
!得出杆件内力(拉正压负)
/post1
*do,i,1,NEALL
*get,force(i),elem,i,smisc,1
*enddo
!------------------------------------------
!截面校核,得出应力比
*do,i,1,NEALL
k=NSECTION(i)
temp=3.1415926/sqrt(FY/EE)
*if,FORCE(i),ge,0,then !拉杆
RATIO=FORCE(i)/AREA(k)/FD !拉杆应力比
*elseif,FORCE(i),lt,0,then !压杆,a类截面
SLENDER=LENGTH(i)/RI(k) !长细比
d1=SLENDER/temp !相对长细比
*if,d1,le,0.215,then !稳定系数
    FI=1-0.41*d1*d1
*else
    d2=0.986 0.152*d1 d1*d1
    FI=(d2-sqrt(d2*d2-4*d1*d1))/2/d1/d1
*endif
RATIO=-FORCE(i)/AREA(k)/FD/FI !压杆应力比
*endif
!------------------------------------------
!截面调整
*if,RATIO,LT,RATIO2,then
NSECTION(i)=NSECTION(i)-1
*elseif,RATIO,GT,RATIO1,then
NSECTION(i)=NSECTION(i) 1
*endif
*if,NSECTION(i),lt,1,then !已经选到最小截面
NSECTION(i)=1
*endif
*if,NSECTION(i),gt,6,then !已经选到最大截面
NSECTION(i)=6
*endif
*enddo
!------------------------------------------
!重新定义单元
finish
/prep7
edele,all !删除所有单元
NUMCMP,ELEM !压缩单元号
kkk=0
!横向上弦杆件
*do,i,1,NY 1
*do,j,1,NX
k=(i-1)*(NX 1) j
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k,k 1
*enddo
*enddo
!纵向上弦杆件
*do,i,1,NY
*do,j,1,NX 1
k=(i-1)*(NX 1) j
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k,k NX 1
*enddo
*enddo
!横向下弦杆件
*do,i,1,NY
*do,j,1,NX-1
k=(i-1)*NX j NNUP
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k,k 1
*enddo
*enddo
!纵向下弦杆件
*do,i,1,NY-1
*do,j,1,NX
k=(i-1)*NX j NNUP
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k,k NX
*enddo
*enddo
!斜腹杆
*do,i,1,NY
*do,j,1,NX
k1=(i-1)*NX j NNUP
k2=k1-NNUP (i-1)
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k1,k2
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k1,k2 1
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k1,k2 NX 1
kkk=kkk 1
kkk1=NSECTION(kkk)
REAL,kkk1
e,k1,k2 NX 2
*enddo
*enddo
!------------------------------------------
!求解
finish
/solu
solve
*enddo
!************************************************
!------------------------------------------
/post1
PLESOL,SMISC,1,0,1 !画出轴力图
!------------------------------------------
!得出杆件内力(拉正压负)
*do,i,1,NEALL
*get,force(i),elem,i,smisc,1
*enddo
!------------------------------------------
!最后截面校核,得出应力比,并打印应力比
/OUT,STRESSRATIO,txt
TOTALMASS=0 !总质量
*do,i,1,NEALL
k=NSECTION(i)
temp=3.1415926/sqrt(FY/EE)
*if,FORCE(i),ge,0,then !拉杆
RATIO=FORCE(i)/AREA(k)/FD !拉杆应力比
*elseif,FORCE(i),lt,0,then !压杆,a类截面
SLENDER=LENGTH(i)/RI(k) !长细比
d1=SLENDER/temp !相对长细比
*if,d1,le,0.215,then !稳定系数
    FI=1-0.41*d1*d1
*else
    d2=0.986 0.152*d1 d1*d1
    FI=(d2-sqrt(d2*d2-4*d1*d1))/2/d1/d1
*endif
RATIO=FORCE(i)/AREA(k)/FD/FI !压杆应力比
*endif
TOTALMASS=TOTALMASS AREA(k)*LENGTH(i)*7.85e-6
*VWRITE,i,k,DOUT(k),(DOUT(k)-DIN(k))/2,RATIO,
(1X,F8.1,F8.1,' ',F5.1,'X',F5.1,' ',F10.4)
*enddo
*enddo
*VWRITE,TOTALMASS
(1X,' ,'F20.4)
*LIST,STRESSRATIO,txt   

!下面是boundary.txt文件
!这个文件用来社定边界条件,这个可根据情况而变化
D, 1 , UZ
D, 4 , UZ
D, 7 , UZ
D, 10 , UZ
D, 13 , UZ
D, 16 , UZ
D, 19 , UZ
D, 22 , UZ
D, 25 , UZ
D, 28 , UZ
D, 31 , UZ
D, 125 , UZ
D, 140 , UZ
D, 155 , UZ
D, 249 , UZ
D, 264 , UZ
D, 279 , UZ
D, 373 , UZ
D, 388 , UZ
D, 403 , UZ
D, 497 , UZ
D, 512 , UZ
D, 527 , UZ
D, 621 , UZ
D, 636 , UZ
D, 651 , UZ
D, 745 , UZ
D, 760 , UZ
D, 775 , UZ
D, 869 , UZ
D, 872 , UZ
D, 875 , UZ
D, 878 , UZ
D, 881 , UZ
D, 884 , UZ
D, 887 , UZ
D, 890 , UZ
D, 893 , UZ
D, 896 , UZ
D, 899 , UZ
D, 1 , UX
D, 1 , UY
D, 899 , UX
D, 899 , UY
D, 31 , UX
D, 31 , UY
D, 869 , UX
D, 869 , UY
!在下面是load1.txt文件,这个文件用来施加何在,如果只有屋面均布何在,前面几行就
!可以了,我这个网架还有下弦吊载,所以比较长
!------------------------------------------------------
!施加上弦节点荷载
*do,i,1,NNUP
f,i,fz,-DLOAD*DX*DY
*enddo
!------------------------------------------------------
!输入自重
ACEL,0,0,11.9952, !9.8*1.02*1.2设计值
!------------------------------------------------------
!风管下弦吊载
F, 931 , FZ, -3600
F, 939 , FZ, -3600
F, 950 , FZ, -3600
F, 958 , FZ, -3600
F, 961 , FZ, -3600
F, 969 , FZ, -3600
F, 980 , FZ, -3600
F, 988 , FZ, -3600
F, 991 , FZ, -3600
F, 999 , FZ, -3600
F, 1010 , FZ, -3600
F, 1018 , FZ, -3600
F, 1021 , FZ, -3600
F, 1029 , FZ, -3600
F, 1040 , FZ, -3600
F, 1048 , FZ, -3600
F, 1051 , FZ, -3600
F, 1059 , FZ, -3600
F, 1070 , FZ, -3600
F, 1078 , FZ, -3600
F, 1081 , FZ, -3600
F, 1089 , FZ, -3600
F, 1100 , FZ, -3600
F, 1108 , FZ, -3600
F, 1111 , FZ, -3600
F, 1119 , FZ, -3600
F, 1130 , FZ, -3600
F, 1138 , FZ, -3600
F, 1141 , FZ, -3600
F, 1149 , FZ, -3600
F, 1160 , FZ, -3600
F, 1168 , FZ, -3600
F, 1171 , FZ, -3600
F, 1179 , FZ, -3600
F, 1190 , FZ, -3600
F, 1198 , FZ, -3600
F, 1201 , FZ, -3600
F, 1209 , FZ, -3600
F, 1220 , FZ, -3600
F, 1228 , FZ, -3600
F, 1231 , FZ, -3600
F, 1239 , FZ, -3600
F, 1250 , FZ, -3600
F, 1258 , FZ, -3600
F, 1261 , FZ, -3600
F, 1269 , FZ, -3600
F, 1280 , FZ, -3600
F, 1288 , FZ, -3600
F, 1291 , FZ, -3600
F, 1299 , FZ, -3600
F, 1310 , FZ, -3600
F, 1318 , FZ, -3600
F, 1321 , FZ, -3600
F, 1329 , FZ, -3600
F, 1340 , FZ, -3600
F, 1348 , FZ, -3600
F, 1351 , FZ, -3600
F, 1359 , FZ, -3600
F, 1370 , FZ, -3600
F, 1378 , FZ, -3600
F, 1381 , FZ, -3600
F, 1389 , FZ, -3600
F, 1400 , FZ, -3600
F, 1408 , FZ, -3600
!------------------------------------------------------
!电动葫芦吊车下弦荷载
F, 927, FZ, -48000
F, 1047, FZ, -48000
F, 1167, FZ, -48000
F, 1317, FZ, -48000
F, 1437, FZ, -48000
!------------------------------------------------------
!桥式吊车下弦荷载
F, 902, -21840 !最小轮压(靠边)
F, 1022, -21840
F, 1142, -21840
F, 1262, -21840
F, 1382, -21840
F, 910, -89600 !最大轮压(居中)
F, 1030, -89600
F, 1150, -89600
F, 1270, -89600
F, 1390, -89600
页: [1]
查看完整版本: 转-网架设计程序APDL