Presentation is loading. Please wait.

Presentation is loading. Please wait.

DSL implementation for UNICOS-CPC Ivan Prieto Barreiro Jeffrey Goderie BE-ICS.

Similar presentations


Presentation on theme: "DSL implementation for UNICOS-CPC Ivan Prieto Barreiro Jeffrey Goderie BE-ICS."— Presentation transcript:

1 DSL implementation for UNICOS-CPC Ivan Prieto Barreiro Jeffrey Goderie BE-ICS

2 Summary 1. UNICOS & UAB UNICOS Framework UAB (Code generation tool) Code Templates 2. DSL Implementation Project Structure Issues / How to.. 3. Custom Interpreter 4. Custom NaBL and TS 2 19/01/2016

3 UNICOS & UAB 3 19/01/2016

4 UNICOS Framework UNified Industrial Control System is a: CERN-made framework to develop industrial control applications It deals with the two upper layers of a control system 4 19/01/2016 Provides Methodology to design & develop applications which run in COTS products (e.g. SCADA & PLCs) Set of standard device types (objects) for the supervision and control layers Automatic code generation tool (UAB)

5 UAB: UNICOS Application Builder Tool used to generate code for UNICOS applications UCPC: Generates code for the control and supervision layers Main inputs: Device type definitions, specs. file & code templates 5 Device Instantiation Templates Process Logic Templates Device Types Analog Alarm PID Inputs Specifications Outputs Control Application PLC S7 Touch Panels 19/01/2016

6 UAB: Device Type Definitions & Specs 6 Device outputs Spec. template generation 19/01/2016 Device Inputs Device spec fields

7 Code Templates Features Scripts implemented in Jython. Used for data validation & code generation. Different Nature Global templates (provided) Instance templates (provided) Logic templates (application specific) 7 19/01/2016

8 Logic Templates Main use cases 1. Generate code dynamically based on queries to the specs file 2. Generate code for modular and repeatable process 3. Generate code too long to be written by hand Examples Use Cases 1 & 3 1. Get all the devices from the specs matching condition XXX 2. For each device: Get master device generate code YYY Use Case 2 8 19/01/2016 IF S01 == TRUE THEN V01 := TRUE; ELSE V01 := FALSE; END_IF; OnOff S01 V01 OO01 OnOff Input Output OnOff IF OnOff_Input == TRUE THEN OnOff_Output := TRUE; ELSE OnOff_Output := FALSE; END_IF;

9 Writing Logic Templates 9 No syntactic/semantic checkings during edition Errors detected during compilation Error messages could be improved PLC code generated from strings No syntactic/semantic checkings Errors detected after generate, import & compile 19/01/2016

10 Logic Template Execution Calls to logic templates are parameterized Several instances can use the same logic template SCL (Siemens): 1 output file for each instance 10 19/01/2016

11 Generation Workflow 11 Specs. file (device instances) Templates UNICOS application sources UAB CPC Wizard Inputs Code Generation Import & Compile Control Code Compilation Error!!! 19/01/2016

12 How a DSL can help? Provide a language for writing logic templates: Similar to the PLC languages (SCL, ST) With additional functionalities to: Query data from the specs Generate code dynamically based on the query results Provide a language editor: Syntactic & semantic checks while editing Code completion for: Device instances defined in the specs Device type definitions (device IOs) Variables, functions, function arguments… Visualize the generated code in real-time Navigation, refactoring, contextual information (hover text), … 12 19/01/2016

13 DSL Implementation 13 19/01/2016

14 Scripting DSL Schneider DSL Project Structure 14 Siemens DSL Siemens Template DSL Schneider Template DSL 19/01/2016

15 Issues / How to.. Sunshine Parameterized calls to templates (input parameters, output file names) Get error and warning messages Set the output folder for the generated files Performance NaBL : big files or complex structures (arrays of structs with arrays …) Language Composition How to achieve language composition avoiding multiple copy/paste? Language Building & Testing Trigger builds in Java 1.8 How to trigger tests (parsing, syntax, semantic…) automatically with Jenkins & Maven Spoofax Documentation Missing E.g. : Type System 15 19/01/2016

16 Custom Interpreter 16 19/01/2016

17 DynSem ProsCons Language independent meta- language No need to keep track of stacks Works great for standard operations/functions No documentation Functionality limited for non- basic operations/functions Limited capability of handling non-standard data types 17 19/01/2016

18 Custom Interpreter ProsCons Works on Java-end, so can handle any Object High speed, low resource cost “Unlimited” extendable functionality Bug-prone due to full stack control Language dependent implementation, though mostly modular No documentation (yet) 18 19/01/2016

19 Implementation Details 19/01/2016 19

20 Custom NaBL and TS

21 NABL and TS ProsCons Semantic definitions of language structures. Powerful features in both NaBL and TS. Less mistakes because of auto-generation Back-end is language independent Subsequent Scoping is not propagated into parent/children scopes. On complex or large files NaBL storing becomes quite costly, causing errors to take long to be updated. Strange things can happen due to the way NaBL has been created. Generated.str files difficult to understand 21 19/01/2016

22 N(ew)NABL and N(ew)TS ProsCons Faster: Completely run on Java’s HashMaps Subsequent scoping throughout tree Full control of both front- and back-end implementations Might not be fully modular in its current state No automatic.str file generation Currently only works for a subset of NaBL Need to implement multi-file analysis 19/01/2016 22

23 NNaBL Multi-step declaration and validation Check for new information on each iteration When no new info has been added, validate the AST Tier plus steps depend on NTS 23 19/01/2016

24 Example(1/4) NaBL codeExample file 24 19/01/2016

25 Example (2/4) 25 19/01/2016

26 Example (3/4) 26 19/01/2016

27 Example (4/4) 27 19/01/2016

28 NTS Structure depends greatly on NNaBL Will be largely in line with current implementation Final structure has yet to be designed 28 19/01/2016

29


Download ppt "DSL implementation for UNICOS-CPC Ivan Prieto Barreiro Jeffrey Goderie BE-ICS."

Similar presentations


Ads by Google