Block Diagram Components - SO - SISO

Gallery
Tutorial
Click on the image to view it full size

The Modelica By Example target code is:


connector RealInput = input Real "'input Real' as connector";
connector RealOutput = output Real "'output Real' as connector";

partial block SO "Single Output continuous control block"
  extends Modelica.Blocks.Icons.Block;

  RealOutput y "Connector of Real output signal" annotation ...
end SO;

within ModelicaByExample.Components.BlockDiagrams.Components;
block Constant "A constant source"
  parameter Real k "Constant output value";
  extends Icons.Axes;
  extends Interfaces.SO;
equation
  y = k;
end Constant;

partial block SISO "Single Input Single Output continuous control block"
  extends Modelica.Blocks.Icons.Block;

  RealInput u "Connector of Real input signal" annotation ...
  RealOutput y "Connector of Real output signal" annotation ...
end SISO;

within ModelicaByExample.Components.BlockDiagrams.Components;
block Gain "A gain block model"
  extends Interfaces.SISO;
  parameter Real k "Gain coefficient";
equation
  y = k*u;
end Gain;

within ModelicaByExample.Components.BlockDiagrams.Components;
block Integrator
  "This block integrates the input signal to compute the output signal"
  parameter Real y0 "Initial condition";
  extends Interfaces.SISO;
initial equation
  y = y0;
equation
  der(y) = u;
end Integrator;

In this SysML trail version, instead of using the RealSignalInElement and RealSignalOutElement from the SysPhS Library directly they are extended so custom stereotype icons can be introduced.

The exported complete Modelica code for the SysML/SysPhS blocks is:


  model SO
    Modelica.Blocks.Interfaces.RealOutput y;
  end SO;

  model Constant
    extends SO;
    parameter Real k;
  equation

  model SISO
    Modelica.Blocks.Interfaces.RealInput u;
    Modelica.Blocks.Interfaces.RealOutput y;
  end SISO;

  model Gain
    extends SISO;
    parameter Real k;
  equation
    y=k*u;
  end Gain;

  model Integrator
    extends SISO;
    parameter Real _y0;
  equation
    der(y)=u;
  end Integrator;
For Integrator the parameter _y0 is «UNUSED» and we'll need to use a workaround for the initial value again:
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links