Accelerate

model Accelerate "Forced movement of a flange according to an acceleration signal"
    extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryOneFlangeAndSupport2(s(start = 0, fixed = true, stateSelect = StateSelect.prefer));

    SI.Velocity v(start = 0, fixed = true, stateSelect = StateSelect.prefer) "Absolute velocity of flange";
    SI.Acceleration a "Absolute acceleration of flange";
    Modelica.Blocks.Interfaces.RealInput a_ref(unit = "m/s2") "Absolute acceleration of flange as input signal"
        annotation (Placement(transformation(extent = {
            {-140, -20}, 
            {-100, 20}})));
equation
    a = a_ref;
    a = der(v);
    v = der(s);

    annotation (
        Documentation(info = "<html>\n<p>\nThe input signal <strong>a</strong> in [m/s2] moves the 1D translational flange\nconnector flange with a predefined <em>acceleration</em>, i.e., the flange\nis <em>forced</em> to move relative to the support connector  with this acceleration. The velocity and the\nposition of the flange are also predefined and are determined by\nintegration of the acceleration.\n</p>\n<p>\nThe acceleration \"a(t)\" can be provided from one of the signal generator\nblocks of the block library Modelica.Blocks.Source.\n</p>\n\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-30, -32}, 
                        {30, -32}},
                    color = {0, 127, 0}), 
                Line(
                    points = {
                        {0, -32}, 
                        {0, -100}},
                    color = {0, 127, 0}), 
                Rectangle(
                    extent = {
                        {-100, 20}, 
                        {100, -20}},
                    lineColor = {0, 127, 0},
                    fillColor = {160, 215, 160},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-29, 32}, 
                        {30, 32}},
                    color = {0, 127, 0}), 
                Line(
                    points = {
                        {0, 52}, 
                        {0, 32}},
                    color = {0, 127, 0}), 
                Text(
                    extent = {
                        {150, 60}, 
                        {-150, 100}},
                    textString = "%name",
                    lineColor = {0, 0, 255}), 
                Text(
                    extent = {
                        {-140, -60}, 
                        {-40, -30}},
                    lineColor = {128, 128, 128},
                    horizontalAlignment = TextAlignment.Right,
                    textString = "a_ref")}));
end Accelerate;