FEDEM Model Database  R8.0
Source code of the FEDEM model database
FmTurbine.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FM_TURBINE_H
9 #define FM_TURBINE_H
10 
11 #include "vpmDB/FmAssemblyBase.H"
12 #include "vpmDB/FmBeamProperty.H"
14 
15 class FmBladeProperty;
16 class FmBladeDesign;
17 class FmTower;
18 class FmNacelle;
19 class FmGenerator;
20 class FmGearBox;
21 class FmShaft;
22 class FmRotor;
23 class FmLink;
24 class FmJointBase;
25 
26 
27 class FmTurbine : public FmAssemblyBase
28 {
30 
31 public:
32  FmTurbine(char createSubAssemblies = '\0', bool isDummy = false);
33 
34  void getParts(FmTower*& tower, FmNacelle*& nacelle,
35  FmGenerator*& generator, FmGearBox*& gearbox,
36  FmShaft*& lsShaft, FmShaft*& hsShaft, FmRotor*& rotor) const;
37  FmTower* getTower() const;
38  FmBladeDesign* getBladeProperties(std::vector<FmBladeProperty*>& bprop) const;
39  double getRadius(const FaVec3& X) const;
40  double getHubRadius() const;
41  double getHubHeight() const;
42  double getRotorSize() const;
43 
44  void draw() const;
45 
46  virtual const char* getUITypeName() const { return "Turbine"; }
47  virtual const char** getListViewPixmap() const;
48  virtual bool isCopyable() const { return false; }
49 
50  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
51  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
52 
53  virtual int printSolverEntry(FILE* fp);
54 
55  int writeAeroDynFile(const std::string& fileName) const;
56 
57  static bool writeBladeElement(FILE* fp, FmLink* beam, int& propId);
58 
59 protected:
60  virtual bool eraseOptions();
61 
62 public:
67 
70 
71  // Some additional data required by the Dynamics Solver
74 
76 };
77 
78 
79 // The other class definitions below are kept in this same file
80 // since they are closely related to the FmTurbine class.
81 
83 {
84  double H;
85  double D;
86  int N;
87  FmTwrSegment(double h = 10.0, double d = 5.0, int n = 5) : H(h), D(d), N(n) {}
88  bool operator==(const FmTwrSegment& s) const
89  { return H == s.H && D == s.D && N == s.N; }
90 };
91 
92 using FmTwrSegmentVec = std::vector<FmTwrSegment>;
93 
94 
96 
97 template<>
99 {
100  return !myData.empty();
101 }
102 
103 template<>
104 inline void FFaField<FmTwrSegmentVec>::write(std::ostream& os) const
105 {
106  for (size_t i = 0; i < myData.size(); i++)
107  {
108  // write up to 9 numbers on a row
109  if (i) os << (i%3 ? " " : "\n\t");
110  os << myData[i].H <<" "<< myData[i].D <<" "<< myData[i].N;
111  }
112 }
113 
114 template<>
115 inline void FFaField<FmTwrSegmentVec>::read(std::istream& is, FmTwrSegmentVec& v) const
116 {
117  v.clear();
118  double h, d, n;
119  while (is)
120  {
121  is >> h >> d >> n;
122  if (is)
123  v.push_back(FmTwrSegment(h,d,n));
124  }
125  is.clear();
126 }
128 
129 
131 {
132 protected:
133  FmTurbinePart(bool isDummy) : FmAssemblyBase(isDummy) {}
134 
135  void initFields(double mass);
136 
137 public:
143 };
144 
145 
146 class FmTower : public FmTurbinePart
147 {
149 
150 public:
151  FmTower(bool isDummy = false);
152 
153  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
154  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
155 
156  virtual const char* getUITypeName() const { return "Tower"; }
157  virtual const char** getListViewPixmap() const;
158  virtual bool isCopyable() const { return false; }
159 
160 public:
163 
167 
169 };
170 
171 
172 class FmNacelle : public FmTurbinePart
173 {
175 
176 public:
177  FmNacelle(bool isDummy = false);
178 
179  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
180  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
181 
182  virtual const char* getUITypeName() const { return "Nacelle"; }
183  virtual const char** getListViewPixmap() const;
184  virtual bool isCopyable() const { return false; }
185 
186 public:
192 };
193 
194 
196 {
198 
199 public:
200  FmGenerator(bool isDummy = false);
201 
202  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
203  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
204 
205  virtual const char* getUITypeName() const { return "Generator"; }
206  virtual const char** getListViewPixmap() const;
207  virtual bool isCopyable() const { return false; }
208 
209 public:
211 };
212 
213 
214 class FmGearBox : public FmTurbinePart
215 {
217 
218 public:
219  FmGearBox(bool isDummy = false);
220 
221  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
222  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
223 
224  virtual const char* getUITypeName() const { return "Gearbox"; }
225  virtual const char** getListViewPixmap() const;
226  virtual bool isCopyable() const { return false; }
227 
228 public:
233 };
234 
235 
236 class FmShaft : public FmAssemblyBase
237 {
239 
240 public:
241  FmShaft(bool isDummy = false, double OD = 0.4, double ID = 0.3, double L = 7.0);
242 
243  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
244  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
245 
246  virtual const char* getUITypeName() const { return "Shaft"; }
247  virtual const char** getListViewPixmap() const;
248  virtual bool isCopyable() const { return false; }
249 
250 public:
253 
255 
256  // Only used temporary :
257 
263 };
264 
265 
266 class FmRotor : public FmTurbinePart
267 {
269 
270 public:
271  FmRotor(bool isDummy = false);
272 
273  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
274  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
275 
276  virtual const char* getUITypeName() const { return "Rotor"; }
277  virtual const char** getListViewPixmap() const;
278  virtual bool isCopyable() const { return false; }
279 
280 public:
284 };
285 
286 
287 class FmBlade : public FmAssemblyBase
288 {
290 
291 public:
292  FmBlade(bool isDummy = false);
293 
294  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
295  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
296 
297  virtual const char* getUITypeName() const { return "Blade"; }
298  virtual const char** getListViewPixmap() const;
299  virtual bool isCopyable() const { return false; }
300 
301  FmJointBase* getPitchJoint() const;
302 
303 public:
306 
308 };
309 
310 #endif
const double const double const double const double double * X
Definition: ChainShape.H:20
const double const double * L
Definition: ChainShape.H:17
Classes representing lists of guarded pointers.
std::vector< FmTwrSegment > FmTwrSegmentVec
Definition: FmTurbine.H:92
ValueT myData
Current field value.
Definition: FFaField.H:130
bool isPrintable() const override
Returns true, if this field should be printed.
Definition: FFaField.H:94
void read(std::istream &is) override
Reads the field value from an input stream.
Definition: FFaField.H:117
void write(std::ostream &os) const override
Writes the field name and value to an output stream.
Definition: FFaField.H:116
Class for point vectors in 3D space.
Definition: FFaVec3.H:40
Definition: FmAssemblyBase.H:17
Definition: FmBladeProperty.H:73
Definition: FmBladeProperty.H:19
Definition: FmTurbine.H:288
FFaField< int > visualize3Dts
Visualize the blade in the 3D view (tristate: off,na,on)
Definition: FmTurbine.H:307
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:297
FmJointBase * getPitchJoint() const
Definition: FmTurbine.C:1104
FFaField< double > IceThickness
Ice thickness.
Definition: FmTurbine.H:305
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:1066
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:1081
FFaField< bool > IceLayer
Ice layer?
Definition: FmTurbine.H:304
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:1060
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:299
FmBlade(bool isDummy=false)
Definition: FmTurbine.C:1049
Fmd_HEADER_INIT()
Definition: FmTurbine.H:215
FFaField< double > O1
Horizontal offset.
Definition: FmTurbine.H:231
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:885
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:224
FFaField< double > Ratio
Gear transmission ratio.
Definition: FmTurbine.H:229
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:879
FFaField< double > O2
Vertical offset.
Definition: FmTurbine.H:232
FFaField< double > Length
Length of gear box (N5)
Definition: FmTurbine.H:230
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:226
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:900
FmGearBox(bool isDummy=false)
Definition: FmTurbine.C:866
Definition: FmTurbine.H:196
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:205
FmGenerator(bool isDummy=false)
Definition: FmTurbine.C:809
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:825
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:840
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:207
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:819
FFaField< double > Length
Length of generator (N7)
Definition: FmTurbine.H:210
Definition: FmJointBase.H:22
Definition: FmTurbine.H:173
FFaField< double > M2
Yaw-axis shaft intersection.
Definition: FmTurbine.H:190
FFaField< double > M3
Shaft length from yaw axis (N3)
Definition: FmTurbine.H:191
FFaField< double > B1
Main bearing location.
Definition: FmTurbine.H:187
FFaField< double > C1
Brake location.
Definition: FmTurbine.H:189
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:184
FFaField< double > B2
Second bearing location.
Definition: FmTurbine.H:188
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:762
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:182
FmNacelle(bool isDummy=false)
Definition: FmTurbine.C:747
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:768
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:783
Definition: FmTurbine.H:267
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:1008
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:278
FFaField< double > HubApex
Hub apex offset (N2)
Definition: FmTurbine.H:283
FFaField< double > HubDiam
Hub diameter (D1=2*Hr)
Definition: FmTurbine.H:282
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:1002
Fmd_HEADER_INIT()
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:276
FFaField< double > PreCone
Precone angle in degrees (beta)
Definition: FmTurbine.H:281
FmRotor(bool isDummy=false)
Definition: FmTurbine.C:990
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:1023
Definition: FmTurbine.H:237
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:949
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:964
Fmd_HEADER_INIT()
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:248
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:246
FFaField< double > Length
Shaft length (N4&N6)
Definition: FmTurbine.H:252
FFaNoPrintField< double > Rho
Mass density.
Definition: FmTurbine.H:260
FFaNoPrintField< double > Di
Inner diameter.
Definition: FmTurbine.H:259
FFaNoPrintField< double > Do
Outer diameter.
Definition: FmTurbine.H:258
FFaNoPrintField< double > E
Young's modulus.
Definition: FmTurbine.H:261
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:943
FFaField< int > visualize3Dts
Visualize the shaft in the 3D view (tristate: off,na,on)
Definition: FmTurbine.H:254
FFaField< double > Tilt
Tilt angle in degrees (alpha)
Definition: FmTurbine.H:251
FmShaft(bool isDummy=false, double OD=0.4, double ID=0.3, double L=7.0)
Definition: FmTurbine.C:926
FFaNoPrintField< double > G
Shear modulus.
Definition: FmTurbine.H:262
Definition: FmTurbine.H:147
FFaField< double > Thick
Wall thickness.
Definition: FmTurbine.H:166
FFaField< int > visualize3Dts
Visualize the tower in the 3D view (tristate: off,na,on)
Definition: FmTurbine.H:168
FFaField< FFaReferenceBase * > materialField
Definition: FmTurbine.H:162
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:721
Fmd_HEADER_INIT()
FmTower(bool isDummy=false)
Definition: FmTurbine.C:684
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:700
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:156
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:706
FFaReference< FmMaterialProperty > material
Definition: FmTurbine.H:161
FFaField< FmTwrSegmentVec > segments
Discretization data.
Definition: FmTurbine.H:164
FFaField< double > Height
Tower height.
Definition: FmTurbine.H:165
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:158
Definition: FmTurbine.H:131
FFaField< double > Mass
Total mass of the component.
Definition: FmTurbine.H:139
FFaField< FaVec3 > Iaxes
Inertia axes of the component.
Definition: FmTurbine.H:142
FFaField< FaVec3 > Inertia
Mass inertias of the component.
Definition: FmTurbine.H:141
FmTurbinePart(bool isDummy)
Definition: FmTurbine.H:133
void initFields(double mass)
Definition: FmTurbine.C:668
FFaField< Doubles > Stiff
Stiffness parameters of the component.
Definition: FmTurbine.H:138
FFaField< FaVec3 > CoG
Centre of gravity of the component.
Definition: FmTurbine.H:140
Definition: FmTurbine.H:28
FmBladeDesign * getBladeProperties(std::vector< FmBladeProperty * > &bprop) const
Definition: FmTurbine.C:157
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmTurbine.H:46
FFaField< bool > ctrlSys
Include regulation system?
Definition: FmTurbine.H:66
FFaField< FFaReferenceListBase * > topologyField
Definition: FmTurbine.H:73
void getParts(FmTower *&tower, FmNacelle *&nacelle, FmGenerator *&generator, FmGearBox *&gearbox, FmShaft *&lsShaft, FmShaft *&hsShaft, FmRotor *&rotor) const
Definition: FmTurbine.C:100
virtual int printSolverEntry(FILE *fp)
Hoook for printing the solver input file entry for this object.
Definition: FmTurbine.C:280
double getHubRadius() const
Definition: FmTurbine.C:178
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmTurbine.C:257
FFaField< FFaReferenceBase * > bladeDefField
Definition: FmTurbine.H:69
double getRotorSize() const
Definition: FmTurbine.C:209
FFaField< int > nBlade
Number of blades.
Definition: FmTurbine.H:65
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmTurbine.C:242
virtual bool eraseOptions()
Hook for class-specific tasks before deleting *this in erase().
Definition: FmTurbine.C:87
FFaReference< FmSubAssembly > bladeDef
Blade segment layout.
Definition: FmTurbine.H:68
FFaReferenceList< FmModelMemberBase > topology
Definition: FmTurbine.H:72
FFaField< double > ptfmRef
Platform reference height.
Definition: FmTurbine.H:64
double getHubHeight() const
Definition: FmTurbine.C:191
FFaField< std::string > towerFile
Definition: FmTurbine.H:75
FmTower * getTower() const
Definition: FmTurbine.C:144
virtual bool isCopyable() const
Returns true if this sub-assembly object can be copied.
Definition: FmTurbine.H:48
int writeAeroDynFile(const std::string &fileName) const
Definition: FmTurbine.C:474
FFaField< double > rhoIce
Mass density for ice.
Definition: FmTurbine.H:63
static bool writeBladeElement(FILE *fp, FmLink *beam, int &propId)
Definition: FmTurbine.C:374
void draw() const
Definition: FmTurbine.C:230
FmTurbine(char createSubAssemblies='\0', bool isDummy=false)
Definition: FmTurbine.C:28
double getRadius(const FaVec3 &X) const
Definition: FmTurbine.C:169
virtual const char ** getListViewPixmap() const
Returns the pixmap of this item.
Definition: FmTurbine.C:236
Definition: FmTurbine.H:83
double H
Height of segment.
Definition: FmTurbine.H:84
double D
Diameter at segment top.
Definition: FmTurbine.H:85
int N
Number of elements.
Definition: FmTurbine.H:86
FmTwrSegment(double h=10.0, double d=5.0, int n=5)
Definition: FmTurbine.H:87
bool operator==(const FmTwrSegment &s) const
Definition: FmTurbine.H:88