research in modelresearch in model--based product ... · research in modelresearch in model--based...
TRANSCRIPT
Research in ModelResearch in Model--Based Product DevelopmentBased Product Developmentat PELAB in the MODPROD Centerat PELAB in the MODPROD Center
Presentation at MODPROD'2011Presentation at MODPROD'2011PELAB PELAB –– Programming Environment LaboratoryProgramming Environment Laboratory
at PELAB in the MODPROD Centerat PELAB in the MODPROD Center
Department of Computer and Information ScienceDepartment of Computer and Information ScienceLinköping University Linköping University
20112011--0202--0808
Peter FritzsonPeter Fritzson
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
Examples of Complex Systems in Examples of Complex Systems in EngineeringEngineeringg gg g• Robotics
A tomoti e• Automotive• Aircraft• Mobile Phone Systems• Mobile Phone Systems• Business Software • Power plantsPower plants• Heavy Vehicles• Process industryy
2 © Peter Fritzson
Vision of IntegratedVision of IntegratedModelModel--Based Product DevelopmentBased Product Developmentpp
FeedbackFeedback
Business Requirements Model-Driven Compilation
SystemSimulation
eedb c
Business Requirements Model-Driven Compilation
SystemSimulation
eedb c
ProcessControl
RequirementsCapture Design
(PIM)& Code Gen
(PSM)
Software &
ProcessControl
RequirementsCapture Design
(PIM)& Code Gen
(PSM)
Software &
Product models
Requirementsmodels
Syst ProductPlatformmodels
Processmodels
Product models
Requirementsmodels
Syst ProductPlatformmodels
Processmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWLUnified Modeling: Meta-modeling& Modelica& UML & OWL
Vision of unified modeling framework for model-driven product development from platform independent models (PIM) to platform specific models (PSM)
3 © Peter Fritzson
to platform specific models (PSM)
Open Source ModelicaOpen Source ModelicaOpen Source Modelica Open Source Modelica ConsortiumConsortium
Open Source EffortOpen Source EffortOpen Source EffortOpen Source Effort
4 © Peter Fritzson
The OpenModelica Open Source Enviroment The OpenModelica Open Source Enviroment www.openmodelica.orgwww.openmodelica.orgwww.openmodelica.orgwww.openmodelica.org• Advanced Interactive Modelica compiler (OMC)
• Supports most of the Modelica Language
• Basic environment for creating models• OMShell – an interactive command handler * ModelicaML UML Profile• OMNotebook – a literate programming notebook * MetaModelica transforms• MDT – an advanced textual environment in Eclipse * OMEdit graphic editor
5 © Peter Fritzson
OSMC OSMC –– International Consortium for Open Source International Consortium for Open Source ModelModel--based Development Tools,based Development Tools, 32 members Dec 201032 members Dec 2010
Industrial members (18)•ABB Corporate Research, Sweden Open source community services
ModelModel based Development Tools, based Development Tools, 32 members Dec 201032 members Dec 2010Founded Dec 4, 2007
•Evonik Energy Services, India• IFP, Paris, France
•Bosch Rexroth AG, Germany •Siemens Turbo Machinery AB, Sweden •CDAC Centre for Advanced Computing, Kerala, India
Open-source community services• Website and Support Forum• Version-controlled source base
Bug database
, ,•InterCAX, Atlanta, USA•MOSTforWATER, Belgium •MathCore Engineering AB, Sweden •Maplesoft, Canada
•CEIT Institute, Spain•Creative Connections, Prague, Czech Republic •Frontway AB, Sweden•Equa Simulation AB, Sweden
• Bug database• Development courses• www.openmodelica.org
•TLK Thermo, Germany •VI-grade, Italy•VTT, Finland •XRG Simulation, Germany
Code Statistics
•Linköping University, Sweden •Hamburg University of Technology/TuTech, Germany FH Bi l f ld Bi l f ld G
University members (14)
•FH Bielefeld, Bielefeld, Germany•Technical University of Braunschweig,, Germany •Technical University of Dortmund, Germany•Université Laval, modelEAU, Canada •Griffith University, Australia •Politecnico di Milano Italy•Politecnico di Milano, Italy •Mälardalen University, Sweden •Technical University Dresden, Germany•Telemark University College, Norway•Ghent University, Belgium•Ecoles des Mines CEP Paris France
6 © Peter Fritzson
•Ecoles des Mines, CEP, Paris, France•University of Ljubljana, Slovenia
New OpenModelica Connection EditorNew OpenModelica Connection EditorOMEditOMEdit
• Supports MSL 3.1E t• Easy to use
• Rather stableI l t d i C Qt lib• Implemented in C++ Qt library
7 © Peter Fritzson
New Interactive New Interactive Simulation with Simulation with OpenModelicaOpenModelica
Examples of Simulation Visualization
Simulation Control
Plot View
RequirementsRequirements
Evaluation View
Liquid Source
MaxLevel
Level h
Level h Domain-Specific
Visualization View
8 © Peter Fritzson
Tank 1 Tank 2
New OpenModelica Optimization SubsystemNew OpenModelica Optimization SubsystemOMOptimOMOptimpp• Parameter
optimizationoptimization• Currently using
genetic optimizationoptimization algorithms in OMOptim 0.9.
9 © Peter Fritzson
New WebNew Web Server Based Teaching/Learning SubsystemServer Based Teaching/Learning SubsystemOMWeb OMWeb
• Runs on ordinary web serverweb server
• Teachers provide modelingmodeling exercises
• Students send inStudents send in solutions
• Running ofgsimulations through server
• Lila EU project
10 © Peter Fritzson
New New DrControlDrControl Interactive Interactive Electronic BookElectronic Book
Examples
QuestionsTheory
ExperimentationModels
11 © Peter Fritzson
ResearchResearchResearchResearch
ModelingModeling--Language DesignLanguage Design
Modeling Support EnvironmentsModeling Support EnvironmentsModeling Support EnvironmentsModeling Support Environments
12 © Peter Fritzson
Important QuestionsImportant Questionspp
• Design of modeling languages for modeling l ( h i l) t (M d li ) i l dicomplex (physical) systems (Modelica) including
precise semantics, extensibility, etc.• How to engineer complex engineering systems of
both hardware and software in a consistent and safe manner?
• Compilation of models for efficient (real-time)• Compilation of models for efficient (real-time) execution on multi-core architectures
• Traceability from requirements to models to implementation
13 © Peter Fritzson
Context of Using of Semantics for Checking Context of Using of Semantics for Checking g gg g
14 © Peter Fritzson
Current Semantics and Current Semantics and MetaModelicaMetaModelica/Modelica 4 /Modelica 4 WorkWorkWorkWork• Defining Core language MKL (Modeling Kernel
Language) and Core MetaModelica for expressing baseLanguage) and Core MetaModelica for expressing base semantics
• Other constructs should be expressible in the Core language
• Defining extensible meta-modeling/meta-programming language primitives (e g MetaModelica)language primitives (e.g. MetaModelica)
• Define compiler and core library in MetaModelica, p y ,migrated to Modelica 4
15 © Peter Fritzson
Integrated HardwareIntegrated Hardware--Software Software ggModelingModeling
ModelicaMLModelicaMLModelicaML ModelicaML UML Profile for ModelicaUML Profile for Modelica
SysMLSysML Modelica IntegrationModelica IntegrationSysMLSysML--Modelica Integration Modelica Integration
16 © Peter Fritzson
Using ECLIPSE as Integration PlatformUsing ECLIPSE as Integration Platformg gg g
UML-ModelicaOpenUP/Basic Capacity Sub-OpenModelicaMDT
UML ModelicaPlug-in
OpenUP/Basic p yProcess Areas
ECLIPSE Process Framework (EPF) Composer Specific components
ECLIPSE Modeling Framework
Graphical Modeling Framework
ECLIPSE Rich Client Platform (RCP) Runtime
ECLIPSE Modeling Framework
Java runtime
OpenModelica runtime
MetaModelica runtime
C/C++ runtime
17 © Peter Fritzson
ModelicaMLModelicaML –– UML Profile for ModelicaUML Profile for Modelica1st Generation (20061st Generation (2006--2008)2008)(( ))
• Extension of SysML subsetExtension of SysML subset• Features:
S pports Modelica constr cts• Supports Modelica constructs• Modelica generic class modeling
M d li t i d fi iti• Modelica syntax in definitions• Equation-based modeling
Si l ti d li• Simulation modeling
18 © Peter Fritzson
ModelicaMLModelicaML UML Profile, 2nd GenerationUML Profile, 2nd GenerationSysMLSysML/UML to Modelica OMG Standardization/UML to Modelica OMG Standardization(with Wladimir Schamai 2009(with Wladimir Schamai 2009 Now)Now)(with Wladimir Schamai, 2009 (with Wladimir Schamai, 2009 –– Now)Now)
• ModelicaML is a UML Profile for SW/HW modeling• Applicable to “pure” UML or to other UML profiles e g SysML• Applicable to pure UML or to other UML profiles, e.g. SysML
• Standardized Mapping UML/SysML to Modelica• Defines transformation/mapping for executable modelsDefines transformation/mapping for executable models• Being standardized by OMG
• ModelicaML• Defines graphical concrete syntax (graphical notation for diagram) for
representing Modelica constructs integrated with UML• Includes graphical formalisms (e.g. State Machines, Activities, g p ( g , ,
Requirements) • Which do not exist in Modelica language • Which are translated into executable Modelica code• Which are translated into executable Modelica code
• Is defined towards generation of executable Modelica code• Current implementation based on the Papyrus UML tool +
O M d li
19 © Peter Fritzson
OpenModelica
ModelicaML: Graphical NotationModelicaML: Graphical Notation
Structure Requirements
B h iBehavior
20 © Peter Fritzson
Example: Representation of System StructureExample: Representation of System Structure
Interconnections
Inheritance
Components
21 © Peter Fritzson
Example: Representation of System BehaviorExample: Representation of System Behavior
State Machine of the
Controller
State Machine of
the Tank
Conditional Algorithm
(Activity Diagram)
22 © Peter Fritzson
ExampleExample: : Representation of System RequirementsRepresentation of System Requirements
Textual Requirement Formalized RequirementTextual Requirement Formalized Requirement
23 © Peter Fritzson
ExampleExample: : Simulation and Requirements Simulation and Requirements EvaluationEvaluation
Req. 001 is instantiated 2 times (there are 2 tanks in
the system)
tank-height is 0.6m
Req. 001 for the tank2 is violated
Req. 001 for the tank1 is not violated
24 © Peter Fritzson
Parallel Execution Parallel Execution Compilation to MultiCore Compilation to MultiCore
25 © Peter Fritzson
Towards HighTowards High--Level Parallel Level Parallel Modeling and SimulationModeling and Simulation
Single-processor Performance Scaling
14.0
16.0
Parallelismgg• Simulations are
time-consuming10.0
12.0
14.0
edu
p
Throughput incr. 55%/year
Device speed
Parallelism
Assumed increase17%/year possibletime consuming
• Moore’s ”Law”: (since 1965) • #devices per chip area doubles
every 18 months 4.0
6.0
8.0
Log
2 S
pee
Limit: Clock rate
Pipelining
Device speed
every 18 months• CPU clock rate also doubled every
18 months – until 2003,then: heat and power issues, limited ILP, ... superscalar technology has reached
0.0
2.0
1984198619881990199219941996199820002002200420062008201020122014201620182020
Limit: RISC ILP
Pipelining
RISC/CISC CPI2006gy
its limits,only (thread-level) parallelism can increasethroughput substantially
• The consequence:
65 nm45 nm 32nm 22nm90 nmSource: Doug Burger, UT Austin 2005
• The consequence: Chip multiprocessors (+ clusters)• Multi-core, PIM, ... (for general-purpose computing)
Need parallel programming/modeling/parallelization• Need parallel programming/modeling/parallelization• Automatic parallelization• Explicit parallel modeling and parallel programming
26 © Peter Fritzson
Towards EasyTowards Easy--toto--UseUseModeling & Simulation using Parallel ComputersModeling & Simulation using Parallel Computers
Modeling using drag’n’drop
Parallel E i
Visualization
TranslationExecution
Parallel SimulationSimulation
Code
27 © Peter Fritzson
Integrating Parallelism and Mathematical ModelsIntegrating Parallelism and Mathematical ModelsThree ApproachesThree Approachespppp
• Automatic Parallelization of Mathematical Models (ModPar)Automatic Parallelization of Mathematical Models (ModPar)• Parallelism over the numeric solver method.• Parallelism over time. • Parallelism over the model equation systemParallelism over the model equation system
• ... with fine-grained task scheduling
• Coarse-Grained Explicit Parallelization Using ComponentsCoarse-Grained Explicit Parallelization Using Components• The programmer partitions the application into computational components
using strongly-typed communication interfaces. • Co-Simulation, Transmission-Line Modeling (TLM), g ( )
• Explicit Parallel Programming • Providing general easy-to-use explicit parallel programming constructsProviding general, easy to use explicit parallel programming constructs
within the algorithmic part of the modeling language. • NestStepModelica
28 © Peter Fritzson
Modelica Simulations Modelica Simulations –– Parallelization ApproachParallelization Approach
• Simulation = solution of (hybrid) DAEs from modelsSimulation solution of (hybrid) DAEs from models
00
),,(),,,(
tYXhtYXXg
• In each step of numerical solver:• Calculate in g (and Y in h)
0),,( tYXh
X g ( )
• Parallelization approach: perform the calculation of in parallel
X
X
p• Called parallelization over the system.
• Drawback: Numeric solver might become bottle-neckDrawback: Numeric solver might become bottle neck
29 © Peter Fritzson
Example Example –– Task Graphs and Parallelized Task Graphs and Parallelized ApplicationApplicationpppp
125 0
2.5
3Speedup
32
21
4 5 60 0 0
1.5
2
41
52
62
7 80 010 0.5
1
71
81
1 2 4 8 16# Proc
Clustered Task Graph Thermofluid Pipe Application
30 © Peter Fritzson
Modified Approach Modified Approach ––InliningInlining and Pipeliningand Pipelininggg p gp g
• Try to keep communication as close as iblpossible
• Only communicate in one direction inside a• Only communicate in one direction inside a time step.
• Solver Inlining – distribute the solver across all the processorsthe processors
• Some parallelism across the method – parallel p pevaluation of Runge-Kutta step
31 © Peter Fritzson
Task Merging Task Merging vsvs Approach with Approach with Pipelining/Pipelining/InliningInlining
S
Use a graph iti
p gp g gg
• Try to keepEquation
Equatio
Equatio
SSS
rewriting system to merge tasks into larger
Try to keep communication as close as possiblen tasks
on tasks
on tasks
S
into larger tasks, based on latency and bandwidth
• Only communicate in
di ti
S
SS
Sbandwidth.
Some tasks are duplicated
one direction inside a time step.
S
Eq EE SS
are duplicated to avoid communication within a step
• Solver Inlining –distribute the solver across allquation ta
Equation
Equation
SSwithin a step solver across all
the processors
32 © Peter Fritzson
asks
tasks
tasks
SS
Measurements PipelinedMeasurements Pipelined(100000 steps Flexible Shaft Model, Fall 2008)(100000 steps Flexible Shaft Model, Fall 2008)
Task-merging, MPI, SGI Altix Pipelined, Pthreads, SGI, Intel Xeon
Relative speedup
4
Relative speedup
7
3
3,5
5
6 SGI
1,5
2
2,5
Spee
dup
3
4
Spee
dup Intel
0,5
1
1
2
00 5 10 15
Number of processors
SGI Altix 3700 Bx2
00 2 4 6 8 10
Number of processors
Intel Xeon SGI Altix 3700 Bx2
33 © Peter Fritzson
SGI Altix 3700 Bx2
332/14/2011 PELAB - Linköping University
Speedup Measurements on NVIDIA (Speedup Measurements on NVIDIA (novnov 2009)2009)Modelica Model, Generated Code, Function of Problem SizeModelica Model, Generated Code, Function of Problem Size, ,, ,
• New PlatformNVIDIA Fermi 20502 Teraflop peak
• In Use from January 2011
34 © Peter Fritzson
New Scalable OpenModelica Parallel Code New Scalable OpenModelica Parallel Code GeneratorGenerator
• Work in Progress• Both task parallelism and data parallelism• Handling non-expanded arrays efficiently• Planned use of TLM-partitioning for more parallelism
• Generating OpenCL code for platform independence• Template based code generator
35 © Peter Fritzson
The The OpenModelicaOpenModelica CompilerCompilerImplemented mainly in MetaModelica and C/C++; 114 packagesImplemented mainly in MetaModelica and C/C ; 114 packages
Mod Connect
Types.Mod SCode.Mod Exp.Componentre f DAE
Main BackendDumpDAE
Flat ModelicaPrefix.Pre fix
Lookup
(Env, name)SCode.Class Derive VarTransform
PrefixBackendDAEEXT
Exp.IdentPrefix.Prefix
Types.Mod SCode.Mod p p
ClassLoader
SCodeUtilParser BackendInst
Absyn SCodeDAE: Equations
Algorithms
( , )
DAE F i
DAE, substlist
DAEExp.Exp Exp.Exp
.mo
ClassLoader
SCode.Exp(Exp.Exp,
Type s.Type) TemplateCodeGen
ClassInf
DAE: FunctionsSimCode
ClassInf.Event ClassInf.State
Values.Value
Exp.Exp
Ceval
Static
Exp.Exp
(Env, name)
Absyn
Data Type Modules:
SCode Utility
Modules:
C code
Patternm
Ceval
Types
Algorithm
DAE
Expression
Dump Debug
ModUtilBuiltin
Util MetaUtil
DFA
36 © Peter Fritzson 36
go t p ess o
SystemPrint RTOpts
u t
Summary of MODPROD Research in PELABSummary of MODPROD Research in PELAByy
• Modeling language design (semantics, type t t d li t ibilit )systems, meta-modeling, extensibility)
• Modelica-SysML integration• Requirements traceability• Compilation to multi-core platformsCompilation to multi core platforms• Compilation and performance measurements for
real time simulationreal-time simulation
Contact: [email protected]
37 © Peter Fritzson