IdealDifferential

model IdealDifferential "Ideal differential gear without inertia"
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a "Flange of driving shaft"
        annotation (Placement(transformation(extent = {
            {-10, -110}, 
            {10, -90}})));
    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_left "Flange of left shaft"
        annotation (Placement(transformation(extent = {
            {-110, -10}, 
            {-90, 10}})));
    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_right "Flange of right shaft"
        annotation (Placement(transformation(extent = {
            {90, -10}, 
            {110, 10}})));
    parameter Real ratio = 1 "Transmission ratio (2 * flange_a.phi / (flange_left.phi + flange_right.phi))";
equation
    2 * flange_a.phi = ratio * (flange_left.phi + flange_right.phi);
    flange_a.tau * ratio = -flange_left.tau;
    flange_left.tau = flange_right.tau;

    annotation (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}, 
                    {100, 10}}), 
            Rectangle(
                origin = {0, -50},
                lineColor = {64, 64, 64},
                fillColor = {192, 192, 192},
                fillPattern = FillPattern.VerticalCylinder,
                extent = {
                    {-10, -50}, 
                    {10, 50}}), 
            Ellipse(
                lineColor = {137, 137, 137},
                fillColor = {192, 192, 192},
                fillPattern = FillPattern.HorizontalCylinder,
                extent = {
                    {-40, 30}, 
                    {40, -30}}), 
            Ellipse(extent = {
                {-40, 30}, 
                {40, -30}}), 
            Rectangle(
                lineColor = {144, 144, 144},
                fillColor = {192, 192, 192},
                fillPattern = FillPattern.HorizontalCylinder,
                extent = {
                    {-40, 20}, 
                    {40, -20}}), 
            Line(
                origin = {-35, 0},
                points = {
                    {5, 20}, 
                    {-5, 20}, 
                    {-5, -20}, 
                    {5, -20}}), 
            Line(
                origin = {35, 0},
                points = {
                    {-5, 20}, 
                    {5, 20}, 
                    {5, -20}, 
                    {-5, -20}})}));
end IdealDifferential;