Changeset 1024 for trunk/Modelica/Electrical/Analog/Semiconductors.mo
- Timestamp:
- 02/01/08 12:53:12 (10 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modelica/Electrical/Analog/Semiconductors.mo
r887 r1024 1 1 within Modelica.Electrical.Analog; 2 package Semiconductors 3 "Semiconductor devices such as diode, MOS and bipolar transistor" 2 package Semiconductors 3 "Semiconductor devices such as diode, MOS and bipolar transistor" 4 4 extends Modelica.Icons.Library; 5 5 import Modelica.SIunits; 6 6 7 7 annotation ( 8 8 Window( … … 44 44 </dl> 45 45 </html>")); 46 47 model Diode "Simple diode" 46 47 model Diode "Simple diode" 48 48 extends Modelica.Electrical.Analog.Interfaces.OnePort; 49 49 parameter SIunits.Current Ids=1.e-6 "Saturation current"; 50 parameter SIunits.Voltage Vt=0.04 50 parameter SIunits.Voltage Vt=0.04 51 51 "Voltage equivalent of temperature (kT/qn)"; 52 parameter Real Maxexp(final min=Modelica.Constants.small) = 15 52 parameter Real Maxexp(final min=Modelica.Constants.small) = 15 53 53 "Max. exponent for linear continuation"; 54 54 parameter SIunits.Resistance R=1.e8 "Parallel ohmic resistance"; … … 115 115 width=0.75, 116 116 height=0.63)); 117 equation 118 i = smooth(1,(if (v/Vt > Maxexp) then Ids*(exp(Maxexp)*(1 + v/Vt - Maxexp) - 1) +119 v/R else Ids*(exp(v/Vt) - 1) + v/R)) ;117 equation 118 i = noEvent(smooth(1,(if (v/Vt > Maxexp) then Ids*(exp(Maxexp)*(1 + v/Vt - Maxexp) - 1) + 119 v/R else Ids*(exp(v/Vt) - 1) + v/R))); 120 120 end Diode; 121 122 model PMOS "Simple MOS Transistor" 121 122 model PMOS "Simple MOS Transistor" 123 123 Interfaces.Pin D "Drain" annotation (Placement(transformation(extent={{90, 124 124 40},{110,60}}, rotation=0))); … … 131 131 parameter SIunits.Length W=20.0e-6 "Width"; 132 132 parameter SIunits.Length L=6.0e-6 "Length"; 133 parameter SIunits.Transconductance Beta=0.0105e-3 133 parameter SIunits.Transconductance Beta=0.0105e-3 134 134 "Transconductance parameter"; 135 135 parameter SIunits.Voltage Vt=-1.0 "Zero bias threshold voltage"; … … 139 139 parameter SIunits.Length dL=-2.1e-6 "Shortening of channel"; 140 140 parameter SIunits.Resistance RDS=1.e+7 "Drain-Source-Resistance"; 141 protected 141 protected 142 142 Real v; 143 143 Real uds; … … 233 233 fillPattern=FillPattern.Solid, 234 234 lineColor={0,0,255})})); 235 equation 235 equation 236 236 //assert (L + dL > 0, "Effective length must be positive"); 237 237 //assert (W + dW > 0, "Effective width must be positive"); 238 238 gds = if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS; 239 239 v = Beta*(W + dW)/(L + dL); 240 ud = if (D.v > S.v) then S.v else D.v;241 us = if (D.v > S.v) then D.v else S.v;240 ud = noEvent(smooth(0,if (D.v > S.v) then S.v else D.v)); 241 us = noEvent(smooth(0,if (D.v > S.v) then D.v else S.v)); 242 242 uds = ud - us; 243 ubs = if (B.v < us) then 0 else B.v - us;243 ubs = noEvent(smooth(0,if (B.v < us) then 0 else B.v - us)); 244 244 ugst = (G.v - us - Vt + K2*ubs)*K5; 245 id = if (ugst >= 0) then uds*gds else if (ugst < uds) then -v*uds*(246 ugst - uds/2) + uds*gds else -v*ugst*ugst/2 + uds*gds ;245 id = noEvent(smooth(0,if (ugst >= 0) then uds*gds else if (ugst < uds) then -v*uds*( 246 ugst - uds/2) + uds*gds else -v*ugst*ugst/2 + uds*gds)); 247 247 G.i = 0; 248 D.i = if (D.v > S.v) then -id else id;249 S.i = if (D.v > S.v) then id else -id;248 D.i = noEvent(smooth(0,if (D.v > S.v) then -id else id)); 249 S.i = noEvent(smooth(0,if (D.v > S.v) then id else -id)); 250 250 B.i = 0; 251 251 end PMOS; 252 253 model NMOS "Simple MOS Transistor" 252 253 model NMOS "Simple MOS Transistor" 254 254 Interfaces.Pin D "Drain" annotation (Placement(transformation(extent={{90, 255 255 40},{110,60}}, rotation=0))); … … 262 262 parameter SIunits.Length W=20.e-6 "Width"; 263 263 parameter SIunits.Length L=6.e-6 "Length"; 264 parameter SIunits.Transconductance Beta=0.041e-3 264 parameter SIunits.Transconductance Beta=0.041e-3 265 265 "Transconductance parameter"; 266 266 parameter SIunits.Voltage Vt=0.8 "Zero bias threshold voltage"; … … 270 270 parameter SIunits.Length dL=-1.5e-6 "shortening of channel"; 271 271 parameter SIunits.Resistance RDS=1.e+7 "Drain-Source-Resistance"; 272 protected 272 protected 273 273 Real v; 274 274 Real uds; … … 369 369 fillPattern=FillPattern.Solid, 370 370 lineColor={0,0,255})})); 371 equation 371 equation 372 372 //assert (L + dL > 0, "Effective length must be positive"); 373 373 //assert (W + dW > 0, "Effective width must be positive"); 374 374 gds = if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS; 375 375 v = Beta*(W + dW)/(L + dL); 376 ud = if (D.v < S.v) then S.v else D.v;376 ud = noEvent(smooth(0,if (D.v < S.v) then S.v else D.v)); 377 377 us = if (D.v < S.v) then D.v else S.v; 378 378 uds = ud - us; 379 ubs = if (B.v > us) then 0 else B.v - us;379 ubs = noEvent(smooth(0,if (B.v > us) then 0 else B.v - us)); 380 380 ugst = (G.v - us - Vt + K2*ubs)*K5; 381 id = if (ugst <= 0) then uds*gds else if (ugst > uds) then v*uds*(ugst382 - uds/2) + uds*gds else v*ugst*ugst/2 + uds*gds ;381 id = noEvent(smooth(0,if (ugst <= 0) then uds*gds else if (ugst > uds) then v*uds*(ugst 382 - uds/2) + uds*gds else v*ugst*ugst/2 + uds*gds)); 383 383 G.i = 0; 384 D.i = if (D.v < S.v) then -id else id;385 S.i = if (D.v < S.v) then id else -id;384 D.i = noEvent(smooth(0,if (D.v < S.v) then -id else id)); 385 S.i = noEvent(smooth(0,if (D.v < S.v) then id else -id)); 386 386 B.i = 0; 387 387 end NMOS; 388 389 model NPN "Simple BJT according to Ebers-Moll" 388 389 model NPN "Simple BJT according to Ebers-Moll" 390 390 parameter Real Bf=50 "Forward beta"; 391 391 parameter Real Br=0.1 "Reverse beta"; 392 392 parameter SIunits.Current Is=1.e-16 "Transport saturation current"; 393 parameter SIunits.InversePotential Vak=0.02 393 parameter SIunits.InversePotential Vak=0.02 394 394 "Early voltage (inverse), 1/Volt"; 395 395 parameter SIunits.Time Tauf=0.12e-9 "Ideal forward transit time"; 396 396 parameter SIunits.Time Taur=5e-9 "Ideal reverse transit time"; 397 397 parameter SIunits.Capacitance Ccs=1e-12 "Collector-substrat(ground) cap."; 398 parameter SIunits.Capacitance Cje=0.4e-12 398 parameter SIunits.Capacitance Cje=0.4e-12 399 399 "Base-emitter zero bias depletion cap."; 400 parameter SIunits.Capacitance Cjc=0.5e-12 400 parameter SIunits.Capacitance Cjc=0.5e-12 401 401 "Base-coll. zero bias depletion cap."; 402 402 parameter SIunits.Voltage Phie=0.8 "Base-emitter diffusion voltage"; … … 409 409 parameter Real EMin=-100 "if x < EMin, the exp(x) function is linearized"; 410 410 parameter Real EMax=40 "if x > EMax, the exp(x) function is linearized"; 411 protected 411 protected 412 412 Real vbc; 413 413 Real vbe; … … 421 421 Real Capcje; 422 422 Real Capcjc; 423 function pow "Just a helper function for x^y" 423 function pow "Just a helper function for x^y" 424 424 input Real x; 425 425 input Real y; 426 426 output Real z; 427 algorithm 427 algorithm 428 428 z:=x^y; 429 429 end pow; 430 public 430 public 431 431 Modelica.Electrical.Analog.Interfaces.Pin C "Collector" annotation (Placement( 432 432 transformation(extent={{90,40},{110,60}}, rotation=0))); … … 507 507 fillPattern=FillPattern.Solid, 508 508 lineColor={0,0,255})})); 509 equation 509 equation 510 510 ExMin = exp(EMin); 511 511 ExMax = exp(EMax); … … 513 513 vbe = B.v - E.v; 514 514 qbk = 1 - vbc*Vak; 515 516 ibc = noEvent( if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc else515 516 ibc = noEvent(smooth(1,if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc else 517 517 if (vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc* 518 Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc) ;519 ibe = noEvent( if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe else518 Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc)); 519 ibe = noEvent(smooth(1,if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe else 520 520 if (vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe* 521 Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe) ;522 Capcjc = noEvent( if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - vbc523 /Phic, -Mc)) ;524 Capcje = noEvent( if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - vbe525 /Phie, -Me)) ;526 cbc = noEvent( if (vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) +521 Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe)); 522 Capcjc = noEvent(smooth(1,(if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - vbc 523 /Phic, -Mc)))); 524 Capcje = noEvent(smooth(1,(if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - vbe 525 /Phie, -Me)))); 526 cbc = noEvent(smooth(1,(if (vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + 527 527 Capcjc else if (vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1) 528 + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc) ;529 cbe = noEvent( if (vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) +528 + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc))); 529 cbe = noEvent(smooth(1,(if (vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) + 530 530 Capcje else if (vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1) 531 + Capcje else Tauf*Is/Vt*exp(vbe/Vt) + Capcje) ;531 + Capcje else Tauf*Is/Vt*exp(vbe/Vt) + Capcje))); 532 532 C.i = (ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) + Ccs*der(C.v); 533 533 B.i = ibe/Bf + ibc/Br + cbc*der(vbc) + cbe*der(vbe); 534 534 E.i = -B.i - C.i + Ccs*der(C.v); 535 535 end NPN; 536 537 model PNP "Simple BJT according to Ebers-Moll" 536 537 model PNP "Simple BJT according to Ebers-Moll" 538 538 parameter Real Bf=50 "Forward beta"; 539 539 parameter Real Br=0.1 "Reverse beta"; 540 540 parameter SIunits.Current Is=1.e-16 "Transport saturation current"; 541 parameter SIunits.InversePotential Vak=0.02 541 parameter SIunits.InversePotential Vak=0.02 542 542 "Early voltage (inverse), 1/Volt"; 543 543 parameter SIunits.Time Tauf=0.12e-9 "Ideal forward transit time"; 544 544 parameter SIunits.Time Taur=5e-9 "Ideal reverse transit time"; 545 545 parameter SIunits.Capacitance Ccs=1e-12 "Collector-substrat(ground) cap."; 546 parameter SIunits.Capacitance Cje=0.4e-12 546 parameter SIunits.Capacitance Cje=0.4e-12 547 547 "Base-emitter zero bias depletion cap."; 548 parameter SIunits.Capacitance Cjc=0.5e-12 548 parameter SIunits.Capacitance Cjc=0.5e-12 549 549 "Base-coll. zero bias depletion cap."; 550 550 parameter SIunits.Voltage Phie=0.8 "Base-emitter diffusion voltage"; … … 557 557 parameter Real EMin=-100 "if x < EMin, the exp(x) function is linearized"; 558 558 parameter Real EMax=40 "if x > EMax, the exp(x) function is linearized"; 559 protected 559 protected 560 560 Real vbc; 561 561 Real vbe; … … 569 569 Real Capcje; 570 570 Real Capcjc; 571 function pow "Just a helper function for x^y" 571 function pow "Just a helper function for x^y" 572 572 input Real x; 573 573 input Real y; 574 574 output Real z; 575 algorithm 575 algorithm 576 576 z:=x^y; 577 577 end pow; 578 public 578 public 579 579 Modelica.Electrical.Analog.Interfaces.Pin C "Collector" annotation (Placement( 580 580 transformation(extent={{90,40},{110,60}}, rotation=0))); … … 649 649 fillPattern=FillPattern.Solid, 650 650 lineColor={0,0,255})})); 651 equation 651 equation 652 652 ExMin = exp(EMin); 653 653 ExMax = exp(EMax); … … 655 655 vbe = E.v - B.v; 656 656 qbk = 1 - vbc*Vak; 657 658 ibc = noEvent( if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc else657 658 ibc = noEvent(smooth(1,(if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc else 659 659 if (vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc* 660 Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc) ;661 662 ibe = noEvent( if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe else660 Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc))); 661 662 ibe = noEvent(smooth(1,(if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe else 663 663 if (vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe* 664 Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe) ;665 666 Capcjc = noEvent( if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - vbc667 /Phic, -Mc)) ;668 Capcje = noEvent( if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - vbe669 /Phie, -Me)) ;670 cbc = noEvent( if (vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) +664 Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe))); 665 666 Capcjc = noEvent(smooth(1,(if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - vbc 667 /Phic, -Mc)))); 668 Capcje = noEvent(smooth(1,if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - vbe 669 /Phie, -Me))); 670 cbc = noEvent(smooth(1,(if (vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + 671 671 Capcjc else if (vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1) 672 + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc) ;673 cbe = noEvent( if (vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) +672 + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc))); 673 cbe = noEvent(smooth(1,(if (vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) + 674 674 Capcje else if (vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1) 675 + Capcje else Tauf*Is/Vt*exp(vbe/Vt) + Capcje) ;675 + Capcje else Tauf*Is/Vt*exp(vbe/Vt) + Capcje))); 676 676 C.i = -((ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) - Ccs*der(C.v)); 677 677 B.i = -(ibe/Bf + ibc/Br + cbe*der(vbe) + cbc*der(vbc)); 678 678 E.i = -B.i - C.i + Ccs*der(C.v); 679 679 end PNP; 680 681 model HeatingDiode "Simple diode with heating port" 680 681 model HeatingDiode "Simple diode with heating port" 682 682 extends Modelica.Electrical.Analog.Interfaces.OnePort; 683 683 Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort(T(start= … … 688 688 rotation=270))); 689 689 parameter Modelica.SIunits.Current Ids=1.e-6 "Saturation current"; 690 690 691 691 /* parameter Modelica.SIunits.Voltage Vt=0.04 "Voltage equivalent of temperature (kT/qn)"; */ 692 parameter Real Maxexp(final min=Modelica.Constants.small) = 15 692 parameter Real Maxexp(final min=Modelica.Constants.small) = 15 693 693 "Max. exponent for linear continuation"; 694 parameter Modelica.SIunits.Resistance R=1.e8 694 parameter Modelica.SIunits.Resistance R=1.e8 695 695 "Parallel ohmic resistance"; 696 696 parameter Real EG=1.11 "activation energy"; 697 697 parameter Real N=1 "Emission coefficient"; 698 parameter Modelica.SIunits.Temperature TNOM=300.15 698 parameter Modelica.SIunits.Temperature TNOM=300.15 699 699 "Parameter measurement temperature"; 700 700 parameter Real XTI=3 "Temperature exponent of saturation current"; 701 701 Modelica.SIunits.Temperature vt_t "Temperature voltage"; 702 702 Modelica.SIunits.Current id "diode current"; 703 protected 703 protected 704 704 Real k=1.380662e-23 "Boltzmann's constant, J/K"; 705 705 Real q=1.6021892e-19 "Electron charge, As"; … … 770 770 width=0.75, 771 771 height=0.63)); 772 equation 772 equation 773 773 assert( heatPort.T > 0,"temperature must be positive"); 774 774 htemp = heatPort.T; 775 775 vt_t = k*htemp/q; 776 776 777 777 id = exlin((v/(N*vt_t)), Maxexp) - 1; 778 778 779 779 aux = (htemp/TNOM - 1)*EG/(N*vt_t); 780 780 auxp = exp(aux); 781 781 782 782 i = Ids*id*pow(htemp/TNOM, XTI/N)*auxp + v/R; 783 783 784 784 heatPort.Q_flow = -i*v; 785 785 end HeatingDiode; 786 787 model HeatingNMOS "Simple MOS Transistor with heating port" 786 787 model HeatingNMOS "Simple MOS Transistor with heating port" 788 788 Modelica.Electrical.Analog.Interfaces.Pin D "Drain" 789 789 annotation (Placement(transformation(extent={{90,40},{110,60}}, … … 806 806 parameter Modelica.SIunits.Length W=20.e-6 "Width"; 807 807 parameter Modelica.SIunits.Length L=6.e-6 "Length"; 808 parameter Modelica.SIunits.Transconductance Beta=0.041e-3 808 parameter Modelica.SIunits.Transconductance Beta=0.041e-3 809 809 "Transconductance parameter"; 810 parameter Modelica.SIunits.Voltage Vt=0.8 810 parameter Modelica.SIunits.Voltage Vt=0.8 811 811 "Zero bias threshold voltage"; 812 812 parameter Real K2=1.144 "Bulk threshold parameter"; … … 814 814 parameter Modelica.SIunits.Length dW=-2.5e-6 "narrowing of channel"; 815 815 parameter Modelica.SIunits.Length dL=-1.5e-6 "shortening of channel"; 816 parameter Modelica.SIunits.Resistance RDS=1.e+7 816 parameter Modelica.SIunits.Resistance RDS=1.e+7 817 817 "Drain-Source-Resistance"; 818 parameter Modelica.SIunits.Temperature Tnom=300.15 818 parameter Modelica.SIunits.Temperature Tnom=300.15 819 819 "Parameter measurement temperature"; 820 820 parameter Real kvt=-6.96e-3 "fitting parameter for Vt"; 821 821 parameter Real kk2=6.0e-4 "fitting parameter for K22"; 822 protected 822 protected 823 823 Real v; 824 824 Real uds; … … 929 929 lineColor={0,0,255}), 930 930 Line(points={{0,-90},{0,-49}}, color={191,0,0})})); 931 equation 931 equation 932 932 assert(L + dL > 0, "Effective length must be positive"); 933 933 assert(W + dW > 0, "Effective width must be positive"); … … 935 935 gds = if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS; 936 936 v = beta_t*(W + dW)/(L + dL); 937 ud = if (D.v < S.v) then S.v else D.v;938 us = if (D.v < S.v) then D.v else S.v;937 ud = noEvent(smooth(0,if (D.v < S.v) then S.v else D.v)); 938 us = noEvent(smooth(0,if (D.v < S.v) then D.v else S.v)); 939 939 uds = ud - us; 940 ubs = if (B.v > us) then 0 else B.v - us;940 ubs = noEvent(smooth(0,if (B.v > us) then 0 else B.v - us)); 941 941 ugst = (G.v - us - vt_t + k2_t*ubs)*K5; 942 id = if (ugst <= 0) then uds*gds else if (ugst > uds) then v*uds*(943 ugst - uds/2) + uds*gds else v*ugst*ugst/2 + uds*gds ;944 942 id = noEvent(smooth(0,if (ugst <= 0) then uds*gds else if (ugst > uds) then v*uds*( 943 ugst - uds/2) + uds*gds else v*ugst*ugst/2 + uds*gds)); 944 945 945 beta_t = Beta*pow((heatPort.T/Tnom), -1.5); 946 946 vt_t = Vt*(1 + (heatPort.T - Tnom)*kvt); 947 947 k2_t = K2*(1 + (heatPort.T - Tnom)*kk2); 948 948 949 949 G.i = 0; 950 D.i = if (D.v < S.v) then -id else id;951 S.i = if (D.v < S.v) then id else -id;950 D.i = noEvent(smooth(0,if (D.v < S.v) then -id else id)); 951 S.i = noEvent(smooth(0,if (D.v < S.v) then id else -id)); 952 952 B.i = 0; 953 953 heatPort.Q_flow = -D.i*(D.v - S.v); 954 954 end HeatingNMOS; 955 956 model HeatingPMOS "Simple PMOS Transistor with heating port" 955 956 model HeatingPMOS "Simple PMOS Transistor with heating port" 957 957 Modelica.Electrical.Analog.Interfaces.Pin D "Drain" 958 958 annotation (Placement(transformation(extent={{90,40},{110,60}}, … … 975 975 parameter Modelica.SIunits.Length W=20.0e-6 "Width"; 976 976 parameter Modelica.SIunits.Length L=6.0e-6 "Length"; 977 parameter Modelica.SIunits.Transconductance Beta=0.0105e-3 977 parameter Modelica.SIunits.Transconductance Beta=0.0105e-3 978 978 "Transconductance parameter"; 979 parameter Modelica.SIunits.Voltage Vt=-1.0 979 parameter Modelica.SIunits.Voltage Vt=-1.0 980 980 "Zero bias threshold voltage"; 981 981 parameter Real K2=0.41 "Bulk threshold parameter"; … … 983 983 parameter Modelica.SIunits.Length dW=-2.5e-6 "Narrowing of channel"; 984 984 parameter Modelica.SIunits.Length dL=-2.1e-6 "Shortening of channel"; 985 parameter Modelica.SIunits.Resistance RDS=1.e+7 985 parameter Modelica.SIunits.Resistance RDS=1.e+7 986 986 "Drain-Source-Resistance"; 987 parameter Modelica.SIunits.Temperature Tnom=300.15 987 parameter Modelica.SIunits.Temperature Tnom=300.15 988 988 "Parameter measurement temperature"; 989 989 parameter Real kvt=-2.9e-3 "fitting parameter for Vt"; 990 990 parameter Real kk2=6.2e-4 "fitting parameter for Kk2"; 991 protected 991 protected 992 992 Real v; 993 993 Real uds; … … 1093 1093 lineColor={0,0,255}), 1094 1094 Line(points={{0,-95},{0,-50}}, color={191,0,0})})); 1095 equation 1095 equation 1096 1096 assert(L + dL > 0, "Effective length must be positive"); 1097 1097 assert(W + dW > 0, "Effective width must be positive"); … … 1099 1099 gds = if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS; 1100 1100 v = beta_t*(W + dW)/(L + dL); 1101 ud = if (D.v > S.v) then S.v else D.v;1102 us = if (D.v > S.v) then D.v else S.v;1101 ud = noEvent(smooth(0,if (D.v > S.v) then S.v else D.v)); 1102 us = noEvent(smooth(0,if (D.v > S.v) then D.v else S.v)); 1103 1103 uds = ud - us; 1104 ubs = if (B.v < us) then 0 else B.v - us;1104 ubs = noEvent(smooth(0,if (B.v < us) then 0 else B.v - us)); 1105 1105 ugst = (G.v - us - vt_t + k2_t*ubs)*K5; 1106 id = if (ugst >= 0) then uds*gds else if (ugst < uds) then -v*uds*(1107 ugst - uds/2) + uds*gds else -v*ugst*ugst/2 + uds*gds ;1108 1106 id = noEvent(smooth(0,if (ugst >= 0) then uds*gds else if (ugst < uds) then -v*uds*( 1107 ugst - uds/2) + uds*gds else -v*ugst*ugst/2 + uds*gds)); 1108 1109 1109 beta_t = Beta*pow((heatPort.T/Tnom), -1.5); 1110 1110 vt_t = Vt*(1 + (heatPort.T - Tnom)*kvt); 1111 1111 k2_t = K2*(1 + (heatPort.T - Tnom)*kk2); 1112 1112 1113 1113 G.i = 0; 1114 D.i = if (D.v > S.v) then -id else id;1115 S.i = if (D.v > S.v) then id else -id;1114 D.i = noEvent(smooth(0,if (D.v > S.v) then -id else id)); 1115 S.i = noEvent(smooth(0,if (D.v > S.v) then id else -id)); 1116 1116 B.i = 0; 1117 1117 heatPort.Q_flow = -D.i*(D.v - S.v); 1118 1118 end HeatingPMOS; 1119 1120 model HeatingNPN 1121 "Simple NPN BJT according to Ebers-Moll with heating port" 1119 1120 model HeatingNPN 1121 "Simple NPN BJT according to Ebers-Moll with heating port" 1122 1122 parameter Real Bf=50 "Forward beta"; 1123 1123 parameter Real Br=0.1 "Reverse beta"; 1124 parameter Modelica.SIunits.Current Is=1.e-16 1124 parameter Modelica.SIunits.Current Is=1.e-16 1125 1125 "Transport saturation current"; 1126 parameter Modelica.SIunits.InversePotential Vak=0.02 1126 parameter Modelica.SIunits.InversePotential Vak=0.02 1127 1127 "Early voltage (inverse), 1/Volt"; 1128 parameter Modelica.SIunits.Time Tauf=0.12e-9 1128 parameter Modelica.SIunits.Time Tauf=0.12e-9 1129 1129 "Ideal forward transit time"; 1130 parameter Modelica.SIunits.Time Taur=5e-9 1130 parameter Modelica.SIunits.Time Taur=5e-9 1131 1131 "Ideal reverse transit time"; 1132 parameter Modelica.SIunits.Capacitance Ccs=1e-12 1132 parameter Modelica.SIunits.Capacitance Ccs=1e-12 1133 1133 "Collector-substrat(ground) cap."; 1134 parameter Modelica.SIunits.Capacitance Cje=0.4e-12 1134 parameter Modelica.SIunits.Capacitance Cje=0.4e-12 1135 1135 "Base-emitter zero bias depletion cap."; 1136 parameter Modelica.SIunits.Capacitance Cjc=0.5e-12 1136 parameter Modelica.SIunits.Capacitance Cjc=0.5e-12 1137 1137 "Base-coll. zero bias depletion cap."; 1138 parameter Modelica.SIunits.Voltage Phie=0.8 1138 parameter Modelica.SIunits.Voltage Phie=0.8 1139 1139 "Base-emitter diffusion voltage"; 1140 1140 parameter Real Me=0.4 "Base-emitter gradation exponent"; 1141 parameter Modelica.SIunits.Voltage Phic=0.8 1141 parameter Modelica.SIunits.Voltage Phic=0.8 1142 1142 "Base-collector diffusion voltage"; 1143 1143 parameter Real Mc=0.333 "Base-collector gradation exponent"; 1144 parameter Modelica.SIunits.Conductance Gbc=1e-15 1144 parameter Modelica.SIunits.Conductance Gbc=1e-15 1145 1145 "Base-collector conductance"; 1146 parameter Modelica.SIunits.Conductance Gbe=1e-15 1146 parameter Modelica.SIunits.Conductance Gbe=1e-15 1147 1147 "Base-emitter conductance"
