(*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 *)

(*
   Derived from ISO TC184/SC4/WG12 N - ISO/CD-TS 10303-xxxx Assembly component placement requirements - EXPRESS ARM 
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Assembly_component_placement_requirements_xim;

	USE FROM Assembly_module_with_interconnect_component_xim;

	REFERENCE FROM Requirement_decomposition_xim(get_rvd);

	USE FROM Assembly_component_placement_requirements_mim;

	USE FROM Fabrication_technology_mim;

REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (bag_to_set);

    SUBTYPE_CONSTRAINT acpr_predefined_requirement_view_definition_subtypes FOR Predefined_requirement_view_definition_armx;   
 	  (ONEOF (Assembly_spacing_requirement_occurrence_armx,
 	  Assembly_group_spacing_requirement_occurrence_armx,
 	  Item_restricted_requirement_occurrence_armx));
    END_SUBTYPE_CONSTRAINT;  
    		
	TYPE restriction_basis_item = EXTENSIBLE GENERIC_ENTITY SELECT(
		Predefined_requirement_view_definition_armx,
   		Part_feature);
	END_TYPE;

TYPE acpr_requirement_assignment_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON requirement_assignment_item WITH 
    (restriction_basis_item,
  	Placement_group_requirement_definition);
END_TYPE; 

TYPE assembly_product_design_object_category = EXTENSIBLE ENUMERATION OF
    (assembly_component_category,
     assembly_module_component_category,
     assembly_module_component_terminal_category,
     assembly_module_macro_component_category,
     assembly_module_macro_component_join_terminal_category,
     bare_die_component_category,
     bare_die_component_terminal_category,
     buried_via_category,
     cable_component_category,
     component_feature_category,
     component_termination_passage_category,
     conductive_interconnect_element_with_pre_defined_transitions_category,
     cutout_category,
     cutout_edge_segment_category,
     dielectric_material_passage_category,
     embedded_physical_component_terminal_category,
     fiducial_category,
     fill_area_category,
     inter_stratum_feature_category,
     interconnect_component_interface_terminal_category,
     interconnect_component_join_terminal_category,
     interconnect_module_component_category,
     interconnect_module_component_stratum_based_terminal_category,
     interconnect_module_component_surface_feature_category,
     interconnect_module_component_terminal_category,
     interconnect_module_edge_category,
     interconnect_module_edge_segment_category,
     interconnect_module_macro_component_category,
     interconnect_module_macro_component_join_terminal_category,
     interface_access_material_removal_laminate_component_category,
     interface_access_stratum_feature_template_component_category,
     interface_component_category,
     interfacial_connection_category,
     internal_probe_access_area_category,
     laminate_component_category,
     minimally_defined_component_terminal_category,
     packaged_component_category,
     packaged_component_join_terminal_category,
     packaged_connector_component_category,
     packaged_connector_component_interface_terminal_category,
     physical_component_category,
     plated_passage_or_unsupported_passage_category,
     routed_interconnect_component_category,
     routed_physical_component_category,
     stratum_feature_category,
     via_category);
END_TYPE;

TYPE assembly_product_design_object_category_or_group = SELECT(
   assembly_product_design_object_category,
   Group);
END_TYPE;    

TYPE assembly_component_or_component_feature = SELECT(
   Assembly_component_armx,
   Component_feature_armx);
END_TYPE;    

TYPE assembly_spacing_type = EXTENSIBLE ENUMERATION OF
    (nearest_boundary,
     centroid,
     furthest_boundary);
END_TYPE;

  ENTITY Assembly_group_spacing_requirement_occurrence_armx
    SUBTYPE OF (Predefined_requirement_view_definition_armx, assembly_group_spacing_requirement_occurrence);
      reference_group : Placement_group_requirement_definition;
      dependent_group : Placement_group_requirement_definition;
      SELF\Predefined_requirement_view_definition_armx.required_characteristic : Length_tolerance_characteristic;
      of_spacing_type : assembly_spacing_type;
  END_ENTITY;

  ENTITY Assembly_spacing_requirement_occurrence_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Predefined_requirement_view_definition_armx, assembly_spacing_requirement_occurrence);
      reference_design_object_category                                   : assembly_product_design_object_category_or_group;
      dependent_design_object_category                                   : assembly_product_design_object_category_or_group;
      SELF\Predefined_requirement_view_definition_armx.required_characteristic       : Length_tolerance_characteristic;
      of_spacing_type                                                    : assembly_spacing_type;
     (* Overlaps with of_spacing_type *) 
    UNIQUE
      UR1 : reference_design_object_category,
 dependent_design_object_category;
  END_ENTITY;

  ENTITY Component_group_assignment
  	(* CONNOTATIONAL *) SUBTYPE OF (product_definition_relationship);
      SELF\product_definition_relationship.related_product_definition RENAMED associated_group    : Placement_group_requirement_definition;
      SELF\product_definition_relationship.relating_product_definition RENAMED assigned_component : assembly_component_or_component_feature;
    DERIVE
      SELF\product_definition_relationship.id : identifier := ?;
  END_ENTITY;

  ENTITY Component_placement_restriction_assignment
  	(* CONNOTATIONAL *) SUBTYPE OF (representation);
      maximum_negative_component_height : OPTIONAL Length_tolerance_characteristic;
      maximum_positive_component_height : OPTIONAL Length_tolerance_characteristic;
      area                              : OPTIONAL Mounting_restriction_area_armx;
      volume                            : OPTIONAL Mounting_restriction_volume_armx;
      requirement                       : Item_restricted_requirement_occurrence_armx;
      components_permitted              : BOOLEAN;
      mounting_clearance                : OPTIONAL Length_tolerance_characteristic;
    DERIVE
      SELF\representation.context_of_items : representation_context := ?;
      SELF\representation.items : SET [1:?] OF representation_item := ?;
      SELF\representation.name : label := ?;
    WHERE
      WR1 : EXISTS(area) OR EXISTS(volume);
  END_ENTITY;

  ENTITY Item_restricted_requirement_occurrence_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Predefined_requirement_view_definition_armx, item_restricted_requirement_occurrence);
      basis : restriction_basis_item;
    DERIVE
      SELF\group.name : label := ?;
      SELF\group.description : text := ?;
    WHERE
      WR1 : SELF :<>: basis;      
  END_ENTITY;

  ENTITY Mounting_restriction_area_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Non_feature_shape_element, mounting_restriction_area);
      mounting_surface                     : Interconnect_module_component_surface_feature_armx;
      SELF\Non_feature_shape_element.scope : Assembly_module;
    WHERE
      WR1 : (SIZEOF(SELF\Non_feature_shape_element.element_shape) = 0) OR
            (SIZEOF(QUERY(es <* SELF\Non_feature_shape_element.element_shape | 
             NOT ('CONSTRUCTION_GEOMETRY_XIM.CONSTRUCTIVE_GEOMETRY_REPRESENTATION' IN TYPEOF(es))
                  )) = 0);      
  END_ENTITY;

  ENTITY Mounting_restriction_volume_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Non_feature_shape_element, mounting_restriction_volume);
      mounting_surface                     : Interconnect_module_component_surface_feature_armx;
      SELF\Non_feature_shape_element.scope : Assembly_module;
    INVERSE
      volume : non_feature_shape_model FOR associated_element;
  END_ENTITY;

  ENTITY Placement_group_requirement_definition
  	(* CONNOTATIONAL *) SUBTYPE OF (Requirement_view_definition, group_product_definition);
      SELF\product_definition.id RENAMED design_specific_usage : identifier;
	DERIVE
  		requirement: SET[0:?] OF Requirement_view_definition :=
           bag_to_set((QUERY(rvdr <* USEDIN (SELF, 'REQUIREMENT_DECOMPOSITION_XIM.'+
		   'REQUIREMENT_VIEW_DEFINITION_RELATIONSHIP.PRIMARY') | (rvdr.relation_type = DERIVED_FROM))));
        SELF\product_definition.description : text := ?;   
    INVERSE
      composition : SET [1:?] OF Component_group_assignment FOR associated_group;        
	WHERE
   		WR1 : EXISTS (requirement) AND SIZEOF(requirement) >= 1;
  END_ENTITY;

  ENTITY Placement_group_area_assignment
  	(* CONNOTATIONAL *) SUBTYPE OF (shape_aspect_relationship);
      placed_group                                                     : Placement_group_requirement_definition;
      SELF\shape_aspect_relationship.related_shape_aspect RENAMED area : Mounting_restriction_area_armx;
    DERIVE
      SELF\shape_aspect_relationship.description : text := ?;
      SELF\shape_aspect_relationship.relating_shape_aspect : shape_aspect := ?;
      SELF\shape_aspect_relationship.name : label := ?;
  END_ENTITY;

  ENTITY Placement_group_volume_assignment
  	(* CONNOTATIONAL *) SUBTYPE OF (shape_aspect_relationship);
      placed_group                                                       : Placement_group_requirement_definition;
      SELF\shape_aspect_relationship.related_shape_aspect RENAMED volume : Mounting_restriction_volume_armx;
    DERIVE
      SELF\shape_aspect_relationship.description : text := ?;
      SELF\shape_aspect_relationship.relating_shape_aspect : shape_aspect := ?;
      SELF\shape_aspect_relationship.name : label := ?;
  END_ENTITY;

END_SCHEMA;


