Sampler

block Sampler "Ideal sampling of continuous signals"
    extends Interfaces.DiscreteSISO;
equation
    when {sampleTrigger, initial()} then 
        y = u;
    end when;

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Ellipse(
                    lineColor = {0, 0, 127},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid,
                    extent = {
                        {25, -10}, 
                        {45, 10}}), 
                Line(
                    points = {
                        {-100, 0}, 
                        {-45, 0}},
                    color = {0, 0, 127}), 
                Line(
                    points = {
                        {45, 0}, 
                        {100, 0}},
                    color = {0, 0, 127}), 
                Line(
                    points = {
                        {-35, 0}, 
                        {30, 35}},
                    color = {0, 0, 127}), 
                Ellipse(
                    lineColor = {0, 0, 127},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid,
                    extent = {
                        {-45, -10}, 
                        {-25, 10}})}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Ellipse(
                    extent = {
                        {-25, -10}, 
                        {-45, 10}},
                    lineColor = {0, 0, 255},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Ellipse(
                    extent = {
                        {45, -10}, 
                        {25, 10}},
                    lineColor = {0, 0, 255},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-100, 0}, 
                        {-45, 0}},
                    color = {0, 0, 255}), 
                Line(
                    points = {
                        {45, 0}, 
                        {100, 0}},
                    color = {0, 0, 255}), 
                Line(
                    points = {
                        {-35, 0}, 
                        {30, 35}},
                    color = {0, 0, 255})}),
        Documentation(info = "<html>\n<p>\nSamples the continues input signal with a sampling rate defined\nvia parameter <strong>samplePeriod</strong>.\n</p>\n</html>"));
end Sampler;