Логическая схема решения, Текст программы - Четырехмассовая динамическая модель трансмиссии автомобиля

Рисунок 9.1 - Логическая схема процедуры Runge

Рисунок 9.2 - Логическая схема для вычисления кинематических и силовых характеристик четырехмассовой динамической модели трансмиссии

Текст программы

Program kursovoi;

Uses crt, dos, graph;

Type mas=array[1..10] of real;

Var

Rez, rezz, rezb:text;

W:string[10];

D, y,y1,k, yy, max1,max2,l:mas;

U1,u2,u3,u4,mm1,mm2,mm3,mmc, mmd: array[1..1000] of real;

Hp, tp, h,t, a1,a2,a21,g12,g13,g23,a3,a31,k1,k2,y4,y5,k3,w1,z, tmax, xmax,

Xst, kx, ky, nmax, M1,M2,M3,M4,ymax, Md, Md0,y3,Mc, kd, kc, Mc0,Mf, Mff, q,nd, wm, ymin,

J1,j2,j3,j4,j5,c4,b4,c1,c2,c3,b1,b2,b3:real;

N, npix, i,j, p,r:integer;

GrDriver: Integer;

GrMode: Integer;

ErrCode: Integer;

Procedure Setka(kx, ky:real; r1,r2:string; kk:integer);

Var

Npix, i,c, d: integer;

Nd:real;

W: string[10];

Begin

if kx<3 then begin

c:=3;

d:=2;

end

else begin

c:=2;

d:=2;

end;

for i:=1 to 15 do begin

npix:=50;

setcolor(7);

line(round(30+(i-1)*npix),10,round(30+(i-1)*npix),460);

If i=13 then begin

Setcolor(4);

Outtextxy(i*npix+100,470, r1);

I:=i+1;

Setcolor(7);

Line(round(30+(i-1)*npix),10,round(30+(i-1)*npix),460);

End;

Nd:=(i*npix/kx);

Str(nd:c:d, w);

Setcolor(1);

Outtextxy(i*npix+8,470, w);

End;

If ky<2.5 then begin

C:=3;

D:=0;

End

Else begin

C:=2;

D:=1;

End;

If kk=1 then begin

Outtextxy(10,360, '0');

For i:=1 to 16 do begin

Npix:=50;

Setcolor(7);

Line(30,360-trunc((i-1)*npix),630,360-trunc((i-1)*npix));

If i=8 then begin

Setcolor(4);

Outtextxy(3,360-i*npix, r2);

I:=i+1;

Setcolor(7);

Line(30,360-trunc((i-1)*npix),630,360-trunc((i-1)*npix));

End;

Nd:=i*npix/ky;

Str(nd:c:d, w);

Setcolor(1);

Outtextxy(0,360-i*npix, w)

End;

For i:=1 to 4 do begin

Setcolor(7);

Line(30,460-trunc((i-1)*npix),630,460-trunc((i-1)*npix));

Nd:=-i*npix/ky;

Str(nd:c:d, w);

Setcolor(1);

Outtextxy(0,360+i*npix, w);

End;

End

Else begin

For i:=1 to 16 do begin

Npix:=50;

Setcolor(7);

Line(30,460-trunc((i-1)*npix),630,460-trunc((i-1)*npix));

If i=6 then begin

Setcolor(4);

Outtextxy(3,360-i*npix, r2);

I:=i+1;

Setcolor(7);

Line(30,460-trunc((i-1)*npix),630,460-trunc((i-1)*npix));

End;

Nd:=i*npix/ky;

Str(nd:c:d, w);

Setcolor(1);

Outtextxy(0,260-i*npix, w);

End;

For i:=1 to 4 do begin

Setcolor(7);

Line(30,460-trunc((i-1)*npix),630,460-trunc((i-1)*npix));

Nd:=-i*npix/ky;

Str(nd:c:d, w);

Setcolor(1);

Outtextxy(0,260+i*npix, w);

Outtextxy(10,260, '0');

End;

End;

End;

Procedure Prav(y:mas);

Begin

M1:=c1*(y[2]-y[4])+b1*(y[1]-y[3]);

M2:=c2*(y[4]-y[6])+b2*(y[3]-y[5]);

M3:=c3*(y[4]-y[8])+b3*(y[3]-y[7]);;

D[1]:=(-M1+Md)/j1;

D[2]:=y[1];

D[3]:=(M1-M2-M3)/j2;

D[4]:=y[3];

D[5]:=(M2)/j3;

D[6]:=y[5];

D[7]:=(M3-Mff)/j4;

D[8]:=y[7];

End;

Function sign(y1:real):real;

Begin

Y1:=y[2]-y[4];

If y1<0 then sign:=-1

Else sign:=1;

End;

Function signn(y2:real):real;

Begin

Y2:=y[4]-y[6];

If y2<0 then signn:=-1

Else signn:=1;

End;

Procedure Rynge;

Begin

Prav(y);

For j:=1 to 8 do begin

Yy[j]:=y[j];

K[j]:=h*d[j];

Y1[j]:=yy[j]+0.5*k[j];

Y[j]:=y[j]+k[j]/6;

End;

T:=t+0.5*h;

Prav(y1);

For j:=1 to 8 do begin

K[j]:=h*d[j];

Y1[j]:=yy[j]+0.5*k[j];

Y[j]:=y[j]+k[j]/3;

End;

Prav(y1);

For j:=1 to 8 do begin

K[j]:=h*d[j];

Y1[j]:=yy[j]+k[j];

Y[j]:=y[j]+k[j]/3;

End;

T:=t+0.5*h;

Prav(y1);

For j:=1 to 8 do begin

K[j]:=h*d[j];

Y[j]:=y[j]+k[j]/6;

End;

End;

Begin

Assign(rez,'dannie. txt');

Reset(rez);

Readln(rez);

Readln(rez);

Readln(rez, y[1]);

Readln(rez, y[2]);

Readln(rez, y[3]);

Readln(rez, y[4]);

Readln(rez, y[5]);

Readln(rez, y[6]);

Readln(rez, y[7]);

Readln(rez, y[8]);

Readln(rez);

Readln(rez, c1);

Readln(rez, c2);

Readln(rez, c3);

Readln(rez);

Readln(rez, b1);

Readln(rez, b2);

Readln(rez, b3);

Readln(rez);

Readln(rez, j1);

Readln(rez, j2);

Readln(rez, j3);

Readln(rez, j4);

Readln(rez);

Readln(rez, Mc0);

Readln(rez, Md0);

Readln(rez, Mff);

Readln(rez, Mf);

Readln(rez);

Readln(rez, kc);

Readln(rez, kd);

Readln(rez);

Readln(rez, wm);

Close(rez);

A1:=c1*(1/j1+1/J2);

A2:=c2*(1/j2+1/J3);

A3:=c3*(1/j2+1/j4);

A21:=c2/j3;

A31:=c3/j4;

G12:=c1*c2/(j2*j2);

G13:=c1*c3/(j2*j2);

G23:=c2*c3/(j2*j2);

N:=1;

W1:=0 ;

For i:=1 to 500 do begin

Y3:=(a1-w1)*(a2-w1)*(a3-w1)-(a1-w1)*g23-(a31-w1)*g12-(a21-w1)*g13;

W1:=w1+0.1;

Y4:=(a1-w1)*(a2-w1)*(a3-w1)-(a1-w1)*g23-(a31-w1)*g12-(a21-w1)*g13;

Z:=y3*y4;

If z<0 then begin

L[n]:=w1;

Writeln('w',n,'=',l[n]);

N:=n+1;

End;

End;

H:=0.05;

Hp:=10*h;

Assign(rezz,'result. txt');

Rewrite(rezz);

Writeln(rezz,' Kursovoy proekt');

Writeln(rezz,' Chetirehmassovay dinamicheskaya model transmissii');

Writeln(rezz,' Vipolnil: student gruppi 101110 Podolyak A. A.');

Writeln(rezz,' Ishodnie dannie po varianty 1/1:');

Writeln(rezz, ' j1=', j1:3:2);

Writeln(rezz, ' j2=', j2:3:2);

Writeln(rezz, ' j3=', j3:3:2);

Writeln(rezz, ' j4=', j4:3:2);

Writeln(rezz, 'Koef. yprygosti ');

Writeln(rezz,'c1=', c1:5:2);

Writeln(rezz,'c2=', c2:5:2);

Writeln(rezz,'c3=', c3:5:2);

Writeln(rezz, 'Koef. dempfir.');

Writeln(rezz,' b1=', b1:4:2);

Writeln(rezz, ' b2=', b2:4:2);

Writeln(rezz, ' b3=', b3:4:2);

Writeln(rezz, 'Shag s4eta h=', h:5:3);

Writeln(rezz, 'Shag pe4ati hp=', hp:5:3);

Writeln(rezz, 'rezultati ras4eta');

Writeln(rezz, 'metodom iteraciy naydeni korni');

Writeln(rezz, 'x1=',l[1]:3:2);

Writeln(rezz, 'x2=',l[2]:3:2);

Writeln(rezz, 'tablica zna4eniy peremennih');

Writeln(rezz,;

Write(rezz, ' t! ');

Write(rezz, ' w1 ! ');

Write(rezz, ' w2 ! ');

Write(rezz, ' w3 ! ');

Write(rezz, ' w4 ! ');

Write(rezz, ' M1 ! ');

Write(rezz, ' M2 ! ');

Write(rezz, ' M3 ! ');

Writeln(rezz,

For i:=1 to 4 do begin

Max1[i]:=0;

Max2[i]:=0;

End;

T:=0;

If abs(M1)<=abs (Mc) then

M1:=c1*(y[2]-y[4])+b1*(y[1]-y[3]);

If abs(M2)<=abs(Mf) then

M2:=c2*(y[4]-y[6])+b2*(y[3]-y[5]);

M3:=c3*(y[4]-y[8])+b3*(y[3]-y[7]);

U1[1]:=y[1];

U2[1]:=y[3];

U3[1]:=y[5];

U4[1]:=y[7];

Write(rezz, t:6:3,' !');

Write(rezz,' ',u1[1]:8:3,' !');

Write(rezz,' ',u2[1]:8:3,' !');

Write(rezz,' ',u3[1]:8:3,' !');

Write(rezz,' ',u4[1]:8:3,' !');

Write(rezz,' ',M1:8:3,' !');

Write(rezz,' ',M2:8:3,' !');

Writeln(rezz,' ',M3:8:3,' !');

Wm:=120;

R:=1;

For i:=2 to 400 do begin

If kc*t>=5 then

Mc:=Mc0

Else if kc*t<=5 then

Mc:=Mc0*(1-exp(-kc*t));

If kd*t>=5 then

Md:=Md0

Else if kd*t<=5 then

Md:=Md0*(1-exp(-kd*t));

Mmc[i]:=Mc;

Mmd[i]:=Md;

If y[1]<wm then begin

Rynge;

U1[i]:=y[1];

U2[i]:=y[3];

U3[i]:=y[5];

U4[i]:=y[7];

If abs(M1)<=abs(Mc) then

M1:=c1*(y[2]-y[4])+b1*(y[1]-y[3]);

If abs(M2)<=abs(Mf) then

M2:=c2*(y[4]-y[6])+b2*(y[3]-y[5]);

M3:=c3*(y[4]-y[8])+b3*(y[3]-y[7]);;

If M1>Mc then M1:=Mc*sign(y[1]-y[3]);

If M2>Mf then M2:=Mf*signn(y[3]-y[5]);

Mm1[i]:=M1;

Mm2[i]:=M2;

Mm3[i]:=M3;

End

Else begin

Md:=0;

Rynge;

Y[1]:=wm;

U1[i]:=y[1];

U2[i]:=y[3];

U3[i]:=y[5];

U4[i]:=y[7];

If abs(M1)<=abs(Mc) then

M1:=c1*(y[2]-y[4])+b1*(y[1]-y[3]);

If abs(M2)<=abs(Mf) then

M2:=c2*(y[4]-y[6])+b2*(y[3]-y[5]);

M3:=c3*(y[4]-y[8])+b3*(y[3]-y[7]);;

If M1>Mc then M1:=Mc*sign(y[1]-y[3]);

If M2>Mf then M2:=Mf*signn(y[3]-y[5]);

Mm1[i]:=M1;

Mm2[i]:=M2;

Mm3[i]:=M3;

End;

Max2[3]:=abs(u3[i]);

If r=10 then begin

Write(rezz, t:6:3,' !');

Write(rezz,' ',u1[i]:8:3,' !');

Write(rezz,' ',u2[i]:8:3,' !');

Write(rezz,' ',u3[i]:8:3,' !');

Write(rezz,' ',u4[i]:8:3,' !');

Write(rezz,' ',mm1[i]:8:3,' !');

Write(rezz,' ',mm2[i]:8:3,' !');

Writeln(rezz,' ',mm3[i]:8:3,' !');

R:=0;

End;

R:=r+1;

End;

Writeln(rezz,

Close(rezz);

Writeln(max1[1]);

Writeln(max1[2]);

Writeln(max1[3]);

Writeln(max1[4]);

Writeln(max2[1]);

Writeln(max2[2]);

Writeln(max2[3]);

Writeln('OK');

GrDriver:=Detect;

InitGraph(grDriver, grMode,'');

ErrCode := GraphResult;

If ErrCode = grOk then

Begin

SetBkcolor(15);

Cleardevice;

Setcolor(7);

Ky:=75/(35);

Kx:=600/(9.0);

Setka(kx, ky,'c','rad/c',1);

T:=0;

For i:=1 to 340 do begin

Setcolor(8);

Setlinestyle(0,0,1);

Line(round(kx*t+30),360-round(ky*(u1[i])), round(kx*(t+h)+30),360-round(ky*(u1[i+1])));

Outtextxy(round(kx*0+30),360-round(ky*(u1[1])), 'w1');

Setcolor(1);

Line(round(kx*t+30),360-round(ky*(u2[i])), round(kx*(t+h)+30), 360-round(ky*(u2[i+1])));

Outtextxy(round(kx*0+30),360-round(ky*(u1[8])), 'w2');

Setcolor(3);

Line(round(kx*t+30),360-round(ky*(u3[i])), round(kx*(t+h)+30), 360-round(ky*(u3[i+1])));

Outtextxy(round(kx*1+30),360-round(ky*(u1[8])), 'w3');

Setcolor(4);

Line(round(kx*t+30),360-round(ky*(u4[i])), round(kx*(t+h)+30), 360-round(ky*(u4[i+1])));

Outtextxy(round(kx*0.6+30),360-round(ky*(u1[6])), 'w4');

T:=t+0.05;

End;

Writeln('OK');

Readln;

Cleardevice;

T:=0;

Ky:=600/(1700);

Kx:=600/(12.0);

Setka(kx, ky,'c','',2);

For i:=1 to 400 do begin

Setcolor(8);

Setlinestyle(0,0,1);

Line(round(kx*t+30),260-round(ky*(mm1[i])), round(kx*(t+h)+30), 260-round(ky*(mm1[i+1])));

Outtextxy(round(kx*1.5+30),260-round(ky*(mm1[5])), 'M1');

Setcolor(1);

Line(round(kx*t+30),260-round(ky*(mm2[i])), round(kx*(t+h)+30), 260-round(ky*(mm2[i+1])));

Outtextxy(round(kx*1.5+30),260-round(ky*(mm2[2])), 'M2');

Setcolor(2);

Line(round(kx*t+30),260-round(ky*(mm3[i])), round(kx*(t+h)+30), 260-round(ky*(mm3[i+1])));

Outtextxy(round(kx*4.5+30),260-round(ky*(mm3[5])), 'M3');

Setcolor(3);

Line(round(kx*t+30),260-round(ky*(mmc[i])), round(kx*(t+h)+30), 260-round(ky*(mmc[i+1])));

Outtextxy(round(kx*4+30),260-round(ky*(mmc[5])), 'Mc');

Setcolor(4);

Line(round(kx*t+30),260-round(ky*(mmd[i])), round(kx*(t+h)+30), 260-round(ky*(mmd[i+1])));

Outtextxy(round(kx*6+30),260-round(ky*(mmd[9])), 'Md');

T:=t+0.05;

End;

Readln;

CloseGraph;

End

Else

Writeln('Graphics error:', GraphErrorMsg(ErrCode))

End.

Похожие статьи




Логическая схема решения, Текст программы - Четырехмассовая динамическая модель трансмиссии автомобиля

Предыдущая | Следующая