Ticket #4625: DF.mo

File DF.mo, 3.3 KB (added by massimo ceraolo, 7 years ago)
Line 
1model DF "Drag Force with Altimetry"
2 parameter String DataFileName = "DataName.txt" "Name of file with Altimetry array ex: \"sort1A.txt\"";
3 import Modelica.Constants.g_n;
4 parameter Modelica.Blocks.Types.Extrapolation extrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint;
5 extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryOneFlangeAndSupport2;
6 extends Modelica.Mechanics.Translational.Interfaces.PartialFriction;
7 Modelica.SIunits.Force f "Total drag force";
8 Modelica.SIunits.Velocity v "vehicle velocity";
9 Modelica.SIunits.Acceleration a "Absolute acceleration of flange";
10 Real Sign;
11 parameter Modelica.SIunits.Mass m "vehicle mass";
12 parameter Modelica.SIunits.Density rho(start = 1.226) "air density";
13 parameter Modelica.SIunits.Area S "vehicle cross area";
14 parameter Real fc(start = 0.01) "rolling friction coefficient";
15 parameter Real Cx "aerodinamic drag coefficient";
16Modelica.Blocks.Tables.CombiTable1D slope1 annotation(
17 Placement(visible = true, transformation(origin = {16, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
18Modelica.Mechanics.Translational.Sensors.PositionSensor position annotation(
19 Placement(visible = true, transformation(origin = {70, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
20protected
21 parameter Real A = fc * m * g_n;
22 parameter Real B = 1 / 2 * rho * S * Cx;
23equation
24 connect(position.s, slope1.u) annotation(
25 Line(points = {{58, 0}, {30, 0}, {30, 0}, {28, 0}}, color = {0, 0, 127}));
26 connect(position.flange, flange) annotation(
27 Line(points = {{80, 0}, {98, 0}, {98, 0}, {100, 0}}, color = {0, 127, 0}));
28 v = der(s);
29 a = der(v);
30 v_relfric = v;
31 a_relfric = a;
32 f0 = A ;
33 f0_max = A ;
34 free = false ;
35 flange.f - f = 0;
36 if v > 0 then
37 Sign = 1;
38 else
39 Sign = -1;
40 end if;
41 f - B * v ^ 2 * Sign = if locked then sa * unitForce else f0 * (if startForward then Modelica.Math.tempInterpol1(v, [0, 1], 2) else if startBackward then -Modelica.Math.tempInterpol1(-v, [0, 1], 2) else if pre(mode) == Forward then Modelica.Math.tempInterpol1(v, [0, 1], 2) else -Modelica.Math.tempInterpol1(-v, [0, 1], 2));
42 annotation(
43 Documentation(info = "<html><head></head><body><p>This component models the total (rolling and aerodynamic vehicle drag resistance: </p>
44 <p>F=fc*m*g+(1/2)*rho*Cx*S*v^2</p>
45 <p>It models reliably the stuck phase. Based on Modelica-Intrerfaces.PartialFriction model</p>
46 </body></html>"),
47 Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-98, 10}, {22, 10}, {22, 41}, {92, 0}, {22, -41}, {22, -10}, {-98, -10}, {-98, 10}}, lineColor = {0, 127, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Line(points = {{-42, -50}, {87, -50}}, color = {0, 0, 0}), Polygon(points = {{-72, -50}, {-41, -40}, {-41, -60}, {-72, -50}}, lineColor = {0, 0, 0}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Line(points = {{-90, -90}, {-70, -88}, {-50, -82}, {-30, -72}, {-10, -58}, {10, -40}, {30, -18}, {50, 8}, {70, 38}, {90, 72}, {110, 110}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-82, 90}, {80, 50}}, lineColor = {0, 0, 255}, textString = "%name")}),
48 Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics));
49end DF;