Band Stop Filter with an Algebraic Loop - BlockImporter Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Toolboxes : BlockImporter : Examples : BlockImporter/Examples/AlgebraicLoop

Band Stop Filter with an Algebraic Loop

 

NOTE:  You will need to have an installed and functioning version of MATLAB® and Simulink® to run this example.

 

 

Section Layout

Import the System

Simulate the System

 

 

 

Initialization

Import the System

Simulate the System

Initialization

withBlockImporter

BuildDE,Import,PrintSummary,SimplifyModel

(1.1)

Import the System

This is an example of a band pass filter.  This example contains an algebraic loop, and therefore will not execute in Simulink.

 

We import the model with the following command.  We need to specify the name of the model to import, as well as a MATLAB® script that initializes the variable names.

 

datadirBlockImporter:-DataDirectory: 

model1  Importfilterb,path=datadir, init=filterb_init,inplace:

Warning: Block diagram 'temp_filterb' contains 1 algebraic loop(s). To see more details about the loops use the command line Simulink debugger by typing "sldebug temp_filterb" in the MATLAB command window. To eliminate this message, set the Algebraic loop option in the Diagnostics page of the Simulation Parameters Dialog to "None".
> In calsignal at 35
  In startrep at 127
Found algebraic loop containing:
  'temp_filterb/Gain'
  'temp_filterb/Derivative1'
  'temp_filterb/Gain2'
  'temp_filterb/Sum3'
  'temp_filterb/Sum1' (algebraic variable)

 

Using the PrintSummary command, we can view the model that we have imported.

 

PrintSummarymodel1

K0,c1=0.00100000000000000002,K0,c2=0.00100000000000000002,K0,r=1000.

(2.1)

 

We can now simplify the model to reduce the number of equations.

smodel1  SimplifyModelmodel1:

PrintSummarysmodel1

K0,c1=0.00100000000000000002,K0,c2=0.00100000000000000002,K0,r=1000.

(2.2)

Simulate the System

First we take the system and build a set of differential equations, and assign the result to the variable sys.

sys1  BuildDEsmodel1:

The following table illustrates the different components of the variable sys1.

Differential Equations

sys1:-equations

x2,1t=K0,c2SinkScope,8,1,1tSourceStep,9,1t,ⅆⅆtx7,1t=K0,rⅆⅆtx2,1tSourceStep,9,1t+x7,1tK0,rK0,c1,SinkScope,8,1,1t=K0,rⅆⅆtx2,1t+x7,1t

(3.1)

Parameter values

sys1:-parameters

K0,c1=0.00100000000000000002,K0,c2=0.00100000000000000002,K0,r=1000.

(3.2)

Initial conditions

sys1:-initialeqs

x2,10=0,x7,10=0

(3.3)

Equations for the sources (inputs)

sys1:-sourceeqs

SourceStep&comma;9&comma;1t&equals;&lcub;0t<11otherwise

(3.4)

List of sinks (outputs)

sys1:-outputvars

SinkScope&comma;8&comma;1&comma;1t

(3.5)

Using the information in the variable sys, we construct a simulation procedure.

sol1  dsolveevalevalsys1:-equations&comma; sys1:-sourceeqs&comma;sys1:-parameters&comma; sys1:-initialeqs&comma; numeric&comma;interr&equals;false

procx_rkf45_dae...end proc

(3.6)

Then we plot the simulation results.

plotsodeplotsol1&comma; t&comma; sys1:-outputvars1&comma; 0..20&comma; numpoints&equals;200&comma; title&equals;Step Response&comma;gridlines&equals;true


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam