MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
module-FMU.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/modules/module-FMU/module-FMU.h,v 1.3 2017/01/12 15:20:16 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /*
33  AUTHOR: Devyesh Tandon <devyeshtandon+mbdyn@gmail.com>
34  Copyright (C) 2016(-2017) all rights reserved.
35  The copyright of this patch is transferred
36  to Pierangelo Masarati and Paolo Mantegazza
37  for use in the software MBDyn as described
38  in the GNU Public License version 2.1
39 
40 */
41 
42 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
43 
44 #include <iostream>
45 #include <cfloat>
46 
47 #include "dataman.h"
48 #include "userelem.h"
49 #include "drive.h"
50 #include "privdrive.h"
51 
52 #include "mbdynFMI_config.h"
53 
54 
55 
56 class ModuleFMU
57 : virtual public Elem, public UserDefinedElem {
58 private:
60  char FMUlocation[1000];
61  const char* simType;
62  double currTime;
63  double initialTime;
64  double timeStep;
65  double endTime;
66 
67  fmi_import_context_t* context;
68  fmi_version_enu_t version;
69 
70  jm_callbacks callbacks;
71  jm_status_enu_t status;
72 
73  typedef std::map<std::string, const DriveCaller *> strDriveCon;
74  typedef std::map<int, const PrivDriveCaller*> intDriveCon;
77 
81 
83  double* currState;
88 
90  double *seedVector;
91 
92 public:
93  ModuleFMU(unsigned uLabel, const DofOwner *pDO,
95  virtual ~ModuleFMU(void);
96 
97  virtual void Output(OutputHandler& OH) const;
98  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
101  doublereal dCoef,
102  const VectorHandler& XCurr,
103  const VectorHandler& XPrimeCurr);
105  AssRes(SubVectorHandler& WorkVec,
106  doublereal dCoef,
107  const VectorHandler& XCurr,
108  const VectorHandler& XPrimeCurr);
109  unsigned int iGetNumPrivData(void) const;
110  unsigned int iGetPrivDataIdx(const char *s) const; //
111  doublereal dGetPrivData(unsigned int i) const; //
112  int iGetNumConnectedNodes(void) const;
113  void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const;
116  std::ostream& Restart(std::ostream& out) const;
117  virtual unsigned int iGetInitialNumDof(void) const;
118  virtual void
119  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
122  const VectorHandler& XCurr);
124  InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
125  unsigned int iGetNumDof(void) const;
126  DofOrder::Order GetDofType(unsigned int i) const;
127  DofOrder::Order GetEqType(unsigned int i) const;
128 
130 
131 };
132 
DofOrder::Order GetEqType(unsigned int i) const
Definition: module-FMU.cc:233
virtual unsigned int iGetInitialNumDof(void) const
Definition: module-FMU.cc:459
Definition: mbdynFMI.h:65
SimulationTypes
Definition: mbdynFMI.h:67
double endTime
Definition: module-FMU.h:65
std::map< std::string, const DriveCaller * > strDriveCon
Definition: module-FMU.h:73
double * seedVector
Definition: module-FMU.h:90
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: module-FMU.cc:324
DofOrder::Order GetDofType(unsigned int i) const
Definition: module-FMU.cc:452
fmu::SimulationTypes SIMTYPE
Definition: module-FMU.h:129
fmi_version_enu_t version
Definition: module-FMU.h:68
int numOfEventIndicators
Definition: module-FMU.h:79
int * statesOrder
Definition: module-FMU.h:82
virtual ~ModuleFMU(void)
Definition: module-FMU.cc:195
char FMUlocation[1000]
Definition: module-FMU.h:60
unsigned int iGetNumDof(void) const
Definition: module-FMU.cc:442
jm_callbacks callbacks
Definition: module-FMU.h:70
unsigned int iGetNumPrivData(void) const
Definition: module-FMU.cc:380
ModuleFMU(unsigned uLabel, const DofOwner *pDO, DataManager *pDM, MBDynParser &HP)
Definition: module-FMU.cc:47
std::vector< Hint * > Hints
Definition: simentity.h:89
double timeStep
Definition: module-FMU.h:64
double initialTime
Definition: module-FMU.h:63
bool * privDriveArray
Definition: module-FMU.h:86
strDriveCon drivesContainer
Definition: module-FMU.h:75
DataManager * pDM
Definition: module-FMU.h:80
jm_status_enu_t status
Definition: module-FMU.h:71
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: module-FMU.cc:254
void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: module-FMU.cc:413
doublereal dGetPrivData(unsigned int i) const
Definition: module-FMU.cc:401
double * currState
Definition: module-FMU.h:83
unsigned int iGetPrivDataIdx(const char *s) const
Definition: module-FMU.cc:386
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: module-FMU.cc:465
double currTime
Definition: module-FMU.h:62
int iGetNumConnectedNodes(void) const
Definition: module-FMU.cc:407
unsigned int uLabel
Definition: withlab.h:44
fmu * model
Definition: module-FMU.h:59
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: module-FMU.cc:488
fmi_import_context_t * context
Definition: module-FMU.h:67
int numOfContinousStates
Definition: module-FMU.h:78
Definition: elem.h:75
int privDriveLength
Definition: module-FMU.h:87
intDriveCon privDrivesIndex
Definition: module-FMU.h:76
virtual void Output(OutputHandler &OH) const
Definition: module-FMU.cc:218
std::ostream & Restart(std::ostream &out) const
Definition: module-FMU.cc:436
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: module-FMU.cc:241
const char * simType
Definition: module-FMU.h:61
void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph)
Definition: module-FMU.cc:419
VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: module-FMU.cc:475
double doublereal
Definition: colamd.c:52
std::map< int, const PrivDriveCaller * > intDriveCon
Definition: module-FMU.h:74
long int integer
Definition: colamd.c:51
int * jacobianInputVector
Definition: module-FMU.h:85
bool directionalFlag
Definition: module-FMU.h:89
double * stateDerivatives
Definition: module-FMU.h:84