Presentation is loading. Please wait.

Presentation is loading. Please wait.

Requirements for CPC Scripting Language

Similar presentations


Presentation on theme: "Requirements for CPC Scripting Language"— Presentation transcript:

1 Requirements for CPC Scripting Language
Ivan Prieto Barreiro Jeffrey Goderie 26/11/2015

2 What is UAB? 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 Device Instantiation Templates Process Logic Templates Device Types Analog Alarm PID Inputs Specifications Outputs Control Application PLC S7 Touch Panels 26/11/2015

3 Current Generation Workflow
UNICOS application sources Code Generation Import & Compile Device specification list Control Code Inputs Compilation Error!!! UAB CPC Wizard Templates 26/11/2015

4 Desired Generation Workflow
UNICOS application sources Code Generation Import & Compile Device specification list Control Code Inputs UAB CPC Wizard Templates Dynamic Errors! Generation Errors! 26/11/2015

5 Writing Logic Templates
PLC code generated from strings No syntactic/semantic checkings Errors detected after generate, import & compile No syntactic/semantic checkings during editing Errors detected during compilation Error messages could be improved 26/11/2015

6 Project Structure Scripting DSL Siemens DSL Schneider DSL Siemens
‘Mixing’ DSL SchneiderScripting ‘Mixing’ DSL 26/11/2015

7 Siemens DSL (1/2) Reusable DSL for Siemens SCL language
Access to CPC devices (I/O) & CPC device instances Syntax checking (To be optimized) & coloring Type system (In progress) Name binding (To be completed) Function names Variables CPC device instances & fields (currently only device I/O, others?) 26/11/2015

8 Siemens DSL (2/2) Code completion (To be completed)
Function names & parameters Variables CPC device instances CPC device fields 26/11/2015

9 Scripting DSL (1/3) Shared by Mixing DSLs (Siemens/Schneider)
Jython like language Used to generate PLC code dynamically User defined functions Reusability of PLC code generation Return values Recursion Call to standard functions List: list.get(index), list.add(obj), max(list), min(list), all(list), any(list), obj in list String: string.strip(), string.lower(), string.upper() String, List: obj.size(), len(obj) Number: abs(number), int(number), real(number) Dictionary (TBD): dict.keySet(), put value, get value 26/11/2015

10 Scripting DSL (2/3) UAB Utilities: Control statements:
specs.findMatchingInstances(..) // Overloaded Completion of spec fields in the conditions TBD: Parameter validation TBD: Completion of device type names IDeviceInstance.getAttributeData(fieldName) TBD: Other utilities (static methods, plug-in methods) Control statements: if - else / if - elif - else for loop while loop break / continue (loops) 26/11/2015

11 Scripting DSL (3/3) Arithmetic expressions: + - / * % **
Comparison operators: ‘==‘ ‘is’ ‘is not’ ‘!=‘ ‘<>’ ‘>=‘ ‘<=‘ ‘<‘ ‘>’ Logical operators: ‘and’ ‘or’ ‘not(..)’ generate(..) Generation of valid SCL (ST) statements Partial SCL (ST) generation (only in last sentence) e.g.: generate{“IF”}; Scripting statements not allowed Comment generation: e.g.: ^// Comment generation with $variable$ replacement 26/11/2015

12 Siemens CPC Template DSL (1/2)
Mixing of SCL(ST) and Scripting DSL Statements with $variable$ Variable insertion: var := $variable$; Simple sentence evaluation: var := $3 + 2$; Call to scripting functions: var := $myFunctions.factorial(4)$; SCL comments are not generated! 26/11/2015

13 Siemens CPC Template DSL (2/2)
Code generation: Real time visualization Validation of SCL generated code 26/11/2015

14 Demo 26/11/2015

15 Questions What other device fields are required? (.index, .FEType, …)
Are overloaded functions required (scripting language)? What Jython functions do you use often? In what locations should scripting language be allowed? 26/11/2015

16 Next Meeting… Get requirements for the scripting language: Date?
Standard functions Additional functionalities Date? 26/11/2015

17


Download ppt "Requirements for CPC Scripting Language"

Similar presentations


Ads by Google