Function that outputs the input after rounding it to
n digits.
For example,
n = 0 to round to the nearest integer,n = 1 to round to the next decimal point,
andn = -1 to round to the next multiple of
ten.Hence, the function outputs
y = floor(x*(10^n) + 0.5)/(10^n) for x > 0,
y = ceil( x*(10^n) - 0.5)/(10^n) for x < 0.
To use this function as a block, use IDEAS.Controls.OBC.CDL.Reals.Round.
function round extends Modelica.Icons.Function; input Real x "Argument to be rounded"; input Integer n "Number of digits being round to"; output Real y "Connector of Real output signal"; end round;
parameter declaration on a protected
variable which causes an error in Dymola 2025x beta1.