128 lines
8.1 KiB
Plaintext
128 lines
8.1 KiB
Plaintext
package test2d
|
|
model test2d
|
|
BondGraph.J1 w_com(N = 3, s = {1, 1, 1}) annotation(
|
|
Placement(transformation(origin = {0, 100}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph.I moi(I = 0.01) annotation(
|
|
Placement(transformation(origin = {40, 100}, extent = {{-10, -10}, {10, 10}})));
|
|
mTFrot2lin mTFrot2lin1(r_body = {0.5, 0}) annotation(
|
|
Placement(transformation(origin = {0, 70}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|
BondGraph._2D.J0 j0(N = 3, s = {-1, -1, 1}) annotation(
|
|
Placement(transformation(origin = {0, 40}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.J1 v_com_i(N = 3, s = {-1, 1, -1}) annotation(
|
|
Placement(transformation(origin = {40, -20}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.J1 v_P_bff(N = 2, s = {-1, -1}) annotation(
|
|
Placement(transformation(origin = {-40, 40}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.J1 v_com_bff(N = 2, s = {1, 1}) annotation(
|
|
Placement(transformation(origin = {40, 40}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.Sf hinge(f0 = {0, 0}) annotation(
|
|
Placement(transformation(origin = {-78, 40}, extent = {{-10, -10}, {10, 10}})));
|
|
rTF rTF1 annotation(
|
|
Placement(transformation(origin = {40, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
|
|
Modelica.Blocks.Continuous.Integrator w2phi(k = 1) annotation(
|
|
Placement(transformation(origin = {30, 70}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.I m(I = [1, 0; 0, 1]) annotation(
|
|
Placement(transformation(origin = {80, -20}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.Se g(e0 = {0, -9.81}) annotation(
|
|
Placement(transformation(origin = {0, -20}, extent = {{-10, -10}, {10, 10}})));
|
|
Modelica.Blocks.Continuous.Integrator vx2x(y_start = -0.5) annotation(
|
|
Placement(transformation(origin = {70, -50}, extent = {{-10, -10}, {10, 10}})));
|
|
Modelica.Blocks.Continuous.Integrator vy2y(y_start = 0) annotation(
|
|
Placement(transformation(origin = {70, -80}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph.J0 j1(N = 3, s = {-1, -1, 1}) annotation(
|
|
Placement(transformation(origin = {-40, 100}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph.Sf hinge2(f0 = 0) annotation(
|
|
Placement(transformation(origin = {-78, 100}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph.J1 w_hinge(N = 2, s = {-1, 1}) annotation(
|
|
Placement(transformation(origin = {-40, 70}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph.R r(R = 0.2) annotation(
|
|
Placement(transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}})));
|
|
vis2d vis2d1 annotation(
|
|
Placement(transformation(origin = {118, -64}, extent = {{-10, -10}, {10, 10}})));
|
|
equation
|
|
connect(w_com.f, w2phi.u) annotation(
|
|
Line(points = {{6, 94}, {18, 70}}, color = {0, 0, 127}));
|
|
connect(w2phi.y, rTF1.phi) annotation(
|
|
Line(points = {{41, 70}, {100, 70}, {100, 10}, {48, 10}}, color = {0, 0, 127}));
|
|
connect(w_com.P[1], moi.p) annotation(
|
|
Line(points = {{0, 100}, {40, 100}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(w_com.P[2], mTFrot2lin1.pR) annotation(
|
|
Line(points = {{0, 100}, {0, 78}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(v_com_bff.P[1], j0.P[1]) annotation(
|
|
Line(points = {{40, 40}, {0, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(mTFrot2lin1.pT, j0.P[2]) annotation(
|
|
Line(points = {{0, 62}, {0, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(j0.P[3], v_P_bff.P[1]) annotation(
|
|
Line(points = {{0, 40}, {-40, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(hinge.p, v_P_bff.P[2]) annotation(
|
|
Line(points = {{-70, 40}, {-40, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(v_com_bff.P[2], rTF1.p2) annotation(
|
|
Line(points = {{40, 40}, {40, 18}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(rTF1.p1, v_com_i.P[1]) annotation(
|
|
Line(points = {{40, 2}, {40, -20}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(g.p, v_com_i.P[3]) annotation(
|
|
Line(points = {{8, -20}, {40, -20}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(v_com_i.P[2], m.p) annotation(
|
|
Line(points = {{40, -20}, {80, -20}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(v_com_i.f[1], vx2x.u) annotation(
|
|
Line(points = {{46, -26}, {50, -50}, {58, -50}}, color = {0, 0, 127}));
|
|
connect(v_com_i.f[2], vy2y.u) annotation(
|
|
Line(points = {{46, -26}, {50, -80}, {58, -80}}, color = {0, 0, 127}));
|
|
connect(hinge2.p, j1.P[1]) annotation(
|
|
Line(points = {{-70, 100}, {-40, 100}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(j1.P[3], w_hinge.P[1]) annotation(
|
|
Line(points = {{-40, 100}, {-40, 70}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(w_hinge.P[2], r.p) annotation(
|
|
Line(points = {{-40, 70}, {-70, 70}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
connect(vy2y.y, vis2d1.y) annotation(
|
|
Line(points = {{82, -80}, {94, -80}, {94, -70}, {108, -70}}, color = {0, 0, 127}));
|
|
connect(vx2x.y, vis2d1.x) annotation(
|
|
Line(points = {{82, -50}, {94, -50}, {94, -64}, {108, -64}}, color = {0, 0, 127}));
|
|
connect(w2phi.y, vis2d1.phi) annotation(
|
|
Line(points = {{42, 70}, {100, 70}, {100, -58}, {108, -58}}, color = {0, 0, 127}));
|
|
connect(w_com.P[3], j1.P[2]) annotation(
|
|
Line(points = {{0, 100}, {-40, 100}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
|
annotation(
|
|
uses(Modelica(version = "4.1.0")),
|
|
experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02),
|
|
Diagram(coordinateSystem(extent = {{-100, 120}, {140, -100}})),
|
|
Icon(coordinateSystem(extent = {{-200, -200}, {200, 200}})),
|
|
version = "");
|
|
end test2d;
|
|
|
|
model mTFrot2lin
|
|
BondGraph.BondPort pR annotation(
|
|
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.BondPort pT annotation(
|
|
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
|
parameter Real r_body[2] = {1, 0};
|
|
protected
|
|
Real B[2];
|
|
equation
|
|
B = {-r_body[2], r_body[1]};
|
|
pT.f = B*pR.f;
|
|
pR.e = B[1]*pT.e[1] + B[2]*pT.e[2];
|
|
annotation(
|
|
Icon(graphics = {Text(extent = {{-70, 100}, {70, -100}}, textString = "rlTF", textStyle = {TextStyle.Bold, TextStyle.UnderLine})}));
|
|
end mTFrot2lin;
|
|
|
|
model rTF
|
|
BondGraph._2D.BondPort p1 "Port 1" annotation(
|
|
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}})));
|
|
BondGraph._2D.BondPort p2 "Port 2" annotation(
|
|
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
|
Modelica.Blocks.Interfaces.RealInput phi "angle" annotation(
|
|
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {0, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
|
protected
|
|
Real R[2, 2];
|
|
equation
|
|
R = [cos(phi), -sin(phi); sin(phi), cos(phi)];
|
|
p1.e = R*p2.e;
|
|
transpose(R)*p1.f = p2.f;
|
|
annotation(
|
|
Diagram(graphics),
|
|
Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "rTF", textStyle = {TextStyle.Bold, TextStyle.UnderLine})}));
|
|
end rTF;
|
|
annotation(
|
|
uses(Modelica(version = "4.1.0")));
|
|
end test2d;
|