LinearDependency

block LinearDependency "Output a linear combination of the two inputs"
    extends Modelica.Blocks.Interfaces.SI2SO;

    parameter Real y0 = 0 "Initial value";
    parameter Real k1 = 0 "u1 dependency";
    parameter Real k2 = 0 "u2 dependency";
equation
    y = y0 * (1 + k1 * u1 + k2 * u2);

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-100, 60}, 
                        {100, 0}, 
                        {-100, -60}},
                    color = {0, 0, 127}), 
                Text(
                    extent = {
                        {-14, 88}, 
                        {94, 32}},
                    textString = "%k1"), 
                Text(
                    extent = {
                        {-40, -48}, 
                        {96, -96}},
                    textString = "%k2"), 
                Text(
                    extent = {
                        {-94, 26}, 
                        {8, -30}},
                    textString = "%y0")}),
        Documentation(info = "<html>\n<p>Determine the linear combination of the two inputs: <code>y = y0*(1 + k1*u1 + k2*u2)</code></p>\n<p><strong>Note</strong>, for y0=0 the output is always zero.</p>\n<p>To improve the implementation, the formula will be changed (non-backwards compatible) in the future: <code>y = y0 + k1*u1 + k2*u2</code></p>\n</html>"));
end LinearDependency;