From 4461da7d2969d2b22b10d3cb8b8eb73cbfead78b Mon Sep 17 00:00:00 2001
From: Dag
This package contains basic continuous input/output blocks.
Release Notes: Copyright (C) 1999, Modelica Design Group and DLR. Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified
under the terms of the Modelica license, see the license conditions
-and the accompanying disclaimer in the documentation of package
+and the accompanying disclaimer in the documentation of package
Modelica in file \"Modelica/package.mo\".
-This blocks computes output y=outPort.signal element-wise as
-integral of the input u=inPort.signal multiplied with
+This blocks computes output y=outPort.signal element-wise as
+integral of the input u=inPort.signal multiplied with
the gain k:
Release Notes:
This blocks computes y=outPort.signal element-wise as integral
of the input u=inPort.signal multiplied with the gain k. If the
@@ -170,76 +144,74 @@ the integral away from the bounds.
Release Notes: Copyright (C) 1999, Modelica Design Group and DLR. Copyright © 1999-2002, Modelica Association and DLR.
-This blocks defines the transfer function between the
-input u=inPort.signal and the output y=outPort.signal
+This blocks defines the transfer function between the
+input u=inPort.signal and the output y=outPort.signal
element-wise as approximated derivative:
If you would like to be able to change easily between different
-transfer functions (FirstOrder, SecondOrder, ... ) by changing
+transfer functions (FirstOrder, SecondOrder, ... ) by changing
parameters, use the general block TransferFunction instead
and model a derivative block with parameters Release Notes:
This blocks defines the transfer function between the input u=inPort.signal
and the output y=outPort.signal element-wise as first order system:
@@ -350,7 +321,7 @@ and the output y=outPort.signal element-wise as first order system:
If you would like to be able to change easily between different
-transfer functions (FirstOrder, SecondOrder, ... ) by changing
+transfer functions (FirstOrder, SecondOrder, ... ) by changing
parameters, use the general block TransferFunction instead
and model a first order SISO system with parameters Release Notes:
This blocks defines the transfer function between the input u=inPort.signal and
the output y=outPort.signal element-wise as second order system:
@@ -470,7 +440,7 @@ the output y=outPort.signal element-wise as second order system:
If you would like to be able to change easily between different
-transfer functions (FirstOrder, SecondOrder, ... ) by changing
+transfer functions (FirstOrder, SecondOrder, ... ) by changing
parameters, use the general model class TransferFunction
instead and model a second order SISO system with parameters Release Notes:
This blocks defines the transfer function between the input u=inPort.signal and
the output y=outPort.signal element-wise as PI system:
@@ -614,7 +574,7 @@ the output y=outPort.signal element-wise as PI system:
If you would like to be able to change easily between different
-transfer functions (FirstOrder, SecondOrder, ... ) by changing
+transfer functions (FirstOrder, SecondOrder, ... ) by changing
parameters, use the general model class TransferFunction
instead and model a PI SISO system with parameters Release Notes:
This is the text-book version of a PID-controller.
For a more practically useful PID-controller, use
@@ -735,87 +684,80 @@ block LimPID.
Release Notes:
This is a PID controller incorporating several practical aspects.
@@ -837,7 +779,7 @@ part of this controller, the following practical aspects are included:
in its limits, anti-windup compensation is activated to drive
the integrator state to zero.
- Release Notes:
-This block defines the transfer function between the input
-u=inPort.signal[1] and the output y=outPort.signal[1]
+This block defines the transfer function between the input
+u=inPort.signal[1] and the output y=outPort.signal[1]
as (nb = dimension of b, na = dimension of a):
Release Notes:
-The State Space block defines the relation
-between the input u=inPort.signal and the output
+The State Space block defines the relation
+between the input u=inPort.signal and the output
y=outPort.signal in state space form:
+
Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)
Oberpfaffenhofen
Postfach 1116
@@ -35,7 +28,7 @@ This package contains basic continuous input/output blocks.
+ by Martin Otter:
Realized a first version, based on an existing Dymola library
of Dieter Moormann and Hilding Elmqvist.
-
-"),
+"),
Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
+ Line(points=[-80, 78; -80, -90], style(color=8)),
Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
Text(
- extent=[0, -10; 60, -70],
- string="I",
- style(color=8)),
+ extent=[0, -10; 60, -70],
+ string="I",
+ style(color=8)),
Text(
- extent=[-150, -150; 150, -110],
- string="k=%k",
- style(color=0)),
- Line(points=[-80, -80; 80, 80])),
+ extent=[-150, -150; 150, -110],
+ string="k=%k",
+ style(color=0)),
+ Line(points=[-80, -80; 80, 80])),
Diagram(
- Rectangle(extent=[-60, 60; 60, -60]),
- Line(points=[-100, 0; -60, 0]),
- Line(points=[60, 0; 100, 0]),
+ Rectangle(extent=[-60, 60; 60, -60]),
+ Line(points=[-100, 0; -60, 0]),
+ Line(points=[60, 0; 100, 0]),
Text(
- extent=[-36, 60; 32, 2],
- string="k",
- style(color=0)),
+ extent=[-36, 60; 32, 2],
+ string="k",
+ style(color=0)),
Text(
- extent=[-32, 0; 36, -58],
- string="s",
- style(color=0)),
+ extent=[-32, 0; 36, -58],
+ string="s",
+ style(color=0)),
Line(points=[-46, 0; 46, 0], style(color=0))));
- equation
+ equation
for i in 1:size(k, 1) loop
der(y[i]) = k[i]*u[i];
end for;
end Integrator;
-
- block LimIntegrator "Integrator with limited values of the outputs"
+
+ block LimIntegrator "Integrator with limited values of the outputs"
parameter Real k[:]={1} "Integrator gains";
parameter Real outMax[:]={1} "Upper limits of outputs";
parameter Real outMin[:]=-outMax "Lower limits of outputs";
-
+ parameter Real y0[:]=zeros(size(k, 1)) "Start values of integrators";
+
extends Interfaces.MIMOs(final n=max([size(k, 1); size(outMax, 1); size(
- outMin, 1)]));
-
- protected
+ outMin, 1)]), y(start=y0));
+
+ protected
parameter Real p_k[n]=(if size(k, 1) == 1 then ones(n)*k[1] else k);
parameter Real p_outMax[n]=(if size(outMax, 1) == 1 then ones(n)*outMax[1]
else outMax);
parameter Real p_outMin[n]=(if size(outMin, 1) == 1 then ones(n)*outMin[1]
else outMin);
annotation (
- Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
- Window(
- x=0.31,
- y=0.09,
- width=0.54,
- height=0.6),
- Documentation(info="
-
+ Documentation(info="
+ by Martin Otter:
Vectorized.
+ by Martin Otter:
Realized.
-
+ by Martin Otter:
Vectorized.
+ by Martin Otter:
Realized.
b = {k,0}, a = {T, 1}.
@@ -260,83 +232,82 @@ b = {k,0}, a = {T, 1}.
-"),
+"),
Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
- Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8,
- fillColor=8)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
- Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(color=8,
- fillColor=8)),
- Line(points=[-80, -80; -80, 60; -70, 17.95; -60, -11.46; -50, -32.05;
- -40, -46.45; -30, -56.53; -20, -63.58; -10, -68.51; 0, -71.96; 10
- , -74.37; 20, -76.06; 30, -77.25; 40, -78.07; 50, -78.65; 60,
- -79.06]),
+ Line(points=[-80, 78; -80, -90], style(color=8)),
+ Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8,
+ fillColor=8)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
+ Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(color=8,
+ fillColor=8)),
+ Line(points=[-80, -80; -80, 60; -70, 17.95; -60, -11.46; -50, -32.05; -
+ 40, -46.45; -30, -56.53; -20, -63.58; -10, -68.51; 0, -71.96; 10
+ , -74.37; 20, -76.06; 30, -77.25; 40, -78.07; 50, -78.65; 60, -
+ 79.06]),
Text(
- extent=[0, 0; 60, 60],
- string="DT1",
- style(color=8)),
+ extent=[0, 0; 60, 60],
+ string="DT1",
+ style(color=8)),
Text(
- extent=[-150, -150; 150, -110],
- string="k=%k",
- style(color=0))),
+ extent=[-150, -150; 150, -110],
+ string="k=%k",
+ style(color=0))),
Diagram(
Text(
- extent=[-54, 52; 50, 10],
- string="k s",
- style(color=0)),
+ extent=[-54, 52; 50, 10],
+ string="k s",
+ style(color=0)),
Text(
- extent=[-54, -6; 52, -52],
- string="T s + 1",
- style(color=0)),
- Line(points=[-50, 0; 50, 0], style(color=0)),
- Rectangle(extent=[-60, 60; 60, -60]),
- Line(points=[-100, 0; -60, 0]),
- Line(points=[60, 0; 100, 0])),
+ extent=[-54, -6; 52, -52],
+ string="T s + 1",
+ style(color=0)),
+ Line(points=[-50, 0; 50, 0], style(color=0)),
+ Rectangle(extent=[-60, 60; 60, -60]),
+ Line(points=[-100, 0; -60, 0]),
+ Line(points=[60, 0; 100, 0])),
Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
+ extent=[-100, -100; 100, 100],
+ grid=[2, 2],
+ component=[20, 20]),
Window(
- x=0.17,
- y=0.03,
- width=0.5,
+ x=0.17,
+ y=0.03,
+ width=0.5,
height=0.61));
- equation
+ equation
for i in 1:n loop
- der(x[i]) = if noEvent(abs(p_k[i]) >= Modelica.Constants.EPS) then (u[i]
- - x[i])/p_T[i] else 0;
- y[i] = if noEvent(abs(p_k[i]) >= Modelica.Constants.EPS) then (p_k[i]/
- p_T[i])*(u[i] - x[i]) else 0;
+ der(x[i]) = if noEvent(abs(p_k[i]) >= Modelica.Constants.eps) then (u[i] - x[i])/
+ p_T[i] else 0;
+ y[i] = if noEvent(abs(p_k[i]) >= Modelica.Constants.eps) then (p_k[i]/p_T[i])*(u[i
+ ] - x[i]) else 0;
end for;
end Derivative;
-
- block FirstOrder "First order transfer function block (= 1 pole)"
+
+ block FirstOrder "First order transfer function block (= 1 pole)"
parameter Real k[:]={1} "Gain";
- parameter SIunits.Time T[:]={1} "Time Constant";
-
+ parameter SI.Time T[:]={1} "Time Constant";
+
extends Interfaces.MIMOs(final n=max([size(k, 1); size(T, 1)]));
-
- protected
+
+ protected
parameter Real p_k[n]=(if size(k, 1) == 1 then ones(n)*k[1] else k);
parameter Real p_T[n]=(if size(T, 1) == 1 then ones(n)*T[1] else T);
annotation (
- Documentation(info="
-
+ Documentation(info="
+ by Martin Otter:
Special handling, if k is zero. Introduced, in order that
the D-part of the PID controllers can be set to zero without
introducing numerical problems.
+ by Martin Otter:
Vectorized.
+ by Martin Otter:
Realized.
b = {k}, a = {T, 1}.
@@ -371,91 +342,90 @@ Example:
-"),
+"),
Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
+ Line(points=[-80, 78; -80, -90], style(color=8)),
Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 88; -80, 90], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-80, -80; -70, -45.11; -60, -19.58; -50, -0.9087; -40,
- 12.75; -30, 22.75; -20, 30.06; -10, 35.41; 0, 39.33; 10, 42.19;
- 20, 44.29; 30, 45.82; 40, 46.94; 50, 47.76; 60, 48.36; 70, 48.8;
- 80, 49.12]),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-80, -80; -70, -45.11; -60, -19.58; -50, -0.9087; -40,
+ 12.75; -30, 22.75; -20, 30.06; -10, 35.41; 0, 39.33; 10, 42.19;
+ 20, 44.29; 30, 45.82; 40, 46.94; 50, 47.76; 60, 48.36; 70, 48.8;
+ 80, 49.12]),
Text(
- extent=[0, 0; 60, -60],
- string="PT1",
- style(color=8)),
+ extent=[0, 0; 60, -60],
+ string="PT1",
+ style(color=8)),
Text(
- extent=[-150, -150; 150, -110],
- string="T=%T",
- style(color=0))),
+ extent=[-150, -150; 150, -110],
+ string="T=%T",
+ style(color=0))),
Diagram(
Text(
- extent=[-48, 52; 50, 8],
- string="k",
- style(color=0)),
+ extent=[-48, 52; 50, 8],
+ string="k",
+ style(color=0)),
Text(
- extent=[-54, -6; 56, -56],
- string="T s + 1",
- style(color=0)),
- Line(points=[-50, 0; 50, 0], style(color=0)),
- Rectangle(extent=[-60, 60; 60, -60]),
- Line(points=[-100, 0; -60, 0]),
- Line(points=[60, 0; 100, 0])),
+ extent=[-54, -6; 56, -56],
+ string="T s + 1",
+ style(color=0)),
+ Line(points=[-50, 0; 50, 0], style(color=0)),
+ Rectangle(extent=[-60, 60; 60, -60]),
+ Line(points=[-100, 0; -60, 0]),
+ Line(points=[60, 0; 100, 0])),
Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
+ extent=[-100, -100; 100, 100],
+ grid=[2, 2],
+ component=[20, 20]),
Window(
- x=0.15,
- y=0.04,
- width=0.52,
+ x=0.15,
+ y=0.04,
+ width=0.52,
height=0.55));
- equation
+ equation
for i in 1:n loop
der(y[i]) = (p_k[i]*u[i] - y[i])/p_T[i];
end for;
end FirstOrder;
-
- block SecondOrder "Second order transfer function block (= 2 poles)"
+
+ block SecondOrder "Second order transfer function block (= 2 poles)"
parameter Real k[:]={1} "Gain";
parameter Real w[:]={1} "Angular frequency";
parameter Real D[:]={1} "Damping";
-
- extends Interfaces.MIMOs(final n=max([size(k, 1); size(w, 1); size(D, 1)])
- );
+
+ extends Interfaces.MIMOs(final n=max([size(k, 1); size(w, 1); size(D, 1)]))
+ ;
output Real yd[n] "Derivative of y";
- protected
+ protected
parameter Real p_k[n]=(if size(k, 1) == 1 then ones(n)*k[1] else k);
parameter Real p_w[n]=(if size(w, 1) == 1 then ones(n)*w[1] else w);
parameter Real p_D[n]=(if size(D, 1) == 1 then ones(n)*D[1] else D);
annotation (
Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
+ extent=[-100, -100; 100, 100],
+ grid=[2, 2],
+ component=[20, 20]),
Window(
- x=0.23,
- y=0.1,
- width=0.54,
- height=0.49),
- Documentation(info="
-
+ x=0.23,
+ y=0.1,
+ width=0.54,
+ height=0.49),
+ Documentation(info="
+ by Martin Otter:
Vectorized.
+ by Martin Otter:
Realized.
b = {k}, a = {1/w^2, 2*D/w, 1}.
@@ -478,7 +448,7 @@ b = {k}, a = {1/w^2, 2*D/w, 1}.
Example:
-
+
parameter: k = {0.3}, w = {0.5}, D = {0.4}
results in:
@@ -491,112 +461,102 @@ Example:
-"),
+"),
Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
+ Line(points=[-80, 78; -80, -90], style(color=8)),
Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 88; -80, 90], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-80, -80; -72, -68.53; -64, -39.5; -56, -2.522; -48,
- 32.75; -40, 58.8; -32, 71.51; -24, 70.49; -16, 58.45; -8, 40.06;
- 0, 20.55; 8, 4.459; 16, -5.271; 24, -7.629; 32, -3.428; 40, 5.21
- ; 48, 15.56; 56, 25.03; 64, 31.66; 72, 34.5; 80, 33.61]),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-80, -80; -72, -68.53; -64, -39.5; -56, -2.522; -48, 32.75
+ ; -40, 58.8; -32, 71.51; -24, 70.49; -16, 58.45; -8, 40.06; 0,
+ 20.55; 8, 4.459; 16, -5.271; 24, -7.629; 32, -3.428; 40, 5.21; 48
+ , 15.56; 56, 25.03; 64, 31.66; 72, 34.5; 80, 33.61]),
Text(
- extent=[0, -10; 60, -70],
- string="PT2",
- style(color=8)),
+ extent=[0, -10; 60, -70],
+ string="PT2",
+ style(color=8)),
Text(
- extent=[-150, -150; 150, -110],
- string="w=%w",
- style(color=0))),
+ extent=[-150, -150; 150, -110],
+ string="w=%w",
+ style(color=0))),
Diagram(
- Rectangle(extent=[-60, 60; 60, -60]),
+ Rectangle(extent=[-60, 60; 60, -60]),
Text(
- extent=[-60, 60; 60, 14],
- string="k",
- style(color=0)),
+ extent=[-60, 60; 60, 14],
+ string="k",
+ style(color=0)),
Text(
- extent=[-60, 8; -32, -20],
- string="s",
- style(color=0)),
- Line(points=[-100, 0; -60, 0]),
- Line(points=[60, 0; 100, 0]),
- Line(points=[-50, 14; 50, 14], style(color=0)),
- Line(points=[-54, -20; -38, -20], style(color=0)),
+ extent=[-60, 8; -32, -20],
+ string="s",
+ style(color=0)),
+ Line(points=[-100, 0; -60, 0]),
+ Line(points=[60, 0; 100, 0]),
+ Line(points=[-50, 14; 50, 14], style(color=0)),
+ Line(points=[-54, -20; -38, -20], style(color=0)),
Text(
- extent=[-52, -26; -36, -48],
- string="w",
- style(color=0)),
- Line(points=[-50, 2; -56, -8; -56, -28; -52, -46], style(color=0)),
- Line(points=[-40, 2; -34, -10; -34, -30; -38, -46], style(color=0)),
+ extent=[-52, -26; -36, -48],
+ string="w",
+ style(color=0)),
+ Line(points=[-50, 2; -56, -8; -56, -28; -52, -46], style(color=0)),
+ Line(points=[-40, 2; -34, -10; -34, -30; -38, -46], style(color=0)),
Text(
- extent=[-34, 8; -22, -10],
- string="2",
- style(color=0)),
+ extent=[-34, 8; -22, -10],
+ string="2",
+ style(color=0)),
Text(
- extent=[-34, -6; 6, -36],
- string="+2D",
- style(color=0)),
+ extent=[-34, -6; 6, -36],
+ string="+2D",
+ style(color=0)),
Text(
- extent=[2, 8; 30, -20],
- string="s",
- style(color=0)),
- Line(points=[8, -20; 24, -20], style(color=0)),
+ extent=[2, 8; 30, -20],
+ string="s",
+ style(color=0)),
+ Line(points=[8, -20; 24, -20], style(color=0)),
Text(
- extent=[10, -26; 26, -48],
- string="w",
- style(color=0)),
- Line(points=[12, 2; 6, -8; 6, -28; 10, -46], style(color=0)),
- Line(points=[22, 2; 28, -10; 28, -30; 24, -46], style(color=0)),
+ extent=[10, -26; 26, -48],
+ string="w",
+ style(color=0)),
+ Line(points=[12, 2; 6, -8; 6, -28; 10, -46], style(color=0)),
+ Line(points=[22, 2; 28, -10; 28, -30; 24, -46], style(color=0)),
Text(
- extent=[30, 2; 58, -42],
- string="+1",
+ extent=[30, 2; 58, -42],
+ string="+1",
style(color=0))));
- equation
+ equation
for i in 1:n loop
der(y[i]) = yd[i];
der(yd[i]) = p_w[i]*(p_w[i]*(p_k[i]*u[i] - y[i]) - 2*p_D[i]*yd[i]);
end for;
end SecondOrder;
-
- block PI "Proportional-Integral controller"
+
+ block PI "Proportional-Integral controller"
parameter Real k[:]={1} "Gain";
- parameter SIunits.Time T[:]={1} "Time Constant (T>0 required)";
-
+ parameter SI.Time T[:]={1} "Time Constant (T>0 required)";
+
extends Interfaces.MIMOs(final n=max([size(k, 1); size(T, 1)]));
output Real x[n] "State of block";
-
- protected
+
+ protected
parameter Real p_k[n]=(if size(k, 1) == 1 then ones(n)*k[1] else k);
parameter Real p_T[n]=(if size(T, 1) == 1 then ones(n)*T[1] else T);
annotation (
- Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
- Window(
- x=0.24,
- y=0.13,
- width=0.56,
- height=0.5),
- Documentation(info="
-
+ Documentation(info="
+ by Martin Otter:
Vectorized and state space representation changed, such
that the output and its derivative are used as state.
+ by Martin Otter:
Realized.
b = {k*T, k}, a = {T, 0}.
@@ -622,9 +582,9 @@ b = {k*T, k}, a = {T, 0}.
Example:
-
+
parameter: k = {0.3}, T = {0.4}
-
+
results in:
0.4 s + 1
@@ -635,97 +595,86 @@ Example:
-"),
+"),
Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
+ Line(points=[-80, 78; -80, -90], style(color=8)),
Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 88; -80, 90], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(
- color=8,
- fillColor=8,
- fillPattern=1)),
- Line(points=[-80, -80; -80, -20; 60, 80], style(thickness=1)),
+ color=8,
+ fillColor=8,
+ fillPattern=1)),
+ Line(points=[-80, -80; -80, -20; 60, 80], style(thickness=1)),
Text(
- extent=[0, 6; 60, -56],
- string="PI",
- style(color=8)),
+ extent=[0, 6; 60, -56],
+ string="PI",
+ style(color=8)),
Text(
- extent=[-150, -150; 150, -110],
- string="T=%T",
- style(color=0))),
+ extent=[-150, -150; 150, -110],
+ string="T=%T",
+ style(color=0))),
Diagram(
- Rectangle(extent=[-60, 60; 60, -60]),
+ Rectangle(extent=[-60, 60; 60, -60]),
Text(
- extent=[-68, 24; -24, -18],
- string="k",
- style(color=0)),
+ extent=[-68, 24; -24, -18],
+ string="k",
+ style(color=0)),
Text(
- extent=[-32, 48; 60, 0],
- string="T s + 1",
- style(color=0)),
+ extent=[-32, 48; 60, 0],
+ string="T s + 1",
+ style(color=0)),
Text(
- extent=[-30, -8; 52, -40],
- string="T s",
- style(color=0)),
- Line(points=[-24, 0; 54, 0], style(color=0)),
- Line(points=[-100, 0; -60, 0]),
+ extent=[-30, -8; 52, -40],
+ string="T s",
+ style(color=0)),
+ Line(points=[-24, 0; 54, 0], style(color=0)),
+ Line(points=[-100, 0; -60, 0]),
Line(points=[62, 0; 100, 0])));
- equation
+ equation
for i in 1:n loop
der(x[i]) = u[i]/p_T[i];
y[i] = p_k[i]*(x[i] + u[i]);
end for;
end PI;
-
- block PID "PID-controller in additive description form"
+
+ block PID "PID-controller in additive description form"
extends Interfaces.SISO;
-
+
parameter Real k=1 "Gain";
- parameter SIunits.Time Ti(min=Modelica.Constants.SMALL) = 0.5
+ parameter SI.Time Ti(min=Modelica.Constants.small) = 0.5
"Time Constant of Integrator";
- parameter SIunits.Time Td(min=0) = 0.1 "Time Constant of Derivative block";
- parameter Real Nd(min=Modelica.Constants.SMALL) = 10
+ parameter SI.Time Td(min=0) = 0.1 "Time Constant of Derivative block";
+ parameter Real Nd(min=Modelica.Constants.small) = 10
"The higher Nd, the more ideal the derivative block";
-
- annotation (
- Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
- Window(
- x=0.15,
- y=0.04,
- width=0.55,
- height=0.68),
- Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
- Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8,
- fillColor=8)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
- Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(color=8,
- fillColor=8)),
- Line(points=[-80, -80; -80, 50; -80, -20; 60, 80]),
+
+ annotation (Icon(
+ Line(points=[-80, 78; -80, -90], style(color=8)),
+ Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8,
+ fillColor=8)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
+ Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(color=8,
+ fillColor=8)),
+ Line(points=[-80, -80; -80, 50; -80, -20; 60, 80]),
Text(
- extent=[-20, -20; 80, -60],
- string="PID",
- style(color=8)),
+ extent=[-20, -20; 80, -60],
+ string="PID",
+ style(color=8)),
Text(
- extent=[-150, -150; 150, -110],
- string="Ti=%Ti",
- style(color=0))),
- Documentation(info="
+ extent=[-150, -150; 150, -110],
+ string="Ti=%Ti",
+ style(color=0))), Documentation(info="
+ by Martin Otter:
Vectorized.
+ by Martin Otter:
Realized.
"));
- Modelica.Blocks.Math.Gain P "Proportional part of PID controller"
- annotation (extent=[-60, 60; -20, 100]);
- Modelica.Blocks.Continuous.Integrator I(k={1/Ti})
- "Integral part of PID controller" annotation (extent=[-60, -20; -20, 20])
- ;
- Modelica.Blocks.Continuous.Derivative D(k={Td}, T={max([Td/Nd, 100*
- Modelica.Constants.EPS])}) "Derivative part of PID controller"
- annotation (extent=[-60, -100; -20, -60]);
- Modelica.Blocks.Math.Gain Gain(k={k}) "Gain of PID controller" annotation
- (extent=[60, -10; 80, 10]);
- Modelica.Blocks.Math.Add3 Add annotation (extent=[20, -10; 40, 10]);
- equation
- connect(P.outPort, Add.inPort1) annotation (points=[-20, 80; 0, 80; 0, 8
- ; 20, 8]);
- equation
+ Math.Gain P "Proportional part of PID controller" annotation (extent=[-60,
+ 60; -20, 100]);
+ Integrator I(k={1/Ti}) "Integral part of PID controller" annotation (extent
+ =[-60, -20; -20, 20]);
+ Derivative D(k={Td}, T={max([Td/Nd, 100*Modelica.Constants.eps])})
+ "Derivative part of PID controller" annotation (extent=[-60, -100; -20, -
+ 60]);
+ Math.Gain Gain(k={k}) "Gain of PID controller" annotation (extent=[60, -10
+ ; 80, 10]);
+ Math.Add3 Add annotation (extent=[20, -10; 40, 10]);
+ equation
+ connect(P.outPort, Add.inPort1) annotation (points=[-20, 80; 0, 80; 0, 8;
+ 20, 8]);
connect(I.outPort, Add.inPort2) annotation (points=[-20, 0; 20, 0]);
- equation
- connect(D.outPort, Add.inPort3) annotation (points=[-20, -80; 0, -80; 0
- , -8; 20, -8]);
- equation
+ connect(D.outPort, Add.inPort3) annotation (points=[-20, -80; 0, -80; 0, -8
+ ; 20, -8]);
connect(Add.outPort, Gain.inPort) annotation (points=[40, 0; 60, 0]);
- equation
connect(outPort, Gain.outPort) annotation (points=[100, 0; 80, 0]);
- equation
connect(inPort, I.inPort) annotation (points=[-100, 0; -60, 0]);
- equation
- connect(inPort, P.inPort) annotation (points=[-100, 0; -80, 0; -80, 80;
- -60, 80]);
- equation
- connect(inPort, D.inPort) annotation (points=[-100, 0; -80, 0; -80, -80
- ; -60, -80]);
+ connect(inPort, P.inPort) annotation (points=[-100, 0; -80, 0; -80, 80; -60
+ , 80]);
+ connect(inPort, D.inPort) annotation (points=[-100, 0; -80, 0; -80, -80; -
+ 60, -80]);
end PID;
-
- block LimPID
+
+ block LimPID
"PID controller with limited output, anti-windup compensation and setpoint weighting"
-
+
+
extends Interfaces.SVcontrol;
-
+
parameter Real k(min=0) = 1 "Gain of PID block";
- parameter SIunits.Time Ti(min=Modelica.Constants.SMALL) = 0.5
+ parameter SI.Time Ti(min=Modelica.Constants.small) = 0.5
"Time constant of Integrator block";
- parameter SIunits.Time Td(min=0) = 0.1 "Time constant of Derivative block";
+ parameter SI.Time Td(min=0) = 0.1 "Time constant of Derivative block";
parameter Real yMax=1 "Upper limit of output";
- parameter Real yMin(max=yMax) = -yMax "Lower limit of output";
- parameter Real wp(min=0) = 1
+ parameter Real yMin=-yMax "Lower limit of output";
+ parameter Real wp(min=0) = 1
"Set-point weight for Proportional block (0..1)";
- parameter Real wd(min=0) = 0
- "Set-point weight for Derivative block (0..1)";
- parameter Real Ni(min=100*Modelica.Constants.EPS) = 0.9
+ parameter Real wd(min=0) = 0 "Set-point weight for Derivative block (0..1)"
+ ;
+ parameter Real Ni(min=100*Modelica.Constants.eps) = 0.9
"Ni*Ti is time constant of anti-windup compensation";
- parameter Real Nd(min=100*Modelica.Constants.EPS) = 10
+ parameter Real Nd(min=100*Modelica.Constants.eps) = 10
"The higher Nd, the more ideal the derivative block";
- Modelica.Blocks.Nonlinear.Limiter limiter(uMax={yMax}, uMin={yMin})
- annotation (extent=[70, -10; 90, 10]);
+ Nonlinear.Limiter limiter(uMax={yMax}, uMin={yMin}) annotation (extent=[70
+ , -10; 90, 10]);
annotation (
Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
+ extent=[-100, -100; 100, 100],
+ grid=[2, 2],
+ component=[20, 20]),
Window(
- x=0.22,
- y=0.02,
- width=0.6,
- height=0.72),
+ x=0.22,
+ y=0.02,
+ width=0.6,
+ height=0.72),
Icon(
- Line(points=[-80, 78; -80, -90], style(color=8)),
- Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8,
- fillColor=8)),
- Line(points=[-90, -80; 82, -80], style(color=8)),
- Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(color=8,
- fillColor=8)),
- Line(points=[-80, -80; -80, 50; -80, -20; 30, 60; 80, 60]),
+ Line(points=[-80, 78; -80, -90], style(color=8)),
+ Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8,
+ fillColor=8)),
+ Line(points=[-90, -80; 82, -80], style(color=8)),
+ Polygon(points=[90, -80; 68, -72; 68, -88; 90, -80], style(color=8,
+ fillColor=8)),
+ Line(points=[-80, -80; -80, 50; -80, -20; 30, 60; 80, 60]),
Text(
- extent=[-20, -20; 80, -60],
- string="PID",
- style(color=8))),
+ extent=[-20, -20; 80, -60],
+ string="PID",
+ style(color=8))),
Documentation(info="
+ by Martin Otter:
Realized.
"));
- Modelica.Blocks.Math.Add addP(k1=wp, k2=-1) annotation (extent=[-80, 40;
- -60, 60]);
- Modelica.Blocks.Math.Add addD(k1=wd, k2=-1) annotation (extent=[-80, -10;
- -60, 10]);
- Modelica.Blocks.Math.Gain P annotation (extent=[-40, 40; -20, 60]);
- Modelica.Blocks.Continuous.Integrator I(k={1/Ti}) annotation (extent=[-40
- , -60; -20, -40]);
- Modelica.Blocks.Continuous.Derivative D(k={Td}, T={max([Td/Nd, 1.e-14])})
- annotation (extent=[-40, -10; -20, 10]);
- Modelica.Blocks.Math.Gain gainPID(k={k}) annotation (extent=[30, -10; 50,
- 10]);
- Modelica.Blocks.Math.Add3 addPID annotation (extent=[0, -10; 20, 10]);
- Modelica.Blocks.Math.Add3 addI(k2=-1) annotation (extent=[-80, -60; -60,
- -40]);
- Modelica.Blocks.Math.Add addSat(k2=-1) annotation (extent=[70, -60; 90,
- -40], rotation=-90);
- Modelica.Blocks.Math.Gain gainTrack(k={1/(k*Ni)}) annotation (extent=[40,
- -80; 20, -60]);
- equation
- connect(inPort_s, addP.inPort1) annotation (points=[-102, 0; -96, 0; -96
- , 56; -80, 56]);
- equation
- connect(inPort_m, addP.inPort2) annotation (points=[0, -100; 0, -92; -92
- , -92; -92, 44; -80, 44], style(thickness=2));
- equation
- connect(inPort_s, addD.inPort1) annotation (points=[-102, 0; -96, 0; -96
- , 6; -82, 6]);
- equation
- connect(inPort_m, addD.inPort2) annotation (points=[0, -100; 0, -92; -92
- , -92; -92, -6; -82, -6; -82, -6], style(thickness=2));
- equation
- connect(inPort_s, addI.inPort1) annotation (points=[-100, 0; -96, 0; -96
- , -42; -82, -42]);
- equation
- connect(inPort_m, addI.inPort2) annotation (points=[0, -104; 0, -92; -92
- , -92; -92, -50; -80, -50], style(thickness=2));
- equation
- connect(gainTrack.outPort, addI.inPort3) annotation (points=[20, -70;
- -88, -70; -88, -58; -80, -58]);
- equation
- connect(addP.outPort, P.inPort) annotation (points=[-60, 50; -40, 50;
- -40, 50]);
- equation
- connect(addD.outPort, D.inPort) annotation (points=[-60, 0; -50, 0]);
- equation
- connect(addI.outPort, I.inPort) annotation (points=[-58, -50; -40, -50])
+ Math.Add addP(k1=wp, k2=-1) annotation (extent=[-80, 40; -60, 60]);
+ Math.Add addD(k1=wd, k2=-1) annotation (extent=[-80, -10; -60, 10]);
+ Math.Gain P annotation (extent=[-40, 40; -20, 60]);
+ Integrator I(k={1/Ti}) annotation (extent=[-40, -60; -20, -40]);
+ Derivative D(k={Td}, T={max([Td/Nd, 1.e-14])}) annotation (extent=[-40, -10
+ ; -20, 10]);
+ Math.Gain gainPID(k={k}) annotation (extent=[30, -10; 50, 10]);
+ Math.Add3 addPID annotation (extent=[0, -10; 20, 10]);
+ Math.Add3 addI(k2=-1) annotation (extent=[-80, -60; -60, -40]);
+ Math.Add addSat(k2=-1) annotation (extent=[70, -60; 90, -40], rotation=-90)
;
- equation
- connect(P.outPort, addPID.inPort1) annotation (points=[-18, 50; -10, 50
- ; -10, 8; 0, 8]);
- equation
- connect(D.outPort, addPID.inPort2) annotation (points=[-20, 0; -2, 0; -2
- , 0]);
- equation
- connect(I.outPort, addPID.inPort3) annotation (points=[-18, -50; -10,
- -50; -10, -8; -2, -8; -2, -8]);
- equation
- connect(addPID.outPort, gainPID.inPort) annotation (points=[21, 0; 28, 0
+ Math.Gain gainTrack(k={1/(k*Ni)}) annotation (extent=[40, -80; 20, -60]);
+ equation
+ assert(yMax >= yMin, "PID: Limits must be consistent");
+ connect(inPort_s, addP.inPort1) annotation (points=[-102, 0; -96, 0; -96,
+ 56; -80, 56]);
+ connect(inPort_m, addP.inPort2) annotation (points=[0, -100; 0, -92; -92, -
+ 92; -92, 44; -80, 44], style(thickness=2));
+ connect(inPort_s, addD.inPort1) annotation (points=[-102, 0; -96, 0; -96, 6
+ ; -82, 6]);
+ connect(inPort_m, addD.inPort2) annotation (points=[0, -100; 0, -92; -92, -
+ 92; -92, -6; -82, -6; -82, -6], style(thickness=2));
+ connect(inPort_s, addI.inPort1) annotation (points=[-100, 0; -96, 0; -96, -
+ 42; -82, -42]);
+ connect(inPort_m, addI.inPort2) annotation (points=[0, -104; 0, -92; -92, -
+ 92; -92, -50; -80, -50], style(thickness=2));
+ connect(gainTrack.outPort, addI.inPort3) annotation (points=[20, -70; -88,
+ -70; -88, -58; -80, -58]);
+ connect(addP.outPort, P.inPort) annotation (points=[-60, 50; -40, 50; -40,
+ 50]);
+ connect(addD.outPort, D.inPort) annotation (points=[-60, 0; -50, 0]);
+ connect(addI.outPort, I.inPort) annotation (points=[-58, -50; -40, -50]);
+ connect(P.outPort, addPID.inPort1) annotation (points=[-18, 50; -10, 50; -
+ 10, 8; 0, 8]);
+ connect(D.outPort, addPID.inPort2) annotation (points=[-20, 0; -2, 0; -2, 0
]);
- equation
- connect(gainPID.outPort, addSat.inPort2) annotation (points=[50, 0; 60,
- 0; 60, -30; 74, -30; 74, -40]);
- equation
- connect(addSat.outPort, gainTrack.inPort) annotation (points=[80, -62;
- 80, -70; 42, -70]);
- equation
- connect(gainPID.outPort, limiter.inPort) annotation (points=[50, 0; 70,
- 0]);
- equation
+ connect(I.outPort, addPID.inPort3) annotation (points=[-18, -50; -10, -50;
+ -10, -8; -2, -8; -2, -8]);
+ connect(addPID.outPort, gainPID.inPort) annotation (points=[21, 0; 28, 0]);
+ connect(gainPID.outPort, addSat.inPort2) annotation (points=[50, 0; 60, 0;
+ 60, -30; 74, -30; 74, -40]);
+ connect(addSat.outPort, gainTrack.inPort) annotation (points=[80, -62; 80,
+ -70; 42, -70]);
+ connect(gainPID.outPort, limiter.inPort) annotation (points=[50, 0; 70, 0])
+ ;
connect(limiter.outPort, outPort) annotation (points=[90, 0; 100, 0]);
- equation
- connect(limiter.outPort, addSat.inPort1) annotation (points=[90, 0; 94,
- 0; 94, -20; 86, -20; 86, -40]);
+ connect(limiter.outPort, addSat.inPort1) annotation (points=[90, 0; 94, 0;
+ 94, -20; 86, -20; 86, -40]);
end LimPID;
-
- block TransferFunction "Linear transfer function"
+
+ block TransferFunction "Linear transfer function"
extends Interfaces.SISO;
-
+
parameter Real b[:]={1} "Numerator coefficients of transfer function.";
- parameter Real a[:]={1,1} "Denominator coefficients of transfer function."
- ;
- output Real x[size(a, 1) - 1]
+ parameter Real a[:]={1,1} "Denominator coefficients of transfer function.";
+ output Real x[size(a, 1) - 1]
"State of transfer function from controller canonical form";
-
- protected
- parameter Integer na=size(a, 1)
- "Size of Denominator of transfer function.";
- parameter Integer nb(max=na) = size(b, 1)
+
+ protected
+ parameter Integer na=size(a, 1) "Size of Denominator of transfer function."
+ ;
+ parameter Integer nb(max=na) = size(b, 1)
"Size of Numerator of transfer function.";
parameter Integer nx=size(a, 1) - 1;
Real x1dot "Derivative of first state of TransferFcn";
Real xn "Highest order state of TransferFcn";
annotation (
Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
+ extent=[-100, -100; 100, 100],
+ grid=[2, 2],
+ component=[20, 20]),
Window(
- x=0.39,
- y=0.09,
- width=0.58,
- height=0.77),
- Documentation(info="
-
+ x=0.39,
+ y=0.09,
+ width=0.58,
+ height=0.77),
+ Documentation(info="
+ by Martin Otter:
Realized.
-"),
+"),
Icon(
- Line(points=[-80, 0; 80, 0]),
- Text(extent=[-90, 10; 90, 90], string="b(s)"),
- Text(extent=[-90, -10; 90, -90], string="a(s)")),
+ Line(points=[-80, 0; 80, 0]),
+ Text(extent=[-90, 10; 90, 90], string="b(s)"),
+ Text(extent=[-90, -10; 90, -90], string="a(s)")),
Diagram(
- Line(points=[40, 0; -40, 0], style(color=0)),
+ Line(points=[40, 0; -40, 0], style(color=0)),
Text(
- extent=[-55, 55; 55, 5],
- string="b(s)",
- style(color=0)),
+ extent=[-55, 55; 55, 5],
+ string="b(s)",
+ style(color=0)),
Text(
- extent=[-55, -5; 55, -55],
- string="a(s)",
- style(color=0)),
- Rectangle(extent=[-60, 60; 60, -60]),
- Line(points=[-100, 0; -60, 0]),
+ extent=[-55, -5; 55, -55],
+ string="a(s)",
+ style(color=0)),
+ Rectangle(extent=[-60, 60; 60, -60]),
+ Line(points=[-100, 0; -60, 0]),
Line(points=[60, 0; 100, 0])));
- equation
+ equation
[der(x); xn] = [x1dot; x];
[u] = transpose([a])*[x1dot; x];
[y] = transpose([zeros(na - nb, 1); b])*[x1dot; x];
end TransferFunction;
-
- block StateSpace "Linear state space system"
- parameter Real A[:, size(A, 1)]=[1, 0; 0, 1]
+
+ block StateSpace "Linear state space system"
+ parameter Real A[:, size(A, 1)]=[1, 0; 0, 1]
"Matrix A of state space model";
parameter Real B[size(A, 1), :]=[1; 1] "Matrix B of state space model";
parameter Real C[:, size(A, 1)]=[1, 1] "Matrix C of state space model";
- parameter Real D[size(C, 1), size(B, 2)]=zeros(size(C, 1), size(B, 2))
+ parameter Real D[size(C, 1), size(B, 2)]=zeros(size(C, 1), size(B, 2))
"Matrix D of state space model";
-
+
extends Interfaces.MIMO(final nin=size(B, 2), final nout=size(C, 1));
output Real x[size(A, 1)] "State vector";
annotation (
Coordsys(
- extent=[-100, -100; 100, 100],
- grid=[2, 2],
- component=[20, 20]),
+ extent=[-100, -100; 100, 100],
+ grid=[2, 2],
+ component=[20, 20]),
Window(
- x=0.2,
- y=0.03,
- width=0.64,
- height=0.73),
- Documentation(info="
-
+ x=0.2,
+ y=0.03,
+ width=0.64,
+ height=0.73),
+ Documentation(info="
- Realized based on a realization of the corresponding
+ by Martin Otter:
+ Realized based on a realization of the corresponding
Dymola library of Hilding Elmqvist.
-
+
+
der(x) = A * x + B * u
y = C * x + D * u
@@ -1072,19 +986,19 @@ The input is a vector of length nu, the output is a vector
of length ny and nx is the number of states. Accordingly
- A has the dimension: A(nx,nx), - B has the dimension: B(nx,nu), - C has the dimension: C(ny,nx), - D has the dimension: D(ny,nu) + A has the dimension: A(nx,nx), + B has the dimension: B(nx,nu), + C has the dimension: C(ny,nx), + D has the dimension: D(ny,nu)
Example:
- parameter: A = [0.12, 2;3, 1.5] - parameter: B = [2, 7;3, 1] - parameter: C = [0.1, 2] + parameter: A = [0.12, 2;3, 1.5] + parameter: B = [2, 7;3, 1] + parameter: C = [0.1, 2] parameter: D = zeros(ny,nu) results in the following equations: @@ -1097,30 +1011,48 @@ results in the following equations: [x[2]] [u[2]]-"), +"), Icon( - Text(extent=[-90, 10; -10, 90], string="A"), - Text(extent=[10, 10; 90, 90], string="B"), - Text(extent=[-90, -10; -10, -90], string="C"), - Text(extent=[10, -10; 90, -90], string="D"), - Line(points=[0, -90; 0, 90], style(color=8)), - Line(points=[-90, 0; 90, 0], style(color=8))), + Text(extent=[-90, 10; -10, 90], string="A"), + Text(extent=[10, 10; 90, 90], string="B"), + Text(extent=[-90, -10; -10, -90], string="C"), + Text(extent=[10, -10; 90, -90], string="D"), + Line(points=[0, -90; 0, 90], style(color=8)), + Line(points=[-90, 0; 90, 0], style(color=8))), Diagram( - Rectangle(extent=[-60, 60; 60, -60]), + Rectangle(extent=[-60, 60; 60, -60]), Text( - extent=[-60, 40; 60, 0], - string="sx=Ax+Bu", - style(color=0)), + extent=[-60, 40; 60, 0], + string="sx=Ax+Bu", + style(color=0)), Text( - extent=[-60, 0; 60, -40], - string=" y=Cx+Du", - style(color=0)), - Line(points=[-100, 0; -60, 0]), + extent=[-60, 0; 60, -40], + string=" y=Cx+Du", + style(color=0)), + Line(points=[-100, 0; -60, 0]), Line(points=[60, 0; 100, 0]))); - equation + equation der(x) = A*x + B*u; y = C*x + D*u; end StateSpace; - -end Continuous; + block Der "Derivative of input (= analytic differentations)" + extends Interfaces.MIMOs; + + annotation (Icon(Text(extent=[-80, 76; 80, -82], string="der()")), + Documentation(info=" +
+Defines that the output (= outPort.signal) is the derivative +of the input (=inPort.signal). Note, that Modelica.Blocks.Continuous.Derivative +computes the derivative in an approximate sense, where this block computes +the derivative exactly. This requires that the input signals are differentiated +by the Modelica translator, if these derivatives are not yet present in +the model. +
+")); + equation + for i in 1:n loop + y[i] = der(u[i]); + end for; + end Der; +end Continuous; diff --git a/Blocks/Examples.mo b/Blocks/Examples.mo new file mode 100644 index 0000000000..3a212e8613 --- /dev/null +++ b/Blocks/Examples.mo @@ -0,0 +1,301 @@ +package Examples "Demonstration examples of the components of this package" + + extends Icons.Library; + + encapsulated model BusUsage "Demonstration of signal bus usage" + import Modelica.Icons; + import Modelica.Blocks.Interfaces.BusAdaptors; + import Modelica.Blocks.Sources; + + extends Icons.Example; + + annotation (Documentation(info=" +Signal bus concept
+ ++In technical systems, such as vehicles, robots or satellites, many signals +are exchanged between components. In a simulation system, these signals +are usually modelled by signal connections of input/output blocks. +Unfortunately, the signal connection structure may become very complicated, +especially for hierarchical models. +
+ ++The same is also true for real technical systems. To reduce complexity +and get higher flexibility, many technical systems use data buses to +exchange data between components. For the same reasons, it is often better +to use a \"signal bus\" concept also in a Modelica model. This is demonstrated +at hand of this model (Modelica.Blocks.Examples.BusUsage), see diagram layer: +
+ ++Difficulties arise if the input or output connector of an +input/output block shall be connected directly to a variable +of a bus because connections can only be performed between +connectors but not between variables. For convenience, +single variable connectors for Real, Integer and Boolean +variables are provided as Modelica.Blocks.Interfaces.RealPort, +Modelica.Blocks.Interfaces.IntegerPort, +Modelica.Blocks.Interfaces.BooleanPort. +For example, the RealPort connector is basically defined as: +
+connector RealPort = Real; ++ +
+This allows a definition of a bus in the form: +
+ +connector Bus + RealPort r1; + RealPort r2; + ... + end Bus; ++ +
+and a connection to r1 and r2 is possible since these are connectors. +Unfortunately, signals defined in this way have, by default, no unit. +To improve this situation, a RealPort is actually defined as +
+ +connector RealPort + replaceable type SignalType = Real; + extends SignalType; + end RealPort; ++ +
+This allows a redeclaration of the Real type to the desired type, such as: +
+ +connector Bus + import SI=Modelica.SIunits; + RealPort v(redeclare SignalType=SI.Velocity); + RealPort p(redeclare SignalType=SI.Pressure); + ... + end Bus; ++ +
+In order to connect from a RealPort connector to an InPort or OutPort +connector of a block from the Modelica.Blocks package, an adaptor block +is needed, since the two connectors are not compatible. Appropriate adaptors +are provided in Modelica.Blocks.Interfaces.BusAdaptors. The usage can +be seen in the diagram layer of the model at hand +(Modelica.Blocks.Examples.BusUsage). +
+ ++If a bus connector contains many signals it is no longer so easy +to test just one part of a system, because all parts of +the bus connector must get a value. To simplify this, +it is practical to provide a RestBus component which +sets all parts of a bus to a default value when selected +via the parameter menu. This is also demonstrated in the example +model (see diagram layer). +
+ +Simulate the system for 1 s. The outputs of the 'receive' signal +blocks should be the same as the inputs of the 'send' signal blocks. +
+")); + protected + Interfaces.Bus bus annotation (extent=[-80, -20; 80, -14]); + public + BusAdaptors.SendReal putRealSignal1 annotation (extent=[-60, 0; -40, 20], + rotation=-90); + BusAdaptors.SendBoolean putBooleanSignal annotation (extent=[-20, 0; 0, 20] + , rotation=-90); + BusAdaptors.SendInteger putIntegerSignal annotation (extent=[20, 0; 40, 20] + , rotation=-90); + BusAdaptors.ReceiveReal getRealSignal1 annotation (extent=[-40, -80; -20, - + 60], rotation=-90); + BusAdaptors.ReceiveBoolean getBooleanSignal annotation (extent=[0, -80; 20 + , -60], rotation=-90); + BusAdaptors.ReceiveInteger getIntegerSignal annotation (extent=[40, -80; 60 + , -60], rotation=-90); + RestBus restBus(set_realSignal2=true) annotation (extent=[60, 20; 80, 40]); + Sources.IntegerStep generateIntegerSignal( + height={1}, + offset={2}, + startTime={0.5}) annotation (extent=[20, 60; 40, 80], rotation=270); + Sources.BooleanStep generateBooleanSignal(startTime={0.5}) annotation ( + extent=[-20, 60; 0, 80], rotation=270); + Sources.Sine generateRealSignal1 annotation (extent=[-60, 60; -40, 80], + rotation=270); + + encapsulated package Interfaces "Interfaces specialised for this example" + + connector MultiPort "Combined port of real and boolean signal" + Real myRealSignal; + Boolean myBooleanSignal; + + annotation (Icon(Rectangle(extent=[-100, 100; 100, -100], style( + fillColor=76, fillPattern=1))), Diagram(Rectangle(extent=[- + 100, 100; 100, -100], style(fillColor=76, fillPattern=1)))); + end MultiPort; + + connector Bus "Signal bus" + import SI = Modelica.SIunits; + import Modelica.Blocks.Interfaces.*; + + RealPort realSignal1(redeclare type SignalType = SI.AngularVelocity) + "First Real signal (angular velocity)"; + RealPort realSignal2 "Second Real signal"; + IntegerPort integerSignal "Integer signal"; + BooleanPort booleanSignal "Boolean signal"; + MultiPort multiSignal "Combined signal"; + + annotation ( + Icon(Rectangle(extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-134, 168; 134, 108], + string="%name", + style(color=77))), + Diagram(Text( + extent=[-134, 168; 134, 108], + string="%name", + style(color=77)), Rectangle(extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1))), + Documentation(info=" +Defines connector for signalbus.
+ +")); + end Bus; + end Interfaces; + + encapsulated model Part "Component with MultiPort connector" + import Modelica.Blocks.Examples; + + Examples.BusUsage.Interfaces.MultiPort multiSignal annotation (extent=[ + 100, -10; 120, 10]); + + annotation (Icon(Rectangle(extent=[-100, 60; 100, -60], style(fillColor= + 76, fillPattern=1)), Text( + extent=[-106, 124; 114, 68], + style(fillColor=76, fillPattern=1), + string="%name"))); + equation + multiSignal.myRealSignal = time; + multiSignal.myBooleanSignal = time > 0.5; + end Part; + + encapsulated model RestBus + "Set default values for bus variables that are not defined elsewhere" + + import Modelica.Blocks.Examples; + + parameter Boolean set_realSignal1=false + "Set dummy value for desiredThrottle"; + parameter Boolean set_realSignal2=false "Set dummy value for brake"; + parameter Boolean set_integerSignal=false + "Set dummy value for controlLeverPosition"; + parameter Boolean set_booleanSignal=false + "Set dummy value for desiredGear"; + parameter Boolean set_multiSignal=false "Set dummy value for ignition"; + + annotation (Icon( + Rectangle(extent=[-100, 100; 100, -100], style(fillColor=7, + fillPattern=1)), + Text( + extent=[-100, 156; 100, 96], + string="%name", + style(pattern=0)), + style(color=77), + Text( + extent=[46, -10; 88, -40], + style(color=0), + string="0"), + Text( + extent=[-82, 62; 38, 34], + style(color=0), + string="false"), + Line(points=[-28, 24; -28, -66; 0, -66; 0, -104; 0, -102], style( + color=77, + fillColor=7, + fillPattern=1)), + Line(points=[68, -46; 68, -66; 0, -66; 0, -108], style( + color=77, + fillColor=7, + fillPattern=1)), + Rectangle(extent=[-90, 78; 46, 24], style(color=0)), + Rectangle(extent=[40, -4; 92, -46], style(color=0)))); + Examples.BusUsage.Interfaces.Bus bus annotation (extent=[-10, -120; 10, - + 100], rotation=90); + equation + if set_realSignal1 then + bus.realSignal1 = 0; + end if; + if set_realSignal2 then + bus.realSignal2 = 0; + end if; + if set_integerSignal then + bus.integerSignal = 0; + end if; + if set_booleanSignal then + bus.booleanSignal = false; + end if; + if set_multiSignal then + bus.multiSignal.myRealSignal = 0; + bus.multiSignal.myBooleanSignal = false; + end if; + end RestBus; + + Part part annotation (extent=[-100, -60; -80, -40]); + equation + + connect(putRealSignal1.toBus, bus.realSignal1) annotation (points=[-50, -2 + ; -50, -16], style(color=77)); + connect(putIntegerSignal.toBus, bus.integerSignal) annotation (points=[30, + -2; 30, -16], style(color=77)); + connect(generateRealSignal1.outPort, putRealSignal1.inPort) annotation ( + points=[-50, 58; -50, 24], style(color=3)); + connect(generateBooleanSignal.outPort, putBooleanSignal.inPort) annotation + (points=[-10, 58; -10, 24], style(color=5)); + connect(generateIntegerSignal.outPort, putIntegerSignal.inPort) annotation + (points=[30, 58; 30, 24], style(color=45)); + connect(getRealSignal1.fromBus, bus.realSignal1) annotation (points=[-30, - + 58; -30, -18], style(color=77)); + connect(getIntegerSignal.fromBus, bus.integerSignal) annotation (points=[50 + , -60; 50, -18], style(color=77)); + connect(restBus.bus, bus) annotation (points=[70, 20; 70, -18], style(color + =77)); + connect(putBooleanSignal.toBus, bus.booleanSignal) annotation (points=[-10 + , -2; -10, -16], style(color=77)); + connect(getBooleanSignal.fromBus, bus.booleanSignal) annotation (points=[10 + , -60; 10, -18], style(color=77)); + connect(part.multiSignal, bus.multiSignal) annotation (points=[-78, -50; - + 70, -50; -70, -18]); + end BusUsage; + + annotation (Documentation(info=" ++This package contains currently one example model to demonstrate the usage of the +signal bus concept provided by the Modelica.Blocks package. +
+ +Copyright © 2002, Modelica Association and DLR.
+ ++The Modelica package is free software; it can be redistributed and/or modified +under the terms of the Modelica license, see the license conditions +and the accompanying disclaimer in the documentation of package +Modelica in file \"Modelica/package.mo\". +
+ +")); + +end Examples; diff --git a/Blocks/Interfaces.mo b/Blocks/Interfaces.mo index 34ccf7821c..70d57d84fd 100644 --- a/Blocks/Interfaces.mo +++ b/Blocks/Interfaces.mo @@ -1,39 +1,36 @@ package Interfaces "Connectors and partial models for input/output blocks" + extends Modelica.Icons.Library; - package SIunits = Modelica.SIunits ; - - annotation ( - Coordsys( - extent=[0, 0; 294, 599], - grid=[2, 2], - component=[20, 20]), - Window( - x=0.03, - y=0.01, - width=0.24, - height=0.63, - library=1, - autolayout=1), - Documentation(info=" - + annotation (Window( + x=0.05, + y=0.09, + width=0.72, + height=0.71, + library=1, + autolayout=1), + Documentation(info="-This package contains interface definitions for +This package contains interface definitions for continuous input/output blocks. In particular it contains the following connector classes:
- InPort Connector with input signals of type Real. - OutPort Connector with output signals of type Real. - BooleanInPort Connector with input signals of type Boolean. - BooleanOutPort Connector with output signals of type Boolean. + InPort Connector with input signals of type Real. + OutPort Connector with output signals of type Real. + BooleanInPort Connector with input signals of type Boolean. + BooleanOutPort Connector with output signals of type Boolean. + IntegerInPort Connector with input signals of type Integer. + IntegerOutPort Connector with output signals of type Integer. + + RealPort Connector with input/output signals of type Real. + BooleanPort Connector with input/output signals of type Real. + IntegerPort Connector with input/output signals of type Real.-
-The following partial block classes are provided -to model continuous control blocks: -
+The following partial block classes are provided +to model continuous control blocks:
BlockIcon Basic graphical layout of continuous block @@ -41,16 +38,16 @@ to model continuous control blocks: MO Multiple Output continuous control block SISO Single Input Single Output continuous control block SI2SO 2 Single Input / 1 Single Output continuous control block + SIMO Single Input Multiple Output continuous control block MISO Multiple Input Single Output continuous control block MIMO Multiple Input Multiple Output continuous control block MIMOs Multiple Input Multiple Output continuous control block with same number of inputs and outputs - MI2MO 2 Multiple Input / Multiple Output continuous + MI2MO 2 Multiple Input / Multiple Output continuous control block SignalSource Base class for continuous signal sources - Periodic Base class for periodic continuous signal sources SVcontrol Single-Variable continuous controller - MVcontrol Multi-Variable continuous controller + MVcontrol Multi-Variable continuous controller
@@ -62,15 +59,34 @@ to model Boolean control blocks: BooleanBlockIcon Basic graphical layout of Boolean block BooleanSISO Single Input Single Output control block with signals of type Boolean - BooleanSignalSource Base class for Boolean signal sources - MI2BooleanMOs 2 Multiple Input / Boolean Multiple Output + BooleanMIMOs Multiple Input Multiple Output control block + with same number of inputs and outputs + MI2BooleanMOs 2 Multiple Input / Boolean Multiple Output block with same signal lengths + BooleanSignalSource Base class for Boolean signal sources + IntegerMIBooleanMOs Multiple Integer Input Multiple Boolean Output control block + with same number of inputs and outputs + + +
+The following partial block classes are provided +to model Integer control blocks: +
+ ++ IntegerBlockIcon Basic graphical layout of Integer block + IntegerMO Multiple Output control block + IntegerSignalSource Base class for Integer signal sources+
In addition, a subpackage BusAdaptors is temporarily provided +in order to make a signal bus concept available. It will be removed, +when the package Block is revised exploiting new Modelica features.
+Release Notes:
Copyright (C) 1999, Modelica Design Group and DLR.
+Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
")); connector InPort "Connector with input signals of type Real" parameter Integer n=1 "Dimension of signal vector"; - input Real signal[n] "Real input signals"; + replaceable type SignalType = Real "type of signal"; + input SignalType signal[n] "Real input signals"; annotation ( Coordsys(extent=[-100, -100; 100, 100]), Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( color=3, fillColor=3))), - Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style - (color=3, fillColor=3)), Text( + Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=3, fillColor=3)), Text( extent=[-100, -120; 100, -220], string="%name", style(color=3))), - Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], - style(color=3, fillColor=3)))); + Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style + (color=3, fillColor=3)))); end InPort; + connector OutPort "Connector with output signals of type Real" parameter Integer n=1 "Dimension of signal vector"; - output Real signal[n] "Real output signals"; + replaceable type SignalType = Real "type of signal"; + output SignalType signal[n] "Real output signals"; annotation ( Coordsys(extent=[-100, -100; 100, 100]), Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( color=3, fillColor=7))), - Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style - (color=3, fillColor=7)), Text( + Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=3, fillColor=7)), Text( extent=[-100, -120; 100, -220], string="%name", style(color=3))), - Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], - style(color=3, fillColor=7)))); + Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style + (color=3, fillColor=7)))); end OutPort; + connector BooleanInPort "Connector with input signals of type Boolean" parameter Integer n=1 "Dimension of signal vector"; input Boolean signal[n] "Boolean input signals"; annotation ( - Coordsys(extent=[-100, -100; 100, 100]), Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( color=5, fillColor=5))), - Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style - (color=5, fillColor=5)), Text( + Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=5, fillColor=5)), Text( extent=[-100, -120; 100, -220], string="%name", style(color=5))), - Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], - style(color=5, fillColor=5)))); + Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style + (color=5, fillColor=5)))); end BooleanInPort; + connector BooleanOutPort "Connector with output signals of type Boolean" parameter Integer n=1 "Dimension of signal vector"; output Boolean signal[n] "Boolean output signals"; @@ -163,25 +187,71 @@ Modelica in file \"Modelica/package.mo\". Coordsys(extent=[-100, -100; 100, 100]), Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( color=5, fillColor=7))), - Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style - (color=5, fillColor=7)), Text( + Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=5, fillColor=7)), Text( extent=[-100, -120; 100, -220], string="%name", style(color=5))), - Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], - style(color=5, fillColor=7)))); + Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style + (color=5, fillColor=7)))); end BooleanOutPort; - partial block BlockIcon "Basic graphical layout of continuous block" - annotation ( - Coordsys(extent=[-100, -100; 100, 100]), + + connector IntegerInPort "Connector with input signals of type Integer" + parameter Integer n=1 "Dimension of signal vector"; + input Integer signal[n] "Integer input signals"; + + annotation ( + Coordsys( + extent=[-100, -100; 100, 100], + grid=[2, 2], + component=[20, 20]), + Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=45, fillColor=45))), + Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=45, fillColor=45)), Text( + extent=[-100, -120; 100, -220], + string="%name", + style(color=45))), + Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style + (color=5, fillColor=5))), Window( - x=0, - y=0, + x=0.4, + y=0.4, width=0.6, - height=0.6), - Icon(Rectangle(extent=[-100, -100; 100, 100], style(color=3, fillColor=7 - )), Text(extent=[-150, 150; 150, 110], string="%name"))); end - BlockIcon; + height=0.6)); + end IntegerInPort; + + connector IntegerOutPort "Connector with output signals of type Integer" + parameter Integer n=1 "Dimension of signal vector"; + output Integer signal[n] "Integer output signals"; + + annotation ( + Coordsys( + extent=[-100, -100; 100, 100], + grid=[2, 2], + component=[20, 20]), + Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=45, fillColor=7))), + Diagram(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style( + color=45, fillColor=7)), Text( + extent=[-100, -120; 100, -220], + string="%name", + style(color=45))), + Terminal(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style + (color=5, fillColor=7))), + Window( + x=0.4, + y=0.4, + width=0.6, + height=0.6)); + end IntegerOutPort; + + partial block BlockIcon "Basic graphical layout of continuous block" + annotation (Icon(Rectangle(extent=[-100, -100; 100, 100], style(color=3, + fillColor=7)), Text(extent=[-150, 150; 150, 110], string="%name") + )); + end BlockIcon; + partial block SO "Single Output continuous control block" extends BlockIcon; @@ -198,9 +268,11 @@ Modelica in file \"Modelica/package.mo\". width=0.6, height=0.6), Diagram); - protected - Real y=outPort.signal[1]; + output Real y; + equation + y = outPort.signal[1]; end SO; + partial block MO "Multiple Output continuous control block" extends BlockIcon; @@ -217,12 +289,13 @@ Modelica in file \"Modelica/package.mo\". y=0.03, width=0.6, height=0.6), - Diagram, - Documentation(info=" + Documentation(info=" ")); - protected - Real y[nout]=outPort.signal; + output Real y[nout]; + equation + y = outPort.signal; end MO; + partial block SISO "Single Input Single Output continuous control block" extends BlockIcon; @@ -230,21 +303,22 @@ Modelica in file \"Modelica/package.mo\". extent=[-140, -20; -100, 20]); OutPort outPort(final n=1) "Connector of Real output signal" annotation ( extent=[100, -10; 120, 10]); - annotation ( - Diagram, - Coordsys( + output Real y; + + annotation (Coordsys( extent=[-100, -100; 100, 100], grid=[2, 2], - component=[20, 20]), - Window( + component=[20, 20]), Window( x=0.32, y=0.07, width=0.6, height=0.6)); protected Real u=inPort.signal[1]; - Real y=outPort.signal[1]; + equation + y = outPort.signal[1]; end SISO; + partial block SI2SO "2 Single Input / 1 Single Output continuous control block" extends BlockIcon; @@ -255,27 +329,39 @@ Modelica in file \"Modelica/package.mo\". extent=[-140, -80; -100, -40]); OutPort outPort(final n=1) "Connector of Real output signal" annotation ( extent=[100, -10; 120, 10]); + output Real y "Output signal"; - annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), - Window( - x=0.31, - y=0.07, - width=0.6, - height=0.6), - Documentation(info=" -Block has two Input vectors inPort1.signal and inPort2.signal and one -output vector outPort.signal. All vectors have one element. -"), - Diagram); + annotation (Documentation(info="+Block has two Input vectors inPort1.signal and inPort2.signal and one +output vector outPort.signal. All vectors have one element.
+")); protected Real u1=inPort1.signal[1] "Input signal 1"; Real u2=inPort2.signal[1] "Input signal 2"; - Real y=outPort.signal[1] "Output signal"; + equation + y = outPort.signal[1]; end SI2SO; + + partial block SIMO "Single Input Multiple Output continuous control block" + extends BlockIcon; + parameter Integer nout=1 "Number of outputs"; + InPort inPort(final n=1) "Connector of Real input signal" annotation ( + extent=[-140, -20; -100, 20]); + OutPort outPort(final n=nout) "Connector of Real output signals" + annotation (extent=[100, -10; 120, 10]); + output Real y[nout] "Output signals"; + + annotation (Documentation(info=" +Block has one continuous input signal and a vector of continuous output +signals.
+ +")); + protected + Real u=inPort.signal[1] "Input signal"; + equation + y = outPort.signal; + end SIMO; + partial block MISO "Multiple Input Single Output continuous control block" extends BlockIcon; parameter Integer nin=1 "Number of inputs"; @@ -283,20 +369,22 @@ output vector outPort.signal. All vectors have one element. extent=[-140, -20; -100, 20]); OutPort outPort(final n=1) "Connector of Real output signal" annotation ( extent=[100, -10; 120, 10]); - annotation (Documentation(info=" - + output Real y "Output signal"; + + annotation (Documentation(info="-Block has a vector of continuous input signals and +Block has a vector of continuous input signals and one continuous output signal.
")); protected Real u[:]=inPort.signal "Input signals"; - Real y=outPort.signal[1] "Output signal"; + equation + y = outPort.signal[1]; end MISO; - partial block MIMO "Multiple Input Multiple Output continuous control block" - + + partial block MIMO "Multiple Input Multiple Output continuous control block" extends BlockIcon; parameter Integer nin=1 "Number of inputs"; @@ -305,8 +393,8 @@ one continuous output signal. extent=[-140, -20; -100, 20]); OutPort outPort(final n=nout) "Connector of Real output signals" annotation (extent=[100, -10; 120, 10]); - annotation (Documentation(info=" - + output Real y[nout] "Output signals"; + annotation (Documentation(info="Block has a continuous input and a continuous output signal vector. The signal sizes of the input and output vector may be different. @@ -315,8 +403,10 @@ The signal sizes of the input and output vector may be different. ")); protected Real u[:]=inPort.signal "Input signals"; - Real y[:]=outPort.signal "Output signals"; + equation + y = outPort.signal; end MIMO; + partial block MIMOs "Multiple Input Multiple Output continuous control block with same number of inputs and outputs" @@ -327,16 +417,15 @@ The signal sizes of the input and output vector may be different. extent=[-140, -20; -100, 20]); OutPort outPort(final n=n) "Connector of Real output signals" annotation ( extent=[100, -10; 120, 10]); + output Real y[n] "Output signals"; annotation ( - Documentation(info=" - + Documentation(info="
Block has a continuous input and a continuous output signal vector where the signal sizes of the input and output vector are identical.
"), - Diagram, Coordsys( extent=[-100, -100; 100, 100], grid=[2, 2], @@ -348,8 +437,10 @@ where the signal sizes of the input and output vector are identical. height=0.6)); protected Real u[:]=inPort.signal "Input signals"; - Real y[:]=outPort.signal "Output signals"; + equation + y = outPort.signal; end MIMOs; + partial block MI2MO "2 Multiple Input / Multiple Output continuous control block" extends BlockIcon; @@ -362,6 +453,7 @@ where the signal sizes of the input and output vector are identical. extent=[-140, -80; -100, -40]); OutPort outPort(final n=n) "Connector of Real output signals" annotation ( extent=[100, -10; 120, 10]); + output Real y[n] "Output signals"; annotation ( Coordsys( extent=[-100, -100; 100, 100], @@ -373,34 +465,36 @@ where the signal sizes of the input and output vector are identical. width=0.6, height=0.6), Documentation(info=" -Block has two Input vectors inPort1.signal and inPort2.signal and one +Block has two Input vectors inPort1.signal and inPort2.signal and one output vector outPort.signal. All vectors have the same number of elements. -"), - Diagram); +")); protected Real u1[:]=inPort1.signal "Input signals 1"; Real u2[:]=inPort2.signal "Input signals 2"; - Real y[:]=outPort.signal "Output signals"; + equation + y = outPort.signal; end MI2MO; + partial block SignalSource "Base class for continuous signal source" extends MO; parameter Real offset[:]={0} "offset of output signal"; - parameter SIunits.Time startTime[:]={0} "output = offset for time < startTime"; + parameter SI.Time startTime[:]={0} "output = offset for time < startTime"; end SignalSource; + partial block SVcontrol "Single-Variable continuous controller" extends BlockIcon; protected Real u_s "Scalar setpoint input signal"; Real u_m "Scalar measurement input signal"; - Real y "Scalar actuator output signal"; public - InPort inPort_s(final n=1) "Connector of setpoint input signal" - annotation (extent=[-140, -20; -100, 20]); + InPort inPort_s(final n=1) "Connector of setpoint input signal" annotation + (extent=[-140, -20; -100, 20]); InPort inPort_m(final n=1) "Connector of measurement input signal" annotation (extent=[20, -100; -20, -140], rotation=-90); OutPort outPort(final n=1) "Connector of actuator output signal" annotation (extent=[100, -10; 120, 10]); + output Real y "Scalar actuator output signal"; annotation ( Diagram( Text(extent=[-102, 34; -142, 24], string="(setpoint)"), @@ -420,6 +514,7 @@ output vector outPort.signal. All vectors have the same number of elements. u_m = inPort_m.signal[1]; y = outPort.signal[1]; end SVcontrol; + partial block MVcontrol "Multi-Variable continuous controller" extends BlockIcon; @@ -432,32 +527,18 @@ output vector outPort.signal. All vectors have the same number of elements. annotation (extent=[20, -100; -20, -140], rotation=-90); OutPort outPort(final n=ny) "Connector of actuator output signals" annotation (extent=[100, -10; 120, 10]); - annotation ( - Diagram( + annotation (Diagram( Text(extent=[-100, 36; -140, 26], string="(setpoint)"), Text(extent=[102, 24; 142, 14], string="(actuator)"), - Text(extent=[-75, -108; -25, -98], string=" (measurement)")), - Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), - Window( - x=0.26, - y=0.19, - width=0.6, - height=0.6)); + Text(extent=[-75, -108; -25, -98], string=" (measurement)"))); end MVcontrol; + partial block BooleanBlockIcon "Basic graphical layout of Boolean block" - annotation ( - Coordsys(extent=[-100, -100; 100, 100]), - Window( - x=0.1, - y=0.1, - width=0.6, - height=0.6), - Icon(Rectangle(extent=[-100, -100; 100, 100], style(color=5, fillColor=7 - )), Text(extent=[-150, 150; 150, 110], string="%name"))); end - BooleanBlockIcon; + annotation (Icon(Rectangle(extent=[-100, -100; 100, 100], style(color=5, + fillColor=7)), Text(extent=[-150, 150; 150, 110], string="%name") + )); + end BooleanBlockIcon; + partial block BooleanSISO "Single Input Single Output control block with signals of type Boolean" extends BooleanBlockIcon; @@ -467,21 +548,66 @@ output vector outPort.signal. All vectors have the same number of elements. annotation (extent=[-140, -20; -100, 20]); BooleanOutPort outPort(final n=1) "Connector of Boolean output signal" annotation (extent=[100, -10; 120, 10]); - annotation ( - Diagram, - Coordsys( + output Boolean y; + + annotation (Coordsys( extent=[-100, -100; 100, 100], grid=[2, 2], - component=[20, 20]), - Window( + component=[20, 20]), Window( x=0.37, y=0.14, width=0.6, height=0.6)); protected Boolean u=inPort.signal[1]; - Boolean y=outPort.signal[1]; + equation + y = outPort.signal[1]; end BooleanSISO; + + partial block BooleanMIMOs + "Multiple Input Multiple Output continuous control block with same number of inputs and outputs of boolean type" + + + extends BooleanBlockIcon; + parameter Integer n=1 "Number of inputs (= number of outputs)"; + BooleanInPort inPort(final n=n) "Connector of Boolean input signals" + annotation (extent=[-140, -20; -100, 20]); + BooleanOutPort outPort(final n=n) "Connector of Boolean output signals" + annotation (extent=[100, -10; 120, 10]); + output Boolean y[n] "Output signals"; + annotation (Documentation(info=" ++Block has a continuous input and a continuous output signal vector +where the signal sizes of the input and output vector are identical +and of type boolean. +
+ +")); + protected + Boolean u[:]=inPort.signal "Input signals"; + equation + y = outPort.signal; + end BooleanMIMOs; + + partial block MI2BooleanMOs + "2 Multiple Input / Boolean Multiple Output block with same signal lengths" + + + extends BooleanBlockIcon; + parameter Integer n=1 "Dimension of input and output vectors."; + InPort inPort1(final n=n) "Connector 1 of Boolean input signals" + annotation (extent=[-140, 40; -100, 80]); + InPort inPort2(final n=n) "Connector 2 of Boolean input signals" + annotation (extent=[-140, -80; -100, -40]); + BooleanOutPort outPort(final n=n) "Connector of Boolean output signals" + annotation (extent=[100, -10; 120, 10]); + annotation (Documentation(info=" +Block has two Boolean input vectors u1 and u2 and one Boolean output +vector y. All vectors have the same number of elements.
+ +")); + end MI2BooleanMOs; + partial block BooleanSignalSource "Base class for Boolean signal sources" extends BooleanBlockIcon; parameter Integer nout(min=1) = 1 "Number of Boolean outputs"; @@ -503,33 +629,361 @@ output vector outPort.signal. All vectors have the same number of elements. fillColor=8)), Line(points=[-90, -70; 68, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8))), - Diagram); + fillColor=8)))); end BooleanSignalSource; - partial block MI2BooleanMOs - "2 Multiple Input / Boolean Multiple Output block with same signal lengths" + + partial block IntegerBlockIcon "Basic graphical layout of Integer block" + annotation (Icon(Rectangle(extent=[-100, -100; 100, 100], style(color=45, + fillColor=7)), Text(extent=[-150, 150; 150, 110], string="%name") + )); + end IntegerBlockIcon; + + partial block IntegerMO "Multiple Integer Output continuous control block" + extends IntegerBlockIcon; + + parameter Integer nout(min=1) = 1 "Number of outputs"; + IntegerOutPort outPort(final n=nout) "Connector of Integer output signals" + annotation (extent=[100, -10; 120, 10]); + output Integer y[nout]; + equation + y = outPort.signal; + end IntegerMO; + + partial block IntegerSignalSource + "Base class for continuous Integer signal source" + extends IntegerMO; + parameter Integer offset[:]={0} "offset of output signal"; + parameter SI.Time startTime[:]={0} "output = offset for time < startTime"; + end IntegerSignalSource; + + partial block IntegerMIBooleanMOs + "Multiple Integer Input Multiple Boolean Output continuous control block with same number of inputs and outputs" extends BooleanBlockIcon; - parameter Integer n=1 "Dimension of input and output vectors."; - InPort inPort1(final n=n) "Connector 1 of Boolean input signals" - annotation (extent=[-140, 40; -100, 80]); - InPort inPort2(final n=n) "Connector 2 of Boolean input signals" - annotation (extent=[-140, -80; -100, -40]); + parameter Integer n=1 "Number of inputs (= number of outputs)"; + IntegerInPort inPort(final n=n) "Connector of Integer input signals" + annotation (extent=[-140, -20; -100, 20]); BooleanOutPort outPort(final n=n) "Connector of Boolean output signals" annotation (extent=[100, -10; 120, 10]); + output Boolean y[n] "Boolean output signals"; + annotation (Documentation(info=" ++Block has a continuous integer input and a continuous boolean output signal vector +where the signal sizes of the input and output vector are identical. +
+ +")); + protected + Integer u[n]=inPort.signal "Input signals"; + equation + y = outPort.signal; + end IntegerMIBooleanMOs; + + connector RealPort "Real port (both input/output possible)" + replaceable type SignalType = Real; + extends SignalType; + end RealPort; + + /*connector RealPort "Connector with input signals of type Real" + parameter Integer n=1 "Dimension of signal vector"; + replaceable type SignalType = Real "type of signal"; + SignalType signal[n] "Real input signals"; + annotation ( - Coordsys(extent=[-100, -100; 100, 100]), - Window( - x=0.19, - y=0.16, - width=0.6, - height=0.6), - Documentation(info=" -Block has two Boolean input vectors u1 and u2 and one Boolean output vector y. -All vectors have the same number of elements. + Icon( + Polygon( + points=[-100, 100; 100, 0; -100, -100; -100, 100], + style(color=3, fillColor=3))), + Diagram( + Polygon( + points=[-100, 100; 100, 0; -100, -100; -100, 100], + style(color=3, fillColor=3)), + Text( + extent=[-100, -120; 100, -220], + string="%name", + style(color=3))), + Terminal( + Polygon( + points=[-100, 100; 100, 0; -100, -100; -100, 100], + style(color=3, fillColor=3)))); + end RealPort; */ + + connector BooleanPort = Boolean "Boolean port (both input/output possible)"; + + connector IntegerPort = Integer "Integer port (both input/output possible)"; + + package BusAdaptors + "Components to send signals to the bus or receive signals from the bus" + + extends Modelica.Icons.Library; + + block SendReal "Send Real signal to bus" + Internal.InputReal toBus annotation (extent=[100, -10; 120, 10]); + InPort inPort(final n=1) annotation (extent=[-140, -20; -100, 20]); + annotation (Icon( + Rectangle(extent=[-100, 40; 100, -40], style(color=73, fillColor=7)) + , + Text( + extent=[-144, 96; 144, 46], + string="%name", + style(color=0)), + Text( + extent=[-100, 30; 100, -30], + string="send", + style(color=73, fillColor=42))), Documentation(info=" ++Converts an InPort connector to a signal which can be connected to the +signal bus. Connect connector 'toBus' with the signal bus. A pop-up +dialog appears which allows to specify the signal from the bus +which is set equal to the signal of the InPort connector. +
+ + ")); - end MI2BooleanMOs; -end Interfaces; + equation + toBus = inPort.signal[1]; + end SendReal; + + block SendBoolean "Send Boolean signal to bus" + Internal.InputBoolean toBus annotation (extent=[100, -10; 120, 10]); + BooleanInPort inPort(final n=1) annotation (extent=[-140, -20; -100, 20]) + ; + annotation (Icon( + Rectangle(extent=[-100, 40; 100, -40], style(color=81, fillColor=7)) + , + Text( + extent=[-144, 96; 144, 46], + string="%name", + style(color=0)), + Text( + extent=[-100, 30; 100, -30], + string="send", + style(color=81, fillColor=42))), Documentation(info=" ++Converts a BooleanInPort connector to a signal which can be connected to the +signal bus. Connect connector 'toBus' with the signal bus. A pop-up +dialog appears which allows to specify the signal from the bus +which is set equal to the signal of the BooleanInPort connector. +
+ + +")); + equation + toBus = inPort.signal[1]; + end SendBoolean; + + block SendInteger "Send Integer signal to bus" + Internal.InputInteger toBus annotation (extent=[100, -10; 120, 10]); + IntegerInPort inPort(final n=1) annotation (extent=[-140, -20; -100, 20]) + ; + annotation (Icon( + Rectangle(extent=[-100, 40; 100, -40], style(color=45, fillColor=7)) + , + Text( + extent=[-144, 96; 144, 46], + string="%name", + style(color=0)), + Text( + extent=[-100, 30; 100, -30], + string="send", + style(color=45, fillColor=42))), Documentation(info=" ++Converts an IntegerInPort connector to a signal which can be connected to the +signal bus. Connect connector 'toBus' with the signal bus. A pop-up +dialog appears which allows to specify the signal from the bus +which is set equal to the signal of the IntegerInPort connector. +
+ + +")); + equation + toBus = inPort.signal[1]; + end SendInteger; + + block ReceiveReal "Receive Real signal from bus" + Internal.OutputReal fromBus annotation (extent=[-120, -10; -100, 10]); + OutPort outPort(final n=1) annotation (extent=[100, -10; 120, 10]); + annotation (Icon( + Rectangle(extent=[-100, 40; 100, -40], style(color=73, fillColor=7)) + , + Text( + extent=[-100, 30; 100, -30], + string="receive", + style(color=73, fillColor=42)), + Text( + extent=[-144, 96; 144, 46], + string="%name", + style(color=0))), Documentation(info=" ++Converts a signal from the signal bus to an OutPort connector. Use this +element by connecting connector 'fromBus' with the signal bus. A pop-up +dialog appears which allows to specify the signal from the bus +which is set equal to the signal of the OutPort connector. +
+ +")); + equation + fromBus = outPort.signal[1]; + end ReceiveReal; + + block ReceiveBoolean "Receive Boolean signal from bus" + Internal.OutputBoolean fromBus annotation (extent=[-120, -10; -100, 10]); + BooleanOutPort outPort(final n=1) annotation (extent=[100, -10; 120, 10]) + ; + annotation (Icon( + Rectangle(extent=[-100, 40; 100, -40], style(color=81, fillColor=7)) + , + Text( + extent=[-100, 30; 100, -30], + string="receive", + style(color=81, fillColor=42)), + Text( + extent=[-144, 96; 144, 46], + string="%name", + style(color=0))), Documentation(info=" ++Converts a signal from the signal bus to a BooleanOutPort connector. Use this +element by connecting connector 'fromBus' with the signal bus. A pop-up +dialog appears which allows to specify the signal from the bus +which is set equal to the signal of the BooleanOutPort connector. +
+ +")); + equation + fromBus = outPort.signal[1]; + end ReceiveBoolean; + + block ReceiveInteger "Receive Integer signal from bus" + Internal.OutputInteger fromBus annotation (extent=[-120, -10; -100, 10]); + IntegerOutPort outPort(final n=1) annotation (extent=[100, -10; 120, 10]) + ; + annotation (Icon( + Rectangle(extent=[-100, 40; 100, -40], style(color=45, fillColor=7)) + , + Text( + extent=[-100, 30; 100, -30], + string="receive", + style(color=45, fillColor=42)), + Text( + extent=[-144, 96; 144, 46], + string="%name", + style(color=0))), Documentation(info=" ++Converts a signal from the signal bus to an IntegerOutPort connector. Use this +element by connecting connector 'fromBus' with the signal bus. A pop-up +dialog appears which allows to specify the signal from the bus +which is set equal to the signal of the IntegerOutPort connector. +
+ + +")); + equation + fromBus = outPort.signal[1]; + end ReceiveInteger; + + package Internal + "Internal connector definitions only to be used from models of package BusAdaptors" + + + extends Modelica.Icons.Library; + + connector InputReal = input Real "'input Real' variable as connector" + annotation (Icon(Rectangle(extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77))), Diagram(Rectangle(extent=[-100, 100; 100, -100] + , style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77)))); + connector InputBoolean = input Boolean + "'input Boolean' variable as connector" annotation (Icon(Rectangle( + extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77))), Diagram(Rectangle(extent=[-100, 100; 100, -100] + , style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77)))); + connector InputInteger = input Integer + "'input Integer' variable as connector" annotation (Icon(Rectangle( + extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77))), Diagram(Rectangle(extent=[-100, 100; 100, -100] + , style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77)))); + connector OutputReal = output Real "'output Real' variable as connector" + annotation (Icon(Rectangle(extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77))), Diagram(Rectangle(extent=[-100, 100; 100, -100] + , style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77)))); + connector OutputBoolean = output Boolean + "'output Boolean' variable as connector" annotation (Icon(Rectangle( + extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77))), Diagram(Rectangle(extent=[-100, 100; 100, -100] + , style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77)))); + connector OutputInteger = output Integer + "'output Integer' variable as connector" annotation (Icon(Rectangle( + extent=[-100, 100; 100, -100], style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77))), Diagram(Rectangle(extent=[-100, 100; 100, -100] + , style( + color=77, + fillColor=77, + fillPattern=1)), Text( + extent=[-132, -100; 132, -198], + string="%name", + style(color=77)))); + end Internal; + end BusAdaptors; +end Interfaces; diff --git a/Blocks/Math.mo b/Blocks/Math.mo index 0a2d54bf6e..067e853961 100644 --- a/Blocks/Math.mo +++ b/Blocks/Math.mo @@ -1,21 +1,14 @@ +package Math "Mathematical functions as input/output blocks" - -package Math "Mathematical functions as input/output blocks" extends Modelica.Icons.Library; - package SIunits = Modelica.SIunits ; - package Interfaces = Modelica.Blocks.Interfaces ; - - annotation ( - Coordsys(extent=[0, 0; 200, 400], component=[20, 20]), - Window( - x=0.02, - y=0.02, - width=0.3, - height=0.7, - library=1, - autolayout=1), - Documentation(info=" - + + annotation (Window( + x=0.05, + y=0.09, + width=0.44, + height=0.71, + library=1, + autolayout=1),Documentation(info="This package contains basic mathematical operations, such as summation and multiplication, and basic mathematical @@ -26,36 +19,44 @@ In particular the following operations and functions are provided:
-- Gain Output the input multiplied by a scalar gain +TwoInputs Change causality of input signals. + TwoOutputs Change causality of output signals. + Gain Output the input multiplied by a scalar gain MatrixGain Output the product of a gain matrix with the input - Sum Output the sum of the elements of the input vector - Feedback Output difference between commanded and feedback input - Add Output the sum of the two inputs - Add3 Output the sum of the three inputs - Product Output product of the two inputs + Sum Output the sum of the elements of the input vector + Feedback Output difference between commanded and feedback input + Add Output the sum of the two inputs + Add3 Output the sum of the three inputs + Product Output product of the two inputs Division Output first input divided by second input Abs Output the absolute value of the input Sign Output the sign of the input Sqrt Output the square root of the input Sin Output the sine of the input Cos Output the cosine of the input - Tan Output the tangent of the input - Asin Output the arc sine of the input - Acos Output the arc cosine of the input - Atan Output the arc tangent of the input - Atan2 Output atan(u1/u2) of the inputs u1 and u2 - Sinh Output the hyperbolic sine of the input - Cosh Output the hyperbolic cosine of the input - Tanh Output the hyperbolic tangent of the input - Exp Output the exponential (base e) of the input - Log Output the natural (base e) logarithm of the input - Log10 Output the base 10 logarithm of the input + Tan Output the tangent of the input + Asin Output the arc sine of the input + Acos Output the arc cosine of the input + Atan Output the arc tangent of the input + Atan2 Output atan(u1/u2) of the inputs u1 and u2 + Sinh Output the hyperbolic sine of the input + Cosh Output the hyperbolic cosine of the input + Tanh Output the hyperbolic tangent of the input + Exp Output the exponential (base e) of the input + Log Output the natural (base e) logarithm of the input + Log10 Output the base 10 logarithm of the input + RealToInteger Output the nearest Integer value to the input + IntegerToReal Output the input as Real value + Max Output the maximum of the two inputs + Min Output the minimum of the two inputs + Edge Set output to true at rising edge of the input + BooleanChange Set output to true when Boolean input changes + IntegerChange Set output to true when Integer input changes
Release Notes:
Copyright (C) 1999, Modelica Design Group and DLR.
+Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
")); - - block Gain + + block TwoInputs "Change causality of input signals (e.g. for inverse models)" + + + extends Interfaces.BlockIcon; + parameter Integer n=1 "number of input signals"; + annotation (Documentation(info=" +This block is used to enable assignment of values to +variables preliminary defined as outputs (e.g. useful for +inverse model generation).
+ +Release Notes:
+This block is used to enable assignment of values to +variables preliminary defined as inputs (e.g. useful for +inverse model generation).
+ +Release Notes:
+-This blocks computes output y=outPort.signal as -element-wise product of gain k with the +This block computes the output y=outPort.signal as +element-wise product of gain k with the input u = inPort.signal:
-- y[i] = k[i] * u[i]; +y[i] = k[i] * u[i];Release Notes:
-This blocks computes output y=outPort.signal as product of the +This block computes the output y=outPort.signal as product of the gain matrix K with the input signal vector u = inPort.signal:
-- y = K * u; +y = K * u;-Example: +Example:
-- parameter: K = [0.12 2; 3 1.5] +parameter: K = [0.12 2; 3 1.5] results in the following equations: - | y[1] | | 0.12 2.00 | | u[1] | - | | = | | * | | + | y[1] | | 0.12 2.00 | | u[1] | + | | = | | * | | | y[2] | | 3.00 1.50 | | u[2] |Release Notes:
-This blocks computes output y=outPort.signal[1] as -sum of the elements of the input signal vector -u=inPort.signal: -
+ Documentation(info=" +This block computes the output y=outPort.signal[1] as +sum of the elements of the input signal vector +u=inPort.signal:
-- y = u[1] + u[2] + ...; +y = u[1] + u[2] + ... + u[nin];--Example: -
+Example: With parameter nin = 3 results the following equation:
-- parameter: nin = 3; +y = u[1] + u[2] + u[3]; +- results in the following equations: - - y = u[1] + u[2] + u[3]; +Optionally, the parameter Real k[nin]=ones(nin) could be +changed to weight the sum elements in order to calculate the scalar +product
+ +y = k*u = k[1]*u[1] + k[2]*u[2] + ... + k[nin]*u[nin] .Release Notes:
-This blocks computes output y=outPort.signal as difference of the -commanded input u1=inPort1.signal and the feedback +This block computes the output y=outPort.signal as difference of the +commanded input u1=inPort1.signal and the feedback input u2=inPort2.signal:
-- y = u1 - u2; +y = u1 - u2;-Example: +Example:
-- parameter: n = 2 +parameter: n = 2 results in the following equations: - - y[1] = u1[1] - u2[1] + + y[1] = u1[1] - u2[1] y[2] = u1[2] - u2[2]Release Notes:
-This blocks computes output y=outPort.signal as sum of the +This block computes the output y=outPort.signal as sum of the two input signals u1=inPort1.signal and u2=inPort2.signal:
-- y = k1*u1 + k2*u2; +y = k1*u1 + k2*u2;-Example: +Example:
-- parameter: n = 2, k1= +2, k2= -3 +parameter: n = 2, k1= +2, k2= -3 results in the following equations: - - y[1] = 2 * u1[1] - 3 * u2[1] + + y[1] = 2 * u1[1] - 3 * u2[1] y[2] = 2 * u1[2] - 3 * u2[2]Release Notes:
-This blocks computes output y=outPort.signal as sum of the +This block computes the output y=outPort.signal as sum of the three input signals u1=inPort1.signal, u2=inPort2.signal and u3=inPort3.signal:
-- y = k1*u1 + k2*u2 + k3*u3; +y = k1*u1 + k2*u2 + k3*u3;-Example: +Example:
-- parameter: n = 2, k1= +2, k2= -3, k3=1; +parameter: n = 2, k1= +2, k2= -3, k3=1; results in the following equations: - - y[1] = 2 * u1[1] - 3 * u2[1] + u3[1]; + + y[1] = 2 * u1[1] - 3 * u2[1] + u3[1]; y[2] = 2 * u1[2] - 3 * u2[2] + u3[2];Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as product of the corresponding elements of the two inputs u1=inPort1.signal and u2=inPort2.signal:
-- y[i] = u1[i] * u2[i]; +y[i] = u1[i] * u2[i];Release Notes:
This block computes the output y=outPort.signal element-wise by dividing the corresponding elements of the two inputs u1=inPort1.signal and u2=inPort2.signal:
-- y[i] = u1[i] / u2[i]; +y[i] = u1[i] / u2[i];Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as absolute value of the input u=inPort.signal:
-- y[i] = abs( u[i] ); +y[i] = abs( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as sign of the input u=inPort.signal:
-- 1 if u[i] > 0 +1 if u[i] > 0 y[i] = 0 if u[i] == 0 - -1 if u[i] < 0 + -1 if u[i] < 0Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as square root of the input u=inPort.signal:
-- y[i] = sqrt( u[i] ); +y[i] = sqrt( u[i] );@@ -918,951 +856,819 @@ Otherwise an error occurs.
Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as sine of the input u=inPort.signal:
-- y[i] = sin( u[i] ); +y[i] = sin( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as cos of the input u=inPort.signal:
-- y[i] = cos( u[i] ); +y[i] = cos( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise +This block computes the output y=outPort.signal element-wise as tan of the input u=inPort.signal:
-- y[i] = tan( u[i] ); +y[i] = tan( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -sine-inverse of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +sine-inverse of the input u=inPort.signal:
-- y[i] = asin( u[i] ); +y[i] = asin( u[i] );-The absolute values of the elements of the input u need to -be less or equal to one (abs( u[i] ) <= 1). +The absolute values of the elements of the input u need to +be less or equal to one (abs( u[i] ) <= 1). Otherwise an error occurs.
Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -cosine-inverse of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +cosine-inverse of the input u=inPort.signal:
-- y[i] = acos( u[i] ); +y[i] = acos( u[i] );-The absolute values of the elements of the input u need to -be less or equal to one (abs( u[i] ) <= 1). +The absolute values of the elements of the input u need to +be less or equal to one (abs( u[i] ) <= 1). Otherwise an error occurs.
Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -tangent-inverse of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +tangent-inverse of the input u=inPort.signal:
-- y[i] = atan( u[i] ); +y[i] = atan( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -tangent-inverse of the input u1=inPort1.signal divided by -input u2=inPort2.signal: +This block computes the output y=outPort.signal element-wise as the +tangent-inverse of the input u1=inPort1.signal divided by +input u2=inPort2.signal:
-- y[i] = atan2( u1[i], u2[i] ); +y[i] = atan2( u1[i], u2[i] );u1[i] and u2[i] shall not be zero at the same time instant. -Atan2 uses the sign of u1[i] and u2[i] in order to construct +Atan2 uses the sign of u1[i] and u2[i] in order to construct the solution in the range -180 deg <= y[i] <= 180 deg, whereas -block Atan gives a solution in the range +block Atan gives a solution in the range -90 deg <= y[i] <= 90 deg.
Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -hyperbolic sine of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +hyperbolic sine of the input u=inPort.signal:
-- y[i] = sinh( u[i] ); +y[i] = sinh( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -hyperbolic cosine of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +hyperbolic cosine of the input u=inPort.signal:
-- y[i] = cosh( u[i] ); +y[i] = cosh( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -hyperbolic tangent of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +hyperbolic tangent of the input u=inPort.signal:
-- y[i] = tanh( u[i] ); +y[i] = tanh( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -exponential (of base e) of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +exponential (of base e) of the input u=inPort.signal:
-- y[i] = exp( u[i] ); +y[i] = exp( u[i] );Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -natural (base e) logarithm of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +natural (base e) logarithm of the input u=inPort.signal:
-- y[i] = log( u[i] ); +y[i] = log( u[i] );@@ -1873,80 +1679,68 @@ zero or negative.
Release Notes:
-This blocks computes the output y=outPort.signal element-wise as the -base 10 logarithm of the input u=inPort.signal: +This block computes the output y=outPort.signal element-wise as the +base 10 logarithm of the input u=inPort.signal:
-- y[i] = log10( u[i] ); +y[i] = log10( u[i] );@@ -1957,24 +1751,188 @@ zero or negative.
Release Notes:
+This block computes the output y=outPort.signal element-wise +as nearest integer value of the input u=inPort.signal: +
+ +y[i] = integer( floor( u[i] + 0.5 ) ) for u[i] > 0; + y[i] = integer( ceil ( u[i] - 0.5 ) ) for u[i] < 0; ++ +")); + public + Interfaces.InPort inPort(final n=n) annotation (extent=[-140, -20; -100, 20 + ]); + Interfaces.IntegerOutPort outPort(final n=n) annotation (extent=[100, -10; + 120, 10]); + equation + u = inPort.signal; + for i in 1:n loop + outPort.signal[i] = if (u[i] > 0) then integer(floor(u[i] + 0.5)) else + integer(ceil(u[i] - 0.5)); + end for; + end RealToInteger; + + block IntegerToReal "Convert integer to real signals" + extends Interfaces.BlockIcon; + parameter Integer n=1 + "Number of input signals (= number of output signals)"; + annotation (Icon( + Text( + extent=[-120, 60; -20, -60], + string="I", + style(color=45)), + Text(extent=[0, 60; 100, -60], string="R"), + Polygon(points=[10, 0; -10, 20; -10, 10; -40, 10; -40, -10; -10, -10; - + 10, -20; 10, 0], style(fillColor=73))), Documentation(info=" +
+This block computes the output y=outPort.signal element-wise +as Real equivalent of the Integer input u=inPort.signal: +
+ +y[i] = u[i]; ++ +
where u is of Integer and y of Real type.
+ +")); + Interfaces.OutPort outPort(final n=n) annotation (extent=[100, -10; 120, 10 + ]); + Interfaces.IntegerInPort inPort(final n=n) annotation (extent=[-140, -20; - + 100, 20]); + equation + outPort.signal = inPort.signal; + end IntegerToReal; + + block Max "Pass through the largest signal" + extends Interfaces.MI2MO; + annotation (Icon(Text( + extent=[-90, 36; 90, -36], + style(color=9), + string="max()")), Documentation(info=" ++This block computes the output y=outPort.signal element-wise +as maximum of the two inputs u1=inPort1.signal and u2=inPort2.signal: +
+ +y[i] = max ( u1[i] , u2[i] ); ++ +")); + equation + for i in 1:n loop + y[i] = max(u1[i], u2[i]); + end for; + end Max; + + block Min "Pass through the smallest signal" + extends Interfaces.MI2MO; + annotation (Icon(Text( + extent=[-90, 36; 90, -36], + style(color=9), + string="min()")), Documentation(info=" +
+This block computes the output y=outPort.signal element-wise +as minimum of the two inputs u1=inPort1.signal and u2=inPort2.signal: +
+ +y[i] = min ( u1[i] , u2[i] ); ++ +")); + equation + for i in 1:n loop + y[i] = min(u1[i], u2[i]); + end for; + end Min; + + block Edge "Indicates rising edge of boolean signal" + extends Interfaces.BooleanMIMOs; + annotation (Icon(Text( + extent=[-90, 36; 90, -36], + style(color=9), + string="edge()")), Documentation(info=" +
+This block sets the Boolean output y=outPort.signal element-wise +to true, when the Boolean input u=inPort.signal shows a rising edge: +
+ +y[i] = edge( u[i] ); ++ +")); + equation + for i in 1:n loop + y[i] = edge(u[i]); + end for; + annotation (Icon); + end Edge; + + block BooleanChange "Indicates boolean signal changing" + extends Interfaces.BooleanMIMOs; + annotation (Icon(Text( + extent=[-90, 36; 90, -36], + style(color=9), + string="change()")), Documentation(info=" +
+This block sets the Boolean output y=outPort.signal element-wise +to true, when the Boolean input u=inPort.signal shows a rising +or falling edge, i.e., when the signal changes: +
+ +y[i] = change( u[i] ); ++ +")); + equation + for i in 1:n loop + y[i] = change(u[i]); + end for; + end BooleanChange; + + block IntegerChange "Indicates integer signal changing" + extends Interfaces.IntegerMIBooleanMOs; + annotation (Icon(Text( + extent=[-90, 36; 90, -36], + style(color=9), + string="change()")), Documentation(info=" +
+This block sets the Boolean output y=outPort.signal element-wise +to true, when the Integer input u=inPort.signal changes: +
+ +y[i] = change( u[i] ); ++ +")); + equation + for i in 1:n loop + y[i] = change(u[i]); + end for; + end IntegerChange; end Math; diff --git a/Blocks/Nonlinear.mo b/Blocks/Nonlinear.mo index 3e400b044a..b62dd3b320 100644 --- a/Blocks/Nonlinear.mo +++ b/Blocks/Nonlinear.mo @@ -1,22 +1,15 @@ -package Nonlinear - "Discontinuous or non-differentiable algebraic control blocks" +package Nonlinear + "Discontinuous or non-differentiable algebraic control blocks" + extends Modelica.Icons.Library; - package Interfaces = Modelica.Blocks.Interfaces ; - - annotation ( - Coordsys( - extent=[0, 0; 268, 370], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.03, - y=0.04, + + annotation (Window( + x=0.05, + y=0.1, width=0.21, - height=0.41, + height=0.23, library=1, - autolayout=1), - Documentation(info=" - + autolayout=1),Documentation(info="
This package contains discontinuous and non-differentiable, algebraic input/output blocks. @@ -24,13 +17,14 @@ In particular the following blocks are provided:
- Limiter Limit the range of a signal. - DeadZone Provide a region of zero output. + Limiter Limit the range of a signal to fixed limits. + VariableLimiter Limit the range of a signal to variable limits. + DeadZone Provide a region of zero output.
Release Notes:
Copyright (C) 1999, Modelica Design Group and DLR.
+Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
")); - block Limiter "Limit the range of a signal" + block Limiter "Limit the range of a signal" parameter Real uMax[:]={1} "Upper limits of input signals"; - parameter Real uMin[size(uMax, 1)](max=uMax) = -uMax + parameter Real uMin[size(uMax, 1)](max=uMax) = -uMax "Lower limits of input signals"; extends Interfaces.MIMOs(final n=size(uMax, 1)); - + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[2, 2], + component=[20, 20]), Window( - x=0.22, - y=0.06, - width=0.43, - height=0.51), - Documentation(info=" - + x=0.22, + y=0.06, + width=0.43, + height=0.51), + Documentation(info="The Limiter block passes its input signal as output signal as long as the input is within the specified upper and lower -limits. If this is not the case, the corresponding limits are passed +limits. If this is not the case, the corresponding limit is passed as output.
-"), +"), Icon( - Line(points=[0, -90; 0, 68], style(color=8)), - Polygon(points=[0, 90; -8, 68; 8, 68; 0, 90], style(color=8, fillColor - =8)), - Line(points=[-90, 0; 68, 0], style(color=8)), - Polygon(points=[90, 0; 68, -8; 68, 8; 90, 0], style(color=8, fillColor - =8)), - Line(points=[-80, -70; -50, -70; 50, 70; 80, 70], style(color=0)), + Line(points=[0, -90; 0, 68], style(color=8)), + Polygon(points=[0, 90; -8, 68; 8, 68; 0, 90], style(color=8, fillColor= + 8)), + Line(points=[-90, 0; 68, 0], style(color=8)), + Polygon(points=[90, 0; 68, -8; 68, 8; 90, 0], style(color=8, fillColor= + 8)), + Line(points=[-80, -70; -50, -70; 50, 70; 80, 70], style(color=0)), Text( - extent=[-150, -150; 150, -110], - string="uMax=%uMax", - style(color=0)), - Text(extent=[-150, 150; 150, 110], string="%name")), + extent=[-150, -150; 150, -110], + string="uMax=%uMax", + style(color=0)), + Text(extent=[-150, 150; 150, 110], string="%name")), Diagram( - Line(points=[0, -60; 0, 50], style(color=8)), - Polygon(points=[0, 60; -5, 50; 5, 50; 0, 60], style(color=8, fillColor - =8)), - Line(points=[-60, 0; 50, 0], style(color=8)), - Polygon(points=[60, 0; 50, -5; 50, 5; 60, 0], style(color=8, fillColor - =8)), - Line(points=[-50, -40; -30, -40; 30, 40; 50, 40], style(color=0)), + Line(points=[0, -60; 0, 50], style(color=8)), + Polygon(points=[0, 60; -5, 50; 5, 50; 0, 60], style(color=8, fillColor= + 8)), + Line(points=[-60, 0; 50, 0], style(color=8)), + Polygon(points=[60, 0; 50, -5; 50, 5; 60, 0], style(color=8, fillColor= + 8)), + Line(points=[-50, -40; -30, -40; 30, 40; 50, 40], style(color=0)), Text( - extent=[46, -6; 68, -18], - string="inPort", - style(color=10)), + extent=[46, -6; 68, -18], + string="inPort", + style(color=10)), Text( - extent=[-30, 70; -5, 50], - string="outPort", - style(color=10)), + extent=[-30, 70; -5, 50], + string="outPort", + style(color=10)), Text( - extent=[-58, -54; -28, -42], - string="uMin", - style(color=10)), + extent=[-58, -54; -28, -42], + string="uMin", + style(color=10)), Text( - extent=[26, 40; 66, 56], - string="uMax", + extent=[26, 40; 66, 56], + string="uMax", style(color=10)))); - equation + equation for i in 1:n loop - y[i] = if u[i] > uMax[i] then uMax[i] else if u[i] < uMin[i] then uMin[i - ] else u[i]; + y[i] = if u[i] > uMax[i] then uMax[i] else if u[i] < uMin[i] then uMin[i] + else u[i]; end for; end Limiter; - block DeadZone "Provide a region of zero output" + + block VariableLimiter "Limit the range of a signal with variable limits" + extends Interfaces.MIMOs; + + Interfaces.InPort limit1(final n=n) annotation (extent=[-140, 60; -100, 100 + ]); + Interfaces.InPort limit2(final n=n) annotation (extent=[-140, -100; -100, - + 60]); + protected + Real uMax[n]; + Real uMin[n]; + + annotation ( + Documentation(info=" ++The Limiter block passes its input signal as output signal +as long as the input is within the upper and lower +limits specified by the two additional inputs limit1 and +limit2. If this is not the case, the corresponding limit +is passed as output. +
+ +"), + Icon( + Line(points=[0, -90; 0, 68], style(color=8)), + Line(points=[-90, 0; 68, 0], style(color=8)), + Polygon(points=[90, 0; 68, -8; 68, 8; 90, 0], style(color=8, fillColor= + 8)), + Line(points=[-80, -70; -50, -70; 50, 70; 80, 70], style(color=0)), + Text(extent=[-150, 150; 150, 110], string="%name"), + Line(points=[-100, 80; 66, 80; 66, 70], style(fillPattern=1)), + Line(points=[-100, -80; -64, -80; -64, -70], style(fillPattern=1)), + Polygon(points=[-64, -70; -66, -74; -62, -74; -64, -70], style( + fillPattern=1)), + Polygon(points=[66, 70; 64, 74; 68, 74; 66, 70], style(fillPattern=1)) + , + Polygon(points=[0, 90; -8, 68; 8, 68; 0, 90], style(color=8, fillColor= + 8))), + Diagram( + Line(points=[0, -60; 0, 50], style(color=8)), + Polygon(points=[0, 60; -5, 50; 5, 50; 0, 60], style(color=8, fillColor= + 8)), + Line(points=[-60, 0; 50, 0], style(color=8)), + Polygon(points=[60, 0; 50, -5; 50, 5; 60, 0], style(color=8, fillColor= + 8)), + Line(points=[-50, -40; -30, -40; 30, 40; 50, 40], style(color=0)), + Text( + extent=[46, -6; 68, -18], + string="inPort", + style(color=10)), + Text( + extent=[-30, 70; -5, 50], + string="outPort", + style(color=10)), + Text( + extent=[-66, -40; -26, -20], + string="uMin", + style(color=10)), + Text( + extent=[30, 20; 70, 40], + string="uMax", + style(color=10)), + Line(points=[-100, 80; 40, 80; 40, 40]), + Line(points=[-100, -80; -40, -80; -40, -40]), + Polygon(points=[40, 40; 35, 50; 45, 50; 40, 40], style(fillPattern=1)) + , + Polygon(points=[-40, -40; -45, -50; -35, -50; -40, -40], style( + fillPattern=1)))); + equation + for i in 1:n loop + uMax[i] = max(limit1.signal[i], limit2.signal[i]); + uMin[i] = min(limit1.signal[i], limit2.signal[i]); + y[i] = if u[i] > uMax[i] then uMax[i] else if u[i] < uMin[i] then uMin[i] + else u[i]; + end for; + end VariableLimiter; + + block DeadZone "Provide a region of zero output" parameter Real uMax[:]={1} "Upper limits of dead zones"; - parameter Real uMin[size(uMax, 1)](max=uMax) = -uMax + parameter Real uMin[size(uMax, 1)](max=uMax) = -uMax "Lower limits of dead zones"; extends Interfaces.MIMOs(final n=size(uMax, 1)); - + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.39, - y=0.18, - width=0.56, - height=0.6), - Documentation(info=" - -+ x=0.39, + y=0.18, + width=0.56, + height=0.6), + Documentation(info=" +
The DeadZone block defines a region of zero output.
@@ -157,49 +229,48 @@ is zero. Outside of this zone, the output is a linear function of the input with a slope of 1. -"), +"), Icon( - Line(points=[0, -90; 0, 68], style(color=8)), - Polygon(points=[0, 90; -8, 68; 8, 68; 0, 90], style(color=8, fillColor - =8)), - Line(points=[-90, 0; 68, 0], style(color=8)), - Polygon(points=[90, 0; 68, -8; 68, 8; 90, 0], style(color=8, fillColor - =8)), - Line(points=[-80, -60; -20, 0; 20, 0; 80, 60], style(color=0)), + Line(points=[0, -90; 0, 68], style(color=8)), + Polygon(points=[0, 90; -8, 68; 8, 68; 0, 90], style(color=8, fillColor= + 8)), + Line(points=[-90, 0; 68, 0], style(color=8)), + Polygon(points=[90, 0; 68, -8; 68, 8; 90, 0], style(color=8, fillColor= + 8)), + Line(points=[-80, -60; -20, 0; 20, 0; 80, 60], style(color=0)), Text( - extent=[-150, -150; 150, -110], - string="uMax=%uMax", - style(color=9)), - Text(extent=[-150, 150; 150, 110], string="%name")), + extent=[-150, -150; 150, -110], + string="uMax=%uMax", + style(color=9)), + Text(extent=[-150, 150; 150, 110], string="%name")), Diagram( - Line(points=[0, -60; 0, 50], style(color=8)), - Polygon(points=[0, 60; -5, 50; 5, 50; 0, 60], style(color=8, fillColor - =8)), - Line(points=[-76, 0; 74, 0], style(color=8)), - Polygon(points=[84, 0; 74, -5; 74, 5; 84, 0], style(color=8, fillColor - =8)), - Line(points=[-81, -40; -38, 0; 40, 0; 80, 40], style(color=0)), + Line(points=[0, -60; 0, 50], style(color=8)), + Polygon(points=[0, 60; -5, 50; 5, 50; 0, 60], style(color=8, fillColor= + 8)), + Line(points=[-76, 0; 74, 0], style(color=8)), + Polygon(points=[84, 0; 74, -5; 74, 5; 84, 0], style(color=8, fillColor= + 8)), + Line(points=[-81, -40; -38, 0; 40, 0; 80, 40], style(color=0)), Text( - extent=[62, -7; 88, -25], - string="inPort", - style(color=10)), + extent=[62, -7; 88, -25], + string="inPort", + style(color=10)), Text( - extent=[-36, 72; -5, 50], - string="outPort", - style(color=10)), + extent=[-36, 72; -5, 50], + string="outPort", + style(color=10)), Text( - extent=[-51, 1; -28, 19], - string="uMin", - style(color=10)), + extent=[-51, 1; -28, 19], + string="uMin", + style(color=10)), Text( - extent=[27, 21; 52, 5], - string="uMax", + extent=[27, 21; 52, 5], + string="uMax", style(color=10)))); - equation + equation for i in 1:n loop - y[i] = if u[i] > uMax[i] then u[i] - uMax[i] else if u[i] < uMin[i] - then u[i] - uMin[i] else 0; + y[i] = if u[i] > uMax[i] then u[i] - uMax[i] else if u[i] < uMin[i] then + u[i] - uMin[i] else 0; end for; end DeadZone; end Nonlinear; - diff --git a/Blocks/Sources.mo b/Blocks/Sources.mo index fb7312a6f7..f11420245e 100644 --- a/Blocks/Sources.mo +++ b/Blocks/Sources.mo @@ -1,32 +1,22 @@ +package Sources + "Signal source blocks generating Real, Integer and Boolean signals" - -package Sources "Signal source blocks generating Real and Boolean signals" extends Modelica.Icons.Library; - package Interfaces = Modelica.Blocks.Interfaces ; - package SIunits = Modelica.SIunits ; - - annotation ( - Coordsys( - extent=[0, 0; 289, 576], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.03, - y=0.04, - width=0.29, - height=0.81, - library=1, - autolayout=1), - Documentation(info=" - + + annotation (Window( + x=0.06, + y=0.1, + width=0.43, + height=0.65, + library=1, + autolayout=1), + Documentation(info="This package contains source components, i.e., blocks which have only output signals. These blocks are used as signal generators.
--The following sources are provided to generate Real signals: -
+The following sources are provided to generate Real signals:
Clock Generate actual time. @@ -39,15 +29,13 @@ The following sources are provided to generate Real signals: Pulse Generate pulse signals. SawTooth Generate sawtooth signals. Trapezoid Generate trapezoidal signals. - KinematicPTP Generate an acceleration signal to move as fast as + KinematicPTP Generate an acceleration signal to move as fast as possible along a distance within given kinematic constraints. - TimeTable Generate a (possibly discontinuous) signal by + TimeTable Generate a (possibly discontinuous) signal by linear interpolation in a table. --
-The following sources are provided to generate Boolean signals: -
+The following sources are provided to generate Boolean signals:
BooleanConstant Generate constant signals. @@ -56,6 +44,13 @@ The following sources are provided to generate Boolean signals: SampleTrigger Generate sample triggers.+
The following sources are provided to generate Integer signals:
+ ++ IntegerConstant Generate constant signals. + IntegerStep Generate step signals. ++
All sources are vectorized. This means that the output is a vector of signals. The number of outputs is in correspondance @@ -92,7 +87,6 @@ have at least the following two parameters: offset Value which is added to all signal values. startTime Start time of signal. For time < startTime, the output is set to offset. -
@@ -104,7 +98,7 @@ usually requires a trimming calculation.
Release Notes:
Copyright (C) 1999, Modelica Design Group, DLR and Fraunhofer-Gesellschaft.
+Copyright © 1999-2002, Modelica Association, DLR and Fraunhofer-Gesellschaft.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
")); - block Clock "Generate actual time signals " + block Clock "Generate actual time signals " 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(offset, 1); size(startTime, 1)] - )); - protected + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(offset, 1); size(startTime, 1)]) + ); + protected 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); - + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.26, - y=0, - width=0.49, - height=0.59), + x=0.26, + y=0, + width=0.36, + height=0.52), Icon( - Text(extent=[-150, 150; 150, 110], string="%name"), - Ellipse(extent=[-80, 80; 80, -80], style(color=9)), - Line(points=[0, 80; 0, 60], style(color=9)), - Line(points=[80, 0; 60, 0], style(color=9)), - Line(points=[0, -80; 0, -60], style(color=9)), - Line(points=[-80, 0; -60, 0], style(color=9)), - Line(points=[37, 70; 26, 50], style(color=9)), - Line(points=[70, 38; 49, 26], style(color=9)), - Line(points=[71, -37; 52, -27], style(color=9)), - Line(points=[39, -70; 29, -51], style(color=9)), - Line(points=[-39, -70; -29, -52], style(color=9)), - Line(points=[-71, -37; -50, -26], style(color=9)), - Line(points=[-71, 37; -54, 28], style(color=9)), - Line(points=[-38, 70; -28, 51], style(color=9)), - Line(points=[0, 0; -50, 50], style(color=0, thickness=2)), - Line(points=[0, 0; 40, 0], style(color=0, thickness=2)), - Text( - extent=[-150, -150; 150, -110], - string="startTime=%startTime", - style(color=0))), + Ellipse(extent=[-80, 80; 80, -80], style(color=9)), + Line(points=[0, 80; 0, 60], style(color=9)), + Line(points=[80, 0; 60, 0], style(color=9)), + Line(points=[0, -80; 0, -60], style(color=9)), + Line(points=[-80, 0; -60, 0], style(color=9)), + Line(points=[37, 70; 26, 50], style(color=9)), + Line(points=[70, 38; 49, 26], style(color=9)), + Line(points=[71, -37; 52, -27], style(color=9)), + Line(points=[39, -70; 29, -51], style(color=9)), + Line(points=[-39, -70; -29, -52], style(color=9)), + Line(points=[-71, -37; -50, -26], style(color=9)), + Line(points=[-71, 37; -54, 28], style(color=9)), + Line(points=[-38, 70; -28, 51], style(color=9)), + Line(points=[0, 0; -50, 50], style(color=0, thickness=2)), + Line(points=[0, 0; 40, 0], style(color=0, thickness=2)), + Text( + extent=[-150, -150; 150, -110], + string="startTime=%startTime", + style(color=0))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-80, 0; -10, 0; 60, 70], style(color=0, thickness=2)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-80, 0; -10, 0; 60, 70], style(color=0, thickness=2)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, 0; -37, -13; -30, -13; -34, 0], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-34, -13; -34, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-34, -69; -37, -56; -31, -56; -34, -69; -34, -69], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-34, -69; -37, -56; -31, -56; -34, -69; -34, -69], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-81, -25; -35, -43], - string="offset", - style(color=9)), - Text( - extent=[-33, -71; 13, -89], - string="startTime", - style(color=9)), - Text( - extent=[-66, 92; -25, 72], - string="outPort", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-10, 0; -10, -70], style(color=8, pattern=2)), - Line(points=[-10, 0; 50, 0], style(color=8, pattern=2)), - Line(points=[50, 0; 50, 60], style(color=8, pattern=2)), - Text( - extent=[35, 33; 50, 23], - string="1", - style(color=9)), - Text( - extent=[14, 13; 32, 1], - string="1", + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-81, -25; -35, -43], + string="offset", + style(color=9)), + Text( + extent=[-33, -71; 13, -89], + string="startTime", + style(color=9)), + Text( + extent=[-66, 92; -25, 72], + string="outPort", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-10, 0; -10, -70], style(color=8, pattern=2)), + Line(points=[-10, 0; 50, 0], style(color=8, pattern=2)), + Line(points=[50, 0; 50, 60], style(color=8, pattern=2)), + Text( + extent=[35, 33; 50, 23], + string="1", + style(color=9)), + Text( + extent=[14, 13; 32, 1], + string="1", style(color=9)))); - equation + equation for i in 1:nout loop - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else time - p_startTime[i]); end for; end Clock; - block Constant "Generate constant signals of type Real" + + block Constant "Generate constant signals of type Real" parameter Real k[:]={1} "Constant output values"; extends Interfaces.MO(final nout=size(k, 1)); - + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[2, 2], + component=[20, 20]), Window( - x=0.29, - y=0.19, - width=0.6, - height=0.6), + x=0.29, + y=0.19, + width=0.6, + height=0.6), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), - Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8)), - Line(points=[-80, 0; 80, 0], style(color=0)), - Text( - extent=[-150, -150; 150, -110], - string="k=%k", - style(color=0))), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, + fillColor=8)), + Line(points=[-80, 0; 80, 0], style(color=0)), + Text( + extent=[-150, -150; 150, -110], + string="k=%k", + style(color=0))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-80, 0; 80, 0], style(color=0, thickness=2)), - Line(points=[-90, -70; 82, -70], style(color=8)), - Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8)), - Text( - extent=[-75, 94; -22, 76], - string="outPort", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Text( - extent=[-101, 8; -81, -12], - string="k", + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-80, 0; 80, 0], style(color=0, thickness=2)), + Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, + fillColor=8)), + Text( + extent=[-75, 94; -22, 76], + string="outPort", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Text( + extent=[-101, 8; -81, -12], + string="k", style(color=9)))); - equation + equation outPort.signal = k; end Constant; - block Step "Generate step signals of type Real" + + 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)])); - protected + 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); - annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.38, - y=0.11, - width=0.6, - height=0.6), - Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), - Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8)), - Line(points=[-80, -70; 0, -70; 0, 50; 80, 50], style(color=0)), - Text( - extent=[-150, -150; 150, -110], - string="startTime=%startTime", - style(color=0))), - Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-80, -18; 0, -18; 0, 50; 80, 50], style(color=0, - thickness=2)), - Line(points=[-90, -70; 82, -70], style(color=8)), - Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Text( - extent=[-21, -72; 25, -90], - string="startTime", - style(color=9)), - Line(points=[0, -17; 0, -71], style(color=8, pattern=2)), - Text( - extent=[-68, -36; -22, -54], - string="offset", - style(color=9)), + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); + annotation (Icon( + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, + fillColor=8)), + Line(points=[-80, -70; 0, -70; 0, 50; 80, 50], style(color=0)), + Text( + extent=[-150, -150; 150, -110], + string="startTime=%startTime", + style(color=0))), Diagram( + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-80, -18; 0, -18; 0, 50; 80, 50], style(color=0, thickness + =2)), + Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, + fillColor=8)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Text( + extent=[-21, -72; 25, -90], + string="startTime", + style(color=9)), + Line(points=[0, -17; 0, -71], style(color=8, pattern=2)), + Text( + extent=[-68, -36; -22, -54], + string="offset", + style(color=9)), Line(points=[-13, 50; -13, -17], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[2, 50; -19, 50; 2, 50], style(color=8, pattern=2)), - Polygon(points=[-13, -17; -16, -4; -10, -4; -13, -17; -13, -17], style - ( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[2, 50; -19, 50; 2, 50], style(color=8, pattern=2)), + Polygon(points=[-13, -17; -16, -4; -10, -4; -13, -17; -13, -17], style( + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-13, 50; -16, 37; -9, 37; -13, 50], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-68, 26; -22, 8], - string="height", - style(color=9)), - Polygon(points=[-13, -69; -16, -56; -10, -56; -13, -69; -13, -69], + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-68, 26; -22, 8], + string="height", + style(color=9)), + Polygon(points=[-13, -69; -16, -56; -10, -56; -13, -69; -13, -69], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-13, -18; -13, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[-13, -18; -16, -31; -9, -31; -13, -18], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[-72, 100; -31, 80], - string="outPort", + extent=[-72, 100; -31, 80], + string="outPort", style(color=9)))); - equation + equation for i in 1:nout loop - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else p_height[i]); end for; end Step; - block Ramp "Generate ramp signals" + + block Ramp "Generate ramp signals" parameter Real height[:]={1} "Heights of ramps"; - parameter Real duration[:](min=Modelica.Constants.SMALL) = {2} - "Durations of ramps"; + parameter Real duration[:](min=Modelica.Constants.small) = {2} "Durations of ramps"; 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(duration, 1); + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(height, 1); size(duration, 1); size(offset, 1); size(startTime, 1)])); - protected + protected parameter Real p_height[nout]=(if size(height, 1) == 1 then ones(nout)* height[1] else height); - parameter Real p_duration[nout]=(if size(duration, 1) == 1 then ones(nout) - *duration[1] else duration); + parameter Real p_duration[nout]=(if size(duration, 1) == 1 then ones(nout)* + duration[1] else duration); 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); - + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.19, - y=0.02, - width=0.59, - height=0.77), + x=0.19, + y=0.02, + width=0.59, + height=0.77), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, -70; -40, -70; 31, 38], style(color=0)), - Text( - extent=[-150, -150; 150, -110], - string="duration=%duration", - style(color=0)), - Line(points=[31, 38; 86, 38], style(color=0))), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, -70; -40, -70; 31, 38], style(color=0)), + Text( + extent=[-150, -150; 150, -110], + string="duration=%duration", + style(color=0)), + Line(points=[31, 38; 86, 38], style(color=0))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), Line(points=[-80, -20; -20, -20; 50, 50], style(color=0, thickness=2)) - , - Line(points=[-90, -70; 82, -70], style(color=8)), + , + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-40, -20; -42, -30; -37, -30; -40, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -20; -40, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-80, -33; -41, -49], - string="offset", - style(color=9)), - Text( - extent=[-40, -70; 6, -88], - string="startTime", - style(color=9)), - Text( - extent=[-66, 92; -25, 72], - string="outPort", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-20, -20; -20, -70], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-80, -33; -41, -49], + string="offset", + style(color=9)), + Text( + extent=[-40, -70; 6, -88], + string="startTime", + style(color=9)), + Text( + extent=[-66, 92; -25, 72], + string="outPort", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-20, -20; -20, -70], style(color=8, pattern=2)), Line(points=[-19, -20; 50, -20], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Line(points=[50, 50; 101, 50], style(color=0, thickness=2)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Line(points=[50, 50; 101, 50], style(color=0, thickness=2)), Line(points=[50, 50; 50, -20], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[50, -20; 42, -18; 42, -22; 50, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-20, -20; -11, -18; -11, -22; -20, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[50, 50; 48, 40; 53, 40; 50, 50], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[50, -20; 47, -10; 52, -10; 50, -20; 50, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[53, 25; 82, 7], - string="height", - style(color=9)), + extent=[53, 25; 82, 7], + string="height", + style(color=9)), Text( - extent=[0, -17; 35, -37], - string="duration", + extent=[0, -17; 35, -37], + string="duration", style(color=9)))); - equation + equation for i in 1:nout loop - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else if time < (p_startTime[i] + p_duration[i]) then (time - p_startTime[i]) *p_height[i]/p_duration[i] else p_height[i]); end for; end Ramp; - block Sine "Generate sine signals" + + block Sine "Generate sine signals" parameter Real amplitude[:]={1} "Amplitudes of sine waves"; - parameter SIunits.Frequency freqHz[:]={1} "Frequencies of sine waves"; - parameter SIunits.Angle phase[:]={0} "Phases of sine waves"; + parameter SI.Frequency freqHz[:]={1} "Frequencies of sine waves"; + parameter SI.Angle phase[:]={0} "Phases of sine waves"; 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(amplitude, 1); size(freqHz, 1) - ; size(phase, 1); size(offset, 1); size(startTime, 1)])); - protected - constant Real pi=Modelica.Constants.PI; - parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones( - nout)*amplitude[1] else amplitude); + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(amplitude, 1); size(freqHz, 1); + size(phase, 1); size(offset, 1); size(startTime, 1)])); + protected + constant Real pi=Modelica.Constants.pi; + parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones(nout + )*amplitude[1] else amplitude); parameter Real p_freqHz[nout]=(if size(freqHz, 1) == 1 then ones(nout)* freqHz[1] else freqHz); - parameter Real p_phase[nout]=(if size(phase, 1) == 1 then ones(nout)*phase - [1] else phase); + parameter Real p_phase[nout]=(if size(phase, 1) == 1 then ones(nout)*phase[ + 1] else phase); 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); + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.23, - y=0.08, - width=0.66, - height=0.68), + x=0.23, + y=0.08, + width=0.66, + height=0.68), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, 0; 68, 0], style(color=8)), - Polygon(points=[90, 0; 68, 8; 68, -8; 90, 0], style(color=8, fillColor - =8)), - Line(points=[-80, 0; -68.7, 34.2; -61.5, 53.1; -55.1, 66.4; -49.4, - 74.6; -43.8, 79.1; -38.2, 79.8; -32.6, 76.6; -26.9, 69.7; -21.3, - 59.4; -14.9, 44.1; -6.83, 21.2; 10.1, -30.8; 17.3, -50.2; 23.7, - - 64.2; 29.3, -73.1; 35, -78.4; 40.6, -80; 46.2, -77.6; 51.9, -71.5 - ; 57.5, -61.9; 63.9, -47.2; 72, -24.8; 80, 0], style(color=0)), - Text( - extent=[-147, -152; 153, -112], - string="freqHz=%freqHz", - style(color=0))), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, 0; 68, 0], style(color=8)), + Polygon(points=[90, 0; 68, 8; 68, -8; 90, 0], style(color=8, fillColor= + 8)), + Line(points=[-80, 0; -68.7, 34.2; -61.5, 53.1; -55.1, 66.4; -49.4, 74.6 + ; -43.8, 79.1; -38.2, 79.8; -32.6, 76.6; -26.9, 69.7; -21.3, 59.4 + ; -14.9, 44.1; -6.83, 21.2; 10.1, -30.8; 17.3, -50.2; 23.7, -64.2 + ; 29.3, -73.1; 35, -78.4; 40.6, -80; 46.2, -77.6; 51.9, -71.5; + 57.5, -61.9; 63.9, -47.2; 72, -24.8; 80, 0], style(color=0)), + Text( + extent=[-147, -152; 153, -112], + string="freqHz=%freqHz", + style(color=0))), Diagram( - Line(points=[-80, -90; -80, 84], style(color=8)), - Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, - fillColor=8)), - Line(points=[-99, -40; 85, -40], style(color=8)), - Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, - fillColor=8)), - Line(points=[-40, 0; -31.6, 34.2; -26.1, 53.1; -21.3, 66.4; -17.1, - 74.6; -12.9, 79.1; -8.64, 79.8; -4.42, 76.6; -0.201, 69.7; 4.02, - 59.4; 8.84, 44.1; 14.9, 21.2; 27.5, -30.8; 33, -50.2; 37.8, -64.2 - ; 42, -73.1; 46.2, -78.4; 50.5, -80; 54.7, -77.6; 58.9, -71.5; - 63.1, -61.9; 67.9, -47.2; 74, -24.8; 80, 0], style(color=0, - thickness=2)), - Line(points=[-41, -2; -80, -2], style(color=0, thickness=2)), - Text( - extent=[-128, 7; -82, -11], - string="offset", - style(color=9)), - Line(points=[-41, -2; -41, -40], style(color=8, pattern=2)), - Text( - extent=[-60, -43; -14, -61], - string="startTime", - style(color=9)), - Text( - extent=[84, -52; 108, -72], - string="time", - style(color=9)), - Text( - extent=[-74, 106; -33, 86], - string="outPort", - style(color=9)), - Line(points=[-9, 79; 43, 79], style(color=8, pattern=2)), - Line(points=[-42, -1; 50, 0], style(color=8, pattern=2)), + Line(points=[-80, -90; -80, 84], style(color=8)), + Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, + fillColor=8)), + Line(points=[-99, -40; 85, -40], style(color=8)), + Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, + fillColor=8)), + Line(points=[-40, 0; -31.6, 34.2; -26.1, 53.1; -21.3, 66.4; -17.1, 74.6 + ; -12.9, 79.1; -8.64, 79.8; -4.42, 76.6; -0.201, 69.7; 4.02, 59.4 + ; 8.84, 44.1; 14.9, 21.2; 27.5, -30.8; 33, -50.2; 37.8, -64.2; 42 + , -73.1; 46.2, -78.4; 50.5, -80; 54.7, -77.6; 58.9, -71.5; 63.1, + -61.9; 67.9, -47.2; 74, -24.8; 80, 0], style(color=0, thickness=2 + )), + Line(points=[-41, -2; -80, -2], style(color=0, thickness=2)), + Text( + extent=[-128, 7; -82, -11], + string="offset", + style(color=9)), + Line(points=[-41, -2; -41, -40], style(color=8, pattern=2)), + Text( + extent=[-60, -43; -14, -61], + string="startTime", + style(color=9)), + Text( + extent=[84, -52; 108, -72], + string="time", + style(color=9)), + Text( + extent=[-74, 106; -33, 86], + string="outPort", + style(color=9)), + Line(points=[-9, 79; 43, 79], style(color=8, pattern=2)), + Line(points=[-42, -1; 50, 0], style(color=8, pattern=2)), Polygon(points=[33, 80; 30, 67; 37, 67; 33, 80], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[37, 57; 83, 39], - string="amplitude", - style(color=9)), + extent=[37, 57; 83, 39], + string="amplitude", + style(color=9)), Polygon(points=[33, 1; 30, 14; 36, 14; 33, 1; 33, 1], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[33, 79; 33, 0], style( - color=8, - pattern=1, - thickness=1, + color=8, + pattern=1, + thickness=1, arrow=0)))); - equation + equation for i in 1:nout loop - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else - p_amplitude[i]*Modelica.Math.sin(2*pi*p_freqHz[i]*(time - p_startTime[i - ]) + p_phase[i])); + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else + p_amplitude[i]*Modelica.Math.sin(2*pi*p_freqHz[i]*(time - p_startTime[i]) + + p_phase[i])); end for; end Sine; - block ExpSine "Generate exponentially damped sine signals" + + block ExpSine "Generate exponentially damped sine signals" parameter Real amplitude[:]={1} "Amplitudes of sine waves"; - parameter SIunits.Frequency freqHz[:]={2} "Frequencies of sine waves"; - parameter SIunits.Angle phase[:]={0} "Phases of sine waves"; - parameter SIunits.Damping damping[:]={1} - "Damping coefficients of sine waves"; + parameter SI.Frequency freqHz[:]={2} "Frequencies of sine waves"; + parameter SI.Angle phase[:]={0} "Phases of sine waves"; + parameter SI.Damping damping[:]={1} "Damping coefficients of sine waves"; 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(amplitude, 1); size(freqHz, 1) - ; size(phase, 1); size(damping, 1); size(offset, 1); size(startTime, - 1)])); - protected - constant Real pi=Modelica.Constants.PI; - parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones( - nout)*amplitude[1] else amplitude); + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(amplitude, 1); size(freqHz, 1); + size(phase, 1); size(damping, 1); size(offset, 1); size(startTime, 1) + ])); + protected + constant Real pi=Modelica.Constants.pi; + parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones(nout + )*amplitude[1] else amplitude); parameter Real p_freqHz[nout]=(if size(freqHz, 1) == 1 then ones(nout)* freqHz[1] else freqHz); - parameter Real p_phase[nout]=(if size(phase, 1) == 1 then ones(nout)*phase - [1] else phase); + parameter Real p_phase[nout]=(if size(phase, 1) == 1 then ones(nout)*phase[ + 1] else phase); parameter Real p_damping[nout]=(if size(damping, 1) == 1 then ones(nout)* damping[1] else damping); 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); + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.18, - y=0.05, - width=0.6, - height=0.63), + x=0.18, + y=0.05, + width=0.6, + height=0.63), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, 0; 68, 0], style(color=8)), - Polygon(points=[90, 0; 68, 8; 68, -8; 90, 0], style(color=8, fillColor - =8)), - Line(points=[-80, 0; -75.2, 32.3; -72, 50.3; -68.7, 64.5; -65.5, 74.2 - ; -62.3, 79.3; -59.1, 79.6; -55.9, 75.3; -52.7, 67.1; -48.6, 52.2 - ; -43, 25.8; -35, -13.9; -30.2, -33.7; -26.1, -45.9; -22.1, -53.2 - ; -18.1, -55.3; -14.1, -52.5; -10.1, -45.3; -5.23, -32.1; 8.44, - 13.7; 13.3, 26.4; 18.1, 34.8; 22.1, 38; 26.9, 37.2; 31.8, 31.8; - 38.2, 19.4; 51.1, -10.5; 57.5, -21.2; 63.1, -25.9; 68.7, -25.9; - 75.2, -20.5; 80, -13.8], style(color=0)), - Text( - extent=[-147, -152; 153, -112], - string="freqHz=%freqHz", - style(color=0))), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, 0; 68, 0], style(color=8)), + Polygon(points=[90, 0; 68, 8; 68, -8; 90, 0], style(color=8, fillColor= + 8)), + Line(points=[-80, 0; -75.2, 32.3; -72, 50.3; -68.7, 64.5; -65.5, 74.2; + -62.3, 79.3; -59.1, 79.6; -55.9, 75.3; -52.7, 67.1; -48.6, 52.2; + -43, 25.8; -35, -13.9; -30.2, -33.7; -26.1, -45.9; -22.1, -53.2; + -18.1, -55.3; -14.1, -52.5; -10.1, -45.3; -5.23, -32.1; 8.44, + 13.7; 13.3, 26.4; 18.1, 34.8; 22.1, 38; 26.9, 37.2; 31.8, 31.8; + 38.2, 19.4; 51.1, -10.5; 57.5, -21.2; 63.1, -25.9; 68.7, -25.9; + 75.2, -20.5; 80, -13.8], style(color=0)), + Text( + extent=[-147, -152; 153, -112], + string="freqHz=%freqHz", + style(color=0))), Diagram( - Line(points=[-80, -90; -80, 84], style(color=8)), - Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, - fillColor=8)), - Line(points=[-99, -40; 85, -40], style(color=8)), - Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, - fillColor=8)), - Line(points=[-50, 0; -46.1, 28.2; -43.5, 44; -40.9, 56.4; -38.2, 64.9 - ; -35.6, 69.4; -33, 69.6; -30.4, 65.9; -27.8, 58.7; -24.5, 45.7; - -19.9, 22.5; -13.4, -12.2; -9.5, -29.5; -6.23, -40.1; -2.96, - - 46.5; 0.302, -48.4; 3.57, -45.9; 6.83, -39.6; 10.8, -28.1; 21.9, - 12; 25.8, 23.1; 29.7, 30.5; 33, 33.3; 36.9, 32.5; 40.8, 27.8; 46 - , 16.9; 56.5, -9.2; 61.7, -18.6; 66.3, -22.7; 70.9, -22.6; 76.1, - -18; 80, -12.1], style(color=0, thickness=2)), - Text( - extent=[-106, 10; -83, -10], - string="offset", - style(color=9)), - Text( - extent=[-72, -36; -26, -54], - string="startTime", - style(color=9)), - Text( - extent=[84, -52; 108, -72], - string="time", - style(color=9)), - Text( - extent=[-79, 104; -39, 87], - string="outPort", - style(color=9)), - Line(points=[-50, 0; 18, 0], style(color=8, pattern=2)), - Line(points=[-50, 0; -81, 0], style(color=0, thickness=2)), - Line(points=[-50, 77; -50, 0], style(color=8, pattern=2)), - Line(points=[18, -1; 18, 76], style(color=8, pattern=2)), - Line(points=[18, 73; -50, 73], style(color=8)), - Text( - extent=[-42, 88; 9, 74], - string="1/freqHz", - style(color=9)), + Line(points=[-80, -90; -80, 84], style(color=8)), + Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, + fillColor=8)), + Line(points=[-99, -40; 85, -40], style(color=8)), + Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, + fillColor=8)), + Line(points=[-50, 0; -46.1, 28.2; -43.5, 44; -40.9, 56.4; -38.2, 64.9; + -35.6, 69.4; -33, 69.6; -30.4, 65.9; -27.8, 58.7; -24.5, 45.7; - + 19.9, 22.5; -13.4, -12.2; -9.5, -29.5; -6.23, -40.1; -2.96, -46.5 + ; 0.302, -48.4; 3.57, -45.9; 6.83, -39.6; 10.8, -28.1; 21.9, 12; + 25.8, 23.1; 29.7, 30.5; 33, 33.3; 36.9, 32.5; 40.8, 27.8; 46, + 16.9; 56.5, -9.2; 61.7, -18.6; 66.3, -22.7; 70.9, -22.6; 76.1, - + 18; 80, -12.1], style(color=0, thickness=2)), + Text( + extent=[-106, 10; -83, -10], + string="offset", + style(color=9)), + Text( + extent=[-72, -36; -26, -54], + string="startTime", + style(color=9)), + Text( + extent=[84, -52; 108, -72], + string="time", + style(color=9)), + Text( + extent=[-79, 104; -39, 87], + string="outPort", + style(color=9)), + Line(points=[-50, 0; 18, 0], style(color=8, pattern=2)), + Line(points=[-50, 0; -81, 0], style(color=0, thickness=2)), + Line(points=[-50, 77; -50, 0], style(color=8, pattern=2)), + Line(points=[18, -1; 18, 76], style(color=8, pattern=2)), + Line(points=[18, 73; -50, 73], style(color=8)), + Text( + extent=[-42, 88; 9, 74], + string="1/freqHz", + style(color=9)), Polygon(points=[-49, 73; -40, 75; -40, 71; -49, 73], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[18, 73; 10, 75; 10, 71; 18, 73], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-50, -61; -19, -61], style(color=8)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-50, -61; -19, -61], style(color=8)), Polygon(points=[-18, -61; -26, -59; -26, -63; -18, -61], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-51, -63; -27, -75], - string="t", - style(color=9)), - Text( - extent=[-82, -67; 108, -96], - string="amplitude*exp(-damping*t)*sin(2*pi*freqHz*t+phase)", - style(color=9)), - Line(points=[-50, 0; -50, -40], style(color=8, pattern=2)), - Line(points=[-50, -54; -50, -72], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-51, -63; -27, -75], + string="t", + style(color=9)), + Text( + extent=[-82, -67; 108, -96], + string="amplitude*exp(-damping*t)*sin(2*pi*freqHz*t+phase)", + style(color=9)), + Line(points=[-50, 0; -50, -40], style(color=8, pattern=2)), + Line(points=[-50, -54; -50, -72], style(color=8, pattern=2)), Line(points=[-15, -77; -1, -48], style(color=8, pattern=2)))); - equation + equation for i in 1:nout loop - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else - p_amplitude[i]*Modelica.Math.exp(-(time - p_startTime[i])*p_damping[i]) - *Modelica.Math.sin(2*pi*p_freqHz[i]*(time - p_startTime[i]) + p_phase[i - ])); + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else + p_amplitude[i]*Modelica.Math.exp(-(time - p_startTime[i])*p_damping[i])*Modelica.Math.sin + (2*pi*p_freqHz[i]*(time - p_startTime[i]) + p_phase[i])); end for; end ExpSine; - model Exponentials "Generate a rising and falling exponential signal" + + block Exponentials "Generate a rising and falling exponential signal" parameter Real outMax[:]={1} "Height of output for infinite riseTime"; - parameter SIunits.Time riseTime[:](min=0) = {0.5} "Rise time"; - parameter SIunits.Time riseTimeConst[:](min=Modelica.Constants.SMALL) = { - 0.1} "Rise time constant"; - parameter SIunits.Time fallTimeConst[:](min=Modelica.Constants.SMALL) = - riseTimeConst "Fall time constant"; + parameter SI.Time riseTime[:](min=0) = {0.5} "Rise time"; + parameter SI.Time riseTimeConst[:](min=Modelica.Constants.small) = {0.1} + "Rise time constant"; + parameter SI.Time fallTimeConst[:](min=Modelica.Constants.small) = riseTimeConst + "Fall time constant"; 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(outMax, 1); size(riseTime, 1); + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(outMax, 1); size(riseTime, 1); size(riseTimeConst, 1); size(fallTimeConst, 1); size(offset, 1); size (startTime, 1)])); - protected + protected parameter Real p_outMax[nout]=(if size(outMax, 1) == 1 then ones(nout)* outMax[1] else outMax); - parameter SIunits.Time p_riseTime[nout]=(if size(riseTime, 1) == 1 then - ones(nout)*riseTime[1] else riseTime); - parameter SIunits.Time p_riseTimeConst[nout]=(if size(riseTimeConst, 1) - == 1 then ones(nout)*riseTimeConst[1] else riseTimeConst); - parameter SIunits.Time p_fallTimeConst[nout]=(if size(fallTimeConst, 1) - == 1 then ones(nout)*fallTimeConst[1] else fallTimeConst); + parameter SI.Time p_riseTime[nout]=(if size(riseTime, 1) == 1 then ones( + nout)*riseTime[1] else riseTime); + parameter SI.Time p_riseTimeConst[nout]=(if size(riseTimeConst, 1) == 1 + then ones(nout)*riseTimeConst[1] else riseTimeConst); + parameter SI.Time p_fallTimeConst[nout]=(if size(fallTimeConst, 1) == 1 + then ones(nout)*fallTimeConst[1] else fallTimeConst); 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); + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); Real y_riseTime[nout]; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.03, - y=0.05, - width=0.85, - height=0.74), + x=0.03, + y=0.05, + width=0.85, + height=0.74), Icon( - Line(points=[-90, -70; 68, -70], style(color=8)), - Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8)), + Line(points=[-90, -70; 68, -70], style(color=8)), + Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, + fillColor=8)), Line(points=[-80, -70; -77.2, -55.3; -74.3, -42.1; -70.8, -27.6; -67.3 - , -15; -63.7, -4.08; -59.5, 7.18; -55.3, 16.7; -50.3, 26; -44.6, + , -15; -63.7, -4.08; -59.5, 7.18; -55.3, 16.7; -50.3, 26; -44.6, 34.5; -38.3, 42.1; -31.2, 48.6; -22.7, 54.3; -12.1, 59.2; -10, 60 ; -7.88, 47.5; -5.05, 32.7; -2.22, 19.8; 0.606, 8.45; 4.14, -3.7 - ; 7.68, -14; 11.9, -24.2; 16.2, -32.6; 21.1, -40.5; 26.8, -47.4; + ; 7.68, -14; 11.9, -24.2; 16.2, -32.6; 21.1, -40.5; 26.8, -47.4; 33.1, -53.3; 40.9, -58.5; 50.8, -62.8; 60, -65.4], style(color=0) - ), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Text( - extent=[-150, -150; 150, -110], - string="riseTime=%riseTime", - style(color=0))), + ), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Text( + extent=[-150, -150; 150, -110], + string="riseTime=%riseTime", + style(color=0))), Diagram( - Line(points=[-100, -70; 84, -70], style(color=8)), - Polygon(points=[100, -70; 84, -64; 84, -76; 100, -70], style(color=8, - fillColor=8)), - Line(points=[-40, -30; -37.2, -15.3; -34.3, -2.1; -30.8, 12.4; -27.3, - 25; -23.7, 35.92; -19.5, 47.18; -15.3, 56.7; -10.3, 66; -4.6, - 74.5; 1.7, 82.1; 8.8, 88.6; 17.3, 94.3; 27.9, 99.2; 30, 100; + Line(points=[-100, -70; 84, -70], style(color=8)), + Polygon(points=[100, -70; 84, -64; 84, -76; 100, -70], style(color=8, + fillColor=8)), + Line(points=[-40, -30; -37.2, -15.3; -34.3, -2.1; -30.8, 12.4; -27.3, + 25; -23.7, 35.92; -19.5, 47.18; -15.3, 56.7; -10.3, 66; -4.6, + 74.5; 1.7, 82.1; 8.8, 88.6; 17.3, 94.3; 27.9, 99.2; 30, 100; 32.12, 87.5; 34.95, 72.7; 37.78, 59.8; 40.606, 48.45; 44.14, 36.3 ; 47.68, 26; 51.9, 15.8; 56.2, 7.4; 61.1, -0.5; 66.8, -7.4; 73.1 - , -13.3; 80.9, -18.5; 90.8, -22.8; 100, -25.4], style(color=0, - thickness=2)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Text( - extent=[-70, 91; -29, 71], - string="outPort", - style(color=9)), - Text( - extent=[-78, -43; -46, -56], - string="offset", - style(color=9)), - Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], + , -13.3; 80.9, -18.5; 90.8, -22.8; 100, -25.4], style(color=0, + thickness=2)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Text( + extent=[-70, 91; -29, 71], + string="outPort", + style(color=9)), + Text( + extent=[-78, -43; -46, -56], + string="offset", + style(color=9)), + Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -29; -40, -60], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[-40, -30; -42, -40; -37, -40; -40, -30], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-39, -30; -80, -30], style(color=0, thickness=2)), - Text( - extent=[-59, -71; -13, -89], - string="startTime", - style(color=9)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-39, -30; -80, -30], style(color=0, thickness=2)), + Text( + extent=[-59, -71; -13, -89], + string="startTime", + style(color=9)), Polygon(points=[-41, -30; -32, -28; -32, -32; -41, -30], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -30; 29, -30], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[29, -30; 21, -28; 21, -32; 29, -30], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[-26, -12; 19, -28], - string="riseTime", - style(color=9)), + extent=[-26, -12; 19, -28], + string="riseTime", + style(color=9)), Text( - extent=[78, -76; 102, -96], - string="time", - style(color=9)), + extent=[78, -76; 102, -96], + string="time", + style(color=9)), Line(points=[30, 100; 30, -34], style(color=8, pattern=2)))); - equation + equation for i in 1:nout loop - y_riseTime[i] = p_outMax[i]*(1 - Modelica.Math.exp(-p_riseTime[i]/ - p_riseTimeConst[i])); + y_riseTime[i] = p_outMax[i]*(1 - Modelica.Math.exp(-p_riseTime[i]/p_riseTimeConst[ + i])); outPort.signal[i] = p_offset[i] + (if (time < p_startTime[i]) then 0 else if (time < (p_startTime[i] + p_riseTime[i])) then p_outMax[i]*(1 - - exp(-(time - p_startTime[i])/p_riseTimeConst[i])) else y_riseTime[i] - *Modelica.Math.exp(-(time - p_startTime[i] - p_riseTime[i])/ - p_fallTimeConst[i])); + - Modelica.Math.exp(-(time - p_startTime[i])/p_riseTimeConst[i])) else y_riseTime[i] + *Modelica.Math.exp(-(time - p_startTime[i] - p_riseTime[i])/p_fallTimeConst[i])) + ; end for; - + end Exponentials; - block Pulse "Generate pulse signals of type Real" + + block Pulse "Generate pulse signals of type Real" parameter Real amplitude[:]={1} "Amplitudes of pulses"; parameter Real width[:]( - final min=Modelica.Constants.SMALL, + final min=Modelica.Constants.small, final max=100) = {50} "Widths of pulses in % of periods"; - parameter SIunits.Time period[:](final min=Modelica.Constants.SMALL) = {1} - "Times for one period"; + parameter SI.Time period[:](final min=Modelica.Constants.small) = {1} + "Times for one period"; 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(amplitude, 1); size(width, 1); + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(amplitude, 1); size(width, 1); size(period, 1); size(offset, 1); size(startTime, 1)])); - protected - parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones( - nout)*amplitude[1] else amplitude); - parameter SIunits.Time p_period[nout]=(if size(period, 1) == 1 then ones( - nout)*period[1] else period); - parameter SIunits.Time p_width[nout]=diagonal(p_period)*(if size(width, 1) - == 1 then ones(nout)*width[1] else width)/100 "Width of one pulse"; + protected + parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones(nout + )*amplitude[1] else amplitude); + parameter SI.Time p_period[nout]=(if size(period, 1) == 1 then ones(nout)* + period[1] else period); + parameter SI.Time p_width[nout]=diagonal(p_period)*(if size(width, 1) == 1 + then ones(nout)*width[1] else width)/100 "Width of one pulse"; 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); - discrete SIunits.Time T0[nout](final start=p_startTime) - "Start time of current period"; + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); + SI.Time T0[nout](final start=p_startTime) "Start time of current period"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.29, - y=0.05, - width=0.59, - height=0.72), + x=0.29, + y=0.05, + width=0.59, + height=0.72), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, -70; -40, -70; -40, 44; 0, 44; 0, -70; 40, -70; 40, - 44; 79, 44], style(color=0)), - Text( - extent=[-147, -152; 153, -112], - string="period=%period", - style(color=0))), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, -70; -40, -70; -40, 44; 0, 44; 0, -70; 40, -70; 40, + 44; 79, 44], style(color=0)), + Text( + extent=[-147, -152; 153, -112], + string="period=%period", + style(color=0))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, 1; -37, -12; -30, -12; -34, 1], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-34, -1; -34, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-33, -70; -36, -57; -30, -57; -33, -70; -33, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-33, -70; -36, -57; -30, -57; -33, -70; -33, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-78, -24; -35, -36], - string="offset", - style(color=9)), - Text( - extent=[-31, -69; 15, -87], - string="startTime", - style(color=9)), - Text( - extent=[-76, 99; -35, 79], - string="outPort", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-10, 0; -10, -70], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-78, -24; -35, -36], + string="offset", + style(color=9)), + Text( + extent=[-31, -69; 15, -87], + string="startTime", + style(color=9)), + Text( + extent=[-76, 99; -35, 79], + string="outPort", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-10, 0; -10, -70], style(color=8, pattern=2)), Line(points=[-80, 0; -10, 0; -10, 50; 30, 50; 30, 0; 50, 0; 50, 50; 90 - , 50], style(color=0, thickness=2)), - Line(points=[-10, 88; -10, 49], style(color=8, pattern=2)), - Line(points=[30, 74; 30, 50], style(color=9, pattern=2)), - Line(points=[50, 88; 50, 50], style(color=8, pattern=2)), - Line(points=[-10, 83; 51, 83], style(color=8)), - Line(points=[-10, 69; 30, 69], style(color=8)), - Text( - extent=[0, 97; 46, 85], - string="period", - style(color=9)), - Text( - extent=[-9, 81; 30, 69], - string="width", - style(color=9)), - Line(points=[-43, 50; -10, 50], style(color=8, pattern=2)), + , 50], style(color=0, thickness=2)), + Line(points=[-10, 88; -10, 49], style(color=8, pattern=2)), + Line(points=[30, 74; 30, 50], style(color=9, pattern=2)), + Line(points=[50, 88; 50, 50], style(color=8, pattern=2)), + Line(points=[-10, 83; 51, 83], style(color=8)), + Line(points=[-10, 69; 30, 69], style(color=8)), + Text( + extent=[0, 97; 46, 85], + string="period", + style(color=9)), + Text( + extent=[-9, 81; 30, 69], + string="width", + style(color=9)), + Line(points=[-43, 50; -10, 50], style(color=8, pattern=2)), Line(points=[-34, 50; -34, 1], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Text( - extent=[-78, 34; -37, 20], - string="amplitude", - style(color=9)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Text( + extent=[-78, 34; -37, 20], + string="amplitude", + style(color=9)), Polygon(points=[-34, 49; -37, 36; -30, 36; -34, 49], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, 1; -37, 14; -31, 14; -34, 1; -34, 1], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[90, 50; 90, 0; 100, 0], style(color=0, thickness=2)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[90, 50; 90, 0; 100, 0], style(color=0, thickness=2)), Polygon(points=[-10, 69; -1, 71; -1, 67; -10, 69], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[30, 69; 22, 71; 22, 67; 30, 69], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-10, 83; -1, 85; -1, 81; -10, 83], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[50, 83; 42, 85; 42, 81; 50, 83], style( - color=8, - fillColor=8, + color=8, + fillColor=8, fillPattern=1)))); - equation + equation for i in 1:nout loop when sample(p_startTime[i], p_period[i]) then T0[i] = time; end when; - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] or time >= - T0[i] + p_width[i] then 0 else p_amplitude[i]); + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] or time >= T0 + [i] + p_width[i] then 0 else p_amplitude[i]); end for; end Pulse; - block SawTooth "Generate saw tooth signals" + + block SawTooth "Generate saw tooth signals" parameter Real amplitude[:]={1} "Amplitudes of saw tooths"; - parameter SIunits.Time period[:](final min=Modelica.Constants.SMALL) = {1} - "Times for one period"; + parameter SI.Time period[:](final min=Modelica.Constants.small) = {1} + "Times for one period"; 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(amplitude, 1); size(period, 1) - ; size(offset, 1); size(startTime, 1)])); - protected - parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones( - nout)*amplitude[1] else amplitude); - parameter SIunits.Time p_period[nout]=(if size(period, 1) == 1 then ones( - nout)*period[1] else period); + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(amplitude, 1); size(period, 1); + size(offset, 1); size(startTime, 1)])); + protected + parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones(nout + )*amplitude[1] else amplitude); + parameter SI.Time p_period[nout]=(if size(period, 1) == 1 then ones(nout)* + period[1] else period); 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); - discrete SIunits.Time T0[nout](final start=p_startTime) - "Start time of current period"; + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); + SI.Time T0[nout](final start=p_startTime) "Start time of current period"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.21, - y=0.11, - width=0.55, - height=0.71), + x=0.21, + y=0.11, + width=0.55, + height=0.71), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, -70; -60, -70; 0, 40; 0, -70; 60, 41; 60, -70], - style(color=0)), - Text( - extent=[-147, -152; 153, -112], - string="period=%period", - style(color=0))), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, -70; -60, -70; 0, 40; 0, -70; 60, 41; 60, -70], style + (color=0)), + Text( + extent=[-147, -152; 153, -112], + string="period=%period", + style(color=0))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, -19; -37, -32; -30, -32; -34, -19], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-34, -20; -34, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-34, -70; -37, -57; -31, -57; -34, -70; -34, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-34, -70; -37, -57; -31, -57; -34, -70; -34, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-78, -24; -35, -36], - string="offset", - style(color=9)), - Text( - extent=[-31, -69; 15, -87], - string="startTime", - style(color=9)), - Text( - extent=[-76, 99; -35, 79], - string="outPort", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-10, -20; -10, -70], style(color=8, pattern=2)), - Line(points=[-10, 88; -10, -20], style(color=8, pattern=2)), - Line(points=[30, 88; 30, 59], style(color=8, pattern=2)), - Line(points=[-10, 83; 30, 83], style(color=8)), - Text( - extent=[-12, 97; 34, 85], - string="period", - style(color=9)), - Line(points=[-44, 60; 30, 60], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-78, -24; -35, -36], + string="offset", + style(color=9)), + Text( + extent=[-31, -69; 15, -87], + string="startTime", + style(color=9)), + Text( + extent=[-76, 99; -35, 79], + string="outPort", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-10, -20; -10, -70], style(color=8, pattern=2)), + Line(points=[-10, 88; -10, -20], style(color=8, pattern=2)), + Line(points=[30, 88; 30, 59], style(color=8, pattern=2)), + Line(points=[-10, 83; 30, 83], style(color=8)), + Text( + extent=[-12, 97; 34, 85], + string="period", + style(color=9)), + Line(points=[-44, 60; 30, 60], style(color=8, pattern=2)), Line(points=[-34, 47; -34, -7], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Text( - extent=[-78, 34; -37, 20], - string="amplitude", - style(color=9)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Text( + extent=[-78, 34; -37, 20], + string="amplitude", + style(color=9)), Polygon(points=[-34, 60; -37, 47; -30, 47; -34, 60], style( - color=8, - fillColor=8, - fillPattern=1)), - Polygon(points=[-34, -20; -37, -7; -31, -7; -34, -20; -34, -20], style - ( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), + Polygon(points=[-34, -20; -37, -7; -31, -7; -34, -20; -34, -20], style( + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-10, 83; -1, 85; -1, 81; -10, 83], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[30, 83; 22, 85; 22, 81; 30, 83], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, -20; -10, -20; 30, 60; 30, -20; 72, 60; 72, -20], + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, -20; -10, -20; 30, 60; 30, -20; 72, 60; 72, -20], style(color=0, thickness=2)))); - equation + equation for i in 1:nout loop when sample(p_startTime[i], p_period[i]) then T0[i] = time; end when; - outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else - (p_amplitude[i]/p_period[i])*(time - T0[i])); + outPort.signal[i] = p_offset[i] + (if time < p_startTime[i] then 0 else ( + p_amplitude[i]/p_period[i])*(time - T0[i])); end for; end SawTooth; - block Trapezoid "Generate trapezoidal signals of type Real" + + block Trapezoid "Generate trapezoidal signals of type Real" parameter Real amplitude[:]={1} "Amplitudes of trapezoids"; - parameter SIunits.Time rising[:](final min=0) = {0} + parameter SI.Time rising[:](final min=0) = {0} "Rising durations of trapezoids"; - parameter SIunits.Time width[:](final min=0) = {0.5} + parameter SI.Time width[:](final min=0) = {0.5} "Width durations of trapezoids"; - parameter SIunits.Time falling[:](final min=0) = {0} + parameter SI.Time falling[:](final min=0) = {0} "Falling durations of trapezoids"; - parameter SIunits.Time period[:](final min=Modelica.Constants.small) = {1} - "Time for one period"; - parameter Integer nperiod[:]={-1} + parameter SI.Time period[:](final min=Modelica.Constants.small) = {1} + "Time for one period"; + parameter Integer nperiod[:]={-1} "Number of periods (< 0 means infinite number of periods)"; 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(amplitude, 1); size(rising, 1) - ; size(width, 1); size(falling, 1); size(period, 1); size(nperiod, 1) - ; size(offset, 1); size(startTime, 1)])); - protected - parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones( - nout)*amplitude[1] else amplitude); - parameter SIunits.Time T_rising[nout]=(if size(rising, 1) == 1 then ones( - nout)*rising[1] else rising) - "End time of rising phase within one period"; - parameter SIunits.Time T_width[nout]=T_rising + (if size(width, 1) == 1 - then ones(nout)*width[1] else width) + parameter SI.Time startTime[:]={0} "Output = offset for time < startTime"; + extends Interfaces.MO(final nout=max([size(amplitude, 1); size(rising, 1); + size(width, 1); size(falling, 1); size(period, 1); size(nperiod, 1); + size(offset, 1); size(startTime, 1)])); + protected + parameter Real p_amplitude[nout]=(if size(amplitude, 1) == 1 then ones(nout + )*amplitude[1] else amplitude); + parameter SI.Time T_rising[nout]=(if size(rising, 1) == 1 then ones(nout)* + rising[1] else rising) "End time of rising phase within one period"; + parameter SI.Time T_width[nout]=T_rising + (if size(width, 1) == 1 then + ones(nout)*width[1] else width) "End time of width phase within one period"; - parameter SIunits.Time T_falling[nout]=T_width + (if size(falling, 1) == 1 - then ones(nout)*falling[1] else falling) + parameter SI.Time T_falling[nout]=T_width + (if size(falling, 1) == 1 then + ones(nout)*falling[1] else falling) "End time of falling phase within one period"; - parameter SIunits.Time p_period[nout]=(if size(period, 1) == 1 then ones( - nout)*period[1] else period) "Duration of one period"; + parameter SI.Time p_period[nout]=(if size(period, 1) == 1 then ones(nout)* + period[1] else period) "Duration of one period"; 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); - discrete SIunits.Time T0[nout](final start=p_startTime) - "Start time of current period"; - discrete Integer counter[nout](start=(if size(nperiod, 1) == 1 then ones( - nout)*nperiod[1] else nperiod)) "Period counter"; - discrete Integer counter2[nout](start=(if size(nperiod, 1) == 1 then ones( - nout)*nperiod[1] else nperiod)); + parameter SI.Time p_startTime[nout]=(if size(startTime, 1) == 1 then ones( + nout)*startTime[1] else startTime); + SI.Time T0[nout](final start=p_startTime) "Start time of current period"; + Integer counter[nout](start=(if size(nperiod, 1) == 1 then ones(nout)* + nperiod[1] else nperiod)) "Period counter"; + Integer counter2[nout](start=(if size(nperiod, 1) == 1 then ones(nout)* + nperiod[1] else nperiod)); annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.35, - y=0, - width=0.49, - height=0.58), + x=0.35, + y=0, + width=0.49, + height=0.58), Icon( - Line(points=[-80, 68; -80, -80], style(color=8)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-147, -152; 153, -112], - string="period=%period", - style(color=0)), - Line(points=[-81, -70; -60, -70; -30, 40; 9, 40; 39, -70; 61, -70; 90 - , 40], style(color=0))), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-147, -152; 153, -112], + string="period=%period", + style(color=0)), + Line(points=[-81, -70; -60, -70; -30, 40; 9, 40; 39, -70; 61, -70; 90, + 40], style(color=0))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-45, -30; -47, -41; -43, -41; -45, -30], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-45, -31; -45, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-45, -70; -47, -60; -43, -60; -45, -70; -45, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-45, -70; -47, -60; -43, -60; -45, -70; -45, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-86, -43; -43, -55], - string="offset", - style(color=9)), - Text( - extent=[-47, -69; -1, -87], - string="startTime", - style(color=9)), - Text( - extent=[-76, 99; -35, 79], - string="outPort", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-29, 82; -30, -70], style(color=8, pattern=2)), - Line(points=[-10, 59; -10, 40], style(color=8, pattern=2)), - Line(points=[20, 59; 20, 39], style(color=9, pattern=2)), - Line(points=[40, 59; 40, -30], style(color=8, pattern=2)), - Line(points=[-20, 76; 61, 76], style(color=8)), - Line(points=[-29, 56; 40, 56], style(color=8)), - Text( - extent=[-2, 86; 25, 77], - string="period", - style(color=9)), - Text( - extent=[-8, 70; 21, 60], - string="width", - style(color=9)), - Line(points=[-42, 40; -10, 40], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-86, -43; -43, -55], + string="offset", + style(color=9)), + Text( + extent=[-47, -69; -1, -87], + string="startTime", + style(color=9)), + Text( + extent=[-76, 99; -35, 79], + string="outPort", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-29, 82; -30, -70], style(color=8, pattern=2)), + Line(points=[-10, 59; -10, 40], style(color=8, pattern=2)), + Line(points=[20, 59; 20, 39], style(color=9, pattern=2)), + Line(points=[40, 59; 40, -30], style(color=8, pattern=2)), + Line(points=[-20, 76; 61, 76], style(color=8)), + Line(points=[-29, 56; 40, 56], style(color=8)), + Text( + extent=[-2, 86; 25, 77], + string="period", + style(color=9)), + Text( + extent=[-8, 70; 21, 60], + string="width", + style(color=9)), + Line(points=[-42, 40; -10, 40], style(color=8, pattern=2)), Line(points=[-39, 40; -39, -19], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Text( - extent=[-77, 14; -40, 0], - string="amplitude", - style(color=9)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Text( + extent=[-77, 14; -40, 0], + string="amplitude", + style(color=9)), Polygon(points=[-29, 56; -22, 58; -22, 54; -29, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-10, 56; -17, 58; -17, 54; -10, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-29, 76; -20, 78; -20, 74; -29, 76], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[61, 76; 53, 78; 53, 74; 61, 76], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-80, -30; -30, -30; -10, 40; 20, 40; 40, -30; 60, -30; 80 - , 40; 100, 40], style(color=0, thickness=2)), + , 40; 100, 40], style(color=0, thickness=2)), Polygon(points=[-39, 40; -41, 29; -37, 29; -39, 40], style( - color=8, - fillColor=8, - fillPattern=1)), - Polygon(points=[-39, -29; -41, -19; -37, -19; -39, -29; -39, -29], + color=8, + fillColor=8, + fillPattern=1)), + Polygon(points=[-39, -29; -41, -19; -37, -19; -39, -29; -39, -29], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[61, 84; 60, -30], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[61, 84; 60, -30], style(color=8, pattern=2)), Polygon(points=[39, 56; 32, 58; 32, 54; 39, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[20, 56; 27, 58; 27, 54; 20, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[20, 56; 13, 58; 13, 54; 20, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-12, 56; -5, 58; -5, 54; -12, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[-34, 70; -5, 60], - string="rising", - style(color=9)), + extent=[-34, 70; -5, 60], + string="rising", + style(color=9)), Text( - extent=[16, 70; 45, 60], - string="falling", + extent=[16, 70; 45, 60], + string="falling", style(color=9)))); - equation + equation for i in 1:nout loop - when (pre(counter2[i]) <> 0 and sample(p_startTime[i], p_period[i])) - then + when pre(counter2[i]) <> 0 and sample(p_startTime[i], p_period[i]) then T0[i] = time; counter2[i] = pre(counter[i]); counter[i] = pre(counter[i]) - (if pre(counter[i]) > 0 then 1 else 0); end when; - outPort.signal[i] = p_offset[i] + (if (time < p_startTime[i] or counter2 - [i] == 0 or time >= T0[i] + T_falling[i]) then 0 else if (time < T0[i] - + T_rising[i]) then (time - T0[i])*p_amplitude[i]/T_rising[i] else if + outPort.signal[i] = p_offset[i] + (if (time < p_startTime[i] or counter2[ + i] == 0 or time >= T0[i] + T_falling[i]) then 0 else if (time < T0[i] + + T_rising[i]) then (time - T0[i])*p_amplitude[i]/T_rising[i] else if (time < T0[i] + T_width[i]) then p_amplitude[i] else (T0[i] + T_falling [i] - time)*p_amplitude[i]/(T_falling[i] - T_width[i])); end for; end Trapezoid; - block KinematicPTP + + block KinematicPTP "Move as fast as possible along a distance within given kinematic constraints" - - + + parameter Real deltaq[:]={1} "Distance to move"; - parameter Real qd_max[:](final min=Modelica.Constants.SMALL) = {1} + parameter Real qd_max[:](final min=Modelica.Constants.small) = {1} "Maximum velocities der(q)"; - parameter Real qdd_max[:](final min=Modelica.Constants.SMALL) = {1} + parameter Real qdd_max[:](final min=Modelica.Constants.small) = {1} "Maximum accelerations der(qd)"; - parameter SIunits.Time startTime=0 "Time instant at which movement starts" - ; - - extends Interfaces.MO(final nout=max([size(deltaq, 1); size(qd_max, 1); + parameter SI.Time startTime=0 "Time instant at which movement starts"; + + extends Interfaces.MO(final nout=max([size(deltaq, 1); size(qd_max, 1); size(qdd_max, 1)])); - - protected + + protected parameter Real p_deltaq[nout]=(if size(deltaq, 1) == 1 then ones(nout)* deltaq[1] else deltaq); parameter Real p_qd_max[nout]=(if size(qd_max, 1) == 1 then ones(nout)* @@ -1389,81 +1365,79 @@ Modelica in file \"Modelica/package.mo\". Real sdd; Real aux1[nout]; Real aux2[nout]; - SIunits.Time Ta1; - SIunits.Time Ta2; - SIunits.Time Tv; - SIunits.Time Te; + SI.Time Ta1; + SI.Time Ta2; + SI.Time Tv; + SI.Time Te; Boolean noWphase; - // constants annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.32, - y=0.05, - width=0.48, - height=0.6), + x=0.17, + y=0.05, + width=0.69, + height=0.72), Icon( - Line(points=[-80, 78; -80, -82], style(color=8)), + Line(points=[-80, 78; -80, -82], style(color=8)), Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 88; -80, 90], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-90, 0; 82, 0], style(color=8)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-90, 0; 82, 0], style(color=8)), Polygon(points=[90, 0; 68, 8; 68, -8; 90, 0], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, 0; -70, 0; -70, 70; -30, 70; -30, 0; 20, 0; 20, -70 - ; 60, -70; 60, 0; 68, 0], style(color=0, thickness=1)), - Text( - extent=[2, 80; 80, 20], - string="acc", - style(color=8)), - Text( - extent=[-150, -150; 150, -110], - string="deltaq=%deltaq", - style(color=0))), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, 0; -70, 0; -70, 70; -30, 70; -30, 0; 20, 0; 20, -70; + 60, -70; 60, 0; 68, 0], style(color=0, thickness=1)), + Text( + extent=[2, 80; 80, 20], + string="acc", + style(color=8)), + Text( + extent=[-150, -150; 150, -110], + string="deltaq=%deltaq", + style(color=0))), Diagram( Rectangle(extent=[-100, -100; 100, 100], style( - color=3, - gradient=0, - fillColor=0, - fillPattern=0)), - Line(points=[-80, 78; -80, -82], style(color=8)), + color=3, + gradient=0, + fillColor=0, + fillPattern=0)), + Line(points=[-80, 78; -80, -82], style(color=8)), Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 88; -80, 90], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-90, 0; 82, 0], style(color=8)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-90, 0; 82, 0], style(color=8)), Polygon(points=[90, 0; 68, 8; 68, -8; 90, 0], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, 0; -70, 0; -70, 70; -30, 70; -30, 0; 20, 0; 20, -70 - ; 60, -70; 60, 0; 68, 0], style(color=0, thickness=2)), - Text( - extent=[-76, 98; -19, 83], - string="acceleration", - style(color=8)), - Text( - extent=[69, 24; 91, 12], - string="time", - style(color=8))), - Documentation(info=" - + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, 0; -70, 0; -70, 70; -30, 70; -30, 0; 20, 0; 20, -70; + 60, -70; 60, 0; 68, 0], style(color=0, thickness=2)), + Text( + extent=[-76, 98; -19, 83], + string="acceleration", + style(color=8)), + Text( + extent=[69, 24; 91, 12], + string="time", + style(color=8))), + Documentation(info="The goal is to move as fast as possible along a distance deltaq -under given kinematical constraints. The distance can be a positional or +under given kinematical constraints. The distance can be a positional or angular range. In robotics such a movement is called PTP (Point-To-Point). -This source block generates the acceleration of this signal -as output. After integrating the output two times, the position is +This source block generates the acceleration qdd of this signal +as output. After integrating the output two times, the position q is obtained. The signal is constructed in such a way that it is not possible -to move faster, given the maximally allowed velocity qd_max and -the maximally allowed angular acceleration qdd_max. +to move faster, given the maximally allowed velocity qd_max and +the maximally allowed acceleration qdd_max.
@@ -1476,157 +1450,151 @@ that the end point is reached at the same time instant.
-This element is useful to generate a reference signal for a controller -which controls a drive train or in combination with model -Modelica.Mechanics.Rotationa.Accelerate to drive +This element is useful to generate a reference signal for a controller +which controls a drive train or in combination with model +Modelica.Mechanics.Rotational.Accelerate to drive a flange according to a given acceleration.
Release Notes:
This block generates an output signal by linear interpolation in -a table. The time points and function values are stored in a matrix -table[i,j], where the first column table[:,1] contains the -time points and the second column contains the data to be interpolated. +a table. The time points and function values are stored in a matrix +table[i,j], where the first column table[:,1] contains the +time points and the second column contains the data to be interpolated. The table interpolation has the following proporties:
@@ -1634,17 +1602,17 @@ The table interpolation has the following proporties:Release Notes:
+ parameter Real table[:, :]=[0, 0; 1, 1; 2, 4]; ++ to +
+ parameter Real table[:, 2]=[0, 0; 1, 1; 2, 4]; ++
This library contains input/output blocks to build up block diagrams. The library is structured in the following sublibraries: @@ -36,6 +34,7 @@ The library is structured in the following sublibraries:
Interfaces Connectors and partial models for block diagram components + Examples Demonstration examples Continuous Basic continuous input/output blocks Discrete Discrete control blocks (not yet available) Logical Logical and relational operations on Boolean signals @@ -48,8 +47,8 @@ The library is structured in the following sublibraries:
Release Notes:
+ 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)) ++
Copyright (C) 1999, Modelica Design Group and DLR.
+Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
diff --git a/Constants.mo b/Constants.mo index 933250e601..35fe90dd27 100644 --- a/Constants.mo +++ b/Constants.mo @@ -1,40 +1,48 @@ -package Constants "Mathematical constants and constants of nature" +package Constants "Mathematical constants and constants of nature" + + import SI = Modelica.SIunits; + import NonSI = Modelica.SIunits.Conversions.NonSIunits; + extends Modelica.Icons.Library2; - package SIunits = Modelica.SIunits; - + // Mathematical constants - // (the definition is a temporary fix since not adapted to the - // machine where the Modelica translator is running) constant Real e=Modelica.Math.exp(1.0); - constant Real pi=2*Modelica.Math.asin(1.0); // 3.14159265358979; - + constant Real pi=2*Modelica.Math.asin(1.0); + // 3.14159265358979; + constant Real D2R=pi/180 "Degree to Radian"; + constant Real R2D=180/pi "Radian to Degree"; + // Machine dependent constants // (the definition is a temporary fix since not adapted to the // machine where the Modelica translator is running) - constant Real eps=1.e-15 "Biggest number such that 1.0 + EPS = 1.0"; - constant Real small=1.e-60 + constant Real eps=1.e-15 "Biggest number such that 1.0 + eps = 1.0"; + constant Real small=1.e-60 "Smallest number such that small and -small are representable on the machine" ; - constant Real inf=1.e+60 + constant Real inf=1.e+60 "Biggest Real number such that inf and -inf are representable on the machine" ; - constant Integer Integer_inf=2147483647 + constant Integer Integer_inf=2147483647 "Biggest Integer number such that Integer_inf and -Integer_inf are representable on the machine" ; - - // Constants of nature + + // Constants of nature // (name, value, description from http://physics.nist.gov/cuu/Constants/) - constant Modelica.SIunits.Velocity c = 299792458 "Speed of light in vacuum"; - constant Modelica.SIunits.Acceleration g_n = 9.80665 "Standard acceleration of gravity on earth"; - constant Real G(final unit="m3/(kg.s2)") = 6.673e-11 "Newtonian constant of gravitation"; + constant SI.Velocity c=299792458 "Speed of light in vacuum"; + constant SI.Acceleration g_n=9.80665 + "Standard acceleration of gravity on earth"; + constant Real G(final unit="m3/(kg.s2)") = 6.673e-11 + "Newtonian constant of gravitation"; constant Real h(final unit="J.s") = 6.62606876e-34 "Planck constant"; constant Real k(final unit="J/K") = 1.3806503e-23 "Boltzmann constant"; constant Real R(final unit="J/(mol.K)") = 8.314472 "Molar gas constant"; - constant Real sigma(final unit="W/(m2.K4)") = 5.670400e-8 "Stefan-Boltzmann constant"; + constant Real sigma(final unit="W/(m2.K4)") = 5.670400e-8 + "Stefan-Boltzmann constant"; constant Real N_A(final unit="1/mol") = 6.02214199e23 "Avogadro constant"; constant Real mue_0(final unit="N/A2") = 4*pi*1.e-7 "Magnetic constant"; - constant Real epsilon_0(final unit="F/m") = 1/(mue_0*c*c) "Electric constant"; - constant Modelica.SIunits.CelsiusTemperature T_zero = -273.15 "Absolute zero temperature"; + constant Real epsilon_0(final unit="F/m") = 1/(mue_0*c*c) "Electric constant" + ; + constant NonSI.Temperature_degC T_zero=-273.15 "Absolute zero temperature"; // For compatibility with previous versions (do not use in new models) constant Real E=e; @@ -50,10 +58,9 @@ package Constants "Mathematical constants and constants of nature" constant Real SIGMA=sigma; constant Real G_EARTH=g_n; constant Real T_ZERO=T_zero; - + annotation ( - Documentation(info=" - + Documentation(info="This package provides often needed constants from mathematics, machine dependent constants and constants from nature. The latter constants @@ -63,7 +70,7 @@ dependent constants and constants from nature. The latter constants
Release Notes:
Copyright (C) 1999, Modelica Design Group and DLR.
+Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
-"), - Coordsys( - extent=[0, 0; 658, 516], - grid=[2, 2], - component=[20, 20]), +"), Window( - x=0.16, - y=0.01, - width=0.65, - height=0.81, - library=1, - autolayout=1), + x=0.16, + y=0.01, + width=0.65, + height=0.81, + library=1, + autolayout=1), + Invisible=true, Icon( - Line(points=[-34, -38; 12, -38], style(color=0, thickness=2)), - Line(points=[-20, -38; -24, -48; -28, -56; -34, -64], style(color=0, - thickness=2)), - Line(points=[-2, -38; 2, -46; 8, -56; 14, -64], style(color=0, thickness - =2))), + Line(points=[-34, -38; 12, -38], style(color=0, thickness=2)), + Line(points=[-20, -38; -24, -48; -28, -56; -34, -64], style(color=0, + thickness=2)), + Line(points=[-2, -38; 2, -46; 8, -56; 14, -64], style(color=0, thickness= + 2))), Diagram( - Rectangle(extent=[200, 162; 380, 312], style(fillColor=30, fillPattern=1 - )), - Polygon(points=[200, 312; 220, 332; 400, 332; 380, 312; 200, 312], style - (fillColor=30, fillPattern=1)), - Polygon(points=[400, 332; 400, 182; 380, 162; 380, 312; 400, 332], style - (fillColor=30, fillPattern=1)), + Rectangle(extent=[200, 162; 380, 312], style(fillColor=30, fillPattern=1) + ), + Polygon(points=[200, 312; 220, 332; 400, 332; 380, 312; 200, 312], style( + fillColor=30, fillPattern=1)), + Polygon(points=[400, 332; 400, 182; 380, 162; 380, 312; 400, 332], style( + fillColor=30, fillPattern=1)), Text( - extent=[210, 302; 370, 272], - string="Library", + extent=[210, 302; 370, 272], + string="Library", style( - color=9, - fillColor=0, - fillPattern=1)), - Line(points=[266, 224; 312, 224], style(color=0, thickness=4)), - Line(points=[280, 224; 276, 214; 272, 206; 266, 198], style(color=0, - thickness=4)), - Line(points=[298, 224; 302, 216; 308, 206; 314, 198], style(color=0, - thickness=4)), + color=9, + fillColor=0, + fillPattern=1)), + Line(points=[266, 224; 312, 224], style(color=0, thickness=4)), + Line(points=[280, 224; 276, 214; 272, 206; 266, 198], style(color=0, + thickness=4)), + Line(points=[298, 224; 302, 216; 308, 206; 314, 198], style(color=0, + thickness=4)), Text( - extent=[152, 412; 458, 334], - string="Modelica.Constants", + extent=[152, 412; 458, 334], + string="Modelica.Constants", style(color=1)))); end Constants; diff --git a/Documentation/ChangeNotes1.5.html b/Documentation/ChangeNotes1.5.html new file mode 100644 index 0000000000..7a20299797 --- /dev/null +++ b/Documentation/ChangeNotes1.5.html @@ -0,0 +1,347 @@ + + +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 |
Removed final from quantity attribute for Mass and MassFlowRate.
+ +Implemented avoiding algorithm section, which would lead to expensive function calls.
+ ++ 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; ++ +
Replaced usage of built-in function exp by Modelica.Math.exp. + +
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; ++ +
+ 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; ++ +
Corrected table of values and default for Beta by dividing them by 1000 +(consistent with the values used in the NAND-example model): +
+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.Transformer: Replaced invalid escape characters '\ ' and '\[newline]' in documentation by '|'.
+ +Removed arrows and names documentation from flanges in diagram layer
+ ++ 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; ++ +
Replaced reinit by initial equation
+ +Bug corrected by using modifier stateSelect = StateSelect.prefer as implementation
+ +Attribute fillColor=7 added to Rectangle on Icon layer, i.e. it is now +filled with white and not transparent any more.
+ +Replaced reinit by initial equation
+ +Bug corrected by using modifier stateSelect = StateSelect.prefer as implementation
+ +Use stateSelect = StateSelect.prefer.
+ +Improved documentation and coordinate system used for example.
+ +Replaced reinit by initial equation
+ +Definition of connectors Surface_a and Surface_b:
+flow SIunits.HeatFlux q; changed to flow SIunits.HeatFlowRate q;
Icon corrected.
+ + + diff --git a/Electrical/Analog/Basic.mo b/Electrical/Analog/Basic.mo index 3beb57e19a..02d83787e5 100644 --- a/Electrical/Analog/Basic.mo +++ b/Electrical/Analog/Basic.mo @@ -1,31 +1,29 @@ package Basic + extends Modelica.Icons.Library; - package SIunits = Modelica.SIunits ; - annotation ( - Coordsys( - extent=[0, 0; 400, 500], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.03, - y=0.04, - width=0.50, - height=0.24, - library=1, - autolayout=1), - Documentation(info=" - + annotation (Window( + x=0.03, + y=0.04, + width=0.54, + height=0.35, + library=1, + autolayout=1), +Documentation(info="This package contains basic analog electrical components:
Ground of an electrical circuit. The potential at the ground node is zero. Every electrical circuit has to contain @@ -80,7 +77,7 @@ at least one ground object. Line(points=[-40, 30; 40, 30]), Line(points=[-20, 10; 20, 10]), Line(points=[0, 90; 0, 50]), - Text(extent=[-100, -40; 100, -10], string="%name")), + Text(extent=[-100, -68; 100, -10], string="%name")), Diagram( Line(points=[-60, 50; 60, 50], style(thickness=2)), Line(points=[-40, 30; 40, 30], style(thickness=2)), @@ -92,20 +89,19 @@ at least one ground object. y=0.23, width=0.59, height=0.63)); - Modelica.Electrical.Analog.Interfaces.Pin p annotation (extent=[-10, 110; - 10, 90], rotation=-90); + Interfaces.Pin p annotation (extent=[-10, 110; 10, 90], rotation=-90); equation p.v = 0; end Ground; + model Resistor "Ideal linear electrical resistor" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Resistance R=1 "Resistance"; + extends Interfaces.OnePort; + parameter SI.Resistance R=1 "Resistance"; annotation ( - Documentation(info=" - + Documentation(info="
The linear resistor connects the branch voltage v with the -branch current i by i*R = v. +branch current i by i*R = v. The Resistance R is allowed to be positive, zero, or negative.
@@ -122,10 +118,10 @@ The Resistance R is allowed to be positive, zero, or negative. Line(points=[-90, 0; -70, 0]), Line(points=[70, 0; 90, 0]), Text( - extent=[-100, -60; 100, -80], + extent=[-98, -58; 102, -120], string="R=%R", style(color=0)), - Text(extent=[-100, 60; 100, 80], string="%name")), + Text(extent=[-100, 40; 100, 100], string="%name")), Diagram( Rectangle(extent=[-70, 30; 70, -30]), Line(points=[-90, 0; -70, 0]), @@ -138,15 +134,106 @@ The Resistance R is allowed to be positive, zero, or negative. equation R*i = v; end Resistor; + + model HeatingResistor "Temperature dependent electrical resistor" + extends Interfaces.OnePort; + + parameter SI.Resistance R_ref "Resistance at temperature T_ref"; + parameter SI.Temperature T_ref=300 "Reference temperature"; + parameter Real alpha(unit="1/K") = 0 + "Temperature coefficient of resistance"; + + SI.Resistance R "Resistance = R_ref*(1 + alpha*(heatPort.T - T_ref));"; + + annotation ( + Diagram( + Line(points=[-110, 20; -85, 20], style(color=9, fillColor=9)), + Polygon(points=[-95, 23; -85, 20; -95, 17; -95, 23], style( + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[90, 20; 115, 20], style(color=9, fillColor=9)), + Line(points=[-125, 0; -115, 0], style(color=9)), + Line(points=[-120, -5; -120, 5], style(color=9)), + Text( + extent=[-110, 25; -90, 45], + string="i", + style(color=9)), + Polygon(points=[105, 23; 115, 20; 105, 17; 105, 23], style( + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[115, 0; 125, 0], style(color=9)), + Text( + extent=[90, 45; 110, 25], + string="i", + style(color=9)), + Rectangle(extent=[-70, 30; 70, -30]), + Line(points=[-90, 0; -70, 0]), + Line(points=[70, 0; 90, 0]), + Line(points=[0, -30; 0, -90], style(color=42)), + Line(points=[-52, -50; 48, 50], style(color=73, fillColor=73)), + Polygon(points=[40, 52; 50, 42; 54, 56; 40, 52], style(color=73, + fillColor=73))), + Icon( + Text(extent=[-143, 60; 143, 98], string="%name"), + Line(points=[-90, 0; -70, 0]), + Line(points=[70, 0; 90, 0]), + Rectangle(extent=[-70, 30; 70, -30], style( + color=3, + fillColor=7, + fillPattern=1)), + Line(points=[0, -30; 0, -91], style(color=42)), + Line(points=[-52, -50; 48, 50], style(color=73, fillColor=73)), + Polygon(points=[40, 52; 50, 42; 54, 56; 40, 52], style(color=73, + fillColor=73))), + Documentation(info=" +This is a model for an electrical resistor where the generated heat +is dissipated to the environment via connector heatPort and where +the resistance R is temperature dependent according to the following +equation:
+ +R = R_ref*(1 + alpha*(heatPort.T - T_ref)) ++ +
alpha is the temperature coefficient of resistance, which +is often abbreviated as TCR. In resistor catalogues, it is usually +defined as X [ppm/K] (parts per million, similarly to per centage) +meaning X*1.e-6 [1/K]. Resistors are available for 1 .. 7000 ppm/K, +i.e., alpha = 1e-6 .. 7e-3 1/K;
+ +When connector heatPort is not connected, the temperature +dependent behaviour is switched off by setting heatPort.T = T_ref. +Additionally, the equation heatPort.Q_dot = 0 is implicitly present +due to a special rule in Modelica that flow variables of not connected +connectors are set to zero.
+ +")); + Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort annotation ( + extent=[-10, -90; 10, -110], rotation=-90); + equation + v = R*i; + + if cardinality(heatPort) > 0 then + R = R_ref*(1 + alpha*(heatPort.T - T_ref)); + heatPort.Q_dot = -v*i; + else + /* heatPort is not connected resulting in the + implicit equation 'heatPort.Q_dot = 0' + */ + R = R_ref; + heatPort.T = T_ref; + end if; + end HeatingResistor; + model Conductor "Ideal linear electrical conductor" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Conductance G=1 "Conductance"; + extends Interfaces.OnePort; + parameter SI.Conductance G=1 "Conductance"; annotation ( - Documentation(info=" - + Documentation(info="The linear conductor connects the branch voltage v with the -branch current i by i = v*G. +branch current i by i = v*G. The Conductance G is allowed to be positive, zero, or negative.
@@ -156,28 +243,29 @@ The Conductance G is allowed to be positive, zero, or negative. grid=[2, 2], component=[20, 20]), Icon( - Rectangle(extent=[-70, 30; 70, -30], style(fillColor=7, fillPattern=1) - ), + Rectangle(extent=[-70, 30; 70, -30], style(fillColor=7, fillPattern=1)) + , Rectangle(extent=[-70, 30; 70, -30]), Line(points=[-90, 0; -70, 0]), Line(points=[70, 0; 90, 0]), Text( - extent=[-100, -60; 100, -80], + extent=[-100, -60; 100, -122], string="G=%G", style(color=0, pattern=0)), - Text(extent=[-100, 60; 100, 80], string="%name")), + Text(extent=[-100, 40; 100, 98], string="%name")), Diagram(Line(points=[-90, 0; -70, 0]), Line(points=[70, 0; 90, 0])), Window( - x=0.17, - y=0.29, - width=0.6, - height=0.6)); + x=0, + y=0.2, + width=0.63, + height=0.68)); equation i = G*v; end Conductor; + model Capacitor "Ideal linear electrical capacitor" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Capacitance C=1 "Capacitance"; + extends Interfaces.OnePort; + parameter SI.Capacitance C=1 "Capacitance"; annotation ( Coordsys( extent=[-100, -100; 100, 100], @@ -188,11 +276,10 @@ The Conductance G is allowed to be positive, zero, or negative. y=0.33, width=0.48, height=0.58), - Documentation(info=" - + Documentation(info="The linear capacitor connects the branch voltage v with the -branch current i by i = C * dv/dt. +branch current i by i = C * dv/dt. The Capacitance C is allowed to be positive, zero, or negative.
@@ -203,10 +290,10 @@ The Capacitance C is allowed to be positive, zero, or negative. Line(points=[-90, 0; -14, 0]), Line(points=[14, 0; 90, 0]), Text( - extent=[-100, -60; 100, -80], + extent=[-100, -60; 100, -120], string="C=%C", style(color=0)), - Text(extent=[-100, 60; 100, 80], string="%name")), + Text(extent=[-100, 40; 100, 100], string="%name")), Diagram( Line(points=[-20, 40; -20, -40], style(thickness=2)), Line(points=[20, 40; 20, -40], style(thickness=2)), @@ -215,19 +302,19 @@ The Capacitance C is allowed to be positive, zero, or negative. equation i = C*der(v); end Capacitor; + model Inductor "Ideal linear electrical inductor" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Inductance L=1 "Inductance"; + extends Interfaces.OnePort; + parameter SI.Inductance L=1 "Inductance"; annotation ( Coordsys( extent=[-100, -100; 100, 100], grid=[2, 2], component=[20, 20]), - Documentation(info=" - + Documentation(info="The linear inductor connects the branch voltage v with the -branch current i by v = L * di/dt. +branch current i by v = L * di/dt. The Inductance L is allowed to be positive, zero, or negative.
@@ -241,10 +328,10 @@ The Inductance L is allowed to be positive, zero, or negative. Line(points=[60, 0; 90, 0]), Line(points=[-90, 0; -60, 0]), Text( - extent=[-100, -60; 100, -80], + extent=[-100, -60; 100, -120], string="L=%L", style(color=0)), - Text(extent=[-100, 60; 100, 80], string="%name")), + Text(extent=[-100, 40; 100, 100], string="%name")), Diagram( Ellipse(extent=[-60, -15; -30, 15]), Ellipse(extent=[-30, -15; 0, 15]), @@ -261,37 +348,29 @@ The Inductance L is allowed to be positive, zero, or negative. equation L*der(i) = v; end Inductor; + model Transformer "Transformer with two ports" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; - parameter SIunits.Inductance L1=1 "Primary inductance"; - parameter SIunits.Inductance L2=1 "Secondary inductance"; - parameter SIunits.Inductance M=1 "Coupling inductance"; + extends Interfaces.TwoPort; + parameter SI.Inductance L1=1 "Primary inductance"; + parameter SI.Inductance L2=1 "Secondary inductance"; + parameter SI.Inductance M=1 "Coupling inductance"; annotation ( - Documentation(info=" - --The transformer is a two port. The left port voltage v1, left port current i1, + Documentation(info=" +
The transformer is a two port. The left port voltage v1, left port current i1, right port voltage v2 and right port current i2 are connected by the following -relation: -
-- - / v1 \ / L1 M \ / i1' \ - | | = | | | | - \ v2 / \ M L2 / \ i2' / - --
-L1, L2, and M are the primary, secondary, and coupling inductances resp.. -
- +relation: +| v1 | | L1 M | | i1' | + | | = | | | | + | v2 | | M L2 | | i2' |+
L1, L2, and M are the primary, secondary, and coupling inductances respectively.
+ "), Coordsys( extent=[-100, -100; 100, 100], grid=[1, 1], component=[20, 20]), Icon( - Text(extent=[-100, 100; 100, 80], string="%name"), + Text(extent=[-100, 128; 100, 70], string="%name"), Ellipse(extent=[-45, -50; -20, -25]), Ellipse(extent=[-45, -25; -20, 0]), Ellipse(extent=[-45, 0; -20, 25]), @@ -306,9 +385,9 @@ relation: Rectangle(extent=[33, -60; 72, 60], style(color=7, fillColor=7)), Line(points=[32, 50; 90, 50]), Line(points=[32, -50; 90, -50]), - Text(extent=[-80, 10; -60, -10], string="L1"), - Text(extent=[60, 10; 80, -10], string="L2"), - Text(extent=[-10, -70; 10, -90], string="M")), + Text(extent=[-89, 18; -60, -10], string="L1"), + Text(extent=[64, 18; 90, -10], string="L2"), + Text(extent=[-18, -70; 20, -98], string="M")), Diagram( Ellipse(extent=[-45, -50; -20, -25]), Ellipse(extent=[-45, -25; -20, 0]), @@ -325,20 +404,22 @@ relation: Line(points=[32, 50; 90, 50]), Line(points=[32, -50; 90, -50])), Window( - x=0.28, - y=0.13, + x=0.26, + y=0.43, width=0.6, height=0.6)); equation v1 = L1*der(i1) + M*der(i2); v2 = M*der(i1) + L2*der(i2); end Transformer; + model Gyrator "Gyrator" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; + extends Interfaces.TwoPort; + parameter SI.Conductance G1=1 "Gyration conductance"; + parameter SI.Conductance G2=1 "Gyration conductance"; annotation ( - Documentation(info=" - -+ Documentation(info=" +
A gyrator is a two-port element defined by the following equations:
@@ -355,23 +436,23 @@ where the constants G1, G2 are called the gyration conductance. grid=[1, 1], component=[20, 20]), Icon( - Rectangle(extent=[-60, 60; 60, -60]), + Rectangle(extent=[-60, 60; 60, -60], style(fillColor=7)), Line(points=[-90, 50; -60, 50]), Line(points=[-90, -50; -60, -50]), Line(points=[60, 50; 90, 50]), Line(points=[60, -50; 90, -50]), Line(points=[-40, 30; 40, 30]), - Line(points=[-20, -30; 20, -30]), + Line(points=[-20, -20; 20, -20]), Polygon(points=[30, 34; 40, 30; 30, 26; 30, 34], style(fillColor=3, fillPattern=1)), - Polygon(points=[-20, -30; -10, -26; -10, -34; -20, -30], style( + Polygon(points=[-26, -19; -16, -15; -16, -23; -26, -19], style( fillColor=3, fillPattern=1)), - Line(points=[-4, 5; -6, -5], style(thickness=2)), - Line(points=[3, 5; 1, -5], style(thickness=2)), - Line(points=[-8, 5; 7, 5], style(thickness=2)), - Text(extent=[-100, 100; 100, 70], string="%name"), - Text(extent=[-20, 50; 20, 35], string="G1"), - Text(extent=[-20, -35; 20, -50], string="G2")), + Line(points=[-5, 10; -10, -10], style(thickness=2)), + Line(points=[9, 10; 4, -9], style(thickness=2)), + Line(points=[-14, 9; 16, 10], style(thickness=2)), + Text(extent=[-100, 130; 100, 69], string="%name"), + Text(extent=[-29, 59; 30, 30], string="G1"), + Text(extent=[-29, -29; 29, -58], string="G2")), Diagram( Rectangle(extent=[-60, 60; 60, -60]), Line(points=[-90, 50; -60, 50]), @@ -379,7 +460,7 @@ where the constants G1, G2 are called the gyration conductance. Line(points=[60, 50; 90, 50]), Line(points=[60, -50; 90, -50]), Line(points=[-40, 30; 40, 30]), - Line(points=[-20, -30; 20, -30]), + Line(points=[-21, -22; 19, -22]), Polygon(points=[30, 34; 40, 30; 30, 26; 30, 34], style(fillColor=3, fillPattern=1)), Polygon(points=[-20, -30; -10, -26; -10, -34; -20, -30], style( @@ -388,19 +469,23 @@ where the constants G1, G2 are called the gyration conductance. Line(points=[3, 5; 1, -5], style(thickness=4)), Line(points=[-8, 5; 7, 5], style(thickness=4)), Text(extent=[-20, 50; 20, 35], string="G1"), - Text(extent=[-20, -35; 20, -50], string="G2"))); - parameter SIunits.Conductance G1=1 "Gyration conductance"; - parameter SIunits.Conductance G2=1 "Gyration conductance"; + Text(extent=[-20, -35; 20, -50], string="G2")), + Window( + x=0.4, + y=0.4, + width=0.6, + height=0.6)); equation i1 = G2*v2; i2 = -G1*v1; end Gyrator; + model EMF "Electromotoric force (electric/mechanic transformer)" parameter Real k(final unit="N.m/A") = 1 "Transformation coefficient"; - SIunits.Voltage v "Voltage drop between the two pins"; - SIunits.Current i "Current flowing from positive to negative pin"; - SIunits.AngularVelocity w "Angular velocity of flange_b"; + SI.Voltage v "Voltage drop between the two pins"; + SI.Current i "Current flowing from positive to negative pin"; + SI.AngularVelocity w "Angular velocity of flange_b"; annotation ( Coordsys( extent=[-100, -100; 100, 100], @@ -412,11 +497,11 @@ where the constants G1, G2 are called the gyration conductance. gradient=2, fillColor=8, fillPattern=1)), - Ellipse(extent=[-40, 40; 40, -40]), + Ellipse(extent=[-40, 40; 40, -40], style(fillColor=7)), Line(points=[0, -90; 0, -40]), Text(extent=[20, -40; 100, -100], string="%name"), Text( - extent=[40, 79; 119, 50], + extent=[30, 100; 119, 40], string="k=%k", style(color=9))), Diagram( @@ -450,8 +535,8 @@ where the constants G1, G2 are called the gyration conductance. Line(points=[14, 80; 14, 70], style(color=8)), Line(points=[140, 0; 110, 0], style(color=0, fillColor=0)), Text(extent=[114, -4; 148, -14], string="flange_b.phi"), - Polygon(points=[140, 3; 150, 0; 140, -3; 140, 3; 140, 3], style(color= - 0, fillColor=0)), + Polygon(points=[140, 3; 150, 0; 140, -3; 140, 3; 140, 3], style(color=0 + , fillColor=0)), Text(extent=[112, 16; 148, 6], string="flange_b.tau"), Polygon(points=[120, 35; 100, 40; 100, 30; 120, 35], style(color=10, fillColor=10)), @@ -467,17 +552,18 @@ where the constants G1, G2 are called the gyration conductance. height=0.66), Documentation(info="-Transforms electrical energy into rotational mechanical energy. -Is used as basic building block of an electrical motor. The mechanical -connector flange_b can be connected to elements of the -Modelica.Mechanics.Rotational library. +EMF transforms electrical energy into rotational mechanical energy. +It is used as basic building block of an electrical motor. The mechanical +connector flange_b can be connected to elements of the +Modelica.Mechanics.Rotational library. flange_b.tau is the cut-torque, +flange_b.phi is the angle at the rotational connection.
- + ")); - Modelica.Electrical.Analog.Interfaces.PositivePin p annotation (extent=[- - 10, 90; 10, 110], rotation=90); - Modelica.Electrical.Analog.Interfaces.NegativePin n annotation (extent=[- - 10, -110; 10, -90], rotation=90); + Interfaces.PositivePin p annotation (extent=[-10, 90; 10, 110], rotation=90 + ); + Interfaces.NegativePin n annotation (extent=[-10, -110; 10, -90], rotation= + 90); Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b annotation ( extent=[90, -10; 110, 10]); equation @@ -489,19 +575,26 @@ Modelica.Mechanics.Rotational library. k*w = v; flange_b.tau = -k*i; end EMF; + model VCV "Linear voltage-controlled voltage source" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; + extends Interfaces.TwoPort; parameter Real gain=1 "Voltage gain"; annotation ( - Documentation(info=" - -Linear voltage-controlled voltage source + Documentation(info=" ++The linear voltage-controlled voltage source is a TwoPort. +The right port voltage v2 is controlled by the left port voltage v1 +via +
- The linear voltage-controlled voltage source is a TwoPort. - The right port voltage vr is controlled by the left port voltage vl - via v2 = v1 * gain. - The left port current is zero. Any voltage gain can be chosen. ++ v2 = v1 * gain. +++The left port current is zero. Any voltage gain can be chosen. +
+ "), Coordsys( extent=[-100, -100; 100, 100], @@ -510,14 +603,14 @@ Linear voltage-controlled voltage source Window( x=0.28, y=0.02, - width=0.56, - height=0.83), + width=0.59, + height=0.92), Icon( Rectangle(extent=[-70, 70; 70, -70], style(fillColor=7)), - Text(extent=[-100, -80; 100, -100], string="%name"), + Text(extent=[-99, -79; 100, -129], string="%name"), Line(points=[-90, 50; -30, 50]), Line(points=[-30, -50; -90, -50]), - Line(points=[90, 50; 30, 50; 30, -50; 90, -50]), + Line(points=[100, 50; 30, 50; 30, -50; 100, -50]), Ellipse(extent=[10, 20; 50, -20]), Line(points=[-20, 60; 20, 60]), Polygon(points=[20, 60; 10, 63; 10, 57; 20, 60], style(fillColor=3, @@ -535,20 +628,24 @@ Linear voltage-controlled voltage source v2 = v1*gain; i1 = 0; end VCV; + model VCC "Linear voltage-controlled current source" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; - parameter Modelica.SIunits.Conductance transConductance=1 - "Transconductance"; + extends Interfaces.TwoPort; + parameter SI.Conductance transConductance=1 "Transconductance"; annotation ( - Documentation(info=" - -Linear voltage-controlled current source - - The linear voltage-controlled current source is a TwoPort. - The right port current ir is controlled by the left port voltage vl - via i2 = v1 * transConductance. - The left port current is zero. Any transConductance can be chosen. - + Documentation(info=" ++The linear voltage-controlled current source is a TwoPort. +The right port current i2 is controlled by the left port voltage v1 +via +
++ i2 = v1 * transConductance. +++The left port current is zero. Any transConductance can be chosen. +
+ "), Coordsys( extent=[-100, -100; 100, 100], @@ -556,7 +653,7 @@ Linear voltage-controlled current source component=[20, 20]), Icon( Rectangle(extent=[-70, 70; 70, -70], style(fillColor=7)), - Text(extent=[-100, -80; 100, -100], string="%name"), + Text(extent=[-99, -80; 100, -129], string="%name"), Line(points=[-90, 50; -30, 50]), Line(points=[-30, -50; -90, -50]), Ellipse(extent=[10, 20; 50, -20]), @@ -586,20 +683,25 @@ Linear voltage-controlled current source i2 = v1*transConductance; i1 = 0; end VCC; + model CCV "Linear current-controlled voltage source" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; + extends Interfaces.TwoPort; - parameter Modelica.SIunits.Resistance transResistance=1 "Transresistance"; + parameter SI.Resistance transResistance=1 "Transresistance"; annotation ( - Documentation(info=" - -Linear current-controlled voltage source - - The linear current-controlled voltage source is a TwoPort. - The right port voltage vr is controlled by the left port current i1 - via v2 = i1 * transResistance. - The left port voltage is zero. Any transResistance can be chosen. - + Documentation(info=" ++The linear current-controlled voltage source is a TwoPort. +The right port voltage v2 is controlled by the left port current i1 +via +
++ v2 = i1 * transResistance. +++The left port voltage is zero. Any transResistance can be chosen. +
+ "), Coordsys( extent=[-100, -100; 100, 100], @@ -607,13 +709,13 @@ Linear current-controlled voltage source component=[20, 20]), Icon( Rectangle(extent=[-70, 70; 70, -70], style(fillColor=7)), - Text(extent=[-100, -80; 100, -100], string="%name"), + Text(extent=[-99, -80; 100, -130], string="%name"), + Line(points=[100, 50; 30, 50; 30, -50; 100, -50]), Ellipse(extent=[10, 20; 50, -20]), Line(points=[-20, 60; 20, 60]), Polygon(points=[20, 60; 10, 63; 10, 57; 20, 60], style(fillColor=3, fillPattern=1)), - Line(points=[90, 50; 30, 50; 30, -50; 90, -50]), - Line(points=[-90, 50; -30, 50; -30, -50; -90, -50])), + Line(points=[-90, 50; -20, 50; -20, -50; -90, -50])), Diagram( Ellipse(extent=[10, 20; 50, -20]), Rectangle(extent=[-70, 70; 70, -70]), @@ -631,19 +733,26 @@ Linear current-controlled voltage source v2 = i1*transResistance; v1 = 0; end CCV; + model CCC "Linear current-controlled current source" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; + extends Interfaces.TwoPort; parameter Real gain=1 "Current gain"; annotation ( - Documentation(info=" - -Linear current-controlled current source + Documentation(info=" ++The linear current-controlled current source is a TwoPort. +The right port current i2 is controlled by the left port current i1 +via +
- The linear current-controlled current source is a TwoPort. - The right port current ir is controlled by the left port current il - via ir = il * gain. - The left port voltage is zero. Any current gain can be chosen. ++ i2 = i1 * gain. +++The left port voltage is zero. Any current gain can be chosen. +
+ "), Coordsys( extent=[-100, -100; 100, 100], @@ -651,15 +760,15 @@ Linear current-controlled current source component=[20, 20]), Icon( Rectangle(extent=[-70, 70; 70, -70], style(fillColor=7)), - Text(extent=[-100, -80; 100, -100], string="%name"), + Text(extent=[-104, -76; 97, -127], string="%name"), + Line(points=[-100, 50; -30, 50; -30, -50; -100, -50]), Ellipse(extent=[10, 20; 50, -20]), Line(points=[-20, 60; 20, 60]), Polygon(points=[20, 60; 10, 63; 10, 57; 20, 60], style(fillColor=3, fillPattern=1)), Line(points=[90, 50; 30, 50; 30, 20]), Line(points=[91, -50; 30, -50; 30, -20]), - Line(points=[10, 0; 50, 0]), - Line(points=[-90, 50; -30, 50; -30, -50; -91, -50])), + Line(points=[10, 0; 50, 0])), Diagram( Ellipse(extent=[10, 20; 50, -20]), Rectangle(extent=[-70, 70; 70, -70]), @@ -679,5 +788,110 @@ Linear current-controlled current source i2 = i1*gain; v1 = 0; end CCC; + + model OpAmp "Simple nonideal model of an OpAmp with limitation" + annotation ( + Documentation(info=" ++The OpAmp is a simle nonideal model with a smooth out.v = f(vin) characteristic, +where \"vin = in_p.v - in_n.v\". +The characteristic is limited by VMax.v and VMin.v. Its slope at vin=0 +is the parameter Slope, which must be positive. (Therefore, the absolute +value of Slope is taken into calculation.) +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Icon( + Text(extent=[-95, 88; 115, 146], string="%name"), + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), + Line(points=[-45, -10; -20, -10; -14, -9; -11, -7; -9, 7; -6, 9; 0, 10 + ; 20, 10]), + Line(points=[0, 35; 0, 80]), + Line(points=[0, -35; 0, -80]), + Line(points=[-90, 50; -60, 50]), + Line(points=[-90, -50; -60, -50]), + Line(points=[60, 0; 90, 0]), + Line(points=[-48, 32; -28, 32]), + Line(points=[-39, -20; -39, -41]), + Line(points=[-50, -31; -28, -31])), + Diagram( + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), + Line(points=[-45, -10; -20, -10; -14, -9; -11, -7; -9, 7; -6, 9; 0, 10 + ; 20, 10]), + Line(points=[0, 35; 0, 80]), + Line(points=[0, -35; 0, -80]), + Line(points=[-90, 50; -60, 50]), + Line(points=[-90, -50; -60, -50]), + Line(points=[60, 0; 90, 0]), + Line(points=[-55, 50; -45, 50]), + Line(points=[-50, -45; -50, -55]), + Line(points=[-55, -50; -45, -50]), + Text( + extent=[-112, -93; -91, -73], + style(color=9, fillColor=9), + string="in_p.i=0"), + Polygon(points=[120, 3; 110, 0; 120, -3; 120, 3], style( + color=9, + gradient=2, + fillColor=9, + fillPattern=1)), + Line(points=[111, 0; 136, 0], style( + color=9, + gradient=2, + fillColor=9)), + Text( + extent=[118, 2; 135, 17], + string="i2", + style( + color=9, + gradient=2, + fillColor=9)), + Text( + extent=[-111, 60; -85, 80], + style(color=9, fillColor=9), + string="in_n.i=0"), + Line(points=[-100, -35; -100, 23; -100, 24], style(color=9, arrow=1)), + Text( + extent=[-97, -16; -74, 4], + style(color=9, fillColor=9), + string="vin")), + Window( + x=0.28, + y=0.19, + width=0.71, + height=0.59)); + parameter Real Slope=1 "Slope of the out.v/vin characteristic at vin=0"; + Modelica.Electrical.Analog.Interfaces.PositivePin in_p + "Positive pin of the input port" annotation (extent=[-110, -60; -90, -40] + ); + Modelica.Electrical.Analog.Interfaces.NegativePin in_n + "Negative pin of the input port" annotation (extent=[-110, 40; -90, 60]); + Modelica.Electrical.Analog.Interfaces.PositivePin out "Output pin" + annotation (extent=[90, -10; 110, 10]); + Modelica.Electrical.Analog.Interfaces.PositivePin VMax + "Positive output voltage limitation" annotation (extent=[-10, 60; 10, 80] + ); + Modelica.Electrical.Analog.Interfaces.NegativePin VMin + "Negative output voltage limitation" annotation (extent=[-10, -80; 10, - + 60]); + SI.Voltage vin "input voltagae"; + protected + Real f "auxiliary variable"; + Real absSlope; + equation + in_p.i = 0; + in_n.i = 0; + VMax.i = 0; + VMin.i = 0; + vin = in_p.v - in_n.v; + f = 2/(VMax.v - VMin.v); + absSlope = if (Slope < 0) then -Slope else Slope; + out.v = (VMax.v + VMin.v)/2 + absSlope*vin/(1 + absSlope*noEvent(if (f*vin + < 0) then -f*vin else f*vin)); + end OpAmp; + end Basic; - diff --git a/Electrical/Analog/Examples/CauerFilter.mo b/Electrical/Analog/Examples/CauerFilter.mo index 18117cdb12..38c858d2a6 100644 --- a/Electrical/Analog/Examples/CauerFilter.mo +++ b/Electrical/Analog/Examples/CauerFilter.mo @@ -1,28 +1,22 @@ -// Example: Modelica.Electrical.Analog.Examples.CauerFilter +encapsulated model CauerFilter "CAUER Switched Capacitor Filter" + import Modelica.Electrical.Analog.Basic; + import Modelica.Electrical.Analog.Sources; + import Modelica.Electrical.Analog.Examples.Utilities; -// Version: $Id$ - - -model CauerFilter "CAUER Switched Capacitor Filter" annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), - Icon(Rectangle(extent=[-60, 60; 60, -60], style( - color=10, - thickness=2, - gradient=0, - fillColor=8, + Icon(Rectangle(extent=[-90, 90; 90, -90], style( + color=10, + thickness=2, + gradient=0, + fillColor=8, fillPattern=1)), Text( - extent=[-50, 20; 50, -20], - string="CauerFilter", - style(color=0))), - Documentation(info=" - + extent=[-50, 20; 50, -20], + string="CauerFilter", + style(color=0))), + Documentation(info="The example Cauer Filter is a low-pass-filter of the fifth order. It is realized -using a switched-capacitor network. The voltage source V is the input voltage, +using a switched-capacitor network. The voltage source V is the input voltage, and the Op5.p2.v is the filter output voltage. The pulse response is calculated.
The simulation end time should be 2e5. Please plot the output voltage Op5.p2.v. @@ -31,9 +25,9 @@ The simulation end time should be 2e5. Please plot the output voltage Op5.p2.v.
Chua's circuit is the most simple nonlinear circuit which shows chaotic behaviour. The circuit consists of linear basic elements (capacitors, resistor, conductor, inductor), and one nonlinear element, which is called Chua's diode. The chaotic behaviour is simulated.
@@ -30,9 +32,9 @@ Kennedy, M.P.: Three Steps to Chaos - Part I: Evolution. IEEE Transactions on CA
It is a simple NPN transistor amplifier circuit. The voltage difference between R1.p and R3.n is amplified. The output signal is the voltage between R2.n and R4.n. In this example the voltage at V1 is amplified because R3.n is grounded.
@@ -35,9 +33,9 @@ Tietze, U.; Schenk, Ch.: Halbleiter-Schaltungstechnik. Springer-Verlag Berlin He
-The nand gate is a basic CMOS building block. It consists of four CMOS transistors. -The output voltage Nand.y.v is low if and only if the two input voltages at Nand.x1.v and Nand.x2.v +The nand gate is a basic CMOS building block. It consists of four CMOS transistors. +The output voltage Nand.y.v is low if and only if the two input voltages at Nand.x1.v and Nand.x2.v are both high. In this way the nand functionality is realized.
-The simulation end time should be set to 1e-7. Please plot the input voltages Nand.x1.v, +The simulation end time should be set to 1e-7. Please plot the input voltages Nand.x1.v, d Nand.x2.v, and the output voltage Nand.y.v.
-The nand gate is a basic CMOS building block. It consists of four CMOS transistors. +The nand gate is a basic CMOS building block. It consists of four CMOS transistors.
This package contains utilities ...
@@ -24,9 +20,9 @@ This package contains utilities ...
This package contains examples for the analog electrical packages.
-This package contains ideal components: +This package contains electrical components with idealized behaviour: +
Ideal thyristor ... < description will be added >
@@ -121,19 +121,19 @@ Ideal thyristor ... < description will be added > v = s*(if off then 1 else Roff); i = s*(if off then Gon else 1); end IdealThyristor; + model IdealGTOThyristor "Ideal GTO thyristor" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Resistance Roff(final min=0) = 1.E-5 + extends Interfaces.OnePort; + parameter SI.Resistance Roff(final min=0) = 1.E-5 "Closed thyristor resistance"; - parameter SIunits.Conductance Gon(final min=0) = 1.E-5 + parameter SI.Conductance Gon(final min=0) = 1.E-5 "Opened thyristor conductance"; protected Real s "Auxiliary variable"; Boolean off(start=true) "Position of switch"; Boolean fire; annotation ( - Documentation(info=" - + Documentation(info="Ideal GTO thyristor ...
@@ -179,11 +179,12 @@ Ideal GTO thyristor ... v = s*(if off then 1 else Roff); i = s*(if off then Gon else 1); end IdealGTOThyristor; + model IdealSwitch "Ideal electrical switch" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Resistance Roff(final min=0) = 1.E-5 + extends Interfaces.OnePort; + parameter SI.Resistance Roff(final min=0) = 1.E-5 "Closed switch resistance"; - parameter SIunits.Conductance Gon(final min=0) = 1.E-5 + parameter SI.Conductance Gon(final min=0) = 1.E-5 "Opened switch conductance"; protected Real s "Auxiliary variable"; @@ -193,20 +194,19 @@ Ideal GTO thyristor ... false})) "true/false opened/closed switch" annotation (extent=[-10 , 50; 10, 70], rotation=-90); annotation ( - Documentation(info=" - + Documentation(info="Ideal electrical switch. In order to prevent singularities during switching, the opened switch has a high resistance -and the closed switch has a low resistance. +and the closed switch has a low resistance.
-If the actual circuit has an appropriate structure, the +If the actual circuit has an appropriate structure, the limiting case is also allowed, i.e., the resistance of the closed switch could be exactly zero and the conductance of the open switch could be also exactly zero (i.e. the resistance is -infinity). Note, there are circuits, where a description -with zero/infinity resistances is not possible. +infinite). Note, there are circuits, where a description +with zero/infinity resistances is not possible.
"), @@ -238,19 +238,190 @@ with zero/infinity resistances is not possible. v = s*(if off then 1 else Roff); i = s*(if off then Gon else 1); end IdealSwitch; - model ControlledIdealSwitch - parameter SIunits.Voltage level "Switch level"; - parameter SIunits.Resistance Roff(final min=0) = 1.E-5 + + model IdealCommutingSwitch "Ideal commuting switch" + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + ; + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance"; + annotation ( + Documentation(info=" ++The commuting switch has a positive pin p and two negative pins n1 and n2. +The switching behaviour is controlled +by the control signal. If the control signal is true, the pin p is connected +with the negative pin n2. Otherwise, the pin p is connected to the negative pin n1. +
++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Icon( + Ellipse(extent=[-44, 4; -36, -4]), + Text(extent=[-80, 0; -60, 22], string="p"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 50; 90, 50]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -70; 100, -100], string="%name")), + Diagram( + Ellipse(extent=[-44, 4; -36, -4]), + Text(extent=[-80, 0; -60, 22], string="p"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 50; 90, 50]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 0; 90, 0])), + Window( + x=0.21, + y=0.05, + width=0.6, + height=0.6)); + public + Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); + Interfaces.NegativePin n2 annotation (extent=[90, -10; 110, 10]); + Interfaces.NegativePin n1 annotation (extent=[90, 40; 110, 60]); + Modelica.Blocks.Interfaces.BooleanInPort control(final n=1) + "true => p--n2 connected, false => p--n1 connected" annotation (extent=[- + 10, 70; 10, 90], rotation=-90); + protected + Real s1; + Real s2 "Auxiliary variables"; + Boolean off; + equation + off = control.signal[1]; + 0 = p.i + n2.i + n1.i; + + p.v - n1.v = s1*(if (off) then 1 else Ron); + n1.i = -s1*(if (off) then Goff else 1); + p.v - n2.v = s2*(if (off) then Ron else 1); + n2.i = -s2*(if (off) then 1 else Goff); + end IdealCommutingSwitch; + + model IdealIntermediateSwitch "Ideal intermediate switch" + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + ; + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance"; + annotation ( + Documentation(info=" ++The intermediate switch has four switching contact pins p1, p2, n1, and n2. +The switching behaviour is controlled by the control signal. If the control +signal is true, the pin p1 is connected to pin n2, and the pin p2 is +connected to the pin n2. Otherwise, the pin p1 is connected to n1, and +p2 is connected to n2. +
+ + + ++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +
+ + + ++The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Icon( + Ellipse(extent=[-4, 30; 4, 22]), + Text(extent=[-80, 50; -60, 72], string="p1"), + Text(extent=[-80, 0; -60, 22], string="p2"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), + Line(points=[-90, 0; -44, 0]), + Line(points=[-90, 50; -44, 50]), + Line(points=[-44, 0; 40, 50]), + Line(points=[-44, 50; 40, 0]), + Line(points=[40, 50; 90, 50]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -70; 100, -100], string="%name")), + Diagram( + Ellipse(extent=[-4, 30; 4, 22]), + Text(extent=[-80, 50; -60, 72], string="p1"), + Text(extent=[-80, 0; -60, 22], string="p2"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), + Line(points=[-90, 0; -44, 0]), + Line(points=[-90, 50; -44, 50]), + Line(points=[-44, 0; 40, 50]), + Line(points=[-44, 50; 40, 0]), + Line(points=[40, 50; 90, 50]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 0; 90, 0])), + Window( + x=0.21, + y=0.05, + width=0.6, + height=0.6)); + public + Interfaces.PositivePin p1 annotation (extent=[-110, 40; -90, 60]); + Interfaces.PositivePin p2 annotation (extent=[-110, -10; -90, 10]); + Interfaces.NegativePin n1 annotation (extent=[90, 40; 110, 60]); + Interfaces.NegativePin n2 annotation (extent=[90, -10; 110, 10]); + Modelica.Blocks.Interfaces.BooleanInPort control(final n=1) "true => p1--n2, p2--n1 connected, + otherwise p1--n1, p2--n2 connected" annotation (extent=[-10, 70; 10, + 90], rotation=-90); + protected + Real s1; + Real s2; + Real s3; + Real s4 "Auxiliary variables"; + Boolean off; + equation + off = control.signal[1]; + p1.v - n1.v = s1*(if (off) then 1 else Ron); + p2.v - n2.v = s2*(if (off) then 1 else Ron); + p1.v - n2.v = s3*(if (off) then Ron else 1); + p2.v - n1.v = s4*(if (off) then Ron else 1); + + p1.i = if (off) then s1*Goff + s3 else s1 + s3*Goff; + p2.i = if (off) then s2*Goff + s4 else s2 + s4*Goff; + n1.i = if (off) then -s1*Goff - s4 else -s1 - s4*Goff; + n2.i = if (off) then -s2*Goff - s3 else -s2 - s3*Goff; + end IdealIntermediateSwitch; + + model ControlledIdealSwitch "Controlled ideal switch" + parameter SI.Voltage level=0.5 "Switch level"; + parameter SI.Resistance Roff(final min=0) = 1.E-5 "Closed switch resistance"; - parameter SIunits.Conductance Gon(final min=0) = 1.E-5 + parameter SI.Conductance Gon(final min=0) = 1.E-5 "Opened switch conductance"; protected Real s "Auxiliary variable"; annotation ( - Documentation(info=" - + Documentation(info="-The ideal switch is a three-pole. If the third pin voltage exceeds the given +The ideal switch is a three-pole. If the third pin voltage exceeds the given parameter Voltage, the pins p and n are open (no current flowing, any voltage possible). Otherwise, p and n are short cut.
@@ -279,33 +450,41 @@ possible). Otherwise, p and n are short cut. Line(points=[40, 0; 90, 0]), Line(points=[0, 90; 0, 25]))); public - Modelica.Electrical.Analog.Interfaces.Pin p "Positive pin" annotation ( - extent=[-110, -10; -90, 10]); - Modelica.Electrical.Analog.Interfaces.Pin n "Negative pin" annotation ( - extent=[90, -10; 110, 10]); - Modelica.Electrical.Analog.Interfaces.Pin control + Interfaces.Pin p "Positive pin" annotation (extent=[-110, -10; -90, 10]); + Interfaces.Pin n "Negative pin" annotation (extent=[90, -10; 110, 10]); + Interfaces.Pin control "Control pin: control.v > level open, otherwise closed" annotation ( extent=[-10, 90; 10, 110], rotation=90); equation control.i = 0; 0 = p.i + n.i; - p.v - n.v = s * (if (control.v < level) then Roff else 1); - n.i = s * (if (control.v < level) then 1 else Gon); + p.v - n.v = s*(if (control.v < level) then Roff else 1); + n.i = s*(if (control.v < level) then 1 else Gon); end ControlledIdealSwitch; - model ControlledIdealCommutingSwitch "Ideal commuting switch" - parameter SIunits.Voltage level "Switch level"; - parameter SIunits.Resistance Roff(final min=0) = 1.E-5 - "Closed switch resistance"; - parameter SIunits.Conductance Gon(final min=0) = 1.E-5 + + model ControlledIdealCommutingSwitch "Controlled ideal commuting switch" + parameter SI.Voltage level=0.5 "Switch level"; + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + ; + parameter SI.Conductance Goff(final min=0) = 1.E-5 "Opened switch conductance"; annotation ( - Documentation(info=" - + Documentation(info=" ++The commuting switch has a positive pin p and two negative pins n1 and n2. +The switching behaviour is controlled +by the control pin. If its voltage exceeds the value of the parameter level, +the pin p is connected with the negative pin n2. Otherwise, the pin p is +connected the negative pin n1. +
-The commuting switch is a four pole. The switching behaviour is controlled -by the fourth pin. If its voltage exceeds the parameter Voltage value, -the first pin p is chort cut to the second pin ng. Otherwise, the pin p -is short cut to the third pin n1. +In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible.
"), @@ -315,6 +494,9 @@ is short cut to the third pin n1. component=[20, 20]), Icon( Ellipse(extent=[-44, 4; -36, -4]), + Text(extent=[-80, 0; -60, 22], string="p"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), Line(points=[-90, 0; -44, 0]), Line(points=[-37, 2; 40, 50]), Line(points=[40, 50; 90, 50]), @@ -323,6 +505,9 @@ is short cut to the third pin n1. Text(extent=[-100, -70; 100, -100], string="%name")), Diagram( Ellipse(extent=[-44, 4; -36, -4]), + Text(extent=[-80, 0; -60, 22], string="p"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), Line(points=[-90, 0; -44, 0]), Line(points=[-37, 2; 40, 50]), Line(points=[40, 50; 90, 50]), @@ -334,39 +519,135 @@ is short cut to the third pin n1. width=0.6, height=0.6)); public - Modelica.Electrical.Analog.Interfaces.Pin p "Positive pin" annotation ( - extent=[-110, -10; -90, 10]); - Modelica.Electrical.Analog.Interfaces.Pin n2 "Negative pin 2" annotation ( - extent=[90, -10; 110, 10]); - Modelica.Electrical.Analog.Interfaces.Pin n1 "Negative pin 1" annotation ( - extent=[90, 40; 110, 60]); - Modelica.Electrical.Analog.Interfaces.Pin control - "Control pin: control.v > level p--n2, otherwise p--n1" annotation ( - extent=[-10, 90; 10, 110], rotation=90); - protected - Real s1, s2 "Auxiliary variables"; + Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); + Interfaces.NegativePin n2 annotation (extent=[90, -10; 110, 10]); + Interfaces.NegativePin n1 annotation (extent=[90, 40; 110, 60]); + Interfaces.Pin control + "Control pin: if control.v > level p--n2 connected, otherwise p--n1 connected" + annotation (extent=[-10, 90; 10, 110], rotation=90); + protected + Real s1; + Real s2 "Auxiliary variables"; equation control.i = 0; 0 = p.i + n2.i + n1.i; - - p.v - n1.v = s1 * (if (control.v > level) then 1 else Roff); - n1.i = s1 * (if (control.v > level) then Gon else 1); - p.v - n2.v = s2 * (if (control.v > level) then Roff else 1); - n2.i = s2 * (if (control.v > level) then 1 else Gon); + + p.v - n1.v = s1*(if (control.v > level) then 1 else Ron); + n1.i = -s1*(if (control.v > level) then Goff else 1); + p.v - n2.v = s2*(if (control.v > level) then Ron else 1); + n2.i = -s2*(if (control.v > level) then 1 else Goff); end ControlledIdealCommutingSwitch; - model IdealOpAmp "Ideal opamp (norator-nullator pair)" - SIunits.Voltage v1 "Voltage drop over the left port"; - SIunits.Voltage v2 "Voltage drop over the right port"; - SIunits.Current i1 - "Current flowing from pos. to neg. pin of the left port"; - SIunits.Current i2 - "Current flowing from pos. to neg. pin of the right port"; + + model ControlledIdealIntermediateSwitch + "Controlled ideal intermediate switch" + parameter SI.Voltage level=0.5 "Switch level"; + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + ; + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance"; annotation ( - Documentation(info=" - + Documentation(info=" ++The intermediate switch has four switching contact pins p1, p2, n1, and n2. +The switching behaviour is controlled +by the control pin. If its voltage exceeds the value of the +parameter level, the pin p1 is connected to pin n2, and the pin p2 is +connected to the pin n2. Otherwise, the pin p1 is connected to n1, and +p2 is connected to n2. +
+ + + ++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +
+ + + ++The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Icon( + Ellipse(extent=[-4, 30; 4, 22]), + Text(extent=[-80, 50; -60, 72], string="p1"), + Text(extent=[-80, 0; -60, 22], string="p2"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), + Line(points=[-90, 0; -44, 0]), + Line(points=[-90, 50; -44, 50]), + Line(points=[-44, 0; 40, 50]), + Line(points=[-44, 50; 40, 0]), + Line(points=[40, 50; 90, 50]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -70; 100, -100], string="%name")), + Diagram( + Ellipse(extent=[-4, 30; 4, 22]), + Text(extent=[-80, 50; -60, 72], string="p1"), + Text(extent=[-80, 0; -60, 22], string="p2"), + Text(extent=[60, 50; 80, 72], string="n1"), + Text(extent=[60, 0; 80, 22], string="n2"), + Line(points=[-90, 0; -44, 0]), + Line(points=[-90, 50; -44, 50]), + Line(points=[-44, 0; 40, 50]), + Line(points=[-44, 50; 40, 0]), + Line(points=[40, 50; 90, 50]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 0; 90, 0])), + Window( + x=0.21, + y=0.05, + width=0.6, + height=0.6)); + + public + Interfaces.PositivePin p1 annotation (extent=[-110, 40; -90, 60]); + Interfaces.PositivePin p2 annotation (extent=[-110, -10; -90, 10]); + Interfaces.NegativePin n1 annotation (extent=[90, 40; 110, 60]); + Interfaces.NegativePin n2 annotation (extent=[90, -10; 110, 10]); + Interfaces.Pin control "Control pin: if control.v > level p1--n2, p2--n1 connected, + otherwise p1--n1, p2--n2 connected" annotation (extent=[-10, 90; 10, + 110], rotation=90); + protected + Real s1; + Real s2; + Real s3; + Real s4 "Auxiliary variables"; + equation + control.i = 0; + + p1.v - n1.v = s1*(if (control.v > level) then 1 else Ron); + p2.v - n2.v = s2*(if (control.v > level) then 1 else Ron); + p1.v - n2.v = s3*(if (control.v > level) then Ron else 1); + p2.v - n1.v = s4*(if (control.v > level) then Ron else 1); + + p1.i = if (control.v > level) then s1*Goff + s3 else s1 + s3*Goff; + p2.i = if (control.v > level) then s2*Goff + s4 else s2 + s4*Goff; + n1.i = if (control.v > level) then -s1*Goff - s4 else -s1 - s4*Goff; + n2.i = if (control.v > level) then -s2*Goff - s3 else -s2 - s3*Goff; + end ControlledIdealIntermediateSwitch; + + model IdealOpAmp "Ideal operational amplifier (norator-nullator pair)" + SI.Voltage v1 "Voltage drop over the left port"; + SI.Voltage v2 "Voltage drop over the right port"; + SI.Current i1 "Current flowing from pos. to neg. pin of the left port"; + SI.Current i2 "Current flowing from pos. to neg. pin of the right port"; + annotation ( + Documentation(info="The ideal OpAmp is a two-port. The left port is fixed to v1=0 and i1=0 -(nullator). At the right port both any voltage v2 and any current i2 +(nullator). At the right port both any voltage v2 and any current i2 are possible (norator).
@@ -377,8 +658,7 @@ are possible (norator). component=[20, 20]), Icon( Text(extent=[-100, 80; 100, 100], string="%name"), - Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)) - , + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), Line(points=[-90, 50; -60, 50]), Line(points=[-90, -50; -60, -50]), Line(points=[60, 0; 90, 0]), @@ -387,8 +667,7 @@ are possible (norator). Line(points=[-39, -20; -39, -41]), Line(points=[-50, -31; -28, -31])), Diagram( - Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)) - , + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), Line(points=[-90, 50; -60, 50]), Line(points=[-90, -50; -60, -50]), Line(points=[60, 0; 90, 0]), @@ -437,16 +716,14 @@ are possible (norator). y=0.19, width=0.71, height=0.59)); - Modelica.Electrical.Analog.Interfaces.PositivePin p1 - "Positive pin of the left port" annotation (extent=[-110, -60; -90, -40]) - ; - Modelica.Electrical.Analog.Interfaces.NegativePin n1 - "Negative pin of the left port" annotation (extent=[-110, 40; -90, 60]); - Modelica.Electrical.Analog.Interfaces.PositivePin p2 - "Positive pin of the right port" annotation (extent=[90, -10; 110, 10]); - Modelica.Electrical.Analog.Interfaces.NegativePin n2 - "Negative pin of the right port" annotation (extent=[-10, -90; 10, -110] - , rotation=-90); + Interfaces.PositivePin p1 "Positive pin of the left port" annotation ( + extent=[-110, -60; -90, -40]); + Interfaces.NegativePin n1 "Negative pin of the left port" annotation ( + extent=[-110, 40; -90, 60]); + Interfaces.PositivePin p2 "Positive pin of the right port" annotation ( + extent=[90, -10; 110, 10]); + Interfaces.NegativePin n2 "Negative pin of the right port" annotation ( + extent=[-10, -90; 10, -110], rotation=-90); equation v1 = p1.v - n1.v; v2 = p2.v - n2.v; @@ -457,33 +734,200 @@ are possible (norator). v1 = 0; i1 = 0; end IdealOpAmp; + + model IdealOpAmp3Pin + "Ideal operational amplifier (norator-nullator pair), but 3 pins" + annotation ( + Documentation(info=" ++The ideal OpAmp with three pins is of exactly the same behaviour as the ideal +OpAmp with four pins. Only the negative output pin is left out. +Both the input voltage and current are fixed to zero (nullator). +At the output pin both any voltage v2 and any current i2 +are possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Icon( + Text(extent=[-100, 80; 100, 100], string="%name"), + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), + Line(points=[-90, 50; -60, 50]), + Line(points=[-90, -50; -60, -50]), + Line(points=[60, 0; 90, 0]), + Line(points=[-48, 32; -28, 32]), + Line(points=[-39, -20; -39, -41]), + Line(points=[-50, -31; -28, -31])), + Diagram( + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), + Line(points=[-90, 50; -60, 50]), + Line(points=[-90, -50; -60, -50]), + Line(points=[60, 0; 90, 0]), + Line(points=[-55, 50; -45, 50]), + Line(points=[-50, -45; -50, -55]), + Line(points=[-55, -50; -45, -50]), + Text( + extent=[-111, -39; -90, -19], + string="p1.i=0", + style(color=9, fillColor=9)), + Polygon(points=[120, 3; 110, 0; 120, -3; 120, 3], style( + color=9, + gradient=2, + fillColor=9, + fillPattern=1)), + Line(points=[111, 0; 136, 0], style( + color=9, + gradient=2, + fillColor=9)), + Text( + extent=[118, 2; 135, 17], + string="i2", + style( + color=9, + gradient=2, + fillColor=9)), + Text( + extent=[-111, 60; -90, 80], + string="n1.i=0", + style(color=9, fillColor=9))), + Window( + x=0.28, + y=0.19, + width=0.71, + height=0.59)); + Interfaces.PositivePin in_p "Positive pin of the input port" annotation ( + extent=[-110, -60; -90, -40]); + Interfaces.NegativePin in_n "Negative pin of the input port" annotation ( + extent=[-110, 40; -90, 60]); + Interfaces.PositivePin out "Output pin" annotation (extent=[90, -10; 110, + 10]); + equation + in_p.v = in_n.v; + in_p.i = 0; + in_n.i = 0; + end IdealOpAmp3Pin; + + model IdealOpAmpLimited "Ideal operational amplifier with limitation" + annotation ( + Documentation(info=" ++The ideal OpAmp with limitation behaves like an ideal OpAmp without limitation, +if the output voltage is within the limits (VMin < out.v < VMax). In this case +the input voltage vin=in_p.v - in_n.v is zero. +If the input voltage is vin < 0, the output voltage is out.v = VMin. +If the input voltage is vin > 0, the output voltage is out.v = VMax. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Icon( + Text(extent=[-110, 80; 100, 90], string="%name"), + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), + Line(points=[-45, -10; -10, -10; -10, 10; 20, 10]), + Line(points=[0, 35; 0, 80]), + Line(points=[0, -35; 0, -80]), + Line(points=[-90, 50; -60, 50]), + Line(points=[-90, -50; -60, -50]), + Line(points=[60, 0; 90, 0]), + Line(points=[-48, 32; -28, 32]), + Line(points=[-39, -20; -39, -41]), + Line(points=[-50, -31; -28, -31])), + Diagram( + Polygon(points=[60, 0; -60, 70; -60, -70; 60, 0], style(fillColor=7)), + Line(points=[-45, -10; -10, -10; -10, 10; 20, 10]), + Line(points=[0, 35; 0, 80]), + Line(points=[0, -35; 0, -80]), + Line(points=[-90, 50; -60, 50]), + Line(points=[-90, -50; -60, -50]), + Line(points=[60, 0; 90, 0]), + Line(points=[-55, 50; -45, 50]), + Line(points=[-50, -45; -50, -55]), + Line(points=[-55, -50; -45, -50]), + Text( + extent=[-111, -39; -90, -19], + string="p1.i=0", + style(color=9, fillColor=9)), + Polygon(points=[120, 3; 110, 0; 120, -3; 120, 3], style( + color=9, + gradient=2, + fillColor=9, + fillPattern=1)), + Line(points=[111, 0; 136, 0], style( + color=9, + gradient=2, + fillColor=9)), + Text( + extent=[118, 2; 135, 17], + string="i2", + style( + color=9, + gradient=2, + fillColor=9)), + Text( + extent=[-111, 60; -90, 80], + string="n1.i=0", + style(color=9, fillColor=9))), + Window( + x=0.28, + y=0.19, + width=0.71, + height=0.59)); + Interfaces.PositivePin in_p "Positive pin of the input port" annotation ( + extent=[-110, -60; -90, -40]); + Interfaces.NegativePin in_n "Negative pin of the input port" annotation ( + extent=[-110, 40; -90, 60]); + Interfaces.PositivePin out "Output pin" annotation (extent=[90, -10; 110, + 10]); + Interfaces.PositivePin VMax "Positive output voltage limitation" + annotation (extent=[-10, 60; 10, 80]); + Interfaces.NegativePin VMin "Negative output voltage limitation" + annotation (extent=[-10, -80; 10, -60]); + SI.Voltage vin "input voltage"; + protected + Real s "Auxiliary variable"; + equation + in_p.i = 0; + in_n.i = 0; + VMax.i = 0; + VMin.i = 0; + vin = in_p.v - in_n.v; + in_p.v - in_n.v = if (s < -1) then s + 1 else if (s > 1) then s - 1 else 0; + out.v = if (s < -1) then VMin.v else if (s > 1) then VMax.v else (VMax.v - + VMin.v)*s/2 + (VMax.v + VMin.v)/2; + end IdealOpAmpLimited; + model IdealDiode "Ideal electrical diode" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - parameter SIunits.Resistance Roff(final min=0) = 1.E-5 - "Closed diode resistance"; - parameter SIunits.Conductance Gon(final min=0) = 1.E-5 + extends Interfaces.OnePort; + parameter SI.Resistance Roff(final min=0) = 1.E-5 "Closed diode resistance" + ; + parameter SI.Conductance Gon(final min=0) = 1.E-5 "Opened diode conductance"; Boolean off(start=true) "Switching state of diode"; protected Real s "Auxiliary variable"; annotation ( - Documentation(info=" - + Documentation(info="Ideal electrical diode. This is an ideal switch which is open, when it is reversed biased (voltage drop < 0) and which is closed, when it is conducting (current > 0). In order to prevent singularities during switching, the opened -diode has a high resistance and the closed diode has a low -resistance. +diode has a high resistance and the closed diode has a low +resistance.
-If the actual circuit has an appropriate structure, the +If the actual circuit has an appropriate structure, the limiting case is also allowed, i.e., the resistance of the closed diode could be exactly zero and the conductance of the open diode could be also exactly zero (i.e. the resistance is infinity). Note, there are circuits, where a description -with zero/infinity resistances is not possible. +with zero/infinity resistances is not possible.
"), @@ -519,16 +963,16 @@ with zero/infinity resistances is not possible. v = s*(if off then 1 else Roff); i = s*(if off then Gon else 1); end IdealDiode; + model IdealTransformer "Ideal electrical transformer" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; + extends Interfaces.TwoPort; parameter Real n=1 "Turns ratio"; annotation ( Coordsys( extent=[-100, -100; 100, 100], grid=[2, 2], component=[20, 20]), - Documentation(info=" - + Documentation(info="The ideal transformer is an ideal two-port resistive circuit element which is characterized by the following two equations: @@ -584,12 +1028,12 @@ where n is a real number called the turns ratio. v1 = n*v2; i2 = -n*i1; end IdealTransformer; + model IdealGyrator "Ideal gyrator" - extends Modelica.Electrical.Analog.Interfaces.TwoPort; + extends Interfaces.TwoPort; annotation ( - Documentation(info=" - -
+ Documentation(info=" +
A gyrator is an ideal two-port element defined by the following equations:
@@ -637,16 +1081,16 @@ where the constant G is called the gyration conductance. Ellipse(extent=[10, -30; 70, 30]), Rectangle(extent=[80, -40; 40, 40], style(color=7, fillColor=7)), Line(points=[90, 50; 40, 50; 40, -50; 90, -50]))); - parameter SIunits.Conductance G=1 "Gyration conductance"; + parameter SI.Conductance G=1 "Gyration conductance"; equation i1 = G*v2; i2 = -G*v1; end IdealGyrator; + model Idle "Idle branch" - extends Modelica.Electrical.Analog.Interfaces.OnePort; + extends Interfaces.OnePort; annotation ( - Documentation(info=" - + Documentation(info="The model Idle is a simple idle running branch.
@@ -657,7 +1101,7 @@ The model Idle is a simple idle running branch. grid=[1, 1], component=[20, 20]), Icon( - Rectangle(extent=[-60, 60; 60, -60]), + Rectangle(extent=[-60, 60; 60, -60], style(fillColor=7)), Line(points=[-90, 0; -41, 0]), Line(points=[91, 0; 40, 0]), Text(extent=[-100, 100; 100, 70], string="%name")), @@ -675,11 +1119,11 @@ The model Idle is a simple idle running branch. i = 0; end Idle; + model Short "Short cut branch" - extends Modelica.Electrical.Analog.Interfaces.OnePort; + extends Interfaces.OnePort; annotation ( - Documentation(info=" - + Documentation(info="The model Short is a simple short cut branch.
@@ -690,7 +1134,7 @@ The model Short is a simple short cut branch. grid=[1, 1], component=[20, 20]), Icon( - Rectangle(extent=[-60, 60; 60, -60]), + Rectangle(extent=[-60, 60; 60, -60], style(fillColor=7)), Line(points=[91, 0; -90, 0]), Text(extent=[-100, 100; 100, 70], string="%name")), Diagram( @@ -705,4 +1149,267 @@ The model Short is a simple short cut branch. equation v = 0; end Short; + + model IdealOpener "Ideal electrical opener" + extends Interfaces.OnePort; + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + annotation (extent=[-56.6667, 10; -10, 56.6667]); + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance" annotation (extent=[10, 10; 56.6667, 56.6667] + ); + Modelica.Blocks.Interfaces.BooleanInPort control(final n=1) + "true => switch open, false => p--n connected" annotation (extent=[-10, + 50; 10, 70], rotation=-90); + protected + Real s "Auxiliary variable"; + Boolean off; + + annotation ( + Documentation(info=" ++The ideal opener has a positive pin p and a negative pin n. +The switching behaviour is controlled by the control signal. +If the control signal is true, pin p is not connected +with negative pin n. Otherwise, pin p is connected +with negative pin n. +
++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Window( + x=0.45, + y=0.01, + width=0.44, + height=0.65), + Icon( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -70; 100, -100], string="%name"), + Line(points=[0, 51; 0, 26]), + Line(points=[40, 20; 40, 0])), + Diagram( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -40; 100, -79], string="%name"), + Line(points=[0, 51; 0, 26]), + Line(points=[40, 20; 40, 0]))); + equation + off = control.signal[1]; + v = s*(if off then 1 else Ron); + i = s*(if off then Goff else 1); + end IdealOpener; + + model IdealCloser "Ideal electrical closer" + extends Interfaces.OnePort; + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + annotation (extent=[-56.6667, 10; -10, 56.6667]); + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance" annotation (extent=[10, 10; 56.6667, 56.6667] + ); + Modelica.Blocks.Interfaces.BooleanInPort control(final n=1) + "true => switch open, false => p--n connected" annotation (extent=[-10, + 50; 10, 70], rotation=-90); + protected + Real s "Auxiliary variable"; + Boolean on; + + annotation ( + Documentation(info=" ++The ideal opener has a positive pin p and a negative pin n. +The switching behaviour is controlled by the control signal. +If the control signal is true, pin p is not connected +with negative pin n. Otherwise, pin p is connected +with negative pin n. +
++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Window( + x=0.24, + y=0.01, + width=0.65, + height=0.77), + Icon( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -70; 100, -100], string="%name"), + Line(points=[0, 51; 0, 26])), + Diagram( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Text(extent=[-100, -40; 100, -79], string="%name"), + Line(points=[0, 51; 0, 26]))); + equation + on = control.signal[1]; + v = s*(if not on then 1 else Ron); + i = s*(if not on then Goff else 1); + end IdealCloser; + + model ControlledIdealOpener "Controlled ideal electrical opener" + parameter SI.Voltage level=0.5 "Switch level" annotation (extent=[-56.6667 + , 10; -10, 56.6667]); + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + annotation (extent=[10, 10; 56.6667, 56.6667]); + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance" annotation (extent=[-56.6667, -56.6667; -10, + -10]); + protected + Real s "Auxiliary variable"; + annotation ( + Documentation(info=" + ++The ideal switch has a positive pin p and a negative pin n. +The switching behaviour is controlled by the control pin. +If its voltage exceeds the voltage of the parameter level, +pin p is not connected with negative pin n. +Otherwise, pin p is connected with negative pin n. +
++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Window( + x=0.45, + y=0.01, + width=0.44, + height=0.65), + Icon( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Line(points=[0, 90; 0, 25]), + Text(extent=[-100, -70; 100, -100], string="%name"), + Line(points=[40, 20; 40, 0])), + Diagram( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Line(points=[0, 90; 0, 25]), + Line(points=[40, 20; 40, 0]))); + public + Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); + Interfaces.NegativePin n annotation (extent=[90, -10; 110, 10]); + Interfaces.Pin control + "Control pin: control.v > level switch open, otherwise p--n connected" + annotation (extent=[-10, 90; 10, 110], rotation=90); + equation + control.i = 0; + 0 = p.i + n.i; + p.v - n.v = s*(if (control.v > level) then 1 else Ron); + p.i = s*(if (control.v > level) then Goff else 1); + end ControlledIdealOpener; + + model ControlledIdealCloser "Controlled ideal electrical closer" + parameter SI.Voltage level=0.5 "Switch level" annotation (extent=[-56.6667 + , 10; -10, 56.6667]); + parameter SI.Resistance Ron(final min=0) = 1.E-5 "Closed switch resistance" + annotation (extent=[10, 10; 56.6667, 56.6667]); + parameter SI.Conductance Goff(final min=0) = 1.E-5 + "Opened switch conductance" annotation (extent=[-56.6667, -56.6667; -10, + -10]); + protected + Real s "Auxiliary variable"; + annotation ( + Documentation(info=" + ++The ideal switch has a positive pin p and a negative pin n. +The switching behaviour is controlled by the control pin. +If its voltage exceeds the voltage of the parameter level, +pin p is not connected with negative pin n. +Otherwise, pin p is connected with negative pin n. +
++In order to prevent singularities during switching, the opened +switch has a (very low) conductance Goff +and the closed switch has a (very low) resistance Ron. +The limiting case is also allowed, i.e., the resistance Ron of the +closed switch could be exactly zero and the conductance Goff of the +open switch could be also exactly zero. Note, there are circuits, +where a description with zero Ron or zero Goff is not possible. +
+ +"), + Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), + Window( + x=0.45, + y=0.01, + width=0.44, + height=0.65), + Icon( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Line(points=[0, 90; 0, 25]), + Text(extent=[-100, -70; 100, -100], string="%name")), + Diagram( + Ellipse(extent=[-44, 4; -36, -4]), + Line(points=[-90, 0; -44, 0]), + Line(points=[-37, 2; 40, 50]), + Line(points=[40, 0; 90, 0]), + Line(points=[0, 90; 0, 25]))); + public + Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); + Interfaces.NegativePin n annotation (extent=[90, -10; 110, 10]); + Interfaces.Pin control + "Control pin: control.v > level switch open, otherwise p--n connected" + annotation (extent=[-10, 90; 10, 110], rotation=90); + equation + control.i = 0; + 0 = p.i + n.i; + p.v - n.v = s*(if (control.v > level) then Ron else 1); + p.i = s*(if (control.v > level) then 1 else Goff); + end ControlledIdealCloser; + end Ideal; diff --git a/Electrical/Analog/Interfaces.mo b/Electrical/Analog/Interfaces.mo index d311cfda73..41bdda4087 100644 --- a/Electrical/Analog/Interfaces.mo +++ b/Electrical/Analog/Interfaces.mo @@ -1,21 +1,13 @@ -package Interfaces - extends Modelica.Icons.Library; - package SIunits = Modelica.SIunits; +package Interfaces - annotation ( - Coordsys( - extent=[0, 0; 210, 333], - grid=[1, 1], - component=[20, 20]), - Window( + extends Modelica.Icons.Library; + annotation (Window( x=0.03, y=0.04, width=0.21, height=0.49, library=1, - autolayout=1), - Documentation(info=" - + autolayout=1),Documentation(info="This package contains connectors and interfaces (partial models) for analog electrical components. @@ -25,9 +17,9 @@ analog electrical components.
")); - connector Pin "Pin of an electrical component" - SIunits.Voltage v "Potential at the pin"; - flow SIunits.Current i "Current flowing into the pin"; + + connector Pin "Pin of an electrical component" + SI.Voltage v "Potential at the pin"; + flow SI.Current i "Current flowing into the pin"; annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), - Documentation(info=" -"), - Icon(Rectangle(extent=[-100, 100; 100, -100], style(color=3, fillColor=3 - ))), - Diagram(Rectangle(extent=[-100, 100; 100, -100], style(color=3, - fillColor=3)), Text( - extent=[-100, -120; 100, -220], - string="%name", - style(color=3))), - Terminal(Rectangle(extent=[-100, 100; 100, -100], style(color=3, - fillColor=3))), - Window( - x=0.21, - y=0.11, - width=0.6, - height=0.63)); + Icon(Rectangle(extent=[-100, 100; 100, -100], style(color=3, fillColor=3) + )), + Diagram(Rectangle(extent=[-100, 100; 100, -100], style(color=3, fillColor + =3)), Text( + extent=[-100, -120; 100, -220], + string="%name", + style(color=3))), + Terminal(Rectangle(extent=[-100, 100; 100, -100], style(color=3, + fillColor=3)))); end Pin; - connector PositivePin "Positive pin of an electric component" - SIunits.Voltage v "Potential at the pin"; - flow SIunits.Current i "Current flowing into the pin"; + + connector PositivePin "Positive pin of an electric component" + SI.Voltage v "Potential at the pin"; + flow SI.Current i "Current flowing into the pin"; annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), - Documentation(info="Connectors PositivePin and NegativePin are nearly identical. + Documentation(info="
Connectors PositivePin +and NegativePin are nearly identical. The only difference is that the icons are different in order to identify more easily the pins of a component. Usually, connector PositivePin is used for the positive and connector NegativePin for the negative pin of an electrical -component. - -"), - Icon(Rectangle(extent=[-100, 100; 100, -100], style(color=3, fillColor=3 - ))), - Diagram(Rectangle(extent=[-100, 100; 100, -100], style(color=3, - fillColor=3)), Text( - extent=[-100, -120; 100, -220], - string="%name", - style(color=3))), - Terminal(Rectangle(extent=[-100, 100; 100, -100], style(color=3, - fillColor=3))), - Window( - x=0.21, - y=0.08, - width=0.6, - height=0.6)); +component.
"), + Icon(Rectangle(extent=[-100, 100; 100, -100], style(color=3, fillColor=3) + )), + Diagram(Rectangle(extent=[-100, 100; 100, -100], style(color=3, fillColor + =3)), Text( + extent=[-100, -120; 100, -220], + string="%name", + style(color=3))), + Terminal(Rectangle(extent=[-100, 100; 100, -100], style(color=3, + fillColor=3)))); end PositivePin; - connector NegativePin "Negative pin of an electric component" - SIunits.Voltage v "Potential at the pin"; - flow SIunits.Current i "Current flowing into the pin"; + + connector NegativePin "Negative pin of an electric component" + SI.Voltage v "Potential at the pin"; + flow SI.Current i "Current flowing into the pin"; annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), - Documentation(info="Connectors PositivePin and NegativePin are nearly identical. + Documentation(info="Connectors PositivePin +and NegativePin are nearly identical. The only difference is that the icons are different in order to identify more easily the pins of a component. Usually, connector PositivePin is used for the positive and connector NegativePin for the negative pin of an electrical -component. - - -"), +component.
"), Icon(Rectangle(extent=[-100, 100; 100, -100], style( - color=3, - gradient=0, - fillColor=7, - fillPattern=1))), + color=3, + gradient=0, + fillColor=7, + fillPattern=1))), Diagram(Rectangle(extent=[-100, 100; 100, -100], style( - color=3, - fillColor=7, + color=3, + fillColor=7, fillPattern=1)), Text(extent=[-100, -120; 100, -220], string= - "%name")), - Terminal(Rectangle(extent=[-100, 100; 100, -100], style(color=3))), - Window( - x=0.33, - y=0.01, - width=0.56, - height=0.67)); + "%name")), + Terminal(Rectangle(extent=[-100, 100; 100, -100], style(color=3)))); end NegativePin; - partial model TwoPin "Component with one electrical port" - SIunits.Voltage v - "Voltage drop between the two pins (= p.v - n.v)"; - Modelica.Electrical.Analog.Interfaces.PositivePin p "Positive pin" - annotation (extent=[-110, -10; -90, 10]); - Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative pin" - annotation (extent=[90, -10; 110, 10]); + partial model TwoPin "Component with one electrical port" + SI.Voltage v "Voltage drop between the two pins (= p.v - n.v)"; + PositivePin p "Positive pin" annotation (extent=[-110, -10; -90, 10]); + NegativePin n "Negative pin" annotation (extent=[90, -10; 110, 10]); annotation ( Diagram( Polygon(points=[-120, 3; -110, 0; -120, -3; -120, 3], style( - color=9, - fillColor=9, - fillPattern=1)), - Line(points=[-136, 0; -111, 0], style(color=9, fillColor=9)), + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[-136, 0; -111, 0], style(color=9, fillColor=9)), Text( - extent=[-134, 5; -117, 20], - string="p.i", - style(color=9, fillColor=9)), - Line(points=[110, 0; 135, 0], style(color=9, fillColor=9)), + extent=[-134, 5; -117, 20], + string="p.i", + style(color=9, fillColor=9)), + Line(points=[110, 0; 135, 0], style(color=9, fillColor=9)), Polygon(points=[120, 3; 110, 0; 120, -3; 120, 3], style( - color=9, - fillColor=9, - fillPattern=1)), + color=9, + fillColor=9, + fillPattern=1)), Text( - extent=[117, 3; 134, 18], - string="n.i", - style(color=9, fillColor=9))), + extent=[117, 3; 134, 18], + string="n.i", + style(color=9, fillColor=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.11, - y=0.14, - width=0.55, + x=0.11, + y=0.14, + width=0.55, height=0.64)); - equation + equation v = p.v - n.v; end TwoPin; - partial model OnePort - "Component with two electrical pins p and n and current i from p to n" - SIunits.Voltage v - "Voltage drop between the two pins (= p.v - n.v)"; - SIunits.Current i "Current flowing from pin p to pin n"; + + partial model OnePort + "Component with two electrical pins p and n and current i from p to n" + SI.Voltage v "Voltage drop between the two pins (= p.v - n.v)"; + SI.Current i "Current flowing from pin p to pin n"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[2, 2], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[2, 2], + component=[20, 20]), Documentation(info="Superclass of elements which have two electrical pins: @@ -201,115 +161,111 @@ into pin p is identical to the current flowing out of pin n. This current is provided explicitly as current i.
-"), +"), Diagram( - Line(points=[-110, 20; -85, 20], style(color=9, fillColor=9)), + Line(points=[-110, 20; -85, 20], style(color=9, fillColor=9)), Polygon(points=[-95, 23; -85, 20; -95, 17; -95, 23], style( - color=9, - fillColor=9, - fillPattern=1)), - Line(points=[90, 20; 115, 20], style(color=9, fillColor=9)), - Line(points=[-125, 0; -115, 0], style(color=9)), - Line(points=[-120, -5; -120, 5], style(color=9)), + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[90, 20; 115, 20], style(color=9, fillColor=9)), + Line(points=[-125, 0; -115, 0], style(color=9)), + Line(points=[-120, -5; -120, 5], style(color=9)), Text( - extent=[-110, 25; -90, 45], - string="i", - style(color=9)), + extent=[-110, 25; -90, 45], + string="i", + style(color=9)), Polygon(points=[105, 23; 115, 20; 105, 17; 105, 23], style( - color=9, - fillColor=9, - fillPattern=1)), - Line(points=[115, 0; 125, 0], style(color=9)), + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[115, 0; 125, 0], style(color=9)), Text( - extent=[90, 45; 110, 25], - string="i", - style(color=9))), + extent=[90, 45; 110, 25], + string="i", + style(color=9))), Window( - x=0.33, - y=0.04, - width=0.63, + x=0.33, + y=0.04, + width=0.63, height=0.67)); - Modelica.Electrical.Analog.Interfaces.PositivePin p annotation (extent=[ - -110, -10; -90, 10]); - Modelica.Electrical.Analog.Interfaces.NegativePin n annotation (extent=[ - 110, -10; 90, 10]); - equation + PositivePin p annotation (extent=[-110, -10; -90, 10]); + NegativePin n annotation (extent=[110, -10; 90, 10]); + equation v = p.v - n.v; 0 = p.i + n.i; i = p.i; end OnePort; - partial model TwoPort - "Component with two electrical ports, including current" - SIunits.Voltage v1 "Voltage drop over the left port"; - SIunits.Voltage v2 "Voltage drop over the right port"; - SIunits.Current i1 - "Current flowing from pos. to neg. pin of the left port"; - SIunits.Current i2 - "Current flowing from pos. to neg. pin of the right port"; - Modelica.Electrical.Analog.Interfaces.PositivePin p1 - "Positive pin of the left port" annotation (extent=[-110, 40; -90, 60]); - Modelica.Electrical.Analog.Interfaces.NegativePin n1 - "Negative pin of the left port" annotation (extent=[-110, -60; -90, -40]) - ; - Modelica.Electrical.Analog.Interfaces.PositivePin p2 - "Positive pin of the right port" annotation (extent=[90, 40; 110, 60]); - Modelica.Electrical.Analog.Interfaces.NegativePin n2 - "Negative pin of the right port" annotation (extent=[90, -60; 110, -40]); + + partial model TwoPort + "Component with two electrical ports, including current" + SI.Voltage v1 "Voltage drop over the left port"; + SI.Voltage v2 "Voltage drop over the right port"; + SI.Current i1 "Current flowing from pos. to neg. pin of the left port"; + SI.Current i2 "Current flowing from pos. to neg. pin of the right port"; + PositivePin p1 "Positive pin of the left port" annotation (extent=[-110, 40 + ; -90, 60]); + NegativePin n1 "Negative pin of the left port" annotation (extent=[-110, - + 60; -90, -40]); + PositivePin p2 "Positive pin of the right port" annotation (extent=[90, 40 + ; 110, 60]); + NegativePin n2 "Negative pin of the right port" annotation (extent=[90, -60 + ; 110, -40]); annotation ( Diagram( Polygon(points=[-120, 53; -110, 50; -120, 47; -120, 53], style( - color=9, - fillColor=9, - fillPattern=1)), - Line(points=[-136, 50; -111, 50], style(color=9, fillColor=9)), + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[-136, 50; -111, 50], style(color=9, fillColor=9)), Polygon(points=[127, -47; 137, -50; 127, -53; 127, -47], style( - color=9, - fillColor=9, - fillPattern=1)), - Line(points=[111, -50; 136, -50], style(color=9, fillColor=9)), + color=9, + fillColor=9, + fillPattern=1)), + Line(points=[111, -50; 136, -50], style(color=9, fillColor=9)), Text( - extent=[112, -44; 128, -29], - string="i2", - style(color=9, fillColor=9)), + extent=[112, -44; 128, -29], + string="i2", + style(color=9, fillColor=9)), Text( - extent=[118, 52; 135, 67], - string="i2", + extent=[118, 52; 135, 67], + string="i2", style( - color=9, - gradient=2, - fillColor=9)), + color=9, + gradient=2, + fillColor=9)), Polygon(points=[120, 53; 110, 50; 120, 47; 120, 53], style( - color=9, - gradient=2, - fillColor=9, - fillPattern=1)), + color=9, + gradient=2, + fillColor=9, + fillPattern=1)), Line(points=[111, 50; 136, 50], style( - color=9, - gradient=2, - fillColor=9)), - Line(points=[-136, -49; -111, -49], style(color=9, fillColor=9)), + color=9, + gradient=2, + fillColor=9)), + Line(points=[-136, -49; -111, -49], style(color=9, fillColor=9)), Polygon(points=[-126, -46; -136, -49; -126, -52; -126, -46], style( - color=9, - fillColor=9, - fillPattern=1)), + color=9, + fillColor=9, + fillPattern=1)), Text( - extent=[-127, -46; -110, -31], - string="i1", - style(color=9, fillColor=9)), + extent=[-127, -46; -110, -31], + string="i1", + style(color=9, fillColor=9)), Text( - extent=[-136, 53; -119, 68], - string="i1", - style(color=9, fillColor=9))), + extent=[-136, 53; -119, 68], + string="i1", + style(color=9, fillColor=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.16, - y=0.12, - width=0.6, + x=0.16, + y=0.12, + width=0.6, height=0.6)); - equation + equation v1 = p1.v - n1.v; v2 = p2.v - n2.v; 0 = p1.i + n1.i; @@ -318,113 +274,108 @@ This current is provided explicitly as current i. i2 = p2.i; end TwoPort; - partial model AbsoluteSensor - "Base class to measure the absolute value of a pin variable" + partial model AbsoluteSensor + "Base class to measure the absolute value of a pin variable" extends Modelica.Icons.RotationalSensor; - - Modelica.Electrical.Analog.Interfaces.PositivePin p "pin to be measured" - annotation (extent=[-110, -10; -90, 10]); - Modelica.Blocks.Interfaces.OutPort outPort(final n=1) annotation (extent=[ - 100, -10; 120, 10]); + + PositivePin p "pin to be measured" annotation (extent=[-110, -10; -90, 10]) + ; + Modelica.Blocks.Interfaces.OutPort outPort(final n=1) annotation (extent=[100, -10; 120, 10]); annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.31, - y=0.04, - width=0.6, - height=0.6), + x=0.31, + y=0.04, + width=0.6, + height=0.6), Icon( - Line(points=[-70, 0; -90, 0], style(color=0)), - Line(points=[70, 0; 100, 0]), - Text(extent=[-110, 80; 110, 120], string="%name")), - Diagram(Line(points=[-70, 0; -90, 0], style(color=0)), Line(points=[70, - 0; 100, 0]))); + Line(points=[-70, 0; -90, 0], style(color=0)), + Line(points=[70, 0; 100, 0]), + Text(extent=[-110, 80; 110, 120], string="%name")), + Diagram(Line(points=[-70, 0; -90, 0], style(color=0)), Line(points=[70, 0 + ; 100, 0]))); end AbsoluteSensor; - model RelativeSensor - "Base class to measure a relative variable between two pins" + + partial model RelativeSensor + "Base class to measure a relative variable between two pins" extends Modelica.Icons.RotationalSensor; - - Modelica.Electrical.Analog.Interfaces.PositivePin p "positive pin" - annotation (extent=[-110, -10; -90, 10]); - Modelica.Electrical.Analog.Interfaces.NegativePin n "negative pin" - annotation (extent=[90, -10; 110, 10]); - Modelica.Blocks.Interfaces.OutPort outPort(final n=1) annotation (extent=[ - -10, -90; 10, -110], rotation=90); + + PositivePin p "positive pin" annotation (extent=[-110, -10; -90, 10]); + NegativePin n "negative pin" annotation (extent=[90, -10; 110, 10]); + Modelica.Blocks.Interfaces.OutPort outPort(final n=1) annotation (extent=[-10, -90; 10, -110], + rotation=90); + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.21, - y=0.04, - width=0.6, - height=0.6), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Line(points=[-70, 0; -90, 0], style(color=0)), - Line(points=[70, 0; 90, 0], style(color=0)), - Line(points=[0, -90; 0, -70]), - Text(extent=[-110, 80; 110, 120], string="%name")), + Line(points=[-70, 0; -90, 0], style(color=0)), + Line(points=[70, 0; 90, 0], style(color=0)), + Line(points=[0, -90; 0, -70]), + Text(extent=[-110, 80; 110, 120], string="%name")), Diagram( - Line(points=[-70, 0; -90, 0], style(color=0)), - Line(points=[0, -90; 0, -70]), + Line(points=[-70, 0; -90, 0], style(color=0)), + Line(points=[0, -90; 0, -70]), Line(points=[70, 0; 90, 0], style(color=0)))); + end RelativeSensor; - partial model VoltageSource "Interface for voltage sources" + + partial model VoltageSource "Interface for voltage sources" extends OnePort; - parameter SIunits.Voltage offset=0 "Voltage offset"; - parameter SIunits.Time startTime=0 "Time offset"; + parameter SI.Voltage offset=0 "Voltage offset"; + parameter SI.Time startTime=0 "Time offset"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Ellipse(extent=[-50, 50; 50, -50], style(color=3, fillColor=7)), - Line(points=[-90, 0; -50, 0]), - Line(points=[50, 0; 90, 0]), - Text(extent=[-100, -120; 100, -80], string="%name=%V"), - Line(points=[-50, 0; 50, 0])), + Ellipse(extent=[-50, 50; 50, -50], style(color=3, fillColor=7)), + Line(points=[-90, 0; -50, 0]), + Line(points=[50, 0; 90, 0]), + Text(extent=[-100, -120; 100, -80], string="%name=%V"), + Line(points=[-50, 0; 50, 0])), Window( - x=0.31, - y=0.09, - width=0.6, + x=0.31, + y=0.09, + width=0.6, height=0.6)); - replaceable Modelica.Blocks.Interfaces.SignalSource signalSource(final - offset={offset}, final startTime={startTime}) annotation (extent=[70, - 70; 90, 90]); - equation + replaceable Modelica.Blocks.Interfaces.SignalSource signalSource(final offset={offset}, final + startTime={startTime}) annotation (extent=[70, 70; 90, 90]); + equation v = signalSource.outPort.signal[1]; end VoltageSource; - partial model CurrentSource "Interface for current sources" + + partial model CurrentSource "Interface for current sources" extends OnePort; - - parameter SIunits.Current offset=0 "Current offset"; - parameter SIunits.Time startTime=0 "Time offset"; + + parameter SI.Current offset=0 "Current offset"; + parameter SI.Time startTime=0 "Time offset"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Ellipse(extent=[-50, 50; 50, -50], style(color=3, fillColor=7)), - Line(points=[-90, 0; -50, 0]), - Line(points=[50, 0; 90, 0]), - Line(points=[0, -50; 0, 50]), - Text(extent=[-100, -120; 100, -80], string="%name=%I")), + Ellipse(extent=[-50, 50; 50, -50], style(color=3, fillColor=7)), + Line(points=[-90, 0; -50, 0]), + Line(points=[50, 0; 90, 0]), + Line(points=[0, -50; 0, 50]), + Text(extent=[-100, -120; 100, -80], string="%name=%I")), Window( - x=0.33, - y=0.24, - width=0.6, + x=0.33, + y=0.24, + width=0.6, height=0.6)); - replaceable Modelica.Blocks.Interfaces.SignalSource signalSource(final - offset={offset}, final startTime={startTime}) annotation (extent=[69, - 70; 90, 90]); - equation + replaceable Modelica.Blocks.Interfaces.SignalSource signalSource(final offset={offset}, final + startTime={startTime}) annotation (extent=[69, 70; 90, 90]); + equation i = signalSource.outPort.signal[1]; end CurrentSource; end Interfaces; diff --git a/Electrical/Analog/Lines.mo b/Electrical/Analog/Lines.mo index fb9a72f5e5..5a3825dd40 100644 --- a/Electrical/Analog/Lines.mo +++ b/Electrical/Analog/Lines.mo @@ -1,31 +1,29 @@ -package Lines +package Lines + extends Modelica.Icons.Library; - package SIunits = Modelica.SIunits; annotation ( - Coordsys( - extent=[0, 0; 400, 500], - grid=[1, 1], - component=[20, 20]), Window( x=0.03, y=0.04, width=0.50, height=0.24, library=1, - autolayout=1), - Documentation(info=" - + autolayout=1), + Documentation(info="-This package contains lossy and lossless tranmission lines. +This package contains lossy and lossless segmented transmission lines, +and LC distributed line models.
-Lossy Transmission Line +Lossy Transmission Line. The lossy transmission line OLine consists of segments of lumped resistances and inductances in series and conductances and capacitances that are - connected with the reference pin g. The precision + connected with the reference pin p3. The precision of the model depends on the number N of lumped segments.
@@ -99,7 +94,7 @@ Lossy Transmission Line-The lossy RC line ULine consists of segments of +The lossy RC line ULine consists of segments of lumped series resistances and capacitances that are -connected with the reference pin g. The precision +connected with the reference pin p3. The precision of the model depends on the number N of lumped segments.
@@ -187,7 +180,7 @@ lumped segments.-The simple diode is a two pole. It consists of the diode itself and an parallel ohmic -resistance R. The diode formula is simple: +The simple diode is a one port. It consists of the diode itself and an parallel ohmic +resistance R. The diode formula is:
v/vt @@ -94,6 +90,10 @@ continued to avoid overflow. Line(points=[-90, 0; 40, 0]), Line(points=[40, 0; 90, 0]), Line(points=[30, 40; 30, -40], style(color=3)), + Text( + extent=[-98, -58; 102, -100], + string="Vt=%Vt", + style(color=0)), Text(extent=[-100, 100; 100, 70], string="%name")), Diagram( Polygon(points=[30, 0; -30, 40; -30, -40; 30, 0], style( @@ -110,11 +110,12 @@ continued to avoid overflow. width=0.75, height=0.63)); equation - //assert (R <> 0, "R must not be zero"); - i = if (v/Vt > Maxexp) then Ids*(exp(Maxexp)*(1 + v/Vt - Maxexp) - 1) + v/ - R else Ids*(exp(v/Vt) - 1) + v/R; + i = if (v/Vt > Maxexp) then Ids*(exp(Maxexp)*(1 + v/Vt - Maxexp) - 1) + + v/R else Ids*(exp(v/Vt) - 1) + v/R; end Diode; model PMOS "Simple MOS Transistor" +// 6.12.2001 parameter RDS added, Clauss + annotation ( Documentation(info=" @@ -124,8 +125,8 @@ FET. It differs slightly from the device used in the SPICE simulator. For more details please care for H. Spiro.-The model does not consider capacitances. A small fixed drain-source resistance -is included (to avoid numerical difficulties). +The model does not consider capacitances. A high drain-source resistance RDS +is included to avoid numerical difficulties.
- W L Beta Vt K2 K5 DW DL - m m A/V^2 V - - m m + W L Beta Vt K2 K5 DW DL + m m A/V^2 V - - m m - 50.e-6 8.e-6 .0085 -.15 .41 .839 -3.8e-6 -4.0e-6 - 20.e-6 6.e-6 .0105 -1.0 .41 .839 -2.5e-6 -2.1e-6 - 30.e-6 5.e-6 .0059 -.3 .98 1.01 0 -3.9e-6 - 30.e-6 5.e-6 .0152 -.69 .104 1.1 -.8e-6 -.4e-6 - 30.e-6 5.e-6 .0163 -.69 .104 1.1 -.8e-6 -.4e-6 - 30.e-6 5.e-6 .0182 -.69 .086 1.06 -.1e-6 -.6e-6 - 20.e-6 6.e-6 .0074 -1. .4 .59 0 0 + 50.e-6 8.e-6 .0085e-3 -.15 .41 .839 -3.8e-6 -4.0e-6 + 20.e-6 6.e-6 .0105e-3 -1.0 .41 .839 -2.5e-6 -2.1e-6 + 30.e-6 5.e-6 .0059e-3 -.3 .98 1.01 0 -3.9e-6 + 30.e-6 5.e-6 .0152e-3 -.69 .104 1.1 -.8e-6 -.4e-6 + 30.e-6 5.e-6 .0163e-3 -.69 .104 1.1 -.8e-6 -.4e-6 + 30.e-6 5.e-6 .0182e-3 -.69 .086 1.06 -.1e-6 -.6e-6 + 20.e-6 6.e-6 .0074e-3 -1. .4 .59 0 0"), @@ -187,15 +188,16 @@ Some typical parameter sets are: Interfaces.Pin S "Source" annotation (extent=[90, -40; 110, -60]); Interfaces.Pin B "Bulk" annotation (extent=[90, -10; 110, 10]); - parameter SIunits.Length W=50.0e-6 "Width"; - parameter SIunits.Length L=8.0e-6 "Length"; - parameter SIunits.Transconductance Beta=0.0085 + parameter SIunits.Length W=20.0e-6 "Width"; + parameter SIunits.Length L=6.0e-6 "Length"; + parameter SIunits.Transconductance Beta=0.0105e-3 "Transconductance parameter"; - parameter SIunits.Voltage Vt=-0.15 "Zero bias threshold voltage"; + parameter SIunits.Voltage Vt=-1.0 "Zero bias threshold voltage"; parameter Real K2=0.41 "Bulk threshold parameter"; parameter Real K5=0.839 "Reduction of pinch-off region"; - parameter SIunits.Length dW=-3.8e-6 "Narrowing of channel"; - parameter SIunits.Length dL=-4.0e-6 "Shortening of channel"; + parameter SIunits.Length dW=-2.5e-6 "Narrowing of channel"; + parameter SIunits.Length dL=-2.1e-6 "Shortening of channel"; + parameter SIunits.Resistance RDS=1.e+7 "Drain-Source-Resistance"; protected Real v; Real uds; @@ -204,24 +206,26 @@ Some typical parameter sets are: Real ud; Real us; Real id; + Real gds; equation //assert (L + dL > 0, "Effective length must be positive"); //assert (W + dW > 0, "Effective width must be positive"); + gds = if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS; v = Beta*(W + dW)/(L + dL); ud = if (D.v > S.v) then S.v else D.v; us = if (D.v > S.v) then D.v else S.v; uds = ud - us; ubs = if (B.v < us) then 0 else B.v - us; ugst = (G.v - us - Vt + K2*ubs)*K5; - id = if (ugst >= 0) then v*uds*1.e-7 else if (ugst < uds) then -v*uds*( - ugst - uds/2 - 1.e-7) else -v*(ugst*ugst/2 - uds*1.e-7); + id = if (ugst >= 0) then v*uds*gds else if (ugst < uds) then -v*uds*( + ugst - uds/2 - gds) else -v*(ugst*ugst/2 - uds*gds); G.i = 0; D.i = if (D.v > S.v) then -id else id; S.i = if (D.v > S.v) then id else -id; B.i = 0; end PMOS; model NMOS "Simple MOS Transistor" - +// 6.12.2001 parameter RDS added, Clauss annotation ( Documentation(info=" @@ -231,32 +235,32 @@ FET. It differs slightly from the device used in the SPICE simulator. For more details please care for H. Spiro.
-The model does not consider capacitances. A small fixed drain-source resistance -is included (to avoid numerical difficulties). +The model does not consider capacitances. A high drain-source resistance RDS +is included to avoid numerical difficulties.
- W L Beta Vt K2 K5 DW DL - m m A/V^2 V - - m m + W L Beta Vt K2 K5 DW DL + m m A/V^2 V - - m m - 12.e-6 4.e-6 .062 -4.5 .24 .61 -1.2e-6 -.9e-6 depletion - 60.e-6 3.e-6 .048 .1 .08 .68 -1.2e-6 -.9e-6 enhancement - 12.e-6 4.e-6 .0625 -.8 .21 .78 -1.2e-6 -.9e-6 zero - 50.e-6 8.e-6 .0299 .24 1.144 .7311 -5.4e-6 -4.e-6 - 20.e-6 6.e-6 .041 .8 1.144 .7311 -2.5e-6 -1.5e-6 - 30.e-6 9.e-6 .025 -4. .861 .878 -3.4e-6 -1.74e-6 - 30.e-6 5.e-6 .031 .6 1.5 .72 0 -3.9e-6 - 50.e-6 6.e-6 .0414 -3.8 .34 .8 -1.6e-6 -2.e-6 depletion - 50.e-6 5.e-6 .03 .37 .23 .86 -1.6e-6 -2.e-6 enhancement - 50.e-6 6.e-6 .038 -.9 .23 .707 -1.6e-6 -2.e-6 zero - 20.e-6 4.e-6 .06776 .5409 .065 .71 -.8e-6 -.2e-6 - 20.e-6 4.e-6 .06505 .6209 .065 .71 -.8e-6 -.2e-6 - 20.e-6 4.e-6 .05365 .6909 .03 .8 -.3e-6 -.2e-6 - 20.e-6 4.e-6 .05365 .4909 .03 .8 -.3e-6 -.2e-6 - 12.e-6 4.e-6 .023 -4.5 .29 .6 0 0 depletion - 60.e-6 3.e-6 .022 .1 .11 .65 0 0 enhancement - 12.e-6 4.e-6 .038 -.8 .33 .6 0 0 zero - 20.e-6 6.e-6 .022 .8 1 .66 0 0 + 12.e-6 4.e-6 .062e-3 -4.5 .24 .61 -1.2e-6 -.9e-6 depletion + 60.e-6 3.e-6 .048e-3 .1 .08 .68 -1.2e-6 -.9e-6 enhancement + 12.e-6 4.e-6 .0625e-3 -.8 .21 .78 -1.2e-6 -.9e-6 zero + 50.e-6 8.e-6 .0299e-3 .24 1.144 .7311 -5.4e-6 -4.e-6 + 20.e-6 6.e-6 .041e-3 .8 1.144 .7311 -2.5e-6 -1.5e-6 + 30.e-6 9.e-6 .025e-3 -4. .861 .878 -3.4e-6 -1.74e-6 + 30.e-6 5.e-6 .031e-3 .6 1.5 .72 0 -3.9e-6 + 50.e-6 6.e-6 .0414e-3 -3.8 .34 .8 -1.6e-6 -2.e-6 depletion + 50.e-6 5.e-6 .03e-3 .37 .23 .86 -1.6e-6 -2.e-6 enhancement + 50.e-6 6.e-6 .038e-3 -.9 .23 .707 -1.6e-6 -2.e-6 zero + 20.e-6 4.e-6 .06776e-3 .5409 .065 .71 -.8e-6 -.2e-6 + 20.e-6 4.e-6 .06505e-3 .6209 .065 .71 -.8e-6 -.2e-6 + 20.e-6 4.e-6 .05365e-3 .6909 .03 .8 -.3e-6 -.2e-6 + 20.e-6 4.e-6 .05365e-3 .4909 .03 .8 -.3e-6 -.2e-6 + 12.e-6 4.e-6 .023e-3 -4.5 .29 .6 0 0 depletion + 60.e-6 3.e-6 .022e-3 .1 .11 .65 0 0 enhancement + 12.e-6 4.e-6 .038e-3 -.8 .33 .6 0 0 zero + 20.e-6 6.e-6 .022e-3 .8 1 .66 0 0
-
"), Coordsys( @@ -442,17 +445,17 @@ stability problems within the solver. vbc = B.v - C.v; vbe = B.v - E.v; qbk = 1 - vbc*Vak; - - ibc = if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc* - Gbc else if (vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc - *Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc; - ibe = if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe* - Gbe else if (vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe - *Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe; - Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - - vbc/Phic, -Mc); - Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - - vbe/Phie, -Me); + + ibc = if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc + else if (vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc* + Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc; + ibe = if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe + else if (vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe* + Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe; + Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - vbc + /Phic, -Mc); + Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - vbe + /Phie, -Me); cbc = if (vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + Capcjc else if (vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1) + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc; @@ -467,23 +470,19 @@ stability problems within the solver. model PNP "Simple BJT according to Ebers-Moll" parameter Real Bf=50 "Forward beta"; parameter Real Br=0.1 "Reverse beta"; - parameter SIunits.Current Is=1.e-16 - "Transport saturation current"; - parameter SIunits.InversePotential Vak=0.02 + parameter SIunits.Current Is=1.e-16 "Transport saturation current"; + parameter SIunits.InversePotential Vak=0.02 "Early voltage (inverse), 1/Volt"; parameter SIunits.Time Tauf=0.12e-9 "Ideal forward transit time"; parameter SIunits.Time Taur=5e-9 "Ideal reverse transit time"; - parameter SIunits.Capacitance Ccs=1e-12 - "Collector-substrat(ground) cap."; - parameter SIunits.Capacitance Cje=0.4e-12 + parameter SIunits.Capacitance Ccs=1e-12 "Collector-substrat(ground) cap."; + parameter SIunits.Capacitance Cje=0.4e-12 "Base-emitter zero bias depletion cap."; parameter SIunits.Capacitance Cjc=0.5e-12 "Base-coll. zero bias depletion cap."; - parameter SIunits.Voltage Phie=0.8 - "Base-emitter diffusion voltage"; + parameter SIunits.Voltage Phie=0.8 "Base-emitter diffusion voltage"; parameter Real Me=0.4 "Base-emitter gradation exponent"; - parameter SIunits.Voltage Phic=0.8 - "Base-collector diffusion voltage"; + parameter SIunits.Voltage Phic=0.8 "Base-collector diffusion voltage"; parameter Real Mc=0.333 "Base-collector gradation exponent"; parameter SIunits.Conductance Gbc=1e-15 "Base-collector conductance"; parameter SIunits.Conductance Gbe=1e-15 "Base-emitter conductance"; @@ -502,6 +501,13 @@ stability problems within the solver. Real ExMax; Real Capcje; Real Capcjc; + function pow "Just a helper function for x^y" + input Real x; + input Real y; + output Real z; + algorithm + z:=x^y; + end pow; annotation ( Documentation(info=" @@ -525,12 +531,6 @@ Van Nostrand Reinhold, New York 1983 on page 317 ff.
-
"), Coordsys( @@ -569,27 +569,28 @@ stability problems within the solver. vbc = C.v - B.v; vbe = E.v - B.v; qbk = 1 - vbc*Vak; - - ibc = if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc* - Gbc else if (vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc - *Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc; - ibe = if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe* - Gbe else if (vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe - *Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe; + ibc = if (vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc + else if (vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc* + Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc; + + ibe = if (vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe + else if (vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe* + Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe; - Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - - vbc/Phic, -Mc); - Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - - vbe/Phie, -Me); + Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - vbc + /Phic, -Mc); + Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - vbe + /Phie, -Me); cbc = if (vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + Capcjc else if (vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1) + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc; cbe = if (vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) + Capcje else if (vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1) + Capcje else Tauf*Is/Vt*exp(vbe/Vt) + Capcje; - C.i = -((ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) + Ccs*der(C.v)); + C.i = -((ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) - Ccs*der(C.v)); B.i = -(ibe/Bf + ibc/Br + cbe*der(vbe) + cbc*der(vbc)); - E.i = -B.i - C.i - Ccs*der(C.v); + E.i = -B.i - C.i + Ccs*der(C.v); end PNP; end Semiconductors; + diff --git a/Electrical/Analog/Sensors.mo b/Electrical/Analog/Sensors.mo index 8b3199b9ac..16bbcbff3d 100644 --- a/Electrical/Analog/Sensors.mo +++ b/Electrical/Analog/Sensors.mo @@ -1,12 +1,8 @@ -package Sensors +package Sensors + extends Modelica.Icons.Library; - package SIunits = Modelica.SIunits ; - + annotation ( - Coordsys( - extent=[0, 0; 400, 500], - grid=[1, 1], - component=[20, 20]), Window( x=0.03, y=0.04, @@ -14,8 +10,7 @@ package Sensors height=0.24, library=1, autolayout=1), - Documentation(info=" - + Documentation(info="
This package contains potential, voltage, and current sensors.
@@ -24,9 +19,9 @@ This package contains potential, voltage, and current sensors.")); - - model PotentialSensor "Sensor to measure the potential" - extends Modelica.Electrical.Analog.Interfaces.AbsoluteSensor; - SIunits.ElectricPotential phi "Absolute voltage potential"; + + model PotentialSensor "Sensor to measure the potential" + extends Interfaces.AbsoluteSensor; + SI.ElectricPotential phi "Absolute voltage potential"; annotation ( - Diagram, Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon(Text( - extent=[-29, -11; 30, -70], - string="V", - style(color=0))), + extent=[-29, -11; 30, -70], + string="V", + style(color=0))), Window( - x=0.4, - y=0.32, - width=0.6, + x=0.4, + y=0.32, + width=0.6, height=0.6)); - equation + equation p.i = 0; phi = p.v; phi = outPort.signal[1]; end PotentialSensor; - - model VoltageSensor "Sensor to measure the voltage between two pins" - extends Modelica.Electrical.Analog.Interfaces.RelativeSensor; - SIunits.Voltage v "Voltage between pin p and n (= p.v - n.v)"; + + model VoltageSensor "Sensor to measure the voltage between two pins" + extends Interfaces.RelativeSensor; + SI.Voltage v "Voltage between pin p and n (= p.v - n.v)"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.28, - y=0.29, - width=0.6, - height=0.6), + x=0.28, + y=0.29, + width=0.6, + height=0.6), Icon(Text( - extent=[-29, -11; 30, -70], - string="V", + extent=[-29, -11; 30, -70], + string="V", style(color=0)))); - equation + equation p.i = 0; n.i = 0; v = p.v - n.v; v = outPort.signal[1]; end VoltageSensor; - - model CurrentSensor "Sensor to measure the current in a branch" - extends Modelica.Electrical.Analog.Interfaces.RelativeSensor; - SIunits.Current i "current in the branch from p to n"; + + model CurrentSensor "Sensor to measure the current in a branch" + extends Interfaces.RelativeSensor; + SI.Current i "current in the branch from p to n"; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.23, - y=0.07, - width=0.6, - height=0.6), + x=0.23, + y=0.07, + width=0.6, + height=0.6), Icon(Text( - extent=[-29, -11; 30, -70], - string="A", + extent=[-29, -11; 30, -70], + string="A", style(color=0)))); - equation + equation p.v = n.v; p.i = i; n.i = -i; i = outPort.signal[1]; end CurrentSensor; - + end Sensors; diff --git a/Electrical/Analog/Sources.mo b/Electrical/Analog/Sources.mo index e88583045b..3d509a0d79 100644 --- a/Electrical/Analog/Sources.mo +++ b/Electrical/Analog/Sources.mo @@ -1,19 +1,15 @@ -package Sources +package Sources + extends Modelica.Icons.Library; + annotation ( - Coordsys( - extent=[0, 0; 400, 500], - grid=[1, 1], - component=[20, 20]), Window( x=0.03, y=0.04, width=0.50, height=0.60, library=1, - autolayout=1), - Documentation(info=" - + autolayout=1),Documentation(info="
This package contains time-dependend and controlled voltage and current sources.
@@ -22,9 +18,9 @@ This package contains time-dependend and controlled voltage and current sources.")); - - model SignalVoltage - "Generic voltage source using the input signal as source voltage" - extends Modelica.Electrical.Analog.Interfaces.OnePort; - + + model SignalVoltage + "Generic voltage source using the input signal as source voltage" + extends Interfaces.OnePort; + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Ellipse(extent=[-50, 50; 50, -50], style(fillColor=7)), - Line(points=[-90, 0; -50, 0]), - Line(points=[50, 0; 90, 0]), - Line(points=[-50, 0; 50, 0]), - Text(extent=[-100, -120; 100, -80], string="%name")), + Ellipse(extent=[-50, 50; 50, -50], style(fillColor=7)), + Line(points=[-90, 0; -50, 0]), + Line(points=[50, 0; 90, 0]), + Line(points=[-50, 0; 50, 0]), + Text(extent=[-100, -120; 100, -80], string="%name")), Window( - x=0.36, - y=0.03, - width=0.62, + x=0.36, + y=0.03, + width=0.62, height=0.76)); - Modelica.Blocks.Interfaces.InPort inPort(final n=1) annotation (extent=[- - 20, 50; 20, 90], rotation=-90); - equation + Modelica.Blocks.Interfaces.InPort inPort(final n=1) annotation (extent=[-20, 50; 20, 90], rotation + =-90); + equation inPort.signal[1] = v; end SignalVoltage; - - model ConstantVoltage "Source for constant voltage" - parameter Modelica.SIunits.Voltage V=1 "Value of constant voltage"; - extends Modelica.Electrical.Analog.Interfaces.OnePort; + + model ConstantVoltage "Source for constant voltage" + parameter SI.Voltage V=1 "Value of constant voltage"; + extends Interfaces.OnePort; annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.33, - y=0.18, - width=0.6, - height=0.6), + x=0.33, + y=0.18, + width=0.6, + height=0.6), Icon( - Line(points=[-90, 0; -10, 0]), - Line(points=[-10, 60; -10, -60]), - Line(points=[0, 30; 0, -30]), - Line(points=[0, 0; 90, 0]), - Text(extent=[-100, -120; 100, -80], string="%name=%V")), + Line(points=[-90, 0; -10, 0]), + Line(points=[-10, 60; -10, -60]), + Line(points=[0, 30; 0, -30]), + Line(points=[0, 0; 90, 0]), + Text(extent=[-100, -120; 100, -80], string="%name=%V")), Diagram( - Line(points=[-90, 0; -10, 0]), - Line(points=[-10, 60; -10, -60]), - Line(points=[0, 30; 0, -30]), + Line(points=[-90, 0; -10, 0]), + Line(points=[-10, 60; -10, -60]), + Line(points=[0, 30; 0, -30]), Line(points=[0, 0; 90, 0]))); - equation + equation v = V; end ConstantVoltage; - - model StepVoltage "Step voltage source" - parameter Modelica.SIunits.Voltage V=1 "Height of step"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.Step signalSource(height={V})); + + model StepVoltage "Step voltage source" + parameter SI.Voltage V=1 "Height of step"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Step signalSource(height={V} + )); annotation ( - Icon(Line(points=[-70, -70; 0, -70; 0, 70; 69, 70], style(color=8))), + Icon(Line(points=[-70, -70; 0, -70; 0, 70; 69, 70], style(color=8))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-80, -18; 0, -18; 0, 50; 80, 50], style(color=0, - thickness=2)), - Line(points=[-90, -70; 82, -70], style(color=8)), - Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, - fillColor=8)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Text( - extent=[-21, -72; 25, -90], - string="startTime", - style(color=9)), - Line(points=[0, -17; 0, -71], style(color=8, pattern=2)), - Text( - extent=[-68, -36; -22, -54], - string="offset", - style(color=9)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-80, -18; 0, -18; 0, 50; 80, 50], style(color=0, thickness + =2)), + Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style(color=8, + fillColor=8)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Text( + extent=[-21, -72; 25, -90], + string="startTime", + style(color=9)), + Line(points=[0, -17; 0, -71], style(color=8, pattern=2)), + Text( + extent=[-68, -36; -22, -54], + string="offset", + style(color=9)), Line(points=[-13, 50; -13, -17], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[2, 50; -19, 50; 2, 50], style(color=8, pattern=2)), - Polygon(points=[-13, -17; -16, -4; -10, -4; -13, -17; -13, -17], style - ( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[2, 50; -19, 50; 2, 50], style(color=8, pattern=2)), + Polygon(points=[-13, -17; -16, -4; -10, -4; -13, -17; -13, -17], style( + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-13, 50; -16, 37; -9, 37; -13, 50], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-68, 26; -22, 8], - string="V", - style(color=9)), - Polygon(points=[-13, -69; -16, -56; -10, -56; -13, -69; -13, -69], + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-68, 26; -22, 8], + string="V", + style(color=9)), + Polygon(points=[-13, -69; -16, -56; -10, -56; -13, -69; -13, -69], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-13, -18; -13, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[-13, -18; -16, -31; -9, -31; -13, -18], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[-67, 93; -2, 67], - string="v = p.v - n.v", - style(color=9))), + extent=[-67, 93; -2, 67], + string="v = p.v - n.v", + style(color=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.28, - y=0, - width=0.72, + x=0.28, + y=0, + width=0.72, height=0.73)); end StepVoltage; - - model RampVoltage "Ramp voltage source" - parameter Modelica.SIunits.Voltage V=1 "Height of ramp"; - parameter Modelica.SIunits.Time duration(min=Modelica.Constants.SMALL) = 2 - "Duration of ramp"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.Ramp signalSource(final height={V}, final - duration={duration})); + + model RampVoltage "Ramp voltage source" + parameter SI.Voltage V=1 "Height of ramp"; + parameter SI.Time duration(min=Modelica.Constants.small) = 2 "Duration of ramp"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Ramp signalSource(final + height={V}, final duration={duration})); annotation ( Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), Line(points=[-80, -20; -20, -20; 50, 50], style(color=0, thickness=2)) - , - Line(points=[-90, -70; 82, -70], style(color=8)), + , + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-40, -20; -42, -30; -37, -30; -40, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -20; -40, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-80, -33; -41, -49], - string="offset", - style(color=9)), - Text( - extent=[-40, -70; 6, -88], - string="startTime", - style(color=9)), - Text( - extent=[-67, 93; -2, 67], - string="v = p.v - n.v", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-20, -20; -20, -70], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-80, -33; -41, -49], + string="offset", + style(color=9)), + Text( + extent=[-40, -70; 6, -88], + string="startTime", + style(color=9)), + Text( + extent=[-67, 93; -2, 67], + string="v = p.v - n.v", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-20, -20; -20, -70], style(color=8, pattern=2)), Line(points=[-19, -20; 50, -20], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Line(points=[50, 50; 101, 50], style(color=0, thickness=2)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Line(points=[50, 50; 101, 50], style(color=0, thickness=2)), Line(points=[50, 50; 50, -20], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[50, -20; 42, -18; 42, -22; 50, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-20, -20; -11, -18; -11, -22; -20, -20], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[50, 50; 48, 40; 53, 40; 50, 50], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[50, -20; 47, -10; 52, -10; 50, -20; 50, -20], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[53, 25; 82, 7], - string="V", - style(color=9)), - Text( - extent=[0, -17; 35, -37], - string="duration", - style(color=9))), - Icon(Line(points=[-80, -60; -50, -60; 50, 60; 80, 60], style(color=8))) - , + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[53, 25; 82, 7], + string="V", + style(color=9)), + Text( + extent=[0, -17; 35, -37], + string="duration", + style(color=9))), + Icon(Line(points=[-80, -60; -50, -60; 50, 60; 80, 60], style(color=8))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.29, - y=0.11, - width=0.6, + x=0.29, + y=0.11, + width=0.6, height=0.6)); end RampVoltage; - - model SineVoltage "Sine voltage source" - parameter Modelica.SIunits.Voltage V=1 "Amplitude of sine wave"; - parameter Modelica.SIunits.Angle phase=0 "Phase of sine wave"; - parameter Modelica.SIunits.Frequency freqHz=1 "Frequency of sine wave"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.Sine signalSource( - amplitude={V}, - freqHz={freqHz}, - phase={phase}, - offset={offset}, - startTime={startTime})); + + model SineVoltage "Sine voltage source" + parameter SI.Voltage V=1 "Amplitude of sine wave"; + parameter SI.Angle phase=0 "Phase of sine wave"; + parameter SI.Frequency freqHz=1 "Frequency of sine wave"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Sine signalSource( + amplitude={V}, + freqHz={freqHz}, + phase={phase})); annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.37, - y=0.06, - width=0.6, - height=0.6), - Icon(Line(points=[-70, 0; -60.2, 29.9; -53.8, 46.5; -48.2, 58.1; -43.3, - 65.2; -38.3, 69.2; -33.4, 69.8; -28.5, 67; -23.6, 61; -18.6, 52; + x=0.37, + y=0.06, + width=0.6, + height=0.6), + Icon(Line(points=[-70, 0; -60.2, 29.9; -53.8, 46.5; -48.2, 58.1; -43.3, + 65.2; -38.3, 69.2; -33.4, 69.8; -28.5, 67; -23.6, 61; -18.6, 52; -13, 38.6; -5.98, 18.6; 8.79, -26.9; 15.1, -44; 20.8, -56.2; 25.7 , -64; 30.6, -68.6; 35.5, -70; 40.5, -67.9; 45.4, -62.5; 50.3, - - 54.1; 55.9, -41.3; 63, -21.7; 70, 0], style(color=8))), + 54.1; 55.9, -41.3; 63, -21.7; 70, 0], style(color=8))), Diagram( - Line(points=[-80, -90; -80, 84], style(color=8)), - Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, - fillColor=8)), - Line(points=[-99, -40; 85, -40], style(color=8)), - Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, - fillColor=8)), - Line(points=[-40, 0; -31.6, 34.2; -26.1, 53.1; -21.3, 66.4; -17.1, - 74.6; -12.9, 79.1; -8.64, 79.8; -4.42, 76.6; -0.201, 69.7; 4.02, - 59.4; 8.84, 44.1; 14.9, 21.2; 27.5, -30.8; 33, -50.2; 37.8, -64.2 - ; 42, -73.1; 46.2, -78.4; 50.5, -80; 54.7, -77.6; 58.9, -71.5; - 63.1, -61.9; 67.9, -47.2; 74, -24.8; 80, 0], style(color=0, - thickness=2)), - Line(points=[-41, -2; -80, -2], style(color=0, thickness=2)), - Text( - extent=[-106, -11; -60, -29], - string="offset", - style(color=9)), - Line(points=[-41, -2; -41, -40], style(color=8, pattern=2)), - Text( - extent=[-60, -43; -14, -61], - string="startTime", - style(color=9)), - Text( - extent=[84, -52; 108, -72], - string="time", - style(color=9)), - Line(points=[-9, 79; 43, 79], style(color=8, pattern=2)), - Line(points=[-42, -1; 50, 0], style(color=8, pattern=2)), + Line(points=[-80, -90; -80, 84], style(color=8)), + Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, + fillColor=8)), + Line(points=[-99, -40; 85, -40], style(color=8)), + Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, + fillColor=8)), + Line(points=[-40, 0; -31.6, 34.2; -26.1, 53.1; -21.3, 66.4; -17.1, 74.6 + ; -12.9, 79.1; -8.64, 79.8; -4.42, 76.6; -0.201, 69.7; 4.02, 59.4 + ; 8.84, 44.1; 14.9, 21.2; 27.5, -30.8; 33, -50.2; 37.8, -64.2; 42 + , -73.1; 46.2, -78.4; 50.5, -80; 54.7, -77.6; 58.9, -71.5; 63.1, + -61.9; 67.9, -47.2; 74, -24.8; 80, 0], style(color=0, thickness=2 + )), + Line(points=[-41, -2; -80, -2], style(color=0, thickness=2)), + Text( + extent=[-106, -11; -60, -29], + string="offset", + style(color=9)), + Line(points=[-41, -2; -41, -40], style(color=8, pattern=2)), + Text( + extent=[-60, -43; -14, -61], + string="startTime", + style(color=9)), + Text( + extent=[84, -52; 108, -72], + string="time", + style(color=9)), + Line(points=[-9, 79; 43, 79], style(color=8, pattern=2)), + Line(points=[-42, -1; 50, 0], style(color=8, pattern=2)), Polygon(points=[33, 80; 30, 67; 37, 67; 33, 80], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[37, 57; 83, 39], - string="V", - style(color=9)), + extent=[37, 57; 83, 39], + string="V", + style(color=9)), Polygon(points=[33, 1; 30, 14; 36, 14; 33, 1; 33, 1], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[33, 79; 33, 0], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Text( - extent=[-69, 109; -4, 83], - string="v = p.v - n.v", + extent=[-69, 109; -4, 83], + string="v = p.v - n.v", style(color=9)))); end SineVoltage; - - model ExpSineVoltage "Exponentially damped sine voltage source" - parameter Modelica.SIunits.Voltage V=1 "Amplitude of sine wave"; - parameter Modelica.SIunits.Frequency freqHz=2 "Frequency of sine wave"; - parameter Modelica.SIunits.Angle phase=0 "Phase of sine wave"; - parameter Modelica.SIunits.Damping damping=1 - "Damping coefficient of sine wave"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.ExpSine signalSource( - amplitude={V}, - freqHz={freqHz}, - phase={phase}, - damping={damping}, - offset={offset}, - startTime={startTime})); + + model ExpSineVoltage "Exponentially damped sine voltage source" + parameter SI.Voltage V=1 "Amplitude of sine wave"; + parameter SI.Frequency freqHz=2 "Frequency of sine wave"; + parameter SI.Angle phase=0 "Phase of sine wave"; + parameter SI.Damping damping=1 "Damping coefficient of sine wave"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.ExpSine signalSource( + amplitude={V}, + freqHz={freqHz}, + phase={phase}, + damping={damping})); annotation ( - Icon(Line(points=[-80, -14; -75.2, 18.3; -72, 36.3; -68.7, 50.5; -65.5, - 60.2; -62.3, 65.3; -59.1, 65.6; -55.9, 61.3; -52.7, 53.1; -48.6, + Icon(Line(points=[-80, -14; -75.2, 18.3; -72, 36.3; -68.7, 50.5; -65.5, + 60.2; -62.3, 65.3; -59.1, 65.6; -55.9, 61.3; -52.7, 53.1; -48.6, 38.2; -43, 11.8; -35, -27.9; -30.2, -47.7; -26.1, -59.9; -22.1, - - 67.2; -18.1, -69.3; -14.1, -66.5; -10.1, -59.3; -5.23, -46.1; - 8.44, -0.3; 13.3, 12.4; 18.1, 20.8; 22.1, 24; 26.9, 23.2; 31.8, + 67.2; -18.1, -69.3; -14.1, -66.5; -10.1, -59.3; -5.23, -46.1; + 8.44, -0.3; 13.3, 12.4; 18.1, 20.8; 22.1, 24; 26.9, 23.2; 31.8, 17.8; 38.2, 5.4; 51.1, -24.5; 57.5, -35.2; 63.1, -39.9; 68.7, - - 39.9; 75.2, -34.5; 80, -27.8], style(color=8))), + 39.9; 75.2, -34.5; 80, -27.8], style(color=8))), Diagram( - Line(points=[-80, -90; -80, 84], style(color=8)), - Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, - fillColor=8)), - Line(points=[-99, -40; 85, -40], style(color=8)), - Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, - fillColor=8)), - Line(points=[-50, 0; -46.1, 28.2; -43.5, 44; -40.9, 56.4; -38.2, 64.9 - ; -35.6, 69.4; -33, 69.6; -30.4, 65.9; -27.8, 58.7; -24.5, 45.7; - -19.9, 22.5; -13.4, -12.2; -9.5, -29.5; -6.23, -40.1; -2.96, - - 46.5; 0.302, -48.4; 3.57, -45.9; 6.83, -39.6; 10.8, -28.1; 21.9, - 12; 25.8, 23.1; 29.7, 30.5; 33, 33.3; 36.9, 32.5; 40.8, 27.8; 46 - , 16.9; 56.5, -9.2; 61.7, -18.6; 66.3, -22.7; 70.9, -22.6; 76.1, - -18; 80, -12.1], style(color=0, thickness=2)), - Text( - extent=[-78, 1; -55, -19], - string="offset", - style(color=9)), - Text( - extent=[-72, -36; -26, -54], - string="startTime", - style(color=9)), - Text( - extent=[84, -52; 108, -72], - string="time", - style(color=9)), - Line(points=[-50, 0; 18, 0], style(color=8, pattern=2)), - Line(points=[-50, 0; -81, 0], style(color=0, thickness=2)), - Line(points=[-50, 77; -50, 0], style(color=8, pattern=2)), - Line(points=[18, -1; 18, 76], style(color=8, pattern=2)), - Line(points=[18, 73; -50, 73], style(color=8)), - Text( - extent=[-42, 88; 9, 74], - string="1/freqHz", - style(color=9)), + Line(points=[-80, -90; -80, 84], style(color=8)), + Polygon(points=[-80, 100; -86, 84; -74, 84; -80, 100], style(color=8, + fillColor=8)), + Line(points=[-99, -40; 85, -40], style(color=8)), + Polygon(points=[101, -40; 85, -34; 85, -46; 101, -40], style(color=8, + fillColor=8)), + Line(points=[-50, 0; -46.1, 28.2; -43.5, 44; -40.9, 56.4; -38.2, 64.9; + -35.6, 69.4; -33, 69.6; -30.4, 65.9; -27.8, 58.7; -24.5, 45.7; - + 19.9, 22.5; -13.4, -12.2; -9.5, -29.5; -6.23, -40.1; -2.96, -46.5 + ; 0.302, -48.4; 3.57, -45.9; 6.83, -39.6; 10.8, -28.1; 21.9, 12; + 25.8, 23.1; 29.7, 30.5; 33, 33.3; 36.9, 32.5; 40.8, 27.8; 46, + 16.9; 56.5, -9.2; 61.7, -18.6; 66.3, -22.7; 70.9, -22.6; 76.1, - + 18; 80, -12.1], style(color=0, thickness=2)), + Text( + extent=[-78, 1; -55, -19], + string="offset", + style(color=9)), + Text( + extent=[-72, -36; -26, -54], + string="startTime", + style(color=9)), + Text( + extent=[84, -52; 108, -72], + string="time", + style(color=9)), + Line(points=[-50, 0; 18, 0], style(color=8, pattern=2)), + Line(points=[-50, 0; -81, 0], style(color=0, thickness=2)), + Line(points=[-50, 77; -50, 0], style(color=8, pattern=2)), + Line(points=[18, -1; 18, 76], style(color=8, pattern=2)), + Line(points=[18, 73; -50, 73], style(color=8)), + Text( + extent=[-42, 88; 9, 74], + string="1/freqHz", + style(color=9)), Polygon(points=[-49, 73; -40, 75; -40, 71; -49, 73], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[18, 73; 10, 75; 10, 71; 18, 73], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-50, -61; -19, -61], style(color=8)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-50, -61; -19, -61], style(color=8)), Polygon(points=[-18, -61; -26, -59; -26, -63; -18, -61], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-51, -63; -27, -75], - string="t", - style(color=9)), - Text( - extent=[-82, -67; 108, -96], - string="V*exp(-damping*t)*sin(2*pi*freqHz*t+phase)", - style(color=9)), - Line(points=[-50, 0; -50, -40], style(color=8, pattern=2)), - Line(points=[-50, -54; -50, -72], style(color=8, pattern=2)), - Line(points=[18, -76; -1, -48], style(color=8, pattern=2)), - Text( - extent=[-77, 105; -38, 92], - string="v = p.v - n.v", - style(color=9))), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-51, -63; -27, -75], + string="t", + style(color=9)), + Text( + extent=[-82, -67; 108, -96], + string="V*exp(-damping*t)*sin(2*pi*freqHz*t+phase)", + style(color=9)), + Line(points=[-50, 0; -50, -40], style(color=8, pattern=2)), + Line(points=[-50, -54; -50, -72], style(color=8, pattern=2)), + Line(points=[18, -76; -1, -48], style(color=8, pattern=2)), + Text( + extent=[-77, 105; -38, 92], + string="v = p.v - n.v", + style(color=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.33, - y=0.06, - width=0.6, + x=0.33, + y=0.06, + width=0.6, height=0.75)); end ExpSineVoltage; - - model ExponentialsVoltage " Rising and falling exponential voltage source" + + model ExponentialsVoltage " Rising and falling exponential voltage source" parameter Real vMax=1 "Upper bound for rising edge"; - parameter Modelica.SIunits.Time riseTime(min=0) = 0.5 "Rise time"; - parameter Modelica.SIunits.Time riseTimeConst(min=Modelica.Constants.SMALL - ) = 0.1 "Rise time constant"; - parameter Modelica.SIunits.Time fallTimeConst(min=Modelica.Constants.SMALL - ) = riseTimeConst "Fall time constant"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.Exponentials signalSource( - outMax={vMax}, - riseTime={riseTime}, - riseTimeConst={riseTimeConst}, + parameter SI.Time riseTime(min=0) = 0.5 "Rise time"; + parameter SI.Time riseTimeConst(min=Modelica.Constants.small) = 0.1 + "Rise time constant"; + parameter SI.Time fallTimeConst(min=Modelica.Constants.small) = riseTimeConst + "Fall time constant"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Exponentials signalSource( + outMax={vMax}, + riseTime={riseTime}, + riseTimeConst={riseTimeConst}, fallTimeConst={fallTimeConst})); annotation ( Icon(Line(points=[-76, -59; -73.2, -44.3; -70.3, -31.1; -66.8, -16.6; - 63.3, -4; -59.7, 6.92; -55.5, 18.18; -51.3, 27.7; -46.3, 37; - 40.6, 45.5; -34.3, 53.1; -27.2, 59.6; -18.7, 65.3; -8.1, 70.2; -6 - , 71; -3.88, 58.5; -1.05, 43.7; 1.78, 30.8; 4.606, 19.45; 8.14, + , 71; -3.88, 58.5; -1.05, 43.7; 1.78, 30.8; 4.606, 19.45; 8.14, 7.3; 11.68, -3; 15.9, -13.2; 20.2, -21.6; 25.1, -29.5; 30.8, - 36.4; 37.1, -42.3; 44.9, -47.5; 54.8, -51.8; 64, -54.4], style( - color=8))), + color=8))), Diagram( - Line(points=[-100, -70; 84, -70], style(color=8)), - Polygon(points=[100, -70; 84, -64; 84, -76; 100, -70], style(color=8, - fillColor=8)), - Line(points=[-40, -30; -37.2, -15.3; -34.3, -2.1; -30.8, 12.4; -27.3, - 25; -23.7, 35.92; -19.5, 47.18; -15.3, 56.7; -10.3, 66; -4.6, - 74.5; 1.7, 82.1; 8.8, 88.6; 17.3, 94.3; 27.9, 99.2; 30, 100; + Line(points=[-100, -70; 84, -70], style(color=8)), + Polygon(points=[100, -70; 84, -64; 84, -76; 100, -70], style(color=8, + fillColor=8)), + Line(points=[-40, -30; -37.2, -15.3; -34.3, -2.1; -30.8, 12.4; -27.3, + 25; -23.7, 35.92; -19.5, 47.18; -15.3, 56.7; -10.3, 66; -4.6, + 74.5; 1.7, 82.1; 8.8, 88.6; 17.3, 94.3; 27.9, 99.2; 30, 100; 32.12, 87.5; 34.95, 72.7; 37.78, 59.8; 40.606, 48.45; 44.14, 36.3 ; 47.68, 26; 51.9, 15.8; 56.2, 7.4; 61.1, -0.5; 66.8, -7.4; 73.1 - , -13.3; 80.9, -18.5; 90.8, -22.8; 100, -25.4], style(color=0, - thickness=2)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Text( - extent=[-70, 91; -29, 71], - string="outPort", - style(color=9)), - Text( - extent=[-78, -43; -46, -56], - string="offset", - style(color=9)), - Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], + , -13.3; 80.9, -18.5; 90.8, -22.8; 100, -25.4], style(color=0, + thickness=2)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Text( + extent=[-70, 91; -29, 71], + string="outPort", + style(color=9)), + Text( + extent=[-78, -43; -46, -56], + string="offset", + style(color=9)), + Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -29; -40, -60], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[-40, -30; -42, -40; -37, -40; -40, -30], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-39, -30; -80, -30], style(color=0, thickness=2)), - Text( - extent=[-59, -71; -13, -89], - string="startTime", - style(color=9)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-39, -30; -80, -30], style(color=0, thickness=2)), + Text( + extent=[-59, -71; -13, -89], + string="startTime", + style(color=9)), Polygon(points=[-41, -30; -32, -28; -32, -32; -41, -30], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -30; 29, -30], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[29, -30; 21, -28; 21, -32; 29, -30], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-26, -12; 19, -28], - string="riseTime", - style(color=9)), - Text( - extent=[78, -76; 102, -96], - string="time", - style(color=9)), - Line(points=[-100, -70; 84, -70], style(color=8)), - Polygon(points=[100, -70; 84, -64; 84, -76; 100, -70], style(color=8, - fillColor=8)), - Line(points=[-40, -30; -37.2, -15.3; -34.3, -2.1; -30.8, 12.4; -27.3, - 25; -23.7, 35.92; -19.5, 47.18; -15.3, 56.7; -10.3, 66; -4.6, - 74.5; 1.7, 82.1; 8.8, 88.6; 17.3, 94.3; 27.9, 99.2; 30, 100; + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-26, -12; 19, -28], + string="riseTime", + style(color=9)), + Text( + extent=[78, -76; 102, -96], + string="time", + style(color=9)), + Line(points=[-100, -70; 84, -70], style(color=8)), + Polygon(points=[100, -70; 84, -64; 84, -76; 100, -70], style(color=8, + fillColor=8)), + Line(points=[-40, -30; -37.2, -15.3; -34.3, -2.1; -30.8, 12.4; -27.3, + 25; -23.7, 35.92; -19.5, 47.18; -15.3, 56.7; -10.3, 66; -4.6, + 74.5; 1.7, 82.1; 8.8, 88.6; 17.3, 94.3; 27.9, 99.2; 30, 100; 32.12, 87.5; 34.95, 72.7; 37.78, 59.8; 40.606, 48.45; 44.14, 36.3 ; 47.68, 26; 51.9, 15.8; 56.2, 7.4; 61.1, -0.5; 66.8, -7.4; 73.1 - , -13.3; 80.9, -18.5; 90.8, -22.8; 100, -25.4], style(color=0, - thickness=2)), - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Text( - extent=[-70, 91; -29, 71], - string="outPort", - style(color=9)), - Text( - extent=[-78, -43; -46, -56], - string="offset", - style(color=9)), - Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], + , -13.3; 80.9, -18.5; 90.8, -22.8; 100, -25.4], style(color=0, + thickness=2)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Text( + extent=[-70, 91; -29, 71], + string="outPort", + style(color=9)), + Text( + extent=[-78, -43; -46, -56], + string="offset", + style(color=9)), + Polygon(points=[-40, -70; -43, -60; -38, -60; -40, -70; -40, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -29; -40, -60], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[-40, -30; -42, -40; -37, -40; -40, -30], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-39, -30; -80, -30], style(color=0, thickness=2)), - Text( - extent=[-59, -71; -13, -89], - string="startTime", - style(color=9)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-39, -30; -80, -30], style(color=0, thickness=2)), + Text( + extent=[-59, -71; -13, -89], + string="startTime", + style(color=9)), Polygon(points=[-41, -30; -32, -28; -32, -32; -41, -30], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-40, -30; 29, -30], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), + color=8, + pattern=1, + thickness=1, + arrow=0)), Polygon(points=[29, -30; 21, -28; 21, -32; 29, -30], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-26, -12; 19, -28], - string="riseTime", - style(color=9)), - Text( - extent=[78, -76; 102, -96], - string="time", - style(color=9)), - Line(points=[30, 100; 30, -34], style(color=8, pattern=2))), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-26, -12; 19, -28], + string="riseTime", + style(color=9)), + Text( + extent=[78, -76; 102, -96], + string="time", + style(color=9)), + Line(points=[30, 100; 30, -34], style(color=8, pattern=2))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.11, - y=0.12, - width=0.78, + x=0.11, + y=0.12, + width=0.78, height=0.83)); end ExponentialsVoltage; - - model PulseVoltage "Pulse voltage source" - parameter Modelica.SIunits.Voltage V=1 "Amplitude of pulse"; + + model PulseVoltage "Pulse voltage source" + parameter SI.Voltage V=1 "Amplitude of pulse"; parameter Real width( - final min=Modelica.Constants.SMALL, + final min=Modelica.Constants.small, final max=100) = 50 "Width of pulse in % of period"; - parameter Modelica.SIunits.Time period(final min=Modelica.Constants.SMALL) - = 1 "Time for one period"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.Pulse signalSource( - amplitude={V}, - width={width}, + parameter SI.Time period(final min=Modelica.Constants.small) = 1 + "Time for one period"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Pulse signalSource( + amplitude={V}, + width={width}, period={period})); annotation ( - Icon(Line(points=[-70, -70; -40, -70; -40, 70; 0, 70; 0, -70; 40, -70; - 41, 70; 80, 70], style(color=8))), + Icon(Line(points=[-70, -70; -40, -70; -40, 70; 0, 70; 0, -70; 40, -70; 41 + , 70; 80, 70], style(color=8))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, 1; -37, -12; -30, -12; -34, 1], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-34, -1; -34, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-33, -70; -36, -57; -30, -57; -33, -70; -33, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-33, -70; -36, -57; -30, -57; -33, -70; -33, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-78, -24; -35, -36], - string="offset", - style(color=9)), - Text( - extent=[-31, -69; 15, -87], - string="startTime", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-10, 0; -10, -70], style(color=8, pattern=2)), - Line(points=[-80, 0; -20, 0; -21, 50; 21, 50; 20, -1; 41, 0; 40, 50; - 80, 51], style(color=0, thickness=2)), - Line(points=[-19, 88; -19, 49], style(color=8, pattern=2)), - Line(points=[21, 74; 21, 50], style(color=9, pattern=2)), - Line(points=[41, 88; 41, 50], style(color=8, pattern=2)), - Line(points=[-19, 83; 42, 83], style(color=8)), - Line(points=[-19, 69; 21, 69], style(color=8)), - Text( - extent=[-9, 97; 37, 85], - string="period", - style(color=9)), - Text( - extent=[-18, 81; 21, 69], - string="width", - style(color=9)), - Line(points=[-52, 50; -19, 50], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-78, -24; -35, -36], + string="offset", + style(color=9)), + Text( + extent=[-31, -69; 15, -87], + string="startTime", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-10, 0; -10, -70], style(color=8, pattern=2)), + Line(points=[-80, 0; -20, 0; -21, 50; 21, 50; 20, -1; 41, 0; 40, 50; 80 + , 51], style(color=0, thickness=2)), + Line(points=[-19, 88; -19, 49], style(color=8, pattern=2)), + Line(points=[21, 74; 21, 50], style(color=9, pattern=2)), + Line(points=[41, 88; 41, 50], style(color=8, pattern=2)), + Line(points=[-19, 83; 42, 83], style(color=8)), + Line(points=[-19, 69; 21, 69], style(color=8)), + Text( + extent=[-9, 97; 37, 85], + string="period", + style(color=9)), + Text( + extent=[-18, 81; 21, 69], + string="width", + style(color=9)), + Line(points=[-52, 50; -19, 50], style(color=8, pattern=2)), Line(points=[-34, 50; -34, 1], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Text( - extent=[-78, 34; -37, 20], - string="V", - style(color=9)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Text( + extent=[-78, 34; -37, 20], + string="V", + style(color=9)), Polygon(points=[-34, 49; -37, 36; -30, 36; -34, 49], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, 1; -37, 14; -31, 14; -34, 1; -34, 1], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[80, 51; 80, 0; 90, -1], style(color=0, thickness=2)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[80, 51; 80, 0; 90, -1], style(color=0, thickness=2)), Polygon(points=[-19, 69; -10, 71; -10, 67; -19, 69], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[21, 69; 13, 71; 13, 67; 21, 69], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-19, 83; -10, 85; -10, 81; -19, 83], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[41, 83; 33, 85; 33, 81; 41, 83], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[-78, 103; -24, 89], - string="v = p.v - n.v", - style(color=9))), + extent=[-78, 103; -24, 89], + string="v = p.v - n.v", + style(color=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.4, - y=0.23, - width=0.6, + x=0.4, + y=0.23, + width=0.6, height=0.6)); end PulseVoltage; - - model SawToothVoltage "Saw tooth voltage source" - parameter Modelica.SIunits.Voltage V=1 "Amplitude of saw tooth"; - parameter Modelica.SIunits.Time period=1 "Time for one period"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.SawTooth signalSource(amplitude={V}, period={ - period})); + + model SawToothVoltage "Saw tooth voltage source" + parameter SI.Voltage V=1 "Amplitude of saw tooth"; + parameter SI.Time period=1 "Time for one period"; + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.SawTooth signalSource( + amplitude={V}, period={period})); annotation ( - Icon(Line(points=[-70, -71; -50, -71; 10, 70; 10, -71; 70, 70; 70, -71] - , style(color=8))), + Icon(Line(points=[-70, -71; -50, -71; 10, 70; 10, -71; 70, 70; 70, -71], + style(color=8))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-34, -19; -37, -32; -30, -32; -34, -19], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-34, -20; -34, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-34, -70; -37, -57; -31, -57; -34, -70; -34, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-34, -70; -37, -57; -31, -57; -34, -70; -34, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-78, -24; -35, -36], - string="offset", - style(color=9)), - Text( - extent=[-31, -69; 15, -87], - string="startTime", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-10, -20; -10, -70], style(color=8, pattern=2)), - Line(points=[-10, 88; -10, -20], style(color=8, pattern=2)), - Line(points=[30, 88; 30, 59], style(color=8, pattern=2)), - Line(points=[-10, 83; 30, 83], style(color=8)), - Text( - extent=[-12, 97; 34, 85], - string="period", - style(color=9)), - Line(points=[-44, 60; 30, 60], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-78, -24; -35, -36], + string="offset", + style(color=9)), + Text( + extent=[-31, -69; 15, -87], + string="startTime", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-10, -20; -10, -70], style(color=8, pattern=2)), + Line(points=[-10, 88; -10, -20], style(color=8, pattern=2)), + Line(points=[30, 88; 30, 59], style(color=8, pattern=2)), + Line(points=[-10, 83; 30, 83], style(color=8)), + Text( + extent=[-12, 97; 34, 85], + string="period", + style(color=9)), + Line(points=[-44, 60; 30, 60], style(color=8, pattern=2)), Line(points=[-34, 47; -34, -7], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Text( - extent=[-78, 34; -37, 20], - string="V", - style(color=9)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Text( + extent=[-78, 34; -37, 20], + string="V", + style(color=9)), Polygon(points=[-34, 60; -37, 47; -30, 47; -34, 60], style( - color=8, - fillColor=8, - fillPattern=1)), - Polygon(points=[-34, -20; -37, -7; -31, -7; -34, -20; -34, -20], style - ( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), + Polygon(points=[-34, -20; -37, -7; -31, -7; -34, -20; -34, -20], style( + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-10, 83; -1, 85; -1, 81; -10, 83], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[30, 83; 22, 85; 22, 81; 30, 83], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, -20; -10, -20; 30, 60; 30, -20; 72, 60; 72, -20], - style(color=0, thickness=2)), - Text( - extent=[-77, 100; -27, 88], - string="v = p.v - n.v", - style(color=9))), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, -20; -10, -20; 30, 60; 30, -20; 72, 60; 72, -20], + style(color=0, thickness=2)), + Text( + extent=[-77, 100; -27, 88], + string="v = p.v - n.v", + style(color=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.37, - y=0.04, - width=0.6, + x=0.37, + y=0.04, + width=0.6, height=0.6)); end SawToothVoltage; - - model TrapezoidVoltage "Trapezoidal voltage source" - parameter Modelica.SIunits.Voltage V=1 "Amplitude of trapezoid"; - parameter SIunits.Time rising(final min=0) = 0 - "Rising duration of trapezoid"; - parameter SIunits.Time width(final min=0) = 0.5 - "Width duration of trapezoid"; - parameter SIunits.Time falling(final min=0) = 0 - "Falling duration of trapezoid"; - parameter SIunits.Time period(final min=Modelica.Constants.small) = 1 - "Time for one period"; - parameter Integer nperiod=-1 + + model TrapezoidVoltage "Trapezoidal voltage source" + parameter SI.Voltage V=1 "Amplitude of trapezoid"; + parameter SI.Time rising(final min=0) = 0 "Rising duration of trapezoid"; + parameter SI.Time width(final min=0) = 0.5 "Width duration of trapezoid"; + parameter SI.Time falling(final min=0) = 0 "Falling duration of trapezoid"; + parameter SI.Time period(final min=Modelica.Constants.small) = 1 + "Time for one period"; + parameter Integer nperiod=-1 "Number of periods (< 0 means infinite number of periods)"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.Trapezoid signalSource( - amplitude={V}, - rising={rising}, - width={width}, - falling={falling}, - period={period}, + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Trapezoid signalSource( + amplitude={V}, + rising={rising}, + width={width}, + falling={falling}, + period={period}, nperiod={nperiod})); annotation ( - Icon(Line(points=[-81, -70; -60, -70; -30, 70; 1, 70; 30, -70; 51, -70; - 80, 70], style(color=8))), + Icon(Line(points=[-81, -70; -60, -70; -30, 70; 1, 70; 30, -70; 51, -70; + 80, 70], style(color=8))), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-45, -30; -47, -41; -43, -41; -45, -30], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-45, -31; -45, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Polygon(points=[-45, -70; -47, -60; -43, -60; -45, -70; -45, -70], + color=8, + pattern=1, + thickness=1, + arrow=0)), + Polygon(points=[-45, -70; -47, -60; -43, -60; -45, -70; -45, -70], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-86, -43; -43, -55], - string="offset", - style(color=9)), - Text( - extent=[-47, -69; -1, -87], - string="startTime", - style(color=9)), - Text( - extent=[70, -80; 94, -100], - string="time", - style(color=9)), - Line(points=[-30, 81; -30, -70], style(color=8, pattern=2)), - Line(points=[-10, 59; -10, 40], style(color=8, pattern=2)), - Line(points=[20, 59; 20, 39], style(color=9, pattern=2)), - Line(points=[40, 59; 40, -30], style(color=8, pattern=2)), - Line(points=[-29, 56; 40, 56], style(color=8)), - Text( - extent=[-8, 70; 21, 60], - string="width", - style(color=9)), - Line(points=[-42, 40; -10, 40], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-86, -43; -43, -55], + string="offset", + style(color=9)), + Text( + extent=[-47, -69; -1, -87], + string="startTime", + style(color=9)), + Text( + extent=[70, -80; 94, -100], + string="time", + style(color=9)), + Line(points=[-30, 81; -30, -70], style(color=8, pattern=2)), + Line(points=[-10, 59; -10, 40], style(color=8, pattern=2)), + Line(points=[20, 59; 20, 39], style(color=9, pattern=2)), + Line(points=[40, 59; 40, -30], style(color=8, pattern=2)), + Line(points=[-29, 56; 40, 56], style(color=8)), + Text( + extent=[-8, 70; 21, 60], + string="width", + style(color=9)), + Line(points=[-42, 40; -10, 40], style(color=8, pattern=2)), Line(points=[-39, 40; -39, -19], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Text( - extent=[-77, 14; -40, 0], - string="V", - style(color=9)), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Text( + extent=[-77, 14; -40, 0], + string="V", + style(color=9)), Polygon(points=[-29, 56; -22, 58; -22, 54; -29, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-10, 56; -17, 58; -17, 54; -10, 56], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[-80, -30; -30, -30; -9, 46; 21, 46; 40, -30; 60, -30; 80 - , 46; 100, 46], style(color=0, thickness=2)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[-80, -30; -30, -30; -9, 46; 21, 46; 40, -30; 60, -30; 80, + 46; 100, 46], style(color=0, thickness=2)), Polygon(points=[-39, 40; -41, 29; -37, 29; -39, 40], style( - color=8, - fillColor=8, - fillPattern=1)), - Polygon(points=[-39, -29; -41, -19; -37, -19; -39, -29; -39, -29], + color=8, + fillColor=8, + fillPattern=1)), + Polygon(points=[-39, -29; -41, -19; -37, -19; -39, -29; -39, -29], style( - color=8, - fillColor=8, - fillPattern=1)), - Line(points=[60, 81; 60, -30], style(color=8, pattern=2)), + color=8, + fillColor=8, + fillPattern=1)), + Line(points=[60, 81; 60, -30], style(color=8, pattern=2)), Polygon(points=[39, 56; 32, 58; 32, 54; 39, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[20, 56; 27, 58; 27, 54; 20, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[20, 56; 13, 58; 13, 54; 20, 56], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[-12, 56; -5, 58; -5, 54; -12, 56], style( - color=8, - fillColor=8, - fillPattern=1)), - Text( - extent=[-34, 70; -5, 60], - string="rising", - style(color=9)), - Text( - extent=[16, 70; 45, 60], - string="falling", - style(color=9)), - Text( - extent=[-77, 103; -23, 91], - string="v = p.v - n.v", - style(color=9)), - Line(points=[-20, 76; 61, 76], style(color=8)), + color=8, + fillColor=8, + fillPattern=1)), + Text( + extent=[-34, 70; -5, 60], + string="rising", + style(color=9)), + Text( + extent=[16, 70; 45, 60], + string="falling", + style(color=9)), + Text( + extent=[-77, 103; -23, 91], + string="v = p.v - n.v", + style(color=9)), + Line(points=[-20, 76; 61, 76], style(color=8)), Polygon(points=[-29, 76; -20, 78; -20, 74; -29, 76], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Polygon(points=[61, 76; 53, 78; 53, 74; 61, 76], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Text( - extent=[-2, 86; 25, 77], - string="period", - style(color=9))), + extent=[-2, 86; 25, 77], + string="period", + style(color=9))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.21, - y=0.22, - width=0.6, + x=0.21, + y=0.22, + width=0.6, height=0.63)); end TrapezoidVoltage; - - model TableVoltage "Voltage source by linear interpolation in a table" - parameter Real table[:, :]=[0, 0; 1, 1; 2, 4] + + model TableVoltage "Voltage source by linear interpolation in a table" + parameter Real table[:, :]=[0, 0; 1, 1; 2, 4] "Table matrix (time = first column, voltage = second column)"; - extends Modelica.Electrical.Analog.Interfaces.VoltageSource(redeclare - Modelica.Blocks.Sources.TimeTable signalSource(table=table)); + extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.TimeTable signalSource(table + =table)); annotation ( - Icon(Line(points=[-66, -36; -66, 84; 34, 84; 34, -36; -66, -36; -66, -6 - ; 34, -6; 34, 24; -66, 24; -66, 54; 34, 54; 34, 84; -16, 84; -16 - , -37], style(color=8))), + Icon(Line(points=[-66, -36; -66, 84; 34, 84; 34, -36; -66, -36; -66, -6; + 34, -6; 34, 24; -66, 24; -66, 54; 34, 54; 34, 84; -16, 84; -16, - + 37], style(color=8))), Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Window( - x=0.25, - y=0.01, - width=0.72, - height=0.86), + x=0.25, + y=0.01, + width=0.72, + height=0.86), Diagram( - Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, - fillColor=8)), - Line(points=[-80, 68; -80, -80], style(color=8)), - Line(points=[-90, -70; 82, -70], style(color=8)), + Polygon(points=[-80, 90; -88, 68; -72, 68; -80, 90], style(color=8, + fillColor=8)), + Line(points=[-80, 68; -80, -80], style(color=8)), + Line(points=[-90, -70; 82, -70], style(color=8)), Polygon(points=[90, -70; 68, -62; 68, -78; 90, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Rectangle(extent=[-20, 90; 30, -30], style( - color=7, - fillColor=8, - fillPattern=1)), - Line(points=[-20, -30; -20, 90; 80, 90; 80, -30; -20, -30; -20, 0; 80 - , 0; 80, 30; -20, 30; -20, 60; 80, 60; 80, 90; 30, 90; 30, -31], - style(color=0)), - Text( - extent=[-77, -42; -38, -58], - string="offset", - style(color=9)), + color=7, + fillColor=8, + fillPattern=1)), + Line(points=[-20, -30; -20, 90; 80, 90; 80, -30; -20, -30; -20, 0; 80, + 0; 80, 30; -20, 30; -20, 60; 80, 60; 80, 90; 30, 90; 30, -31], + style(color=0)), + Text( + extent=[-77, -42; -38, -58], + string="offset", + style(color=9)), Polygon(points=[-31, -30; -33, -40; -28, -40; -31, -30], style( - color=8, - fillColor=8, - fillPattern=1)), - Polygon(points=[-30, -70; -33, -60; -28, -60; -30, -70; -30, -70], + color=8, + fillColor=8, + fillPattern=1)), + Polygon(points=[-30, -70; -33, -60; -28, -60; -30, -70; -30, -70], style( - color=8, - fillColor=8, - fillPattern=1)), + color=8, + fillColor=8, + fillPattern=1)), Line(points=[-31, -31; -31, -70], style( - color=8, - pattern=1, - thickness=1, - arrow=0)), - Line(points=[-20, -20; -20, -70], style(color=8, pattern=2)), - Text( - extent=[-38, -70; 8, -88], - string="startTime", - style(color=9)), - Line(points=[-20, -30; -80, -30], style(color=8, pattern=2)), - Text( - extent=[66, -81; 91, -93], - string="time", - style(color=9)), - Text( - extent=[-15, 83; 24, 68], - string="time", - style(color=0)), - Text( - extent=[33, 83; 76, 67], - string="v", - style(color=0)), - Text( - extent=[-81, 98; -31, 85], - string="v = p.v - n.v", - style(color=9))), + color=8, + pattern=1, + thickness=1, + arrow=0)), + Line(points=[-20, -20; -20, -70], style(color=8, pattern=2)), + Text( + extent=[-38, -70; 8, -88], + string="startTime", + style(color=9)), + Line(points=[-20, -30; -80, -30], style(color=8, pattern=2)), + Text( + extent=[66, -81; 91, -93], + string="time", + style(color=9)), + Text( + extent=[-15, 83; 24, 68], + string="time", + style(color=0)), + Text( + extent=[33, 83; 76, 67], + string="v", + style(color=0)), + Text( + extent=[-81, 98; -31, 85], + string="v = p.v - n.v", + style(color=9))), Documentation(info="
This block generates a voltage source by linear interpolation in -a table. The time points and voltage values are stored in a matrix -table[i,j], where the first column table[:,1] contains the -time points and the second column contains the voltage to be interpolated. +a table. The time points and voltage values are stored in a matrix +table[i,j], where the first column table[:,1] contains the +time points and the second column contains the voltage to be interpolated. The table interpolation has the following proporties:
@@ -1056,17 +1033,17 @@ The table interpolation has the following proporties:This block generates a current source by linear interpolation in -a table. The time points and current values are stored in a matrix -table[i,j], where the first column table[:,1] contains the -time points and the second column contains the current to be interpolated. +a table. The time points and current values are stored in a matrix +table[i,j], where the first column table[:,1] contains the +time points and the second column contains the current to be interpolated. The table interpolation has the following proporties:
@@ -2030,17 +1985,17 @@ The table interpolation has the following proporties:This package contains packages for analog electrical components:
diff --git a/Electrical/package.mo b/Electrical/package.mo index b8a4c04fd3..50465d0486 100644 --- a/Electrical/package.mo +++ b/Electrical/package.mo @@ -1,9 +1,11 @@ package Electrical "Library for electrical models" + + extends Modelica.Icons.Library2; + annotation ( - Documentation(info=" - + Documentation(info="
This library contains electrical components to build up analog and digital circuits. The library is currently structured in the following sublibraries: @@ -17,9 +19,9 @@ The library is currently structured in the following sublibraries:
-"),
- Coordsys(
- extent=[0, 0; 120, 175],
- grid=[2, 2],
- component=[20, 20]),
- Window(
+"),Window(
x=0.03,
y=0.03,
width=0.13,
@@ -56,12 +53,12 @@ Modelica in file \"Modelica/package.mo\".
library=1,
autolayout=1),
Icon(
- Rectangle(extent=[-29, -13; 3, -27], style(color=0)),
- Line(points=[37, -58; 62, -58], style(color=0)),
- Line(points=[36, -49; 61, -49], style(color=0)),
- Line(points=[-78, -50; -43, -50], style(color=0)),
- Line(points=[-67, -55; -55, -55], style(color=0)),
- Line(points=[-61, -50; -61, -20; -29, -20], style(color=0)),
- Line(points=[3, -20; 48, -20; 48, -49], style(color=0)),
+ Rectangle(extent=[-29, -13; 3, -27], style(color=0)),
+ Line(points=[37, -58; 62, -58], style(color=0)),
+ Line(points=[36, -49; 61, -49], style(color=0)),
+ Line(points=[-78, -50; -43, -50], style(color=0)),
+ Line(points=[-67, -55; -55, -55], style(color=0)),
+ Line(points=[-61, -50; -61, -20; -29, -20], style(color=0)),
+ Line(points=[3, -20; 48, -20; 48, -49], style(color=0)),
Line(points=[48, -58; 48, -78; -61, -78; -61, -55], style(color=0))));
end Electrical;
diff --git a/Icons.mo b/Icons.mo
index da7b6701f7..0a5fcfa51b 100644
--- a/Icons.mo
+++ b/Icons.mo
@@ -1,70 +1,64 @@
-package Icons "Icon definitions"
-
+package Icons "Icon definitions"
+
annotation (
- Coordsys(
- extent=[0, 0; 606, 355],
- grid=[2, 2],
- component=[20, 20]),
Window(
- x=0.17,
- y=0.09,
- width=0.6,
- height=0.6,
+ x=0.08,
+ y=0.08,
+ width=0.28,
+ height=0.51,
library=1,
autolayout=1),
Icon(
- Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern=1
- )),
+ Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern=1)
+ ),
Polygon(points=[-100, 50; -80, 70; 100, 70; 80, 50; -100, 50], style(
- fillColor=30, fillPattern=1)),
+ fillColor=30, fillPattern=1)),
Polygon(points=[100, 70; 100, -80; 80, -100; 80, 50; 100, 70], style(
- fillColor=30, fillPattern=1)),
+ fillColor=30, fillPattern=1)),
Text(
- extent=[-120, 135; 120, 70],
- string="%name",
- style(color=1)),
+ extent=[-120, 135; 120, 70],
+ string="%name",
+ style(color=1)),
Text(
- extent=[-90, 40; 70, 10],
- string="Library",
+ extent=[-90, 40; 70, 10],
+ string="Library",
style(
- color=9,
- fillColor=0,
- fillPattern=1)),
- Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern=1
- )),
+ color=9,
+ fillColor=0,
+ fillPattern=1)),
+ Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern=1)
+ ),
Polygon(points=[-100, 50; -80, 70; 100, 70; 80, 50; -100, 50], style(
- fillColor=30, fillPattern=1)),
+ fillColor=30, fillPattern=1)),
Polygon(points=[100, 70; 100, -80; 80, -100; 80, 50; 100, 70], style(
- fillColor=30, fillPattern=1)),
+ fillColor=30, fillPattern=1)),
Text(
- extent=[-90, 40; 70, 10],
- string="Library",
+ extent=[-90, 40; 70, 10],
+ string="Library",
style(
- color=9,
- fillColor=0,
- fillPattern=1)),
- Polygon(points=[-64, -20; -50, -4; 50, -4; 36, -20; -64, -20; -64, -20]
- , style(
- color=0,
- fillColor=8,
- fillPattern=1)),
+ color=9,
+ fillColor=0,
+ fillPattern=1)),
+ Polygon(points=[-64, -20; -50, -4; 50, -4; 36, -20; -64, -20; -64, -20],
+ style(
+ color=0,
+ fillColor=8,
+ fillPattern=1)),
Rectangle(extent=[-64, -20; 36, -84], style(
- color=0,
- fillColor=8,
- fillPattern=1)),
+ color=0,
+ fillColor=8,
+ fillPattern=1)),
Text(
- extent=[-60, -24; 32, -38],
- string="Library",
+ extent=[-60, -24; 32, -38],
+ string="Library",
style(
- color=10,
- fillColor=10,
- fillPattern=1)),
+ color=10,
+ fillColor=10,
+ fillPattern=1)),
Polygon(points=[50, -4; 50, -70; 36, -84; 36, -20; 50, -4], style(
- color=0,
- fillColor=8,
- fillPattern=1))),
- Documentation(info="
-
+ color=0,
+ fillColor=8,
+ fillPattern=1))), Documentation(info="
This package contains definitions for the graphical layout of components which may be used in different libraries. @@ -75,7 +69,7 @@ using \"extends\".
Release Notes:
Copyright (C) 1999, Modelica Design Group and DLR.
+Copyright © 1999-2002, Modelica Association and DLR.
The Modelica package is free software; it can be redistributed and/or modified under the terms of the Modelica license, see the license conditions -and the accompanying disclaimer in the documentation of package +and the accompanying disclaimer in the documentation of package Modelica in file \"Modelica/package.mo\".
")); - model Info "Icon for an information class" annotation ( + partial model Info "Icon for an information class" + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Rectangle(extent=[-100, 80; 80, -90], style(color=3)), + Rectangle(extent=[-100, 80; 80, -90], style(color=3)), Polygon(points=[-100, 80; -90, 90; 90, 90; 80, 80; -100, 80], style( - fillColor=3)), + fillColor=3)), Polygon(points=[80, -90; 90, -80; 90, 90; 80, 80; 80, -90], style( - fillColor=3)), - Text(extent=[-80, 70; 60, -70], string="Info")), + fillColor=3)), + Text(extent=[-80, 70; 60, -70], string="Info")), Diagram( - Rectangle(extent=[-100, 80; 80, -90], style(color=3)), + Rectangle(extent=[-100, 80; 80, -90], style(color=3)), Polygon(points=[-100, 80; -90, 90; 90, 90; 80, 80; -100, 80], style( - fillColor=3)), + fillColor=3)), Polygon(points=[80, -90; 90, -80; 90, 90; 80, 80; 80, -90], style( - fillColor=3)), - Text(extent=[-80, 70; 60, -70], string="Info"))); end Info; - model Library "Icon for library" annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.33, - y=0.34, - width=0.6, - height=0.55), - Icon( - Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern - =1)), + fillColor=3)), + Text(extent=[-80, 70; 60, -70], string="Info"))); + end Info; + + partial package Library "Icon for library" + annotation (Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( + Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern= + 1)), Polygon(points=[-100, 50; -80, 70; 100, 70; 80, 50; -100, 50], style( - fillColor=30, fillPattern=1)), + fillColor=30, fillPattern=1)), Polygon(points=[100, 70; 100, -80; 80, -100; 80, 50; 100, 70], style( - fillColor=30, fillPattern=1)), + fillColor=30, fillPattern=1)), Text( - extent=[-85, 35; 65, -85], - string="Library", - style(color=3)), + extent=[-85, 35; 65, -85], + string="Library", + style(color=3)), Text( - extent=[-120, 135; 120, 70], - string="%name", - style(color=1)))); end Library; - model Library2 - "Icon for library where additional icon elements shall be added" - annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.29, - y=0.29, - width=0.6, - height=0.6), - Icon( - Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern - =1)), + extent=[-120, 122; 120, 73], + string="%name", + style(color=1)))); + end Library; + + partial package Library2 + "Icon for library where additional icon elements shall be added" + annotation (Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( + Rectangle(extent=[-100, -100; 80, 50], style(fillColor=30, fillPattern= + 1)), Polygon(points=[-100, 50; -80, 70; 100, 70; 80, 50; -100, 50], style( - fillColor=30, fillPattern=1)), + fillColor=30, fillPattern=1)), Polygon(points=[100, 70; 100, -80; 80, -100; 80, 50; 100, 70], style( - fillColor=30, fillPattern=1)), + fillColor=30, fillPattern=1)), Text( - extent=[-120, 135; 120, 70], - string="%name", - style(color=1)), + extent=[-120, 125; 120, 70], + string="%name", + style(color=1)), Text( - extent=[-90, 40; 70, 10], - string="Library", + extent=[-90, 40; 70, 10], + string="Library", style( - color=9, - fillColor=0, - fillPattern=1)))); end Library2; - model Example "Icon for an example model" annotation ( - Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), - Window( - x=0.35, - y=0.28, - width=0.6, - height=0.6), - Icon( - Rectangle(extent=[-100, -100; 80, 50]), - Polygon(points=[-100, 50; -80, 70; 100, 70; 80, 50; -100, 50]), - Polygon(points=[100, 70; 100, -80; 80, -100; 80, 50; 100, 70]), + color=9, + fillColor=0, + fillPattern=1)))); + end Library2; + + partial model Example "Icon for an example model" + annotation (Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( + Rectangle(extent=[-100, -100; 80, 50], style(fillColor=7)), + Polygon(points=[-100, 50; -80, 70; 100, 70; 80, 50; -100, 50], style( + fillColor=7)), + Polygon(points=[100, 70; 100, -80; 80, -100; 80, 50; 100, 70], style( + fillColor=7)), + Text( + extent=[-96, 3; 77, -49], + string="Example", + style(color=3)), Text( - extent=[-84, 34; 64, -84], - string="Example", - style(color=3)), + extent=[-120, 132; 120, 73], + string="%name", + style(color=1)))); + end Example; + + partial function Function "Icon for a function" + annotation (Icon( + Text(extent=[-134, 104; 142, 44], string="%name"), + Ellipse(extent=[-100, 40; 100, -100], style(color=45, fillColor=7)), Text( - extent=[-120, 135; 120, 70], - string="%name", - style(color=1)))); end Example; - model TranslationalSensor - "Icon representing translational measurement device" annotation ( + extent=[-84, -4; 84, -52], + string="function", + style(color=45)))); + end Function; + + partial record Record "Icon for a record" + annotation (Icon( + Rectangle(extent=[-100, 50; 100, -100], style(fillColor=51, fillPattern + =1)), + Text(extent=[-127, 115; 127, 55], string="%name"), + Line(points=[-100, -50; 100, -50], style(color=0)), + Line(points=[-100, 0; 100, 0], style(color=0)), + Line(points=[0, 50; 0, -100], style(color=0)))); + end Record; + + partial function Enumeration "Icon for an enumeration" + annotation (Icon( + Text(extent=[-134, 104; 142, 44], string="%name"), + Ellipse(extent=[-100, 40; 100, -100], style(color=85, fillColor=7)), + Text( + extent=[-84, -4; 84, -52], + string="enumeration", + style(color=85, fillColor=88)))); + end Enumeration; + + partial model TranslationalSensor + "Icon representing translational measurement device" + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Rectangle(extent=[-70, -60; 70, 20], style(color=0, fillColor=7)), + Rectangle(extent=[-70, -60; 70, 20], style(color=0, fillColor=7)), Polygon(points=[0, -40; -10, -16; 10, -16; 0, -40], style( - color=0, - fillColor=0, - fillPattern=1)), - Line(points=[0, 0; 0, -16], style(color=0)), - Line(points=[-70, 0; 0, 0], style(color=0)), - Line(points=[-50, -40; -50, -60], style(color=0)), - Line(points=[-30, -40; -30, -60], style(color=0)), - Line(points=[-10, -40; -10, -60], style(color=0)), - Line(points=[10, -40; 10, -60], style(color=0)), - Line(points=[30, -40; 30, -60], style(color=0)), - Line(points=[50, -40; 50, -60], style(color=0))), + color=0, + fillColor=0, + fillPattern=1)), + Line(points=[0, 0; 0, -16], style(color=0)), + Line(points=[-70, 0; 0, 0], style(color=0)), + Line(points=[-50, -40; -50, -60], style(color=0)), + Line(points=[-30, -40; -30, -60], style(color=0)), + Line(points=[-10, -40; -10, -60], style(color=0)), + Line(points=[10, -40; 10, -60], style(color=0)), + Line(points=[30, -40; 30, -60], style(color=0)), + Line(points=[50, -40; 50, -60], style(color=0))), Diagram( - Rectangle(extent=[-70, -60; 70, 20], style(color=0, fillColor=7)), + Rectangle(extent=[-70, -60; 70, 20], style(color=0, fillColor=7)), Polygon(points=[0, -40; -10, -16; 10, -16; 0, -40], style( - color=0, - fillColor=0, - fillPattern=1)), - Line(points=[0, 0; 0, -16], style(color=0)), - Line(points=[-70, 0; 0, 0], style(color=0)), - Line(points=[-50, -40; -50, -60], style(color=0)), - Line(points=[-30, -40; -30, -60], style(color=0)), - Line(points=[-10, -40; -10, -60], style(color=0)), - Line(points=[10, -40; 10, -60], style(color=0)), - Line(points=[30, -40; 30, -60], style(color=0)), - Line(points=[50, -40; 50, -60], style(color=0)))); end - TranslationalSensor; - model RotationalSensor "Icon representing rotational measurement device" - annotation ( + color=0, + fillColor=0, + fillPattern=1)), + Line(points=[0, 0; 0, -16], style(color=0)), + Line(points=[-70, 0; 0, 0], style(color=0)), + Line(points=[-50, -40; -50, -60], style(color=0)), + Line(points=[-30, -40; -30, -60], style(color=0)), + Line(points=[-10, -40; -10, -60], style(color=0)), + Line(points=[10, -40; 10, -60], style(color=0)), + Line(points=[30, -40; 30, -60], style(color=0)), + Line(points=[50, -40; 50, -60], style(color=0)))); + end TranslationalSensor; + + partial model RotationalSensor + "Icon representing rotational measurement device" + annotation ( Coordsys( - extent=[-100, -100; 100, 100], - grid=[1, 1], - component=[20, 20]), + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( - Ellipse(extent=[-70, 70; 70, -70], style(color=0, fillColor=7)), - Line(points=[0, 70; 0, 40], style(color=0)), - Line(points=[22.9, 32.8; 40.2, 57.3], style(color=0)), - Line(points=[-22.9, 32.8; -40.2, 57.3], style(color=0)), - Line(points=[37.6, 13.7; 65.8, 23.9], style(color=0)), - Line(points=[-37.6, 13.7; -65.8, 23.9], style(color=0)), - Line(points=[0, 0; 9.02, 28.6], style(color=0)), + Ellipse(extent=[-70, 70; 70, -70], style(color=0, fillColor=7)), + Line(points=[0, 70; 0, 40], style(color=0)), + Line(points=[22.9, 32.8; 40.2, 57.3], style(color=0)), + Line(points=[-22.9, 32.8; -40.2, 57.3], style(color=0)), + Line(points=[37.6, 13.7; 65.8, 23.9], style(color=0)), + Line(points=[-37.6, 13.7; -65.8, 23.9], style(color=0)), + Line(points=[0, 0; 9.02, 28.6], style(color=0)), Polygon(points=[-0.48, 31.6; 18, 26; 18, 57.2; -0.48, 31.6], style( - color=0, - fillColor=0, - fillPattern=1)), + color=0, + fillColor=0, + fillPattern=1)), Ellipse(extent=[-5, 5; 5, -5], style( - color=0, - gradient=0, - fillColor=0, - fillPattern=1))), + color=0, + gradient=0, + fillColor=0, + fillPattern=1))), Diagram( - Ellipse(extent=[-70, 70; 70, -70], style(color=0, fillColor=7)), - Line(points=[0, 70; 0, 40], style(color=0)), - Line(points=[22.9, 32.8; 40.2, 57.3], style(color=0)), - Line(points=[-22.9, 32.8; -40.2, 57.3], style(color=0)), - Line(points=[37.6, 13.7; 65.8, 23.9], style(color=0)), - Line(points=[-37.6, 13.7; -65.8, 23.9], style(color=0)), - Line(points=[0, 0; 9.02, 28.6], style(color=0)), + Ellipse(extent=[-70, 70; 70, -70], style(color=0, fillColor=7)), + Line(points=[0, 70; 0, 40], style(color=0)), + Line(points=[22.9, 32.8; 40.2, 57.3], style(color=0)), + Line(points=[-22.9, 32.8; -40.2, 57.3], style(color=0)), + Line(points=[37.6, 13.7; 65.8, 23.9], style(color=0)), + Line(points=[-37.6, 13.7; -65.8, 23.9], style(color=0)), + Line(points=[0, 0; 9.02, 28.6], style(color=0)), Polygon(points=[-0.48, 31.6; 18, 26; 18, 57.2; -0.48, 31.6], style( - color=0, - fillColor=0, - fillPattern=1)), + color=0, + fillColor=0, + fillPattern=1)), Ellipse(extent=[-5, 5; 5, -5], style( - color=0, - gradient=0, - fillColor=0, - fillPattern=1)))); end RotationalSensor; + color=0, + gradient=0, + fillColor=0, + fillPattern=1)))); + end RotationalSensor; + + partial model GearIcon "Icon for gearbox" + annotation (Coordsys( + extent=[-100, -100; 100, 100], + grid=[2, 2], + component=[20, 20]), Icon( + Rectangle(extent=[-90, 10; -60, -10], style( + gradient=2, + fillColor=8, + fillPattern=1)), + Polygon(points=[-60, 10; -60, 20; -40, 40; -40, -40; -60, -20; -60, 10] + , style( + color=10, + gradient=2, + fillColor=10, + fillPattern=1)), + Rectangle(extent=[-40, 60; 40, -60], style( + color=3, + pattern=1, + thickness=1, + gradient=2, + arrow=0, + fillColor=8, + fillPattern=1)), + Polygon(points=[60, 20; 40, 40; 40, -40; 60, -20; 60, 20], style( + color=10, + fillColor=10, + fillPattern=1)), + Rectangle(extent=[60, 10; 90, -10], style( + gradient=2, + fillColor=8, + fillPattern=1)), + Polygon(points=[-60, -90; -50, -90; -20, -30; 20, -30; 48, -90; 60, -90 + ; 60, -100; -60, -100; -60, -90], style( + color=0, + fillColor=0, + fillPattern=1)))); + end GearIcon; + + partial model MotorIcon "Icon for electrical motor" + annotation (Coordsys( + extent=[-100, -100; 100, 100], + grid=[1, 1], + component=[20, 20]), Icon( + Rectangle(extent=[-100, 50; 30, -50], style( + color=1, + gradient=2, + fillColor=1, + fillPattern=1)), + Polygon(points=[-100, -90; -90, -90; -60, -20; -10, -20; 20, -90; 30, - + 90; 30, -100; -100, -100; -100, -90], style( + color=0, + gradient=0, + fillColor=0, + fillPattern=1)), + Rectangle(extent=[30, 10; 90, -10], style( + gradient=2, + fillColor=8, + fillPattern=1)))); + end MotorIcon; end Icons; diff --git a/Images/ControlledIdealIntermediateSwitch1.png b/Images/ControlledIdealIntermediateSwitch1.png new file mode 100644 index 0000000000000000000000000000000000000000..594a0b362dd402374c1374831dff897d20136452 GIT binary patch literal 1871 zcmV-V2e9~wP)a*NX2^NDsCN !x7>up0-%gqAWvL*cwjPi#4+i#_nRa2!BH>`_M#|#@r1X8CO&f1|xTRdep zzC~7E&Nf~9Jryw+pw&7Zn`YovhTBG~pO=La|Lzx@wh+BtP{+pUawAl42QJ0)k#N_A zT2ZjF_^UyibXe!=i@iZno8;nOt7UDm{5xLQ5(j5_QOx4!FP^7v|29HkWFqXc%&aVP zFtSr^DZm*+6b~H-RtXu1VD6<=PynRRdEXV$`(1oLy{JP@>$Mf@?2k86MPu7ZUed+H zTgE0aHx{~D!t~|+GakowRX7fC9Q7Z^_WJzv0vU)r#tut5y(-rO`1Zcdv4d-vbsFcc zxAm?sr(<`{ZZG2+E%ss4qeEwaqlfi@ZRK2l*x_KR<4EP}CgQ{4e#hih2L%6NeV9$~ z<>93KVd1RfPaG#LVv~Mr3=~?71x}2`IBAPj*#(|Gb)5r4q9Y*7CbY^4Aa!0B$5>zl z7S)`Mx9wzxj#j;#XSW^WsCReHb|-@(esek>5o0V}9 {?$~pc@;o`661Y_&L zH7GoeYH@z!gK?~eu|*y6$7|xN^}6Wc!s&4pv+nzm<3DE3e EghWMbnjPOBJEQ6U zJ$C*pkt+3d(&b#uCE)|jwz#9Hyet;U&ac#nb;Qx>m?M7L@el$$e8;JYThC(QC`4p_ zV#nZgFVvUn )p^j d(@Thrs-^l1i*ffjgY&Od zmvgq~!hx3#S01u!&c-BOQqQiY3ogsQ{ozz_R=v7Z=(zB9@jNQJFfw=k=yJ&!2>tQ~ z>b`Tq)`6!&<0T${X)SQ=h6}Y-zjn8|bOJB0JTCA)r(Fk!U%8N6f9|+;X7UaR^nM+l z5E%OLM(w4fO{v0@mF9T)h3$u3~X Y_6+Sp^A++BIegN z XW(BF@Pr9u!o&bX{s*C0BYgk> literal 0 HcmV?d00001 diff --git a/Images/IdealIntermediateSwitch1.png b/Images/IdealIntermediateSwitch1.png new file mode 100644 index 0000000000000000000000000000000000000000..2406b36959e2c9ee01e7d3f181412f2e343b1810 GIT binary patch literal 1742 zcmV;<1~K`GP) RX&%+Gw0! zM#`mL0$ L 4(MF;LLr*i7@baE|AknW(C2HT@vU6UBhrbcnMMY5?+CHmH8f57 z(Z kvPcsF}x6V3gh!{L^T*G z{^p>eWC%?hxP}j&@R~ztu9aw_r_@Z&Pk0{+=KO_mY!hgz_tmLVLsP7;0Uc98G*dA% zMkw|x;?GAR9F$Hp%_=WM(~JndHedJoR>Ea ;xY$nVOaTGLr& u8I%}r $SHPE%!2Af${?M4AE zZt%6HmBxvh>k`e>_mBLo>`#9BtHq+m4f7*<)DuyOCY3m);Sf+nlcI s{H^zw!GHuJE3W+!I;`onbE`oA@gX4Z!>rMfoS@wU5`N1 z+-D-1Y0+FLpnrrWmZ@E08T3Fju?m-2r{5V(EW#PCuoCthmp(rI@<(p4NLO3>8jcC8 z+8Tb$BE3de;5E6aS^j`N$6xYV%tqywf$#QcPJ6Et=-g}H(fGb5l~86Ei=1@scz# )j)k&P4O+>#9_U6HRI#IuBh`5lw26&ZAe% zM3b7K^Mv1Jh$b~g+i}Sy(WK_-Jagw+qDl4AdGgOOM3d@5@ccjeA)3@i;65$6B%0I! zoo6POM3Wkb>=*v=F43e~87I9am3N(f6`e$rvMHty;+N1#G^s8G&!>}UQh$=mIdF+4 zbw+YI8t#cEbzXA03&%v0IwZNgoKB+2 BXHlQK)qoRd)nhW zlA!sDcIuEdYkc#_Z{rn)@`QIc+h``Y*@tLqtiV1d{E4KEW@w`lMtb9WjTZ8nrq8SU zPR*pHU$`yj5;h9aG&YKtK|Zq{-7Yc}nz%)?{&sK!G*>LSUqe%G7^#hZ{bLx=m%FQ? zroz{qtEhDY`dS9k8P&N}?j6v4juu68va{atP-$c0ZQTC=niNGeDXJ@b`3LH=^VAdj kAh-Yk00(qQO+^RN3=k0>A{q`FW&i*H07*qoM6N<$f{){0^#A|> literal 0 HcmV?d00001 diff --git a/Images/IdealIntermediateSwitch2.png b/Images/IdealIntermediateSwitch2.png new file mode 100644 index 0000000000000000000000000000000000000000..cb860cc8411ba5942716b916224988e321275167 GIT binary patch literal 2714 zcmV;L3T5?)P) CMfP?@*!o%YG z`}^zb>;4r-0!TOqKR-XulCYFANW%NYq3c=ktaG1@w5yQtHIfXH@P6@ex`M+AqVkKu zF#Gz&{rUH=txy@i;9evQL)<_3^NT)7gplT${%RxC60=tAsv(!HuUMhKf4FimKPaD% z{z1-2BvjspBz%_DyO2=!X8Oj2SMp#@LiNY`O}$UKXQ7I>)YpF)+X)HFF!ZZyujmK$ z@^t#Fw+R(LUDiHC!a;T&kAyXjYh2dV*NUNQls-PuEYi<0&zHg_R|{+ApvV-a87m95 zjOmRV>UwHzMAr7h*NccyR#cP9Z;fBH-$j_1jIUFnc3cNK7i-NWuNab0UQuU%9rpPo zG^wi^%ReYT8VZGvcmBLZ vFmgq>R6g5wfc*rMV7?j3Fx`4buLh}+WO21GETOuU< zK1}mKTd#V&hP!vSahxtSoyScSwQ}(ba#RG4i4grXvq{lUzCC$9|3MP!JJIF4WBu1i z7&>DC3H82FqzJ4F!{Fh0n+f`Ha{8ChiGHLKdcTX%4J)KSu#glJUOazKC^<>aV9Xw` zwGT9Os@fowqh?p|8VU9FJ0vs*Gx|WNW<*%`P!Q?uR_h?`DH4W)$X{)|5^Ck#BB9}- z-jdA9#nVnl^(u{xw5X5`fW8@XylHml+E|r-!hvvW*U8heY4NLVWjJ}KL~l{3gsm9R zMNgZ03JHBK4*zPd9F+jjF)6V$MHz9x045hhlXlI4N4SgAI#b8G*%Ru0pgEj;hlD!s z*Ti8+s1J>N!Fc~ID@X_?*Fztd;in^7=h)##Cgf`2gM$ZV`fsJa^ NC*IcgaAN7001Ne01^TKARz#d z5C8xPPXXpwfLmi;OL-VNVL!<=QEOU#9M|-|HS6I*CwKiig^e$xhLGuYlXwfQZd9dj z`oym9y6Kf}lz2Ec`c}w?%OHvC*WEOwXa4xIrG)75MC)&))#`Rsj^>VDXmyFCl3Zc^ zW|%_Q1hKQ=o9c`x>(_m26NA~3@aI2b!MY6zcOJ$fUJu3d{v;Idhgu_L{jIsKBLmV+ z!CW>XR>WG^f3ZnIY4F}^tiM|&^y8^auWmg?$E4DaCTy*j%!_VLLcRX5H+jnXTY;zd zhZ64I+IoPGp0xMr1?%?5rsVc2VSl>K4kYxA@lATuyIxI$&TjZal`st1{VSm#Rgk-W zGvK5X9@WeGydaB&xAvTsArkrl5*w1xxWsG^%#5CnEg<1T{ni=1lDiAlLm>Q`TTWlL z{y8KJe{2Qu_dK)|qZyN=pJv`W85w~%aoOi4VSf^f-%L&qgO-HRD+wp14U%xmvVG9b zA)y{jz2~0L7~RxxD&Z6o8s)anp0G0xtuv(Q7?n^5`rvMIy(i2*!6eI(Ii!$qME?0{ z>?!LH57m4n9GR51l7ufDuN1AbTgU5J(c?9V*&K?W{2|S=gOuM7Vsk=kNVxgO4E$k+ z*PM&jZ|2B*I_Y4jXEQCQuOVS)=Ms)~3gqZPKN`jy`MIZ~yO~kSUFU?{jO_GTZ}adD z4rah*Nr)YCNI3Y0jL``g?qqoOQw_wx JnD10*O3D>t?aAxmmM zgl0SO?R@Z)O6SOhNKo?Er^BG&10*PkEH?}aK0tzE&)j7fe1HVSu(^BMf)9|Ol*HUv zE$e--Ef0~PWV)2)6=EF;iotV(v)}_HDAFT0Cd ItErnCP;J65hAVT@?v>p3a~Tq<@@l)x7g;L-3F) zX4c&lKkk#1%eD+O9q-4-^!hgGW@sy6eNYmLe^2JeO-X2GzdW^pHe3xa1&&U_huaMu zEt|gyT=qA5OG5bW_fjxru14599h^yy%7oDHX*veBZiBzwng&c(r+>(%QO0gS!n2Z4 zVEpJObLnw0t=YqnaLD4O07`DtQ|bF|@V^Czu7n|%TJG)-tAm7(k7VL8Zh!5oXYQE% z2MN!*Cp0rN{2X;iI8% r2OBs6bd zwPp-M!gmo)>e6&F--j-Ngr^~)Iaf1}=r@FQB$(OBoQ^)Wa=1CHztZDcO*-_O1T)E% zA-;#e<~%tw2~$46&U+Ob*1Gjh;bUuQrcZxqke-FpUwR7??jRBQcV6`8Ch53bJoMQy zqD0cu0WA+vrwEYbg_UJdzInkxonAzLZkUb>!A(iTu(=UiFg+y^d*+62!Ss|w%$OU) zpPJNrf(WK0p8FJFpFG0MdP*Y6EBTHJrl%y5vvO~(%!<*|mkUbbMfB(TbX*8cN+M>- zjroG<$vaphH~9H)R}?r%R^X5j83vNI03<|@f#h^t#$Sd(4)43_=mxC)MA8F&JmS60 z)5S~BMsV=YbPME_c9)*N9~zFe>_+rm98|>0tgFShAOpFimD6Al>K^TtjWVArC6%;z zRG#AQ_-LfL>(&kJju^xuB08;&4|E8z@)kVhstpGtM=m0L!xA_1!hFM{5>|X&!8?5i z7nAVTXp(;j71z3>op-sW%i#K32s>XIdk(TUeLrQ+4*vA)^tDpYR0(BORwZnaP~?j4 zbSRH3`y_`bpIf_s@y+${-%U1)_dA1h)=Zo0s0LFc>Q2@4xztmc!mgPM!l0EzZhxEQ z7GLG+--Huz>I ~s=(9(AO0OhV&~aBq{fmo@7#1QSA 6a%O9tAIgjzKnf`s8%fzVA8 z(J2Ey#9Jc|wk4sLlcjU$Vy1AUoF(|v(auC3!`Kc9r{s=S%4mh}{tRr9FzXgtWu&$7 z{ wU@<2$U0-_-729uIoMW|dXtL6m+8o|%Szc6c0zn} zIcoeaAyGmVu4CQ2U7qq5g;~0pN2imY_Q84*>b3dNmYtc;yOB`m+?)Hb!OC}Q{T8%! za$!$9A`-4KyC U6Jopf#sB~S07*qoM6N<$f|v_0-T(jq literal 0 HcmV?d00001 diff --git a/Images/PreLoad.gif b/Images/PreLoad.gif new file mode 100644 index 0000000000000000000000000000000000000000..0cc673abc724dca86bf619acfe073bca1260c489 GIT binary patch literal 8889 zcmX9?by!pH+n@0h5Cp%XbPN=v6;N6^(v3>@knZl9ba&_I8aX;gH%NDPr!?C;ulM<5 z*SVhE_owdr{By)5#dvsiA3dFTd z5C{T*AW#ql{jU%TfS^zi6b*ubKrjFVgMwga5E2AJ0w5$5ghYeT7%%{YhJw&&Fa{C? zfI(0&2n_~ zHm36aqp+ zz#s@1fPkS8FdBl%0|N;_ApjZz0YM-D1OkOX&=4plCkz!70!2e$AP5YAz@QKq8iE8t zkN^Y;g&@%oOrjW3Xeb1Y$q4jM(Z4`3en6NwFwQZ?Fn<2Y{3jGs2g1-`5HSsyI?NUH z-$6rRASeug!k|zX8j1u#kpL74g(A^V%#<)jF|}wk3^O8(OH3gM4FiK0Kd&`1af2?3B0C=!B3LP1C<@J}Wb zjf8=aFaQaIB4KDG5`;toNF)@AL?bcVgc%6N6B_+*l|aBhL!f`lgxMR+ieNV2-+lqW zKbOG2Az|i$i5`>ezoml$|Exp*naB9VSi&gA2*qf^&|}aspqPG4Ddvgh<|zmS(gm?# zenJ1<2>=@fLgP?Kl*8J5unCzod&@IB0$#qAN|mU{>Ixy@G+pSe$nJ>%3kOq3R_64@ zFensh_EqK%Bz)BCPnAUE4W;nd?Je{n@<%eLAAvwpRRyEj5;06#{Z)nI`QIg HGXT7xO2Yv8j8 lOFwlm~0Jtv0UfH?5$ARvm+Dz90Ydm191k*s-RzK)+MFDRFKYvME6 zhSH&yMc6N9);Sf+kDzMYmX4=;tO#0L?ib<;nI9~8nbD0~y0vLSV_&uwoSx7+LG04s z7{iS5pU*6M;mHwYIupe^()`Bq7o(DSH0-zJ-W?X88~FaGDorq>m@mwBtuP@rSbVfj zN1alATT_VlSFdhFc{9VRkAU`6W|;7^LM^}NZ1rg|)HR)1zpnc7mjkJo81 oE zh)HWxbk1KyHCdCDUME2iT{WSWA6N?XESPckT*HVh|E@V|gin>F2BceV$(`aZ$GNpL zn{FoDB{9GYe-@2a FfU@AwWcY%q|=cv#ROHO6U<}+M{PfdP!HF|PuVLX z-nQ1<+nM!WUnI0XCVQ#;M5O;@XT0?p$I0(^?Fvta;;5(I(EToN9C*at+qSR!hofnq z>JcSR+tP%U9cmZ$T;)3Qp~Ctdje91ZkwiyXUAaHcU?#rPObNl+NdOAK%X&Gx) bu|x9Df$hZTrOKOPNIzsL&hC=lZ=0(@*QvdK#rB*dl0uH!Cp z7?cXc75c}#f~#^r8th2xNsa#=uFB(?+?KWLA9p#b$_JFT<$a_ktnsT0Bqq0h#Pm-X zvsD*<7u{0GmYRgfRTrstZ7L!9Csiz~iy@+$DjiZ&^5NBR gW-MOv^8mh?ipIC4 zV96RJ>w(F)*K@DPt`OOxM>f>NL`b}8uhO4zHFff;`K|bdh4rxrYkm#dNv^u7N!C&D z>&yXdWuX~|ExXz-&2!#@DqiX17)zq%bLC_Hkf6A8!<_oAWJARKV{49S>6$a$A!isf zYaw5c07N#T>TrH2Ew#94mT}M~ps@UkWM1_#;UKb0fq0xYA;ZVTvWaY%%um#qE5f<1 zjdiK~ZY<$5euy;kwSi@rcy0D8=3~n~gq5~7-o`S`k(~$|U3hNR`qpTnB#lUl$>YS< zx93)^|7mgHr5r#eY>lmbnHL|G;Pw5jex9w4{|1$y>&{~~%Vthe%Hh)^-bkYHX{h{e zKD>-Ln>&EF;p#1C+XO}3w=KCaXXV87w0ka&o0}0u{EO5+$5kQ1D9=E-vlQY*gAW~t zqZ>4pd51>7c9;}x-Nnuexa$pB+~)Wom+ComT6;>_u316&QpMEw`i?h=LZkbfIbE6n zvwXtPi=pZeC#?-B6wZuXcx6>S<>&r>(kU)fXh{;@+LI8Tt{zU^!k$Y$R!T{8=C8G{ z)6(V?2S^NE_U&uds}EV7$fa=y$K8JXrTxfSG&>$mV&pqP{xF=-T`R{^n9#fSWh6zp zpKZQbLB*1DTBYf~bemqLE#vLyFZ~$Zoe?P7qk|11m3juj`hEukYbaWO^6yr4FT3cO zRPz1SK$lB@47pvxdF>)+hSHE<`Z@Ncz|LbzzOe+9P%h`g?zjNoM1HASp~AzSUJc(= zEtPSJ-NSy19p6lk9Ct;`!-3NU-`uqJM+D;GP)LP;VH@A3e*EDm!IppN%95n{{NY%* zhJOXCjJTB$b&~o@V2#-7eHSO{RKmY$V_@gHPoss|zqM&=vgT&ktKux3z+)Hqa62{< zc#$XX(fPgXcIy1yd1=IhEab!8T*$~}-8RLc-H6-pCF)9H{>w?gGWQxewOYGi%UN~z z?IwT5%}9hNb*{XJ?B~|o8MN(XElNIN!_Mn&3H|l5 %$TE z*ZXzB`