Export to Modelica and execution of the SysML/SysPhS block TestBed for SignalProcessing

Gallery
Tutorial
Click on the image to view it full size

The export of block TestBed from the MagicDraw SysML Plugin or Magic Cyber-Systems Engineer® (Cameo Systems Modeler®) gives:

model TestBed
  TestBed _TestBed;
  model TestBed
    SignalProcessor signalProcessor;
    SignalSource inputSignal(amp.start=3.0,amp.fixed=true);
    SignalSink scopeSignalOutput;
  equation
    connect(inputSignal.y,signalProcessor.u);
    connect(signalProcessor.y,scopeSignalOutput.u);
  end TestBed;
  model SignalProcessor
    Modelica.Blocks.Interfaces.RealInput u;
    Modelica.Blocks.Interfaces.RealOutput y;
    Amplifier a(g.start=2.0,g.fixed=true);
    HighPassFilter hPF(xi.start=0.0,xi.fixed=true,alpha.start=0.01,alpha.fixed=true);
    LowPassFilter lPF(alpha.start=3.0,alpha.fixed=true,xi.start=0.0,xi.fixed=true);
    Mixer m;
  equation
    connect(u,a.u);
    connect(a.y,hPF.u);
    connect(a.y,lPF.u);
    connect(m.y,y);
    connect(hPF.y,m.u1);
    connect(lPF.y,m.u2);
  end SignalProcessor;
  model SignalSource
    parameter Real amp;
    Modelica.Blocks.Interfaces.RealOutput y;
  equation
    y=amp*sin(2*3.14*time)+3*sin(3.14*time)+10*sin(2*time);
  end SignalSource;
  model SignalSink
    Real scope;
    Modelica.Blocks.Interfaces.RealInput u;
  equation
    scope=u;
  end SignalSink;
  model Amplifier
    extends TwoPinSignalComponent;
    parameter Real g;
  equation
    y=u*g;
  end Amplifier;
  model HighPassFilter
    extends SimplePassFilter;
  equation
    der(xi)=(1/alpha)*u-(1/alpha)*xi;
    y=u-xi;
  end HighPassFilter;
  model LowPassFilter
    extends SimplePassFilter;
  equation
    der(xi)=(1/alpha)*u-(1/alpha)*xi;
    y=xi;
  end LowPassFilter;
  model Mixer
    Modelica.Blocks.Interfaces.RealInput u1;
    Modelica.Blocks.Interfaces.RealInput u2;
    Modelica.Blocks.Interfaces.RealOutput y;
  equation
    y=(u1+u2)/2;
  end Mixer;
  model TwoPinSignalComponent
    Modelica.Blocks.Interfaces.RealInput u;
    Modelica.Blocks.Interfaces.RealOutput y;
  end TwoPinSignalComponent;
  model SimplePassFilter
    extends TwoPinSignalComponent;
    parameter Time alpha;
    Real xi;
  end SimplePassFilter;
  type Time=Real(unit="s");
end TestBed;
Validation passes and gives:

Validation of model TestBed 
Warning: Parameter _TestBed.signalProcessor.a.g has no value, and is fixed during initialization (fixed = true), using available start value (start = 2.0) as default value.
Warning: Parameter _TestBed.signalProcessor.hPF.alpha has no value, and is fixed during initialization (fixed = true), using available start value (start = 0.01) as default value.
Warning: Parameter _TestBed.signalProcessor.lPF.alpha has no value, and is fixed during initialization (fixed = true), using available start value (start = 3.0) as default value.
Warning: Parameter _TestBed.inputSignal.amp has no value, and is fixed during initialization (fixed = true), using available start value (start = 3.0) as default value.
Validation of model TestBed completed successfully.
The model is globally balanced with 6 variables and 6 equations.
Among these, 6 equations are trivial.
The plot shows output values at various locations in the model from a typical simulation execution in Wolfram SystemModeler.
Up next
Next trail section
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)