|
| 1 | +within PlanarMechanics.Parts.BaseClasses; |
| 2 | +partial model TwoConnectorShapes |
| 3 | + "Partial base class containing two frames and cylinder shapes at these frames" |
| 4 | + extends PlanarMechanics.Interfaces.PartialTwoFrames; |
| 5 | + |
| 6 | + parameter Boolean animate = true "Enable animation" |
| 7 | + annotation(Dialog(group="Animation")); |
| 8 | + |
| 9 | + parameter SI.Length zPosition = planarWorld.defaultZPosition |
| 10 | + "Position z of cylinder representing the fixed translation" annotation (Dialog( |
| 11 | + tab="Animation", group="if animation = true", enable=animate)); |
| 12 | + input Types.SpecularCoefficient specularCoefficient = planarWorld.defaultSpecularCoefficient |
| 13 | + "Reflection of ambient light (= 0: light is completely absorbed)" |
| 14 | + annotation (HideResult=true, Dialog(tab="Animation", group="if animation = true", enable=animate)); |
| 15 | + |
| 16 | + parameter Boolean animateConnectors = true |
| 17 | + "=true, if connectors a and b should be animated as cylinders" |
| 18 | + annotation (Dialog(tab="Animation", group="Connectors (if animation = true)", enable=animate)); |
| 19 | + parameter SI.Diameter diameterConnector_a=planarWorld.defaultJointWidth |
| 20 | + "Diameter of connector at frame_a" |
| 21 | + annotation (Dialog(tab="Animation", group="Connectors (if animation = true)", enable=animate and animateConnectors)); |
| 22 | + parameter SI.Diameter diameterConnector_b=planarWorld.defaultJointWidth |
| 23 | + "Diameter of connector at frame_b" |
| 24 | + annotation (Dialog(tab="Animation", group="Connectors (if animation = true)", enable=animate and animateConnectors)); |
| 25 | + input Types.Color colorConnector_a = Types.Defaults.RodColor |
| 26 | + "Color of connector at frame_a" |
| 27 | + annotation (HideResult=true, Dialog(colorSelector=true, tab="Animation", group="Connectors (if animation = true)", enable=animate and animateConnectors)); |
| 28 | + input Types.Color colorConnector_b = Types.Defaults.RodColor |
| 29 | + "Color of connector at frame_a" |
| 30 | + annotation (HideResult=true, Dialog(colorSelector=true, tab="Animation", group="Connectors (if animation = true)", enable=animate and animateConnectors)); |
| 31 | + |
| 32 | +protected |
| 33 | + MB.Visualizers.Advanced.Shape contactA( |
| 34 | + shapeType="cylinder", |
| 35 | + color=colorConnector_a, |
| 36 | + specularCoefficient=specularCoefficient, |
| 37 | + length=planarWorld.defaultJointLength, |
| 38 | + width=diameterConnector_a, |
| 39 | + height=diameterConnector_a, |
| 40 | + lengthDirection={0,0,1}, |
| 41 | + widthDirection={1,0,0}, |
| 42 | + r_shape={frame_a.x,frame_a.y,zPosition}+{0,0,-planarWorld.defaultJointLength/2}, |
| 43 | + r=planarWorld.r_0, |
| 44 | + R=planarWorld.R) if planarWorld.enableAnimation and animate and animateConnectors; |
| 45 | + MB.Visualizers.Advanced.Shape contactB( |
| 46 | + shapeType="cylinder", |
| 47 | + color=colorConnector_b, |
| 48 | + specularCoefficient=specularCoefficient, |
| 49 | + length=planarWorld.defaultJointLength, |
| 50 | + width=diameterConnector_b, |
| 51 | + height=diameterConnector_b, |
| 52 | + lengthDirection={0,0,1}, |
| 53 | + widthDirection={1,0,0}, |
| 54 | + r_shape={frame_b.x,frame_b.y,zPosition}+{0,0,-planarWorld.defaultJointLength/2}, |
| 55 | + r=planarWorld.r_0, |
| 56 | + R=planarWorld.R) if planarWorld.enableAnimation and animate and animateConnectors; |
| 57 | + |
| 58 | + annotation ( |
| 59 | + Icon(graphics={ |
| 60 | + Text( |
| 61 | + extent={{-108,-24},{-72,-49}}, |
| 62 | + lineColor={128,128,128}, |
| 63 | + textString="a"), |
| 64 | + Text( |
| 65 | + extent={{72,-24},{108,-49}}, |
| 66 | + lineColor={128,128,128}, |
| 67 | + textString="b")}), |
| 68 | + Documentation(revisions="<html><p><img src=\"modelica://PlanarMechanics/Resources/Images/dlr_logo.png\"/> <b>Developed 2010-2014 at the DLR Institute of System Dynamics and Control</b></p></html>", info="<html> |
| 69 | +<p>This partial base class contains two frames and optionally enables to visualize a cylinder at place of each of these frames. This class should be extended to create a proper model, see e.g. <a href=\"modelica://PlanarMechanics.Parts.Spring\">Spring</a> model. </p> |
| 70 | +</html>")); |
| 71 | +end TwoConnectorShapes; |
0 commit comments