Buildings.Controls.OBC.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 Buildings.Controls.OBC.CDL.Discrete.

Package Content

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

Buildings.Controls.OBC.CDL.Discrete.Examples.FirstOrderHold Buildings.Controls.OBC.CDL.Discrete.Examples.FirstOrderHold

Example model for the FirstOrderHold block

Buildings.Controls.OBC.CDL.Discrete.Examples.FirstOrderHold

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.FirstOrderHold.

Modelica definition

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

Buildings.Controls.OBC.CDL.Discrete.Examples.Sampler Buildings.Controls.OBC.CDL.Discrete.Examples.Sampler

Example model for the Sampler block

Buildings.Controls.OBC.CDL.Discrete.Examples.Sampler

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.Sampler.

Modelica definition

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

Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredMax Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredMax

Example model for the TriggeredMax block

Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredMax

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.TriggeredMax.

Modelica definition

model TriggeredMax "Example model for the TriggeredMax block" Buildings.Controls.OBC.CDL.Discrete.TriggeredMax triggeredMax "Output the maximum, absolute value of a continuous signal at trigger instants"; Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sin sin1 "Block that outputs the sine of the input"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredMovingMean Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredMovingMean

Validation model for the TriggeredMovingMean block

Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredMovingMean

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean.

Modelica definition

model TriggeredMovingMean "Validation model for the TriggeredMovingMean block" Buildings.Controls.OBC.CDL.Reals.Sources.Sin sin( freqHz=1/8, phase=0.5235987755983, startTime=-0.5) "Example input signal"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul( width=0.5, period=1, shift=-0.5) "Block that outputs trigger signals"; Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean triMovMea( n=3) "Triggered moving mean with 3 samples to average"; Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean triMovMea1( n=1) "Triggered moving mean with 1 sample to average"; Buildings.Controls.OBC.CDL.Discrete.TriggeredMovingMean triMovMea2( n=3) "Triggered moving mean with 3 samples to average with a different trigger period"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredSampler Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredSampler

Example model for the TriggeredSampler block

Buildings.Controls.OBC.CDL.Discrete.Examples.TriggeredSampler

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler.

Modelica definition

model TriggeredSampler "Example model for the TriggeredSampler block" Buildings.Controls.OBC.CDL.Reals.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Reals.Sin sin1 "Block that outputs the sine of the input"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booPul( width=0.5, period=0.2) "Block that outputs cyclic on and off"; Buildings.Controls.OBC.CDL.Discrete.TriggeredSampler triSam "Triggered sampler wity y_start = 0"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Discrete.Examples.UnitDelay Buildings.Controls.OBC.CDL.Discrete.Examples.UnitDelay

Example model for the UnitDelay block

Buildings.Controls.OBC.CDL.Discrete.Examples.UnitDelay

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.UnitDelay.

Modelica definition

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

Buildings.Controls.OBC.CDL.Discrete.Examples.ZeroOrderHold Buildings.Controls.OBC.CDL.Discrete.Examples.ZeroOrderHold

Example model for the ZeroOrderHold block

Buildings.Controls.OBC.CDL.Discrete.Examples.ZeroOrderHold

Information

Validation test for the block Buildings.Controls.OBC.CDL.Discrete.ZeroOrderHold.

Modelica definition

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