# Changes in package Modelica 1.5

# New components

Modelica.Blocks.
Continuous.Der | Derivative of input (= analytic differentations)
Examples | Demonstration examples of the components of this package
Nonlinear.VariableLimiter | Limit the range of a signal with variable limits
Modelica.Blocks.Interfaces.
RealPort | Real port (both input/output possible)
IntegerPort | Integer port (both input/output possible)
BooleanPort | Boolean port (both input/output possible)
SIMO | Single Input Multiple Output continuous control block
IntegerBlockIcon | Basic graphical layout of Integer block
IntegerMO | Multiple Integer Output continuous control block
IntegerSignalSource | Base class for continuous Integer signal source
IntegerMIBooleanMOs | Multiple Integer Input Multiple Boolean Output continuous control block with same number of inputs and outputs
BooleanMIMOs | Multiple Input Multiple Output continuous control block with same number of inputs and outputs of boolean type
BusAdaptors | Components to send signals to the bus or receive signals from the bus
Modelica.Blocks.Math.
RealToInteger | Convert real to integer signals
IntegerToReal | Convert integer to real signals
Max | Pass through the largest signal
Min | Pass through the smallest signal
Edge | Indicates rising edge of boolean signal
BooleanChange | Indicates boolean signal changing
IntegerChange | Indicates integer signal changing
Modelica.Blocks.Sources.
IntegerConstant | Generate constant signals of type Integer
IntegerStep | Generate step signals of type Integer
Modelica.Electrical.Analog.Basic.
HeatingResistor | Temperature dependent electrical resistor
OpAmp | Simple nonideal model of an OpAmp with limitation
Modelica.Electrical.Analog.Ideal.
IdealCommutingSwitch | Ideal commuting switch
IdealIntermediateSwitch | Ideal intermediate switch
ControlledIdealCommutingSwitch | Controlled ideal commuting switch
ControlledIdealIntermediateSwitch | Controlled ideal intermediate switch
IdealOpAmpLimited | Ideal operational amplifier with limitation
IdealOpener | Ideal opener
IdealCloser | Ideal closer
ControlledIdealOpener | Controlled ideal opener
ControlledIdealCloser | Controlled ideal closer
Modelica.Electrical.Analog.Lines.
TLine1 | Lossless transmission line (Z0, TD)
TLine2 | Lossless transmission line (Z0, F, NL)
TLine2 | Lossless transmission line (Z0, F)
Modelica.Icons.
Function | Icon for a function
Record | Icon for a record
Enumeration | Icon for an enumeration
Modelica.Math.
tempInterpol2 | temporary routine for vectorized linear interpolation (will be removed)
Modelica.Mechanics.Rotational.
Examples.LossyGearDemo1 | Example to show that gear efficiency may lead to stuck motion
Examples.LossyGearDemo2 | Example to show combination of LossyGear and BearingFriction
LossyGear | Gear with mesh efficiency and bearing friction (stuck/rolling possible)
Gear2 | Realistic model of a gearbox (based on LossyGear)
Modelica.SIunits.
Conversions | Conversion functions to/from non SI units and type definitions of non SI units
EnergyFlowRate | Same definition as Power
EnthalpyFlowRate | `Real (final quantity="EnthalpyFlowRate", final unit="W")`
Modelica.
Thermal.HeatTransfer | 1-dimensional heat transfer with lumped elements
ModelicaAdditions.Blocks.Discrete.
TriggeredSampler | Triggered sampling of continuous signals
TriggeredMax | Compute maximum, absolute value of continuous signal at trigger instants
ModelicaAdditions.Blocks.Logical.Interfaces.
BooleanMIRealMOs | Multiple Boolean Input Multiple Real Output continuous control block with same number of inputs and outputs
RealMIBooleanMOs | Multiple Real Input Multiple Boolean Output continuous control block with same number of inputs and outputs
ModelicaAdditions.Blocks.Logical.
TriggeredTrapezoid | Triggered trapezoid generator
Hysteresis | Transform Real to Boolean with Hysteresis
OnOffController | On-off controller
Compare | True, if signal of inPort1 is larger than signal of inPort2
ZeroCrossing | Trigger zero crossing of input signal
ModelicaAdditions.
Blocks.Multiplexer.Extractor | Extract scalar signal out of signal vector dependent on IntegerInPort index
Tables.CombiTable1Ds | Table look-up in one dimension (matrix/file) with only single input

# Package-specific Changes

- All example models made encapsulated
- Upper case constants changed to lower case (cf. Modelica.Constants)
- Introduced Modelica.SIunits.Wavelength due to typo "Wavelenght"
- Introduced ModelicaAdditions.Blocks.Logical.Interfaces.Comparison due to typo "Comparision"
- Changed these components of *.Blocks to `block` class, which have not been already of block type
- Changed *.Interfaces.RelativeSensor to `partial` models

# Class-specific Changes

## Modelica.SIunits

Removed `final` from quantity attribute for Mass and MassFlowRate.

## Modelica.Blocks.Math.Sum

Implemented avoiding algorithm section, which would lead to expensive function calls.

## Modelica.Blocks.Sources

### Step

      block Step "Generate step signals of type Real"
        parameter Real height[:]={1} "Heights of steps";
     // parameter Real offset[:]={0} "Offsets of output signals";
     // parameter SIunits.Time startTime[:]={0} "Output = offset for time < startTime";
     // extends Interfaces.MO          (final nout=max([size(height, 1); size(offset, 1); size(startTime, 1)]));
        extends Interfaces.SignalSource(final nout=max([size(height, 1); size(offset, 1); size(startTime, 1)]));
      protected
        parameter Real p_height[nout]=(if size(height, 1) == 1 then ones(nout)*
            height[1] else height);
        parameter Real p_offset[nout]=(if size(offset, 1) == 1 then ones(nout)*
            offset[1] else offset);
        parameter SIunits.Time p_startTime[nout]=(if size(startTime, 1) == 1 then
            ones(nout)*startTime[1] else startTime);
      equation
        for i in 1:nout loop
          outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else
            p_height[i]);
        end for;
      end Step;

### Exponentials

Replaced usage of built-in function `exp` by Modelica.Math.exp.

### TimeTable

Interface definition changed from

        parameter Real table[:, :]=[0, 0; 1, 1; 2, 4] "Table matrix (time = first column)";

to

        parameter Real table[:, 2]=[0, 0; 1, 1; 2, 4] "Table matrix (time = first column)";

Did the same for subfunction getInterpolationCoefficients.

Bug in getInterpolationCoefficients for startTime <> 0 fixed:

            ...
            end if;
          end if;
          // Take into account startTime "a*(time - startTime) + b"
          b := b - a*startTime;
        end getInterpolationCoefficients;

### BooleanStep

      block BooleanStep "Generate step signals of type Boolean"
        parameter SIunits.Time startTime[:]={0} "Time instants of steps";
        parameter Boolean startValue[size(startTime, 1)]=fill(false, size(startTime, 1)) "Output before startTime";
        extends Interfaces.BooleanSignalSource(final nout=size(startTime, 1));
      equation
        for i in 1:nout loop
     //   outPort.signal[i] = time >= startTime[i];
          outPort.signal[i] = if time >= startTime[i] then not startValue[i] else startValue[i];
        end for;
      end BooleanStep;

## Modelica.Electrical.Analog

Corrected table of values and default for Beta by dividing them by 1000 (consistent with the values used in the NAND-example model):

- Semiconductors.PMOS
- Semiconductors.NMOS

Corrected parameter defaults, unit and description for TrapezoidCurrent. This makes the parameters consistent with their use in the model. Models specifying parameter values are not changed. Models not specifying parameter values did not generate trapezoids previously.

Icon layer background changed from transparent to white:

- Basic.Gyrator
- Basic.EMF
- Ideal.Idle
- Ideal.Short

Basic.Transformer: Replaced invalid escape characters '\ ' and '\[newline]' in documentation by '|'.

## Modelica.Mechanics

### Rotational

Removed arrows and names documentation from flanges in diagram layer

### Rotational.Interfaces.FrictionBase

        partial model FrictionBase "Base class of Coulomb friction elements"
          parameter SIunits.AngularVelocity w_small=1
            "Relative angular velocity near to zero (see model info text)";

            // Equations to define the following variables have to be defined in subclasses
          SIunits.AngularVelocity w_relfric
            "Relative angular velocity between frictional surfaces";
          SIunits.AngularAcceleration a_relfric
            "Relative angular acceleration between frictional surfaces";
          SIunits.Torque tau
            "Friction torque (positive, if directed in opposite direction of w_rel)"
            ;
          SIunits.Torque tau0 "Friction torque for w=0 and forward sliding";
          SIunits.Torque tau0_max "Maximum friction torque for w=0 and locked";
          Boolean free "true, if frictional element is not active";

          // Equations to define the following variables are given in this class
          Real sa "Path parameter of friction characteristic tau = f(a_relfric)";

          Boolean startForward(start=false, fixed=true)
            "true, if w_rel=0 and start of forward sliding or w_rel > w_small";
          Boolean startBackward(start=false, fixed=true)
            "true, if w_rel=0 and start of backward sliding or w_rel < -w_small";
          Boolean locked "true, if w_rel=0 and not sliding";

          constant Integer Unknown=3 "Value of mode is not known";
          constant Integer Free=2 "Element is not active";
          constant Integer Forward=1 "w_rel > 0 (forward sliding)";
          constant Integer Stuck=0
            "w_rel = 0 (forward sliding, locked or backward sliding)";
          constant Integer Backward=-1 "w_rel < 0 (backward sliding)";
          Integer mode(
            final min=Backward,
            final max=Unknown,
            start=Unknown,
            fixed=true);
        equation
          /* Friction characteristic
         (locked is introduced to help the Modelica translator determining
          the different structural configurations, if for each configuration
          special code shall be generated)
      */

          startForward = pre(mode) == Stuck and (sa > tau0_max or pre(startForward)
             and sa > tau0) or pre(mode) == Backward and w_relfric > w_small or
            initial() and (w_relfric > 0);
          startBackward = pre(mode) == Stuck and (sa < -tau0_max or pre(
            startBackward) and sa < -tau0) or pre(mode) == Forward and w_relfric <
            -w_small or initial() and (w_relfric < 0);
          locked = not free and not (pre(mode) == Forward or startForward or pre(
            mode) == Backward or startBackward);

          a_relfric = if locked then 0 else if free then sa else if startForward
             then sa - tau0 else if startBackward then sa + tau0 else if pre(mode)
             == Forward then sa - tau0 else sa + tau0;

          /* Friction torque has to be defined in a subclass. Example for a clutch:
           tau = if locked then sa else if free then 0 else cgeo*fn*
                    (if startForward  then  Math.tempInterpol1( w_relfric, mue_pos, 2)
                 else if startBackward then -Math.tempInterpol1(-w_relfric, mue_pos, 2)
                 else if pre(mode) == Forward then Math.tempInterpol1(w_relfric, mue_pos, 2)
                 else -Math.tempInterpol1(-w_relfric, mue_pos, 2));
      */

          // finite state machine to determine configuration
          mode = if free then Free else (if (pre(mode) == Forward or pre(mode) ==
            Free or startForward) and w_relfric > 0 then Forward else if (pre(mode)
             == Backward or pre(mode) == Free or startBackward) and w_relfric < 0
             then Backward else Stuck);
        end FrictionBase;

### Rotational.Position

Replaced `reinit` by `initial equation`

### Rotational.RelativeStates

Bug corrected by using modifier `stateSelect = StateSelect.prefer` as implementation

### Translational.Interfaces.flange_b

Attribute fillColor=7 added to Rectangle on Icon layer, i.e. it is now filled with white and not transparent any more.

### Translational.Position

Replaced `reinit` by `initial equation`

### Translational.RelativeStates

Bug corrected by using modifier `stateSelect = StateSelect.prefer` as implementation

### Translational.Stop

Use `stateSelect = StateSelect.prefer`.

### Translational.Examples.PreLoad

Improved documentation and coordinate system used for example.

## ModelicaAdditions

### Blocks.Nonlinear.PadeDelay

Replaced `reinit` by `initial equation`

### HeatFlow1D.Interfaces

Definition of connectors Surface_a and Surface_b:
`flow SIunits.HeatFlux q;` changed to `flow SIunits.HeatFlowRate q;`

### MultiBody.Parts.InertialSystem

Icon corrected.