From e3216636be9c7e0fa905b79828ca7f6a2a6ffcfe Mon Sep 17 00:00:00 2001 From: HOS Date: Tue, 13 Feb 2024 15:52:12 +0100 Subject: [PATCH] Avoid 0.0^0.0. - Having a test for negative base (without passing through zero) would be good, but require more. - Having an integer exponent block would also be good, but too late See #4305 --- ModelicaTest/Blocks.mo | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ModelicaTest/Blocks.mo b/ModelicaTest/Blocks.mo index 9549c9c01d..d1629a24ea 100644 --- a/ModelicaTest/Blocks.mo +++ b/ModelicaTest/Blocks.mo @@ -2064,13 +2064,13 @@ the whole homotopy transformation.

Modelica.Blocks.Math.Exponentiation oneExponent(exponent=1) annotation (Placement(transformation(extent={{0,20},{20,40}}))); Modelica.Blocks.Math.Exponentiation zeroExponent(exponent=0) - annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + annotation (Placement(transformation(extent={{0,-70},{20,-50}}))); Modelica.Blocks.Math.Abs abs1 - annotation (Placement(transformation(extent={{-40,-40},{-20,-20}}))); + annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); Modelica.Blocks.Math.Exponentiation nonInteger(exponent=2.1) - annotation (Placement(transformation(extent={{0,-40},{20,-20}}))); + annotation (Placement(transformation(extent={{0,-10},{20,10}}))); Modelica.Blocks.Math.Exponentiation sqrtExponent(exponent=0.5) - annotation (Placement(transformation(extent={{0,-70},{20,-50}}))); + annotation (Placement(transformation(extent={{0,-40},{20,-20}}))); Modelica.Blocks.Math.Max max1 annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); Modelica.Blocks.Sources.Constant oneTenth(k=0.1) @@ -2080,27 +2080,27 @@ the whole homotopy transformation.

equation connect(negativeToPositiveRamp.y, evenExponent.u) annotation (Line(points={{-79,90},{-2,90}}, color={0,0,127})); - connect(abs1.u, evenExponent.u) annotation (Line(points={{-42,-30},{-50,-30}, - {-50,90},{-2,90}}, + connect(abs1.u, evenExponent.u) annotation (Line(points={{-42,0},{-50,0},{ + -50,90},{-2,90}}, color={0,0,127})); connect(abs1.y, nonInteger.u) - annotation (Line(points={{-19,-30},{-2,-30}},color={0,0,127})); + annotation (Line(points={{-19,0},{-2,0}}, color={0,0,127})); connect(oddExponent.u, evenExponent.u) annotation (Line(points={{-2,60},{ -20,60},{-20,90},{-2,90}}, color={0,0,127})); connect(oneExponent.u, evenExponent.u) annotation (Line(points={{-2,30},{ -20,30},{-20,90},{-2,90}}, color={0,0,127})); - connect(sqrtExponent.u, nonInteger.u) annotation (Line(points={{-2,-60},{ - -10,-60},{-10,-30},{-2,-30}}, color={0,0,127})); + connect(sqrtExponent.u, nonInteger.u) annotation (Line(points={{-2,-30},{ + -10,-30},{-10,0},{-2,0}}, color={0,0,127})); connect(max1.y, inverse.u) annotation (Line(points={{-19,-90},{-2,-90}}, color={0,0,127})); - connect(zeroExponent.u, evenExponent.u) annotation (Line(points={{-2,0},{ - -20,0},{-20,90},{-2,90}}, color={0,0,127})); connect(max1.u1, evenExponent.u) annotation (Line(points={{-42,-84},{-50, -84},{-50,90},{-2,90}}, color={0,0,127})); connect(oneTenth.y, max1.u2) annotation (Line(points={{-59,-90},{-50,-90},{ -50,-96},{-42,-96}}, color={0,0,127})); + connect(max1.y, zeroExponent.u) annotation (Line(points={{-19,-90},{-10,-90}, + {-10,-60},{-2,-60}}, color={0,0,127})); annotation (experiment(StopTime=1.0)); end Exponentiation;