Inertia

model Inertia "1D-rotational component with inertia"
    extends Rotational.Interfaces.PartialTwoFlanges;

    parameter SI.Inertia J(min = 0, start = 1) "Moment of inertia";
    parameter StateSelect stateSelect = StateSelect.default "Priority to use phi and w as states"
        annotation (
            HideResult = true,
            Dialog(tab = "Advanced"));
    SI.Angle phi(stateSelect = stateSelect) "Absolute rotation angle of component"
        annotation (Dialog(
            group = "Initialization",
            showStartAttribute = true));
    SI.AngularVelocity w(stateSelect = stateSelect) "Absolute angular velocity of component (= der(phi))"
        annotation (Dialog(
            group = "Initialization",
            showStartAttribute = true));
    SI.AngularAcceleration a "Absolute angular acceleration of component (= der(w))"
        annotation (Dialog(
            group = "Initialization",
            showStartAttribute = true));
equation
    J * a = flange_a.tau + flange_b.tau;
    a = der(w);
    w = der(phi);
    phi = flange_a.phi;
    phi = flange_b.phi;

    annotation (
        Documentation(info = "<html>\n<p>\nRotational component with <strong>inertia</strong> and two rigidly connected flanges.\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, -10}, 
                        {-50, 10}}), 
                Rectangle(
                    lineColor = {64, 64, 64},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.HorizontalCylinder,
                    extent = {
                        {50, -10}, 
                        {100, 10}}), 
                Line(points = {
                    {-80, -25}, 
                    {-60, -25}}), 
                Line(points = {
                    {60, -25}, 
                    {80, -25}}), 
                Line(points = {
                    {-70, -25}, 
                    {-70, -70}}), 
                Line(points = {
                    {70, -25}, 
                    {70, -70}}), 
                Line(points = {
                    {-80, 25}, 
                    {-60, 25}}), 
                Line(points = {
                    {60, 25}, 
                    {80, 25}}), 
                Line(points = {
                    {-70, 45}, 
                    {-70, 25}}), 
                Line(points = {
                    {70, 45}, 
                    {70, 25}}), 
                Line(points = {
                    {-70, -70}, 
                    {70, -70}}), 
                Rectangle(
                    lineColor = {64, 64, 64},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.HorizontalCylinder,
                    extent = {
                        {-50, -50}, 
                        {50, 50}},
                    radius = 10), 
                Text(
                    lineColor = {0, 0, 255},
                    extent = {
                        {-150, 60}, 
                        {150, 100}},
                    textString = "%name"), 
                Text(
                    extent = {
                        {-150, -120}, 
                        {150, -80}},
                    textString = "J=%J"), 
                Rectangle(
                    lineColor = {64, 64, 64},
                    fillColor = {255, 255, 255},
                    extent = {
                        {-50, -50}, 
                        {50, 50}},
                    radius = 10)}));
end Inertia;