2020-T-ASE/transformations/README.MD

460 lines
19 KiB
Markdown

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 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 translated from
```mermaid
classDiagram
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
```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
<<PersonnelClass>> MaintenanceEngineer
class PositioningUnit
<<EquipmentClass>> PositioningUnit
class Chassis
<<MaterialClass>> Chassis
class ChassisBlack
<<MaterialDefinition>> 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
<<EquipmentClass>> PositioningUnit
class Locked
<<EquipmentClassProperty>> 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
<<ResourceNetworkConnectionType>> EquipmentReachTo
class MaterialLocation
<<ResourceNetworkConnectionType>> 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
<<ProcessSegment>> MoveShuttle
class SHUTTLE
<<EquipmentSegmentSpecification>> SHUTTLE
class Shuttle
<<EquipmentClass>> Shuttle
class FROM
<<EquipmentSegmentSpecification>> FROM
class TO
<<EquipmentSegmentSpecification>> TO
class LockedFrom {
<<EquipmentSegmentSpecificationProperty>>
description = "pddl:pre"
value = false
}
class PositioningUnit
<<EquipmentClass>> PositioningUnit
class TransportationNode
<<EquipmentClass>> TransportationNode
class LockedTo {
<<EquipmentSegmentSpecificationProperty>>
description = "pddl:pre"
value = false
}
class Locked
<<EquipmentClassProperty>> Locked
MoveShuttle *-- SHUTTLE : contains
MoveShuttle *-- FROM : contains
MoveShuttle *-- TO : contains
SHUTTLE --> Shuttle : specifies
FROM *-- LockedFrom : has property
FROM --> PositioningUnit : specifies
FROM --> TransportationNode : specifies
TO --> PositioningUnit : specifies
TO --> TransportationNode : specifies
TO *-- LockedTo : has property
PositioningUnit *-- 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))
)
(or
(EquipmentClassed ?TO EC_PositioningUnit)
(EquipmentClassed ?TO EC_TransportationNode)
)
(imply (EquipmentClassed ?TO EC_PositioningUnit)
(not (PositioningUnitLocked ?TO))
)
(TransportationNodeConnection ?FROM ?TO)
(EquipmentLocation ?SHUTTLE ?FROM)
(not (EquipmentLocation ?SHUTTLE ?TO))
)
:effect
(and
(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
<<Person>> MaintenanceEngineer1
class MaintenanceEngineer
<<EquipmentClass>> MaintenanceEngineer
class Shuttle1
<<Equipment>> Shuttle1
class Shuttle
<<EquipmentClass>> Shuttle
class ChassisBlack1
<<MaterialLot>> ChassisBlack1
class ChassisBlack
<<MaterialDefinition>> ChassisBlack
class Chassis
<<MaterialClass>> 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
<<ResourceNetworkConnection>> Robot1ReachesToTable1
class Robot1ReachesToPUMC1
<<ResourceNetworkConnection>> Robot1ReachesToPUMC1
class Robot1ReachesToPUMC2
<<ResourceNetworkConnection>> Robot1ReachesToPUMC2
class EquipmentReachTo
<<ResourceNetworkConnectionType>> 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 directed graph structure is generated. Here, we already show a simplified graph where only topologically important elements are kept (curves and straight lines without positioning units attached are removed). Elements starting with a `J` are `Joins`, `D` depicts `Divides`, and `A` represents a special item, an `Arena` (two inputs, two outputs). Stadium-shaped nodes depict positioning units.
```mermaid
graph LR
J5 --> A1
D4 --> J4
D3 --> P1([PU-MC-1]) --> J3
D2 --> P2([PU-MC-2]) --> J3 --> J2
D1 --> P3([PU-MC-3]) --> J2 --> J1
A1 --> J1 --> D1 --> D2 --> D3 --> D4 --> P10([PU-IO-2]) --> J4 --> D5 --> J5
A1 --> P100([PU-IO-1]) --> A1
D5 --> P50([PU-Buffer]) --> J5
```
In order to reduce computational complexity for the PDDL solver, an even more simplified topology is computed that only contains the positioning units and leaves out all intermediate elements. 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.
```mermaid
graph LR
P1 & P2 & P3 & P10 & P50 --> P100([PU-IO-1])
P1 & P2 & P3 & P10 & P100 --> P50([PU-Buffer])
P1 & P2 & P3 & P50 & P100 --> P10([PU-IO-2])
P1 & P2 & P10 & P50 & P100 --> P3([PU-MC-3])
P1 & P3 & P10 & P50 & P100 --> P2([PU-MC-2])
P2 & P3 & P10 & P50 & P100 --> P1([PU-MC-1])
```
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)
)
```
## Material Assembly Information
Information about what material can be assembled from what other material is captured from the `assembly` relation in the `MaterialClass` and `MaterialDefinition` instances.
From
```mermaid
classDiagram
class OpenTopBlackYellowBlue
<<MaterialDefinition>> OpenTopBlackYellowBlue
class ChassisBlack
<<MaterialDefinition>> ChassisBlack
class CabinYellow
<<MaterialDefinition>> CabinYellow
class BodyOpenTopBlue
<<MaterialDefinition>> BodyOpenTopBlue
OpenTopBlackYellowBlue --> BodyOpenTopBlue : assembled from
OpenTopBlackYellowBlue --> CabinYellow : assembled from
OpenTopBlackYellowBlue --> ChassisBlack : assembled from
```
to
```pddl
(:init
(MaterialDefinitionAssembly MD_OpenTop-Black-Yellow-Blue MD_Chassis-Black)
(MaterialDefinitionAssembly MD_OpenTop-Black-Yellow-Blue MD_Cabin-Yellow)
(MaterialDefinitionAssembly MD_OpenTop-Black-Yellow-Blue MD_Body-OpenTop-Blue)
)
```
Information about the current assembly state are expressed through the assembly relation of the `MaterialLot` relation. This is not only used to express the current state, but also for the formulation of goal statements, es depicted below. The `from` IEC 62264 model is extracted from the [goal description model](../iec62264/CIIRC-Testbed-TASE-Goal-1.iec62264).
From
```mermaid
classDiagram
class OpenTopBlackYellowBlue1
<<MaterialLot>> OpenTopBlackYellowBlue1
class ChassisBlack1
<<MaterialLot>> ChassisBlack1
class CabinYellow1
<<MaterialLot>> CabinYellow1
class BodyOpenTopBlue1
<<MaterialLot>> BodyOpenTopBlue1
OpenTopBlackYellowBlue1 --> BodyOpenTopBlue1 : assembled from
OpenTopBlackYellowBlue1 --> CabinYellow1 : assembled from
OpenTopBlackYellowBlue1 --> ChassisBlack1 : assembled from
```
to
```pddl
(:goal
(and
(MaterialLotAssembly ML_OpenTop-Black-Yellow-Blue-1 ML_Body-OpenTop-Blue-1)
(MaterialLotAssembly ML_OpenTop-Black-Yellow-Blue-1 ML_Cabin-Yellow-1)
(MaterialLotAssembly ML_OpenTop-Black-Yellow-Blue-1 ML_Chassis-Black-1)
)
)
```