ConstantTorque

model ConstantTorque "Constant torque, not dependent on speed"
    extends Rotational.Interfaces.PartialTorque;

    parameter Modelica.SIunits.Torque tau_constant "Constant torque (if negative, torque is acting as load in positive direction of rotation)";
    Modelica.SIunits.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))";
    Modelica.SIunits.Torque tau "Accelerating torque acting at flange (= -flange.tau)";
equation
    w = der(phi);
    tau = tau_constant;
    tau = -flange.tau;

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-75, 10}, 
                        {75, 10}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {0, 60}, 
                        {0, 0}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {-75, 30}, 
                        {75, 30}},
                    color = {0, 0, 127}), 
                Text(
                    extent = {
                        {-120, -40}, 
                        {120, -10}},
                    textString = "%tau_constant")}),
        Documentation(info = "<html>\n<p>Model of constant torque, not dependent on angular velocity of flange.</p>\n<p>Please note:<br>\nPositive torque accelerates in positive direction of rotation, but brakes in reverse direction of rotation.<br>\nNegative torque brakes in positive direction of rotation, but accelerates in reverse direction of rotation.</p>\n</html>"));
end ConstantTorque;