English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Launcher: TInputFileFMU.h Source File
Uranie / Launcher  v4.10.0
/* @license-end */
TInputFileFMU.h
Go to the documentation of this file.
1 // 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 
33 #ifndef TInputFileFMU_H
34 #define TInputFileFMU_H
35 
36 // ROOT
37 #include "Rtypes.h"
38 #include "TString.h"
39 
40 // URANIE
41 #include "TAttribute.h"
42 #include "TInputFile.h"
43 
44 // FMI
45 #ifdef WIN32
46 #include <Windows4Root.h>
47 #endif
48 #include "fmilib.h"
49 
50 namespace URANIE {
51 namespace Launcher {
52 
54 {
55 public:
56  //---------------------------------------------
60  TInputFileFMU(TString str);
63  virtual ~TInputFileFMU();
65 
66  // Public attribute accessor methods
67  //
68  //---------------------------------------------
76  void setWorkingDirectory(TString sPathName = "");
77 
82  TString getWorkingDirectory() {
83  return _sFMUWorkingDirectory;
84  };
85 
86  Double_t getStartTime() {
87  return _dFMUStart;
88  }
89  void setStartTime(Double_t dval) {
90  _dFMUStart = dval;
91  }
92 
93  Double_t getStopTime() {
94  return _dFMUStop;
95  }
96  void setStopTime(Double_t dval) {
97  _dFMUStop = dval;
98  }
99 
100  Double_t getStepTime() {
101  return _dFMUStep;
102  }
103  void setStepTime(Double_t dval) {
104  _dFMUStep = dval;
105  }
106 
107  Double_t getTolerance() {
108  return _dFMUTolerance;
109  }
110  void setTolerance(Double_t dval) {
111  _dFMUTolerance = dval;
112  }
113 
114 
115 
117 
118 
119  //---------------------------------------------
123 
127  virtual void init();
128 
130 
133  virtual void terminate();
135 
136 
137  //---------------------------------------------
145  Bool_t isFileToCopy()
146  {
147  return kFALSE;
148  }
150 
153  TString getAttributeInKey(TString skey);
154 
158  virtual void addAttribute(URANIE::DataServer::TAttribute*);
159 
160 
162 
163  //---------------------------------------------
167 
171  virtual void searchIndexeAttribute(URANIE::DataServer::TAttribute* att);
172 
173  void substitue(forkcode *fjob, Int_t &n, Double_t *val, Int_t *index = NULL);
174 
176 
183  void substitue(forkcode *fjob, Int_t &n, vector<URANIE::DataServer::UEntry*> *ent, Int_t *index = NULL);
185 
186  // Public FMI functions
187  //
188  //---------------------------------------------
192  void setContext(fmi_import_context_t* fmi_ctxt)
193  {
194  _context_FMI = fmi_ctxt;
195  }
196 
197  fmi_import_context_t* getContext()
198  {
199  return _context_FMI;
200  }
201 
202  jm_callbacks* getCallbackFMI()
203  {
204  return _callbacks_FMI;
205  }
206 
207  fmi1_import_t* getFMU1Import()
208  {
209  return _fmi1Import;
210  }
211 
212  fmi2_import_t* getFMU2Import()
213  {
214  return _fmi2Import;
215  }
216 
217 
218  void setVersion(fmi_version_enu_t fmi_version)
219  {
220  _sVersion = fmi_version;
221  }
222 
223  fmi_version_enu_t getFMUVersion()
224  {
225  return _sVersion;
226  }
227  const char* getFMUVersionString();
228 
229  void runFMI(Option_t *option="");
230 
236  Int_t simulate_fmi1_cs(Option_t *option="");
237 
243  Int_t simulate_fmi2_cs(Option_t *option="");
244 
245  void initFMI(Option_t *option="");
246 
247  void do_exit(int code)
248  {
249  printf("Press 'Enter' to exit\n");
250  /* getchar(); */
251  exit(code);
252  }
253 
254 
259  void init_fmi2_0(Option_t *option = "");
260 
265  void init_fmi1(Option_t *option = "");
266 
267  vector<vector<double>> getVectorValues()
268  {
269  return _vecOutputs;
270  }
271 
272  void setListOutputVector(TArrayI *arr);
274 
275  //---------------------------------------------
279  virtual void printLog(Option_t *option = "");
281 
282  //---------------------------------------------
287 protected:
289  // FMI structures
290  jm_callbacks *_callbacks_FMI;
291  fmi_import_context_t* _context_FMI;
292  fmi_version_enu_t _sVersion;
293  fmi1_import_t* _fmi1Import;
294  fmi2_import_t* _fmi2Import;
295 
296  // FMI General informations
299 
300  TString _sPlatformName;
301  TString _sModelName;
302  TString _sModelVersion;
303  TString _sGUID;
304 
305 
306  Double_t _dFMUStart;
307  Double_t _dFMUStop;
308  Double_t _dFMUTolerance;
309  Double_t _dFMUStep;
310  vector<vector<double>> _vecOutputs;
311  vector<int> _vecVROutputs;
312  UInt_t _no;
313 
315 
316 
317 
318  ClassDef(URANIE::Launcher::TInputFileFMU, ID_LAUNCHER)
319 };
320 
321 } // End of namespace Launcher
322 } // End of namespace URANIE
323 
324 #endif // TInputFileFMU_H
325 // End of File
Definition: TCluster.h:66
TString _sGenerationDateTime
The FMU generation date and time.
Definition: TInputFileFMU.h:298
Double_t _dFMUTolerance
The tolerance for default experiment as specified in the XML file (not used)
Definition: TInputFileFMU.h:308
virtual void terminate()
The terminate step.
Description of the class TInputFileFMU.
Definition: TInputFileFMU.h:53
void setStartTime(Double_t dval)
Definition: TInputFileFMU.h:89
Double_t _dFMUStart
The start time for default experiment as specified in the XML file.
Definition: TInputFileFMU.h:306
virtual void printLog(Option_t *option="")
void init_fmi2_0(Option_t *option="")
init_fmi_v2_0
fmi_import_context_t * _context_FMI
The FMU context.
Definition: TInputFileFMU.h:291
fmi_version_enu_t getFMUVersion()
Definition: TInputFileFMU.h:223
void init_fmi1(Option_t *option="")
init_fmi1
Double_t _dFMUStop
The stop time for default experiment as specified in the XML file.
Definition: TInputFileFMU.h:307
Int_t simulate_fmi2_cs(Option_t *option="")
test_simulate_fmi2_cs
virtual ~TInputFileFMU()
Default destructor.
void setVersion(fmi_version_enu_t fmi_version)
Definition: TInputFileFMU.h:218
Interface of the class URANIE::Launcher::TInputFile.
TString getAttributeInKey(TString skey)
Return the name of the attribute for the key.
Abstract class for an input file of a code.
Definition: TInputFile.h:55
TString getWorkingDirectory()
Get the working directory.
Definition: TInputFileFMU.h:82
virtual void addAttribute(URANIE::DataServer::TAttribute *)
addAttribute
void setWorkingDirectory(TString sPathName="")
Set the working directory.
Double_t getStopTime()
Definition: TInputFileFMU.h:93
jm_callbacks * getCallbackFMI()
Definition: TInputFileFMU.h:202
void runFMI(Option_t *option="")
TString _sGUID
The.
Definition: TInputFileFMU.h:303
void substitue(forkcode *fjob, Int_t &n, Double_t *val, Int_t *index=NULL)
Substitute the values of the attributes linked in the input file and write it.
fmi_import_context_t * getContext()
Definition: TInputFileFMU.h:197
fmi1_import_t * getFMU1Import()
Definition: TInputFileFMU.h:207
struct unforkjob forkcode
Definition: TInputFile.h:53
jm_callbacks * _callbacks_FMI
Definition: TInputFileFMU.h:290
fmi1_import_t * _fmi1Import
The FMU 1.0 Object.
Definition: TInputFileFMU.h:293
vector< vector< double > > getVectorValues()
Definition: TInputFileFMU.h:267
Double_t getStepTime()
Definition: TInputFileFMU.h:100
void setListOutputVector(TArrayI *arr)
void setTolerance(Double_t dval)
Definition: TInputFileFMU.h:110
fmi2_import_t * _fmi2Import
The FMU 2.0 Object.
Definition: TInputFileFMU.h:294
vector< vector< double > > _vecOutputs
the vector of stored kVector attributes
Definition: TInputFileFMU.h:310
Double_t _dFMUStep
The step for default experiment as specified in the XML file.
Definition: TInputFileFMU.h:309
void initFMI(Option_t *option="")
void do_exit(int code)
Definition: TInputFileFMU.h:247
TString _sModelVersion
The.
Definition: TInputFileFMU.h:302
virtual void init()
The init step.
void setContext(fmi_import_context_t *fmi_ctxt)
Definition: TInputFileFMU.h:192
vector< int > _vecVROutputs
The vector of VR of the kVector Output attributes.
Definition: TInputFileFMU.h:311
TString _sPlatformName
The.
Definition: TInputFileFMU.h:300
void setStopTime(Double_t dval)
Definition: TInputFileFMU.h:96
TInputFileFMU(TString str)
Default constructor.
Bool_t isFileToCopy()
Gets the type of the file. This method is used to find InputFile of type &#39;Recreate&#39;.
Definition: TInputFileFMU.h:145
UInt_t _no
The number of kVector Output attributes.
Definition: TInputFileFMU.h:312
TString _sFMUWorkingDirectory
the FMU import directory
Definition: TInputFileFMU.h:288
TString _sGenerationTool
The FMU generation tool.
Definition: TInputFileFMU.h:297
Double_t getTolerance()
Definition: TInputFileFMU.h:107
void setStepTime(Double_t dval)
Definition: TInputFileFMU.h:103
fmi2_import_t * getFMU2Import()
Definition: TInputFileFMU.h:212
Int_t simulate_fmi1_cs(Option_t *option="")
simulate_fmi1_cs
TString _sModelName
The.
Definition: TInputFileFMU.h:301
Double_t getStartTime()
Definition: TInputFileFMU.h:86
fmi_version_enu_t _sVersion
The FMU version.
Definition: TInputFileFMU.h:292
virtual void searchIndexeAttribute(URANIE::DataServer::TAttribute *att)
search the indexes of the attribute in the input file