I'm new to Modelica and try to apply my quite limited knowledges to model a quite simple physics problem. Here is its description:
You are responsible for sizing a motor operating a valve to regulate the water level in a tank supplying a water jet system. The control valve is made up of two discs pierced with holes, one of which can slide relative to the other, in vertical translation. This makes it possible to modify the water passage section and control the flow rate: when the holes of the 2 discs are face to face, the flow rate is maximum, when they are entirely offset, the flow rate is zero. The representation of the kinematic chain as well as a photograph of the valve are given below:
The mechanical data is as follows:
The translation speed v of the valve's pierced disc must be set at 1.67.10^-4 m/s The screw pitch p (vertical displacement corresponding to one rotation of the valve control) is 4 mm.
The maximum force F allowing the valve to translate is 20 kN.
The efficiency ηv of the screw-nut system is 26%
The efficiency ηR of the gearbox is 22% and its reduction ratio K is 560.
I'd like my model be able to answer the following questions:
I wonder if a Modelica model can be build to answer this kind of question or not.
Currently my model is quite limited
The first problem I encountered is that I have to answer by hand questions to know motor speed. Is Modelica able to inverse model to know that ?
An other problem is that I don't know how to apply constant force of 20kN in my model.
This is a very import point as it will result in the expense of power
Here is the code of my model:
model Vanne
Modelica.Mechanics.Translational.Components.IdealGearR2T idealGearR2T(ratio = 1571) annotation(
Placement(visible = true, transformation(origin = {34, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Sensors.SpeedSensor speedSensor annotation(
Placement(visible = true, transformation(origin = {72, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed(w_fixed(displayUnit = "rpm") = 146.9218164328827) annotation(
Placement(visible = true, transformation(origin = {-58, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.LossyGear lossyGear(lossTable = [0, 0.22, 0.22, 0], ratio = 560) annotation(
Placement(visible = true, transformation(origin = {-22, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor1 annotation(
Placement(visible = true, transformation(origin = {10, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Sources.ConstantForce constantForce annotation(
Placement(visible = true, transformation(origin = {64, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(idealGearR2T.flangeT, speedSensor.flange) annotation(
Line(points = {{44, -2}, {62, -2}}, color = {0, 127, 0}));
connect(constantSpeed.flange, lossyGear.flange_a) annotation(
Line(points = {{-48, -2}, {-32, -2}}));
connect(lossyGear.flange_b, idealGearR2T.flangeR) annotation(
Line(points = {{-12, -2}, {24, -2}}));
connect(speedSensor1.flange, lossyGear.flange_b) annotation(
Line(points = {{0, 38}, {-12, 38}, {-12, -2}}));
annotation(
uses(Modelica(version = "4.0.0")));
end Vanne;
I have built something that should answer most of your questions:
Vanne.Inverse
: Sets the translational speed to compute the rotationals speeds at both sides of the gear.Vanne.Forward
: Sets the angular velocity to compute torques and power requested.Note:
Vanne.Components.LossyR2G
, which should be a R2T element with an efficiency (hope I didn't mess up, I haven't validated it). I modified the icon a bit to make it distinguishable. This should answer your other question: Why Modelica doesn't provide a non ideal GearR2T and how to overcome that?Modelica.Blocks.Math.InverseBlockConstraints
, which is e.g. applied in Modelica.Clocked.Examples.Systems.ControlledMixingUnit
. I thought this unnecessarily complex for this example...Here is the code:
package Vanne
model Inverse "Compute rotational velocities"
extends Modelica.Icons.Example;
Components.LossyR2G lossyR2G(eta=0.26, ratio=1571)
annotation (
Placement(visible = true,
transformation(extent={{0,-10},{20,10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.LossyGear lossyGear(lossTable=[0,0.22,0.22,0,0], ratio=560)
annotation (
Placement(visible = true, transformation(origin={-30,0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sensors.SpeedSensor nR
annotation (Placement(visible=true, transformation(
origin={-60,-30},
extent={{10,-10},{-10,10}},
rotation=90)));
Modelica.Mechanics.Translational.Sources.Speed speed(exact=true)
annotation (Placement(visible = true, transformation(origin={50,0}, extent={{10,-10},{-10,10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant desiredSpeed(k=1.67e-4) annotation (Placement(transformation(extent={{100,-10},{80,10}})));
Modelica.Blocks.Interaction.Show.RealValue realValue(significantDigits=5)
annotation (Placement(transformation(extent={{-10,-80},{10,-60}})));
Modelica.Blocks.Math.UnitConversions.To_rpm to_rpm annotation (Placement(transformation(extent={{-46,-76},{-34,-64}})));
Modelica.Mechanics.Rotational.Sensors.SpeedSensor nMAS annotation (Placement(visible=true, transformation(
origin={-10,-30},
extent={{10,-10},{-10,10}},
rotation=90)));
Modelica.Blocks.Interaction.Show.RealValue realValue1(significantDigits=5)
annotation (Placement(transformation(extent={{40,-60},{60,-40}})));
Modelica.Blocks.Math.UnitConversions.To_rpm to_rpm1
annotation (Placement(transformation(extent={{4,-56},{16,-44}})));
equation
connect(lossyGear.flange_b, lossyR2G.flangeR) annotation (Line(points={{-20,0},{0,0}}));
connect(speed.flange, lossyR2G.flangeT) annotation (Line(points={{40,0},{20,0}}, color={0,127,0}));
connect(nR.flange, lossyGear.flange_a) annotation (Line(points={{-60,-20},{-60,0},{-40,0}}, color={0,0,0}));
connect(desiredSpeed.y, speed.v_ref) annotation (Line(points={{79,0},{62,0}}, color={0,0,127}));
connect(realValue.numberPort, to_rpm.y) annotation (Line(points={{-11.5,-70},{-33.4,-70}}, color={0,0,127}));
connect(to_rpm.u, nR.w) annotation (Line(points={{-47.2,-70},{-60,-70},{-60,-41}}, color={0,0,127}));
connect(realValue1.numberPort, to_rpm1.y) annotation (Line(points={{38.5,-50},{16.6,-50}}, color={0,0,127}));
connect(to_rpm1.u, nMAS.w) annotation (Line(points={{2.8,-50},{-10,-50},{-10,-41}}, color={0,0,127}));
connect(nMAS.flange, lossyR2G.flangeR) annotation (Line(points={{-10,-20},{-10,0},{0,0}}, color={0,0,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)));
end Inverse;
model Forward "Compute torque and power"
extends Modelica.Icons.Example;
Components.LossyR2G lossyR2G(eta=0.26,ratio = 1571) annotation (
Placement(visible = true, transformation(origin={40,0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Sensors.SpeedSensor translationalSpeedSensor annotation (Placement(visible=true,
transformation(
origin={80,40},
extent={{-10,-10},{10,10}},
rotation=0)));
Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed(w_fixed(displayUnit = "rpm") = 146.9218164328827) annotation (
Placement(visible = true, transformation(origin={-86,0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.LossyGear lossyGear(lossTable=[0,0.22,0.22,0,0], ratio = 560) annotation (
Placement(visible = true, transformation(origin={-20,0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Sources.ConstantForce constantForce(f_constant=20e3)
annotation (Placement(visible = true, transformation(origin={80,0}, extent={{10,-10},{-10,10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sensors.MultiSensor Pu_TR annotation (Placement(visible=true, transformation(
origin={-54,0},
extent={{-10,-10},{10,10}},
rotation=0)));
Modelica.Blocks.Interaction.Show.RealValue realValue(significantDigits=4)
annotation (Placement(transformation(extent={{-40,-70},{-20,-50}})));
Modelica.Mechanics.Rotational.Sensors.TorqueSensor TMAS annotation (Placement(visible=true, transformation(
origin={10,0},
extent={{-10,-10},{10,10}},
rotation=0)));
Modelica.Blocks.Interaction.Show.RealValue realValue1(significantDigits=3)
annotation (Placement(transformation(extent={{20,-70},{40,-50}})));
Modelica.Blocks.Interaction.Show.RealValue realValue2(significantDigits=3)
annotation (Placement(transformation(extent={{-40,-90},{-20,-70}})));
equation
connect(lossyR2G.flangeT, translationalSpeedSensor.flange)
annotation (Line(points={{50,0},{60,0},{60,40},{70,40}}, color={0,127,0}));
connect(constantForce.flange, lossyR2G.flangeT) annotation (Line(points={{70,0},{50,0}}, color={0,127,0}));
connect(constantSpeed.flange, Pu_TR.flange_a) annotation (Line(points={{-76,0},{-64,0}}, color={0,0,0}));
connect(Pu_TR.flange_b, lossyGear.flange_a) annotation (Line(points={{-44,0},{-30,0}}, color={0,0,0}));
connect(realValue.numberPort, Pu_TR.tau) annotation (Line(points={{-41.5,-60},{-54,-60},{-54,-11}}, color={0,0,127}));
connect(lossyGear.flange_b, TMAS.flange_a) annotation (Line(points={{-10,0},{0,0}}, color={0,0,0}));
connect(TMAS.flange_b, lossyR2G.flangeR) annotation (Line(points={{20,0},{30,0}}, color={0,0,0}));
connect(TMAS.tau, realValue1.numberPort) annotation (Line(points={{2,-11},{2,-60},{18.5,-60}}, color={0,0,127}));
connect(realValue2.numberPort, Pu_TR.power) annotation (Line(points={{-41.5,-80},{-60,-80},{-60,-11}}, color={0,0,127}));
end Forward;
package Components
model LossyR2G
extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryRotationalToTranslational(
final useSupportR = false,
final useSupportT = false);
parameter Modelica.Units.SI.Efficiency eta(displayUnit="%") = 1 "Efficiency";
parameter Real ratio(final unit="rad/m", start=1)=1 "Transmission ratio (flange_a.phi/flange_b.s)";
Modelica.Mechanics.Rotational.Components.LossyGear lossyGear(
final useSupport=false,
lossTable=[0,eta,eta,0,0], ratio=1)
annotation (
Placement(
visible = true,
transformation(origin={-30,0},
extent = {{-10, -10}, {10, 10}},
rotation = 0)));
Modelica.Mechanics.Translational.Components.IdealGearR2T idealGearR2T(
final useSupportR=false,
final useSupportT=false,
ratio=ratio)
annotation (
Placement(
visible = true,
transformation(extent={{20,-10},{40,10}},
rotation = 0)));
equation
connect(lossyGear.flange_b, idealGearR2T.flangeR) annotation (Line(points={{-20,0},{20,0}}, color={0,0,0}));
connect(idealGearR2T.flangeT, flangeT) annotation (Line(points={{40,0},{100,0}}, color={0,127,0}));
connect(flangeR, lossyGear.flange_a) annotation (Line(points={{-100,0},{-40,0}}, color={0,0,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(origin={133.3333,0.0},
lineColor={64,64,64},
fillColor={192,192,192},
fillPattern=FillPattern.HorizontalCylinder,
extent={{-233.3333,-10.0},{-163.3333,10.0}}),
Rectangle(
fillColor={131,175,131},
fillPattern=FillPattern.Solid,
extent={{95.0,-60.0},{106.0,-10.0}}),
Rectangle(
fillColor={131,175,131},
fillPattern=FillPattern.Solid,
extent={{-74.411,-80},{106.589,-60}}),
Line(points={{-100,16},{-80,16}}),
Line(points={{-100,-16},{-80,-16}}),
Line(points={{-100.0,-16.0},{-100.0,-100.0}}),
Polygon(
origin={16.875,-50.0},
fillColor={162,29,33},
fillPattern=FillPattern.Solid,
points={{-84.375,-10.0},{-79.375,10.0},{-69.375,10.0},{-64.375,-10.0},{-54.375,-10.0},{-49.375,10.0},{-39.375,10.0},{-34.375,-10.0},{-24.375,-10.0},{-19.375,10.0},{-9.375,10.0},{-4.375,-10.0},
{5.625,-10.0},{10.625,10.0},{20.625,10.0},{25.625,-10.0},{35.625,-10.0},{40.625,10.0},{50.625,10.0},{55.625,-10.0},{65.625,-10.0},{70.625,10.0},{78.125,10.0},{78.125,-10.0}}),
Polygon(origin={-20.0,-0.0},
rotation=10.0,
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
points={{-5.0,45.0},{-10.0,10.0},{-45.0,5.0},{-45.0,-5.0},{-10.0,-10.0},{-5.0,-45.0},{5.0,-45.0},{10.0,-10.0},{45.0,-5.0},{45.0,5.0},{10.0,10.0},{5.0,45.0}}),
Polygon(origin={-20.0,-0.0},
rotation=55.0,
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
points={{-5.0,45.0},{-10.0,10.0},{-45.0,5.0},{-45.0,-5.0},{-10.0,-10.0},{-5.0,-45.0},{5.0,-45.0},{10.0,-10.0},{45.0,-5.0},{45.0,5.0},{10.0,10.0},{5.0,45.0}}),
Ellipse(origin={-20.0,-0.0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
extent={{-30.0,-30.0},{30.0,30.0}}),
Ellipse(origin={-20.0,-0.0},
fillColor={128,128,128},
fillPattern=FillPattern.Solid,
extent={{-10.0,-10.0},{10.0,10.0}})}), Diagram(coordinateSystem(preserveAspectRatio=false)));
end LossyR2G;
end Components;
annotation (uses(Modelica(version="4.0.0")));
end Vanne;
and some screenshots