180 likes | 701 Views
JGrafchart – Graphical Domain-Specific Languages in Java. Karl-Erik Årzén LUCAS & Automatic Control, LTH + Rasmus Olsson, Gert-Ola Carlsson. Domain-Specific Languages. Common in industrial automation/control IEC 61131-3 Function Block Diagrams (FBD) Sequential Function Charts (SFC)
E N D
JGrafchart – Graphical Domain-Specific Languages in Java Karl-Erik Årzén LUCAS & Automatic Control, LTH + Rasmus Olsson, Gert-Ola Carlsson
Domain-Specific Languages • Common in industrial automation/control • IEC 61131-3 • Function Block Diagrams (FBD) • Sequential Function Charts (SFC) • Ladder Diagrams (LD) • Instruction List (IL) • Structured Text (ST)
Grafchart • Graphical programming language for sequential control applications • Based on Grafcet/SFC, Petri nets, object-oriented programming concepts • Steps with actions, transitions with conditions, macros, procedures • Developed at Automatic Control since 1991 (NUTEK, VINNOVA, SSF, EU)
High-Level Grafchart • Tokens are objects with state • State can be modified from step actions • Transitions are enabled with respect to a certain token object • Tokens may have behavior • function charts • multi-dimensional function charts
Implementation Platform • Grafchart implemented in G2 from • Object-oriented programming environment & run-time system • Powerful, but expensive and not widely spread • Financial problems
JGrafchart • Grafchart in Java/Swing • Go – class package for graphical object editors from Northwoods Corp. • Three versions • Go++ – MFC and C++ • JGo – Swing and Java • Go.Net – .NET and C# • Similar APIs • Model - View - Controller metaphor
JGo • Swing-based class package for interactive diagrams, network editors, connected graphs • Built in support for different shapes, texts, containers, connectors, orthogonal links, arrowheads, scrolling, zooming, selection, drag-drop, resizing, layers, undo-redo, … • AutoLayout package • Several large code examples (graphical editors) included • http://www.nwoods.com
JGrafchart • Graphical editor & run-time environment • JavaCC - parser generator for transitions and actions • Encapsulation - macro steps & procedure steps • Lexical scoping based on workspaces • Serialization or XML as save format • Code generation possible
JGrafchart Possibilities • High-Level Grafchart Features • Code generation • Support for other 1131-3 languages, e.g., function block diagrams • Tighter Java integration • function charts as graphical Java methods • LUCAS ABB project - Torbjörn Ekman
Master Thesis: Statechart Editor • Gert-Ola Carlsson at ABB Automation Products • Goals: • Add Statecharts as a 6th language to IEC 61131-3 • Interface to Control Builder within ControlIT • JGo-based graphical editor • 1131-3 Structured Text code generation • Transferred as XML to Control Builder
Summary • Java and Swing a nice environment for development of graphical domain-specific programming languages • JGo easy to use and contains several large code examples • Good area for master theses: • ABB Automation Products • Botech