pre-big change
This commit is contained in:
84
vis2d.mo
84
vis2d.mo
@@ -5,9 +5,21 @@ model vis2d
|
||||
parameter Real L = 1;
|
||||
parameter Real w = 0.02;
|
||||
parameter Real orbRadius = 0.04;
|
||||
parameter Real axisLength = 0.25;
|
||||
parameter Real axisWidth = 0.01;
|
||||
parameter Real planeSize = 2.0;
|
||||
parameter Real planeThickness = 0.002;
|
||||
parameter Real planeOffset = -0.001;
|
||||
|
||||
input Real r[3];
|
||||
input Real phi;
|
||||
Modelica.Blocks.Interfaces.RealInput phi annotation(
|
||||
Placement(transformation(origin = {-98, -42}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-94, 60}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Interfaces.RealInput y annotation(
|
||||
Placement(transformation(origin = {-98, 0}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-94, -60}, extent = {{-10, -10}, {10, 10}})));
|
||||
Modelica.Blocks.Interfaces.RealInput x annotation(
|
||||
Placement(transformation(origin = {-98, 40}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-94, 0}, extent = {{-10, -10}, {10, 10}})));
|
||||
protected
|
||||
Real Rz[3,3];
|
||||
Real r[3];
|
||||
|
||||
Visualizers.Advanced.Shape link(
|
||||
shapeType = "cylinder",
|
||||
@@ -18,11 +30,7 @@ model vis2d
|
||||
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)));
|
||||
R = Frames.from_T(Rz, zeros(3)));
|
||||
|
||||
Visualizers.Advanced.Shape orb(
|
||||
shapeType = "sphere",
|
||||
@@ -33,9 +41,59 @@ model vis2d
|
||||
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;
|
||||
R = Frames.from_T(Rz, zeros(3)));
|
||||
|
||||
Visualizers.Advanced.Shape xAxis(
|
||||
shapeType = "cylinder",
|
||||
length = axisLength,
|
||||
width = axisWidth,
|
||||
height = axisWidth,
|
||||
color = {255, 0, 0},
|
||||
specularCoefficient = 0.1,
|
||||
r_shape = {axisLength / 2, 0, 0},
|
||||
lengthDirection = {1, 0, 0},
|
||||
widthDirection = {0, 1, 0},
|
||||
r = zeros(3),
|
||||
R = Frames.from_T([1, 0, 0;
|
||||
0, 1, 0;
|
||||
0, 0, 1], zeros(3)));
|
||||
|
||||
Visualizers.Advanced.Shape yAxis(
|
||||
shapeType = "cylinder",
|
||||
length = axisLength,
|
||||
width = axisWidth,
|
||||
height = axisWidth,
|
||||
color = {0, 200, 0},
|
||||
specularCoefficient = 0.1,
|
||||
r_shape = {0, axisLength / 2, 0},
|
||||
lengthDirection = {0, 1, 0},
|
||||
widthDirection = {0, 0, 1},
|
||||
r = zeros(3),
|
||||
R = Frames.from_T([1, 0, 0;
|
||||
0, 1, 0;
|
||||
0, 0, 1], zeros(3)));
|
||||
|
||||
Visualizers.Advanced.Shape zAxis(
|
||||
shapeType = "cylinder",
|
||||
length = axisLength,
|
||||
width = axisWidth,
|
||||
height = axisWidth,
|
||||
color = {0, 90, 255},
|
||||
specularCoefficient = 0.1,
|
||||
r_shape = {0, 0, axisLength / 2},
|
||||
lengthDirection = {0, 0, 1},
|
||||
widthDirection = {1, 0, 0},
|
||||
r = zeros(3),
|
||||
R = Frames.from_T([1, 0, 0;
|
||||
0, 1, 0;
|
||||
0, 0, 1], zeros(3)));
|
||||
equation
|
||||
r = {x, y, 0};
|
||||
Rz = [cos(phi), -sin(phi), 0;
|
||||
sin(phi), cos(phi), 0;
|
||||
0, 0, 1];
|
||||
|
||||
annotation(
|
||||
uses(Modelica(version = "4.1.0")),
|
||||
Icon(graphics = {Rectangle(lineColor = {204, 204, 204}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Sphere, extent = {{-100, 100}, {100, -100}}, radius = 10), Text(extent = {{-100, 100}, {100, -100}}, textString = "VIS")}));
|
||||
end vis2d;
|
||||
Reference in New Issue
Block a user