beforehands
DESCRIPTION
Beforehands. OMOptim. C++ code Stored on subversion solver Using Qt libraries (GUI, Model/ View , Containers, Threads, XML…). Subversion repository. Main classes. Class Project. The Core of the program One project at a time Contains main items - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/1.jpg)
BEFOREHANDS
![Page 2: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/2.jpg)
OMOptim
• C++ code• Stored on subversion solver• Using Qt libraries (GUI, Model/View,
Containers, Threads, XML…)
![Page 3: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/3.jpg)
Subversion repository
16/01/2012 Plateforme CERES
![Page 4: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/4.jpg)
MAIN CLASSES
![Page 5: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/5.jpg)
Class Project
• The Core of the program• One project at a time• Contains main items– Modelica tree of models, package… (ModClassTree)– List of problems and results– List of ModModelPlus– Misc. Informations : save files, files loaded
• Main functions– Problems should be launched from Project– Threads management
![Page 6: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/6.jpg)
Class Project
![Page 7: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/7.jpg)
GUI
• Widgets• Dialogs• Treeviews• Tableviews
Modelica
• ModClassTree• ModPlusCtrl• ModModelPlus• ModClass
Problems• ProblemInterface• Problem• Result
OMOptim
![Page 8: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/8.jpg)
MODELICA - MODELS
![Page 9: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/9.jpg)
ModClass
• Basic class, corresponding to an item in modelica– Each instance stores name and children
Inheritance diagram
![Page 10: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/10.jpg)
ModClassTree
• Contains modelica models, packages, classes names
![Page 11: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/11.jpg)
ModModelPlus
ModModelPlus
• ModModel* pointer to a modelica model
• void compile()• void readVariables()
ModModelPlus allows to store information about a modelica model (ModModel*).
Especially :-Input variables-Connections between components
It also provides compiling and reading functions. Still, those functions require ModPlusCtrl.
![Page 12: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/12.jpg)
ModPlusCtrl• Simulation software controler :– Specific for each simulation software– Provide interface functions :
• Set simulation parameters• Writing / Reading variables• Compiling model• Simulating model
– Set Parameters :• Simulation time• Solver• Tolerances• …
![Page 13: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/13.jpg)
ModReader & MOOmc
• Offering modelica reading functions• MOOmc : link between OpenModelica &
OMOptim (use Corba protocol)– QString getFlattenedModel (const QString &modelName)– bool addConnection (QString org, QString dest)– void getInheritedComponents (QString parentClass, QStringList
&names, QStringList &classes)– …
![Page 14: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/14.jpg)
Model AModel B
Model management
MOOMC
MyFile.moOMOptim
ModPlusCtrl
OpenModelica controler
Dymola controler
MathModelica controler
Reading modelCorba communication with
OpenModelica
-Compiling-Simulating- Reading/Writing variables
ModClassTree
![Page 15: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/15.jpg)
PROBLEMS
![Page 16: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/16.jpg)
Launching a problem
Project
• void launchProblem(Problem*);• SLOT : void
onProblemFinished(Problem*,Result*);
• Problems* _problems;• Results* _results;
Post-computation procedure :
Result storage GUI creation
SLOT
project->onProblemFinished(myProblem,myResult)
SIGNAL
emit finished(myProblem,myResult)
Create Problem Thread
myProblem->launch()… separate thread …
project->launchProblem(myProblem)
User
ProblemThread
• void run();• SIGNAL : void finished
(Problem*,Result*);
Separatethread
![Page 17: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/17.jpg)
ProblemAn abstract class defining basic functions.Inherits OMCase which contains more basic virtual functions.
![Page 18: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/18.jpg)
Project
One Simulation
ModClassTree
• Package 1• Package 2
[ModPackage]• Model a• Model b
[ModModel] ModModelPlus
ModModelPlus
Problem1 [OneSimulation]
• OverwritedVariables• ModPlusControler• ModModelPlus*
![Page 19: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/19.jpg)
One Simulation
•Linked to ModModel (node in ModClassTree)
•Model initial variables
ModModelPlus*
•Simulator choice and parameters
ModPlusCtrl*
•Variables with new values set by the user
Overwritedvariables*
OneSimResult
•Simulation variables at final time
FinalVariables
•A copy of the problem
OneSimulation
![Page 20: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/20.jpg)
Problems’ plugin
Shared OMOptim :
- OneSimulation- Optimization
Energy Integration- PluginEI.dll
My Sensitivity analysis
Plugin loading :dynamic or static
Method: implement new inheritances of following abstract classes- ProblemInterface- Problem- Result
![Page 21: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/21.jpg)
ENERGY INTEGRATION
![Page 22: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/22.jpg)
Energy integration
• EI is a plugin offering new problems– EIMER : Minimum energy requirement– EITarget : Utilities targetting– EIHEN1 : Heat Exchanger Network
![Page 23: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/23.jpg)
Energy integration
Modelica model
MILP optimization problem
EIProblem-MER
-Target-HEN
ModPlusCtrl
MOOmc
MILP SolverGLPK
Cbc
Cplex
![Page 24: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/24.jpg)
GUI
![Page 25: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/25.jpg)
GUI – Core links
• Often use Qt model-view programming– Data / GUI more
independent
![Page 26: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/26.jpg)
Conventions used in code
• Class name always start with an uppercase : MyClass
• Members always start with _ + lowercase_myInstance
• Local variables start with lowercasemyLocalVariable
• Documentation generated through Doxygen
![Page 27: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/27.jpg)
OMOptimBasisVariables, Problems,
Settings, GUI
OMOptim PluginEI
PluginEIOMOptimModelica
![Page 28: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/28.jpg)
Source code storage
![Page 29: Beforehands](https://reader035.vdocuments.us/reader035/viewer/2022062501/56816924550346895de05b11/html5/thumbnails/29.jpg)
Documentation