model HeatingDiode "Simple diode with heating port"
extends Modelica.Electrical.Analog.Interfaces.OnePort;
parameter SI.Current Ids = 1e-6 "Saturation current";
parameter Real Maxexp(final min = Modelica.Constants.small) = 15 "Max. exponent for linear continuation";
parameter SI.Resistance R = 1e+8 "Parallel ohmic resistance";
parameter Real EG = 1.11 "Activation energy";
parameter Real N = 1 "Emission coefficient";
parameter SI.Temperature TNOM = 300.15 "Parameter measurement temperature";
parameter Real XTI = 3 "Temperature exponent of saturation current";
extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(useHeatPort = true);
SI.Voltage vt_t "Temperature voltage";
SI.Current id "Diode current";
protected
SI.Temperature htemp "Auxiliary temperature";
Real aux;
Real auxp;
equation
assert(0 < T_heatPort, "Temperature must be positive");
i = id * pow(htemp / TNOM, XTI / N) * auxp + v / R;
LossPower = i * v;
aux = (htemp / TNOM - 1) * EG / (N * vt_t);
auxp = exp(aux);
htemp = T_heatPort;
id = Ids * (exlin(v / (N * vt_t), Maxexp) - 1);
vt_t = k * htemp / q;
annotation (
defaultComponentName = "diode",
Documentation(
info = "<html>\n<p>\nThe simple diode is an electrical one port, where a heat port is added, which is\ndefined in the Modelica.Thermal library. It consists of the diode itself and an parallel ohmic\nresistance <em>R</em>. The diode formula is:\n</p>\n<pre>\n v/vt_t\n i = ids ( e - 1).\n\n</pre>\nwhere vt_t depends on the temperature of the heat port:\n<pre>\n vt_t = k*temp/q\n</pre>\n<p>\nIf the exponent <em>v/vt_t</em> reaches the limit <em>maxex</em>, the diode characteristic is linearly\ncontinued to avoid overflow.<br>\nThe thermal power is calculated by <em>i*v</em>.\n</p>\n</html>",
revisions = "<html>\n<ul>\n<li><em> March 11, 2009 </em>\n by Christoph Clauss<br> conditional heat port added<br>\n </li>\n<li><em>April 5, 2004 </em>\n by Christoph Clauss<br> implemented<br>\n </li>\n</ul>\n</html>"),
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Polygon(
points = {
{30, 0},
{-30, 40},
{-30, -40},
{30, 0}},
lineColor = {0, 0, 255},
fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid),
Line(
points = {
{-90, 0},
{40, 0}},
color = {0, 0, 255}),
Line(
points = {
{40, 0},
{90, 0}},
color = {0, 0, 255}),
Line(
points = {
{30, 40},
{30, -40}},
color = {0, 0, 255}),
Text(
extent = {
{-150, 90},
{150, 50}},
textString = "%name",
lineColor = {0, 0, 255})}));
end HeatingDiode;