Train Control Language Teaching Computers Interlocking By: J. Endresen, E. Carlson, T. Moen1, K. J. Alme, Haugen, G. K. Olsen & A. Svendsen Synthesizing Software Models Generate Train Station Models Automatically By: Andreas Svendsen, Øystein Haugen, and Birger MøllerPedersen Presenter: Rahma Al Mahruqi CISC 836 Train Control Language Teaching Computers Interlocking Outline • Motivation • Objectives • Computer Based Interlocking CBI • Domain Specific Modeling Language DSL • Syntax of TCL • TCL Semantics • Advantages of TCL Motivation Bridging the gap between trains and computers with a specially designed language that enables the signaling experts to create consistent train interlocking systems. Objectives • ABB and SINTEF organizations have developed TCL for specifying and automating the train interlocking systems. • Combine the station drawing with the train routes and interlocking tables in the TCL. • Generate automatically the programmable logic controller PLC code and test cases from the models created in the TCL language. • Describes DSL for specifying stations and to allow automatic generation of interlocking tables and the code for the Computer Based Interlocking CBI Terminologies • DSL : Domain Specific Language • DSM Domain Specific Modeling • TCL : Train Control Language • PLC: Program Language Controller • CBI : Computer Based Interlocking • EMF: Eclipse Modeling Framework • GMF : Graphical Modeling Framework Introduction • Interlocking system controls the basic elements of the train station such as signals, switches, truck circuits and allocate train routes to avoid collisions. • Interlocking system ensures that the route is safe by reading the status of the elements in the route (e.g. tracks, switches, signals) to see if they comply with the logic of the interlocking system. Interlocking System • Prevents dangerous train movement on a train station by giving a “clear” signal to a train only if the requested route is safe. Interlocking System • Development of interlocking source code is a time-consuming process requiring a large amount of resources. • The logic is illustrated by an interlocking table, and realized by the interlocking source code, in the form of functional blocks of code that are executed by the PLCs in their control of the station. CBI Development Workflow Domain Specific Language • DSL is a modeling language dedicated to a particular problem domain. • Bridge between the experts of an application domain and the experts of computer science. Train Control Language • DSL done through a metamodel, which automates the production of source code for computers controlling train stations • Improves the completeness and consistency of the specifications and reduce the human effort. • Applies UML class diagrams to define metamodels. Metamodel • Model of the language which defines the language concepts and the relations between these concepts. • Characteristics of a Metamodel: - Composition (Stations contain TrackCircuits etc.), - Attributes (Station has a name) and - Relations (TrainRoute refers to a number of TrackCircuits). A small piece of the TCL Metamodel Track Inheritance Hierarchy. Concrete Syntax of TCL • Open source Eclipse and its modeling framework EMF technology used to define TCL. • Graphical Modeling Framework GMF used to define the graphics of the terms of the metamodel. • GMF technology helps produce an editor for TCL based on the metamodel and the graphic definitions. • The editor is embedded into the eclipse environment. The Semantics of TCL Advantages of TCL • Provides a clear interface between the realms of computer science and signaling. • Makes the signaling experts capable of creating advanced computer systems without knowing the details of computer programming. • Provides automatic generation of several different artifacts previously manually developed. • Much of the tedious and error-prone manual controls can be eliminated and the highly competent signaling experts can instead be used to refine the designs through the TCL language. Conclusion • TCL can improve the development process of interlocking systems. • Signaling experts will be able to design the systems directly. • The interlocking systems will be generated directly from the graphic representation which is produced for validation and tests. • The traditional manual work will be eliminated or minimized. Synthesizing Software Models Generate Train Station Models Automatically Motivation • Presents an approach for automatic synthesis of software models which are increasingly being used for representing software applications at a high abstraction level. • Model analysis is useful for performing model-based testing which involves generating test-cases for the application. • Software applications can be produced quicker and more reliable by automating the task of building models • A number of software models can be created to validate and verify a code generator. Objectives • Description of an approach for synthesizing software models automatically based on a formal definition of the DSL and userdefined properties. • Illustrate real example from the train domain TCL, where train station models are generated automatically. Terminologies • DSL is defined by an abstract syntax, a concrete syntax and well-defined semantics. • Accompanied by code-generators and frameworks. • TCL is a graphical DSL for modeling train stations and generate configuration code for a framework which controls train station signaling systems. • Alloy is a formal language used to find and produce intended DSL models. TCL Metamodel TCL concrete syntax TCL Model Components • Repository model, containing the abstract syntax, • Diagram model storing the location of each element on the canvas. • Includes algorithms for calculating the diagram model based on the repository model. • This allows the graphical diagram model to be reconstructed if the repository model is exposed to changes. TCL Graphical Editor Alloy • Light-weight declarative language using relational calculus for modeling a system formally . • Formal validation and verification of a system using mathematical notation to express the system precisely, to prove its correctness. • Supplied with an analyzer tool based on first-order-logic performs automatic analysis of Alloy models. How Alloy works • Alloy Analyzer only performs analysis within a user-specified scope, restricting the number of elements of each type in the model • When the Alloy Analyzer searches for a solution, it populates all signatures in the model with model elements up to the user-specified scope. • An Alloy model typically consists of signatures, fields, facts, predicates and assertions. Model Synthesis Generate models automatically based on specifications, for: • Reducing development time of models by generating a basis which can be extended. • Modeling large sets of models to reduce time-consuming. • Generate a model that is close to the target application model. Synthesizing TCL Model • Generating TCL Models • Adding Dynamic Properties • Optimizing Alloy Models Synthesizing TCL Model Generating TCL Models TCL Generated Stations- Static Properties TCL with Dynamic Properties • Dynamic properties is defined as a quality that can only be determined by dynamic analysis, such as model simulation. • Using dynamic analysis, certain properties of the model can be checked or simulated before the model is generate, eg. The number of tracks of the station can give an indication of how many trains the station can handle simultaneously. Optimizing Alloy Models • The Alloy Analyzer performs complete analysis within the userspecified scope. Complete analysis involves populating all possible models and discarding the ones where the constraints (facts) do not hold. Therefore, • When the scope increases, the number of possible combinations to form solution models, and thus the analysis time, increases exponentially. Conclusion • Generate application models automatically based on a well defined specification of a DSL. • Use Alloy to define the semantics of the DSL and illustrated the approach using TCL. • Alloy is used because of its uniform notation and its automatic analyzer. • Using Alloy as a specification language provides the possibility to specify the operational semantics of DSL . Conclusion • Performing model synthesis reduce the cost of developing applications, and several applications can be generated to test a code generator. • Thorough knowledge of Alloy as specification language and TCL is required to apply the proposed approach. Critique Advantages: • Well organized paper • Lot of figures • Good references Limitations: • Approach with limit to 3 track station only- generate large set of station using dynamic approach • Perform case studies and implementing the approach with other DSL