Pendulum working
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build/
|
||||
@@ -1,5 +1,5 @@
|
||||
within BondGraph;
|
||||
package BondGraphLib
|
||||
package _1D
|
||||
|
||||
connector BondPort "Bond graph power port"
|
||||
Real e "Effort variable";
|
||||
@@ -231,4 +231,4 @@ package BondGraphLib
|
||||
annotation(
|
||||
Icon(graphics = {Text(origin = {50, 0}, extent = {{-50, 100}, {50, -100}}, textString = "R"), Line(origin = {-45.22, 20.19}, points = {{-58.7774, -20.1934}, {21.2226, -20.1934}, {-38.7774, 19.8066}}, thickness = 5), Line(origin = {-9.81, -8.19}, points = {{-10.1934, 48.1934}, {-10.1934, -31.8066}}, thickness = 5)}),
|
||||
uses(Modelica(version = "4.1.0")));
|
||||
end BondGraphLib;
|
||||
end _1D;
|
||||
@@ -1,5 +1,5 @@
|
||||
within BondGraph;
|
||||
package BondGraphLib2D
|
||||
package _2D
|
||||
|
||||
connector BondPort "Bond graph 2D multibond power port"
|
||||
Real e[2] "Effort vector";
|
||||
@@ -100,7 +100,7 @@ package BondGraphLib2D
|
||||
model Se "Effort source"
|
||||
BondPort p annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
input Real e0[2] "Imposed effort";
|
||||
parameter Real e0[2] "Imposed effort";
|
||||
equation
|
||||
p.e = e0;
|
||||
annotation(
|
||||
@@ -111,7 +111,7 @@ package BondGraphLib2D
|
||||
model Sf "Flow source"
|
||||
BondPort p annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
input Real f0[2] "Imposed flow";
|
||||
parameter Real f0[2] "Imposed flow";
|
||||
equation
|
||||
p.f = f0;
|
||||
annotation(
|
||||
@@ -151,11 +151,12 @@ package BondGraphLib2D
|
||||
model mSe "Bond graph modulated effort source"
|
||||
BondPort p annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Interfaces.RealInput e0[2] "Imposed effort" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {0, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
||||
|
||||
Modelica.Blocks.Interfaces.RealInput e0 "Imposed effort" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-20, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
||||
Modelica.Blocks.Interfaces.RealInput e1 "Imposed effort" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {20, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
||||
equation
|
||||
p.e = e0;
|
||||
p.e = {e0,e1};
|
||||
annotation(
|
||||
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSe", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
|
||||
Diagram(graphics));
|
||||
@@ -164,11 +165,12 @@ package BondGraphLib2D
|
||||
model mSf "Bond graph modulated flow source"
|
||||
BondPort p annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Interfaces.RealInput f0[2] "Imposed flow" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {0, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
||||
|
||||
Modelica.Blocks.Interfaces.RealInput f0 "Imposed flow" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-20, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
||||
Modelica.Blocks.Interfaces.RealInput f1 "Imposed flow" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {20, -78}, extent = {{-8, -8}, {8, 8}}, rotation = 90)));
|
||||
equation
|
||||
p.f = f0;
|
||||
p.f = {f0,f1};
|
||||
annotation(
|
||||
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSf", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
|
||||
Diagram(graphics));
|
||||
@@ -207,7 +209,7 @@ package BondGraphLib2D
|
||||
package TransRotUtils
|
||||
|
||||
model mTFrot2lin
|
||||
BondGraphLib.BondPort pR annotation(
|
||||
_1D.BondPort pR annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondPort pT annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
@@ -242,9 +244,26 @@ package BondGraphLib2D
|
||||
end rTF;
|
||||
|
||||
end TransRotUtils;
|
||||
|
||||
model fsensor2d
|
||||
BondPort p annotation(
|
||||
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-52, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Interfaces.RealOutput f0 "Flow output" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {54, 20}, extent = {{-8, -8}, {8, 8}})));
|
||||
Modelica.Blocks.Interfaces.RealOutput f1 "Flow output" annotation(
|
||||
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {54, -20}, extent = {{-8, -8}, {8, 8}})));
|
||||
equation
|
||||
// Ideal flow sensor in bond-graph form: zero effort loading.
|
||||
p.e = {0,0};
|
||||
f0 = p.f[1];
|
||||
f1 = p.f[2];
|
||||
annotation(
|
||||
Icon(graphics = {Text(origin = {-10, 0}, extent = {{-50, 60}, {50, -60}}, textString = "f", textStyle = {TextStyle.Italic}), Ellipse(origin = {-2, 0}, lineThickness = 5, extent = {{-50, 50}, {50, -50}})}));
|
||||
end fsensor2d;
|
||||
|
||||
|
||||
annotation(
|
||||
Icon(graphics = {Text(origin = {50, 0}, extent = {{-50, 100}, {50, -100}}, textString = "R", textStyle = {TextStyle.Bold}), Line(origin = {-45.22, 20.19}, points = {{-58.7774, -20.1934}, {21.2226, -20.1934}, {-38.7774, 19.8066}}, thickness = 5), Line(origin = {-9.81, -8.19}, points = {{-10.1934, 48.1934}, {-10.1934, -31.8066}}, thickness = 5), Line(origin = {-78, 16}, points = {{-26, 0}, {30, 0}}, thickness = 5)}),
|
||||
uses(Modelica(version = "4.1.0")),
|
||||
Diagram(graphics));
|
||||
end BondGraphLib2D;
|
||||
end _2D;
|
||||
@@ -15,3 +15,4 @@ mSf
|
||||
mTF
|
||||
mGY
|
||||
TransRotUtils
|
||||
fsensor2d
|
||||
@@ -1,2 +1,2 @@
|
||||
BondGraphLib2D
|
||||
BondGraphLib
|
||||
_1D
|
||||
_2D
|
||||
|
||||
28
test.mo
28
test.mo
@@ -1,28 +0,0 @@
|
||||
model test
|
||||
BondGraphLib.J1 j1(Nin = 1, Nout = 3) annotation(
|
||||
Placement(transformation(extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib.R r annotation(
|
||||
Placement(transformation(origin = {0, 40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib.C c(c = 0.5) annotation(
|
||||
Placement(transformation(origin = {0, -40}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Sources.Step step(height = 1, startTime = 1) annotation(
|
||||
Placement(transformation(origin = {-90, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib.mSe mSe annotation(
|
||||
Placement(transformation(origin = {-40, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib.I i(I = 0.1) annotation(
|
||||
Placement(transformation(origin = {40, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
equation
|
||||
connect(j1.Pout[1], c.p) annotation(
|
||||
Line(points = {{0, 8}, {0, -32}}, color = {0, 0, 127}));
|
||||
connect(j1.Pout[2], r.p) annotation(
|
||||
Line(points = {{0, 8}, {0, 48}}, color = {0, 0, 127}));
|
||||
connect(mSe.p, j1.Pin[1]) annotation(
|
||||
Line(points = {{-32, 0}, {0, 0}, {0, 8}}, color = {0, 0, 127}));
|
||||
connect(step.y, mSe.e0) annotation(
|
||||
Line(points = {{-78, 0}, {-40, 0}, {-40, -8}}, color = {0, 0, 127}));
|
||||
connect(i.p, j1.Pout[3]) annotation(
|
||||
Line(points = {{40, 8}, {40, 0}, {0, 0}, {0, 8}}, color = {0, 0, 127}));
|
||||
annotation(
|
||||
uses(Modelica(version = "4.1.0")),
|
||||
experiment(StartTime = 0, StopTime = 12, Tolerance = 1e-06, Interval = 0.024));
|
||||
end test;
|
||||
104
test2d.mo
104
test2d.mo
@@ -1,36 +1,48 @@
|
||||
model test2d
|
||||
import BondGraphLib = BondGraph.BondGraphLib;
|
||||
import BondGraphLib2D = BondGraph.BondGraphLib2D;
|
||||
|
||||
BondGraphLib.J1 w_com(N = 3, s = {1, -1, -1}) annotation(
|
||||
import _1D = BondGraph._1D;
|
||||
import _2D = BondGraph._2D;
|
||||
_1D.J1 w_com(N = 4, s = {1, -1, -1, -1}) annotation(
|
||||
Placement(transformation(origin = {0, 120}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib.Sf sf(f0 = 1) annotation(
|
||||
Placement(transformation(origin = {50, 120}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
||||
BondGraphLib2D.TransRotUtils.mTFrot2lin mTFrot2lin(r_body = {0.1, 0}) annotation(
|
||||
_2D.TransRotUtils.mTFrot2lin mTFrot2lin(r_body = {0.5, 0}) annotation(
|
||||
Placement(transformation(origin = {0, 80}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
||||
BondGraphLib2D.J0 j0(N = 3, s = {1, 1, -1}) annotation(
|
||||
_2D.J0 j0(N = 3, s = {1, 1, -1}) annotation(
|
||||
Placement(transformation(origin = {0, 40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib2D.J1 v_p_bff(N = 2, s = {1, -1}) annotation(
|
||||
_2D.J1 v_p_bff(N = 2, s = {1, 1}) annotation(
|
||||
Placement(transformation(origin = {-40, 40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib2D.J1 v_com_bff(N = 2, s = {-1, -1}) annotation(
|
||||
_2D.J1 v_com_bff(N = 2, s = {-1, -1}) annotation(
|
||||
Placement(transformation(origin = {40, 40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib2D.TransRotUtils.rTF rTF annotation(
|
||||
Placement(transformation(origin = {40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
||||
BondGraphLib2D.TransRotUtils.rTF rTF1 annotation(
|
||||
Placement(transformation(origin = {-40, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));
|
||||
BondGraphLib.fsensor wsensor annotation(
|
||||
_2D.TransRotUtils.rTF rTF annotation(
|
||||
Placement(transformation(origin = {40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
|
||||
_1D.fsensor wsensor annotation(
|
||||
Placement(transformation(origin = {50, 90}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Continuous.Integrator w2phi annotation(
|
||||
Modelica.Blocks.Continuous.Integrator w2phi(k = 1) annotation(
|
||||
Placement(transformation(origin = {90, 90}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib2D.J1 v_y_in(N = 1, s = {1}) annotation(
|
||||
Placement(transformation(origin = {-40, -40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib2D.J1 v_com_in(N = 2, s = {1, -1}) annotation(
|
||||
_2D.J1 v_com_in(N = 4, s = {1, -1, -1, 1}) annotation(
|
||||
Placement(transformation(origin = {40, -40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraphLib2D.I mass annotation(
|
||||
_2D.I mass(I = [1, 0; 0, 1]) annotation(
|
||||
Placement(transformation(origin = {80, -40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._2D.Sf ground(f0 = {0, 0}) annotation(
|
||||
Placement(transformation(origin = {-80, 40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._1D.I m_inertial(I = 0.001) annotation(
|
||||
Placement(transformation(origin = {40, 120}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._1D.Sf ground2(f0 = 0) annotation(
|
||||
Placement(transformation(origin = {-80, 120}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._1D.J0 j1(N = 3, s = {1, -1, -1}) annotation(
|
||||
Placement(transformation(origin = {-40, 120}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._1D.J1 w_hinge(N = 2, s = {1, -11}) annotation(
|
||||
Placement(transformation(origin = {-40, 90}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._1D.R hinge_r(R = 0.01) annotation(
|
||||
Placement(transformation(origin = {-80, 90}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._2D.Se g(e0 = {0, 9.81}) annotation(
|
||||
Placement(transformation(origin = {2, -40}, extent = {{-10, -10}, {10, 10}})));
|
||||
BondGraph._2D.fsensor2d v_inertial annotation(
|
||||
Placement(transformation(origin = {40, -60}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
||||
Modelica.Blocks.Continuous.Integrator vx_to_x(k = -1, y_start = -0.5) annotation(
|
||||
Placement(transformation(origin = {70, -70}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Continuous.Integrator vy_to_y annotation(
|
||||
Placement(transformation(origin = {70, -100}, extent = {{-10, -10}, {10, 10}})));
|
||||
vis2d link;
|
||||
equation
|
||||
connect(sf.p, w_com.P[1]) annotation(
|
||||
Line(points = {{42, 120}, {0, 120}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(w_com.P[2], mTFrot2lin.pR) annotation(
|
||||
Line(points = {{0, 120}, {0, 88}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(mTFrot2lin.pT, j0.P[1]) annotation(
|
||||
@@ -38,29 +50,45 @@ equation
|
||||
connect(v_com_bff.P[1], j0.P[2]) annotation(
|
||||
Line(points = {{40, 40}, {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(origin = {-1, 0},points = {{0, 40}, {-40, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(v_com_bff.P[2], rTF.p1) annotation(
|
||||
Line(points = {{40, 40}, {40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(v_p_bff.P[2], rTF1.p1) annotation(
|
||||
Line(points = {{-40, 40}, {-40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
Line(origin = {-1, 0}, points = {{0, 40}, {-40, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(wsensor.f, w2phi.u) annotation(
|
||||
Line(points = {{58, 90}, {78, 90}}, color = {0, 0, 127}));
|
||||
connect(w2phi.y, rTF1.phi) annotation(
|
||||
Line(points = {{102, 90}, {110, 90}, {110, 20}, {0, 20}, {0, 0}, {-32, 0}}, color = {0, 0, 127}, arrow = {Arrow.None, Arrow.Filled}));
|
||||
connect(w2phi.y, rTF.phi) annotation(
|
||||
Line(points = {{102, 90}, {110, 90}, {110, 20}, {0, 20}, {0, 0}, {32, 0}}, color = {0, 0, 127}, arrow = {Arrow.None, Arrow.Filled}));
|
||||
connect(rTF1.p2, v_y_in.P[1]) annotation(
|
||||
Line(points = {{-40, -8}, {-40, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(rTF.p2, v_com_in.P[1]) annotation(
|
||||
Line(origin = {1, 0},points = {{40, -8}, {40, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
Line(points = {{102, 90}, {110, 90}, {110, 0}, {48, 0}}, color = {0, 0, 127}, arrow = {Arrow.None, Arrow.Filled}));
|
||||
connect(v_com_in.P[2], mass.p) annotation(
|
||||
Line(points = {{40, -40}, {80, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(w_com.P[3], wsensor.p) annotation(
|
||||
Line(points = {{0, 120}, {44, 90}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(w_com.P[1], m_inertial.p) annotation(
|
||||
Line(points = {{0, 120}, {40, 120}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(ground2.p, j1.P[1]) annotation(
|
||||
Line(points = {{-72, 120}, {-40, 120}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(j1.P[2], w_com.P[4]) annotation(
|
||||
Line(points = {{-40, 120}, {0, 120}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.Half, Arrow.None}, arrowSize = 6));
|
||||
connect(ground.p, v_p_bff.P[2]) annotation(
|
||||
Line(points = {{-72, 40}, {-40, 40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(j1.P[3], w_hinge.P[1]) annotation(
|
||||
Line(points = {{-40, 120}, {-40, 90}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(w_hinge.P[2], hinge_r.p) annotation(
|
||||
Line(points = {{-40, 90}, {-80, 90}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(g.p, v_com_in.P[3]) annotation(
|
||||
Line(points = {{10, -40}, {40, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(v_com_bff.P[2], rTF.p2) annotation(
|
||||
Line(points = {{40, 40}, {40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(rTF.p1, v_com_in.P[1]) annotation(
|
||||
Line(points = {{40, -8}, {40, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(v_com_in.P[4], v_inertial.p) annotation(
|
||||
Line(points = {{40, -40}, {40, -54}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
|
||||
connect(v_inertial.f0, vx_to_x.u) annotation(
|
||||
Line(points = {{42, -66}, {42, -70}, {58, -70}}, color = {0, 0, 127}));
|
||||
connect(v_inertial.f1, vy_to_y.u) annotation(
|
||||
Line(points = {{38, -66}, {38, -100}, {58, -100}}, color = {0, 0, 127}));
|
||||
link.r = {vx_to_x.y, vy_to_y.y, 0};
|
||||
link.phi = w2phi.y;
|
||||
annotation(
|
||||
uses(Modelica(version = "4.1.0")),
|
||||
experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02),
|
||||
Diagram(coordinateSystem(extent = {{-60, 140}, {120, -60}})),
|
||||
Icon(coordinateSystem(extent = {{-200, -200}, {200, 200}})),
|
||||
version = "");
|
||||
experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02),
|
||||
Diagram(coordinateSystem(extent = {{-100, 140}, {120, -120}})),
|
||||
Icon(coordinateSystem(extent = {{-200, -200}, {200, 200}})),
|
||||
version = "");
|
||||
end test2d;
|
||||
41
vis2d.mo
Normal file
41
vis2d.mo
Normal file
@@ -0,0 +1,41 @@
|
||||
model vis2d
|
||||
import Modelica.Mechanics.MultiBody.Visualizers;
|
||||
import Modelica.Mechanics.MultiBody.Frames;
|
||||
|
||||
parameter Real L = 1;
|
||||
parameter Real w = 0.02;
|
||||
parameter Real orbRadius = 0.04;
|
||||
|
||||
input Real r[3];
|
||||
input Real phi;
|
||||
|
||||
Visualizers.Advanced.Shape link(
|
||||
shapeType = "cylinder",
|
||||
length = L,
|
||||
width = w,
|
||||
height = w,
|
||||
r_shape = {-L / 2, 0, 0},
|
||||
lengthDirection = {1, 0, 0},
|
||||
widthDirection = {0, 1, 0},
|
||||
r = r,
|
||||
R = Frames.from_T(
|
||||
[cos(phi), -sin(phi), 0;
|
||||
sin(phi), cos(phi), 0;
|
||||
0, 0, 1],
|
||||
zeros(3)));
|
||||
|
||||
Visualizers.Advanced.Shape orb(
|
||||
shapeType = "sphere",
|
||||
length = 2 * orbRadius,
|
||||
width = 2 * orbRadius,
|
||||
height = 2 * orbRadius,
|
||||
r_shape = {L / 2 - orbRadius, 0, 0},
|
||||
lengthDirection = {1, 0, 0},
|
||||
widthDirection = {0, 1, 0},
|
||||
r = r,
|
||||
R = Frames.from_T(
|
||||
[cos(phi), -sin(phi), 0;
|
||||
sin(phi), cos(phi), 0;
|
||||
0, 0, 1],
|
||||
zeros(3)));
|
||||
end vis2d;
|
||||
Reference in New Issue
Block a user