Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed guard against division by zero in electrical resistance #1941

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions IBPSA/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=IBPSA.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,12 +44,17 @@ 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\">Buildings #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.
</li>
<li>May 14, 2015, by Marco Bonvini:<br/>
Changed parent class to <a href=\"modelica://Buildings.Electrical.Interfaces.ResistiveLoad\">
Changed parent class to <a href=\"modelica://IBPSA.Electrical.Interfaces.ResistiveLoad\">
IBPSA.Electrical.Interfaces.ResistiveLoad</a> in order
to help openmodelica parsing the model. This fixes issue
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/415\">#415</a>.
Expand Down
Loading