model Move "Forced movement of a flange according to an angle, speed and angular acceleration signal"
extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2;
Modelica.SIunits.Angle phi "Rotation angle of flange with respect to support";
Modelica.Blocks.Interfaces.RealInput u[3] "Angle, angular velocity and angular acceleration of flange with respect to support 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
phi = flange.phi - phi_support;
phi = position(u, time);
annotation (
Documentation(info = "<html>\n<p>\nFlange <strong>flange</strong> is <strong>forced</strong> to move relative to flange support with a predefined motion\naccording to the input signals:\n</p>\n<pre>\n u[1]: angle of flange\n u[2]: angular velocity of flange\n u[3]: angular 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[2]. 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 angle = angle(t) and set the angular velocity\nand the angular 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</html>"),
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Rectangle(
lineColor = {64, 64, 64},
fillColor = {192, 192, 192},
fillPattern = FillPattern.HorizontalCylinder,
extent = {
{-100, -20},
{100, 20}}),
Line(points = {
{-30, -32},
{30, -32}}),
Line(points = {
{0, 52},
{0, 32}}),
Line(points = {
{-29, 32},
{30, 32}}),
Line(points = {
{0, -32},
{0, -100}}),
Text(
lineColor = {0, 0, 255},
extent = {
{-150, 60},
{150, 100}},
textString = "%name"),
Text(
extent = {
{-140, -60},
{-40, -30}},
lineColor = {128, 128, 128},
horizontalAlignment = TextAlignment.Right,
textString = "phi,w,a")}));
end Move;