-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathResistor.mo
More file actions
58 lines (56 loc) · 2.12 KB
/
Resistor.mo
File metadata and controls
58 lines (56 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
within Modelica.Electrical.Analog.Basic;
model Resistor "Ideal linear electrical resistor"
parameter SI.Resistance R(start=1)
"Resistance at temperature T_ref";
parameter SI.Temperature T_ref=300.15 "Reference temperature";
parameter SI.LinearTemperatureCoefficient alpha=0
"Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref)))";
extends Modelica.Electrical.Analog.Interfaces.OnePort;
extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T=T_ref);
SI.Resistance R_actual
"Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))";
equation
assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps,
"Temperature outside scope of model!");
R_actual = R*(1 + alpha*(T_heatPort - T_ref));
v = R_actual*i;
LossPower = v*i;
annotation (
Documentation(info="<html>
<p>The linear resistor connects the branch voltage <em>v</em> with the branch current <em>i</em> by <em>i*R = v</em>. The Resistance <em>R</em> is allowed to be positive, zero, or negative.</p>
</html>",
revisions="<html>
<ul>
<li><em> August 07, 2009 </em>
by Anton Haumer<br> temperature dependency of resistance added<br>
</li>
<li><em> March 11, 2009 </em>
by Christoph Clauss<br> conditional heat port added<br>
</li>
<li><em> 1998 </em>
by Christoph Clauss<br> initially implemented<br>
</li>
</ul>
</html>"),
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}}), graphics={
Rectangle(
extent={{-70,30},{70,-30}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(points={{-90,0},{-70,0}}, color={0,0,255}),
Line(points={{70,0},{90,0}}, color={0,0,255}),
Text(
extent={{-150,-40},{150,-80}},
textString="R=%R"),
Line(
visible=useHeatPort,
points={{0,-100},{0,-30}},
color={127,0,0},
pattern=LinePattern.Dot),
Text(
extent={{-150,90},{150,50}},
textString="%name",
textColor={0,0,255})}));
end Resistor;