|
Project:
|
Diagram : Public Package
Two-dimensional engineering diagrams. <br/><br/>The Diagram package provides concepts<br/><br/>1. for the graphical representation of a ConceptualObject,<br/><br/>2. for linking parts of this graphical representation to parts of the<br/> ConceptualObject, and<br/><br/>3. for semantic annotations of the graphical representation.<br/><br/><br/>.. admonition:: technical<br/><br/> This specification is not a drawing standard. It does not prescribe any drawing style or<br/> standard and it does not prescribe which information in a<br/> ConceptualObject has to be represented in a Diagram.<br/><br/>.. admonition:: technical<br/><br/> Until version 1.2, graphics has not been in the scope of the DEXPI P&ID Specification.<br/> Graphics was handled as prescribed by :ref:`standard-proteus`. Over the years, some best<br/> practices concerning graphics have evolved in the DEXPI community, and fragmentary<br/> annotations have been added to the DEXPI P&ID Specification.<br/><br/> In DEXPI P&ID Specification 1.3, an informative Graphics package was added to cover<br/> conceptual and graphics information in a single comprehensive model.<br/><br/> For the P&ID Specification 1.4, the Graphics package was further<br/> elaborated, and it is now a normative part of the specification. It serves to document<br/> the best practices that have emerged in the past, but no new features have been added. <br/><br/> The Graphics package is independent from Proteus Schema in the sense that it is a pure<br/> UML package. But, like for all other packages in this specification, mappings to Proteus<br/> Schema are defined that describe how instances of the package's types are serialized.<br/> In consequence, the features of the Graphics package are constrained to what is supported<br/> by Proteus Schema. Future versions of the DEXPI P&ID Specification will skip support for<br/> Proteus Schema, such that additional features can be added to the Graphics package<br/> depending on the DEXPI community's needs.<br/><br/> Since DEXPI 2.0, the Graphics package can be used for both P&IDs and process models.<br/><br/><br/>Example<br/>-------<br/><br/><br/>We consider a simple ConceptualModel cm that contains a<br/>single CentrifugalPump with two<br/>ProcessNozzles and a<br/>Chamber; in total, there are five<br/>ConceptualObjects:<br/><br/>.. image:: /images/img0.*<br/><br/>A typical graphical representation of this model may look like this:<br/><br/>.. image:: /images/img1.*<br/><br/>Linking Graphics and Conceptual Objects<br/>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br/><br/>The graphics can be decomposed in parts each of which represents one of the<br/>ConceptualObjects. For each of these parts, we use a<br/>RepresentationGroup:<br/><br/>.. image:: /images/img2.*<br/><br/>- The Diagram d represents the entire ConceptualModel.<br/> Diagram is a subclass of RepresentationGroup that is meant to be used for<br/> the entire graphics. In addition to a conventional RepresentationGroup, a<br/> Diagram has a size (width and height) and a background color.<br/><br/>- cp_grp is the RepresentationGroup for the<br/> CentrifugalPump cp.<br/><br/>- pn1_grp and pn2_grp represent the two<br/> ProcessNozzles pn1 and<br/> pn2.<br/><br/>Note that the composition hierarchy of the Diagram corresponds exactly to the<br/>composition hierarchy of the ConceptualModel. In the<br/>ConceptualModel, pn1 is a component of cp, and in<br/>the Diagram, pn1_grp is a component of cp_grp.<br/><br/>However, if a ConceptualObject (including all its descendants) has no<br/>graphical representation at all, no RepresentationGroup is required: In the example<br/>above, there is no RepresentationGroup for the Chamber<br/>ch. <br/><br/>Adding Semantics<br/>~~~~~~~~~~~~~~~~<br/><br/>So far, we have decomposed the overall graphics in<br/>RepresentationGroups that correspond to<br/>certain ConceptualObjects. On a finer level of<br/>granularity, we can identify parts with different meanings. These meanings are covered by<br/>different subclasses of the abstract class RepresentationTypeGroup. In the example,<br/>two of these subclasses are used: Static and<br/>EquipmentTagNameLabel.<br/><br/>.. image:: /images/img3.*<br/><br/>- Consider cp_grp, the RepresentationGroup of the <br/> CentrifugalPump cp. In addition to the two<br/> groups for the ProcessNozzles,<br/> cp_grp now contains two<br/> RepresentationTypeGroups.<br/><br/> - The Static group contains the actual<br/> CentrifugalPump graphics without any annotations, labels,<br/> etc.<br/><br/> - The EquipmentTagNameLabel group displays the tag name of<br/> the CentrifugalPump.<br/><br/>- pn1_grp contains a Static group for the basic symbol of the<br/> ProcessNozzle.<br/><br/>- pn2_grp contains another Static group for the second<br/> ProcessNozzle symbol.<br/><br/>Whereas RepresentationGroups can be<br/>decomposed in further groups,<br/>RepresentationTypeGroups cannot contain<br/>further groups.<br/><br/><br/>Adding Graphical Elements<br/>~~~~~~~~~~~~~~~~~~~~~~~~~<br/><br/>RepresentationTypeGroups rather contain<br/>GraphicalElements such as geometric<br/>primitives, texts, or ShapeUsages.<br/><br/>.. image:: /images/img4.*<br/><br/>- The Static group for the CentrifugalPump contains a<br/> ShapeUsage, i.e., a reference to a reusable Shape with information about<br/> this specific usage (scaling, rotation, position).<br/><br/>- The EquipmentTagNameLabel for the<br/> CentrifugalPump contains a Text.<br/><br/>- Both Static groups for the two<br/> ProcessNozzles contain a ShapeUsage.<br/><br/><br/>Coordinate System<br/>-----------------<br/><br/>The coordinate system used is a 2D Cartesian system whose horizontal axis is oriented to the right and whose vertical axis is oriented to the bottom. In consequence, angles are measured clockwise.<br/><br/>Lengths are dimensionless. In the examples, we assume they are in millimeters.<br/><br/><br/>.. admonition:: proteus<br/><br/>In Proteus Schema, the vertical axis to the top, and angles are measured anti-clockwise.<br/><br/><br/>Mapping to SVG<br/>--------------<br/><br/>The purpose of these mappings is to define the visualization of instances of the types in<br/>this package, i.e., "how they look like".<br/><br/>In order to keep the mappings simple, the SVG mappings for all<br/>GraphicalPrimitives are defined such that<br/>they can be easily scaled when they appear in a Shape (in particular, they use<br/>``vector-effect = "non-scaling-stroke"``). In consequence, further scaling, e.g., in an<br/>application, will lead to unacceptable results.<br/><br/>.. admonition:: technical<br/><br/>The SVG mappings in this specification must not be misunderstood as a proposal for<br/>exchanging P&ID graphics via SVG.<br/><br/><br/>.. _modulo-operator:<br/><br/>Modulo Operator<br/>---------------<br/><br/>In some calculations for the SVG and Proteus mappings, the *modulo operator* (or *remainder<br/>of division*) is used. As the modulo operator can be defined in different ways, we give a<br/>definition of how the operator is used in this specification. We content ourselves with a<br/>definition for positive quotients.<br/><br/>Let :math:`q #gt; 0, a \in \mathbb R`. Then<br/><br/>.. math::<br/><br/> a\,\textrm{mod}\,q = a - \left\lfloor \frac a q \right\rfloor \cdot q \quad .<br/><br/>:math:`\lfloor.\rfloor` is the *floor function* that for :math:`x \in \mathbb R` yields the largest integer :math:`n` such that :math:`n \leq x`.<br/><br/>For example,<br/><br/>.. math::<br/><br/> 0\,\textrm{mod}\,360 &= 0 - \left\lfloor \frac {0} {360} \right\rfloor \cdot 360 = 0 - 0 \cdot 360 = 0 \quad, \\<br/> 100\,\textrm{mod}\,360 &= 100 - \left\lfloor \frac {100} {360} \right\rfloor \cdot 360 = 100 - 0 \cdot 360 = 100 \quad, \\<br/> 359\,\textrm{mod}\,360 &= 359 - \left\lfloor \frac {359} {360} \right\rfloor \cdot 360 = 359 - 0 \cdot 360 = 359 \quad, \\<br/> 360\,\textrm{mod}\,360 &= 360 - \left\lfloor \frac {360} {360} \right\rfloor \cdot 360 = 360 - 1 \cdot 360 = 0 \quad, \\<br/> (-100)\,\textrm{mod}\,360 &= -100 - \left\lfloor \frac {-100} {360} \right\rfloor \cdot 360 = -100 - (-1) \cdot 360 = 260 \quad. \\<br/><br/>.. admonition:: technical<br/><br/> The definition of the modulo operator differs between programming languages. For example, the modulo operator in Python, written :code:`%`, coincides with the definition above. The modulo operator in JavaScript (ECMAScript), also written :code:`%`, behaves differently for negative dividends: :code:`-100 % 360` is evaluated to :code:`-100`.<br/>
|