block Add "Output the sum of the two inputs"
extends Interfaces.ComplexSI2SO;
parameter Complex k1 = Complex(1, 0) "Gain of input 1";
parameter Complex k2 = Complex(1, 0) "Gain of input 2";
equation
y = k1 * u1Internal + k2 * u2Internal;
annotation (
Documentation(info = "<html>\n<p>\nThis blocks computes output <code>y</code> as <em>sum</em> of the\ntwo input signals <code>u1</code> and <code>u2</code>. Optionally, either input <code>u1</code> or <code>u2</code> or both inputs can be processed conjugate complex, when parameters <code>useConjugateInput1</code> and <code>useConjugateInput2</code> are <code>true</code>, respectively.\n</p>\n<pre>\n y = k1*u1Internal + k2*u2Internal;\n</pre>\n<p>\n<strong>Example</strong> parameters:\n</p>\n<ul>\n<li><code>k1 = +2</code>,</li>\n<li><code>k2 = -3</code>,</li>\n<li><code>useConjugateInput1 = true</code>,</li>\n<li><code>useConjugateInput2 = false</code></li>\n</ul>\n<p>\nresult in the following equation:\n</p>\n<pre>\n y = 2 * Modelica.ComplexMath.conj(u1) - 3 * u2\n</pre>\n\n</html>"),
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Text(
extent = {
{-98, -52},
{7, -92}},
textString = "%k2"),
Text(
extent = {
{-100, 90},
{5, 50}},
textString = "%k1"),
Line(
points = {
{-100, 60},
{-40, 60},
{-30, 40}},
color = {0, 0, 255}),
Ellipse(
extent = {
{-50, 50},
{50, -50}},
lineColor = {0, 0, 255}),
Line(
points = {
{-100, -60},
{-40, -60},
{-30, -40}},
color = {0, 0, 255}),
Line(points = {
{-15, -25.99},
{15, 25.99}}),
Rectangle(
extent = {
{-100, -100},
{100, 100}},
lineColor = {0, 0, 127},
fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid),
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 255}),
Line(
points = {
{-100, 60},
{-74, 24},
{-44, 24}},
color = {0, 0, 127}),
Line(
points = {
{-100, -60},
{-74, -28},
{-42, -28}},
color = {0, 0, 127}),
Ellipse(
extent = {
{-50, 50},
{50, -50}},
lineColor = {0, 0, 127}),
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 127}),
Text(
extent = {
{-38, 34},
{38, -34}},
textString = "+"),
Text(
extent = {
{-100, 52},
{5, 92}},
textString = "%k1"),
Text(
extent = {
{-100, -52},
{5, -92}},
textString = "%k2")}),
Diagram(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Rectangle(
extent = {
{-100, -100},
{100, 100}},
lineColor = {0, 0, 255},
fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid),
Text(
extent = {
{-98, -52},
{7, -92}},
textString = "%k2"),
Text(
extent = {
{-100, 90},
{5, 50}},
textString = "%k1"),
Line(
points = {
{-100, 60},
{-40, 60},
{-30, 40}},
color = {0, 0, 255}),
Ellipse(
extent = {
{-50, 50},
{50, -50}},
lineColor = {0, 0, 255}),
Line(
points = {
{-100, -60},
{-40, -60},
{-30, -40}},
color = {0, 0, 255}),
Line(points = {
{-15, -25.99},
{15, 25.99}}),
Rectangle(
extent = {
{-100, -100},
{100, 100}},
lineColor = {0, 0, 127},
fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid),
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 255}),
Line(
points = {
{-100, 60},
{-74, 24},
{-44, 24}},
color = {0, 0, 127}),
Line(
points = {
{-100, -60},
{-74, -28},
{-42, -28}},
color = {0, 0, 127}),
Ellipse(
extent = {
{-50, 50},
{50, -50}},
lineColor = {0, 0, 127}),
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 127}),
Text(
extent = {
{-38, 34},
{38, -34}},
textString = "+"),
Text(
extent = {
{-100, 52},
{5, 92}},
textString = "k1"),
Text(
extent = {
{-100, -52},
{5, -92}},
textString = "k2")}));
end Add;