Поможем написать учебную работу
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Program bipolar;
uses {wincrt,windos}crt,dos,graph;
Label 1;
var
t1,t2,t3,t4,
Uc, Uccs, Ucb, Uec, Ueb, VA, VJC, VJE,
Is0, Is, Ieb, Icb ,Ib ,Ic, Iy,Ik,Ie,{Ib1,}
CJC0, CJE0, CBE, CJE, CDE, CBC, CJC, CDC,
RB,RC,RJ,
T, TNOM, TCB,
Kyf,a,BF, BR, EG, TAUF, TAUR, MJC, MJE, CCS, K, FIt, q,expon: extended;
ii,col,row:integer; { real }
an,key:char;
function st(a:extended; b:extended):extended;
begin
if b<0 then
begin
if (-1*b * ln(a)) < 1.1356523e4 then
begin
st:=1/ (exp((-1*b) * ln(a)));
end
else st:= 1;
end
else
begin
if (b * ln(a)) > 1.1356523e4 then
begin
st:=1e4000;
end
else
begin
st:=exp((b) * ln(a));
end;
end;
end;
Procedure Model(Ueb,Ucb:extended;var Ieb,Icb,Ib,Iy:extended);
Begin
If Ueb > Uc then
begin
Ieb := 1 / BF * (Ic+ (Ueb - Uc) / RJ );
end
else
begin
Ieb :=1 / BF * Is * (st(expon,Ueb / FIt) -1);
end;
If Ucb > Uc then
begin
Icb:= 1/BR * (Ic + (Ucb-Uc)/RJ);
end
else
begin
{ if (st(expon,(Ucb/FIt))-1) < 1e4800/(1/BR * Is) then}
begin
Icb:= 1/BR * Is* (st(expon, Ucb/FIt)-1);
end
{ else Icb:= 1e4800;}
end;
Ib:= Ieb + Icb;
Iy:= Ieb*BF - Icb*BR;
end;
procedure InputTrans;
Label 1,2,3;
begin
clrscr;
BF:=75;
BR:= 0.3;
TCB:=2500;
Is0:=3.5e-15;
EG:=1.11;
CJC0:=4e-12;
CJE0:=1.2e-12;
RB:=67;
RC:=7.3;
VA:=102;
TAUF:=9.4e-11;
TAUR:=6.692e-8;
MJC:=0.33;
VJC:=0.65;
MJE:=0.69;
VJE:=0.69;
CCS:=1e-12;
RJ:=0.01;
writeln(' It is default parameters of transistor KT316B (Y/N) ');
gotoxy(col+3,row+3);
write('[Forward beta] ');
gotoxy(col+39,row+3);
write(BF);
gotoxy(col+3,row+4);
write('[Revers beta] ');
gotoxy(col+39,row+4);
write(BR);
gotoxy(col+3,row+5);
write('[Temp. coef. of BETTA (PPM)] ');
gotoxy(col+39,row+5);
write(TCB);
gotoxy(col+3,row+6);
write('[Saturation Current] ');
gotoxy(col+39,row+6);
write(Is0);
gotoxy(col+3,row+7);
write('[Energy gap (0.6 to 1.3)] ');
gotoxy(col+39,row+7);
write(EG);
EG:=EG*1.6e-19;
gotoxy(col+3,row+8);
write('[CJC0] ');
gotoxy(col+39,row+8);
write(CJC0);
gotoxy(col+3,row+9);
write('[CJE0] ');
gotoxy(col+39,row+9);
write(CJE0);
gotoxy(col+3,row+10);
write('[Base resistance] ');
gotoxy(col+39,row+10);
write(RB);
gotoxy(col+3,row+11);
write('[Collector resistance] ');
gotoxy(col+39,row+11);
write(RC);
gotoxy(col+3,row+12);
write('[Early Valtage] ');
gotoxy(col+39,row+12);
write(VA);
gotoxy(col+3,row+13);
write('[TAU forward] ');
gotoxy(col+39,row+13);
write(TAUF);
gotoxy(col+3,row+14);
write('[TAU reverse] ');
gotoxy(col+39,row+14);
write(TAUR);
gotoxy(col+3,row+15);
write('[MJC] ');
gotoxy(col+39,row+15);
write(MJC);
gotoxy(col+3,row+16);
write('[VJC] ');
gotoxy(col+39,row+16);
write(VJC);
gotoxy(col+3,row+17);
write('[MJE] ');
gotoxy(col+39,row+17);
write(MJE);
gotoxy(col+3,row+18);
write('[VJE] ');
gotoxy(col+39,row+18);
write(VJE);
gotoxy(col+3,row+19);
write('[CSUB] ');
gotoxy(col+39,row+19);
write(CCS);
gotoxy(col+3,row+20);
write('[Minimum junction resistance] ');
gotoxy(col+39,row+20);
write(RJ);
gotoxy(col+6,row+25);
write('Accept parameters of transistor (Y/N) ');
an:=readkey;
case an of 'y': goto 3; {writeln('F1'); }
'Y': goto 3; {writeln('F2'); }
'n': goto 2; {writeln('F2'); }
'N': goto 2; {writeln('F2'); }
else
begin
sound(500);
delay(1000);
nosound;
goto 1;
end;
end;
2: clrscr;
gotoxy(col+25,row+1);
write('Input next parameters of transistor');
gotoxy(col+3,row+3);
write('[Forward beta] ');
gotoxy(col+40,row+3);
read(BF);
gotoxy(col+39,row+3);
write(BF);
gotoxy(col+3,row+4);
write('[Revers beta] ');
gotoxy(col+40,row+4);
read(BR);
gotoxy(col+39,row+4);
write(BR);
gotoxy(col+3,row+5);
write('[Temp. coef. of BETTA (PPM)] ');
gotoxy(col+40,row+5);
read(TCB);
gotoxy(col+39,row+5);
write(TCB);
gotoxy(col+3,row+6);
write('[Saturation Current] ');
gotoxy(col+40,row+6);
read(Is0);
gotoxy(col+39,row+6);
write(Is0);
gotoxy(col+3,row+7);
write('[Energy gap (0.6 to 1.3)] ');
gotoxy(col+40,row+7);
read(EG);
gotoxy(col+39,row+7);
write(EG);
gotoxy(col+3,row+8);
write('[CJC0] ');
gotoxy(col+40,row+8);
read(CJC0);
gotoxy(col+39,row+8);
write(CJC0);
gotoxy(col+3,row+9);
write('[CJE0] ');
gotoxy(col+40,row+9);
read(CJE0);
gotoxy(col+39,row+9);
write(CJE0);
gotoxy(col+3,row+10);
write('[Base resistance] ');
gotoxy(col+40,row+10);
read(RB);
gotoxy(col+39,row+10);
write(RB);
gotoxy(col+3,row+11);
write('[Collector resistance] ');
gotoxy(col+40,row+11);
read(RC);
gotoxy(col+39,row+11);
write(RC);
gotoxy(col+3,row+12);
write('[Early Valtage] ');
gotoxy(col+40,row+12);
read(VA);
gotoxy(col+39,row+12);
write(VA);
gotoxy(col+3,row+13);
write('[TAU forward] ');
gotoxy(col+40,row+13);
read(TAUF);
gotoxy(col+39,row+13);
write(TAUF);
gotoxy(col+3,row+14);
write('[TAU reverse] ');
gotoxy(col+40,row+14);
read(TAUR);
gotoxy(col+39,row+14);
write(TAUR);
gotoxy(col+3,row+15);
write('[MJC] ');
gotoxy(col+40,row+15);
read(MJC);
gotoxy(col+39,row+15);
write(MJC);
gotoxy(col+3,row+16);
write('[VJC] ');
gotoxy(col+40,row+16);
read(VJC);
gotoxy(col+39,row+16);
write(VJC);
gotoxy(col+3,row+17);
write('[MJE] ');
gotoxy(col+40,row+17);
read(MJE);
gotoxy(col+39,row+17);
write(MJE);
gotoxy(col+3,row+18);
write('[VJE] ');
gotoxy(col+40,row+18);
read(VJE);
gotoxy(col+39,row+18);
write(VJE);
gotoxy(col+3,row+19);
write('[CSUB] ');
gotoxy(col+40,row+19);
read(CCS);
gotoxy(col+39,row+19);
write(CCS);
gotoxy(col+3,row+20);
write('[Minimum junction resistance] ');
gotoxy(col+40,row+20);
read(RJ);
gotoxy(col+39,row+20);
write(RJ);
writeln;
1: gotoxy(col+6,row+25);
write('Accept parameters of transistor (Y/N) ');
an:=readkey;
case an of 'y': goto 3; {writeln('F1'); }
'Y': goto 3; {writeln('F2'); }
'n': goto 2; {writeln('F2'); }
'N': goto 2; {writeln('F2'); }
else
begin
sound(500);
delay(1000);
nosound;
goto 1;
end;
end;
3:;
end;
Procedure InputCurrent;
Label 1,2,3;
begin
clrscr;
TNOM:=27;
T:=21;
Ueb:=0.8;
Uec:=2;
Ucb:=-1.2;
gotoxy(col+25,row+1);
write(' Default parameters');
gotoxy(col+3,row+3);
write('[Nominal temperature (C)] ');
gotoxy(col+39,row+3);
write(TNOM);
gotoxy(col+3,row+4);
write('[Current temperature (C)] ');
gotoxy(col+39,row+4);
write(T);
gotoxy(col+3,row+5);
write('[Emitter-Base voltage] ');
gotoxy(col+39,row+5);
write(Ueb);
gotoxy(col+3,row+6);
write('[Emitter-Collector voltage] ');
gotoxy(col+39,row+6);
write(Uec);
gotoxy(col+3,row+7);
write('[Collector-Base voltage] ');
gotoxy(col+39,row+7);
write(Ucb);
1: gotoxy(col+6,row+25);
write('Accept current parameters (Y/N) ');
an:=readkey;
case an of 'y': goto 3; {writeln('F1'); }
'Y': goto 3; {writeln('F2'); }
'n': goto 2; {writeln('F2'); }
'N': goto 2; {writeln('F2'); }
else
begin
sound(500);
delay(1000);
nosound;
goto 1;
end;
end;
2: clrscr;
gotoxy(col+20,row+2);
write('Input next current parameters');
gotoxy(col+3,row+3);
write('[Nominal temperature (C)] ');
gotoxy(col+40,row+3);
read(TNOM);
gotoxy(col+39,row+3);
write(TNOM);
gotoxy(col+3,row+4);
write('[Current temperature (C)] ');
gotoxy(col+40,row+4);
read(T);
gotoxy(col+39,row+4);
write(T);
gotoxy(col+3,row+5);
write('[Emitter-Base voltage] ');
gotoxy(col+40,row+5);
read(Ueb);
gotoxy(col+39,row+5);
write(Ueb);
gotoxy(col+3,row+6);
write('[Emitter-Collector voltage] ');
gotoxy(col+40,row+6);
read(Uec);
gotoxy(col+39,row+6);
write(Uec);
if (Ueb = 0) or (Uec = 0) then
begin
gotoxy(col+3,row+7);
write('[Collector-Base voltage] ');
gotoxy(col+40,row+7);
read(Ucb);
gotoxy(col+39,row+7);
write(Ucb);
if Uec <> 0 then
begin
Ueb := Uec + Ucb;
gotoxy(col+39,row+5);
write(Ueb);
end
else
begin
Uec := Ueb - Ucb;
gotoxy(col+39,row+6);
write(Uec);
end;
goto 1;
end;
Ucb := -(Uec - Ueb);
gotoxy(col+3,row+7);
write('[Collector-Base voltage] ');
gotoxy(col+39,row+7);
write(Ucb);
3: TNOM:=TNOM+273.15;
T:=T+273.15;
BF:=BF*(1+(T-TNOM)*TCB*10e-6);
BR:=BR*(1+(T-TNOM)*TCB*10e-6);
gotoxy(col+39,row+8);
end;
procedure OutputResult;
begin
clrscr;
writeln(' It is result ');
K:=1.38e-23;
q:=1.6e-19;
expon:=exp(1.0);
FIt:=K*T/q;
gotoxy(col+3,row+3);
write('[FIt] ');
gotoxy(col+39,row+3);
write(FIt);
t1:=Is0 * (1+ Uec/VA);
t2:=st(T/TNOM,3);
t3:=-EG/K*(1/T-1/TNOM);
t4:=st(expon,-EG/K*(1/T-1/TNOM));
Is:=Is0 * (1+ Uec/VA) * st(T/TNOM,3) * st(expon,-EG/K*(1/T-1/TNOM));
gotoxy(col+3,row+4);
write('[Is]');
gotoxy(col+39,row+4);
write(Is);
Uc:=Fit*ln(FIt/(Is*RJ));
gotoxy(col+3,row+5);
write('[Uc] ');
gotoxy(col+39,row+5);
write(Uc);
if (st(expon,(Uec/FIt))-1) < 1e4800/Is then
begin
Ic:= Is * (st(expon,Uc/FIt)-1);
end
else Ic:= 1e4800;
gotoxy(col+3,row+6);
write('[Ic]');
gotoxy(col+39,row+6);
write(Ic);
Model(Ueb,Ucb,Ieb,Icb,Ib,Iy);
gotoxy(col+3,row+7);
write('[Ieb] ');
gotoxy(col+39,row+7);
write(Ieb);
gotoxy(col+3,row+8);
write('[Icb] ');
gotoxy(col+39,row+8);
write(Icb);
gotoxy(col+3,row+9);
write('[Ib] ');
gotoxy(col+39,row+9);
write(Ib);
gotoxy(col+3,row+10);
write('[Iy] ');
gotoxy(col+39,row+10);
write(Iy);
Ik:=Iy-Icb;
gotoxy(col+3,row+11);
write('[Ik] ');
gotoxy(col+39,row+11);
write(Ik);
Ie:=Iy+Ieb;
gotoxy(col+3,row+12);
write('[Ie] ');
gotoxy(col+39,row+12);
write(Ie);
If Ueb < VJE/2 then
begin
CJE := CJE0* 1 / st(1- Ueb/VJE,MJE);
end
else
begin
CJE := st(2,MJE) * CJE0 * (MJE* Ueb / VJE/2 + 1 - MJE);
end;
gotoxy(col+3,row+13);
write('[CJE] ');
gotoxy(col+39,row+13);
write(CJE);
If Ieb > 0 then
begin
CDE := Ieb * BF * TAUF / FIt;
end
else
begin
CDE := 0;
end;
gotoxy(col+3,row+14);
write('[CDE] ');
gotoxy(col+39,row+14);
write(CDE);
CBE:=CJE+CDE;
gotoxy(col+3,row+15);
write('[CBE] ');
gotoxy(col+39,row+15);
write(CBE);
If Ucb < (VJC / 2) then
begin
CJC := CJC0 * 1 / st(1- Ucb/VJC,MJC);
end
else
begin
CJC := 2 * st(2,MJC) * CJC0 * (MJC * Ucb / VJC / 2 + 1 - MJC);
end;
gotoxy(col+3,row+16);
write('[CJC] ');
gotoxy(col+39,row+16);
write(CJC);
If Icb > 0 then
begin
CDC := Icb * BR * TAUR / FIt;
end
else
begin
CDC := 0;
end;
gotoxy(col+3,row+17);
write('[CDC] ');
gotoxy(col+39,row+17);
write(CDC);
CBC := CJC + CDC;
gotoxy(col+3,row+18);
write('[CBC] ');
gotoxy(col+39,row+18);
write(CBC);
gotoxy(col+6,row+25);
write('Pres any key to Main menu ');
readkey;
end;
procedure IGraph;
var
grDriver: Integer;
grMode: Integer;
ErrCode: Integer;
i,x0,y0: Integer;
stro1,stro2,stro3,stro4:string;
begin
grDriver := Detect;
InitGraph(grDriver, grMode,'');
ErrCode := GraphResult;
if ErrCode = grOk then
begin { Do graphics }
x0:=320;
y0:=350;
Kyf:=0;
OutTextXY(250,10,'Graphic Ib=f(-Ueb)');
Line(x0, y0-150, x0, Y0+150);
Line(x0-200, y0, X0+200, Y0);
setcolor(0);
LineTo(x0+200, y0-300);
setcolor(2);
for i:=200 downto -200 do
begin
Model(Ueb*(i)/200,-(Uec-Ueb*(i)/200),Ieb,Icb,Ib,Iy);
if Kyf=0 then
begin
Kyf:=300/Ib;
Str(Ieb,stro1);
Str(Ueb,stro2);
end;
if abs(Kyf*Ib)< 10e5 then
Lineto(x0+i, y0-round(Kyf*Ib));
end;
Str(-Ieb,stro3);
Str(-Ueb,stro4);
OutTextXY(x0-40,Y0-300,'+Ib = ');
OutTextXY(x0+3,Y0-300,Stro1);
OutTextXY(x0+60,Y0+10,'+Ueb = ');
OutTextXY(x0+100,Y0+10,Stro2);
OutTextXY(x0-250,Y0+10,'-Ib = ');
OutTextXY(x0-210,Y0+10,Stro3);
OutTextXY(x0-300,Y0-10,'-Ueb = ');
OutTextXY(x0-250,Y0-10,Stro4);
OutTextXY(40,470,'Pres any key to Main menu');
Readkey;
CloseGraph;
end
else Writeln('Graphics error:', GraphErrorMsg(ErrCode));
end;
procedure OGraph;
var
grDriver: Integer;
grMode: Integer;
ErrCode: Integer;
i,x0,y0: Integer;
stro1,stro2,stro3,stro4:string;
begin
grDriver := Detect;
InitGraph(grDriver, grMode,'');
ErrCode := GraphResult;
if ErrCode = grOk then
begin { Do graphics }
x0:=320;
y0:=240;
Kyf:=0;
OutTextXY(250,10,'Graphic Ik=f(Uec)');
Line(x0, y0-150, x0, Y0+150);
Line(x0-200, y0, X0+200, Y0);
{ Model(Ueb,Ueb-Uec,Ieb,Icb,Ib,Iy);
Ik:=Iy-Icb;
Kyf:=abs(300/Ik);
Str(Ik,stro1);
Str(Uec,stro2);}
setcolor(0);
LineTo(x0+200, round(y0-Kyf*Ik));
setcolor(2);
Kyf:=0;
for i:=200 downto -200 do
begin
if (i>0) or (i=0) then
begin
Is:=Is0 * (1+ Uec*(i)/200/VA) * st(T/TNOM,3) * st(expon,-EG/K*(1/T-1/TNOM));
Uc:=Fit*ln(FIt/(Is*RJ));
Ic:= Is * (st(expon,Uc/FIt)-1);
Model(Ueb,Ueb-Uec*(i)/200,Ieb,Icb,Ib,Iy);
Ik:=Iy-Icb;
end;
if i<0 then
begin
Is:=Is0 * (1- Uec*(i)/200/VA) * st(T/TNOM,3) * st(expon,-EG/K*(1/T-1/TNOM));
Uc:=Fit*ln(FIt/(Is*RJ));
Ic:= Is * (st(expon,Uc/FIt)-1);
Model(Ueb+Uec*(i)/200,Ueb,Ieb,Icb,Ib,Iy);
Ik:=(Iy-Icb);
end;
if Kyf=0 then
begin
Kyf:=abs(20/Ik);
Str(Ik,stro1);
Str(Uec,stro2);
setcolor(0);
LineTo(x0+200, round(y0-Kyf*Ik));
setcolor(2);
end;
if abs(Kyf*Ik)< 10e5 then
Lineto(x0+i, y0-round(Kyf*Ik));
end;
OutTextXY(x0-40,Y0-210,'+Ik = ');
OutTextXY(x0+3,Y0-210,Stro1);
OutTextXY(x0+60,Y0+10,'+Uec = ');
OutTextXY(x0+100,Y0+10,Stro2);
OutTextXY(40,470,'Pres any key to Main menu');
Readkey;
CloseGraph;
end
else Writeln('Graphics error:', GraphErrorMsg(ErrCode));
end;
begin
textbackground(1);
textcolor(14);
col:=-2;
row:=0;
repeat
clrscr;
writeln(' Mogel p-n-p transistor Eabers-Mol whith 1 SIDI');
writeln;
writeln(' Main menu');
writeln;
writeln('1: Input parameters of transistor');
writeln('2: Input current parameters');
writeln('3: Output text result');
writeln('4: Input-graphic result');
writeln('5: Output-graphic result');
writeln('ECS:exit');
key:=Readkey;
case key of '1': InputTrans;
'2': InputCurrent;
'3': OutputResult;
'4': IGraph;
'5': OGraph;
#27: halt ;
else
begin
sound(500);
delay(1000);
nosound;
end;
end;
until key=#27;
{row:=28;}
{donewincrt;}
end.