From 4fe31b146867f93efc620d832d40aedd1702bed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Wed, 8 Dec 2021 14:26:27 +0100 Subject: [PATCH 1/7] Initial draft of removing cycles between Modelica--ModelicaServices --- Modelica/Icons.mo | 190 +--- .../Mechanics/MultiBody/Frames/Orientation.mo | 7 +- .../MultiBody/Frames/nullRotation.mo | 28 +- .../partialSurfaceCharacteristic.mo | 23 +- .../Mechanics/MultiBody/Types/ShapeType.mo | 63 +- .../MultiBody/Visualizers/Advanced/Shape.mo | 2 +- .../MultiBody/Visualizers/Advanced/Surface.mo | 2 +- Modelica/Utilities/Internal.mo | 151 ---- Modelica/package.mo | 2 +- .../Frames/Orientation.mo | 66 ++ .../Frames/nullRotation.mo | 28 + ModelicaAnimationInterface/Frames/package.mo | 4 + ModelicaAnimationInterface/Icons.mo | 818 ++++++++++++++++++ ModelicaAnimationInterface/Interfaces.mo | 3 + .../partialSurfaceCharacteristic.mo | 24 + ModelicaAnimationInterface/Types/Color.mo | 30 + .../Types/ShapeExtra.mo | 51 ++ ModelicaAnimationInterface/Types/ShapeType.mo | 63 ++ .../Types/SpecularCoefficient.mo | 22 + .../Types/VectorQuantity.mo | 36 + ModelicaAnimationInterface/Types/package.mo | 9 + ModelicaAnimationInterface/package.mo | 105 +++ ModelicaServices/Interfaces/package.mo | 49 ++ ModelicaServices/package.mo | 36 +- ModelicaServices/package.order | 1 + 25 files changed, 1343 insertions(+), 470 deletions(-) create mode 100644 ModelicaAnimationInterface/Frames/Orientation.mo create mode 100644 ModelicaAnimationInterface/Frames/nullRotation.mo create mode 100644 ModelicaAnimationInterface/Frames/package.mo create mode 100644 ModelicaAnimationInterface/Icons.mo create mode 100644 ModelicaAnimationInterface/Interfaces.mo create mode 100644 ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo create mode 100644 ModelicaAnimationInterface/Types/Color.mo create mode 100644 ModelicaAnimationInterface/Types/ShapeExtra.mo create mode 100644 ModelicaAnimationInterface/Types/ShapeType.mo create mode 100644 ModelicaAnimationInterface/Types/SpecularCoefficient.mo create mode 100644 ModelicaAnimationInterface/Types/VectorQuantity.mo create mode 100644 ModelicaAnimationInterface/Types/package.mo create mode 100644 ModelicaAnimationInterface/package.mo create mode 100644 ModelicaServices/Interfaces/package.mo diff --git a/Modelica/Icons.mo b/Modelica/Icons.mo index 1723aaa65e..6fa28b5432 100644 --- a/Modelica/Icons.mo +++ b/Modelica/Icons.mo @@ -1,83 +1,11 @@ within Modelica; package Icons "Library of icons" - partial class Information "Icon for general information packages" + partial class Information = ModelicaAnimationInterface.Icons.Information; + extends ModelicaAnimationInterface.Icons.Package; - annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ - Ellipse( - lineColor={75,138,73}, - fillColor={75,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - extent={{-100.0,-100.0},{100.0,100.0}}), - Polygon(origin={-4.167,-15.0}, - fillColor={255,255,255}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,-50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}}, - smooth=Smooth.Bezier), - Ellipse(origin={7.5,56.5}, - fillColor={255,255,255}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - extent={{-12.5,-12.5},{12.5,12.5}})}), - Documentation(info=" -

This icon indicates classes containing only documentation, intended for general description of, e.g., concepts and features of a package.

-")); - end Information; - extends Icons.Package; - - partial class Contact "Icon for contact information" - - annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, - -100},{100,100}}), graphics={ - Rectangle( - extent={{-100,70},{100,-72}}, - fillColor={235,235,235}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-100,-72},{100,-72},{0,20},{-100,-72}}, - fillColor={215,215,215}, - fillPattern=FillPattern.Solid), - Polygon( - points={{22,0},{100,70},{100,-72},{22,0}}, - fillColor={235,235,235}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-100,70},{100,70},{0,-20},{-100,70}}, - fillColor={241,241,241}, - fillPattern=FillPattern.Solid)}), - Documentation(info=" -

This icon shall be used for the contact information of the library developers.

-")); - end Contact; - - partial class ReleaseNotes "Icon for release notes in documentation" - - annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, - -100},{100,100}}), graphics={ - Polygon( - points={{-80,-100},{-80,100},{0,100},{0,20},{80,20},{80,-100},{-80, - -100}}, - fillColor={245,245,245}, - fillPattern=FillPattern.Solid), - Polygon( - points={{0,100},{80,20},{0,20},{0,100}}, - fillColor={215,215,215}, - fillPattern=FillPattern.Solid), - Line(points={{2,-12},{50,-12}}), - Ellipse( - extent={{-56,2},{-28,-26}}, - fillColor={215,215,215}, - fillPattern=FillPattern.Solid), - Line(points={{2,-60},{50,-60}}), - Ellipse( - extent={{-56,-46},{-28,-74}}, - fillColor={215,215,215}, - fillPattern=FillPattern.Solid)}), Documentation(info=" -

This icon indicates release notes and the revision history of a library.

-")); + partial class Contact = ModelicaAnimationInterface.Icons.Contact; - end ReleaseNotes; + partial class ReleaseNotes = ModelicaAnimationInterface.Icons.ReleaseNotes; partial class References "Icon for external references" @@ -137,22 +65,7 @@ package Icons "Library of icons" ")); end Example; - partial package Package "Icon for standard packages" - - annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0)}), Documentation(info=" -

Standard package icon.

-")); - end Package; + partial package Package = ModelicaAnimationInterface.Icons.Package; partial package BasesPackage "Icon for packages containing base classes" extends Modelica.Icons.Package; @@ -339,46 +252,7 @@ package Icons "Library of icons" extent={{-12.5,-12.5},{12.5,12.5}})})); end IconsPackage; - partial package InternalPackage - "Icon for an internal package (indicating that the package should not be directly utilized by user)" - - annotation ( - Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, - 100}}), graphics={ - Rectangle( - lineColor={215,215,215}, - fillColor={255,255,255}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100,-100},{100,100}}, - radius=25), - Rectangle( - lineColor={215,215,215}, - extent={{-100,-100},{100,100}}, - radius=25), - Ellipse( - extent={{-80,80},{80,-80}}, - lineColor={215,215,215}, - fillColor={215,215,215}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-55,55},{55,-55}}, - lineColor={255,255,255}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-60,14},{60,-14}}, - lineColor={215,215,215}, - fillColor={215,215,215}, - fillPattern=FillPattern.Solid, - rotation=45)}), - Documentation(info=" - -

-This icon shall be used for a package that contains internal classes not to be -directly utilized by a user. -

-")); - end InternalPackage; + partial package InternalPackage = ModelicaAnimationInterface.Icons.InternalPackage; partial package MaterialPropertiesPackage "Icon for package containing property classes" @@ -498,57 +372,9 @@ This icon is designed for a translational sensor model.

")); end RectangularSensor; - partial function Function "Icon for functions" + partial function Function = ModelicaAnimationInterface.Icons.Function; - annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ - Text( - textColor={0,0,255}, - extent={{-150,105},{150,145}}, - textString="%name"), - Ellipse( - lineColor = {108,88,49}, - fillColor = {255,215,136}, - fillPattern = FillPattern.Solid, - extent = {{-100,-100},{100,100}}), - Text( - textColor={108,88,49}, - extent={{-90.0,-90.0},{90.0,90.0}}, - textString="f")}), - Documentation(info=" -

This icon indicates Modelica functions.

-")); - end Function; - - partial record Record "Icon for records" - - annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Text( - textColor={0,0,255}, - extent={{-150,60},{150,100}}, - textString="%name"), - Rectangle( - origin={0.0,-25.0}, - lineColor={64,64,64}, - fillColor={255,215,136}, - fillPattern=FillPattern.Solid, - extent={{-100.0,-75.0},{100.0,75.0}}, - radius=25.0), - Line( - points={{-100.0,0.0},{100.0,0.0}}, - color={64,64,64}), - Line( - origin={0.0,-50.0}, - points={{-100.0,0.0},{100.0,0.0}}, - color={64,64,64}), - Line( - origin={0.0,-25.0}, - points={{0.0,75.0},{0.0,-75.0}}, - color={64,64,64})}), Documentation(info=" -

-This icon is indicates a record. -

-")); - end Record; + partial record Record = ModelicaAnimationInterface.Icons.Record; type TypeReal "Icon for Real types" extends Real; diff --git a/Modelica/Mechanics/MultiBody/Frames/Orientation.mo b/Modelica/Mechanics/MultiBody/Frames/Orientation.mo index f2217c87e9..72d9e6aa45 100644 --- a/Modelica/Mechanics/MultiBody/Frames/Orientation.mo +++ b/Modelica/Mechanics/MultiBody/Frames/Orientation.mo @@ -1,11 +1,6 @@ within Modelica.Mechanics.MultiBody.Frames; record Orientation - "Orientation object defining rotation from a frame 1 into a frame 2" - - extends Modelica.Icons.Record; - Real T[3, 3] "Transformation matrix from world frame to local frame"; - SI.AngularVelocity w[3] - "Absolute angular velocity of local frame, resolved in local frame"; + extends ModelicaAnimationInterface.Frames.Orientation; encapsulated function equalityConstraint "Return the constraint residues to express that two frames have the same orientation" diff --git a/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo b/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo index 8161d7e261..84c7ef945c 100644 --- a/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo +++ b/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo @@ -1,28 +1,2 @@ within Modelica.Mechanics.MultiBody.Frames; -function nullRotation - "Return orientation object that does not rotate a frame" - extends Modelica.Icons.Function; - output Orientation R - "Orientation object such that frame 1 and frame 2 are identical"; -algorithm - R := Orientation(T=identity(3),w= zeros(3)); - annotation(Inline=true, Documentation(info=" -

Syntax

-
-R = Frames.nullRotation();
-
- -

Description

-

-The function call Frames.nullRotation() returns an orientation matrix R -describing the orientation object to rotate frame 1 into frame 2, if frame 1 and frame 2 are identical. -(= transformation matrix is identity matrix and angular velocity is zero). -

- -

See also

-

-TransformationMatrices.nullRotation, -Quaternions.nullRotation. -

-")); -end nullRotation; +function nullRotation = ModelicaAnimationInterface.Frames.nullRotation; diff --git a/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo b/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo index b6ff29b835..d06f59037e 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo @@ -1,23 +1,2 @@ within Modelica.Mechanics.MultiBody.Interfaces; -partial function partialSurfaceCharacteristic "Interface for a function returning surface characteristics" - extends Modelica.Icons.Function; - input Integer nu "Number of points in u-Dimension"; - input Integer nv "Number of points in v-Dimension"; - input Boolean multiColoredSurface=false - "= true: Color is defined for each surface point"; - output SI.Position X[nu,nv] - "[nu,nv] positions of points in x-Direction resolved in surface frame"; - output SI.Position Y[nu,nv] - "[nu,nv] positions of points in y-Direction resolved in surface frame"; - output SI.Position Z[nu,nv] - "[nu,nv] positions of points in z-Direction resolved in surface frame"; - output Real C[if multiColoredSurface then nu else 0, - if multiColoredSurface then nv else 0,3] - "[nu,nv,3] Color array, defining the color for each surface point"; - annotation (Documentation(info=" -

This partial function defines the interface of a function that returns -surface characteristics for an object visualization, see e.g. -Visualizers.Advanced.SurfaceCharacteristics.torus. -

-")); -end partialSurfaceCharacteristic; +partial function partialSurfaceCharacteristic = ModelicaAnimationInterface.Interfaces.partialSurfaceCharacteristic; \ No newline at end of file diff --git a/Modelica/Mechanics/MultiBody/Types/ShapeType.mo b/Modelica/Mechanics/MultiBody/Types/ShapeType.mo index c213269a0f..a83f87bcfb 100644 --- a/Modelica/Mechanics/MultiBody/Types/ShapeType.mo +++ b/Modelica/Mechanics/MultiBody/Types/ShapeType.mo @@ -1,63 +1,2 @@ within Modelica.Mechanics.MultiBody.Types; -type ShapeType = Modelica.Icons.TypeString - "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )" - annotation ( choices( - choice="box" "\"box\"", - choice="sphere" "\"sphere\"", - choice="cylinder" "\"cylinder\"", - choice="pipecylinder" "\"pipecylinder\"", - choice="cone" "\"cone\"", - choice="pipe" "\"pipe\"", - choice="beam" "\"beam\"", - choice="gearwheel" "\"gearwheel\"", - choice="spring" "\"spring\"", - choice="modelica://PackageName/PathName.dxf"), - Documentation(info=" -

-Type ShapeType is used to define the shape of the -visual object as parameter String. Usually, \"shapeType\" is used -as instance name. The following -values for shapeType are possible, e.g., shapeType=\"box\": -

- -
-\"model -
- -

-The dark blue arrows in the figure above are directed along -variable lengthDirection. The light blue arrows are directed -along variable widthDirection. The coordinate systems -in the figure represent frame_a of the Shape component. -

- -

-Additionally, external shapes can be specified as (not all options might be supported by all tools): -

- - - -

-The supported file formats are tool dependent. Most tools support -at least DXF-files (a tool might support 3-dim. Face of the DXF format only), -but may support other format as well (such as stl, obj, 3ds). -Since visualization files contain color and other data, the corresponding -information in the model is usually ignored. -

-")); +type ShapeType = ModelicaAnimationInterface.Types.ShapeType; diff --git a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo index ef29a9a31f..22c31dac71 100644 --- a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo +++ b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo @@ -3,7 +3,7 @@ model Shape "Visualizing an elementary object with variable size; all data have to be set as modifiers (see info layer)" extends ModelicaServices.Animation.Shape; - extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialShape; + extends ModelicaAnimationInterface.PartialShape; annotation ( Icon(coordinateSystem( diff --git a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo index 4fc065e03d..e6fd1474f8 100644 --- a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo +++ b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo @@ -2,7 +2,7 @@ within Modelica.Mechanics.MultiBody.Visualizers.Advanced; model Surface "Visualizing a moveable, parameterized surface; the surface characteristic is provided by a function" extends Modelica.Mechanics.MultiBody.Icons.Surface; - extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialSurface; + extends ModelicaAnimationInterface.PartialSurface; extends ModelicaServices.Animation.Surface; annotation (Icon(graphics={Polygon( points={{-102,40},{-98,92},{28,-8},{96,146},{104,-118},{-18,-34},{-52, diff --git a/Modelica/Utilities/Internal.mo b/Modelica/Utilities/Internal.mo index acfc1725ef..b87b4e6be6 100644 --- a/Modelica/Utilities/Internal.mo +++ b/Modelica/Utilities/Internal.mo @@ -3,157 +3,6 @@ package Internal "Internal components that a user should usually not directly utilize" extends Modelica.Icons.InternalPackage; import Modelica.Units.SI; -package PartialModelicaServices - "Interfaces of components requiring a tool specific implementation" - extends Modelica.Icons.InternalPackage; - package Animation "Models and functions for 3-dim. animation" - extends Modelica.Icons.Package; - partial model PartialShape "Interface for 3D animation of elementary shapes" - - import Modelica.Mechanics.MultiBody.Frames; - import Modelica.Mechanics.MultiBody.Types; - - parameter Types.ShapeType shapeType="box" - "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )"; - input Frames.Orientation R=Frames.nullRotation() - "Orientation object to rotate the world frame into the object frame" annotation(Dialog); - input SI.Position r[3]={0,0,0} - "Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog); - input SI.Position r_shape[3]={0,0,0} - "Position vector from origin of object frame to shape origin, resolved in object frame" annotation(Dialog); - input Real lengthDirection[3](each final unit="1")={1,0,0} - "Vector in length direction, resolved in object frame" annotation(Dialog); - input Real widthDirection[3](each final unit="1")={0,1,0} - "Vector in width direction, resolved in object frame" annotation(Dialog); - input SI.Length length=0 "Length of visual object" annotation(Dialog); - input SI.Length width=0 "Width of visual object" annotation(Dialog); - input SI.Length height=0 "Height of visual object" annotation(Dialog); - input Types.ShapeExtra extra=0.0 - "Additional size data for some of the shape types" annotation(Dialog); - input Real color[3]={255,0,0} "Color of shape" annotation(Dialog(colorSelector=true)); - input Types.SpecularCoefficient specularCoefficient = 0.7 - "Reflection of ambient light (= 0: light is completely absorbed)" annotation(Dialog); - - annotation ( - Documentation(info=" -

-This model is documented at -Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape. -

-")); - - end PartialShape; - - partial model PartialVector "Interface for 3D animation of a vector quantity (force, torque etc)" - import Modelica.Mechanics.MultiBody.Types; - import Modelica.Mechanics.MultiBody.Frames; - - input Frames.Orientation R=Frames.nullRotation() - "Orientation object to rotate the world frame into the vector frame" annotation(Dialog); - input SI.Position r[3]={0,0,0} - "Position vector from origin of world frame to origin of vector frame, resolved in world frame" annotation(Dialog); - input Real coordinates[3]={0,0,0} - "Coordinates of the vector resolved in vector frame" annotation(Dialog); - input Types.Color color=Types.Defaults.ArrowColor - "Color of vector" annotation(Dialog(colorSelector=true)); - input Types.SpecularCoefficient specularCoefficient = 0.7 - "Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)" annotation(Dialog); - parameter Types.VectorQuantity quantity = Types.VectorQuantity.Force "Quantity of the coordinates"; - input Boolean headAtOrigin=false "= true, if the vector is pointing towards the origin of vector frame" annotation(Dialog); - input Boolean twoHeadedArrow=false "= true, if the arrow has two heads after each other (pointing in the same direction)" annotation(Dialog); - - annotation ( - Documentation(info=" -

-This model is documented at -Modelica.Mechanics.MultiBody.Visualizers.Advanced.Vector. -

-")); - end PartialVector; - - partial model PartialSurface "Interface for 3D animation of surfaces" - - import Modelica.Mechanics.MultiBody.Frames; - import Modelica.Mechanics.MultiBody.Types; - - input Frames.Orientation R=Frames.nullRotation() - "Orientation object to rotate the world frame into the surface frame" - annotation(Dialog(group="Surface frame")); - input SI.Position r_0[3]={0,0,0} - "Position vector from origin of world frame to origin of surface frame, resolved in world frame" - annotation(Dialog(group="Surface frame")); - - parameter Integer nu=2 "Number of points in u-Dimension" annotation(Dialog(group="Surface properties")); - parameter Integer nv=2 "Number of points in v-Dimension" annotation(Dialog(group="Surface properties")); - replaceable function surfaceCharacteristic = - Modelica.Mechanics.MultiBody.Interfaces.partialSurfaceCharacteristic - "Function defining the surface characteristic" - annotation(choicesAllMatching=true,Dialog(group="Surface properties")); - - parameter Boolean wireframe=false "= true: 3D model will be displayed without faces" - annotation (Dialog(group="Material properties"),choices(checkBox=true)); - parameter Boolean multiColoredSurface=false "= true: Color is defined for each surface point" - annotation(Dialog(group="Material properties"),choices(checkBox=true)); - input Real color[3]={255,0,0} "Color of surface" annotation(Dialog(colorSelector=true,group="Material properties", enable=not multiColoredSurface)); - input Types.SpecularCoefficient specularCoefficient = 0.7 - "Reflection of ambient light (= 0: light is completely absorbed)" - annotation(Dialog(group="Material properties")); - input Real transparency=0 "Transparency of shape: 0 (= opaque) ... 1 (= fully transparent)" - annotation(Dialog(group="Material properties")); - - annotation (Documentation(info=" -

-This model is documented at -Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface. -

-")); - end PartialSurface; - end Animation; - - package ExternalReferences "Functions to access external resources" - extends Modelica.Icons.InternalPackage; - partial function PartialLoadResource - "Interface for tool specific function to return the absolute path name of a URI or local file name" - extends Modelica.Icons.Function; - input String uri "URI or local file name"; - output String fileReference "Absolute path name of file"; - annotation (Documentation(info=" -

-This partial function defines the function interface of a tool-specific implementation -in package ModelicaServices. The interface is documented at -Modelica.Utilities.Internal.FileSystem.loadResource. -

- -")); - end PartialLoadResource; - end ExternalReferences; - - package System "System dependent functions" - extends Modelica.Icons.InternalPackage; - partial function exitBase "Interface for tool specific function to terminate the execution of the Modelica environment" - extends Modelica.Icons.Function; - input Integer status=0 "Result to be returned by environment (0 means success)"; - annotation (Documentation(info=" -

-This partial function defines the function interface of a tool-specific implementation -in package ModelicaServices. -

-")); - end exitBase; - end System; - annotation (Documentation(info=" - -

-This package contains interfaces of a set of functions and models used in the -Modelica Standard Library that requires a tool specific implementation. -There is an associated package called ModelicaServices. A tool vendor -should provide a proper implementation of this library for the corresponding -tool. The default implementation is \"do nothing\". -In the Modelica Standard Library, the models and functions of ModelicaServices -are used. -

-")); -end PartialModelicaServices; package FileSystem "Internal package with external functions as interface to the file system" diff --git a/Modelica/package.mo b/Modelica/package.mo index 38bff3cffc..213e0634c3 100644 --- a/Modelica/package.mo +++ b/Modelica/package.mo @@ -9000,7 +9000,7 @@ version="4.0.0", versionDate="2020-06-04", dateModified = "2020-06-04 11:00:00Z", revisionId="$Format:%h %ci$", -uses(Complex(version="4.0.0"), ModelicaServices(version="4.0.0")), +uses(Complex(version="4.0.0"), ModelicaServices(version="4.0.0")), ModelicaAnimationInterface(version="4.0.0"), conversion( from(version={"3.0", "3.0.1", "3.1", "3.2", "3.2.1", "3.2.2", "3.2.3"}, script="modelica://Modelica/Resources/Scripts/Conversion/ConvertModelica_from_3.2.3_to_4.0.0.mos")), Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={ diff --git a/ModelicaAnimationInterface/Frames/Orientation.mo b/ModelicaAnimationInterface/Frames/Orientation.mo new file mode 100644 index 0000000000..454c70ecb9 --- /dev/null +++ b/ModelicaAnimationInterface/Frames/Orientation.mo @@ -0,0 +1,66 @@ +within ModelicaAnimationInterface.Frames; +record Orientation + "Orientation object defining rotation from a frame 1 into a frame 2" + + extends Icons.Record; + Real T[3, 3] "Transformation matrix from world frame to local frame"; + Types.AngularVelocity w[3] + "Absolute angular velocity of local frame, resolved in local frame"; + + annotation (Documentation(info=" +

+This object describes the rotation from a frame 1 into a frame 2. +An instance of this type should never be directly accessed but +only with the access functions provided +in package Modelica.Mechanics.MultiBody.Frames. As a consequence, it is not necessary to know +the internal representation of this object as described in the next paragraphs. +

+

+\"Orientation\" is defined to be a record consisting of two +elements: \"Real T[3,3]\", the transformation matrix to rotate frame 1 +into frame 2 and \"Real w[3]\", the angular velocity of frame 2 with +respect to frame 1, resolved in frame 2. Element \"T\" +has the following interpretation: +

+ +
+Orientation R;
+R.T = [ex, ey, ez];
+    e.g., R.T = [1,0,0; 0,1,0; 0,0,1]
+
+ +

+where ex,ey,ez +are unit vectors in the direction of the x-axis, y-axis, and z-axis +of frame 1, resolved in frame 2, respectively. Therefore, if v1 +is vector v resolved in frame 1 and v2 is +vector v resolved in frame 2, the following relationship holds: +

+ +
+v2 = R.T * v1
+
+ +

+The inverse orientation +R_inv.T = R.TT describes the rotation +from frame 2 into frame 1. +

+

+Since the orientation is described by 9 variables, there are +6 constraints between these variables. These constraints +are defined in function Frames.orientationConstraint. +

+

+R.w is the angular velocity of frame 2 with respect to frame 1, resolved +in frame 2. Formally, R.w is defined as:
+skew(R.w) = R.T*der(transpose(R.T)) +with +

+
+          |   0   -w[3]  w[2] |
+skew(w) = |  w[3]   0   -w[1] |
+          | -w[2]  w[1]     0 |
+
+")); +end Orientation; diff --git a/ModelicaAnimationInterface/Frames/nullRotation.mo b/ModelicaAnimationInterface/Frames/nullRotation.mo new file mode 100644 index 0000000000..5d3ac71278 --- /dev/null +++ b/ModelicaAnimationInterface/Frames/nullRotation.mo @@ -0,0 +1,28 @@ +within ModelicaAnimationInterface.Frames; +function nullRotation + "Return orientation object that does not rotate a frame" + extends Icons.Function; + output Orientation R + "Orientation object such that frame 1 and frame 2 are identical"; +algorithm + R := Orientation(T=identity(3),w= zeros(3)); + annotation(Inline=true, Documentation(info=" +

Syntax

+
+R = Frames.nullRotation();
+
+ +

Description

+

+The function call Frames.nullRotation() returns an orientation matrix R +describing the orientation object to rotate frame 1 into frame 2, if frame 1 and frame 2 are identical. +(= transformation matrix is identity matrix and angular velocity is zero). +

+ +

See also

+

+TransformationMatrices.nullRotation, +Quaternions.nullRotation. +

+")); +end nullRotation; diff --git a/ModelicaAnimationInterface/Frames/package.mo b/ModelicaAnimationInterface/Frames/package.mo new file mode 100644 index 0000000000..5eca278c40 --- /dev/null +++ b/ModelicaAnimationInterface/Frames/package.mo @@ -0,0 +1,4 @@ +within ModelicaAnimationInterface; + +package Frames +end Frames; diff --git a/ModelicaAnimationInterface/Icons.mo b/ModelicaAnimationInterface/Icons.mo new file mode 100644 index 0000000000..dd7d2ae10a --- /dev/null +++ b/ModelicaAnimationInterface/Icons.mo @@ -0,0 +1,818 @@ +within ModelicaAnimationInterface; +package Icons "Library of icons" + partial class Information "Icon for general information packages" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Ellipse( + lineColor={75,138,73}, + fillColor={75,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-100.0,-100.0},{100.0,100.0}}), + Polygon(origin={-4.167,-15.0}, + fillColor={255,255,255}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,-50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}}, + smooth=Smooth.Bezier), + Ellipse(origin={7.5,56.5}, + fillColor={255,255,255}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-12.5,-12.5},{12.5,12.5}})}), + Documentation(info=" +

This icon indicates classes containing only documentation, intended for general description of, e.g., concepts and features of a package.

+")); + end Information; + extends Icons.Package; + + partial class Contact "Icon for contact information" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Rectangle( + extent={{-100,70},{100,-72}}, + fillColor={235,235,235}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-100,-72},{100,-72},{0,20},{-100,-72}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Polygon( + points={{22,0},{100,70},{100,-72},{22,0}}, + fillColor={235,235,235}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-100,70},{100,70},{0,-20},{-100,70}}, + fillColor={241,241,241}, + fillPattern=FillPattern.Solid)}), + Documentation(info=" +

This icon shall be used for the contact information of the library developers.

+")); + end Contact; + + partial class ReleaseNotes "Icon for release notes in documentation" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Polygon( + points={{-80,-100},{-80,100},{0,100},{0,20},{80,20},{80,-100},{-80, + -100}}, + fillColor={245,245,245}, + fillPattern=FillPattern.Solid), + Polygon( + points={{0,100},{80,20},{0,20},{0,100}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Line(points={{2,-12},{50,-12}}), + Ellipse( + extent={{-56,2},{-28,-26}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Line(points={{2,-60},{50,-60}}), + Ellipse( + extent={{-56,-46},{-28,-74}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid)}), Documentation(info=" +

This icon indicates release notes and the revision history of a library.

+")); + + end ReleaseNotes; + + partial class References "Icon for external references" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Polygon( + points={{-100,-80},{-100,60},{-80,54},{-80,80},{-40,58},{-40,100},{ + -10,60},{90,60},{100,40},{100,-100},{-20,-100},{-100,-80}}, + lineColor={0,0,255}, + pattern=LinePattern.None, + fillColor={245,245,245}, + fillPattern=FillPattern.Solid), + Polygon(points={{-20,-100},{-10,-80},{90,-80},{100,-100},{-20,-100}}), + Line(points={{90,-80},{90,60},{100,40},{100,-100}}), + Line(points={{90,60},{-10,60},{-10,-80}}), + Line(points={{-10,60},{-40,100},{-40,-40},{-10,-80},{-10,60}}), + Line(points={{-20,-88},{-80,-60},{-80,80},{-40,58}}), + Line(points={{-20,-100},{-100,-80},{-100,60},{-80,54}}), + Line(points={{10,30},{72,30}}), + Line(points={{10,-10},{70,-10}}), + Line(points={{10,-50},{70,-50}})}), Documentation(info= + " +

This icon indicates a documentation class containing references to external documentation and literature.

+")); + + end References; + + partial package ExamplesPackage + "Icon for packages containing runnable examples" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), Documentation(info=" +

This icon indicates a package that contains executable examples.

+")); + end ExamplesPackage; + + partial model Example "Icon for runnable examples" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent = {{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points = {{-36,60},{64,0},{-36,-60},{-36,60}})}), Documentation(info=" +

This icon indicates an example. The play button suggests that the example can be executed.

+")); + end Example; + + partial package Package "Icon for standard packages" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0)}), Documentation(info=" +

Standard package icon.

+")); + end Package; + + partial package BasesPackage "Icon for packages containing base classes" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Ellipse( + extent={{-30.0,-30.0},{30.0,30.0}}, + lineColor={128,128,128}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), + Documentation(info=" +

This icon shall be used for a package/library that contains base models and classes, respectively.

+")); + end BasesPackage; + + partial package VariantsPackage "Icon for package containing variants" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), + graphics={ + Ellipse( + extent={{-70.0,-70.0},{-10.0,-10.0}}, + lineColor={76,76,76}, + fillColor={76,76,76}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{70.0,-70.0},{10.0,-10.0}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{70.0,70.0},{10.0,10.0}}, + lineColor={128,128,128}, + fillColor={128,128,128}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-70.0,70.0},{-10.0,10.0}}, + lineColor={128,128,128}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), + Documentation(info=" +

This icon shall be used for a package/library that contains several variants of one component.

+")); + end VariantsPackage; + + partial package InterfacesPackage "Icon for packages containing interfaces" + extends Modelica.Icons.Package; + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), + graphics={ + Polygon( + lineColor={64,64,64}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + points={{10,70},{30,70},{60,20},{100,20},{100,-20},{60,-20},{30,-70},{10,-70}}), + Polygon( + lineColor={102,102,102}, + fillColor={102,102,102}, + fillPattern=FillPattern.Solid, + points={{-100,20},{-60,20},{-30,70},{-10,70},{-10,-70},{-30,-70},{-60,-20},{-100,-20}})}), + Documentation(info=" +

This icon indicates packages containing interfaces.

+")); + end InterfacesPackage; + + partial package SourcesPackage "Icon for packages containing sources" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Polygon(origin={23.3333,0.0}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-23.333,30.0},{46.667,0.0},{-23.333,-30.0}}), + Rectangle( + fillColor = {128,128,128}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + extent = {{-70,-4.5},{0,4.5}})}), + Documentation(info=" +

This icon indicates a package which contains sources.

+")); + end SourcesPackage; + + partial package SensorsPackage "Icon for packages containing sensors" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Ellipse(origin={0.0,-30.0}, + fillColor={255,255,255}, + extent={{-90.0,-90.0},{90.0,90.0}}, + startAngle=20.0, + endAngle=160.0), + Ellipse(origin={0.0,-30.0}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-20.0,-20.0},{20.0,20.0}}), + Line(origin={0.0,-30.0}, + points={{0.0,60.0},{0.0,90.0}}), + Ellipse(origin={-0.0,-30.0}, + fillColor={64,64,64}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-10.0,-10.0},{10.0,10.0}}), + Polygon( + origin={-0.0,-30.0}, + rotation=-35.0, + fillColor={64,64,64}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-7.0,0.0},{-3.0,85.0},{0.0,90.0},{3.0,85.0},{7.0,0.0}})}), + Documentation(info=" +

This icon indicates a package containing sensors.

+")); + end SensorsPackage; + + partial package UtilitiesPackage "Icon for utility packages" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={ + Polygon( + origin={1.3835,-4.1418}, + rotation=45.0, + fillColor={64,64,64}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-15.0,93.333},{-15.0,68.333},{0.0,58.333},{15.0,68.333},{15.0,93.333},{20.0,93.333},{25.0,83.333},{25.0,58.333},{10.0,43.333},{10.0,-41.667},{25.0,-56.667},{25.0,-76.667},{10.0,-91.667},{0.0,-91.667},{0.0,-81.667},{5.0,-81.667},{15.0,-71.667},{15.0,-61.667},{5.0,-51.667},{-5.0,-51.667},{-15.0,-61.667},{-15.0,-71.667},{-5.0,-81.667},{0.0,-81.667},{0.0,-91.667},{-10.0,-91.667},{-25.0,-76.667},{-25.0,-56.667},{-10.0,-41.667},{-10.0,43.333},{-25.0,58.333},{-25.0,83.333},{-20.0,93.333}}), + Polygon( + origin={10.1018,5.218}, + rotation=-45.0, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + points={{-15.0,87.273},{15.0,87.273},{20.0,82.273},{20.0,27.273},{10.0,17.273},{10.0,7.273},{20.0,2.273},{20.0,-2.727},{5.0,-2.727},{5.0,-77.727},{10.0,-87.727},{5.0,-112.727},{-5.0,-112.727},{-10.0,-87.727},{-5.0,-77.727},{-5.0,-2.727},{-20.0,-2.727},{-20.0,2.273},{-10.0,7.273},{-10.0,17.273},{-20.0,27.273},{-20.0,82.273}})}), + Documentation(info=" +

This icon indicates a package containing utility classes.

+")); + end UtilitiesPackage; + + partial package TypesPackage "Icon for packages containing type definitions" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={Polygon( + origin={-12.167,-23}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{12.167,65},{14.167,93},{36.167,89},{24.167,20},{4.167,-30}, + {14.167,-30},{24.167,-30},{24.167,-40},{-5.833,-50},{-15.833, + -30},{4.167,20},{12.167,65}}, + smooth=Smooth.Bezier), Polygon( + origin={2.7403,1.6673}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{49.2597,22.3327},{31.2597,24.3327},{7.2597,18.3327},{-26.7403, + 10.3327},{-46.7403,14.3327},{-48.7403,6.3327},{-32.7403,0.3327},{-6.7403, + 4.3327},{33.2597,14.3327},{49.2597,14.3327},{49.2597,22.3327}}, + smooth=Smooth.Bezier)})); + end TypesPackage; + + partial package FunctionsPackage "Icon for packages containing functions" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Text( + textColor={128,128,128}, + extent={{-90,-90},{90,90}}, + textString="f")})); + end FunctionsPackage; + + partial package IconsPackage "Icon for packages containing icons" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={Polygon( + origin={-8.167,-17}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{ + 4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833, + -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}}, + smooth=Smooth.Bezier), Ellipse( + origin={-0.5,56.5}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-12.5,-12.5},{12.5,12.5}})})); + end IconsPackage; + + partial package InternalPackage + "Icon for an internal package (indicating that the package should not be directly utilized by user)" + + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, + 100}}), graphics={ + Rectangle( + lineColor={215,215,215}, + fillColor={255,255,255}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100,-100},{100,100}}, + radius=25), + Rectangle( + lineColor={215,215,215}, + extent={{-100,-100},{100,100}}, + radius=25), + Ellipse( + extent={{-80,80},{80,-80}}, + lineColor={215,215,215}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-55,55},{55,-55}}, + lineColor={255,255,255}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-60,14},{60,-14}}, + lineColor={215,215,215}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid, + rotation=45)}), + Documentation(info=" + +

+This icon shall be used for a package that contains internal classes not to be +directly utilized by a user. +

+")); + end InternalPackage; + + partial package MaterialPropertiesPackage + "Icon for package containing property classes" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Ellipse( + lineColor={102,102,102}, + fillColor={204,204,204}, + pattern=LinePattern.None, + fillPattern=FillPattern.Sphere, + extent={{-60.0,-60.0},{60.0,60.0}})}), + Documentation(info=" +

This icon indicates a package that contains properties

+")); + end MaterialPropertiesPackage; + + partial package RecordsPackage "Icon for package containing records" + extends Modelica.Icons.Package; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Rectangle( + origin={0,-20}, + lineColor={64,64,64}, + fillColor={255,215,136}, + fillPattern=FillPattern.Solid, + extent={{-80,-60},{80,60}}, + radius=25.0), + Line( + points={{-80,0},{80,0}}, + color={64,64,64}), + Line( + origin={0,-40}, + points={{-80,0},{80,0}}, + color={64,64,64}), + Line( + origin={0,-5}, + points={{0,45},{0,-75}}, + color={64,64,64})}), + Documentation(info=" +

This icon indicates a package that contains records

+")); + end RecordsPackage; + + partial class MaterialProperty "Icon for property classes" + + annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ + Ellipse(lineColor={102,102,102}, + fillColor={204,204,204}, + pattern=LinePattern.None, + fillPattern=FillPattern.Sphere, + extent={{-100.0,-100.0},{100.0,100.0}})}), + Documentation(info=" +

This icon indicates a property class.

+")); + end MaterialProperty; + + partial class RoundSensor "Icon representing a round measurement device" + + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Ellipse( + fillColor={245,245,245}, + fillPattern=FillPattern.Solid, + extent={{-70.0,-70.0},{70.0,70.0}}), + Line(points={{0.0,70.0},{0.0,40.0}}), + Line(points={{22.9,32.8},{40.2,57.3}}), + Line(points={{-22.9,32.8},{-40.2,57.3}}), + Line(points={{37.6,13.7},{65.8,23.9}}), + Line(points={{-37.6,13.7},{-65.8,23.9}}), + Ellipse( + lineColor={64,64,64}, + fillColor={255,255,255}, + extent={{-12.0,-12.0},{12.0,12.0}}), + Polygon( + rotation=-17.5, + fillColor={64,64,64}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-5.0,0.0},{-2.0,60.0},{0.0,65.0},{2.0,60.0},{5.0,0.0}}), + Ellipse( + fillColor={64,64,64}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-7.0,-7.0},{7.0,7.0}})}), + Documentation(info=" +

+This icon is designed for a rotational sensor model. +

+")); + end RoundSensor; + + partial class RectangularSensor + "Icon representing a linear measurement device" + + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + fillColor={245,245,245}, + fillPattern=FillPattern.Solid, + extent={{-70.0,-60.0},{70.0,20.0}}), + Polygon( + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-40,-40},{-50,-16},{-30,-16},{-40,-40}}), + Line(points={{-40,0},{-40,-16}}), + Line(points={{-70,0},{-40,0}}), + Line(points={{-50.0,-40.0},{-50.0,-60.0}}), + Line(points={{-30.0,-40.0},{-30.0,-60.0}}), + Line(points={{-10.0,-40.0},{-10.0,-60.0}}), + Line(points={{10.0,-40.0},{10.0,-60.0}}), + Line(points={{30.0,-40.0},{30.0,-60.0}}), + Line(points={{50.0,-40.0},{50.0,-60.0}})}), + Documentation(info=" +

+This icon is designed for a translational sensor model. +

")); + end RectangularSensor; + + partial function Function "Icon for functions" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Text( + textColor={0,0,255}, + extent={{-150,105},{150,145}}, + textString="%name"), + Ellipse( + lineColor = {108,88,49}, + fillColor = {255,215,136}, + fillPattern = FillPattern.Solid, + extent = {{-100,-100},{100,100}}), + Text( + textColor={108,88,49}, + extent={{-90.0,-90.0},{90.0,90.0}}, + textString="f")}), + Documentation(info=" +

This icon indicates Modelica functions.

+")); + end Function; + + partial record Record "Icon for records" + + annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ + Text( + textColor={0,0,255}, + extent={{-150,60},{150,100}}, + textString="%name"), + Rectangle( + origin={0.0,-25.0}, + lineColor={64,64,64}, + fillColor={255,215,136}, + fillPattern=FillPattern.Solid, + extent={{-100.0,-75.0},{100.0,75.0}}, + radius=25.0), + Line( + points={{-100.0,0.0},{100.0,0.0}}, + color={64,64,64}), + Line( + origin={0.0,-50.0}, + points={{-100.0,0.0},{100.0,0.0}}, + color={64,64,64}), + Line( + origin={0.0,-25.0}, + points={{0.0,75.0},{0.0,-75.0}}, + color={64,64,64})}), Documentation(info=" +

+This icon is indicates a record. +

+")); + end Record; + + type TypeReal "Icon for Real types" + extends Real; + annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + lineColor={160,160,164}, + fillColor={160,160,164}, + fillPattern=FillPattern.Solid, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Text( + textColor={255,255,255}, + extent={{-90.0,-50.0},{90.0,50.0}}, + textString="R")}),Documentation(info=" +

+This icon is designed for a Real type. +

+")); + end TypeReal; + + type TypeInteger "Icon for Integer types" + extends Integer; + annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + lineColor={160,160,164}, + fillColor={160,160,164}, + fillPattern=FillPattern.Solid, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Text( + textColor={255,255,255}, + extent={{-90.0,-50.0},{90.0,50.0}}, + textString="I")}),Documentation(info=" +

+This icon is designed for an Integer type. +

+")); + end TypeInteger; + + type TypeBoolean "Icon for Boolean types" + extends Boolean; + annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + lineColor={160,160,164}, + fillColor={160,160,164}, + fillPattern=FillPattern.Solid, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Text( + textColor={255,255,255}, + extent={{-90.0,-50.0},{90.0,50.0}}, + textString="B")}), + Documentation(info=" +

+This icon is designed for a Boolean type. +

")); + end TypeBoolean; + + type TypeString "Icon for String types" + extends String; + annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + lineColor={160,160,164}, + fillColor={160,160,164}, + fillPattern=FillPattern.Solid, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Text( + textColor={255,255,255}, + extent={{-90.0,-50.0},{90.0,50.0}}, + textString="S")}),Documentation(info=" +

+This icon is designed for a String type. +

+")); + end TypeString; + + expandable connector SignalBus "Icon for signal bus" + + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}, initialScale=0.2), graphics={ + Rectangle( + lineColor={255,204,51}, + lineThickness=0.5, + extent={{-20.0,-2.0},{20.0,2.0}}), + Polygon( + fillColor={255,215,136}, + fillPattern=FillPattern.Solid, + points={{-80.0,50.0},{80.0,50.0},{100.0,30.0},{80.0,-40.0},{60.0,-50.0},{-60.0,-50.0},{-80.0,-40.0},{-100.0,30.0}}, + smooth=Smooth.Bezier), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{-65.0,15.0},{-55.0,25.0}}), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{-5.0,15.0},{5.0,25.0}}), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{55.0,15.0},{65.0,25.0}}), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{-35.0,-25.0},{-25.0,-15.0}}), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{25.0,-25.0},{35.0,-15.0}})}), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + initialScale=0.2), graphics={ + Polygon( + points={{-40,25},{40,25},{50,15},{40,-20},{30,-25},{-30,-25},{-40,-20},{-50,15}}, + fillColor={255,204,51}, + fillPattern=FillPattern.Solid, + smooth=Smooth.Bezier), + Ellipse( + extent={{-32.5,7.5},{-27.5,12.5}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-2.5,12.5},{2.5,7.5}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{27.5,12.5},{32.5,7.5}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-17.5,-7.5},{-12.5,-12.5}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{12.5,-7.5},{17.5,-12.5}}, + fillPattern=FillPattern.Solid), + Text( + extent={{-150,70},{150,40}}, + textString="%name")}), + Documentation(info=" +This icon is designed for a signal bus connector. +")); + end SignalBus; + + expandable connector SignalSubBus "Icon for signal sub-bus" + + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Line( + points={{-16.0,2.0},{16.0,2.0}}, + color={255,204,51}, + thickness=0.5), + Rectangle( + lineColor={255,204,51}, + lineThickness=0.5, + extent={{-10.0,0.0},{8.0,8.0}}), + Polygon( + fillColor={255,215,136}, + fillPattern=FillPattern.Solid, + points={{-80.0,50.0},{80.0,50.0},{100.0,30.0},{80.0,-40.0},{60.0,-50.0},{-60.0,-50.0},{-80.0,-40.0},{-100.0,30.0}}, + smooth=Smooth.Bezier), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{-55.0,15.0},{-45.0,25.0}}), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{45.0,15.0},{55.0,25.0}}), + Ellipse( + fillPattern=FillPattern.Solid, + extent={{-5.0,-25.0},{5.0,-15.0}}), + Rectangle( + lineColor={255,215,136}, + lineThickness=0.5, + extent={{-20.0,0.0},{20.0,4.0}})}), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}), graphics={ + Polygon( + points={{-40,25},{40,25},{50,15},{40,-20},{30,-25},{-30,-25},{-40,-20},{-50,15}}, + fillColor={255,204,51}, + fillPattern=FillPattern.Solid, + smooth=Smooth.Bezier), + Ellipse( + extent={{-22.5,7.5},{-17.5,12.5}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{17.5,12.5},{22.5,7.5}}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-2.5,-7.5},{2.5,-12.5}}, + fillPattern=FillPattern.Solid), + Text( + extent={{-150,70},{150,40}}, + textString= + "%name")}), + Documentation(info=" +

+This icon is designed for a sub-bus in a signal connector. +

+")); + + end SignalSubBus; + + partial class UnderConstruction + "Icon for classes that are still under construction" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Polygon(points={{-100,-100},{0,80},{100,-100},{-100,-100}}, + lineColor={255,0,0}, + lineThickness=0.5)}), Documentation(info=" +

Library developers can use this icon to indicate that the respective model is under construction.

+")); + end UnderConstruction; + + partial class ObsoleteModel + "Icon for classes that are obsolete and will be removed in later versions" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={Rectangle( + extent={{-102,102},{102,-102}}, + lineColor={255,0,0}, + pattern=LinePattern.Dash, + lineThickness=0.5)}), Documentation(info=" +

+This partial class is intended to provide a default icon +for an obsolete model that will be removed from the +corresponding library in a future release. +

+")); + end ObsoleteModel; + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={Polygon( + origin={-8.167,-17}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{ + 4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833, + -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}}, + smooth=Smooth.Bezier), Ellipse( + origin={-0.5,56.5}, + fillColor={128,128,128}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-12.5,-12.5},{12.5,12.5}})}), Documentation(info=" +

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

+ +

Main Authors

+ +
+
Martin Otter
+
Deutsches Zentrum für Luft- und Raumfahrt (DLR)
+
Institut für Systemdynamik und Regelungstechnik (SR)
+
Münchener Straße 20
+
D-82234 Weßling
+
Germany
+
email: Martin.Otter@dlr.de
+
Christian Kral
+
Electric Machines, Drives and Systems
+
1060 Vienna, Austria
+
email: dr.christian.kral@gmail.com
+
Johan Andreasson
+
Modelon AB
+
Ideon Science Park
+
22370 Lund, Sweden
+
email: johan.andreasson@modelon.se
+
+ +

+Copyright © 1998-2020, Modelica Association and contributors +

+")); +end Icons; diff --git a/ModelicaAnimationInterface/Interfaces.mo b/ModelicaAnimationInterface/Interfaces.mo new file mode 100644 index 0000000000..2767df92d9 --- /dev/null +++ b/ModelicaAnimationInterface/Interfaces.mo @@ -0,0 +1,3 @@ +within ModelicaAnimationInterface; +package Interfaces +end Interfaces; \ No newline at end of file diff --git a/ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo b/ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo new file mode 100644 index 0000000000..bf0a44ed9a --- /dev/null +++ b/ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo @@ -0,0 +1,24 @@ +within ModelicaAnimationInterface.Interfaces; + +partial function partialSurfaceCharacteristic "Interface for a function returning surface characteristics" + extends Modelica.Icons.Function; + input Integer nu "Number of points in u-Dimension"; + input Integer nv "Number of points in v-Dimension"; + input Boolean multiColoredSurface=false + "= true: Color is defined for each surface point"; + output Types.Position X[nu,nv] + "[nu,nv] positions of points in x-Direction resolved in surface frame"; + output Types.Position Y[nu,nv] + "[nu,nv] positions of points in y-Direction resolved in surface frame"; + output Types.Position Z[nu,nv] + "[nu,nv] positions of points in z-Direction resolved in surface frame"; + output Real C[if multiColoredSurface then nu else 0, + if multiColoredSurface then nv else 0,3] + "[nu,nv,3] Color array, defining the color for each surface point"; + annotation (Documentation(info=" +

This partial function defines the interface of a function that returns +surface characteristics for an object visualization, see e.g. +Visualizers.Advanced.SurfaceCharacteristics.torus. +

+")); +end partialSurfaceCharacteristic; diff --git a/ModelicaAnimationInterface/Types/Color.mo b/ModelicaAnimationInterface/Types/Color.mo new file mode 100644 index 0000000000..0e140ae1a4 --- /dev/null +++ b/ModelicaAnimationInterface/Types/Color.mo @@ -0,0 +1,30 @@ +within ModelicaAnimationInterface.Types; + +type Color = Modelica.Icons.TypeInteger[3] (each min=0, each max=255) + "RGB representation of color" + annotation ( + Dialog(colorSelector=true), + choices( + choice={0,0,0} "{0,0,0} \"black\"", + choice={155,0,0} "{155,0,0} \"dark red\"", + choice={255,0,0} "{255,0,0 } \"red\"", + choice={255,65,65} "{255,65,65} \"light red\"", + choice={0,128,0} "{0,128,0} \"dark green\"", + choice={0,180,0} "{0,180,0} \"green\"", + choice={0,230,0} "{0,230,0} \"light green\"", + choice={0,0,200} "{0,0,200} \"dark blue\"", + choice={0,0,255} "{0,0,255} \"blue\"", + choice={0,128,255} "{0,128,255} \"light blue\"", + choice={255,255,0} "{255,255,0} \"yellow\"", + choice={255,0,255} "{255,0,255} \"pink\"", + choice={100,100,100} "{100,100,100} \"dark grey\"", + choice={155,155,155} "{155,155,155} \"grey\"", + choice={255,255,255} "{255,255,255} \"white\""), + Documentation(info=" +

+Type Color is an Integer vector with 3 elements, +{r, g, b}, and specifies the color of a shape. +{r, g, b} are the \"red\", \"green\" and \"blue\" color parts. +Note, r, g and b are given in the range 0 … 255. +

+")); diff --git a/ModelicaAnimationInterface/Types/ShapeExtra.mo b/ModelicaAnimationInterface/Types/ShapeExtra.mo new file mode 100644 index 0000000000..383c29a51f --- /dev/null +++ b/ModelicaAnimationInterface/Types/ShapeExtra.mo @@ -0,0 +1,51 @@ +within ModelicaAnimationInterface.Types; +type ShapeExtra = Modelica.Icons.TypeReal + "Type of the additional data that can be defined for an elementary ShapeType" + annotation ( + Documentation(info=" +

+This type is used in shapes of visual objects to define +extra data depending on the shape type. Usually, input +variable extra is used as instance name: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
shapeTypeMeaning of parameter extra
\"cylinder\"if extra > 0, a black line is included in the + cylinder to show the rotation of it.
\"cone\"extra = diameter-left-side / diameter-right-side, i.e.,
+ extra = 1: cylinder
+ extra = 0: \"real\" cone.
\"pipe\"extra = outer-diameter / inner-diameter, i.e,
+ extra = 1: cylinder that is completely hollow
+ extra = 0: cylinder without a hole.
\"gearwheel\"extra is the number of teeth of the (external) gear. +If extra < 0, an internal gear is visualized with |extra| teeth. +The axis of the gearwheel is along \"lengthDirection\", and usually: +width = height = 2*radiusOfGearWheel.
\"spring\"extra is the number of windings of the spring. + Additionally, \"height\" is not the \"height\" but + 2*coil-width.
external shapeextra = 0: Visualization from file is not scaled.
+ extra = 1: Visualization from file is scaled with \"length\", \"width\" and \"height\" + of the shape
+")); diff --git a/ModelicaAnimationInterface/Types/ShapeType.mo b/ModelicaAnimationInterface/Types/ShapeType.mo new file mode 100644 index 0000000000..4b13e71d70 --- /dev/null +++ b/ModelicaAnimationInterface/Types/ShapeType.mo @@ -0,0 +1,63 @@ +within ModelicaAnimationInterface.Types; +type ShapeType = Icons.TypeString + "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )" + annotation ( choices( + choice="box" "\"box\"", + choice="sphere" "\"sphere\"", + choice="cylinder" "\"cylinder\"", + choice="pipecylinder" "\"pipecylinder\"", + choice="cone" "\"cone\"", + choice="pipe" "\"pipe\"", + choice="beam" "\"beam\"", + choice="gearwheel" "\"gearwheel\"", + choice="spring" "\"spring\"", + choice="modelica://PackageName/PathName.dxf"), + Documentation(info=" +

+Type ShapeType is used to define the shape of the +visual object as parameter String. Usually, \"shapeType\" is used +as instance name. The following +values for shapeType are possible, e.g., shapeType=\"box\": +

+ +
+\"model +
+ +

+The dark blue arrows in the figure above are directed along +variable lengthDirection. The light blue arrows are directed +along variable widthDirection. The coordinate systems +in the figure represent frame_a of the Shape component. +

+ +

+Additionally, external shapes can be specified as (not all options might be supported by all tools): +

+ +
    +
  • \"1\", \"2\", …
    + define external shapes specified in DXF format in files \"1.dxf\", \"2.dxf\", … + The DXF-files must be found either in the current directory or in the directory where + the Shape instance is stored that references the DXF file. + This (very limited) option should not be used for new models. Example:
    + shapeType=\"1\".
  • + +
  • \"modelica://<Modelica-name>/<relative-path-file-name>\"
    + characterizes the file that is stored under the location of the + <Modelica-name> library path with the given relative file name. + Example:
    shapeType = \"modelica://Modelica/Resources/Data/Shapes/Engine/piston.dxf\".
  • + +
  • \"file:///<absolute-file-name>\"
    + characterizes an absolute file name in the file system. Example:
    + shapeType=\"file:///C:/users/myname/shapes/piston.dxf\".
  • +
+ +

+The supported file formats are tool dependent. Most tools support +at least DXF-files (a tool might support 3-dim. Face of the DXF format only), +but may support other format as well (such as stl, obj, 3ds). +Since visualization files contain color and other data, the corresponding +information in the model is usually ignored. +

+")); diff --git a/ModelicaAnimationInterface/Types/SpecularCoefficient.mo b/ModelicaAnimationInterface/Types/SpecularCoefficient.mo new file mode 100644 index 0000000000..5409863735 --- /dev/null +++ b/ModelicaAnimationInterface/Types/SpecularCoefficient.mo @@ -0,0 +1,22 @@ +within ModelicaAnimationInterface.Types; +type SpecularCoefficient = Modelica.Icons.TypeReal(min=0) + "Reflection of ambient light (= 0: light is completely absorbed)" + annotation (choices( + choice=0 "0.0 \"dull\"", + choice=0.7 "0.7 \"medium\"", + choice=1 "1.0 \"glossy\""), + Documentation(info=" +

+Type SpecularCoefficient defines the reflection of +ambient light on shape surfaces. If value = 0, the light +is completely absorbed. Often, 0.7 is a reasonable value. +It might be that from some viewing directions, a body is no +longer visible, if the SpecularCoefficient value is too high. +In the following image, the different values of SpecularCoefficient +are shown for a cylinder: +

+ +
+ +
+")); diff --git a/ModelicaAnimationInterface/Types/VectorQuantity.mo b/ModelicaAnimationInterface/Types/VectorQuantity.mo new file mode 100644 index 0000000000..ac05cefca2 --- /dev/null +++ b/ModelicaAnimationInterface/Types/VectorQuantity.mo @@ -0,0 +1,36 @@ +within ModelicaAnimationInterface.Types; + +type VectorQuantity = enumeration( + Force "Force quantity", + Torque "Torque quantity", + Velocity "Velocity quantity", + Acceleration "Acceleration quantity", + AngularVelocity "Angular velocity quantity", + AngularAcceleration "Angular acceleration quantity", + RelativePosition "Relative position") + "Enumeration defining the kind of physical quantity represented by the vector" + annotation (Documentation(info=" + + + + + + + + + + + + + + + + + + + + + + +
Types.VectorQuantity.Meaning
ForceVector represents a force quantity
TorqueVector represents a torque quantity
VelocityVector represents a velocity quantity
AccelerationVector represents an acceleration quantity
AngularVelocityVector represents an angular velocity quantity
AngularAccelerationVector represents an angular acceleration quantity
RelativePositionVector represents the relative position
+")); diff --git a/ModelicaAnimationInterface/Types/package.mo b/ModelicaAnimationInterface/Types/package.mo new file mode 100644 index 0000000000..9bdedab734 --- /dev/null +++ b/ModelicaAnimationInterface/Types/package.mo @@ -0,0 +1,9 @@ +within ModelicaAnimationInterface; + +package Types +type Length = Real (final quantity="Length", final unit="m"); +type Position = Length; +type AngularVelocity = Real ( + final quantity="AngularVelocity", + final unit="rad/s"); +end Types; diff --git a/ModelicaAnimationInterface/package.mo b/ModelicaAnimationInterface/package.mo new file mode 100644 index 0000000000..529582d593 --- /dev/null +++ b/ModelicaAnimationInterface/package.mo @@ -0,0 +1,105 @@ +within ; + +package ModelicaAnimationInterface + extends Icons.Package; + partial model PartialShape "Interface for 3D animation of elementary shapes" + parameter Types.ShapeType shapeType="box" + "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )"; + input Frames.Orientation R=Frames.nullRotation() + "Orientation object to rotate the world frame into the object frame" annotation(Dialog); + input Types.Position r[3]={0,0,0} + "Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog); + input Types.Position r_shape[3]={0,0,0} + "Position vector from origin of object frame to shape origin, resolved in object frame" annotation(Dialog); + input Real lengthDirection[3](each final unit="1")={1,0,0} + "Vector in length direction, resolved in object frame" annotation(Dialog); + input Real widthDirection[3](each final unit="1")={0,1,0} + "Vector in width direction, resolved in object frame" annotation(Dialog); + input Types.Length length=0 "Length of visual object" annotation(Dialog); + input Types.Length width=0 "Width of visual object" annotation(Dialog); + input Types.Length height=0 "Height of visual object" annotation(Dialog); + input Types.ShapeExtra extra=0.0 + "Additional size data for some of the shape types" annotation(Dialog); + input Real color[3]={255,0,0} "Color of shape" annotation(Dialog(colorSelector=true)); + input Types.SpecularCoefficient specularCoefficient = 0.7 + "Reflection of ambient light (= 0: light is completely absorbed)" annotation(Dialog); + + annotation ( + Documentation(info=" +

+This model is documented at +Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape. +

+")); + + end PartialShape; + + partial model PartialVector "Interface for 3D animation of a vector quantity (force, torque etc)" + input Frames.Orientation R=Frames.nullRotation() + "Orientation object to rotate the world frame into the vector frame" annotation(Dialog); + input Types.Position r[3]={0,0,0} + "Position vector from origin of world frame to origin of vector frame, resolved in world frame" annotation(Dialog); + input Real coordinates[3]={0,0,0} + "Coordinates of the vector resolved in vector frame" annotation(Dialog); + input Types.Color color=Types.Defaults.ArrowColor + "Color of vector" annotation(Dialog(colorSelector=true)); + input Types.SpecularCoefficient specularCoefficient = 0.7 + "Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)" annotation(Dialog); + parameter Types.VectorQuantity quantity = Types.VectorQuantity.Force "Quantity of the coordinates"; + input Boolean headAtOrigin=false "= true, if the vector is pointing towards the origin of vector frame" annotation(Dialog); + input Boolean twoHeadedArrow=false "= true, if the arrow has two heads after each other (pointing in the same direction)" annotation(Dialog); + + annotation ( + Documentation(info=" +

+This model is documented at +Modelica.Mechanics.MultiBody.Visualizers.Advanced.Vector. +

+")); + end PartialVector; + + partial model PartialSurface "Interface for 3D animation of surfaces" + input Frames.Orientation R=Frames.nullRotation() + "Orientation object to rotate the world frame into the surface frame" + annotation(Dialog(group="Surface frame")); + input Types.Position r_0[3]={0,0,0} + "Position vector from origin of world frame to origin of surface frame, resolved in world frame" + annotation(Dialog(group="Surface frame")); + + parameter Integer nu=2 "Number of points in u-Dimension" annotation(Dialog(group="Surface properties")); + parameter Integer nv=2 "Number of points in v-Dimension" annotation(Dialog(group="Surface properties")); + replaceable function surfaceCharacteristic = + Modelica.Mechanics.MultiBody.Interfaces.partialSurfaceCharacteristic + "Function defining the surface characteristic" + annotation(choicesAllMatching=true,Dialog(group="Surface properties")); + + parameter Boolean wireframe=false "= true: 3D model will be displayed without faces" + annotation (Dialog(group="Material properties"),choices(checkBox=true)); + parameter Boolean multiColoredSurface=false "= true: Color is defined for each surface point" + annotation(Dialog(group="Material properties"),choices(checkBox=true)); + input Real color[3]={255,0,0} "Color of surface" annotation(Dialog(colorSelector=true,group="Material properties", enable=not multiColoredSurface)); + input Types.SpecularCoefficient specularCoefficient = 0.7 + "Reflection of ambient light (= 0: light is completely absorbed)" + annotation(Dialog(group="Material properties")); + input Real transparency=0 "Transparency of shape: 0 (= opaque) ... 1 (= fully transparent)" + annotation(Dialog(group="Material properties")); + + annotation (Documentation(info=" +

+This model is documented at +Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface. +

+")); + end PartialSurface; + annotation( + preferredView="info", + version="4.0.0", + Documentation(info=" +ModelicaAnimationInterface contains the interfaces of elements used to create animations in Modelica. +These interfaces are used by the Modelica Standard Library and ModelicaServices to ensure that both contain +the expected interface. +In ModelicaServices, the actual implementation may be extended to add communication with a Modelica tool in +order to for example visualize the model on the fly. +") + ); +end ModelicaAnimationInterface; diff --git a/ModelicaServices/Interfaces/package.mo b/ModelicaServices/Interfaces/package.mo new file mode 100644 index 0000000000..45e5c57110 --- /dev/null +++ b/ModelicaServices/Interfaces/package.mo @@ -0,0 +1,49 @@ +within ModelicaServices; + +package Interfaces + "Interfaces of components requiring a tool specific implementation" + extends ModelicaAnimationInterface.Icons.InternalPackage; + + package ExternalReferences "Functions to access external resources" + extends ModelicaAnimationInterface.Icons.InternalPackage; + partial function PartialLoadResource + "Interface for tool specific function to return the absolute path name of a URI or local file name" + extends ModelicaAnimationInterface.Icons.Function; + input String uri "URI or local file name"; + output String fileReference "Absolute path name of file"; + annotation (Documentation(info=" +

+This partial function defines the function interface of a tool-specific implementation +in package ModelicaServices. The interface is documented at +Modelica.Utilities.Internal.FileSystem.loadResource. +

+ +")); + end PartialLoadResource; + end ExternalReferences; + + package System "System dependent functions" + extends ModelicaAnimationInterface.Icons.InternalPackage; + partial function exitBase "Interface for tool specific function to terminate the execution of the Modelica environment" + extends ModelicaAnimationInterface.Icons.Function; + input Integer status=0 "Result to be returned by environment (0 means success)"; + annotation (Documentation(info=" +

+This partial function defines the function interface of a tool-specific implementation +in package ModelicaServices. +

+")); + end exitBase; + end System; + annotation (Documentation(info=" + +

+This package contains interfaces of a set of functions and models used in the +Modelica Standard Library that requires a tool-specific implementation. +Definitions in this package should not be modified by tool vendors. +Instead, a tool vendor should provide a proper implementation of this library for the corresponding tool in ModelicaServices. +The default implementation is \"do nothing\". +In the Modelica Standard Library, the models and functions of ModelicaServices are used. +

+")); +end Interfaces; diff --git a/ModelicaServices/package.mo b/ModelicaServices/package.mo index d64ab069dc..df5733b746 100644 --- a/ModelicaServices/package.mo +++ b/ModelicaServices/package.mo @@ -1,13 +1,13 @@ within ; package ModelicaServices "ModelicaServices (Default implementation) - Models and functions used in the Modelica Standard Library requiring a tool specific implementation" - extends Modelica.Icons.Package; + extends ModelicaAnimationInterface.Icons.Package; constant String target="Default" "Target of this ModelicaServices implementation"; package UsersGuide "User's Guide" - extends Modelica.Icons.Information; + extends ModelicaAnimationInterface.Icons.Information; class ReleaseNotes "Release notes" - extends Modelica.Icons.ReleaseNotes; + extends ModelicaAnimationInterface.Icons.ReleaseNotes; annotation (Documentation(info="

Version 4.0.0, 2020-06-04

@@ -80,7 +80,7 @@ First version of the ModelicaServices library. end ReleaseNotes; class Contact "Contact" - extends Modelica.Icons.Contact; + extends ModelicaAnimationInterface.Icons.Contact; annotation (Documentation(info="
Main Author
@@ -108,11 +108,11 @@ The design of the Animation.Shape component is from Hilding Elmqvist, previously end UsersGuide; package Animation "Models and functions for 3-dim. animation" - extends Modelica.Icons.Package; + extends ModelicaAnimationInterface.Icons.Package; model Shape "Different visual shapes with variable size; all data have to be set as modifiers (see info layer)" extends - Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialShape; + ModelicaAnimationInterface.PartialShape; annotation (Icon(coordinateSystem( preserveAspectRatio=true, @@ -130,7 +130,7 @@ The interface of this model is documented at model Surface "Animation of a moveable, parameterized surface; the surface characteristic is provided by a function" - extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialSurface; + extends ModelicaAnimationInterface.PartialSurface; annotation (Documentation(info="

@@ -144,7 +144,7 @@ The interface of this model is defined at end Surface; model Vector "Animation of a moveable vector-quantity (the length is not fixed in meters)" - extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialVector; + extends ModelicaAnimationInterface.PartialVector; annotation (Documentation(info="

@@ -159,11 +159,12 @@ The interface of this model is defined at end Animation; package ExternalReferences "Library of functions to access external resources" - extends Modelica.Icons.Package; + extends ModelicaAnimationInterface.Icons.Package; function loadResource "Return the absolute path name of a URI or local file name (in this default implementation URIs are not supported, but only local file names)" - extends - Modelica.Utilities.Internal.PartialModelicaServices.ExternalReferences.PartialLoadResource; + extends ModelicaAnimationInterface.Icons.Function; + input String uri "URI or local file name"; + output String fileReference "Absolute path name of file"; algorithm fileReference := Modelica.Utilities.Files.fullPathName(uri); @@ -177,7 +178,7 @@ The interface of this model is documented at end ExternalReferences; package Machine "Machine dependent constants" - extends Modelica.Icons.Package; + extends ModelicaAnimationInterface.Icons.Package; final constant Real eps=1e-15 "Biggest number such that 1.0 + eps = 1.0"; final constant Real small=1e-60 "Smallest number such that small and -small are representable on the machine"; @@ -196,10 +197,11 @@ but indirectly via the alias definition in end Machine; package System "System dependent functions" - extends Modelica.Icons.Package; + extends ModelicaAnimationInterface.Icons.Package; impure function exit "Terminate execution of Modelica environment" - extends Modelica.Utilities.Internal.PartialModelicaServices.System.exitBase; - external "C" exit(status) annotation(Include="#include ", Library="ModelicaExternalC"); + extends ModelicaAnimationInterface.Icons.Function; + input Integer status=0 "Result to be returned by environment (0 means success)"; + external "C" exit(status) annotation(Include="#include "); annotation(Documentation(info="

Tool-specific implementation of Modelica.Utilities.System.exit. @@ -209,7 +211,7 @@ Tool-specific implementation of Date: Thu, 9 Dec 2021 10:40:11 +0100 Subject: [PATCH 2/7] Move ModelicaAnimationInterface into ModelicaServices --- Modelica/Icons.mo | 190 +++++++++++++++++- .../Mechanics/MultiBody/Frames/Orientation.mo | 7 +- .../MultiBody/Frames/nullRotation.mo | 28 ++- .../partialSurfaceCharacteristic.mo | 23 ++- .../Mechanics/MultiBody/Types/ShapeType.mo | 63 +++++- .../MultiBody/Visualizers/Advanced/Shape.mo | 2 +- .../MultiBody/Visualizers/Advanced/Surface.mo | 2 +- .../MultiBody/Visualizers/Advanced/Vector.mo | 2 +- Modelica/Utilities/Files.mo | 2 - Modelica/package.mo | 2 +- ModelicaAnimationInterface/Frames/package.mo | 4 - ModelicaAnimationInterface/Interfaces.mo | 3 - .../AnimationInterface}/Frames/Orientation.mo | 2 +- .../Frames/nullRotation.mo | 2 +- .../AnimationInterface/Frames/package.mo | 4 + .../AnimationInterface/Interfaces/package.mo | 3 + .../partialSurfaceCharacteristic.mo | 2 +- .../AnimationInterface}/Types/Color.mo | 2 +- .../AnimationInterface}/Types/ShapeExtra.mo | 2 +- .../AnimationInterface}/Types/ShapeType.mo | 2 +- .../Types/SpecularCoefficient.mo | 2 +- .../Types/VectorQuantity.mo | 2 +- .../AnimationInterface}/Types/package.mo | 2 +- .../AnimationInterface}/package.mo | 10 +- .../Icons.mo | 31 +-- ModelicaServices/package.mo | 29 ++- ModelicaServices/package.order | 2 + 27 files changed, 342 insertions(+), 83 deletions(-) delete mode 100644 ModelicaAnimationInterface/Frames/package.mo delete mode 100644 ModelicaAnimationInterface/Interfaces.mo rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Frames/Orientation.mo (98%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Frames/nullRotation.mo (95%) create mode 100644 ModelicaServices/AnimationInterface/Frames/package.mo create mode 100644 ModelicaServices/AnimationInterface/Interfaces/package.mo rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Interfaces/partialSurfaceCharacteristic.mo (95%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Types/Color.mo (96%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Types/ShapeExtra.mo (97%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Types/ShapeType.mo (98%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Types/SpecularCoefficient.mo (94%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Types/VectorQuantity.mo (96%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/Types/package.mo (82%) rename {ModelicaAnimationInterface => ModelicaServices/AnimationInterface}/package.mo (95%) rename {ModelicaAnimationInterface => ModelicaServices}/Icons.mo (95%) diff --git a/Modelica/Icons.mo b/Modelica/Icons.mo index 6fa28b5432..1723aaa65e 100644 --- a/Modelica/Icons.mo +++ b/Modelica/Icons.mo @@ -1,11 +1,83 @@ within Modelica; package Icons "Library of icons" - partial class Information = ModelicaAnimationInterface.Icons.Information; - extends ModelicaAnimationInterface.Icons.Package; + partial class Information "Icon for general information packages" - partial class Contact = ModelicaAnimationInterface.Icons.Contact; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Ellipse( + lineColor={75,138,73}, + fillColor={75,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-100.0,-100.0},{100.0,100.0}}), + Polygon(origin={-4.167,-15.0}, + fillColor={255,255,255}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,-50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}}, + smooth=Smooth.Bezier), + Ellipse(origin={7.5,56.5}, + fillColor={255,255,255}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + extent={{-12.5,-12.5},{12.5,12.5}})}), + Documentation(info=" +

This icon indicates classes containing only documentation, intended for general description of, e.g., concepts and features of a package.

+")); + end Information; + extends Icons.Package; + + partial class Contact "Icon for contact information" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Rectangle( + extent={{-100,70},{100,-72}}, + fillColor={235,235,235}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-100,-72},{100,-72},{0,20},{-100,-72}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Polygon( + points={{22,0},{100,70},{100,-72},{22,0}}, + fillColor={235,235,235}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-100,70},{100,70},{0,-20},{-100,70}}, + fillColor={241,241,241}, + fillPattern=FillPattern.Solid)}), + Documentation(info=" +

This icon shall be used for the contact information of the library developers.

+")); + end Contact; + + partial class ReleaseNotes "Icon for release notes in documentation" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), graphics={ + Polygon( + points={{-80,-100},{-80,100},{0,100},{0,20},{80,20},{80,-100},{-80, + -100}}, + fillColor={245,245,245}, + fillPattern=FillPattern.Solid), + Polygon( + points={{0,100},{80,20},{0,20},{0,100}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Line(points={{2,-12},{50,-12}}), + Ellipse( + extent={{-56,2},{-28,-26}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Line(points={{2,-60},{50,-60}}), + Ellipse( + extent={{-56,-46},{-28,-74}}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid)}), Documentation(info=" +

This icon indicates release notes and the revision history of a library.

+")); - partial class ReleaseNotes = ModelicaAnimationInterface.Icons.ReleaseNotes; + end ReleaseNotes; partial class References "Icon for external references" @@ -65,7 +137,22 @@ package Icons "Library of icons" ")); end Example; - partial package Package = ModelicaAnimationInterface.Icons.Package; + partial package Package "Icon for standard packages" + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0)}), Documentation(info=" +

Standard package icon.

+")); + end Package; partial package BasesPackage "Icon for packages containing base classes" extends Modelica.Icons.Package; @@ -252,7 +339,46 @@ package Icons "Library of icons" extent={{-12.5,-12.5},{12.5,12.5}})})); end IconsPackage; - partial package InternalPackage = ModelicaAnimationInterface.Icons.InternalPackage; + partial package InternalPackage + "Icon for an internal package (indicating that the package should not be directly utilized by user)" + + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, + 100}}), graphics={ + Rectangle( + lineColor={215,215,215}, + fillColor={255,255,255}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100,-100},{100,100}}, + radius=25), + Rectangle( + lineColor={215,215,215}, + extent={{-100,-100},{100,100}}, + radius=25), + Ellipse( + extent={{-80,80},{80,-80}}, + lineColor={215,215,215}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-55,55},{55,-55}}, + lineColor={255,255,255}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-60,14},{60,-14}}, + lineColor={215,215,215}, + fillColor={215,215,215}, + fillPattern=FillPattern.Solid, + rotation=45)}), + Documentation(info=" + +

+This icon shall be used for a package that contains internal classes not to be +directly utilized by a user. +

+")); + end InternalPackage; partial package MaterialPropertiesPackage "Icon for package containing property classes" @@ -372,9 +498,57 @@ This icon is designed for a translational sensor model.

")); end RectangularSensor; - partial function Function = ModelicaAnimationInterface.Icons.Function; + partial function Function "Icon for functions" - partial record Record = ModelicaAnimationInterface.Icons.Record; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Text( + textColor={0,0,255}, + extent={{-150,105},{150,145}}, + textString="%name"), + Ellipse( + lineColor = {108,88,49}, + fillColor = {255,215,136}, + fillPattern = FillPattern.Solid, + extent = {{-100,-100},{100,100}}), + Text( + textColor={108,88,49}, + extent={{-90.0,-90.0},{90.0,90.0}}, + textString="f")}), + Documentation(info=" +

This icon indicates Modelica functions.

+")); + end Function; + + partial record Record "Icon for records" + + annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ + Text( + textColor={0,0,255}, + extent={{-150,60},{150,100}}, + textString="%name"), + Rectangle( + origin={0.0,-25.0}, + lineColor={64,64,64}, + fillColor={255,215,136}, + fillPattern=FillPattern.Solid, + extent={{-100.0,-75.0},{100.0,75.0}}, + radius=25.0), + Line( + points={{-100.0,0.0},{100.0,0.0}}, + color={64,64,64}), + Line( + origin={0.0,-50.0}, + points={{-100.0,0.0},{100.0,0.0}}, + color={64,64,64}), + Line( + origin={0.0,-25.0}, + points={{0.0,75.0},{0.0,-75.0}}, + color={64,64,64})}), Documentation(info=" +

+This icon is indicates a record. +

+")); + end Record; type TypeReal "Icon for Real types" extends Real; diff --git a/Modelica/Mechanics/MultiBody/Frames/Orientation.mo b/Modelica/Mechanics/MultiBody/Frames/Orientation.mo index 72d9e6aa45..f2217c87e9 100644 --- a/Modelica/Mechanics/MultiBody/Frames/Orientation.mo +++ b/Modelica/Mechanics/MultiBody/Frames/Orientation.mo @@ -1,6 +1,11 @@ within Modelica.Mechanics.MultiBody.Frames; record Orientation - extends ModelicaAnimationInterface.Frames.Orientation; + "Orientation object defining rotation from a frame 1 into a frame 2" + + extends Modelica.Icons.Record; + Real T[3, 3] "Transformation matrix from world frame to local frame"; + SI.AngularVelocity w[3] + "Absolute angular velocity of local frame, resolved in local frame"; encapsulated function equalityConstraint "Return the constraint residues to express that two frames have the same orientation" diff --git a/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo b/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo index 84c7ef945c..8161d7e261 100644 --- a/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo +++ b/Modelica/Mechanics/MultiBody/Frames/nullRotation.mo @@ -1,2 +1,28 @@ within Modelica.Mechanics.MultiBody.Frames; -function nullRotation = ModelicaAnimationInterface.Frames.nullRotation; +function nullRotation + "Return orientation object that does not rotate a frame" + extends Modelica.Icons.Function; + output Orientation R + "Orientation object such that frame 1 and frame 2 are identical"; +algorithm + R := Orientation(T=identity(3),w= zeros(3)); + annotation(Inline=true, Documentation(info=" +

Syntax

+
+R = Frames.nullRotation();
+
+ +

Description

+

+The function call Frames.nullRotation() returns an orientation matrix R +describing the orientation object to rotate frame 1 into frame 2, if frame 1 and frame 2 are identical. +(= transformation matrix is identity matrix and angular velocity is zero). +

+ +

See also

+

+TransformationMatrices.nullRotation, +Quaternions.nullRotation. +

+")); +end nullRotation; diff --git a/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo b/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo index d06f59037e..b6ff29b835 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/partialSurfaceCharacteristic.mo @@ -1,2 +1,23 @@ within Modelica.Mechanics.MultiBody.Interfaces; -partial function partialSurfaceCharacteristic = ModelicaAnimationInterface.Interfaces.partialSurfaceCharacteristic; \ No newline at end of file +partial function partialSurfaceCharacteristic "Interface for a function returning surface characteristics" + extends Modelica.Icons.Function; + input Integer nu "Number of points in u-Dimension"; + input Integer nv "Number of points in v-Dimension"; + input Boolean multiColoredSurface=false + "= true: Color is defined for each surface point"; + output SI.Position X[nu,nv] + "[nu,nv] positions of points in x-Direction resolved in surface frame"; + output SI.Position Y[nu,nv] + "[nu,nv] positions of points in y-Direction resolved in surface frame"; + output SI.Position Z[nu,nv] + "[nu,nv] positions of points in z-Direction resolved in surface frame"; + output Real C[if multiColoredSurface then nu else 0, + if multiColoredSurface then nv else 0,3] + "[nu,nv,3] Color array, defining the color for each surface point"; + annotation (Documentation(info=" +

This partial function defines the interface of a function that returns +surface characteristics for an object visualization, see e.g. +Visualizers.Advanced.SurfaceCharacteristics.torus. +

+")); +end partialSurfaceCharacteristic; diff --git a/Modelica/Mechanics/MultiBody/Types/ShapeType.mo b/Modelica/Mechanics/MultiBody/Types/ShapeType.mo index a83f87bcfb..c213269a0f 100644 --- a/Modelica/Mechanics/MultiBody/Types/ShapeType.mo +++ b/Modelica/Mechanics/MultiBody/Types/ShapeType.mo @@ -1,2 +1,63 @@ within Modelica.Mechanics.MultiBody.Types; -type ShapeType = ModelicaAnimationInterface.Types.ShapeType; +type ShapeType = Modelica.Icons.TypeString + "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )" + annotation ( choices( + choice="box" "\"box\"", + choice="sphere" "\"sphere\"", + choice="cylinder" "\"cylinder\"", + choice="pipecylinder" "\"pipecylinder\"", + choice="cone" "\"cone\"", + choice="pipe" "\"pipe\"", + choice="beam" "\"beam\"", + choice="gearwheel" "\"gearwheel\"", + choice="spring" "\"spring\"", + choice="modelica://PackageName/PathName.dxf"), + Documentation(info=" +

+Type ShapeType is used to define the shape of the +visual object as parameter String. Usually, \"shapeType\" is used +as instance name. The following +values for shapeType are possible, e.g., shapeType=\"box\": +

+ +
+\"model +
+ +

+The dark blue arrows in the figure above are directed along +variable lengthDirection. The light blue arrows are directed +along variable widthDirection. The coordinate systems +in the figure represent frame_a of the Shape component. +

+ +

+Additionally, external shapes can be specified as (not all options might be supported by all tools): +

+ +
    +
  • \"1\", \"2\", …
    + define external shapes specified in DXF format in files \"1.dxf\", \"2.dxf\", … + The DXF-files must be found either in the current directory or in the directory where + the Shape instance is stored that references the DXF file. + This (very limited) option should not be used for new models. Example:
    + shapeType=\"1\".
  • + +
  • \"modelica://<Modelica-name>/<relative-path-file-name>\"
    + characterizes the file that is stored under the location of the + <Modelica-name> library path with the given relative file name. + Example:
    shapeType = \"modelica://Modelica/Resources/Data/Shapes/Engine/piston.dxf\".
  • + +
  • \"file:///<absolute-file-name>\"
    + characterizes an absolute file name in the file system. Example:
    + shapeType=\"file:///C:/users/myname/shapes/piston.dxf\".
  • +
+ +

+The supported file formats are tool dependent. Most tools support +at least DXF-files (a tool might support 3-dim. Face of the DXF format only), +but may support other format as well (such as stl, obj, 3ds). +Since visualization files contain color and other data, the corresponding +information in the model is usually ignored. +

+")); diff --git a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo index 22c31dac71..0e9a54447a 100644 --- a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo +++ b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo @@ -3,7 +3,7 @@ model Shape "Visualizing an elementary object with variable size; all data have to be set as modifiers (see info layer)" extends ModelicaServices.Animation.Shape; - extends ModelicaAnimationInterface.PartialShape; + extends ModelicaServices.AnimationInterface.PartialShape; annotation ( Icon(coordinateSystem( diff --git a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo index e6fd1474f8..633e863937 100644 --- a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo +++ b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Surface.mo @@ -2,7 +2,7 @@ within Modelica.Mechanics.MultiBody.Visualizers.Advanced; model Surface "Visualizing a moveable, parameterized surface; the surface characteristic is provided by a function" extends Modelica.Mechanics.MultiBody.Icons.Surface; - extends ModelicaAnimationInterface.PartialSurface; + extends ModelicaServices.AnimationInterface.PartialSurface; extends ModelicaServices.Animation.Surface; annotation (Icon(graphics={Polygon( points={{-102,40},{-98,92},{28,-8},{96,146},{104,-118},{-18,-34},{-52, diff --git a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Vector.mo b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Vector.mo index fe8aee5e8b..5a693281fe 100644 --- a/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Vector.mo +++ b/Modelica/Mechanics/MultiBody/Visualizers/Advanced/Vector.mo @@ -2,7 +2,7 @@ within Modelica.Mechanics.MultiBody.Visualizers.Advanced; model Vector "Visualizing a vector quantity (force, torque, etc.)" extends ModelicaServices.Animation.Vector; - extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialVector; + extends ModelicaServices.AnimationInterface.PartialVector; annotation ( Documentation(info=" diff --git a/Modelica/Utilities/Files.mo b/Modelica/Utilities/Files.mo index 0d9a310087..601deeca6f 100644 --- a/Modelica/Utilities/Files.mo +++ b/Modelica/Utilities/Files.mo @@ -692,8 +692,6 @@ end temporaryFileName; function loadResource "Return the absolute path name of a URI or local file name" - extends - Modelica.Utilities.Internal.PartialModelicaServices.ExternalReferences.PartialLoadResource; extends ModelicaServices.ExternalReferences.loadResource; annotation ( Documentation(info= diff --git a/Modelica/package.mo b/Modelica/package.mo index 213e0634c3..38bff3cffc 100644 --- a/Modelica/package.mo +++ b/Modelica/package.mo @@ -9000,7 +9000,7 @@ version="4.0.0", versionDate="2020-06-04", dateModified = "2020-06-04 11:00:00Z", revisionId="$Format:%h %ci$", -uses(Complex(version="4.0.0"), ModelicaServices(version="4.0.0")), ModelicaAnimationInterface(version="4.0.0"), +uses(Complex(version="4.0.0"), ModelicaServices(version="4.0.0")), conversion( from(version={"3.0", "3.0.1", "3.1", "3.2", "3.2.1", "3.2.2", "3.2.3"}, script="modelica://Modelica/Resources/Scripts/Conversion/ConvertModelica_from_3.2.3_to_4.0.0.mos")), Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={ diff --git a/ModelicaAnimationInterface/Frames/package.mo b/ModelicaAnimationInterface/Frames/package.mo deleted file mode 100644 index 5eca278c40..0000000000 --- a/ModelicaAnimationInterface/Frames/package.mo +++ /dev/null @@ -1,4 +0,0 @@ -within ModelicaAnimationInterface; - -package Frames -end Frames; diff --git a/ModelicaAnimationInterface/Interfaces.mo b/ModelicaAnimationInterface/Interfaces.mo deleted file mode 100644 index 2767df92d9..0000000000 --- a/ModelicaAnimationInterface/Interfaces.mo +++ /dev/null @@ -1,3 +0,0 @@ -within ModelicaAnimationInterface; -package Interfaces -end Interfaces; \ No newline at end of file diff --git a/ModelicaAnimationInterface/Frames/Orientation.mo b/ModelicaServices/AnimationInterface/Frames/Orientation.mo similarity index 98% rename from ModelicaAnimationInterface/Frames/Orientation.mo rename to ModelicaServices/AnimationInterface/Frames/Orientation.mo index 454c70ecb9..c40d22dd96 100644 --- a/ModelicaAnimationInterface/Frames/Orientation.mo +++ b/ModelicaServices/AnimationInterface/Frames/Orientation.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Frames; +within ModelicaServices.AnimationInterface.Frames; record Orientation "Orientation object defining rotation from a frame 1 into a frame 2" diff --git a/ModelicaAnimationInterface/Frames/nullRotation.mo b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo similarity index 95% rename from ModelicaAnimationInterface/Frames/nullRotation.mo rename to ModelicaServices/AnimationInterface/Frames/nullRotation.mo index 5d3ac71278..d91892ce99 100644 --- a/ModelicaAnimationInterface/Frames/nullRotation.mo +++ b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Frames; +within ModelicaServices.AnimationInterface.Frames; function nullRotation "Return orientation object that does not rotate a frame" extends Icons.Function; diff --git a/ModelicaServices/AnimationInterface/Frames/package.mo b/ModelicaServices/AnimationInterface/Frames/package.mo new file mode 100644 index 0000000000..e5a5573642 --- /dev/null +++ b/ModelicaServices/AnimationInterface/Frames/package.mo @@ -0,0 +1,4 @@ +within ModelicaServices.AnimationInterface; + +package Frames +end Frames; diff --git a/ModelicaServices/AnimationInterface/Interfaces/package.mo b/ModelicaServices/AnimationInterface/Interfaces/package.mo new file mode 100644 index 0000000000..ebd0729745 --- /dev/null +++ b/ModelicaServices/AnimationInterface/Interfaces/package.mo @@ -0,0 +1,3 @@ +within ModelicaServices.AnimationInterface; +package Interfaces +end Interfaces; diff --git a/ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo b/ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo similarity index 95% rename from ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo rename to ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo index bf0a44ed9a..6f64f2e6f6 100644 --- a/ModelicaAnimationInterface/Interfaces/partialSurfaceCharacteristic.mo +++ b/ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Interfaces; +within ModelicaServices.AnimationInterface.Interfaces; partial function partialSurfaceCharacteristic "Interface for a function returning surface characteristics" extends Modelica.Icons.Function; diff --git a/ModelicaAnimationInterface/Types/Color.mo b/ModelicaServices/AnimationInterface/Types/Color.mo similarity index 96% rename from ModelicaAnimationInterface/Types/Color.mo rename to ModelicaServices/AnimationInterface/Types/Color.mo index 0e140ae1a4..b677390357 100644 --- a/ModelicaAnimationInterface/Types/Color.mo +++ b/ModelicaServices/AnimationInterface/Types/Color.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Types; +within ModelicaServices.AnimationInterface.Types; type Color = Modelica.Icons.TypeInteger[3] (each min=0, each max=255) "RGB representation of color" diff --git a/ModelicaAnimationInterface/Types/ShapeExtra.mo b/ModelicaServices/AnimationInterface/Types/ShapeExtra.mo similarity index 97% rename from ModelicaAnimationInterface/Types/ShapeExtra.mo rename to ModelicaServices/AnimationInterface/Types/ShapeExtra.mo index 383c29a51f..7c3a701b2c 100644 --- a/ModelicaAnimationInterface/Types/ShapeExtra.mo +++ b/ModelicaServices/AnimationInterface/Types/ShapeExtra.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Types; +within ModelicaServices.AnimationInterface.Types; type ShapeExtra = Modelica.Icons.TypeReal "Type of the additional data that can be defined for an elementary ShapeType" annotation ( diff --git a/ModelicaAnimationInterface/Types/ShapeType.mo b/ModelicaServices/AnimationInterface/Types/ShapeType.mo similarity index 98% rename from ModelicaAnimationInterface/Types/ShapeType.mo rename to ModelicaServices/AnimationInterface/Types/ShapeType.mo index 4b13e71d70..a7b6f030c8 100644 --- a/ModelicaAnimationInterface/Types/ShapeType.mo +++ b/ModelicaServices/AnimationInterface/Types/ShapeType.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Types; +within ModelicaServices.AnimationInterface.Types; type ShapeType = Icons.TypeString "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )" annotation ( choices( diff --git a/ModelicaAnimationInterface/Types/SpecularCoefficient.mo b/ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo similarity index 94% rename from ModelicaAnimationInterface/Types/SpecularCoefficient.mo rename to ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo index 5409863735..c84a76aefb 100644 --- a/ModelicaAnimationInterface/Types/SpecularCoefficient.mo +++ b/ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Types; +within ModelicaServices.AnimationInterface.Types; type SpecularCoefficient = Modelica.Icons.TypeReal(min=0) "Reflection of ambient light (= 0: light is completely absorbed)" annotation (choices( diff --git a/ModelicaAnimationInterface/Types/VectorQuantity.mo b/ModelicaServices/AnimationInterface/Types/VectorQuantity.mo similarity index 96% rename from ModelicaAnimationInterface/Types/VectorQuantity.mo rename to ModelicaServices/AnimationInterface/Types/VectorQuantity.mo index ac05cefca2..bd5ed29268 100644 --- a/ModelicaAnimationInterface/Types/VectorQuantity.mo +++ b/ModelicaServices/AnimationInterface/Types/VectorQuantity.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface.Types; +within ModelicaServices.AnimationInterface.Types; type VectorQuantity = enumeration( Force "Force quantity", diff --git a/ModelicaAnimationInterface/Types/package.mo b/ModelicaServices/AnimationInterface/Types/package.mo similarity index 82% rename from ModelicaAnimationInterface/Types/package.mo rename to ModelicaServices/AnimationInterface/Types/package.mo index 9bdedab734..8a423b99bb 100644 --- a/ModelicaAnimationInterface/Types/package.mo +++ b/ModelicaServices/AnimationInterface/Types/package.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface; +within ModelicaServices.AnimationInterface; package Types type Length = Real (final quantity="Length", final unit="m"); diff --git a/ModelicaAnimationInterface/package.mo b/ModelicaServices/AnimationInterface/package.mo similarity index 95% rename from ModelicaAnimationInterface/package.mo rename to ModelicaServices/AnimationInterface/package.mo index 529582d593..b169cc4b4d 100644 --- a/ModelicaAnimationInterface/package.mo +++ b/ModelicaServices/AnimationInterface/package.mo @@ -1,6 +1,6 @@ -within ; +within ModelicaServices; -package ModelicaAnimationInterface +package AnimationInterface extends Icons.Package; partial model PartialShape "Interface for 3D animation of elementary shapes" parameter Types.ShapeType shapeType="box" @@ -95,11 +95,11 @@ This model is documented at preferredView="info", version="4.0.0", Documentation(info=" -ModelicaAnimationInterface contains the interfaces of elements used to create animations in Modelica. +AnimationInterface contains the interfaces of elements used to create animations in Modelica. These interfaces are used by the Modelica Standard Library and ModelicaServices to ensure that both contain the expected interface. -In ModelicaServices, the actual implementation may be extended to add communication with a Modelica tool in +In ModelicaServices.Animation, the actual implementation may be extended to add communication with a Modelica tool in order to for example visualize the model on the fly. ") ); -end ModelicaAnimationInterface; +end AnimationInterface; diff --git a/ModelicaAnimationInterface/Icons.mo b/ModelicaServices/Icons.mo similarity index 95% rename from ModelicaAnimationInterface/Icons.mo rename to ModelicaServices/Icons.mo index dd7d2ae10a..0f9a395f46 100644 --- a/ModelicaAnimationInterface/Icons.mo +++ b/ModelicaServices/Icons.mo @@ -1,4 +1,4 @@ -within ModelicaAnimationInterface; +within ModelicaServices; package Icons "Library of icons" partial class Information "Icon for general information packages" @@ -787,32 +787,5 @@ corresponding library in a future release. fillColor={128,128,128}, pattern=LinePattern.None, fillPattern=FillPattern.Solid, - extent={{-12.5,-12.5},{12.5,12.5}})}), Documentation(info=" -

This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using "extends" or by directly copying the "icon" layer.

- -

Main Authors

- -
-
Martin Otter
-
Deutsches Zentrum für Luft- und Raumfahrt (DLR)
-
Institut für Systemdynamik und Regelungstechnik (SR)
-
Münchener Straße 20
-
D-82234 Weßling
-
Germany
-
email: Martin.Otter@dlr.de
-
Christian Kral
-
Electric Machines, Drives and Systems
-
1060 Vienna, Austria
-
email: dr.christian.kral@gmail.com
-
Johan Andreasson
-
Modelon AB
-
Ideon Science Park
-
22370 Lund, Sweden
-
email: johan.andreasson@modelon.se
-
- -

-Copyright © 1998-2020, Modelica Association and contributors -

-")); + extent={{-12.5,-12.5},{12.5,12.5}})})); end Icons; diff --git a/ModelicaServices/package.mo b/ModelicaServices/package.mo index df5733b746..f82a103e68 100644 --- a/ModelicaServices/package.mo +++ b/ModelicaServices/package.mo @@ -1,13 +1,13 @@ within ; package ModelicaServices "ModelicaServices (Default implementation) - Models and functions used in the Modelica Standard Library requiring a tool specific implementation" - extends ModelicaAnimationInterface.Icons.Package; + extends Icons.Package; constant String target="Default" "Target of this ModelicaServices implementation"; package UsersGuide "User's Guide" - extends ModelicaAnimationInterface.Icons.Information; + extends Icons.Information; class ReleaseNotes "Release notes" - extends ModelicaAnimationInterface.Icons.ReleaseNotes; + extends Icons.ReleaseNotes; annotation (Documentation(info="

Version 4.0.0, 2020-06-04

@@ -80,7 +80,7 @@ First version of the ModelicaServices library. end ReleaseNotes; class Contact "Contact" - extends ModelicaAnimationInterface.Icons.Contact; + extends Icons.Contact; annotation (Documentation(info="
Main Author
@@ -108,11 +108,11 @@ The design of the Animation.Shape component is from Hilding Elmqvist, previously end UsersGuide; package Animation "Models and functions for 3-dim. animation" - extends ModelicaAnimationInterface.Icons.Package; + extends Icons.Package; model Shape "Different visual shapes with variable size; all data have to be set as modifiers (see info layer)" extends - ModelicaAnimationInterface.PartialShape; + AnimationInterface.PartialShape; annotation (Icon(coordinateSystem( preserveAspectRatio=true, @@ -130,7 +130,7 @@ The interface of this model is documented at model Surface "Animation of a moveable, parameterized surface; the surface characteristic is provided by a function" - extends ModelicaAnimationInterface.PartialSurface; + extends AnimationInterface.PartialSurface; annotation (Documentation(info="

@@ -144,7 +144,7 @@ The interface of this model is defined at end Surface; model Vector "Animation of a moveable vector-quantity (the length is not fixed in meters)" - extends ModelicaAnimationInterface.PartialVector; + extends AnimationInterface.PartialVector; annotation (Documentation(info="

@@ -159,10 +159,10 @@ The interface of this model is defined at end Animation; package ExternalReferences "Library of functions to access external resources" - extends ModelicaAnimationInterface.Icons.Package; + extends Icons.Package; function loadResource "Return the absolute path name of a URI or local file name (in this default implementation URIs are not supported, but only local file names)" - extends ModelicaAnimationInterface.Icons.Function; + extends Icons.Function; input String uri "URI or local file name"; output String fileReference "Absolute path name of file"; algorithm @@ -178,7 +178,7 @@ The interface of this model is documented at end ExternalReferences; package Machine "Machine dependent constants" - extends ModelicaAnimationInterface.Icons.Package; + extends Icons.Package; final constant Real eps=1e-15 "Biggest number such that 1.0 + eps = 1.0"; final constant Real small=1e-60 "Smallest number such that small and -small are representable on the machine"; @@ -197,9 +197,9 @@ but indirectly via the alias definition in end Machine; package System "System dependent functions" - extends ModelicaAnimationInterface.Icons.Package; + extends Icons.Package; impure function exit "Terminate execution of Modelica environment" - extends ModelicaAnimationInterface.Icons.Function; + extends Icons.Function; input Integer status=0 "Result to be returned by environment (0 means success)"; external "C" exit(status) annotation(Include="#include "); annotation(Documentation(info=" @@ -211,7 +211,7 @@ Tool-specific implementation of Date: Thu, 9 Dec 2021 10:44:01 +0100 Subject: [PATCH 3/7] Remove nullRotation from ModelicaServices --- .../AnimationInterface/Frames/nullRotation.mo | 28 ------------------- .../AnimationInterface/package.mo | 15 +++++----- 2 files changed, 8 insertions(+), 35 deletions(-) delete mode 100644 ModelicaServices/AnimationInterface/Frames/nullRotation.mo diff --git a/ModelicaServices/AnimationInterface/Frames/nullRotation.mo b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo deleted file mode 100644 index d91892ce99..0000000000 --- a/ModelicaServices/AnimationInterface/Frames/nullRotation.mo +++ /dev/null @@ -1,28 +0,0 @@ -within ModelicaServices.AnimationInterface.Frames; -function nullRotation - "Return orientation object that does not rotate a frame" - extends Icons.Function; - output Orientation R - "Orientation object such that frame 1 and frame 2 are identical"; -algorithm - R := Orientation(T=identity(3),w= zeros(3)); - annotation(Inline=true, Documentation(info=" -

Syntax

-
-R = Frames.nullRotation();
-
- -

Description

-

-The function call Frames.nullRotation() returns an orientation matrix R -describing the orientation object to rotate frame 1 into frame 2, if frame 1 and frame 2 are identical. -(= transformation matrix is identity matrix and angular velocity is zero). -

- -

See also

-

-TransformationMatrices.nullRotation, -Quaternions.nullRotation. -

-")); -end nullRotation; diff --git a/ModelicaServices/AnimationInterface/package.mo b/ModelicaServices/AnimationInterface/package.mo index b169cc4b4d..5fb204747f 100644 --- a/ModelicaServices/AnimationInterface/package.mo +++ b/ModelicaServices/AnimationInterface/package.mo @@ -5,7 +5,7 @@ package AnimationInterface partial model PartialShape "Interface for 3D animation of elementary shapes" parameter Types.ShapeType shapeType="box" "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )"; - input Frames.Orientation R=Frames.nullRotation() + input Frames.Orientation R=Frames.Orientation(T=identity(3),w=zeros(3)) "Orientation object to rotate the world frame into the object frame" annotation(Dialog); input Types.Position r[3]={0,0,0} "Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog); @@ -35,7 +35,7 @@ This model is documented at end PartialShape; partial model PartialVector "Interface for 3D animation of a vector quantity (force, torque etc)" - input Frames.Orientation R=Frames.nullRotation() + input Frames.Orientation R=Frames.Orientation(T=identity(3),w=zeros(3)) "Orientation object to rotate the world frame into the vector frame" annotation(Dialog); input Types.Position r[3]={0,0,0} "Position vector from origin of world frame to origin of vector frame, resolved in world frame" annotation(Dialog); @@ -59,7 +59,7 @@ This model is documented at end PartialVector; partial model PartialSurface "Interface for 3D animation of surfaces" - input Frames.Orientation R=Frames.nullRotation() + input Frames.Orientation R=Frames.Orientation(T=identity(3),w=zeros(3)) "Orientation object to rotate the world frame into the surface frame" annotation(Dialog(group="Surface frame")); input Types.Position r_0[3]={0,0,0} @@ -95,11 +95,12 @@ This model is documented at preferredView="info", version="4.0.0", Documentation(info=" -AnimationInterface contains the interfaces of elements used to create animations in Modelica. +

AnimationInterface contains the interfaces of elements used to create animations in Modelica. These interfaces are used by the Modelica Standard Library and ModelicaServices to ensure that both contain -the expected interface. -In ModelicaServices.Animation, the actual implementation may be extended to add communication with a Modelica tool in -order to for example visualize the model on the fly. +the expected interface.

+

In ModelicaServices.Animation, the actual implementation may be extended to add communication with a Modelica tool in +order to for example visualize the model on the fly.

+

This package including any classes below it in the hierarchy are not intended to be modified by a tool vendor.

") ); end AnimationInterface; From 803f3e4c787a14ac48124d27354b2c77c8e400de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Fri, 10 Dec 2021 11:29:00 +0100 Subject: [PATCH 4/7] Add back nullRotation. Needed to merge extends in older MSL. --- .../AnimationInterface/Frames/nullRotation.mo | 28 +++++++++++++++++++ .../AnimationInterface/package.mo | 6 ++-- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 ModelicaServices/AnimationInterface/Frames/nullRotation.mo diff --git a/ModelicaServices/AnimationInterface/Frames/nullRotation.mo b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo new file mode 100644 index 0000000000..d91892ce99 --- /dev/null +++ b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo @@ -0,0 +1,28 @@ +within ModelicaServices.AnimationInterface.Frames; +function nullRotation + "Return orientation object that does not rotate a frame" + extends Icons.Function; + output Orientation R + "Orientation object such that frame 1 and frame 2 are identical"; +algorithm + R := Orientation(T=identity(3),w= zeros(3)); + annotation(Inline=true, Documentation(info=" +

Syntax

+
+R = Frames.nullRotation();
+
+ +

Description

+

+The function call Frames.nullRotation() returns an orientation matrix R +describing the orientation object to rotate frame 1 into frame 2, if frame 1 and frame 2 are identical. +(= transformation matrix is identity matrix and angular velocity is zero). +

+ +

See also

+

+TransformationMatrices.nullRotation, +Quaternions.nullRotation. +

+")); +end nullRotation; diff --git a/ModelicaServices/AnimationInterface/package.mo b/ModelicaServices/AnimationInterface/package.mo index 5fb204747f..e031f92f6b 100644 --- a/ModelicaServices/AnimationInterface/package.mo +++ b/ModelicaServices/AnimationInterface/package.mo @@ -5,7 +5,7 @@ package AnimationInterface partial model PartialShape "Interface for 3D animation of elementary shapes" parameter Types.ShapeType shapeType="box" "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )"; - input Frames.Orientation R=Frames.Orientation(T=identity(3),w=zeros(3)) + input Frames.Orientation R=Frames.nullRotation() "Orientation object to rotate the world frame into the object frame" annotation(Dialog); input Types.Position r[3]={0,0,0} "Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog); @@ -35,7 +35,7 @@ This model is documented at end PartialShape; partial model PartialVector "Interface for 3D animation of a vector quantity (force, torque etc)" - input Frames.Orientation R=Frames.Orientation(T=identity(3),w=zeros(3)) + input Frames.Orientation R=Frames.nullRotation() "Orientation object to rotate the world frame into the vector frame" annotation(Dialog); input Types.Position r[3]={0,0,0} "Position vector from origin of world frame to origin of vector frame, resolved in world frame" annotation(Dialog); @@ -59,7 +59,7 @@ This model is documented at end PartialVector; partial model PartialSurface "Interface for 3D animation of surfaces" - input Frames.Orientation R=Frames.Orientation(T=identity(3),w=zeros(3)) + input Frames.Orientation R=Frames.nullRotation() "Orientation object to rotate the world frame into the surface frame" annotation(Dialog(group="Surface frame")); input Types.Position r_0[3]={0,0,0} From 746b8d37cd60fed9ced7926cc95a0d812c8cdc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Fri, 10 Dec 2021 11:32:35 +0100 Subject: [PATCH 5/7] Remove some documentation that is also in MSL --- .../AnimationInterface/Frames/Orientation.mo | 58 ------------------- .../AnimationInterface/Frames/nullRotation.mo | 19 ------ .../partialSurfaceCharacteristic.mo | 6 -- 3 files changed, 83 deletions(-) diff --git a/ModelicaServices/AnimationInterface/Frames/Orientation.mo b/ModelicaServices/AnimationInterface/Frames/Orientation.mo index c40d22dd96..76592fa726 100644 --- a/ModelicaServices/AnimationInterface/Frames/Orientation.mo +++ b/ModelicaServices/AnimationInterface/Frames/Orientation.mo @@ -1,66 +1,8 @@ within ModelicaServices.AnimationInterface.Frames; record Orientation "Orientation object defining rotation from a frame 1 into a frame 2" - extends Icons.Record; Real T[3, 3] "Transformation matrix from world frame to local frame"; Types.AngularVelocity w[3] "Absolute angular velocity of local frame, resolved in local frame"; - - annotation (Documentation(info=" -

-This object describes the rotation from a frame 1 into a frame 2. -An instance of this type should never be directly accessed but -only with the access functions provided -in package Modelica.Mechanics.MultiBody.Frames. As a consequence, it is not necessary to know -the internal representation of this object as described in the next paragraphs. -

-

-\"Orientation\" is defined to be a record consisting of two -elements: \"Real T[3,3]\", the transformation matrix to rotate frame 1 -into frame 2 and \"Real w[3]\", the angular velocity of frame 2 with -respect to frame 1, resolved in frame 2. Element \"T\" -has the following interpretation: -

- -
-Orientation R;
-R.T = [ex, ey, ez];
-    e.g., R.T = [1,0,0; 0,1,0; 0,0,1]
-
- -

-where ex,ey,ez -are unit vectors in the direction of the x-axis, y-axis, and z-axis -of frame 1, resolved in frame 2, respectively. Therefore, if v1 -is vector v resolved in frame 1 and v2 is -vector v resolved in frame 2, the following relationship holds: -

- -
-v2 = R.T * v1
-
- -

-The inverse orientation -R_inv.T = R.TT describes the rotation -from frame 2 into frame 1. -

-

-Since the orientation is described by 9 variables, there are -6 constraints between these variables. These constraints -are defined in function Frames.orientationConstraint. -

-

-R.w is the angular velocity of frame 2 with respect to frame 1, resolved -in frame 2. Formally, R.w is defined as:
-skew(R.w) = R.T*der(transpose(R.T)) -with -

-
-          |   0   -w[3]  w[2] |
-skew(w) = |  w[3]   0   -w[1] |
-          | -w[2]  w[1]     0 |
-
-")); end Orientation; diff --git a/ModelicaServices/AnimationInterface/Frames/nullRotation.mo b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo index d91892ce99..0aafbe21e8 100644 --- a/ModelicaServices/AnimationInterface/Frames/nullRotation.mo +++ b/ModelicaServices/AnimationInterface/Frames/nullRotation.mo @@ -6,23 +6,4 @@ function nullRotation "Orientation object such that frame 1 and frame 2 are identical"; algorithm R := Orientation(T=identity(3),w= zeros(3)); - annotation(Inline=true, Documentation(info=" -

Syntax

-
-R = Frames.nullRotation();
-
- -

Description

-

-The function call Frames.nullRotation() returns an orientation matrix R -describing the orientation object to rotate frame 1 into frame 2, if frame 1 and frame 2 are identical. -(= transformation matrix is identity matrix and angular velocity is zero). -

- -

See also

-

-TransformationMatrices.nullRotation, -Quaternions.nullRotation. -

-")); end nullRotation; diff --git a/ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo b/ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo index 6f64f2e6f6..f3c680508f 100644 --- a/ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo +++ b/ModelicaServices/AnimationInterface/Interfaces/partialSurfaceCharacteristic.mo @@ -15,10 +15,4 @@ partial function partialSurfaceCharacteristic "Interface for a function returnin output Real C[if multiColoredSurface then nu else 0, if multiColoredSurface then nv else 0,3] "[nu,nv,3] Color array, defining the color for each surface point"; - annotation (Documentation(info=" -

This partial function defines the interface of a function that returns -surface characteristics for an object visualization, see e.g. -Visualizers.Advanced.SurfaceCharacteristics.torus. -

-")); end partialSurfaceCharacteristic; From fae4bc46eed67ab3ef4f78dc676c859c4718560f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Fri, 10 Dec 2021 11:40:11 +0100 Subject: [PATCH 6/7] Remove ModelicaServices.Interfaces (was added, but not used) --- ModelicaServices/Interfaces/package.mo | 49 -------------------------- ModelicaServices/package.order | 1 - 2 files changed, 50 deletions(-) delete mode 100644 ModelicaServices/Interfaces/package.mo diff --git a/ModelicaServices/Interfaces/package.mo b/ModelicaServices/Interfaces/package.mo deleted file mode 100644 index 45e5c57110..0000000000 --- a/ModelicaServices/Interfaces/package.mo +++ /dev/null @@ -1,49 +0,0 @@ -within ModelicaServices; - -package Interfaces - "Interfaces of components requiring a tool specific implementation" - extends ModelicaAnimationInterface.Icons.InternalPackage; - - package ExternalReferences "Functions to access external resources" - extends ModelicaAnimationInterface.Icons.InternalPackage; - partial function PartialLoadResource - "Interface for tool specific function to return the absolute path name of a URI or local file name" - extends ModelicaAnimationInterface.Icons.Function; - input String uri "URI or local file name"; - output String fileReference "Absolute path name of file"; - annotation (Documentation(info=" -

-This partial function defines the function interface of a tool-specific implementation -in package ModelicaServices. The interface is documented at -Modelica.Utilities.Internal.FileSystem.loadResource. -

- -")); - end PartialLoadResource; - end ExternalReferences; - - package System "System dependent functions" - extends ModelicaAnimationInterface.Icons.InternalPackage; - partial function exitBase "Interface for tool specific function to terminate the execution of the Modelica environment" - extends ModelicaAnimationInterface.Icons.Function; - input Integer status=0 "Result to be returned by environment (0 means success)"; - annotation (Documentation(info=" -

-This partial function defines the function interface of a tool-specific implementation -in package ModelicaServices. -

-")); - end exitBase; - end System; - annotation (Documentation(info=" - -

-This package contains interfaces of a set of functions and models used in the -Modelica Standard Library that requires a tool-specific implementation. -Definitions in this package should not be modified by tool vendors. -Instead, a tool vendor should provide a proper implementation of this library for the corresponding tool in ModelicaServices. -The default implementation is \"do nothing\". -In the Modelica Standard Library, the models and functions of ModelicaServices are used. -

-")); -end Interfaces; diff --git a/ModelicaServices/package.order b/ModelicaServices/package.order index 1f9260df22..e653e220d2 100644 --- a/ModelicaServices/package.order +++ b/ModelicaServices/package.order @@ -5,6 +5,5 @@ ExternalReferences Machine System Types -Interfaces AnimationInterface Icons From b96b33be8678aadd5df2a6b8af179ede9b78f2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Fri, 10 Dec 2021 13:04:56 +0100 Subject: [PATCH 7/7] Do not use Modelica.Icons --- ModelicaServices/AnimationInterface/Types/Color.mo | 2 +- ModelicaServices/AnimationInterface/Types/ShapeExtra.mo | 2 +- ModelicaServices/AnimationInterface/Types/ShapeType.mo | 2 +- .../AnimationInterface/Types/SpecularCoefficient.mo | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ModelicaServices/AnimationInterface/Types/Color.mo b/ModelicaServices/AnimationInterface/Types/Color.mo index b677390357..68a08d6cd3 100644 --- a/ModelicaServices/AnimationInterface/Types/Color.mo +++ b/ModelicaServices/AnimationInterface/Types/Color.mo @@ -1,6 +1,6 @@ within ModelicaServices.AnimationInterface.Types; -type Color = Modelica.Icons.TypeInteger[3] (each min=0, each max=255) +type Color = Integer[3] (each min=0, each max=255) "RGB representation of color" annotation ( Dialog(colorSelector=true), diff --git a/ModelicaServices/AnimationInterface/Types/ShapeExtra.mo b/ModelicaServices/AnimationInterface/Types/ShapeExtra.mo index 7c3a701b2c..418349fef3 100644 --- a/ModelicaServices/AnimationInterface/Types/ShapeExtra.mo +++ b/ModelicaServices/AnimationInterface/Types/ShapeExtra.mo @@ -1,5 +1,5 @@ within ModelicaServices.AnimationInterface.Types; -type ShapeExtra = Modelica.Icons.TypeReal +type ShapeExtra = Real "Type of the additional data that can be defined for an elementary ShapeType" annotation ( Documentation(info=" diff --git a/ModelicaServices/AnimationInterface/Types/ShapeType.mo b/ModelicaServices/AnimationInterface/Types/ShapeType.mo index a7b6f030c8..66c11b5132 100644 --- a/ModelicaServices/AnimationInterface/Types/ShapeType.mo +++ b/ModelicaServices/AnimationInterface/Types/ShapeType.mo @@ -1,5 +1,5 @@ within ModelicaServices.AnimationInterface.Types; -type ShapeType = Icons.TypeString +type ShapeType = String "Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, )" annotation ( choices( choice="box" "\"box\"", diff --git a/ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo b/ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo index c84a76aefb..7124d18b6a 100644 --- a/ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo +++ b/ModelicaServices/AnimationInterface/Types/SpecularCoefficient.mo @@ -1,5 +1,5 @@ within ModelicaServices.AnimationInterface.Types; -type SpecularCoefficient = Modelica.Icons.TypeReal(min=0) +type SpecularCoefficient = Real(min=0) "Reflection of ambient light (= 0: light is completely absorbed)" annotation (choices( choice=0 "0.0 \"dull\"",