From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
1
From Simulink to RT tools
June 15, 2010
June 15, 2010 - EFDA Feedback Control Working GroupMeeting
G. De Tommasi1 A. Barbalace2 A. Neto3 F. Sartori4
L. Zabeo5 and EFDA-JET PPCC contributors1EURATOM-ENEA-CREATE, Universita di Napoli Federico II
2Consorzio RFX3Associacao EURATOM/IST, Instituto de Plasmas e Fusao Nuclear
4Fusion For Energy 5ITER Organization
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
2
Outline
Motivations
A brief history
From Simulink to Real-Time Environments
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
3
Motivations
Main aim
I Reduction of the time needed for commissioningon the machine
I Reduction of the risk on the plant
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
4
Requirements
Requirements for the RT framework
I Standard architecture for real-time control systems
I Complete separation between the algorithmic part of areal-time application from the plant-interface software
Requirements for the design environment
I Model based design
I Validation via simulation
I Tools for the rapid prototyping of the real-timeapplication
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
5
Design aided with modeling, simulation and rapidprototyping tool
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
6
The JET eXtreme Shape Controller 2002–2003
Development phase
I The design and validation of the control algorithm was carried out inMatlab/Simulink environment (XSC Tools [1])
I The control algorithm were coded “by-hands” in the JETRTframework [2] (MARTe ancestor)
I During the implementation phase the control algorithm was revised
I The XSC Tools were updated in order to take into account thesechanges!
I The final version the XSC Tools allows the user to generate an XSCscenario (i.e. the file that is loaded by the session leader when preparingthe experiment)
G. De Tommasi et al.,
XSC Tools: a software suite for tokamak plasma shape control design and validationIEEE Transactions on Plasma Science, vol. 35(3), Jun. 2007
G. De Tommasi et al.,
A flexible software for real-time control in nuclear fusion experimentsControl Engineering Practice, vol. 14(11), Nov. 2006
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
7
The JET eXtreme Shape Controller 2002–2003
Commissioning phase
I Each time a new XSC scenario has been released thetuning of the controller parameters and its validationhas been performed in the Matlab/Simulinkenvironment with the XSC Tools
I The real-time boundary reconstruction code(XLOC/Felix) has been plugged in the Simulink schemein order to minimize the differences between the offlineand the real-time environment
I In this case we “embedded” the real-time codeinto Simulink
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
8
From real-time environment to Simulink
“Embedding RT code into Simulink”
I In most of the cases to check the real-time version of thecontroller it is convenient to run it against the plant model inthe Simulink environment.
I The real-time version and the Simulink version of the systemcan be run in parallel in order to perform the validation
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
9
Lessons learned from the XSC experience
Wishes
I Avoid implementation by-hands → automatic real-time codegeneration
I Allow to perform closed–loop validation with the real-timecode
Limitations
I JETRT didn’t provide a real separation between thealgorithmic part of a real-time application from theplant-interface software
I JETRT didn’t allow the user to plug in a plant model inorder to perform closed–loop validation of the real-timesystem
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
10
Further development of the JETRT framework 2005–2007
I In 2005–2007 a first attempt to automatically generateuser application starting from Simulink was carried outin collaboration with ENEA
I This activity was abandoned due to licensing problemsat JET
I The development of the JETRT framework stoppedsince we moved to MARTe, which provides a realseparation between the algorithmic part of a real-timeapplication from the plant-interface software
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
11
The new JET Vertical Stabilization System 2008–2009
Development phase
I The design and validation phases were still carried out inMatlab/Simulink environment
I The control algorithm was still coded “by-hands” as aGeneric Application Module (GAM) in MARTe [1]
I Validation of the real-time code were performed byclosed–loop simulations GAMifying the CREATE plasmamodel [2]
A. C. Neto et al.,
MARTe: a Multi-Platform Real-Time Framework,IEEE Transactions on Nuclear Science, vol. 57(2), Apr. 2010
T. Bellizio et al.,
A MARTe based simulator for the JET vertical stabilization system,
submitted to 26th Symposium on Fusion Technology (SOFT’10), 2010
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
12
Something is still pending!
I Within MARTe we still need automatic code generationtools!
I We would like to exploits the Mathworks Real-TimeWorkshop to automatically generate GAMs startingfrom Simulink schemes
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
13
We would like to make it easy!
We would like to just press a button and generate the codefor real-time
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
14
Automatic code generation
Automatic code generation is used for rapid prototyping indifferent fields:
I Automotive industry
I Aerospace industry
I Electrical drives
I . . .
Many commercial tools are available:
I Mathworks Real-Time Workshop
I dSpace
I Labview Simulation Interface Toolkit (which partially exploitsMathworks Real-Time Workshop)
I . . .
but there are also open source tools:
I Scilab/Scicos (compatible RTAI)
I Ptolemy/Kepler
I . . .
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
15
Target Hardware
I Generally these tools generate either a general purposecode or they are tailored for a specific HW platform
I Thanks to MARTe architecture GAMs code is notlinked to any specific HW platform
I Within MARTe the automatic code generation can beperformed regardless of the HW platform
From Simulink toRT tools
G. De Tommasi
Outline
Motivations
A brief history
From Simulink toRT
16
From Simulink to GAM
Matlab/Simulink environment is a standard de facto for thedesign of control algorithms
Possible activity
Automatic GAM generation starting from Simulink can bedone:
I Exploiting the Real-Time Workshop Target LanguageCompiler (TLC) to generate a new target for theMARTe GAMs, which is HW independent
I Generating a general purpose C/C++ code with theReal-Time Workshop and then wrap it into a GAM (asimilar solution is currently adopted by RFX)