From d7983586135a36d6f1820987902aec56fc356119 Mon Sep 17 00:00:00 2001 From: Bernhard Wally Date: Sat, 2 May 2020 01:35:14 +0200 Subject: [PATCH] Added more information to the transformation process. --- transformations/README.MD | 366 +++++++++++++++++++++++++++++++++++++- 1 file changed, 359 insertions(+), 7 deletions(-) diff --git a/transformations/README.MD b/transformations/README.MD index 9b967bf..c1d427a 100644 --- a/transformations/README.MD +++ b/transformations/README.MD @@ -1,22 +1,374 @@ -# Transformations +**Table of Contents** +[TOC] The following rules have been applied in order to create PDDL files from IEC 62264 production system models. +# PDDL Domain Definitions + ## Metamodel Concepts Metamodel concepts of IEC 62264 are being converted to a set of PDDL type specifications and predicates. Relevant elements are those that appear within a given IEC 62264 model. Unused elements are not translated in order to reduce file size and increase performance and readability. -* IEC 62264 elements (e.g., `Equipment`, `Equipment Class`) are being converted to types. -* IEC 62264 relations (e.g., `Equipment` can be classified by [0..*] `Equipment Classes`) are being converted to predicates. +* IEC 62264 elements (e.g., `Equipment`, `Equipment Class`) are converted to types. +* IEC 62264 relations (e.g., `Equipment` can be classified by [0..*] `Equipment Classes`) are converted to predicates. -For the above mentioned examples, the IEC 62264 concepts are being translated from +For the above mentioned examples, the IEC 62264 concepts are translated from ```mermaid classDiagram - Equipment --> "0..*" Equipment Class : classifiedBy > + Person "0..*" --> "0..*" Personnel Class : defined by + Equipment "0..*" --> "0..*" Equipment Class : defined by + Material Lot "0..*" --> "1" Material Definition : defined by + Material Definition "0..*" --> "0..*" Material Class : grouped by ``` + to -``` -(:types EquipmentClass Equipment) + +```pddl +(:types + PersonnelClass Person + EquipmentClass Equipment + MaterialClass MaterialDefinition MaterialLot +) (:predicates + (PersonClassed ?P - Person ?C - PersonnelClass) (EquipmentClassed ?E - Equipment ?C - EquipmentClass) + (MaterialClassed ?D - MaterialDefinition ?C - MaterialClass) + (MaterialDefined ?L - MaterialLot ?D - MaterialDefinition) + (MaterialLotClassed ?L - MaterialLot ?C - MaterialClass) +) +``` +Where the last predicate `(MaterialLotClassed ?L - MaterialLot ?C - MaterialClass)` is the composition of `defined by` and `grouped by` in the material information model. + +## Model Concepts +IEC 62264 instance data is converted into PDDL information using the rules laid out in the following clauses. Note, that we are using class diagram visual syntax instead of object diagram syntax due to limitations in the used Markdown rendering engine. + +### * Class and Material Definition +`* Class` and `Material Definition` instances are converted to constants + +From + +```mermaid +classDiagram + class MaintenanceEngineer + <> MaintenanceEngineer + class PositioningUnit + <> PositioningUnit + class Chassis + <> Chassis + class ChassisBlack + <> ChassisBlack +``` + +to + +```pddl +(:constants + PC_MaintenanceEngineer - PersonnelClass + EC_PositioningUnit - EquipmentClass + MC_Chassis - MaterialClass + MD_Chassis-Black - MaterialDefinition +) +``` + +### * Class Property and Material Definition Property +Boolean `* Class Property` and `Material Definition Property` instances are converted to predicates and actions. Non-boolean properties are not supported in the current state of implementation. The actions are only generated, if the property is not marked as of kind `implicit`, in which case the corresponding predicate is only triggered by other actions' effects. + +From + +```mermaid +classDiagram + class PositioningUnit + <> PositioningUnit + class Locked + <> Locked + PositioningUnit *-- Locked : has property +``` + +to + +```pddl +(:predicates + (PositioningUnitLocked ?E - Equipment) +) + +(:action LockPositioningUnit + :parameters (?E - Equipment) + :precondition + (and + (EquipmentClassed ?E EC_PositioningUnit) + (not (PositioningUnitLocked ?E)) + ) + :effect + (and + (increase (total-cost) 1) + (PositioningUnitLocked ?E) + ) +) + +(:action UnlockPositioningUnit + :parameters (?E - Equipment) + :precondition + (and + (EquipmentClassed ?E EC_PositioningUnit) + (PositioningUnitLocked ?E) + ) + :effect + (and + (increase (total-cost) 1) + (not (PositioningUnitLocked ?E)) + ) +) +``` +Please, note that we have applied hard-coded "pretty-printing" to some of the `* Class Property` instances. In the above case `PositioningUnit`'s `locked` is translated into the terms `LockPositioningUnit` and `UnlockPositioningUnit`. The default translation for this instance would be `PositioningUnitLockedTrue` `PositioningUnitLockedFalse`. Action cost for setting a property are considered to be 1. + +### Resource Network Connection Type +`Resource Network Connection Type` instances are converted to predicates. + +From + +```mermaid +classDiagram + class EquipmentReachTo + <> EquipmentReachTo + class MaterialLocation + <> MaterialLocation +``` + +to + +```pddl +(:predicates + (ReachesTo ?R ?E - Equipment) + (MaterialLocation ?M - MaterialLot ?E - Equipment) +) +``` + +Please, note that we have applied hard-coded "pretty-printing" to some of the `ResourceNetworkConnectionType` instances. In the above case `EquipmentReachTo` is translated into the term `ReachesTo`. + +### Process Segment +`Process Segment` instances are converted to actions, with their `* Segment Specification` instances becoming their parameters and being used in certain pre and post condition statements. In the example below, we are not listing all elements specified in the IEC 62264 input model, as this would increase complexity a lot. Instead, we are listing the main elements of the input model, but we are listing the complete result for the PDDL domain description. + +From + +```mermaid +classDiagram + class MoveShuttle + <> MoveShuttle + class Shuttle + <> Shuttle + class ShuttleClass + <> ShuttleClass + class From + <> From + class To + <> To + class LockedFrom + <> LockedFrom + class PositioningUnitClass + <> PositioningUnitClass + class LockedTo + <> LockedTo + class Locked + <> Locked + MoveShuttle *-- Shuttle : contains + MoveShuttle *-- From : contains + MoveShuttle *-- To : contains + Shuttle --> ShuttleClass : specifies + From *-- LockedFrom : has property + From --> PositioningUnitClass : specifies + To --> PositioningUnitClass : specifies + To *-- LockedTo : has property + PositioningUnitClass *-- Locked : has property + LockedFrom --> Locked : corresponds to + LockedTo --> Locked : corresponds to +``` + +to + +```pddl +(:action MoveShuttle + :parameters (?SHUTTLE ?FROM ?TO - Equipment) + :precondition + (and + (EquipmentClassed ?SHUTTLE EC_Shuttle) + (or + (EquipmentClassed ?FROM EC_PositioningUnit) + (EquipmentClassed ?FROM EC_TransportationNode) + ) + (imply (EquipmentClassed ?FROM EC_PositioningUnit) + (not (PositioningUnitLocked ?FROM)) + ) + (imply (EquipmentClassed ?FROM EC_TransportationNode) (TransportationNodeOccupied ?FROM)) + (or + (EquipmentClassed ?TO EC_PositioningUnit) + (EquipmentClassed ?TO EC_TransportationNode) + ) + (imply (EquipmentClassed ?TO EC_PositioningUnit) + (not (PositioningUnitLocked ?TO)) + ) + (imply (EquipmentClassed ?TO EC_TransportationNode) + (not (TransportationNodeOccupied ?TO)) + ) + (TransportationNodeConnection ?FROM ?TO) + (EquipmentLocation ?SHUTTLE ?FROM) + (not (EquipmentLocation ?SHUTTLE ?TO)) + ) + :effect + (and + (not (TransportationNodeOccupied ?FROM)) + (TransportationNodeOccupied ?TO) + (increase (total-cost) (shuttle-time ?FROM ?TO)) + (not (EquipmentLocation ?SHUTTLE ?FROM)) + (EquipmentLocation ?SHUTTLE ?TO) + ) +) +``` + +Please, note that we are adding a few pre- and post conditions hard-coded in the transformation process, based on our knowledge of the underlying production system, e.g., utilization of the `EquipmentLocation` and `TransportationNodeConnection` predicates. + +Further, the action cost are encoded as a function `shuttle-time` that is filled with values in the PDDL problem description. + +# PDDL Problem Definitions + +## Person, Equipment, and Material Lot +Instances of `Person`, `Equipment`, and `Material Lot` are converted to objects. Their relations to `* Class` or `Material Definition` instances are materialized as initialization statements. + +From + +```mermaid +classDiagram + class MaintenanceEngineer1 + <> MaintenanceEngineer1 + class MaintenanceEngineer + <> MaintenanceEngineer + class Shuttle1 + <> Shuttle1 + class Shuttle + <> Shuttle + class ChassisBlack1 + <> ChassisBlack1 + class ChassisBlack + <> ChassisBlack + class Chassis + <> Chassis + MaintenanceEngineer1 --> MaintenanceEngineer : defined by + Shuttle1 --> Shuttle : defined by + ChassisBlack1 --> ChassisBlack : defined by + ChassisBlack --> Chassis : grouped by +``` + +to + +```pddl +(:objects + P_MaintenanceEngineer-1 - Person + E_Shuttle-1 - Equipment + ML_Chassis-Black-1 - MaterialLot +) +(:init + (PersonClassed P_MaintenanceEngineer-1 PC_MaintenanceEngineer) + (EquipmentClassed E_Shuttle-1 EC_Shuttle) + (MaterialClassed MD_Chassis-Black MC_Chassis) + (MaterialDefined ML_Chassis-Black-1 MD_Chassis-Black) + (MaterialLotClassed ML_Chassis-Black-1 MC_Chassis) +) +``` + +### Resource Network Connection +`Resource Network Connection` instances are converted to init statements. + +From + +```mermaid +classDiagram + class Robot1ReachesToTable1 + <> Robot1ReachesToTable1 + class Robot1ReachesToPUMC1 + <> Robot1ReachesToPUMC1 + class Robot1ReachesToPUMC2 + <> Robot1ReachesToPUMC2 + class EquipmentReachTo + <> EquipmentReachTo + Robot1ReachesToTable1 --> EquipmentReachTo : derived from + Robot1ReachesToPUMC1 --> EquipmentReachTo : derived from + Robot1ReachesToPUMC2 --> EquipmentReachTo : derived from +``` + +to + +```pddl +(:init + (ReachesTo E_Robot-1 E_Table-1) + (ReachesTo E_Robot-1 E_PositioningUnit-MachiningCenter-1) + (ReachesTo E_Robot-1 E_PositioningUnit-MachiningCenter-2) +) +``` + +### Intralogistic Routing Topology +`Resource Network Connection` instances of type `Transport-System-Track-Connection` and `Transport-System-Positioning-Unit-Connection` are converted in a very specific way. The former raw connections represent the physical connections of all track curves, lines, and switches. The latter represent the physical location where a positioning unit has been attached to a track. This information is read in, and a simplified topology (a graph) is computed that only contains the positioning units and whether they are reachable from each other. The edge weight of the graph corresponds to the physical track length between the positioning units and is converted into seconds based on an assumed average speed of 0.56 m/s. + +For each "positioning unit connection" two init statements are created: one that states that these two positioning units are connected with each other (`TransportationNodeConnection`), and another one setting the function value for the function `shuttle-time`, representing the estimated traveling time in seconds between these two positioning units. The resulting PDDL init statements are listed below: + +```pddl +(:init + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-MachiningCenter-2) + (= (shuttle-time E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-MachiningCenter-2) 25) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-MachiningCenter-1) + (= (shuttle-time E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-MachiningCenter-1) 30) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-Buffer) + (= (shuttle-time E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-Buffer) 54) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-IO-1) + (= (shuttle-time E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-IO-1) 78) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-IO-2) + (= (shuttle-time E_PositioningUnit-MachiningCenter-3 E_PositioningUnit-IO-2) 37) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-MachiningCenter-3) + (= (shuttle-time E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-MachiningCenter-3) 25) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-MachiningCenter-1) + (= (shuttle-time E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-MachiningCenter-1) 35) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-Buffer) + (= (shuttle-time E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-Buffer) 59) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-IO-1) + (= (shuttle-time E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-IO-1) 83) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-IO-2) + (= (shuttle-time E_PositioningUnit-MachiningCenter-2 E_PositioningUnit-IO-2) 42) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-MachiningCenter-3) + (= (shuttle-time E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-MachiningCenter-3) 28) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-MachiningCenter-2) + (= (shuttle-time E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-MachiningCenter-2) 33) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-Buffer) + (= (shuttle-time E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-Buffer) 62) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-IO-1) + (= (shuttle-time E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-IO-1) 86) + (TransportationNodeConnection E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-IO-2) + (= (shuttle-time E_PositioningUnit-MachiningCenter-1 E_PositioningUnit-IO-2) 45) + (TransportationNodeConnection E_PositioningUnit-Buffer E_PositioningUnit-MachiningCenter-3) + (= (shuttle-time E_PositioningUnit-Buffer E_PositioningUnit-MachiningCenter-3) 30) + (TransportationNodeConnection E_PositioningUnit-Buffer E_PositioningUnit-MachiningCenter-2) + (= (shuttle-time E_PositioningUnit-Buffer E_PositioningUnit-MachiningCenter-2) 35) + (TransportationNodeConnection E_PositioningUnit-Buffer E_PositioningUnit-MachiningCenter-1) + (= (shuttle-time E_PositioningUnit-Buffer E_PositioningUnit-MachiningCenter-1) 40) + (TransportationNodeConnection E_PositioningUnit-Buffer E_PositioningUnit-IO-1) + (= (shuttle-time E_PositioningUnit-Buffer E_PositioningUnit-IO-1) 26) + (TransportationNodeConnection E_PositioningUnit-Buffer E_PositioningUnit-IO-2) + (= (shuttle-time E_PositioningUnit-Buffer E_PositioningUnit-IO-2) 47) + (TransportationNodeConnection E_PositioningUnit-IO-1 E_PositioningUnit-MachiningCenter-3) + (= (shuttle-time E_PositioningUnit-IO-1 E_PositioningUnit-MachiningCenter-3) 18) + (TransportationNodeConnection E_PositioningUnit-IO-1 E_PositioningUnit-MachiningCenter-2) + (= (shuttle-time E_PositioningUnit-IO-1 E_PositioningUnit-MachiningCenter-2) 23) + (TransportationNodeConnection E_PositioningUnit-IO-1 E_PositioningUnit-MachiningCenter-1) + (= (shuttle-time E_PositioningUnit-IO-1 E_PositioningUnit-MachiningCenter-1) 28) + (TransportationNodeConnection E_PositioningUnit-IO-1 E_PositioningUnit-Buffer) + (= (shuttle-time E_PositioningUnit-IO-1 E_PositioningUnit-Buffer) 52) + (TransportationNodeConnection E_PositioningUnit-IO-1 E_PositioningUnit-IO-2) + (= (shuttle-time E_PositioningUnit-IO-1 E_PositioningUnit-IO-2) 36) + (TransportationNodeConnection E_PositioningUnit-IO-2 E_PositioningUnit-MachiningCenter-3) + (= (shuttle-time E_PositioningUnit-IO-2 E_PositioningUnit-MachiningCenter-3) 51) + (TransportationNodeConnection E_PositioningUnit-IO-2 E_PositioningUnit-MachiningCenter-2) + (= (shuttle-time E_PositioningUnit-IO-2 E_PositioningUnit-MachiningCenter-2) 56) + (TransportationNodeConnection E_PositioningUnit-IO-2 E_PositioningUnit-MachiningCenter-1) + (= (shuttle-time E_PositioningUnit-IO-2 E_PositioningUnit-MachiningCenter-1) 61) + (TransportationNodeConnection E_PositioningUnit-IO-2 E_PositioningUnit-Buffer) + (= (shuttle-time E_PositioningUnit-IO-2 E_PositioningUnit-Buffer) 22) + (TransportationNodeConnection E_PositioningUnit-IO-2 E_PositioningUnit-IO-1) + (= (shuttle-time E_PositioningUnit-IO-2 E_PositioningUnit-IO-1) 47) ) ```