English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Launcher: TCodeFMU.h Source File
Uranie / Launcher v4.9.0
/* @license-end */
TCodeFMU.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2024 CEA/DES
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as published
6// by the Free Software Foundation, either version 3 of the License, or any
7// later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
51#ifndef TCODEFMU_H
52#define TCODEFMU_H
53
54// ROOT
55
56//URANIE
57#include "TCode.h"
58#include "TInputFileFMU.h"
59#include "TOutputFileFMU.h"
60
61// FMI
62#ifdef WIN32
63#include <Windows4Root.h>
64#endif
65#include "fmilib.h"
66#include <JM/jm_portability.h>
67
68#include <string>
69
70namespace URANIE {
71namespace Launcher {
72
73class TCodeFMU : public TCode
74{
75public:
76
88
89 // Constructors/Destructors
90 //
91
92
102 TCodeFMU(const TString &name, const TString &title);
108 TCodeFMU(URANIE::DataServer::TDataServer *tds, TString sFMUfile, Option_t *option ="");
109
115
119 virtual ~TCodeFMU ();
120
121 // Static Public attributes
122 //
123
124 // Public attributes
125 //
126 //---------------------------------------------
135 virtual void init(Option_t *option = "");
136
141 virtual void run(Option_t *option = "");
142
147 virtual void terminate(Option_t *option = "");
148
149 void initIFirst(Option_t *option = "");
150
152
153
154 // Public attribute accessor methods
155 //
156 //---------------------------------------------
167 void setFMUFile (TString new_var, Option_t *option = "");
175 TString getFMUFile () {
176 FUNCT_TRACE();
177 return _sFMUFile;
178 }
179
181 FUNCT_TRACE();
182 return _dStart;
183 }
184 void setStartSimulation(Double_t dval) {
185 FUNCT_TRACE();
186 _dStart = dval;
187 _bStart = kTRUE;
188 }
190 FUNCT_TRACE();
191 return _dStop;
192 }
193 void setStopSimulation(Double_t dval) {
194 FUNCT_TRACE();
195 _dStop = dval;
196 _bStop = kTRUE;
197 }
198 Double_t getStepSimulation() {
199 FUNCT_TRACE();
200 return _dStep;
201 }
202 void setStepSimulation(Double_t dval) {
203 FUNCT_TRACE();
204 _dStep = dval;
205 _bStep = kTRUE;
206 }
207
209 return _dTolerance;
210 }
211 void setToleranceSimulation(Double_t dval) {
212 FUNCT_TRACE();
213 _dTolerance = dval;
214 _bTolerance = kTRUE;
215 }
216 void setStartStopSimulation(Double_t dstart, Double_t dstop) {
217 FUNCT_TRACE();
218 try {
219 if ( dstart < dstop ) {
220 setStartSimulation(dstart);
221 setStopSimulation(dstop);
222 } else {
223 throw URANIE::Exceptions::UErrorExceptions(
224 __FILE__, __LINE__,
225 Form("TcodeFMU::%s Method\n The start time[%f] is greater than stop [%e] time", __func__, dstart, dstop));
226 }
227 } catch (URANIE::Exceptions::UExceptions& ue) {
228 ue.printMessage();
229 if (ue.getMessageType() > URANIE::Exceptions::UExceptions::kWARNING)
230 exit(-1);
231
232 }
233 }
234
235
237
238 // Public FMI functions
239 //
240 //---------------------------------------------
244
245
251 void do_exit(int code)
252 {
253 printf("Press 'Enter' to exit\n");
254 /* getchar(); */
255 exit(code);
256 }
257
259
260 // Public attribute accessor methods
261 //
262
263 //---------------------------------------------
270 void setLog() {
271 _blog = kTRUE;
272 }
276 void unsetLog() {
277 _blog = kFALSE;
278 }
282 void changeLog() {
283 _blog = _blog ? kFALSE : kTRUE;
284 }
289 Bool_t getLog() {
290 return _blog;
291 }
292
300 _logLevel = theLogLevel;
301 }
302
308 return _logLevel;
309 }
310
315 virtual void printLog(Option_t *option = "");
317
318protected:
319
320 // Static Protected attributes
321 //
322
323 // Protected attributes
324 //
325
326public:
327
328
329 // Protected attribute accessor methods
330 //
331
332 //---------------------------------------------
337protected:
338 TString _sFMUFile;
341 Double_t _dStart;
342 Double_t _dStop;
343 Double_t _dStep;
344 Double_t _dTolerance;
345 Bool_t _bStart;
346 Bool_t _bStop;
347 Bool_t _bStep;
348 Bool_t _bTolerance;
350
351 // FMI structures
352 fmi_version_enu_t _sVersion;
353 fmi_import_context_t* _context_FMI;
354 fmi1_import_t* _fmi1Import;
355 fmi2_import_t* _fmi2Import;
356
357 // FMI General informations
360 Double_t _dFMUStart;
361 Double_t _dFMUStop;
362 Double_t _dFMUStep;
363 Double_t _dFMUTolerance;
364
366
367public:
368
369
370 // Protected attribute accessor methods
371 //
372
373protected:
374
375
376private:
377
378 // Static Private attributes
379 //
380
381 // Private attributes
382 //
383
384public:
385
386
387 // Private attribute accessor methods
388 //
389
390private:
395 void treatOption(TString soption);
396
397public:
398
399
400 // Private attribute accessor methods
401 //
402
403private:
404
405 ClassDef(URANIE::Launcher::TCodeFMU, ID_LAUNCHER)
406
407
408};
409
410} // End of namespace Launcher
411} // End of namespace URANIE
412
413#endif // TCODEFMU_H
414// End of File
415
Interface of the class URANIE::Launcher::TCode.
Interface file for the class URANIE::Launcher::TInputFileFMU.
Interface of the class URANIE::Launcher::TOutputFileFMU.
A virtual class for the FMI/FMU encapsulation.
Definition TCodeFMU.h:74
TString getFMUFile()
Get the value of the _sFMUFile attribute.
Definition TCodeFMU.h:175
TCodeFMU(URANIE::Launcher::TCode &mycode)
Copy constructor.
Double_t getToleranceSimulation()
Definition TCodeFMU.h:208
void changeLog()
Swith the status of the log.
Definition TCodeFMU.h:282
fmi_version_enu_t _sVersion
The FMU version.
Definition TCodeFMU.h:352
Double_t getStepSimulation()
Definition TCodeFMU.h:198
fmi_import_context_t * _context_FMI
The FMU context.
Definition TCodeFMU.h:353
Double_t _dFMUStart
The start time for default experiment as specified in the XML file.
Definition TCodeFMU.h:360
TCodeFMU()
Default constructor.
void setFMUFile(TString new_var, Option_t *option="")
Set the value of _sFMUFile.
ELogLevel_t
The list of log level.
Definition TCodeFMU.h:78
@ log_level_verbose
Informative messages.
Definition TCodeFMU.h:84
@ log_level_fatal
Must be first in this enum. May be usefull in application relying solely on jm_get_last_error()
Definition TCodeFMU.h:80
@ log_level_nothing
Definition TCodeFMU.h:79
@ log_level_error
Unrecoverable errors.
Definition TCodeFMU.h:81
@ log_level_warning
Errors that may be not critical for some FMUs.
Definition TCodeFMU.h:82
@ log_level_info
Non-critical issues.
Definition TCodeFMU.h:83
@ log_level_all
Debug messages. Only enabled if library is configured with FMILIB_ENABLE_LOG_LEVEL_DEBUG.
Definition TCodeFMU.h:86
@ log_level_debug
Verbose messages.
Definition TCodeFMU.h:85
Bool_t _bStep
boolean to known if _dstep is defined by user
Definition TCodeFMU.h:347
virtual void printLog(Option_t *option="")
Print the log of the object/class.
fmi1_import_t * _fmi1Import
The FMU 1.0 Object.
Definition TCodeFMU.h:354
TString _sGenerationTool
The FMU generation tool.
Definition TCodeFMU.h:358
Bool_t _bStop
boolean to known if _dstop is defined by user
Definition TCodeFMU.h:346
Double_t getStoptSimulation()
Definition TCodeFMU.h:189
void setToleranceSimulation(Double_t dval)
Definition TCodeFMU.h:211
void unsetLog()
Force to desable the log.
Definition TCodeFMU.h:276
TString _sFMUFile
The FMU filename.
Definition TCodeFMU.h:338
Double_t _dStop
The stop time for the simulation.
Definition TCodeFMU.h:342
virtual void run(Option_t *option="")
Run the code.
Double_t _dFMUStep
The step time for default experiment as specified in the XML file.
Definition TCodeFMU.h:362
void setStartSimulation(Double_t dval)
Definition TCodeFMU.h:184
ELogLevel_t getLogLevel()
Get the Log Level in the FMI Library.
Definition TCodeFMU.h:307
Double_t _dTolerance
The tolerance for the simulation.
Definition TCodeFMU.h:344
Bool_t getLog()
Get the status of the log.
Definition TCodeFMU.h:289
virtual void terminate(Option_t *option="")
Terminate phase of the code.
Double_t _dStart
The start time for the simulation.
Definition TCodeFMU.h:341
void setStepSimulation(Double_t dval)
Definition TCodeFMU.h:202
ELogLevel_t _logLevel
The log Level for FMI Library.
Definition TCodeFMU.h:340
TString _sGenerationDateTime
The FMU generation date and time.
Definition TCodeFMU.h:359
void setLog()
Force the log.
Definition TCodeFMU.h:270
void setStopSimulation(Double_t dval)
Definition TCodeFMU.h:193
Double_t _dStep
The step time for the simulation.
Definition TCodeFMU.h:343
Bool_t _bStart
boolean to known if _dstart is defined by user
Definition TCodeFMU.h:345
void do_exit(int code)
do_exit
Definition TCodeFMU.h:251
void initIFirst(Option_t *option="")
fmi2_import_t * _fmi2Import
The FMU 2.0 Object.
Definition TCodeFMU.h:355
void setLogLevel(ELogLevel_t theLogLevel=log_level_info)
Set the Log Level for the FMI Library.
Definition TCodeFMU.h:299
TCodeFMU(const TString &name, const TString &title)
constructor with a name and a title
virtual void init(Option_t *option="")
Init phase of the code.
Bool_t _bTolerance
boolean to known if _dTolerance is defined by user
Definition TCodeFMU.h:348
TString _sFMUWorkingDirectory
the FMU import directory
Definition TCodeFMU.h:339
void setStartStopSimulation(Double_t dstart, Double_t dstop)
Definition TCodeFMU.h:216
Double_t _dFMUTolerance
The tolerance for default experiment as specified in the XML file.
Definition TCodeFMU.h:363
Double_t _dFMUStop
The stop time for default experiment as specified in the XML file.
Definition TCodeFMU.h:361
void treatOption(TString soption)
treat the soption for the class
Bool_t _binitIFirst
boolean to known if passed into the initIFirst step
Definition TCodeFMU.h:349
Double_t getStartSimulation()
Definition TCodeFMU.h:180
TCodeFMU(URANIE::DataServer::TDataServer *tds, TString sFMUfile, Option_t *option="")
Constructor from TDataServer and Command as string.
Description of the class TCode.
Definition TCode.h:46
Bool_t _blog
Boolean for edit the log.
Definition TCode.h:435
Definition TCluster.h:67