diff --git a/ObsoletePlanarMechanics2.mo b/ObsoletePlanarMechanics2.mo new file mode 100644 index 0000000..06a2fc7 --- /dev/null +++ b/ObsoletePlanarMechanics2.mo @@ -0,0 +1,182 @@ +within ; +package ObsoletePlanarMechanics2 "Library that contains components from PlanarMechanics Library 1.6.0 that have been removed from version 2.0.0" + extends Modelica.Icons.Package; + + package Visualizers "Visualization components of the library" + extends Modelica.Icons.Package; + + package Advanced "Visualizers that require advanced knowledge in order to use them properly" + extends Modelica.Icons.Package; + + model DoubleArrow + "Visualizing a double arrow with variable size; all data have to be set as modifiers (see info layer)" + extends Modelica.Icons.ObsoleteModel; + + import T = Modelica.Mechanics.MultiBody.Frames.TransformationMatrices; + import Modelica.Units.Conversions.to_unit1; + + input Modelica.Mechanics.MultiBody.Frames.Orientation R=Modelica.Mechanics.MultiBody.Frames.nullRotation() + "Orientation object to rotate the planarWorld frame into the arrow frame" annotation(Dialog); + input Modelica.Units.SI.Position r[3]={0,0,0} + "Position vector from origin of planarWorld frame to origin of arrow frame, resolved in planarWorld frame" + annotation(Dialog); + input Modelica.Units.SI.Position r_tail[3]={0,0,0} + "Position vector from origin of arrow frame to double arrow tail, resolved in arrow frame" + annotation(Dialog); + input Modelica.Units.SI.Position r_head[3]={0,0,0} + "Position vector from double arrow tail to the head of the double arrow, resolved in arrow frame" + annotation(Dialog); + input Modelica.Units.SI.Diameter diameter=planarWorld.defaultArrowDiameter + "Diameter of arrow line" annotation(Dialog); + input Modelica.Mechanics.MultiBody.Types.Color color=PlanarMechanics.Types.Defaults.ArrowColor + "Color of double arrow" annotation(HideResult=true, Dialog(colorSelector=true)); + input Modelica.Mechanics.MultiBody.Types.SpecularCoefficient specularCoefficient = planarWorld.defaultSpecularCoefficient + "Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)" + annotation(HideResult=true, Dialog); + + protected + outer PlanarMechanics.PlanarWorld planarWorld; + Modelica.Units.SI.Length length=Modelica.Math.Vectors.length(r_head) "Length of arrow"; + Real e_x[3](each final unit="1", start={1,0,0}) = noEvent(if length < 1.e-10 then {1,0,0} else r_head/length); + Real rxvisobj[3](each final unit="1") = transpose(R.T)*e_x + "X-axis unit vector of shape, resolved in planarWorld frame" + annotation (HideResult=true); + Modelica.Units.SI.Position rvisobj[3] = r + T.resolve1(R.T, r_tail) + "Position vector from planarWorld frame to shape frame, resolved in planarWorld frame" + annotation (HideResult=true); + + Modelica.Units.SI.Length headLength=noEvent(max(0, length - arrowLength)) + annotation(HideResult=true); + Modelica.Units.SI.Length headWidth=noEvent(max(0, diameter*PlanarMechanics.Types.Defaults.ArrowHeadWidthFraction)) + annotation(HideResult=true); + Modelica.Units.SI.Length arrowLength = noEvent(max(0, length - 1.5*diameter*PlanarMechanics.Types.Defaults.ArrowHeadLengthFraction)) + annotation(HideResult=true); + + Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape arrowLine( + length=arrowLength, + width=diameter, + height=diameter, + lengthDirection=to_unit1(r_head), + widthDirection={0,1,0}, + shapeType="cylinder", + color=color, + specularCoefficient=specularCoefficient, + r_shape=r_tail, + r=r, + R=R) if planarWorld.enableAnimation; + Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape arrowHead1( + length=2/3*headLength, + width=headWidth, + height=headWidth, + lengthDirection=to_unit1(r_head), + widthDirection={0,1,0}, + shapeType="cone", + color=color, + specularCoefficient=specularCoefficient, + r=rvisobj + rxvisobj*arrowLength, + R=R) if planarWorld.enableAnimation; + Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape arrowHead2( + length=2/3*headLength, + width=headWidth, + height=headWidth, + lengthDirection=to_unit1(r_head), + widthDirection={0,1,0}, + shapeType="cone", + color=color, + specularCoefficient=specularCoefficient, + r=rvisobj + rxvisobj*(arrowLength + headLength/3), + R=R) if planarWorld.enableAnimation; + + annotation ( + obsolete = "Obsolete model - use Modelica.Mechanics.MultiBody.Visualizers.Advanced.DoubleArrow instead", + Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ + 100,100}}), graphics={ + Rectangle( + extent={{-100,30},{0,-30}}, + lineColor={128,128,128}, + fillColor={128,128,128}, + fillPattern=FillPattern.Solid), + Polygon( + points={{40,60},{100,0},{40,-60},{40,60}}, + lineColor={128,128,128}, + fillColor={128,128,128}, + fillPattern=FillPattern.Solid), + Polygon( + points={{0,60},{60,0},{0,-60},{0,60}}, + lineColor={128,128,128}, + fillColor={128,128,128}, + fillPattern=FillPattern.Solid), + Text( + extent={{-150,100},{150,60}}, + textString="%name", + textColor={0,0,255})}), + Documentation(info=" +
+Obsolete model that was previously used to visualize a double arrow +that is dynamically scaled at the defined location. This model is only provided for +backward compatibility – use +Modelica.Mechanics.MultiBody.Visualizers.Advanced.DoubleArrow +instead. +Optionally, +Modelica.Mechanics.MultiBody.Visualizers.Advanced.Vector +can be used for visualization of a 3-dimensional torque quantity. +
+")); + end DoubleArrow; + end Advanced; + end Visualizers; + annotation ( + preferredView="info", + version="2.0.0", + versionDate="2024-01-08", + dateModified = "2024-01-08 12:00:00Z", + uses( + Modelica(version="4.0.0"), + PlanarMechanics(version="2.0.0")), + Documentation( + info=" ++This package contains models and blocks from the PlanarMechanics Library +version 1.6.0 that are no longer available in the version 2.0.0. +The conversion script for version 2.0.0 changes references in existing +user models automatically to the models and blocks of package +ObsoletePlanarMechanics2. The user should manually replace all +references to ObsoletePlanarMechanics2 in his/her models to the models +that are recommended in the documentation of the respective model. +
+ ++In most cases, this means that a model with the name +\"ObsoletePlanarMechanics2.XY\" should be renamed to \"PlanarMechanics.YZ\" +(version 2.0.0) and manually adaptated afterwards. +This usually requires some changes at the place where +the class is used (besides the renaming of the underlying class). +
+ ++The models in ObsoletePlanarMechanics2 either not comply to the +Modelica Language version 3.4 and higher, or the model was changed significantly +to get a better design. +In all cases, an automatic conversion to the new implementation +was not feasible. +
+ ++In order to easily detect obsolete models and blocks, all of them are particularly +marked in the icon layer with a red box. +
+ + ++Copyright © 2024, Deutsches Zentrum für Luft- und Raumfahrt (DLR) +
++This Modelica package is free software and the use is completely +at your own risk; it can be redistributed and/or modified under +the terms of the 3-Clause BSD license. For license conditions (including +the disclaimer of warranty) visit +https://modelica.org/licenses/modelica-3-clause-bsd. +
+")); +end ObsoletePlanarMechanics2; diff --git a/PlanarMechanics/Resources/Scripts/Conversion/ConvertFromPlanarMechanics_2_0_0.mos b/PlanarMechanics/Resources/Scripts/Conversion/ConvertFromPlanarMechanics_2_0_0.mos index 9357b98..4c9f121 100644 --- a/PlanarMechanics/Resources/Scripts/Conversion/ConvertFromPlanarMechanics_2_0_0.mos +++ b/PlanarMechanics/Resources/Scripts/Conversion/ConvertFromPlanarMechanics_2_0_0.mos @@ -17,10 +17,7 @@ convertModifiers({"PlanarMechanics.Sensors.CutTorque", // convertModifiers({"PlanarMechanics.Sensors.Distance"}, // {"arrowDiameter"}, fill("", 0), true); convertClass("PlanarMechanics.Visualizers.Advanced.DoubleArrow", - "Modelica.Mechanics.MultiBody.Visualizers.Advanced.DoubleArrow") -convertModifiers("PlanarMechanics.Visualizers.Advanced.DoubleArrow", - {"diameter"}, fill("", 0), true); - + "ObsoletePlanarMechanics2.Visualizers.Advanced.DoubleArrow") // convertModifiers({"PlanarMechanics.Sources.RelativeForce", // "PlanarMechanics.Sources.QuadraticSpeedDependentForce",