## Modelica.UsersGuide

### Users Guide of the Modelica Standard Library

Package Modelica is a standardized and pre-defined package that is developed together with the Modelica language from the Modelica Association, see http://www.Modelica.org. It is also called Modelica Standard Library. It provides constants, types, connectors, partial models and model components in various disciplines.

This package contains the users guide for the library and has the following content (this users guide will be improved in the future):

1. Overview of library gives an overview of the library.
2. Release Notes summarizes the differences between different versions of this library.
3. Contact provides information about the authors of the library as well as acknowledgments.
4. ModelicaLicense defines the license conditions for using this library.

Name | Description
--- | ---
OverView | Overview of library
ReleaseNotes | Release notes
Contact | Contact
ModelicaLicense | Modelica License

## Modelica.UsersGuide.OverView

### Overview of Library Modelica

An overview of the Modelica Standard Library will be given here.

In the Modelica package the following conventions are used:

- Class and instance names are written in upper and lower case letters, e.g., "ElectricCurrent". An underscore is only used at the end of a name to characterize a lower or upper index, e.g., body_low_up.
- Type names start always with an upper case letter. Instance names start always with a lower case letter with only a few exceptions, such as "T" for a temperature instance, if this is common sense.
- A package XXX has its interface definitions in subpackage XXX.Interfaces, e.g., Electrical.Interfaces.
- Preferred instance names for connectors:

        p,n: positive and negative side of a partial model.
        a,b: side "a" and side "b" of a partial model
             (= connectors are completely equivalent).

## Modelica.UsersGuide.ReleaseNotes

### Release notes

### Version 1.6 (June 30, 2004)

Added 1 new library (Electrical.MultiPhase), 17 new components, improved 3 existing components in the Modelica.Electrical library and improved 3 types in the Modelica.SIunits library. Furthermore, this Users Guide has been started. The improvements in more detail:

New components

Modelica.Electrical.Analog.Basic.
SaturatingInductor | Simple model of an inductor with saturation
VariableResistor | Ideal linear electrical resistor with variable resistance
VariableConductor | Ideal linear electrical conductor with variable conductance
VariableCapacitor | Ideal linear electrical capacitor with variable capacitance
VariableInductor | Ideal linear electrical inductor with variable inductance
Modelica.Electrical.Analog.Semiconductors.
HeadingDiode | Simple diode with heating port
HeadingNMOS | Simple MOS Transistor with heating port
HeadingPMOS | Simple PMOS Transistor with heating port
HeadingNPN | Simple NPN BJT according to Ebers-Moll with heating port
HeadingPNP | Simple PNP BJT according to Ebers-Moll with heating port
Modelica.Electrical.MultiPhase A new library for multi-phase electrical circuits

New examples

The following new examples have been added to Modelica.Electrical.Analog.Examples:

CharacteristicThyristors, CharacteristicIdealDiodes, HeatingNPN_OrGate, HeatingMOSInverter, HeatingRectifier, Rectifier, ShowSaturatingInductor ShowVariableResistor

Improved existing components

In the library Modelica.Electrical.Analog.Ideal, a knee voltage has been introduced for the components IdealThyristor, IdealGTOThyristor, IdealDiode in order that the approximation of these ideal elements is improved with not much computational effort.

In the Modelica.SIunits library, the following changes have been made:

Inductance | min=0 removed
SelfInductance | min=0 added
ThermodynamicTemperature | min=0 added

### Version 1.5 (December 16, 2002)

Added 55 new components. In particular, added new package Thermal.HeatTransfer for modeling of lumped heat transfer, added model LossyGear in Mechanics.Rotational to model gear efficiency and bearing friction according to a new theory in a robust way, added 10 new models in Electrical.Analog and added several other new models and improved existing models.

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)]));

Modelica.Blocks.Sources.Exponentials

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

Modelica.Blocks.Sources.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;

Modelica.Blocks.Sources.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

Modelica.Mechanics.Rotational.Interfaces.FrictionBase

Modelica.Mechanics.Rotational.Position

Replaced `reinit` by `initial equation`

Modelica.Mechanics.Rotational.RelativeStates/i>

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

Modelica.Mechanics.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.

Modelica.Mechanics.Translational.Position

Replaced `reinit` by `initial equation`

Modelica.Mechanics.Translational.RelativeStates

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

Modelica.Mechanics.Translational.Stop

Use `stateSelect = StateSelect.prefer`.

Modelica.Mechanics.Translational.Examples.PreLoad

Improved documentation and coordinate system used for example.

ModelicaAdditions.Blocks.Nonlinear.PadeDelay

Replaced `reinit` by `initial equation`

ModelicaAdditions.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.

### Version 1.4.1 (June 28, 2001)

- Several minor bugs fixed.
- New models:
  Modelica.Blocks.Interfaces.IntegerInPort/IntegerOutPort,
  Modelica.Blocks.Math.TwoInputs/TwoOutputs
  Modelica.Electrical.Analog.Ideal.IdealOpAmp3Pin,
  Modelica.Mechanics.Rotational.Move,
  Modelica.Mechanics.Translational.Move.

### Version 1.4.1beta1 (February 12, 2001)

Adapted to Modelica 1.4

### Version 1.3.2beta2 (June 20, 2000)

- New subpackage Modelica.Mechanics.Translational
- Changes to Modelica.Mechanics.Rotational:
  New elements:

         IdealGearR2T    Ideal gear transforming rotational in translational motion.
         Position        Forced movement of a flange with a reference angle
                         given as input signal
         RelativeStates  Definition of relative state variables

- Changes to Modelica.SIunits:
  Introduced new types:
  type Temperature = ThermodynamicTemperature;
  types DerDensityByEnthalpy, DerDensityByPressure, DerDensityByTemperature, DerEnthalpyByPressure, DerEnergyByDensity, DerEnergyByPressure
  Attribute "final" removed from min and max values in order that these values can still be changed to narrow the allowed range of values.
  Quantity="Stress" removed from type "Stress", in order that a type "Stress" can be connected to a type "Pressure".
- Changes to Modelica.Icons:
  New icons for motors and gearboxes.
- Changes to Modelica.Blocks.Interfaces:
  Introduced a replaceable signal type into Blocks.Interfaces.InPort/OutPort:

         replaceable type SignalType = Real

  in order that the type of the signal of an input/output block can be changed to a physical type, for example:

         Sine sin1(outPort(redeclare type SignalType=Modelica.SIunits.Torque))

### Version 1.3.1 (Dec. 13, 1999)

First official release of the library.

## Modelica.UsersGuide.Contact

### Contact

The development of the Modelica package is organized by
  Martin Otter
  Deutsches Zentrum für Luft und Raumfahrt e.V. (DLR)
  Institut für Robotik und Mechatronik
  Abteilung für Entwurfsorientierte Regelungstechnik
  Postfach 1116
  D-82230 Wessling
  Germany
  email: Martin.Otter@dlr.de

This library is developed by several people from the Modelica Association, see http://www.Modelica.org. In particular, the following people have contributed:

Peter Beater University of Paderborn, Germany | Modelica.Mechanics.Translational
Christoph Clauß Fraunhofer Institute for Integrated Circuits, Dresden, Germany | Modelica.Electrical
Anton Haumer Consultant, St.Andrae-Woerdern, Austria | Modelica.Electrical
Martin Otter DLR, German Aerospace Center, Oberpfaffenhofen, Germany | Modelica.Blocks Modelica.Mechanics.Rotational Modelica.Math Modelica.SIunits Modelica.Thermal
André Schneider Fraunhofer Institute for Integrated Circuits, Dresden, Germany | Modelica.Electrical
Christian Schweiger DLR, German Aerospace Center, Oberpfaffenhofen, Germany | Modelica.Mechanics.Rotational
Michael Tiller Ford Motor Company, Dearborn, MI, U.S.A | Modelica.Thermal
Hubertus Tummescheit Scynamics, Lund, Sweden | Modelica.Thermal

## Modelica.UsersGuide.ModelicaLicense

### The Modelica License (Version 1.1 of June 30, 2000)

Redistribution and use in source and binary forms, with or without modification are permitted, provided that the following conditions are met:

1. The author and copyright notices in the source files, these license conditions and the disclaimer below are (a) retained and (b) reproduced in the documentation provided with the distribution.
2. Modifications of the original source files are allowed, provided that a prominent notice is inserted in each changed file and the accompanying documentation, stating how and when the file was modified, and provided that the conditions under (1) are met.
3. It is not allowed to charge a fee for the original version or a modified version of the software, besides a reasonable fee for distribution and support. Distribution in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution is permitted, provided that it is not advertised as a product of your own.

#### Disclaimer

The software (sources, binaries, etc.) in their original or in a modified form are provided "as is" and the copyright holders assume no responsibility for its contents what so ever. Any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holders, or any party who modify and/or redistribute the package, be liable for any direct, indirect, incidental, special, exemplary, or consequential damages, arising in any way out of the use of this software, even if advised of the possibility of such damage.