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

Reformulated InductiveLoad to avoid infinite value #1867

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 13 additions & 2 deletions IBPSA/Electrical/Interfaces/InductiveLoad.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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(
IBPSA.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);
Expand All @@ -36,6 +40,13 @@ equation
annotation (Documentation(revisions="<html>
<ul>
<li>
April 4, 2024, by Michael Wetter:<br/>
Reformulated calculation of reactive power to bound argument of tangent away from &pi;,
which avoids an infinite function value.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3776\">Buildings, #3776</a>.
</li>
<li>
June 06, 2014, by Marco Bonvini:<br/>
Added power factor input <code>pf_in</code> and updated documentation.
</li>
Expand All @@ -45,7 +56,7 @@ Created documentation.
</li>
<li>
October 31, 2013, by Marco Bonvini:<br/>
Model included into the IBPSA library.
Model included into the Buildings library.
</li>
</ul>
</html>", info="<html>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
last-generated=2015-05-08
statistics-simulation={'numerical Jacobians': '0', 'nonlinear': ' ', 'linear': '0'}
grid.P.real=[5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 4833.33348615961403993424, 4666.66645920329392538406, 4499.99992052691322896862, 4333.33350602774044091348, 4166.6666032476086911629, 3999.99994039562170655699, 3833.33328175553242544993, 3666.66686725563204163336, 3499.99996026374765278888, 3333.3333016238038908341, 3166.6666387713808035187, 2999.99998013187405376812, 2833.33332149207581096562, 2666.66665863965272365022, 2500., 2333.33309300811561115552, 2166.66692686000988032902, 2000.00001986819847843435, 1833.33323494604542247544, 1666.66682465855183181702, 1500.0000397363978663634, 1333.33325481424390090979, 1166.66684452675031025137, 1000.00005960459634479776, 833.33321364746893777919, 666.66692542966939072357, 500.00007947265021357452, 333.33326403313640184933, 166.666433334760768048, 0.00009934086479290727, -166.6667313574441777746, -333.33356205564700758259, -499.999880790915540274, -666.66672674804385678726, -833.33351167027058181702, -999.99986092286258099193, -1166.66664584476097843435, -1333.33355283657260770269, -1499.99984105440853454638, -1666.6666259765625, -1833.33353296607856464107, -2000.00031788644605512673, -2166.66722487479773917585, -2333.33289433218396879965, -2499.99980132169957869337, -2666.66670830974044292816, -2833.3333711609780038998, -3000.00027814962095362716, -3166.66718513913656352088, -3333.33285459652279314469, -3499.9997615860384030384, -3666.66666857497239107033, -3833.33333142502760892967, -4000.0002384139615969616, -4166.66690126576304464834, -4333.33305899828701512888, -4499.99972184834223298822, -4666.66638470014368067496, -4833.33353583030293521006, -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000., -5000.]
grid.P.apparent=[5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 4834.29100581935745140072, 4670.63325724062542576576, 4509.24943546803297067527, 4350.39356409194715524791, 4194.35263135346940543968, 4041.45185034590394934639, 3892.06228230378928856226, 3746.60361846113937644986, 3605.55123658723596236086, 3469.44339930719343101373, 3338.88419411656786905951, 3214.5502786307770293206, 3097.19120983075617914437, 2987.62885019220721005695, 2886.75146484375, 2795.49894232645283409511, 2714.8426110333616634307, 2645.75122836090895361849, 2589.15108238512266325415, 2545.87553330332912082667, 2516.61157787450383693795, 2501.85106998240507891751, 2501.85106645211772047332, 2516.61156489087488807854, 2545.87551079228933303966, 2589.15105334101372136502, 2645.75119126407798830769, 2714.84256562420250702417, 2795.49914813551959014148, 2886.75140806592980879941, 2987.62894424220849032281, 3097.19131209085890077404, 3214.55020694091172117624, 3338.88430790474740206264, 3469.44351910377417880227, 3605.55115422720064088935, 3746.60353276435625957674, 3892.06241452586073137354, 4041.45176042761931967107, 4194.3525390625, 4350.39370515641348902136, 4509.24981768563338846434, 4670.63376650683130719699, 4834.29066262712422030745, 4999.99980154434069845593, 5167.56245988334649155149, 5336.80432093938543403056, 5507.57059891875178436749, 5679.72408633097620622721, 5853.14069868674050667323, 6027.71361683476698090089, 6203.34415434489528706763, 6379.94539696952779195271, 6557.4387311864384173532, 6735.75335592334431566996, 6914.8252132104707925464, 7094.59882062216001941124, 7275.02037859018855670001, 7456.04398855378076405032, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625, 7637.6259765625]
time=[0., 1.]
last-generated=2024-04-04
statistics-simulation=
{
"linear": "0",
"nonlinear": " ",
"numerical Jacobians": "0"
}
time=[0e+00, 1e+00]
grid.P.real=[5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 5e+03, 4.833333486159614e+03, 4.666666459203294e+03, 4.499999920526913e+03, 4.33333350602774e+03, 4.166666603247609e+03, 3.999999940395622e+03, 3.833333281755532e+03, 3.666666867255632e+03, 3.499999960263748e+03, 3.333333301623804e+03, 3.166666638771381e+03, 2.999999980131874e+03, 2.833333321492076e+03, 2.666666658639653e+03, 2.5e+03, 2.333333093008116e+03, 2.16666692686001e+03, 2.000000019868198e+03, 1.833333234946045e+03, 1.666666824658552e+03, 1.500000039736398e+03, 1.333333254814244e+03, 1.16666684452675e+03, 1.000000059604596e+03, 8.333332136474689e+02, 6.666669254296694e+02, 5.000000794726502e+02, 3.333332640331364e+02, 1.666664333347608e+02, 9.934086505580808e-05, -1.666667313574442e+02, -3.33333562055647e+02, -4.999998807909155e+02, -6.666667267480439e+02, -8.333335116702706e+02, -9.999998609228626e+02, -1.166666645844761e+03, -1.333333552836573e+03, -1.499999841054409e+03, -1.666666625976562e+03, -1.833333532966079e+03, -2.000000317886446e+03, -2.166667224874798e+03, -2.333332894332184e+03, -2.4999998013217e+03, -2.66666670830974e+03, -2.833333371160978e+03, -3.000000278149621e+03, -3.166667185139137e+03, -3.333332854596523e+03, -3.499999761586038e+03, -3.666666668574972e+03, -3.833333331425028e+03, -4.000000238413962e+03, -4.166666901265763e+03, -4.333333058998287e+03, -4.499999721848342e+03, -4.666666384700144e+03, -4.833333535830303e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03, -5e+03]
grid.P.apparent=[5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 5.0000498046875e+03, 4.833897939385459e+03, 4.669765093045849e+03, 4.507873458652912e+03, 4.348472665687626e+03, 4.191846284056652e+03, 4.03831806104941e+03, 3.888254665240271e+03, 3.742073101415614e+03, 3.600245816472694e+03, 3.463308145654874e+03, 3.331862953278726e+03, 3.206585923045612e+03, 3.088227587210179e+03, 2.977612980471399e+03, 2.87563623046875e+03, 2.783246499818916e+03, 2.701428061505466e+03, 2.631166999984546e+03, 2.573410114638883e+03, 2.529014694770704e+03, 2.498692388666142e+03, 2.48295897948644e+03, 2.482092278465293e+03, 2.496107658888839e+03, 2.524757102270478e+03, 2.567550712158811e+03, 2.62379684570589e+03, 2.692652379995837e+03, 2.773178347249496e+03, 2.864390324087376e+03, 2.965303016534463e+03, 3.074961087647957e+03, 3.192463292764907e+03, 3.31697683724848e+03, 3.447741370925297e+03, 3.584072882551323e+03, 3.725360857011919e+03, 3.87106217064717e+03, 4.020696633241664e+03, 4.17384228515625e+03, 4.330125638978333e+03, 4.489220032971753e+03, 4.650835915600903e+03, 4.814718884806662e+03, 4.98064726222282e+03, 5.148421834833287e+03, 5.317868285926324e+03, 5.48883182970531e+03, 5.661174770411334e+03, 5.834773999037261e+03, 6.009522210340299e+03, 6.185321693328235e+03, 6.362085045482697e+03, 6.539734141559217e+03, 6.718198668772585e+03, 6.897414080026612e+03, 7.07732587117524e+03, 7.257880730058394e+03, 7.439031781552799e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03, 7.62073681640625e+03]
Loading
Loading