From faf456fced0680f29697ac3a9db341f1a2642be7 Mon Sep 17 00:00:00 2001 From: Michael Wetter Date: Fri, 5 Apr 2024 18:03:35 -0700 Subject: [PATCH] Reformulated InductiveLoad to avoid infinite value (#3778) For #3776 --- .../Electrical/Interfaces/InductiveLoad.mo | 13 ++++++- ...AC_OnePhase_Examples_GeneratorLoadGrid.txt | 15 +++++--- ...sBalanced_Loads_Examples_ParallelLoads.txt | 24 ++++++------- .../Resources/Scripts/BuildingsPy/conf.yml | 4 --- Buildings/package.mo | 36 ++++++++++++------- README.md | 2 +- 6 files changed, 58 insertions(+), 36 deletions(-) diff --git a/Buildings/Electrical/Interfaces/InductiveLoad.mo b/Buildings/Electrical/Interfaces/InductiveLoad.mo index 14cd425372c..c80b4a578eb 100644 --- a/Buildings/Electrical/Interfaces/InductiveLoad.mo +++ b/Buildings/Electrical/Interfaces/InductiveLoad.mo @@ -24,7 +24,11 @@ protected "Magnetic flux"; Modelica.Units.SI.Impedance Z[2] "Impedance of the load"; Modelica.Units.SI.AngularVelocity omega "Angular frequency"; - Modelica.Units.SI.Power Q=P*tan(acos(pf_internal)) + Modelica.Units.SI.Power Q=P*tan(acos( + Buildings.Utilities.Math.Functions.smoothMin( + x1=pf_internal, + x2=0.99999, + deltaX=0.0000025))) "Reactive power (positive because inductive load)"; equation connect(pf_in, pf_internal); @@ -36,6 +40,13 @@ equation annotation (Documentation(revisions="