block Add "Output the sum of the two inputs"
extends Interfaces.SI2SO;
parameter Real k1 = 1 "Gain of input signal 1";
parameter Real k2 = 1 "Gain of input signal 2";
equation
y = k1 * u1 + k2 * u2;
annotation (
Documentation(info = "<html>\n<p>\nThis blocks computes output <strong>y</strong> as <em>sum</em> of the\ntwo input signals <strong>u1</strong> and <strong>u2</strong>:\n</p>\n<blockquote><pre>\n<strong>y</strong> = k1*<strong>u1</strong> + k2*<strong>u2</strong>;\n</pre></blockquote>\n<p>\nExample:\n</p>\n<blockquote><pre>\n parameter: k1= +2, k2= -3\n\nresults in the following equations:\n\n y = 2 * u1 - 3 * u2\n</pre></blockquote>\n\n</html>"),
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{-100, 60},
{-74, 24},
{-44, 24}},
color = {0, 0, 127}),
Line(
points = {
{-100, -60},
{-74, -24},
{-44, -24}},
color = {0, 0, 127}),
Ellipse(
lineColor = {0, 0, 127},
extent = {
{-50, -50},
{50, 50}}),
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 127}),
Text(
extent = {
{-40, 40},
{40, -40}},
textString = "+"),
Text(
extent = {
{-100, 52},
{5, 92}},
textString = "%k1"),
Text(
extent = {
{-100, -92},
{5, -52}},
textString = "%k2")}),
Diagram(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 255}),
Line(
points = {
{50, 0},
{100, 0}},
color = {0, 0, 127})}));
end Add;