From b3a85dc4acc98644bc610bdf0ffb7f283054d269 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 13:41:22 +0100 Subject: [PATCH 01/22] Some generic Formatting guides - consistent with how classes are usually written. --- Modelica/package.mo | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modelica/package.mo b/Modelica/package.mo index c44e2f4de8..df802d4a23 100644 --- a/Modelica/package.mo +++ b/Modelica/package.mo @@ -1300,6 +1300,14 @@ be defined like: tab=\"Controller\", group=\"Speed control\")); +

Whitespace and Indentation

+

+Trailing white-space (i.e., white-space at the end of the lines) shall not be used. +The tab-character shall not be used, since the tab-stops are not standardized.

+

The code in a class shall be indented relative to the class in steps of two spaces; +except that the headings public, protected, equation, algorithm, and end of class marker shall not be indented. +The keywords public and protected are headings for a group of declarations. +

")); end Format; From c7d5c7f4ab1759d48a99c7b93ef99ff03fe02d6f Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 13:50:57 +0100 Subject: [PATCH 02/22] Use protected as a heading for a number of declarations. I believe that the previous formatting in Digitial is due to someone having protected A protected B protected C (which would be another style). Then the subsequent protected were lost, and first protected formatted on a separate line. --- .../RealSignals/TimeBasedSources/Sine.mo | 3 +- Modelica/Electrical/Digital.mo | 42 +++++++++---------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/Modelica/Clocked/RealSignals/TimeBasedSources/Sine.mo b/Modelica/Clocked/RealSignals/TimeBasedSources/Sine.mo index 65204c38ee..cb69ebef89 100644 --- a/Modelica/Clocked/RealSignals/TimeBasedSources/Sine.mo +++ b/Modelica/Clocked/RealSignals/TimeBasedSources/Sine.mo @@ -10,8 +10,7 @@ block Sine "Generate sine signal" "Output = offset for time < startTime"; protected constant Real pi=Modelica.Constants.pi; -protected - SI.Time simTime; + SI.Time simTime; equation simTime = sample(time); y = offset + (if simTime < startTime then 0 else amplitude* diff --git a/Modelica/Electrical/Digital.mo b/Modelica/Electrical/Digital.mo index ecd490a3c6..f4a6d9542a 100644 --- a/Modelica/Electrical/Digital.mo +++ b/Modelica/Electrical/Digital.mo @@ -6112,9 +6112,9 @@ NC = no change annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); protected - D.Interfaces.Logic nextstate(start=L.'U'); - D.Interfaces.DigitalOutput yy(start=L.'U'); - D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL,y(start=L.'U', fixed=true)); + D.Interfaces.Logic nextstate(start=L.'U'); + D.Interfaces.DigitalOutput yy(start=L.'U'); + D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL,y(start=L.'U', fixed=true)); algorithm nextstate := T.NXferTable[enable, x]; yy := nextstate; @@ -6194,9 +6194,9 @@ UX: if dataIn == U then U else X annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); protected - D.Interfaces.Logic nextstate(start=L.'U'); - D.Interfaces.DigitalOutput yy(start=L.'U'); - D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U', fixed=true)); + D.Interfaces.Logic nextstate(start=L.'U'); + D.Interfaces.DigitalOutput yy(start=L.'U'); + D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U', fixed=true)); algorithm nextstate := T.NRXferTable[enable, x]; yy := nextstate; @@ -6276,9 +6276,9 @@ Strength Reduced: 0 -> L, 1 -> H, X -> W annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); protected - D.Interfaces.Logic nextstate(start=L.'U'); - D.Interfaces.DigitalOutput yy(start=L.'U'); - D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL); + D.Interfaces.Logic nextstate(start=L.'U'); + D.Interfaces.DigitalOutput yy(start=L.'U'); + D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL); algorithm nextstate := T.PXferTable[enable, x]; yy := nextstate; @@ -6357,8 +6357,7 @@ UX: if dataIn == U then U else X D.Interfaces.DigitalOutput y annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); - protected - D.Interfaces.Logic nextstate(start=L.'U'); + protected D.Interfaces.Logic nextstate(start=L.'U'); D.Interfaces.DigitalOutput yy(start=L.'U'); D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL); algorithm @@ -6439,8 +6438,7 @@ UX: if dataIn == U then U else X D.Interfaces.DigitalOutput y annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); - protected - D.Interfaces.Logic nextstate(start=L.'U'); + protected D.Interfaces.Logic nextstate(start=L.'U'); D.Interfaces.DigitalOutput yy(start=L.'U'); D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U', fixed=true)); algorithm @@ -6518,8 +6516,7 @@ DataOut*: Strength map for DataOut according to tristate table Buf3sTable D.Interfaces.DigitalOutput y annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); - protected - D.Interfaces.Logic nextstate(start=L.'U'); + protected D.Interfaces.Logic nextstate(start=L.'U'); D.Interfaces.DigitalOutput yy(start=L.'U'); D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL); algorithm @@ -6597,8 +6594,7 @@ DataOut*: Strength map for DataOut according to tristate table Buf3slTable D.Interfaces.DigitalOutput y annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); - protected - D.Interfaces.Logic nextstate(start=L.'U'); + protected D.Interfaces.Logic nextstate(start=L.'U'); D.Interfaces.DigitalOutput yy(start=L.'U'); D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U',fixed=true)); algorithm @@ -6682,9 +6678,9 @@ DataOut*: Strength map for DataOut according to tristate table Buf3sTable annotation (Placement(transformation(extent={{80,-20},{100,0}}), iconTransformation(extent={{80,-20},{100,0}}))); protected - D.Interfaces.Logic nextstate(start=L.'U'); - D.Interfaces.DigitalOutput yy(start=L.'U'); - D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL); + D.Interfaces.Logic nextstate(start=L.'U'); + D.Interfaces.DigitalOutput yy(start=L.'U'); + D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL); algorithm nextstate := T.Buf3sTable[strength, T.UX01Conv[T.NotTable[enable]], T.UX01Conv[T.NotTable[x]]]; yy := nextstate; @@ -7004,9 +7000,9 @@ Z = L.'Z' iconTransformation(extent={{80,-10},{100,10}}))); protected - D.Interfaces.Logic nextstate(start=L.'U'); - D.Interfaces.DigitalOutput yy(start=L.'U'); - D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U',fixed=true)); + D.Interfaces.Logic nextstate(start=L.'U'); + D.Interfaces.DigitalOutput yy(start=L.'U'); + D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U',fixed=true)); algorithm nextstate := T.MUX2x1Table[T.UX01Conv[in1], T.UX01Conv[sel], T.UX01Conv[in0]]; From 9b42089518a42f6122dbee4ad081e92f228e6695 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:02:39 +0100 Subject: [PATCH 03/22] Avoid bad line-breaks in connect-annotation. --- .../Electrical/Analog/Examples/Utilities/DirectCapacitor.mo | 6 ++---- .../Machines/Examples/DCMachines/DCPM_CurrentControlled.mo | 3 +-- .../Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo | 3 +-- .../Electrical/PowerConverters/Examples/ACAC/SoftStarter.mo | 3 +-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo b/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo index 17213f5048..4e54b3116f 100644 --- a/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo +++ b/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo @@ -45,11 +45,9 @@ equation connect(currentSource.p, ground.p) annotation (Line(points={{-40,-10},{-20,-10}}, color={0,0,255})); connect(ground.p, capacitor.n) - annotation (Line(points={{-20,-10},{0,-10}}, - color={0,0,255})); + annotation (Line(points={{-20,-10},{0,-10}}, color={0,0,255})); connect(currentSource.n, capacitor.p) - annotation (Line(points={{-40,10},{0,10}}, - color={0,0,255})); + annotation (Line(points={{-40,10},{0,10}}, color={0,0,255})); annotation (Icon(coordinateSystem( preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Text( diff --git a/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo b/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo index 9a03793dc9..914c5358d1 100644 --- a/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo +++ b/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo @@ -90,8 +90,7 @@ equation connect(dcpm.flange, loadInertia.flange_a) annotation (Line( points={{20,-20},{40,-20}})); connect(dcpm.pin_an, ground.p) - annotation (Line(points={{4,-10},{4,0},{-8,0}}, - color={0,0,255})); + annotation (Line(points={{4,-10},{4,0},{-8,0}},color={0,0,255})); connect(signalVoltage.p, currentSensor.p) annotation (Line(points={{20,30},{20,20}}, color={0,0,255})); connect(currentSensor.n, dcpm.pin_ap) diff --git a/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo b/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo index 7be025fa04..2f0eb4815a 100644 --- a/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo +++ b/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo @@ -39,8 +39,7 @@ equation connect(ToSpacePhasor1.y, ToPolar1.u) annotation (Line( points={{0,-1},{0,-18}}, color={0,0,127})); connect(ToPolar1.y[1], Gain1.u) annotation (Line( - points={{0,-41},{0,-50.5},{0,-58}}, - color={0,0,127})); + points={{0,-41},{0,-50.5},{0,-58}}, color={0,0,127})); connect(Gain1.y, I) annotation (Line( points={{0,-81},{0,-110}}, color={0,0,127})); annotation (defaultComponentName="currentRMSSensor", diff --git a/Modelica/Electrical/PowerConverters/Examples/ACAC/SoftStarter.mo b/Modelica/Electrical/PowerConverters/Examples/ACAC/SoftStarter.mo index 7d15468838..aa2f6c7b22 100644 --- a/Modelica/Electrical/PowerConverters/Examples/ACAC/SoftStarter.mo +++ b/Modelica/Electrical/PowerConverters/Examples/ACAC/SoftStarter.mo @@ -151,8 +151,7 @@ equation connect(multiSensor.pc, multiSensor.pv) annotation (Line(points={{-10,40},{-10,50},{0,50}}, color={0,0,255})); connect(multiSensor.nv,star2. plug_p) - annotation (Line(points={{0,30},{0,10}}, - color={0,0,255})); + annotation (Line(points={{0,30},{0,10}}, color={0,0,255})); connect(terminalBox.plug_sn, imc.plug_sn) annotation (Line(points={{14,10},{14,10}}, color={0,0,255})); connect(terminalBox.plug_sp, imc.plug_sp) From a2c97aa6e0b23cacb6c4daa0becff6e06f9c4863 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:03:24 +0100 Subject: [PATCH 04/22] Do not use tab. (Additional changes would be good.) --- Modelica/Fluid/Pipes.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Fluid/Pipes.mo b/Modelica/Fluid/Pipes.mo index 8f88e05545..6c3ac9adac 100644 --- a/Modelica/Fluid/Pipes.mo +++ b/Modelica/Fluid/Pipes.mo @@ -940,7 +940,7 @@ This also allows for taking into account friction losses with respect to the act // Assumptions parameter Boolean allowFlowReversal=system.allowFlowReversal - "= true, if flow reversal is enabled, otherwise restrict flow to design direction (states[1] -> states[n+1])" + "= true, if flow reversal is enabled, otherwise restrict flow to design direction (states[1] -> states[n+1])" annotation(Dialog(tab="Internal interface",enable=false,group="Assumptions"), Evaluate=true); parameter Modelica.Fluid.Types.Dynamics momentumDynamics=system.momentumDynamics "Formulation of momentum balance" From 8d7eaab50edc76ea0b9df81adeab4d70dcd3e197 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:04:29 +0100 Subject: [PATCH 05/22] Remove trailing white-space --- Modelica/Math/isPowerOf2.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Math/isPowerOf2.mo b/Modelica/Math/isPowerOf2.mo index 30b9e5c835..ad2c53ae94 100644 --- a/Modelica/Math/isPowerOf2.mo +++ b/Modelica/Math/isPowerOf2.mo @@ -3,7 +3,7 @@ function isPowerOf2 "Determine if the integer input is a power of 2" extends Modelica.Icons.Function; input Integer i(min=1) "Integer scalar"; output Boolean result "= true, if integer scalar is a power of 2"; -protected +protected Integer target; Integer powOf2; algorithm From d4a6596de0639201ac981da6dba510c3e15d3689 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:08:12 +0100 Subject: [PATCH 06/22] The end of a class shall not be indented relative to class. --- Modelica/Media/Air/ReferenceAir.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Media/Air/ReferenceAir.mo b/Modelica/Media/Air/ReferenceAir.mo index 89511e4b5f..eba53e9444 100644 --- a/Modelica/Media/Air/ReferenceAir.mo +++ b/Modelica/Media/Air/ReferenceAir.mo @@ -2149,4 +2149,4 @@ Some parts of this library refer to the ThermoFluid library developed at Lund Un Copyright © 2013-2020, Modelica Association and contributors

")); -end ReferenceAir; + end ReferenceAir; From 554af2d1c705fa84695e12e55777915fb4a6182b Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:10:52 +0100 Subject: [PATCH 07/22] RemoveTrailingWhiteSpace --- Modelica/Thermal/FluidHeatFlow/Examples/ParallelCooling.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Thermal/FluidHeatFlow/Examples/ParallelCooling.mo b/Modelica/Thermal/FluidHeatFlow/Examples/ParallelCooling.mo index 062453a81e..51217d1442 100644 --- a/Modelica/Thermal/FluidHeatFlow/Examples/ParallelCooling.mo +++ b/Modelica/Thermal/FluidHeatFlow/Examples/ParallelCooling.mo @@ -9,7 +9,7 @@ model ParallelCooling "Cooling circuit with parallel branches" output SI.TemperatureDifference dTSource1= prescribedHeatFlow1.port.T-TAmb "Temperature difference between heat source 1 and ambient condition"; output SI.TemperatureDifference dTtoPipe1=prescribedHeatFlow1.port.T-pipe1.T_q - "Temperature difference between heat source 1 and coolant in pipe 1"; + "Temperature difference between heat source 1 and coolant in pipe 1"; output SI.TemperatureDifference dTCoolant1=pipe1.dT "Coolant1's temperature increase in pipe 1"; output SI.TemperatureDifference dTSource2= From 27cdec988ff96d60b88b82d34df121f59bf5ce26 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:11:19 +0100 Subject: [PATCH 08/22] NoTab --- Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo b/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo index 590ce346fb..eb27ea6557 100644 --- a/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo +++ b/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo @@ -4,7 +4,7 @@ model RelTemperatureSensor "Temperature difference sensor" extends FluidHeatFlow.Interfaces.RelativeSensorBase; Modelica.Blocks.Interfaces.RealOutput y(unit="K") "Temperature difference as output signal" - annotation (absoluteValue = false, Placement(transformation( + annotation (absoluteValue = false, Placement(transformation( origin={0,-110}, extent={{10,-10},{-10,10}}, rotation=90))); From 7d67b7d044a7a357d2517b80e7f3213f4ce13974 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:15:54 +0100 Subject: [PATCH 09/22] Even for redeclare extends ensure that class contents is indented relative to class. --- Modelica/Media/IdealGases/Common/package.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modelica/Media/IdealGases/Common/package.mo b/Modelica/Media/IdealGases/Common/package.mo index 38f64cf045..996516ac12 100644 --- a/Modelica/Media/IdealGases/Common/package.mo +++ b/Modelica/Media/IdealGases/Common/package.mo @@ -147,7 +147,7 @@ Temperature T (= " + String(T) + " K) is not in the allowed range end setState_dTX; redeclare function extends setSmoothState - "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" + "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" algorithm state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small), T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small)); @@ -687,7 +687,7 @@ required from medium model \"" + mediumName + "\"."); end setState_dTX; redeclare function extends setSmoothState - "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" + "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" algorithm state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small), T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small), @@ -943,7 +943,7 @@ end gasMixtureViscosity; redeclare replaceable function extends dynamicViscosity "Return mixture dynamic viscosity" - protected + protected DynamicViscosity[nX] etaX "Component dynamic viscosities"; algorithm for i in 1:nX loop @@ -1206,7 +1206,7 @@ end lowPressureThermalConductivity; "Return thermal conductivity for low pressure gas mixtures" input Integer method=methodForThermalConductivity "Method to compute single component thermal conductivity"; - protected + protected ThermalConductivity[nX] lambdaX "Component thermal conductivities"; DynamicViscosity[nX] eta "Component thermal dynamic viscosities"; SpecificHeatCapacity[nX] cp "Component heat capacity"; From 9381d61b46ec179e8fd40a81cd4cfe785e456048 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:20:12 +0100 Subject: [PATCH 10/22] Indent annotation relative to class --- Modelica/Media/Air/ReferenceMoistAir.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Media/Air/ReferenceMoistAir.mo b/Modelica/Media/Air/ReferenceMoistAir.mo index fa8ae0f1df..c783b8c278 100644 --- a/Modelica/Media/Air/ReferenceMoistAir.mo +++ b/Modelica/Media/Air/ReferenceMoistAir.mo @@ -1859,7 +1859,7 @@ package ReferenceMoistAir rho := max(p/(g.R_s*T*g.pi*g.gpi), 1e-9); h_der := (1/rho - T*vt)*p_der - g.R_s*g.tau*g.tau*g.gtautau*T_der; end h_pT_der; - annotation (Documentation(info=" + annotation (Documentation(info="

This is a makeshift package avoiding the region validity checks of the IF97 utility functions BaseIF97.Basic.g2, From f04eb52b9d92209e8164600e41c7b8eb9bed016b Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 14:37:02 +0100 Subject: [PATCH 11/22] Documentation shall be indented relative to class --- Modelica/Utilities/Streams.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Utilities/Streams.mo b/Modelica/Utilities/Streams.mo index d6bac5d591..148169eb43 100644 --- a/Modelica/Utilities/Streams.mo +++ b/Modelica/Utilities/Streams.mo @@ -211,8 +211,8 @@ See Ex output Real matrix[nrow, ncol] "2D Real array"; external "C" ModelicaIO_readRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2), verboseRead) annotation(IncludeDirectory="modelica://Modelica/Resources/C-Sources", Include="#include \"ModelicaIO.h\"", Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); - annotation( -Documentation(info=" + annotation(Documentation(info= + "

Syntax

 matrix = Streams.readRealMatrix(fileName, matrixName, nrow, ncol, verboseRead)

From 3ad98fa5d81503d74f6c0e1dbfd4496304680822 Mon Sep 17 00:00:00 2001
From: HOS 
Date: Thu, 2 Nov 2023 14:37:55 +0100
Subject: [PATCH 12/22] And sensible formatting

---
 Modelica/Utilities/Streams.mo | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Modelica/Utilities/Streams.mo b/Modelica/Utilities/Streams.mo
index 148169eb43..ceed866f44 100644
--- a/Modelica/Utilities/Streams.mo
+++ b/Modelica/Utilities/Streams.mo
@@ -211,8 +211,7 @@ See Ex
     output Real matrix[nrow, ncol] "2D Real array";
     external "C" ModelicaIO_readRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2), verboseRead)
     annotation(IncludeDirectory="modelica://Modelica/Resources/C-Sources", Include="#include \"ModelicaIO.h\"", Library={"ModelicaIO", "ModelicaMatIO", "zlib"});
-    annotation(Documentation(info=
-                   "
+    annotation(Documentation(info="
 

Syntax

 matrix = Streams.readRealMatrix(fileName, matrixName, nrow, ncol, verboseRead)

From e88b12c0c2fc05ed861890af3f35ee326b5d46ab Mon Sep 17 00:00:00 2001
From: HOS 
Date: Thu, 2 Nov 2023 14:50:39 +0100
Subject: [PATCH 13/22] Use protected as heading consistently.

---
 Modelica/Electrical/Digital.mo | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/Modelica/Electrical/Digital.mo b/Modelica/Electrical/Digital.mo
index f4a6d9542a..7f28cc815f 100644
--- a/Modelica/Electrical/Digital.mo
+++ b/Modelica/Electrical/Digital.mo
@@ -6357,9 +6357,10 @@ UX: if dataIn == U then U else X
       D.Interfaces.DigitalOutput y
         annotation (Placement(transformation(extent={{80,-20},{100,0}}),
             iconTransformation(extent={{80,-20},{100,0}})));
-    protected D.Interfaces.Logic nextstate(start=L.'U');
-              D.Interfaces.DigitalOutput yy(start=L.'U');
-              D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL);
+    protected
+      D.Interfaces.Logic nextstate(start=L.'U');
+      D.Interfaces.DigitalOutput yy(start=L.'U');
+      D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL);
     algorithm
       nextstate := T.PRXferTable[enable, x];
       yy := nextstate;
@@ -6438,9 +6439,10 @@ UX: if dataIn == U then U else X
       D.Interfaces.DigitalOutput y
         annotation (Placement(transformation(extent={{80,-20},{100,0}}),
             iconTransformation(extent={{80,-20},{100,0}})));
-    protected D.Interfaces.Logic nextstate(start=L.'U');
-              D.Interfaces.DigitalOutput yy(start=L.'U');
-              D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U', fixed=true));
+    protected
+      D.Interfaces.Logic nextstate(start=L.'U');
+      D.Interfaces.DigitalOutput yy(start=L.'U');
+      D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U', fixed=true));
     algorithm
       nextstate := T.Buf3sTable[strength, T.UX01Conv[enable], T.UX01Conv[x]];
       yy := nextstate;
@@ -6516,9 +6518,10 @@ DataOut*: Strength map for DataOut according to tristate table Buf3sTable
       D.Interfaces.DigitalOutput y
         annotation (Placement(transformation(extent={{80,-20},{100,0}}),
             iconTransformation(extent={{80,-20},{100,0}})));
-    protected D.Interfaces.Logic nextstate(start=L.'U');
-              D.Interfaces.DigitalOutput yy(start=L.'U');
-              D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL);
+    protected
+      D.Interfaces.Logic nextstate(start=L.'U');
+      D.Interfaces.DigitalOutput yy(start=L.'U');
+      D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL);
     algorithm
       nextstate := T.Buf3slTable[strength, T.UX01Conv[enable], T.UX01Conv[x]];
       yy := nextstate;
@@ -6594,9 +6597,10 @@ DataOut*: Strength map for DataOut according to tristate table Buf3slTable
       D.Interfaces.DigitalOutput y
         annotation (Placement(transformation(extent={{80,-20},{100,0}}),
             iconTransformation(extent={{80,-20},{100,0}})));
-    protected D.Interfaces.Logic nextstate(start=L.'U');
-              D.Interfaces.DigitalOutput yy(start=L.'U');
-              D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U',fixed=true));
+    protected
+     D.Interfaces.Logic nextstate(start=L.'U');
+     D.Interfaces.DigitalOutput yy(start=L.'U');
+     D.Delay.InertialDelaySensitive inertialDelaySensitive(tLH=tLH, tHL=tHL, y(start=L.'U',fixed=true));
     algorithm
       nextstate := T.Buf3sTable[strength, T.UX01Conv[enable], T.UX01Conv[T.NotTable[x]]];
       yy := nextstate;

From 85fdcd0c580e887c2949b87d0d068cf23291e30a Mon Sep 17 00:00:00 2001
From: HOS 
Date: Thu, 2 Nov 2023 15:03:46 +0100
Subject: [PATCH 14/22] Remove weird line-breaks and format equation
 consistently.

---
 .../Electrical/QuasiStatic/Polyphase.mo       | 36 +++++++------------
 ModelicaTest/Fluid/Dissipation.mo             | 21 ++++-------
 .../Fluid/TestComponents/NewFittings.mo       |  3 +-
 ModelicaTest/Math.mo                          |  6 ++--
 ModelicaTest/Tables/CombiTable2Ds.mo          | 10 +++---
 ModelicaTest/Tables/CombiTable2Dv.mo          |  4 +--
 ModelicaTest/Tables/CombiTimeTable.mo         | 16 ++++-----
 7 files changed, 38 insertions(+), 58 deletions(-)

diff --git a/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo b/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo
index 76b907914d..04e8070695 100644
--- a/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo
+++ b/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo
@@ -14,26 +14,19 @@ package Polyphase "Polyphase quasi-static package"
                                                                              annotation (Placement(transformation(extent={{-90,20},{-70,40}})));
     Modelica.Electrical.QuasiStatic.Polyphase.Basic.Admittance admittance(Y_ref=fill(Complex(0.5,0.5),m), m=m)
                                                                                                     annotation (Placement(transformation(extent={{-60,20},{-40,40}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableResistor variableResistor(m=m)
-                                                                                           annotation (Placement(transformation(extent={{-30,20},{-10,40}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableConductor variableConductor(m=m)
-                                                                                             annotation (Placement(transformation(extent={{0,20},{20,40}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Conductor conductor(G_ref=fill(1,m), m=m)
-                                                                                              annotation (Placement(transformation(
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableResistor variableResistor(m=m) annotation (Placement(transformation(extent={{-30,20},{-10,40}})));
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableConductor variableConductor(m=m) annotation (Placement(transformation(extent={{0,20},{20,40}})));
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Conductor conductor(G_ref=fill(1,m), m=m) annotation (Placement(transformation(
           extent={{-10,-10},{10,10}},
           rotation=90,
           origin={-90,10})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableCapacitor variableCapacitor(m=m)
-                                                                                             annotation (Placement(transformation(extent={{30,20},{50,40}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableInductor variableInductor(m=m)
-                                                                                           annotation (Placement(transformation(extent={{60,20},{80,40}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableImpedance variableImpedance(m=m)
-                                                                                             annotation (Placement(transformation(
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableCapacitor variableCapacitor(m=m) annotation (Placement(transformation(extent={{30,20},{50,40}})));
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableInductor variableInductor(m=m) annotation (Placement(transformation(extent={{60,20},{80,40}})));
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableImpedance variableImpedance(m=m) annotation (Placement(transformation(
           extent={{-10,-10},{10,10}},
           rotation=180,
           origin={70,-40})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableAdmittance variableAdmittance(m=m)
-                                                                                               annotation (Placement(transformation(
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.VariableAdmittance variableAdmittance(m=m) annotation (Placement(transformation(
           extent={{-10,-10},{10,10}},
           rotation=180,
           origin={40,-40})));
@@ -54,8 +47,7 @@ package Polyphase "Polyphase quasi-static package"
       duration=1,
       offset=10,
       startTime=0) annotation (Placement(transformation(extent={{-100,-30},{-80,-10}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star(m=m)
-                                                                   annotation (Placement(transformation(
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star(m=m) annotation (Placement(transformation(
           extent={{10,-10},{-10,10}},
           rotation=90,
           origin={-50,-60})));
@@ -94,13 +86,11 @@ package Polyphase "Polyphase quasi-static package"
     extends Modelica.Icons.Example;
     parameter Integer m = 3 "Number of phases" annotation(Evaluate=true);
     output SI.ComplexCurrent I[m] = currentSensor.i "Current";
-    Modelica.Electrical.QuasiStatic.Polyphase.Ideal.Idle idle(m=m)
-                                                                   annotation (Placement(transformation(
+    Modelica.Electrical.QuasiStatic.Polyphase.Ideal.Idle idle(m=m) annotation (Placement(transformation(
           extent={{-10,-10},{10,10}},
           rotation=270,
           origin={-50,10})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Ideal.Short short(m=m)
-                                                                     annotation (Placement(transformation(extent={{-80,20},{-60,40}})));
+    Modelica.Electrical.QuasiStatic.Polyphase.Ideal.Short short(m=m) annotation (Placement(transformation(extent={{-80,20},{-60,40}})));
     Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealCommutingSwitch idealCommutingSwitch(m=m,
       Ron=fill(1E-5, m),
       Goff=fill(1E-5, m))                                                                          annotation (Placement(transformation(extent={{30,20},{50,40}})));
@@ -163,8 +153,7 @@ package Polyphase "Polyphase quasi-static package"
     Modelica.ComplexBlocks.Sources.ComplexConstant const_admittance[m](k=fill(Complex(0.5, 0.5), m)) annotation (Placement(transformation(extent={{-60,-50},{-40,-30}})));
     Modelica.ComplexBlocks.Sources.ComplexConstant const_impedance[m](k=fill(Complex(2, 2), m)) annotation (Placement(transformation(extent={{-30,-70},{-10,-50}})));
     Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentSensor currentSensor annotation (Placement(transformation(extent={{-60,-30},{-80,-10}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star(m=m)
-                                                                   annotation (Placement(transformation(
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star(m=m) annotation (Placement(transformation(
           extent={{-10,-10},{10,10}},
           rotation=270,
           origin={-90,-40})));
@@ -226,8 +215,7 @@ package Polyphase "Polyphase quasi-static package"
       fStart=0.01,
       fStop=100) annotation (Placement(transformation(extent={{-20,-60},{-40,-40}})));
     Modelica.Electrical.QuasiStatic.Polyphase.Basic.Capacitor capacitor(C=fill(1, 3)) annotation (Placement(transformation(extent={{-40,-30},{-20,-10}})));
-    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starI
-                                                                   annotation (Placement(transformation(extent={{-20,-90},{-40,-70}})));
+    Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starI     annotation (Placement(transformation(extent={{-20,-90},{-40,-70}})));
     Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundI annotation (Placement(transformation(extent={{-70,-100},{-50,-80}})));
   equation
     connect(voltageSource.plug_p, inductor.plug_p) annotation (Line(points={{-40,50},{-50,50},{-50,80},{-40,80}}, color={85,170,255}));
diff --git a/ModelicaTest/Fluid/Dissipation.mo b/ModelicaTest/Fluid/Dissipation.mo
index d36dff61a3..1288152bf9 100644
--- a/ModelicaTest/Fluid/Dissipation.mo
+++ b/ModelicaTest/Fluid/Dissipation.mo
@@ -1397,10 +1397,8 @@ extends Modelica.Icons.ExamplesPackage;
             annotation (Placement(transformation(extent={{40,-20},{60,0}})));
 
           //output variables
-          SI.MassFlowRate m_flow[n] "Mass flow rate"
-                                                     annotation (Dialog(group="Output"));
-          SI.NusseltNumber Nu[n] "Nusselt number"
-                                                  annotation (Dialog(group="Output"));
+          SI.MassFlowRate m_flow[n] "Mass flow rate" annotation (Dialog(group="Output"));
+          SI.NusseltNumber Nu[n] "Nusselt number" annotation (Dialog(group="Output"));
 
         public
           Modelica.Blocks.Sources.Ramp input_Re(
@@ -1660,10 +1658,8 @@ extends Modelica.Icons.ExamplesPackage;
             annotation (Placement(transformation(extent={{40,-20},{60,0}})));
 
           //output variables
-          SI.MassFlowRate m_flow[n] "Mass flow rate"
-                                                     annotation (Dialog(group="Output"));
-          SI.NusseltNumber Nu[n] "Nusselt number"
-                                                  annotation (Dialog(group="Output"));
+          SI.MassFlowRate m_flow[n] "Mass flow rate" annotation (Dialog(group="Output"));
+          SI.NusseltNumber Nu[n] "Nusselt number" annotation (Dialog(group="Output"));
 
         public
           Modelica.Blocks.Sources.Ramp input_Re(
@@ -5857,8 +5853,7 @@ extends Modelica.Icons.ExamplesPackage;
           SI.Length K[1]={0}
             "Roughness (average height of surface asperities)"
             annotation (Dialog(group="Straight pipe"));
-          SI.Length L=1 "Length"
-                                 annotation (Dialog(group="Straight pipe"));
+          SI.Length L=1 "Length" annotation (Dialog(group="Straight pipe"));
 
           //fluid property variables
           SI.DynamicViscosity eta=1e-3
@@ -5975,8 +5970,7 @@ extends Modelica.Icons.ExamplesPackage;
           SI.Length K[4]={0,2e-4*d_hyd,2e-3*d_hyd,2e-2*d_hyd}
             "Roughness (average height of surface asperities)"
             annotation (Dialog(group="Straight pipe"));
-          SI.Length L=1 "Length"
-                                 annotation (Dialog(group="Straight pipe"));
+          SI.Length L=1 "Length" annotation (Dialog(group="Straight pipe"));
 
           //fluid property variables
           SI.DynamicViscosity eta=1e-3
@@ -6105,8 +6099,7 @@ extends Modelica.Icons.ExamplesPackage;
           SI.Length K[4]={0,2e-4*d_hyd,2e-3*d_hyd,2e-2*d_hyd}
             "Roughness (average height of surface asperities)"
             annotation (Dialog(group="Straight pipe"));
-          SI.Length L=1 "Length"
-                                 annotation (Dialog(group="Straight pipe"));
+          SI.Length L=1 "Length" annotation (Dialog(group="Straight pipe"));
 
           //fluid property variables
           SI.DynamicViscosity eta=1e-3
diff --git a/ModelicaTest/Fluid/TestComponents/NewFittings.mo b/ModelicaTest/Fluid/TestComponents/NewFittings.mo
index 659ddaa91d..efc3c96e7c 100644
--- a/ModelicaTest/Fluid/TestComponents/NewFittings.mo
+++ b/ModelicaTest/Fluid/TestComponents/NewFittings.mo
@@ -100,8 +100,7 @@ This model executes pressure loss calculations out of the  Fluid.Dissipa
     model ThickEdgedOrifice
       extends Modelica.Icons.Example;
       parameter
-        Modelica.Fluid.Fittings.BaseClasses.Orifices.ThickEdgedOrifice.Geometry
-                                                                                geometry=
+        Modelica.Fluid.Fittings.BaseClasses.Orifices.ThickEdgedOrifice.Geometry geometry=
     Modelica.Fluid.Fittings.BaseClasses.Orifices.ThickEdgedOrifice.Choices.circular(diameter=0.1, venaDiameter=0.01, venaLength=0.001) annotation (Placement(transformation(extent={{12,72},{32,92}})));
       extends ModelicaTest.Fluid.TestComponents.NewFittings.PartialFittingTest(
                                  redeclare model FittingComponent =
diff --git a/ModelicaTest/Math.mo b/ModelicaTest/Math.mo
index dce3dc1d95..26d07b7cc9 100644
--- a/ModelicaTest/Math.mo
+++ b/ModelicaTest/Math.mo
@@ -762,7 +762,7 @@ extends Modelica.Icons.ExamplesPackage;
 
   model TestMatricesExamplesSolveLinearEquations
     extends Modelica.Icons.Example;
-    equation
+  equation
       Modelica.Math.Matrices.Examples.solveLinearEquations();
     annotation (experiment(StopTime=0));
   end TestMatricesExamplesSolveLinearEquations;
@@ -828,9 +828,9 @@ extends Modelica.Icons.ExamplesPackage;
     Real x, y, xIntegrated;
     Integer i;
     parameter Real p=1 "So that the variable is integrated";
-    initial equation
+  initial equation
     xIntegrated=x;
-    equation
+  equation
     (x,i)=Modelica.Math.Vectors.interpolate(tabx, taby, time);
     y=der(x);
     der(xIntegrated)=p*y;
diff --git a/ModelicaTest/Tables/CombiTable2Ds.mo b/ModelicaTest/Tables/CombiTable2Ds.mo
index 043309a21d..c4673691e3 100644
--- a/ModelicaTest/Tables/CombiTable2Ds.mo
+++ b/ModelicaTest/Tables/CombiTable2Ds.mo
@@ -535,7 +535,7 @@ double mydummyfunc(double dummy_in) {
     Modelica.Blocks.Tables.CombiTable2Ds combiTable2DT(
       table=transpose([1,0,6;2,4,4;3,9,9;4,16,16]),
       smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments) annotation(Placement(transformation(extent={{-95,-60},{-75,-40}})));
-    equation
+  equation
       connect(combiTable1D.u,clock1.y) annotation(Line(
         points={{-97,10},{-102,10},{-104,10},{-104,75},{-109,75}},
         color={0,0,127},
@@ -593,7 +593,7 @@ double mydummyfunc(double dummy_in) {
     Modelica.Blocks.Continuous.Der der3 annotation(Placement(transformation(extent={{-60,0},{-40,20}})));
     Modelica.Blocks.Continuous.Der der4 annotation(Placement(transformation(extent={{-60,-30},{-40,-10}})));
     Modelica.Blocks.Continuous.Der der5 annotation(Placement(transformation(extent={{-60,-60},{-40,-40}})));
-    equation
+  equation
       connect(combiTable1D.u,clock1.y) annotation(Line(
         points={{-97,10},{-102,10},{-104,10},{-104,75},{-109,75}},
         color={0,0,127},
@@ -676,7 +676,7 @@ double mydummyfunc(double dummy_in) {
     Modelica.Blocks.Continuous.Der der3 annotation(Placement(transformation(extent={{-60,0},{-40,20}})));
     Modelica.Blocks.Continuous.Der der4 annotation(Placement(transformation(extent={{-60,-30},{-40,-10}})));
     Modelica.Blocks.Continuous.Der der5 annotation(Placement(transformation(extent={{-60,-60},{-40,-40}})));
-    equation
+  equation
       connect(combiTable1D.u,clock1.y) annotation(Line(
         points={{-97,10},{-102,10},{-104,10},{-104,75},{-109,75}},
         color={0,0,127},
@@ -772,7 +772,7 @@ double mydummyfunc(double dummy_in) {
       phase=Modelica.Constants.pi/2,
       offset=18) annotation(Placement(transformation(extent={{-130,-10},{-110,10}})));
     Modelica.Blocks.Sources.Constant const_L(k=82) annotation(Placement(transformation(extent={{-130,-45},{-110,-25}})));
-    equation
+  equation
       connect(der_1R.u,combiTable2D_1R.y) annotation(Line(
         points={{-32,65},{-37,65},{-44,65},{-49,65}},
         color={0,0,127},
@@ -888,7 +888,7 @@ double mydummyfunc(double dummy_in) {
       f=1/3,
       offset=82,
       startTime=1) annotation(Placement(transformation(extent={{-130,-45},{-110,-25}})));
-    equation
+  equation
       connect(der_1R.u,combiTable2D_1R.y) annotation(Line(
         points={{-32,65},{-37,65},{-44,65},{-49,65}},
         color={0,0,127},
diff --git a/ModelicaTest/Tables/CombiTable2Dv.mo b/ModelicaTest/Tables/CombiTable2Dv.mo
index 82b9255e6e..b91496f85e 100644
--- a/ModelicaTest/Tables/CombiTable2Dv.mo
+++ b/ModelicaTest/Tables/CombiTable2Dv.mo
@@ -1003,7 +1003,7 @@ double mydummyfunc(double dummy_in) {
                -70})));
     Modelica.Blocks.Continuous.Der der3
       annotation (Placement(transformation(extent={{-10,-10},{10,10}}, origin={30,-70})));
-   equation
+  equation
     connect(combiTable2Dv.y[2], der2.u)
       annotation (Line(points={{44,40},{72,40},{72,30},{78,30}},
                                                  color={0,0,127}));
@@ -1038,5 +1038,5 @@ double mydummyfunc(double dummy_in) {
       experiment(
         StartTime=-1,
         StopTime=4));
-   end OneSidedDerivative2D;
+  end OneSidedDerivative2D;
 end CombiTable2Dv;
diff --git a/ModelicaTest/Tables/CombiTimeTable.mo b/ModelicaTest/Tables/CombiTimeTable.mo
index 5840540f22..13768e1465 100644
--- a/ModelicaTest/Tables/CombiTimeTable.mo
+++ b/ModelicaTest/Tables/CombiTimeTable.mo
@@ -927,7 +927,7 @@ double mydummyfunc(double* dummy_in) {
       smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative) annotation(Placement(transformation(extent={{-40,-30},{-20,-10}})));
     Modelica.Blocks.Continuous.Der d_t_new_2 annotation(Placement(transformation(extent={{0,-30},{20,-10}})));
     Modelica.Blocks.Continuous.Der d2_t_new_2 annotation(Placement(transformation(extent={{40,-30},{60,-10}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
     annotation (experiment(StartTime=0, StopTime=4));
@@ -943,7 +943,7 @@ double mydummyfunc(double* dummy_in) {
       smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative) annotation(Placement(transformation(extent={{-40,-30},{-20,-10}})));
     Modelica.Blocks.Continuous.Der d_t_new_2 annotation(Placement(transformation(extent={{0,-30},{20,-10}})));
     Modelica.Blocks.Continuous.Der d2_t_new_2 annotation(Placement(transformation(extent={{40,-30},{60,-10}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
     annotation (experiment(StartTime=0, StopTime=15));
@@ -959,7 +959,7 @@ double mydummyfunc(double* dummy_in) {
       smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative) annotation(Placement(transformation(extent={{-40,-30},{-20,-10}})));
     Modelica.Blocks.Continuous.Der d_t_new_2 annotation(Placement(transformation(extent={{0,-30},{20,-10}})));
     Modelica.Blocks.Continuous.Der d2_t_new_2 annotation(Placement(transformation(extent={{40,-30},{60,-10}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
     annotation (experiment(StartTime=7.99, StopTime=20));
@@ -983,7 +983,7 @@ double mydummyfunc(double* dummy_in) {
       smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative) annotation(Placement(transformation(extent={{-40,-30},{-20,-10}})));
     Modelica.Blocks.Continuous.Der d_t_new_2 annotation(Placement(transformation(extent={{0,-30},{20,-10}})));
     Modelica.Blocks.Continuous.Der d2_t_new_2 annotation(Placement(transformation(extent={{40,-30},{60,-10}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
     annotation (experiment(StartTime=0, StopTime=4));
@@ -999,7 +999,7 @@ double mydummyfunc(double* dummy_in) {
       smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative) annotation(Placement(transformation(extent={{-40,-30},{-20,-10}})));
     Modelica.Blocks.Continuous.Der d_t_new_2 annotation(Placement(transformation(extent={{0,-30},{20,-10}})));
     Modelica.Blocks.Continuous.Der d2_t_new_2 annotation(Placement(transformation(extent={{40,-30},{60,-10}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
     annotation (experiment(StartTime=0, StopTime=15));
@@ -1015,7 +1015,7 @@ double mydummyfunc(double* dummy_in) {
       smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative) annotation(Placement(transformation(extent={{-40,-30},{-20,-10}})));
     Modelica.Blocks.Continuous.Der d_t_new_2 annotation(Placement(transformation(extent={{0,-30},{20,-10}})));
     Modelica.Blocks.Continuous.Der d2_t_new_2 annotation(Placement(transformation(extent={{40,-30},{60,-10}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
     annotation (experiment(StartTime=7.99, StopTime=20));
@@ -1118,7 +1118,7 @@ double mydummyfunc(double* dummy_in) {
     Modelica.Blocks.Continuous.Der d2_t_new_3 annotation(Placement(transformation(extent={{40,-60},{60,-40}})));
     Modelica.Blocks.Continuous.Der d_t_new_4 annotation(Placement(transformation(extent={{0,-90},{20,-70}})));
     Modelica.Blocks.Continuous.Der d2_t_new_4 annotation(Placement(transformation(extent={{40,-90},{60,-70}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
       connect(d_t_new_3.y,d2_t_new_3.u) annotation(Line(points={{21,-50},{26,-50},{33,-50},{38,-50}},   color={0,0,127}));
@@ -1149,7 +1149,7 @@ double mydummyfunc(double* dummy_in) {
     Modelica.Blocks.Continuous.Der d2_t_new_3 annotation(Placement(transformation(extent={{40,-60},{60,-40}})));
     Modelica.Blocks.Continuous.Der d_t_new_4 annotation(Placement(transformation(extent={{0,-90},{20,-70}})));
     Modelica.Blocks.Continuous.Der d2_t_new_4 annotation(Placement(transformation(extent={{40,-90},{60,-70}})));
-    equation
+  equation
       connect(t_new_2.y[1], d_t_new_2.u) annotation(Line(points={{-19,-20},{-2,-20}}, color={0,0,127}));
       connect(d_t_new_2.y, d2_t_new_2.u) annotation(Line(points={{21,-20},{26,-20},{33,-20},{38,-20}}, color={0,0,127}));
       connect(d_t_new_3.y,d2_t_new_3.u) annotation(Line(points={{21,-50},{26,-50},{33,-50},{38,-50}},   color={0,0,127}));

From a0541729b6f4aabfea3f3233f522e8e6ea47a3a9 Mon Sep 17 00:00:00 2001
From: HOS 
Date: Thu, 2 Nov 2023 15:07:12 +0100
Subject: [PATCH 15/22] Add separation rule as well.

---
 Modelica/package.mo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Modelica/package.mo b/Modelica/package.mo
index df802d4a23..0c6dd299df 100644
--- a/Modelica/package.mo
+++ b/Modelica/package.mo
@@ -1308,6 +1308,7 @@ The tab-character shall not be used, since the tab-stops are not standardized.public, protected, equation, algorithm, and end of class marker shall not be indented.
 The keywords public and protected are headings for a group of declarations.
 

+

Full class definitions shall be separated by an empty line.

")); end Format; From 02b813b83ec5cf490a60c605874652b9d3e42f17 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 2 Nov 2023 15:07:40 +0100 Subject: [PATCH 16/22] And apply the rule --- Complex.mo | 1 + 1 file changed, 1 insertion(+) diff --git a/Complex.mo b/Complex.mo index ea62a21702..a6d6013d49 100644 --- a/Complex.mo +++ b/Complex.mo @@ -182,6 +182,7 @@ operator record Complex "Complex number with overloaded operators"

This function returns the given Complex number c1 to the power of the Complex number c2.

")); end complexPower; + function integerPower "Integer power of complex number" import Complex; input Complex c1 "Complex number"; From 8f5ff8a11a1ff9cd73f98acd19b86bf57fa02508 Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Thu, 2 Nov 2023 16:07:06 +0100 Subject: [PATCH 17/22] Update Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo --- Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo b/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo index 2f0eb4815a..0f003d1a32 100644 --- a/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo +++ b/Modelica/Electrical/Machines/Sensors/CurrentQuasiRMSSensor.mo @@ -39,7 +39,7 @@ equation connect(ToSpacePhasor1.y, ToPolar1.u) annotation (Line( points={{0,-1},{0,-18}}, color={0,0,127})); connect(ToPolar1.y[1], Gain1.u) annotation (Line( - points={{0,-41},{0,-50.5},{0,-58}}, color={0,0,127})); + points={{0,-41},{0,-50.5},{0,-58}}, color={0,0,127})); connect(Gain1.y, I) annotation (Line( points={{0,-81},{0,-110}}, color={0,0,127})); annotation (defaultComponentName="currentRMSSensor", From 271c0ea511a3ea2ef9e0dd6e9bb102d4c3061c01 Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Thu, 2 Nov 2023 16:08:39 +0100 Subject: [PATCH 18/22] Apply suggestions from code review Co-authored-by: Henrik Tidefelt Apply suggestions from code review Minor formatting changes in html code --- .../Examples/Utilities/DirectCapacitor.mo | 4 ++-- .../DCMachines/DCPM_CurrentControlled.mo | 2 +- Modelica/package.mo | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo b/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo index 4e54b3116f..3a6bb8044e 100644 --- a/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo +++ b/Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo @@ -45,9 +45,9 @@ equation connect(currentSource.p, ground.p) annotation (Line(points={{-40,-10},{-20,-10}}, color={0,0,255})); connect(ground.p, capacitor.n) - annotation (Line(points={{-20,-10},{0,-10}}, color={0,0,255})); + annotation (Line(points={{-20,-10},{0,-10}}, color={0,0,255})); connect(currentSource.n, capacitor.p) - annotation (Line(points={{-40,10},{0,10}}, color={0,0,255})); + annotation (Line(points={{-40,10},{0,10}}, color={0,0,255})); annotation (Icon(coordinateSystem( preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Text( diff --git a/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo b/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo index 914c5358d1..3b06bee359 100644 --- a/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo +++ b/Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo @@ -90,7 +90,7 @@ equation connect(dcpm.flange, loadInertia.flange_a) annotation (Line( points={{20,-20},{40,-20}})); connect(dcpm.pin_an, ground.p) - annotation (Line(points={{4,-10},{4,0},{-8,0}},color={0,0,255})); + annotation (Line(points={{4,-10},{4,0},{-8,0}}, color={0,0,255})); connect(signalVoltage.p, currentSensor.p) annotation (Line(points={{20,30},{20,20}}, color={0,0,255})); connect(currentSensor.n, dcpm.pin_ap) diff --git a/Modelica/package.mo b/Modelica/package.mo index 0c6dd299df..54392dc1e8 100644 --- a/Modelica/package.mo +++ b/Modelica/package.mo @@ -1300,15 +1300,22 @@ be defined like: tab=\"Controller\", group=\"Speed control\"));
+

Whitespace and Indentation

Trailing white-space (i.e., white-space at the end of the lines) shall not be used. -The tab-character shall not be used, since the tab-stops are not standardized.

-

The code in a class shall be indented relative to the class in steps of two spaces; -except that the headings public, protected, equation, algorithm, and end of class marker shall not be indented. -The keywords public and protected are headings for a group of declarations. +The tab-character shall not be used, since the tab-stops are not standardized. +

+

+The code in a class shall be indented relative to the class in steps of two spaces; +except that the headings public, protected, equation, +algorithm, and end of class marker shall not be indented. +The keywords public and protected are headings for a group +of declarations. +

+

+Full class definitions shall be separated by an empty line.

-

Full class definitions shall be separated by an empty line.

")); end Format; From 385fb087dbe723d3a30ec630bf35b7cce161a755 Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Mon, 6 Nov 2023 14:21:27 +0100 Subject: [PATCH 19/22] Apply suggestions from code review Co-authored-by: tobolar --- Modelica/Media/IdealGases/Common/package.mo | 4 ++-- .../Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo | 2 +- ModelicaTest/Electrical/QuasiStatic/Polyphase.mo | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modelica/Media/IdealGases/Common/package.mo b/Modelica/Media/IdealGases/Common/package.mo index 996516ac12..f1cc4e2b1e 100644 --- a/Modelica/Media/IdealGases/Common/package.mo +++ b/Modelica/Media/IdealGases/Common/package.mo @@ -147,7 +147,7 @@ Temperature T (= " + String(T) + " K) is not in the allowed range end setState_dTX; redeclare function extends setSmoothState - "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" + "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" algorithm state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small), T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small)); @@ -687,7 +687,7 @@ required from medium model \"" + mediumName + "\"."); end setState_dTX; redeclare function extends setSmoothState - "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" + "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" algorithm state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small), T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small), diff --git a/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo b/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo index eb27ea6557..8a3c22eb27 100644 --- a/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo +++ b/Modelica/Thermal/FluidHeatFlow/Sensors/RelTemperatureSensor.mo @@ -4,7 +4,7 @@ model RelTemperatureSensor "Temperature difference sensor" extends FluidHeatFlow.Interfaces.RelativeSensorBase; Modelica.Blocks.Interfaces.RealOutput y(unit="K") "Temperature difference as output signal" - annotation (absoluteValue = false, Placement(transformation( + annotation (absoluteValue = false, Placement(transformation( origin={0,-110}, extent={{10,-10},{-10,10}}, rotation=90))); diff --git a/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo b/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo index 04e8070695..6ad080eece 100644 --- a/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo +++ b/ModelicaTest/Electrical/QuasiStatic/Polyphase.mo @@ -93,7 +93,7 @@ package Polyphase "Polyphase quasi-static package" Modelica.Electrical.QuasiStatic.Polyphase.Ideal.Short short(m=m) annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealCommutingSwitch idealCommutingSwitch(m=m, Ron=fill(1E-5, m), - Goff=fill(1E-5, m)) annotation (Placement(transformation(extent={{30,20},{50,40}}))); + Goff=fill(1E-5, m)) annotation (Placement(transformation(extent={{30,20},{50,40}}))); Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealIntermediateSwitch idealIntermediateSwitch(m=m, Ron=fill(1E-5, m), Goff=fill(1E-5, m)) annotation (Placement(transformation(extent={{60,20},{80,40}}))); From b2ed2c281262ab4eba061cea097f33309e9b2e83 Mon Sep 17 00:00:00 2001 From: HOS Date: Mon, 6 Nov 2023 14:33:24 +0100 Subject: [PATCH 20/22] Specify how to handle modifier lists. Give example. Rename to be slightly better. Quoting! Type Modelica keywords in bold and remove trailing whitespaces ;-) --- Modelica/package.mo | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Modelica/package.mo b/Modelica/package.mo index 54392dc1e8..f2ecdeb40c 100644 --- a/Modelica/package.mo +++ b/Modelica/package.mo @@ -1314,8 +1314,35 @@ The keywords public and protected are headings for a&n of declarations.

+Long modifier lists shall be split into several indented lines with at most one modifier per line. +

+

Full class definitions shall be separated by an empty line.

+ +
Example
+ +
+package MyPackage
+  partial model BaseModel
+    parameter Real p;
+    input Real u(unit=\"m/s\");
+  protected
+    Real y;
+    Real x(
+      start=1,
+      unit=\"m\",
+      nominal=10);
+  equation
+    der(x) = u;
+    y = 2*x;
+  end BaseModel;
+
+  model ModelP2
+    extends BaseModel(p=2);
+  end ModelP2;
+end MyPackage;
+
")); end Format; From 8057a51028e8f929c5d7472667d30ee098db37e0 Mon Sep 17 00:00:00 2001 From: HOS Date: Wed, 10 Jan 2024 16:38:37 +0100 Subject: [PATCH 21/22] TrailingWhiteSpace --- Modelica/Blocks/Sources.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index a75cd1203f..136f17e14f 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -301,7 +301,7 @@ If parameter duration is set to 0.0, the limiting case of a Step signal is achie if continuous then y = offset + amplitude*smooth(0, (if time < startTime then Modelica.Math.sin(phase) else Modelica.Math.sin(2*pi*f*(time - startTime) + phase))); - else + else y = offset + (if time < startTime then 0 else amplitude*Modelica.Math.sin(2 *pi*f*(time - startTime) + phase)); end if; @@ -614,7 +614,7 @@ and that the parameter startTime is omitted since the voltage can b SI.Angle x=2*pi*f*(time - startTime); equation if continuous then - y = offset + amplitude*smooth(1, (if time < startTime then 1 else + y = offset + amplitude*smooth(1, (if time < startTime then 1 else (if noEvent(time - startTime < eps) then 1 else (sin(x))/x))); else y = offset + (if time < startTime then 0 else amplitude* From 0b277be2522ae2db41a184397ee315d028d4f56a Mon Sep 17 00:00:00 2001 From: HOS Date: Wed, 10 Jan 2024 16:38:57 +0100 Subject: [PATCH 22/22] TrailingWhiteSpaceOnEmptyLine --- Modelica/Media/package.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Media/package.mo b/Modelica/Media/package.mo index 4a2932585d..81515f5229 100644 --- a/Modelica/Media/package.mo +++ b/Modelica/Media/package.mo @@ -4544,7 +4544,7 @@ This function computes an isentropic state transformation: input ThermodynamicState state "Thermodynamic state record"; output MassFraction Xi[nXi] "Independent mass fractions"; end massFraction; - + type MassFlowRate = SI.MassFlowRate ( quantity="MassFlowRate." + mediumName, min=-1.0e5,