Showing posts with label OCL. Show all posts
Showing posts with label OCL. Show all posts

Tuesday, September 11, 2018

Model-Driven Vertical Integration: Transforming between Production System Models and MES/ERP Models

Introduction

Manufacturing companies usually run a number of different software systems to monitor and control their operations from business aspects to their production systems. A fundamental concept to describe the different levels of control is captured in the functional hierarchy model.

Functional hierarchy model for a manufacturing enterprise, depicting the five hierarchy levels in industrial automation.

This systems' separation leads to technical barriers. In order to overcome these barriers, international standards have been developed, such as the IEC 62264 series of standards that tries to harmonize levels 3 (MES) and 4 (ERP) and thus foster vertical integration.
In further steps, modern and smart manufacturing in production companies require deeply integrated IT systems to provide flexibility and rearrangement. Approaches like Industry 4.0 aim at flexible production network that additionally require horizontal integration across companies. Thus, there is also production related information exchanged in the network, which must be vertically forwarded to the corresponding service endpoints of the local production system.
To fulfill above requirements, two kinds of system integrations are required:
  1. Horizontal integration for the linking and seamless communication of systems in the network on the same hierarchy level.
  2. Vertical integration for the integration within one production system, from the business floor to shop floor. Vertical integration can go far beyond the manufacturing or management layers and down to programmable logic controllers and even single sensors. Practically all companies share the same vision for the future, automation and individualization of the complete manufacturing process, from product description, over order production to logistics and delivery. In order to create this vision in the real world, different business partners are required for executing specific processes, provide these capabilities in service and work with standardized horizontal and vertical information linking.
Model-Driven Engineering (MDE) is a software engineering development methodology that focuses on creating and exploiting domain models, which are conceptual models of topics related to a specific problem. MDE has developed a rich palette of tools and techniques for the description and manipulation of software models including model-to-model transformations, model validations, querying and many more.
In this blog post, we will showcase the application of Model-Driven Engineering in the field of automated production systems, focusing on vertical integration by aligning AutomationML, IEC 62264 and B2MML. For example, a digitized shop floor is much more flexible and open to adaptations when digital standardized system models are used, rather than it has been the case in the past when required rapid adaptations in the business models were necessary to provide up-to-date service descriptions.
Our digital shop floor is encoded in XML-based AutomationML (AML), for the MES to ERP integration we are using IEC 62264 (specifically, its second part) and its XML serialization B2MML. The focus in the implementation is on transforming between these three standards and extracting information into persistent document files.

Implementation

In this section we give an overview of the different transformation implementations between AutomationML, IEC 62264-2 and B2MML, based on the ATL Transformation Language for Model2Model (M2M) transformations and the Xtend Java dialect for Model2Text (M2T) transformations.

Implementation tasks overview

  1. ATL M2M Transformation: AutomationML <-> IEC 62264-2 pure.
  2. ATL M2M Transformation: B2MML <-> IEC 62264-2.
  3. Xtend M2T Transformations:
    1. 3.a AutomationML model to .aml document file.
    2. 3.b B2MML model to .b2mml document file.
  4. Additional Tasks:
    1. 4.a ATL M2M Transformation: AutomationML <-> IEC 62264-2 light.
    2. 4.b Unidirectional cross references from .aml document files to .b2mml document files.
The pure transformation considers all components and details, whereas the light transformation only transforms main components and leaves details to separate B2MML files which are referenced. The metamodels of AutomationML and IEC 62264 were provided in advance, whereas the B2MML metamodel was generated from an XML schema.

Conclusion

In our technical section we implemented model transformations, code generation and Java programs for adapting the model instances to achieve the goal that one single model is available in three different languages which are B2MML, IEC 62264 and AML and in their XML representation as files. The translation between all of these instances is very fast and can be used to improve collaboration between tools using one of the languages. One future task would be the implementation of bidrectional transformations between IEC 62264, AML and B2MML. With this improvement it would be possible to change between the languages very fast and so the model can always be adapted to the language currently needed. Other tasks which can be done after this project would be the changes in the transformations like the generation of real GUIDs or the transformation of other concepts in these languages which had been neglected such as transformations of ProcessSegmentCapabilityModel etc.


Thursday, July 19, 2018

[Building Information Modeling] IFC to Ecore Transformation

Introduction:

Building Information Modelling is, in the field of the construction industry, an approach to build semantically-rich 3-dimensional digital models instead of “plain old” CAD models to fulfill different needs of different stakeholders.
The most widely used standard for exchanging BIM models in the industry is defined by the Industry Foundation Classes (IFC). IFC is a standardized data model developed by different domain experts to enable interoperability within the Architecture, Engineering, Construction and Facility Management industries.

Problem Description:

Using IFC software products in research as well as in real projects presents certain challenges – it’s complex, hard to understand for the users and has some consistency issues during import and export of real-world building data.

Many of above mentioned issues can be addressed by transforming this IFC metamodel into a smaller, easier to understand and use model, as an instance of a common linguistic meta-model, such as Ecore. The advantage of an Ecore model is not only a new class diagram, but rather the ability to use a very broad set of Ecore functionalities, such as code, entity and api generation, as well as the ability to check models regarding their syntactical and semantical correctness.

Our project, the transformation to the Ecore Model is a part (step 2) of the bigger picture shown below

The bigger picture
The bigger pictur

We used the Atlas Transformation Language (ATL) for this transformation. 

IFC Structure:

In general, the IFC specification consists of four different Declaration types: 
  • Type Declarations 
  • Entity Declarations 
  • Function Declarations 
  • Rule Declarations 

We focused on the transformation of Type and Entity Declarations and handled the rest as simple EClass “name-only” stubs. 

Type Declarations are similar to "typedef" or "value type" in common programming languages, and refer to a basic information construct, derived from: 

  • an Enumeration
  • a primitive (String, Integer, Real, Boolean) - aka Concrete Type
  • a selector of entites of types - aka Select Types 


Entity Declarations are similar to the term "class", and describe data structures. They are built in the following way (in the express notation)

ENTITY (*Name*) 
    ABSTRACT SUPERTYPE OF (*Classes*); 
    SUBTYPE OF (*Classes*); 
    (*Declarations*); 
END_ENTITY;

Methodology:

The transformation will be shown using the example of the "IFCActuator" entity. The result of this transformation to Ecore looks the following:

IFCActuator
IFCActuator

Type Declarations

In this section we transform the three different types of Type Declarations.

Enumerations:
As you can see on the upper left side, the IFC Actuator contains some enumerations of type "IFCActuatorTypeEnum". Basically they are transformed to an EEnum using the following rule:

In Ecore an EEnum needs a name, which we transform by adding the corresponding IFC!Enum's classname, aswell as a value, which is incremented by 1 for every added Enumeration. 

Enumeration Transformation Rule
Enumeration Transformation Rule



Concrete Types:
Simple Types (for example String) are needed to be converted very often and are realized via helper functions. 

Simple Type Transformation Rule
Simple Type Transformation Rule


Select Types:
Select Types are  converted to eClasses with eAttributes or eReferences, or both, depending on the types declared in the "select_list.named_types", as shown below:

Select Type Transformation Rule

Entity Declarations:

Entities (for example the upper middle IFCActuator entity) are transformed to an EClass, containing a name, some eStructuralFeatures (for example attributes) aswell as an eSuperType for inheritance. 

Entity Transformation Rule


There are many different rules for transforming eStructuralFeatures, depending on the complexity of the underlying type, but in the most simple case, like in the IFCActuator the "PredefinedType", which is an IFC!AttributeSimple, the transformation rule looks the follwoing: 

Simple Attribute Transformation Rule
Simple Attribute Transformation Rule


Relations & Aggregations: 

Relations between entities (for example between IFCElement and IFCIdentifier), as well as aggregations are realized with the EReference class - below there is a transformation rule for a simple case:


Relations and Aggregation Transformation Rule


OCL-Annotations:

In IFC some parts that cannot be transformed to ECore. For example, there is a type declaration called IFCGloballyUniqueId, containing a String with a length that of exactly 22 characters.

TYPE IfcGloballyUniqueId = STRING(22) FIXED;
END_TYPE;

We handle this logic using additional OCL Annotations.
OCL Annotations
OCL Annotations


Results:

The transformation of the Express DML metamodell into the Ecore model is successful. The transformation of the whole IFC4.isoexpall model takes between 0.5 and 2 seconds. There are no missing entities and no errors or warnings in ATL. The resulting target model is a syntactical valid Ecore model.

Next Steps:

Even if the target model has no errors it’s not guaranteed that the model to model transformation is actually valid - ATL doesn’t offer this kind of checking-feature. Therefore the validity of the transformation still needed to be proven.


Friday, July 15, 2016

Automated Scoping, Validation and Quickfixes for xText based languages

By Christian Beikov, Raphael Löffler, Oliver Reiter and Christopher Schwarz.

Xtext is a language development framework and mostly used to create domain specific languages as well as to develop feature-rich editors. Model validation with error highlighting, scoping and quick fixes are also supported, but have to be implemented manually. Our project generates said features automatically based on OCL constraints, which are defined in the underlying model of the language. The goal is to reduce the amount of work creating textual editors for DSLs by following a model based approach. In cause of the fact that the whole work is based on Xtext, a big part of it was to explore Xtext to find possible solutions for integrating the described automated approach. Xtext is one part of the openArchitectureWare (oAW), which is framework for supporting model driven development. The possibility to not only create a new DSL, but also create automatically specified editors for this DSL makes Xtext very interesting. Another big part were our work is based on is the Object Constraint Language (OCL). OCL is a textual formal specification language and is part of the Unified Modeling Language. It is a declarative language and was introduced by the Object Management Group (OMG) to add the possibility of adding constraints to object-oriented models that can not be defined with standard diagrammatic notations.

Validation

For each class, which has OCL constraints defined, a validator is generated in Java, which also tries to find the erroneous feature of the object. These are further used in a custom implementation of AbstractDeclarativeValidator to be used in an Xtext editor. The improvement to the default validation is the localization of the error, which also enables the possibility to provide quickfixes. The pictures below show our implementation (Fig. 2.) in comparison to the default validator (Fig. 1.), which highlights the complete, invalid object.

Fig. 1. Error highlighting with default validators
Fig. 2. Error highlighting with OCL validators

Scoping

A scoping provider basically returns a set of objects, which can be used in a specific context. Therefore scoping rules have to be implemented manually, as the default provider only generates a scope with objects of a valid type. Our project tries to filter these by the OCL constraints of the context. To give an example, Fig. 4. shows the filtered scope in comparison to the unfiltered one (Fig. 3.). A constraint hereby is, that a page element, e.g. a text-field, can only refer to features contained in the handled entity of the form. In this example, this is Event. Another one in this example is, that a date-selection-field can only refer to attributes of the type Date and therefore the other elements are filtered out.

Fig. 3. Scope of the default validator
Fig. 4. Scope of the OCL based validator

Quickfixes

Quickfixes are provided by the editor, if an error is detected. For cross references, this is basically just the combination of validation and scoping, but for primitive data types, these have to be provided seperately. Our implementation detects the type of the erroneous feature and generates a fix at runtime in the validator. There is currently just one limitation: quickfixes are provided only for boolean values and cross references, but this functionality can easily be extended in the future.

Fig. 5. Quickfix of the OCL based provider

Future work

Of course there are some restrictions and limits of our implementation, which can be improved in future. Especially the generated Java code can be optimized in future. As mentioned our generated quickfixes currently support only boolean values. The code generation can be extended in future to also provide other types. Another way to extend our solution is to integrate all OCL operations. Currently we only implemented the most important ones to provide basic functionality of the implementation. These two extensions can be easily introduced by extending the implementation for the wanted functionality.


The source code of the project can be found on Github (https://github.com/Advanced-Model-Engineering-SS16/xtext-ocl-extensions).