CDL.Discrete.Examples

Collection of models that illustrate model use and test models

Information

This package contains examples for the use of models that can be found in CDL.Discrete.

Package Content

Name Description
CDL.Discrete.Examples.FirstOrderHold FirstOrderHold Example model for the FirstOrderHold block
CDL.Discrete.Examples.Sampler Sampler Example model for the Sampler block
CDL.Discrete.Examples.TriggeredMax TriggeredMax Example model for the TriggeredMax block
CDL.Discrete.Examples.TriggeredMovingMean TriggeredMovingMean Validation model for the TriggeredMovingMean block
CDL.Discrete.Examples.TriggeredSampler TriggeredSampler Example model for the TriggeredSampler block
CDL.Discrete.Examples.UnitDelay UnitDelay Example model for the UnitDelay block
CDL.Discrete.Examples.ZeroOrderHold ZeroOrderHold Example model for the ZeroOrderHold block

CDL.Discrete.Examples.FirstOrderHold CDL.Discrete.Examples.FirstOrderHold

Example model for the FirstOrderHold block

CDL.Discrete.Examples.FirstOrderHold

Information

Validation test for the block CDL.Discrete.FirstOrderHold.

Modelica definition

model FirstOrderHold "Example model for the FirstOrderHold block" CDL.Discrete.FirstOrderHold firOrdHol( samplePeriod=0.2) "Block that first order hold of a sampled-data system"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Cos cos1 "Block that outputs the cosine of the input"; equation connect(ramp1.y,cos1.u); connect(cos1.y,firOrdHol.u); end FirstOrderHold;

CDL.Discrete.Examples.Sampler CDL.Discrete.Examples.Sampler

Example model for the Sampler block

CDL.Discrete.Examples.Sampler

Information

Validation test for the block CDL.Discrete.Sampler.

Modelica definition

model Sampler "Example model for the Sampler block" CDL.Discrete.Sampler sampler1( samplePeriod=0.2) "Ideal sampler of a continuous signal"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; equation connect(ramp1.y,sin1.u); connect(sin1.y,sampler1.u); end Sampler;

CDL.Discrete.Examples.TriggeredMax CDL.Discrete.Examples.TriggeredMax

Example model for the TriggeredMax block

CDL.Discrete.Examples.TriggeredMax

Information

Validation test for the block CDL.Discrete.TriggeredMax.

Modelica definition

model TriggeredMax "Example model for the TriggeredMax block" CDL.Discrete.TriggeredMax triggeredMax "Output the maximum, absolute value of a continuous signal at trigger instants"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; CDL.Logical.Sources.Pulse booPul( width=0.5, period=0.2) "Block that outputs cyclic on and off"; equation connect(ramp1.y,sin1.u); connect(sin1.y,triggeredMax.u); connect(booPul.y,triggeredMax.trigger); end TriggeredMax;

CDL.Discrete.Examples.TriggeredMovingMean CDL.Discrete.Examples.TriggeredMovingMean

Validation model for the TriggeredMovingMean block

CDL.Discrete.Examples.TriggeredMovingMean

Information

Validation test for the block CDL.Discrete.TriggeredMovingMean.

Modelica definition

model TriggeredMovingMean "Validation model for the TriggeredMovingMean block" CDL.Continuous.Sources.Sin sin( freqHz=1/8, phase=0.5235987755983, startTime=-0.5) "Example input signal"; CDL.Logical.Sources.Pulse booPul( width=0.5, period=1, shift=-0.5) "Block that outputs trigger signals"; CDL.Discrete.TriggeredMovingMean triMovMea( n=3) "Triggered moving mean with 3 samples to average"; CDL.Discrete.TriggeredMovingMean triMovMea1( n=1) "Triggered moving mean with 1 sample to average"; CDL.Discrete.TriggeredMovingMean triMovMea2( n=3) "Triggered moving mean with 3 samples to average with a different trigger period"; CDL.Logical.Sources.Pulse booPul1( width=0.5, period=1) "Block that outputs trigger signals"; equation connect(sin.y,triMovMea.u); connect(booPul.y,triMovMea.trigger); connect(booPul.y,triMovMea1.trigger); connect(sin.y,triMovMea1.u); connect(booPul1.y,triMovMea2.trigger); connect(sin.y,triMovMea2.u); end TriggeredMovingMean;

CDL.Discrete.Examples.TriggeredSampler CDL.Discrete.Examples.TriggeredSampler

Example model for the TriggeredSampler block

CDL.Discrete.Examples.TriggeredSampler

Information

Validation test for the block CDL.Discrete.TriggeredSampler.

Modelica definition

model TriggeredSampler "Example model for the TriggeredSampler block" CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; CDL.Logical.Sources.Pulse booPul( width=0.5, period=0.2) "Block that outputs cyclic on and off"; CDL.Discrete.TriggeredSampler triSam "Triggered sampler wity y_start = 0"; CDL.Discrete.TriggeredSampler triSam1( y_start=1) "Triggered sampler with y_start = 1"; equation connect(ramp1.y,sin1.u); connect(sin1.y,triSam.u); connect(booPul.y,triSam.trigger); connect(sin1.y,triSam1.u); connect(booPul.y,triSam1.trigger); end TriggeredSampler;

CDL.Discrete.Examples.UnitDelay CDL.Discrete.Examples.UnitDelay

Example model for the UnitDelay block

CDL.Discrete.Examples.UnitDelay

Information

Validation test for the block CDL.Discrete.UnitDelay.

Modelica definition

model UnitDelay "Example model for the UnitDelay block" CDL.Discrete.UnitDelay unitDelay1( samplePeriod=0.2) "Sample period of component"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; equation connect(ramp1.y,sin1.u); connect(sin1.y,unitDelay1.u); end UnitDelay;

CDL.Discrete.Examples.ZeroOrderHold CDL.Discrete.Examples.ZeroOrderHold

Example model for the ZeroOrderHold block

CDL.Discrete.Examples.ZeroOrderHold

Information

Validation test for the block CDL.Discrete.ZeroOrderHold.

Modelica definition

model ZeroOrderHold "Example model for the ZeroOrderHold block" CDL.Discrete.ZeroOrderHold zerOrdHol( samplePeriod=0.2) "Output the input signal with a zero order hold"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Cos cos1 "Block that outputs the cosine of the input"; equation connect(ramp1.y,cos1.u); connect(cos1.y,zerOrdHol.u); end ZeroOrderHold;