| Application module: Thermal network definition | ISO/TS 10303-1752:2018-11(E) © ISO | 
         (*
ISO/TC 184/SC 4/WG 12 N8227 - ISO/TS 10303-1752 Thermal network definition - EXPRESS ARM
Supersedes 
         ISO/TC 184/SC 4/WG 12 N7622
*)
         
SCHEMA Thermal_network_definition_arm;
         USE FROM
         Component_feature_arm;
            -- ISO/TS 10303-1657
         USE FROM
         Network_functional_design_view_arm;
            -- ISO/TS 10303-1704
         USE FROM
         Non_feature_shape_element_arm;
            -- ISO/TS 10303-1706
         REFERENCE FROM 
         Support_resource_arm   -- ISO/TS 10303-1800
  (bag_to_set);
         
TYPE tnd_location_select =
         
         EXTENSIBLE
         
         GENERIC_ENTITY
         
         
         SELECT
            (Cartesian_point, 
    Part_feature, 
    Non_feature_shape_element, 
    Component_feature);
         END_TYPE; 
         
ENTITY Thermal_functional_unit_network_node_definition
           SUBTYPE OF (Functional_unit_network_node_definition);
           SELF\Functional_unit_network_node_definition.associated_functional_unit_definition : Thermal_network_definition;
           location : 
         OPTIONAL 
         tnd_location_select;
           used_model : 
         OPTIONAL 
         shape_model;
WHERE
           WR1: SIZEOF(USEDIN(SELF, 'NETWORK_FUNCTIONAL_DESIGN_VIEW_ARM.BUS_ELEMENT_LINK.PRECEDENT_ELEMENT' ))
            + SIZEOF(USEDIN(SELF, 'NETWORK_FUNCTIONAL_DESIGN_VIEW_ARM.BUS_ELEMENT_LINK.SUBSEQUENT_ELEMENT' )) = 0;
           WR2: NOT('ELEMENTAL_GEOMETRIC_SHAPE_ARM.CARTESIAN_POINT' IN TYPEOF(location)) OR 
            (used_model IN using_representations(location));
           WR3: NOT('ELEMENTAL_GEOMETRIC_SHAPE_ARM.CARTESIAN_POINT' IN TYPEOF(location)) OR 
            (SIZEOF(QUERY(sda <* USEDIN(used_model, 'PROPERTY_ASSIGNMENT_ARM.PROPERTY_DEFINITION_REPRESENTATION.USED_REPRESENTATION')
            |
            sda\Property_definition_representation.definition = SELF\Functional_unit_network_node_definition.associated_functional_unit_definition))
            = 1);
           WR4: NOT(('ELEMENTAL_GEOMETRIC_SHAPE_ARM.CARTESIAN_POINT' IN TYPEOF(location)) XOR
            EXISTS(used_model));
         
         END_ENTITY;
ENTITY Thermal_network_definition
           SUBTYPE OF (Functional_unit_network_definition);
         
         END_ENTITY;
FUNCTION using_items
 (item : Representation_item; checked_items : SET[0:?] OF Representation_item) : SET[0:?] OF Representation_item;
         LOCAL
      new_check_items    : SET OF Representation_item;
      result_items       : SET OF Representation_item;
      next_items         : SET OF Representation_item;
    END_LOCAL;
    result_items := [];
    new_check_items := checked_items + item;
    -- Find the set of representation_items or founded_items
    -- in which item is used directly.
    next_items := QUERY(z <* bag_to_set( USEDIN(item , '')) |
      ('FOUNDATION_REPRESENTATION_ARM.REPRESENTATION_ITEM' IN TYPEOF(z)));
    -- If the set of next_items is not empty;
    IF SIZEOF(next_items) > 0 THEN
      -- For each element in the set, find the using_items recursively
      REPEAT i := 1 TO HIINDEX(next_items);
        -- Check for loop in data model, i.e. one of the next_items
        -- occurred earlier in the set of check_items;
        IF NOT(next_items[i] IN new_check_items) THEN
          result_items := result_items + next_items[i] +
                          using_items(next_items[i],new_check_items);
        END_IF;
      END_REPEAT;
    END_IF;
    -- return the set of representation_items or founded_items
    -- in which the input item is used directly and indirectly.
    RETURN (result_items);
         END_FUNCTION;
         
FUNCTION using_representations
 (item : Representation_item) : SET[0:?] OF Representation;
         LOCAL
      results            : SET OF Representation;
      result_bag         : BAG OF Representation;
      intermediate_items : SET OF Representation_item;
    END_LOCAL;
    -- Find the representations in which the item is used and add to the
    -- results set.
    results := [];
    result_bag := USEDIN(item,'FOUNDATION_REPRESENTATION_ARM.REPRESENTATION.ITEMS');
    IF SIZEOF(result_bag) > 0 THEN
      REPEAT i := 1 TO HIINDEX(result_bag);
        results := results + result_bag[i];
      END_REPEAT;
    END_IF;
    -- Find all representation_items or founded_items
    -- by which item is referenced directly or indirectly.
    intermediate_items := using_items(item,[]);
    -- If the set of intermediate items is not empty;
    IF SIZEOF(intermediate_items) > 0 THEN
      -- For each element in the set, add the
      -- representations of that element.
      REPEAT i := 1 TO HIINDEX(intermediate_items);
        result_bag := USEDIN(intermediate_items[i],
                      'FOUNDATION_REPRESENTATION_ARM.REPRESENTATION.ITEMS');
        IF SIZEOF(result_bag) > 0 THEN
          REPEAT j := 1 TO HIINDEX(result_bag);
            results := results + result_bag[j];
          END_REPEAT;
        END_IF;
      END_REPEAT;
    END_IF;
    -- Return the set of representation in which the input item is
    -- used directly and indirectly (through intervening
    -- representation_items or founded items).
    RETURN (results);
         END_FUNCTION;
         
         END_SCHEMA;  -- Thermal_network_definition_arm
© ISO 2018 — All rights reserved