Skip to content

Commit

Permalink
Changed guard against division by zero (#4033)
Browse files Browse the repository at this point in the history
This closes #4032
  • Loading branch information
mwetter authored Nov 3, 2024
1 parent eee08d5 commit cfa625f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Buildings/Electrical/DC/Loads/Resistor.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ model Resistor "Ideal linear electrical resistor"
redeclare package PhaseSystem = PhaseSystems.TwoConductor,
redeclare Interfaces.Terminal_n terminal,
final mode=Buildings.Electrical.Types.Load.FixedZ_steady_state,
final P_nominal=V_nominal^2/max(R, Modelica.Constants.small));
final P_nominal=V_nominal^2/max(R, sqrt(Modelica.Constants.small)));
extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref);
parameter Modelica.Units.SI.Resistance R(start=1)
"Resistance at temperature T_ref";
Expand Down Expand Up @@ -44,6 +44,11 @@ The temperature <i>T</i> is the temperature of the heat port if <code>useHeatPor
</html>",
revisions="<html>
<ul>
<li>November 2, 2024, by Michael Wetter:<br/>
Changed guarding against division by zero.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/4032\">#4032</a>.
</li>
<li>November 3, 2015, by Michael Wetter:<br/>
Set default value for <code>P_nominal</code> to avoid an error when translating
the model in Dymola's pedantic mode.
Expand Down

0 comments on commit cfa625f

Please sign in to comment.