Anda di halaman 1dari 5

G_STIFFNESS();

GDL();
DISPLACEMENT();
REACTIONS();
FORCES();
EXPORT ARMADURAS()

BEGIN
LOCAL n,m, k;
LOCAL joints, poles, loads, g_stiffness, r_stiffness, r_stiffness2;
LOCAL n_joints, n_loads, gdl, reac, r_forces, n_dis;
LOCAL n_gdl, n_reac, gdl1, gdl2, desp, r_disp, n_poles;
LOCAL name_joints:={}, name_poles:={}, name_loads:={}, l_loads;
LOCAL name_reac:={};
LOCAL name_forces:={};
LOCAL cosx, sinx;
FOR k FROM 1 TO 50 DO
name_joints(k):="J-"+k;
name_poles(k):="P-"+k;
name_loads(k):="L-"+k;
END;
joints:=MAKEMAT(0,1,3);
poles:=MAKEMAT(0,1,5);
loads:=MAKEMAT(0,1,3);
WHILE true DO
CHOOSE(n, " ARMADURAS 2D ", { "->JOINTS", "->POLES","-> LOADS", "->
CALCULATE","->EXAMPLE" ,"<-END"});
CASE
IF n==1 THEN
MSGBOX("REMEMBER: \n TYPE \n (0)->FIXED \n (1)->MOBILE \n (2)->SIMPLE");
EDITMAT(joints,{"JOINTS",name_joints,{"COOR-X", "COOR-Y", "TYPE"," "}});
END;
IF n==2 THEN
EDITMAT(poles,{"POLES",name_poles,{"Ni", "Nf", "b","h","E"," "}});
END;
IF n==3 THEN
EDITMAT(loads,{"LOADS",name_loads,{"N_J", "?(-) ?(+)","?(-) ?(+)","
"}});
END;
IF n==4 THEN
IFERR
n_joints:=SIZE(joints);
n_poles:=SIZE(poles);
gdl:=GDL(joints);
gdl2:=gdl(2);
n_dis:=SIZE(gdl2);
r_disp:=MAKEMAT(0,2*n_joints(1),1);
n_gdl:=SIZE(gdl(1));
desp:=DISPLACEMENT(joints, poles, loads);
WHILE true DO
CHOOSE(m,"RESULTS",{"[K]->GLOBAL STIFFNESS","[F]->FORCES","[D]-
>DISPLACEMENTS","[R]->REACTIONS","<-BACK"});
CASE
IF m==1 THEN
r_stiffness:=G_STIFFNESS(joints,poles);
EDITMAT(r_stiffness,"STIFFNESS",1);
END;
IF m==2 THEN
r_forces:=FORCES(joints,poles,loads);
name_forces:=MAKELIST("P-"+X,X,1,n_poles(1));
name_forces(n_poles(1)+1):=" ";
EDITMAT(r_forces,{"FORCES",name_forces,{"F"," "}},1);

END;
IF m==3 THEN

FOR k FROM 1 TO n_dis DO


r_disp(gdl2(k),1):=ROUND(desp(k,1),6);
END;
EDITMAT(r_disp,"DISPLACEMENTS",1);
END;
IF m==4 THEN
reac:=REACTIONS(joints, poles, loads);
name_reac:=MAKELIST("R-"+X,X,1,n_gdl);
name_reac(n_gdl+1):=" ";
EDITMAT(reac,{"REACTIONS",name_reac,{"1"}});
END;
IF m==5 THEN
BREAK;

END;
END;
END;
THEN
MSGBOX("Enter the data correctly");
END;
END;
IF n==5 THEN
joints:=[[0,3,2],[3,3,2],[5,3,2],[3,0,1],[0,0,0]];
poles:=[[5,4,0.3,0.4,2100000],[4,3,0.3,0.4,2100000],[2,3,0.3,0.4,2100000],
[1,2,0.3,0.4,2100000],[5,1,0.3,0.4,2100000],[1,4,0.4,0.4,2100000],
[5,2,0.4,0.4,2100000],[4,2,0.4,0.4,2100000]];
loads:=[[3,5,-6]];
MSGBOX("Example successfully loaded!");
END;
IF n==6 THEN
BREAK;
END;
END;
END;
END;

EXPORT G_STIFFNESS(joints, poles)


BEGIN
// V. ITERABLES
LOCAL i,k,j;
// V. PRINCIPALES
LOCAL g_stiff; // RESULTADO
LOCAL stiff, ael, cosx, sinx, cons;
LOCAL n_joints:=SIZE(joints);
LOCAL n_poles:=SIZE(poles);
LOCAL e_mod:={}, area_b:={}, long:={};
// PROCESO
FOR i FROM 1 TO n_poles(1) DO
e_mod(i):=poles(i,5);
END;
CASE
IF mean(e_mod)>100000 THEN
cons:= 100000;
END;
IF mean(e_mod)>10000 THEN
cons:= 10000;
END;
IF mean(e_mod)<10000 THEN
cons:= 1;
END;
END;

// areas y longitudes
FOR i FROM 1 TO n_poles(1) DO
area_b(i):=poles(i,3)*poles(i,4);
long(i):= SQRT((joints(poles(i,1),1)-joints(poles(i,2),1))^2+
(joints(poles(i,1),2)-joints(poles(i,2),2))^2);
END;
ael:=area_b*e_mod/(long*cons);

// MATRIZ RIGIDEZ GLOBAL

FOR i FROM 1 TO n_poles(1) DO


stiff:=MAKEMAT(0,2*n_joints(1),2*n_joints(1));
cosx:=(joints(poles(i,2),1)-joints(poles(i,1),1))/long(i);
sinx:=(joints(poles(i,2),2)-joints(poles(i,1),2))/long(i);

stiff(2*poles(i,1)-1,2*poles(i,1)-1):=ael(i)*cosx*cosx;
stiff(2*poles(i,1),2*poles(i,1)-1):=ael(i)*cosx*sinx;
stiff(2*poles(i,1)-1,2*poles(i,1)):=ael(i)*cosx*sinx;
stiff(2*poles(i,1),2*poles(i,1)):=ael(i)*sinx*sinx;

stiff(2*poles(i,2)-1,2*poles(i,1)-1):=-ael(i)*cosx*cosx;
stiff(2*poles(i,2),2*poles(i,1)-1):=-ael(i)*cosx*sinx;
stiff(2*poles(i,2)-1,2*poles(i,1)):=-ael(i)*cosx*sinx;
stiff(2*poles(i,2),2*poles(i,1)):=-ael(i)*sinx*sinx;

stiff(2*poles(i,1)-1,2*poles(i,2)-1):=-ael(i)*cosx*cosx;
stiff(2*poles(i,1),2*poles(i,2)-1):=-ael(i)*cosx*sinx;
stiff(2*poles(i,1)-1,2*poles(i,2)):=-ael(i)*cosx*sinx;
stiff(2*poles(i,1),2*poles(i,2)):=-ael(i)*sinx*sinx;

stiff(2*poles(i,2)-1,2*poles(i,2)-1):=ael(i)*cosx*cosx;
stiff(2*poles(i,2),2*poles(i,2)-1):=ael(i)*cosx*sinx;
stiff(2*poles(i,2)-1,2*poles(i,2)):=ael(i)*cosx*sinx;
stiff(2*poles(i,2),2*poles(i,2)):=ael(i)*sinx*sinx;

g_stiff:=g_stiff+cons*(stiff);
END;

END;
EXPORT GDL(joints)
BEGIN
LOCAL i,j:=1,k:=1, gdlr:={}, reac:={};
LOCAL n_joints:=SIZE(joints);
FOR i FROM 1 TO n_joints(1) DO
CASE
IF joints(i,3)==2 THEN
reac(k):=2*i-1;
k:=k+1;
reac(k):=2*i;
k:=k+1;
END;
IF joints(i,3)==1 THEN
reac(k):=i*2-1;
k:=k+1;
gdlr(j):=i*2;
j:=j+1;
END;
IF joints(i,3)==0 THEN
gdlr(j):=i*2-1;
j:=j+1;
gdlr(j):=i*2;
j:=j+1;
END
END;
END;
RETURN {gdlr,reac};
END;
EXPORT DISPLACEMENT(joints, poles, loads)
BEGIN
LOCAL n_joints, n_loads, g_stiffness, l_loads, n_poles;
LOCAL k,gdl,gdl1,gdl2,n_gdl,n_dis;
LOCAL desp;
n_joints:=SIZE(joints);
n_loads:=SIZE(loads);
n_poles:=SIZE(poles);
g_stiffness:=G_STIFFNESS(joints, poles);
l_loads:=MAKEMAT(0,2*n_joints(1),1);
FOR k FROM 1 TO n_loads(1) DO
l_loads(2*loads(k,1)-1,1):=loads(k,2);
l_loads(2*loads(k,1),1):=loads(k,3);
END;
gdl:=GDL(joints);
gdl1:=REVERSE(gdl(1));
gdl2:=REVERSE(gdl(2));
n_gdl:=SIZE(gdl1);
n_dis:=SIZE(gdl2);
FOR k FROM 1 TO n_gdl DO
DELROW(g_stiffness,gdl1(k));
delcol(g_stiffness,gdl1(k));
delrow(l_loads,gdl1(k));
END;
desp:=inv(g_stiffness)*l_loads;
RETURN desp;
END;

EXPORT REACTIONS(joints, poles, loads)


BEGIN
LOCAL r_stiffness2, n_gdl, gdl, gdl1;
LOCAL n_dis,gdl2, desp, k, reac;
gdl:=GDL(joints);
gdl1:=REVERSE(gdl(1));
gdl2:=REVERSE(gdl(2));
n_gdl:=SIZE(gdl1);
n_dis:=SIZE(gdl2);
r_stiffness2:=G_STIFFNESS(joints,poles);
desp:=DISPLACEMENT(joints,poles,loads);
FOR k FROM 1 TO n_dis DO
DELROW(r_stiffness2,gdl2(k));
END;
FOR k FROM 1 TO n_gdl DO
delcol(r_stiffness2,gdl1(k));
END;
reac:=r_stiffness2*desp;
RETURN reac;
END;

EXPORT FORCES(joints, poles, loads)


BEGIN
LOCAL desp;
LOCAL ael, cosx, sinx, cons;
LOCAL n_joints:=SIZE(joints);
LOCAL n_poles:=SIZE(poles);
LOCAL e_mod:={}, area_b:={}, long:={};
LOCAL m_cos, r_disp, i, k, gdl, gdl2, n_dis;
// PROCESO
// areas y longitudes
r_disp:=MAKEMAT(0,2*n_joints(1),1);
gdl:=GDL(joints);
gdl2:=gdl(2);
n_dis:=SIZE(gdl2);
FOR i FROM 1 TO n_poles(1) DO
e_mod(i):=poles(i,5);
area_b(i):=poles(i,3)*poles(i,4);
long(i):= SQRT((joints(poles(i,1),1)-joints(poles(i,2),1))^2+
(joints(poles(i,1),2)-joints(poles(i,2),2))^2);
END;
ael:=area_b*e_mod/long;
desp:=DISPLACEMENT(joints,poles,loads);
m_cos:=MAKEMAT(0,n_poles(1),2*n_joints(1));
FOR k FROM 1 TO n_dis DO
r_disp(gdl2(k),1):=desp(k,1);
END;
FOR i FROM 1 TO n_poles(1) DO
cosx:=(joints(poles(i,2),1)-joints(poles(i,1),1))/long(i);
sinx:=(joints(poles(i,2),2)-joints(poles(i,1),2))/long(i);
m_cos(i,2*poles(i,2)-1):=cosx*ael(i);
m_cos(i,2*poles(i,2)):=sinx*ael(i);
m_cos(i,2*poles(i,1)-1):=-cosx*ael(i);
m_cos(i,2*poles(i,1)):=-sinx*ael(i);
END;
RETURN m_cos*r_disp;
END;

Anda mungkin juga menyukai