model Move "Forced movement of a flange according to a position, velocity and acceleration signal"
extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryOneFlangeAndSupport2;
Modelica.Blocks.Interfaces.RealInput u[3] "Position, velocity and acceleration of flange as input signals"
annotation (Placement(transformation(extent = {
{-140, -20},
{-100, 20}})));
protected
function position
extends Modelica.Icons.Function;
input Real q_qd_qdd[3] "Required values for position, speed, acceleration";
input Real dummy "Just to have one input signal that should be differentiated to avoid possible problems in the Modelica tool (is not used)";
output Real q;
algorithm
q := q_qd_qdd[1];
annotation (
derivative(noDerivative = q_qd_qdd) = position_der,
LateInline = true);
end position;
function position_der
extends Modelica.Icons.Function;
input Real q_qd_qdd[3] "Required values for position, speed, acceleration";
input Real dummy "Just to have one input signal that should be differentiated to avoid possible problems in the Modelica tool (is not used)";
input Real dummy_der;
output Real qd;
algorithm
qd := q_qd_qdd[2];
annotation (
derivative(
noDerivative = q_qd_qdd,
order = 2) = position_der2,
LateInline = true);
end position_der;
function position_der2
extends Modelica.Icons.Function;
input Real q_qd_qdd[3] "Required values for position, speed, acceleration";
input Real dummy "Just to have one input signal that should be differentiated to avoid possible problems in the Modelica tool (is not used)";
input Real dummy_der;
input Real dummy_der2;
output Real qdd;
algorithm
qdd := q_qd_qdd[3];
end position_der2;
equation
s = position(u, time);
annotation (
Documentation(info = "<html>\n<p>\nFlange <strong>flange_b</strong> is <strong>forced</strong> to move relative to the support connector with a predefined motion\naccording to the input signals:\n</p>\n<pre>\n u[1]: position of flange\n u[2]: velocity of flange\n u[3]: acceleration of flange\n</pre>\n<p>\nThe user has to guarantee that the input signals are consistent to each other,\ni.e., that u[2] is the derivative of u[1] and that\nu[3] is the derivative of u. There are, however,\nalso applications where by purpose these conditions do not hold. For example,\nif only the position dependent terms of a mechanical system shall be\ncalculated, one may provide position = position(t) and set the velocity\nand the acceleration to zero.\n</p>\n<p>\nThe input signals can be provided from one of the signal generator\nblocks of the block library Modelica.Blocks.Sources.\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 = {
{0, 52},
{0, 32}},
color = {0, 127, 0}),
Line(
points = {
{-29, 32},
{30, 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 = "s,v,a")}));
end Move;