MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
motor.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/elec/motor.h,v 1.29 2017/01/12 14:46:22 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 #ifndef MOTOR_H
33 #define MOTOR_H
34 
35 /*
36  * Electric motor: an internal couple between two structural nodes
37  * whose value is represented by an internal state that is a current,
38  * according to equations:
39 
40  M = M0(Phi_e) - (Gain + M1(Phi_e)) * i
41 
42  C1 = -M
43 
44  C2 = M
45 
46  i1 = - i
47 
48  i2 = i
49 
50  d i
51  L * --- + R * i = - Gain * (Omega2 - Omega1) + V2 - V1
52  d t
53 
54  * In order to take into account the so called cogging torque or ripple torque
55  * of DC motors, the following data can be provided:
56  * M0(Phi_e) ... variation of the motor torque independent of current
57  * M1(Phi_e) ... variation of the motor torque proportional to current
58  * p ... number of terminal pairs
59  *
60  * Phi_m ... mechanical angle of rotation between rotor and stator
61  * Phi_e = p * Phi_m ... electric angle between rotor field and stator field
62  */
63 
64 class Motor : virtual public Elem, public Electric {
65 private:
70 
77 
78  inline doublereal dGetOmega() const;
79  inline doublereal dGetVoltage() const;
80  inline doublereal dGetOmega(const Vec3& n) const;
81  inline Vec3 GetAxisOfRotation() const;
82  inline doublereal dGetPhiMechanical() const;
84 
86 
87  static const int iNumPrivData = 12;
88 
89  static const struct PrivData {
90  int index;
91  char name[8];
93 
94 public:
95  Motor(unsigned int uL, const DofOwner* pD,
96  const StructNode* pN1, const StructNode* pN2,
97  const ElectricNode* pV1, const ElectricNode* pV2,
98  const Mat3x3& Rn, doublereal dG,
100  integer p, const DriveCaller* pM0, const DriveCaller* pM1,
101  flag fOut);
102  virtual ~Motor(void);
103 
104  virtual Electric::Type GetElectricType(void) const;
105 
106  virtual unsigned int iGetNumPrivData(void) const;
107  virtual unsigned int iGetPrivDataIdx(const char *s) const;
108  virtual doublereal dGetPrivData(unsigned int i) const;
109 
110  /* Contributo al file di restart */
111  virtual std::ostream& Restart(std::ostream& out) const;
112 
113  virtual unsigned int iGetNumDof(void) const;
114  virtual DofOrder::Order GetDofType(unsigned int i) const;
115 
116  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
117 
119  doublereal dCoef,
120  const VectorHandler& XCurr,
121  const VectorHandler& XPrimeCurr);
123  doublereal dCoef,
124  const VectorHandler& XCurr,
125  const VectorHandler& XPrimeCurr);
126 
127  virtual void SetInitialValue(VectorHandler& X);
128 
129  virtual void SetValue(DataManager *pDM,
131  SimulationEntity::Hints* h = 0);
132 
133  virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const;
134 };
135 
136 #endif /* MOTOR_H */
137 
Vec3 GetAxisOfRotation() const
Definition: motor.cc:322
const StructNode * pStrNode1
Definition: motor.h:66
virtual void SetInitialValue(VectorHandler &X)
Definition: motor.cc:351
const ElectricNode * pVoltage1
Definition: motor.h:68
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: motor.cc:372
virtual Electric::Type GetElectricType(void) const
Definition: motor.cc:112
DriveOwner M1
Definition: motor.h:76
long int flag
Definition: mbdyn.h:43
doublereal M
Definition: motor.h:85
Definition: matvec3.h:98
doublereal i
Definition: motor.h:85
virtual doublereal dGetPrivData(unsigned int i) const
Definition: motor.cc:397
virtual unsigned int iGetNumPrivData(void) const
Definition: motor.cc:381
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: motor.cc:166
std::vector< Hint * > Hints
Definition: simentity.h:89
doublereal iP
Definition: motor.h:85
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: motor.cc:386
virtual ~Motor(void)
Definition: motor.cc:107
virtual unsigned int iGetNumDof(void) const
Definition: motor.cc:147
virtual std::ostream & Restart(std::ostream &out) const
Definition: motor.cc:119
DriveOwner M0
Definition: motor.h:76
DriveOwner dR
Definition: motor.h:74
doublereal dGetPhiElectric(doublereal Phi_m) const
Definition: motor.cc:338
doublereal dGetVoltage() const
Definition: motor.cc:314
integer p
Definition: motor.h:75
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: motor.cc:267
const ElectricNode * pVoltage2
Definition: motor.h:69
virtual DofOrder::Order GetDofType(unsigned int i) const
Definition: motor.cc:153
Definition: elec.h:43
static const int iNumPrivData
Definition: motor.h:87
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: motor.cc:159
Type
Definition: elec.h:46
Definition: motor.h:64
static const struct Motor::PrivData rgPrivData[iNumPrivData]
Definition: motor.cc:69
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
Definition: motor.cc:359
doublereal Phi_m
Definition: motor.h:85
Mat3x3 Rn
Definition: motor.h:71
doublereal Phi_e
Definition: motor.h:85
doublereal dGetOmega() const
Definition: motor.cc:326
char name[8]
Definition: motor.h:91
Definition: elem.h:75
Motor(unsigned int uL, const DofOwner *pD, const StructNode *pN1, const StructNode *pN2, const ElectricNode *pV1, const ElectricNode *pV2, const Mat3x3 &Rn, doublereal dG, doublereal dl, DriveCaller *dR, doublereal i0, integer p, const DriveCaller *pM0, const DriveCaller *pM1, flag fOut)
Definition: motor.cc:84
doublereal dL
Definition: motor.h:73
doublereal dGetPhiMechanical() const
Definition: motor.cc:330
const StructNode * pStrNode2
Definition: motor.h:67
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
doublereal dGain
Definition: motor.h:72