Skip to content

Commit

Permalink
Improve comment strings and reformat implementation of CDL Elementary…
Browse files Browse the repository at this point in the history
… Blocks (#4044)

* Revised comment strings and formatting

For #4038
  • Loading branch information
mwetter authored Nov 9, 2024
1 parent 0881724 commit df0be2a
Show file tree
Hide file tree
Showing 126 changed files with 516 additions and 612 deletions.
3 changes: 1 addition & 2 deletions Buildings/Controls/OBC/CDL/Constants.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ package Constants
"Biggest number such that 1.0 + eps = 1.0";
final constant Real small=1E-37
"Smallest number such that small and -small are representable on the machine";
final constant Real pi=2*Modelica.Math.asin(
1.0)
final constant Real pi=2*Modelica.Math.asin(1.0)
"Constant number pi, 3.14159265358979";
annotation (
Documentation(
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Conversions/BooleanToInteger.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ block BooleanToInteger
parameter Integer integerFalse=0
"Output signal for false Boolean input";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u
"Connector of Boolean input signal"
"Boolean signal to be converted to an Integer signal"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y
"Connector of Integer output signal"
"Converted input signal as an Integer"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Conversions/BooleanToReal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ block BooleanToReal
parameter Real realFalse=0.0
"Output signal for false Boolean input";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u
"Connector of Boolean input signal"
"Boolean signal to be converted to a Real signal"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Connector of Real output signal"
"Converted input signal as a Real"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Conversions/IntegerToReal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ within Buildings.Controls.OBC.CDL.Conversions;
block IntegerToReal
"Convert Integer to Real signals"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signal"
"Integer signal to be converted to a Real signal"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Connector of Real output signal"
"Converted input signal as a Real"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Conversions/RealToInteger.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ within Buildings.Controls.OBC.CDL.Conversions;
block RealToInteger
"Convert Real to Integer signal"
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Connector of Real input signal"
"Real signal to be converted to an Integer signal"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y
"Connector of Integer output signal"
"Converted input signal as an Integer"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Discrete/FirstOrderHold.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ block FirstOrderHold
min=1E-3)
"Sample period of component";
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Continuous input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Continuous output signal"
"First order hold of input signal"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

protected
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Discrete/Sampler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ block Sampler
min=1E-3)
"Sample period of component";
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Continuous input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Continuous output signal"
"Sampled input signal"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

protected
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Discrete/TriggeredMax.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Discrete;
block TriggeredMax
"Output the maximum, absolute value of a continuous signal at trigger instants"
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Connector with a Real input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput trigger
"Connector for trigger"
"Input for trigger that causes u to be sampled"
annotation (Placement(transformation(origin={0,-120},extent={{-20,-20},{20,20}},rotation=90)));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Connector with a Real output signal"
"Maximum of input signal over all trigger instants"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

initial equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Discrete/TriggeredMovingMean.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ block TriggeredMovingMean
min=1)
"Number of samples over which the input is averaged";
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Continuous input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput trigger
"Boolean signal that triggers the block"
"Input for trigger that causes u to be sampled"
annotation (Placement(transformation(origin={0,-120},extent={{-20,-20},{20,20}},rotation=90),iconTransformation(extent={{-20,-20},{20,20}},rotation=90,origin={0,-120})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Discrete averaged signal"
"Moving mean of input signal over all trigger instants"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

protected
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Discrete/TriggeredSampler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ block TriggeredSampler
parameter Real y_start=0
"Initial value of output signal";
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Connector with a Real input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput trigger
"Signal that triggers the sampler"
"Input for trigger that causes u to be sampled"
annotation (Placement(transformation(origin={0,-120},extent={{-20,-20},{20,20}},rotation=90)));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Connector with a Real output signal"
"Input signal at the last trigger instant"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

initial equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Discrete/UnitDelay.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ block UnitDelay
parameter Real y_start=0
"Initial value of output signal";
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Continuous input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Continuous output signal"
"Input signal at the previous sample instant"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

protected
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Discrete/ZeroOrderHold.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ block ZeroOrderHold
min=1E-3)
"Sample period of component";
Buildings.Controls.OBC.CDL.Interfaces.RealInput u
"Continuous input signal"
"Input signal to be sampled"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y
"Continuous output signal"
"Zero order hold of the input signal"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

protected
Expand Down
9 changes: 3 additions & 6 deletions Buildings/Controls/OBC/CDL/Integers/Abs.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ within Buildings.Controls.OBC.CDL.Integers;
block Abs
"Output the absolute value of the input"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signals"
"Input for absolute function"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y
"Connector of Integer output signals"
"Absolute value of the input"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
y=if u >= 0 then
u
else
-u;
y=if u >= 0 then u else -u;
annotation (
defaultComponentName="absInt",
Icon(
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/Add.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Integers;
block Add
"Output the sum of the two inputs"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1
"Connector of Integer input signal 1"
"Input to be added"
annotation (Placement(transformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2
"Connector of Integer input signal 2"
"Input to be added"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y
"Connector of Integer output signal"
"Sum of the two inputs"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
8 changes: 5 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/AddParameter.mo
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
within Buildings.Controls.OBC.CDL.Integers;
block AddParameter "Output the sum of an input plus a parameter"
parameter Integer p
"Value to be added";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u "Connector of Integer input signal"
"Parameter to be added to the input";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Input to be added to the parameter"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Connector of Integer output signal"
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y
"Sum of the parameter and the input"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
8 changes: 4 additions & 4 deletions Buildings/Controls/OBC/CDL/Integers/Change.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ block Change
parameter Integer pre_u_start=0
"Start value of pre(u) at initial time";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signal"
"Integer to be monitored for a change in value"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Output that is true when the input changes its value"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput up
"Connector of Boolean output signal indicating input increase"
"Output that is true when the input increased its value"
annotation (Placement(transformation(extent={{100,40},{140,80}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput down
"Connector of Boolean output signal indicating input decrease"
"Output that is true when the input decreased its value"
annotation (Placement(transformation(extent={{100,-80},{140,-40}})));

initial equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/Equal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Integers;
block Equal
"Output y is true, if input u1 is equal to input u2"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1
"Connector of first Integer input signal"
"Input to be checked for equality with other input"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2
"Connector of second Integer input signal"
"Input to be checked for equality with other input"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs that is true if the two inputs are equal, and false otherwise"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/Greater.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Integers;
block Greater
"Output y is true, if input u1 is greater than input u2"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1
"Connector of first Integer input signal"
"First input u1"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2
"Connector of second Integer input signal"
"Second input u2"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u1 is greater than u2"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/GreaterEqual.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Integers;
block GreaterEqual
"Output y is true, if input u1 is greater or equal than input u2"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1
"Connector of first Integer input signal"
"First input u1"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2
"Connector of second Integer input signal"
"Second input u2"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u1 is greater or equal than u2"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
8 changes: 4 additions & 4 deletions Buildings/Controls/OBC/CDL/Integers/GreaterEqualThreshold.mo
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
within Buildings.Controls.OBC.CDL.Integers;
block GreaterEqualThreshold
"Output y is true, if input u is greater or equal than threshold"
"Output y is true, if input u is greater or equal than a threshold"
parameter Integer t=0
"Comparison with respect to a threshold";
"Threshold against which the input is compared to";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signal"
"Input to be compared against the threshold"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u is greater or equal than the threshold"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/GreaterThreshold.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ within Buildings.Controls.OBC.CDL.Integers;
block GreaterThreshold
"Output y is true, if input u is greater than a threshold"
parameter Integer t=0
"Threshold for comparison";
"Threshold against which the input is compared to";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signal"
"Input to be compared against the threshold"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u is greater than the threshold"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/Less.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Integers;
block Less
"Output y is true, if input u1 is less than input u2"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1
"Connector of first Integer input signal"
"First input u1"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2
"Connector of second Integer input signal"
"Second input u2"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u1 is less than u2"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Controls/OBC/CDL/Integers/LessEqual.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ within Buildings.Controls.OBC.CDL.Integers;
block LessEqual
"Output y is true, if input u1 is less or equal than input u2"
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u1
"Connector of first Integer input signal"
"First input"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u2
"Connector of second Integer input signal"
"Second input"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u1 is less or equal than u2"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Integers/LessEqualThreshold.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ block LessEqualThreshold
parameter Integer t=0
"Threshold for comparison";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signal"
"Input to be compared"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u is less or equal than the threshold"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
4 changes: 2 additions & 2 deletions Buildings/Controls/OBC/CDL/Integers/LessThreshold.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ block LessThreshold
parameter Integer t=0
"Threshold for comparison";
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u
"Connector of Integer input signal"
"Input to be compared against the threshold"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y
"Connector of Boolean output signal"
"Outputs true if u is less than the threshold"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

equation
Expand Down
Loading

0 comments on commit df0be2a

Please sign in to comment.