FlightGear next
FGFCS.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGGFCS.h
4 Author: Jon S. Berndt
5 Date started: 12/12/98
6
7 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
25
26HISTORY
27--------------------------------------------------------------------------------
2812/12/98 JSB Created
29
30%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31SENTRY
32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34#ifndef FGFCS_H
35#define FGFCS_H
36
37/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38INCLUDES
39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41#include <iosfwd>
42#include <vector>
43#include <string>
44
45#include "models/FGModel.h"
46#include "models/FGLGear.h"
48
49/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50FORWARD DECLARATIONS
51%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53namespace JSBSim {
54
55class FGFCSChannel;
56typedef enum { ofRad=0, ofDeg, ofNorm, ofMag , NForms} OutputForm;
57
58/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59CLASS DOCUMENTATION
60%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61
182
183/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
184CLASS DECLARATION
185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
186
187class FGFCS : public FGModel
188{
189
190public:
195 ~FGFCS() override;
196
197 bool InitModel(void) override;
198
206 bool Run(bool Holding) override;
207
209
210
212 double GetDaCmd(void) const { return DaCmd; }
213
216 double GetDeCmd(void) const { return DeCmd; }
217
220 double GetDrCmd(void) const { return DrCmd; }
221
224 double GetDsCmd(void) const { return fdmex->GetGroundReactions()->GetDsCmd(); }
225
228 double GetDfCmd(void) const { return DfCmd; }
229
232 double GetDsbCmd(void) const { return DsbCmd; }
233
236 double GetDspCmd(void) const { return DspCmd; }
237
241 double GetThrottleCmd(int engine) const;
242
243 const std::vector<double>& GetThrottleCmd() const {return ThrottleCmd;}
244
248 double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
249
250 const std::vector<double>& GetMixtureCmd() const {return MixtureCmd;}
251
255 double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
256
260 bool GetFeatherCmd(int engine) const { return PropFeatherCmd[engine]; }
261
264 double GetPitchTrimCmd(void) const { return PTrimCmd; }
265
268 double GetYawTrimCmd(void) const { return YTrimCmd; }
269
272 double GetRollTrimCmd(void) const { return RTrimCmd; }
273
277 double GetGearCmd(void) const { return GearCmd; }
279
281
282
284 double GetDaLPos( int form = ofRad )
285 const { return DaLPos[form]; }
286
289 double GetDaRPos( int form = ofRad )
290 const { return DaRPos[form]; }
291
294 double GetDePos( int form = ofRad )
295 const { return DePos[form]; }
296
299 double GetDrPos( int form = ofRad )
300 const { return DrPos[form]; }
301
304 double GetDsbPos( int form = ofRad )
305 const { return DsbPos[form]; }
306
309 double GetDspPos( int form = ofRad )
310 const { return DspPos[form]; }
311
314 double GetDfPos( int form = ofRad )
315 const { return DfPos[form]; }
316
320 double GetThrottlePos(int engine) const;
321
322 const std::vector<double>& GetThrottlePos() const {return ThrottlePos;}
323
327 double GetMixturePos(int engine) const { return MixturePos[engine]; }
328
329 const std::vector<double>& GetMixturePos() const {return MixturePos;}
330
333 double GetGearPos(void) const { return GearPos; }
334
337 double GetTailhookPos(void) const { return TailhookPos; }
338
341 double GetWingFoldPos(void) const { return WingFoldPos; }
342
346 double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
347
348 const std::vector<double>& GetPropAdvance() const { return PropAdvance; }
349
353 bool GetPropFeather(int engine) const { return PropFeather[engine]; }
354
355 const std::vector<bool>& GetPropFeather() const { return PropFeather; }
357
361 std::string GetComponentStrings(const std::string& delimiter) const;
362
367 std::string GetComponentValues(const std::string& delimiter) const;
368
370
371
373 void SetDaCmd( double cmd ) { DaCmd = cmd; }
374
377 void SetDeCmd(double cmd ) { DeCmd = cmd; }
378
381 void SetDrCmd(double cmd) { DrCmd = cmd; }
382
385 void SetDsCmd(double cmd) { fdmex->GetGroundReactions()->SetDsCmd( cmd ); }
386
389 void SetDfCmd(double cmd) { DfCmd = cmd; }
390
393 void SetDsbCmd(double cmd) { DsbCmd = cmd; }
394
397 void SetDspCmd(double cmd) { DspCmd = cmd; }
398
401 void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
402
405 void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
406
409 void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
410
414 void SetThrottleCmd(int engine, double cmd);
415
419 void SetMixtureCmd(int engine, double cmd);
420
423 void SetGearCmd(double gearcmd) { GearCmd = gearcmd; }
424
428 void SetPropAdvanceCmd(int engine, double cmd);
429
433 void SetFeatherCmd(int engine, bool cmd);
435
437
438
440 void SetDaLPos( int form , double pos );
441
444 void SetDaRPos( int form , double pos );
445
448 void SetDePos( int form , double pos );
449
452 void SetDrPos( int form , double pos );
453
456 void SetDfPos( int form , double pos );
457
460 void SetDsbPos( int form , double pos );
461
464 void SetDspPos( int form , double pos );
465
469 void SetThrottlePos(int engine, double cmd);
470
474 void SetMixturePos(int engine, double cmd);
475
478 void SetGearPos(double gearpos) { GearPos = gearpos; }
479
482 void SetTailhookPos(double hookpos) { TailhookPos = hookpos; }
483
486 void SetWingFoldPos(double foldpos) { WingFoldPos = foldpos; }
487
491 void SetPropAdvance(int engine, double cmd);
492
496 void SetPropFeather(int engine, bool cmd);
498
500
501
503 void SetLBrake(double cmd) {BrakePos[FGLGear::bgLeft] = cmd;}
504
507 void SetRBrake(double cmd) {BrakePos[FGLGear::bgRight] = cmd;}
508
511 void SetCBrake(double cmd) {BrakePos[FGLGear::bgCenter] = cmd;}
512
516 double GetBrake(FGLGear::BrakeGroup bg);
517
518 const std::vector<double>& GetBrakePos() const {return BrakePos;}
519
522 double GetLBrake(void) const {return BrakePos[FGLGear::bgLeft];}
523
526 double GetRBrake(void) const {return BrakePos[FGLGear::bgRight];}
527
530 double GetCBrake(void) const {return BrakePos[FGLGear::bgCenter];}
532
534
539 bool Load(Element* el) override;
540
541 SGPath FindFullPathName(const SGPath& path) const override;
542
543 void AddThrottle(void);
544 double GetDt(void) const;
545
547
548 bool GetTrimStatus(void) const { return FDMExec->GetTrimStatus(); }
549 double GetChannelDeltaT(void) const { return GetDt() * ChannelRate; }
550
551private:
552 double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
553 double DePos[NForms], DaLPos[NForms], DaRPos[NForms], DrPos[NForms];
554 double DfPos[NForms], DsbPos[NForms], DspPos[NForms];
555 double PTrimCmd, YTrimCmd, RTrimCmd;
556 std::vector <double> ThrottleCmd;
557 std::vector <double> ThrottlePos;
558 std::vector <double> MixtureCmd;
559 std::vector <double> MixturePos;
560 std::vector <double> PropAdvanceCmd;
561 std::vector <double> PropAdvance;
562 std::vector <bool> PropFeatherCmd;
563 std::vector <bool> PropFeather;
564 //double LeftBrake, RightBrake, CenterBrake; // Brake settings
565 std::vector <double> BrakePos; // left, center, right - defined by FGLGear:: enum
566 double GearCmd,GearPos;
567 double TailhookPos, WingFoldPos;
568 SystemType systype;
569 int ChannelRate;
570 FGFDMExec* fdmex;
571
572 typedef std::vector <FGFCSChannel*> Channels;
573 Channels SystemChannels;
574 void bind(void);
575 void bindThrottle(unsigned int);
576 void Debug(int from) override;
577};
578}
579
580#endif
void SetThrottlePos(int engine, double cmd)
Sets the actual throttle setting for the specified engine.
Definition FGFCS.cpp:333
double GetDspPos(int form=ofRad) const
Gets the spoiler position.
Definition FGFCS.h:309
void SetPropAdvanceCmd(int engine, double cmd)
Sets the propeller pitch command for the specified engine.
Definition FGFCS.cpp:415
double GetDeCmd(void) const
Gets the elevator command.
Definition FGFCS.h:216
std::string GetComponentStrings(const std::string &delimiter) const
Retrieves all component names for inclusion in output stream.
Definition FGFCS.cpp:624
void SetLBrake(double cmd)
Sets the left brake group.
Definition FGFCS.h:503
double GetDaLPos(int form=ofRad) const
Gets the left aileron position.
Definition FGFCS.h:284
void SetPitchTrimCmd(double cmd)
Sets the pitch trim command.
Definition FGFCS.h:401
FGPropertyManager * GetPropertyManager(void)
Definition FGFCS.h:546
double GetYawTrimCmd(void) const
Gets the rudder trim command.
Definition FGFCS.h:268
void SetRBrake(double cmd)
Sets the right brake group.
Definition FGFCS.h:507
double GetPropAdvanceCmd(int engine) const
Gets the prop pitch command.
Definition FGFCS.h:255
double GetCBrake(void) const
Gets the center brake.
Definition FGFCS.h:530
double GetDaRPos(int form=ofRad) const
Gets the right aileron position.
Definition FGFCS.h:289
double GetDsCmd(void) const
Gets the steering command.
Definition FGFCS.h:224
double GetBrake(FGLGear::BrakeGroup bg)
Gets the brake for a specified group.
Definition FGFCS.cpp:604
const std::vector< double > & GetMixturePos() const
Definition FGFCS.h:329
void SetDeCmd(double cmd)
Sets the elevator command.
Definition FGFCS.h:377
double GetDfPos(int form=ofRad) const
Gets the flaps position.
Definition FGFCS.h:314
const std::vector< double > & GetPropAdvance() const
Definition FGFCS.h:348
FGFCS(FGFDMExec *)
Constructor.
Definition FGFCS.cpp:72
double GetChannelDeltaT(void) const
Definition FGFCS.h:549
bool GetTrimStatus(void) const
Definition FGFCS.h:548
void SetYawTrimCmd(double cmd)
Sets the rudder trim command.
Definition FGFCS.h:405
const std::vector< bool > & GetPropFeather() const
Definition FGFCS.h:355
double GetDrCmd(void) const
Gets the rudder command.
Definition FGFCS.h:220
SGPath FindFullPathName(const SGPath &path) const override
Definition FGFCS.cpp:611
void SetPropAdvance(int engine, double cmd)
Sets the actual prop pitch setting for the specified engine.
Definition FGFCS.cpp:429
void SetDspPos(int form, double pos)
Sets the spoiler position.
Definition FGFCS.cpp:296
bool Run(bool Holding) override
Runs the Flight Controls model; called by the Executive Can pass in a value indicating if the executi...
Definition FGFCS.cpp:153
const std::vector< double > & GetThrottlePos() const
Definition FGFCS.h:322
bool GetFeatherCmd(int engine) const
Gets the prop feather command.
Definition FGFCS.h:260
void SetDspCmd(double cmd)
Sets the spoilers command.
Definition FGFCS.h:397
void SetDfPos(int form, double pos)
Sets the flaps position.
Definition FGFCS.cpp:258
void SetDaCmd(double cmd)
Sets the aileron command.
Definition FGFCS.h:373
void SetWingFoldPos(double foldpos)
Set the wing fold position.
Definition FGFCS.h:486
void SetDsbCmd(double cmd)
Sets the speedbrake command.
Definition FGFCS.h:393
double GetRBrake(void) const
Gets the right brake.
Definition FGFCS.h:526
void SetTailhookPos(double hookpos)
Set the tailhook position.
Definition FGFCS.h:482
double GetTailhookPos(void) const
Gets the tailhook position (0 up, 1 down)
Definition FGFCS.h:337
void SetDsCmd(double cmd)
Sets the steering command.
Definition FGFCS.h:385
double GetPropAdvance(int engine) const
Gets the prop pitch position.
Definition FGFCS.h:346
double GetMixturePos(int engine) const
Gets the mixture position.
Definition FGFCS.h:327
double GetGearPos(void) const
Gets the gear position (0 up, 1 down), defaults to down.
Definition FGFCS.h:333
void SetDaRPos(int form, double pos)
Sets the right aileron position.
Definition FGFCS.cpp:201
double GetRollTrimCmd(void) const
Gets the aileron trim command.
Definition FGFCS.h:272
double GetLBrake(void) const
Gets the left brake.
Definition FGFCS.h:522
double GetDePos(int form=ofRad) const
Gets the elevator position.
Definition FGFCS.h:294
double GetDsbCmd(void) const
Gets the speedbrake command.
Definition FGFCS.h:232
double GetDrPos(int form=ofRad) const
Gets the rudder position.
Definition FGFCS.h:299
double GetDspCmd(void) const
Gets the spoiler command.
Definition FGFCS.h:236
double GetGearCmd(void) const
Get the gear extend/retract command.
Definition FGFCS.h:277
bool InitModel(void) override
Definition FGFCS.cpp:117
void SetThrottleCmd(int engine, double cmd)
Sets the throttle command for the specified engine.
Definition FGFCS.cpp:315
void SetDfCmd(double cmd)
Sets the flaps command.
Definition FGFCS.h:389
const std::vector< double > & GetMixtureCmd() const
Definition FGFCS.h:250
void SetMixturePos(int engine, double cmd)
Sets the actual mixture setting for the specified engine.
Definition FGFCS.cpp:401
~FGFCS() override
Destructor.
Definition FGFCS.cpp:96
void SetDrCmd(double cmd)
Sets the rudder command.
Definition FGFCS.h:381
void SetDaLPos(int form, double pos)
Sets the left aileron position.
Definition FGFCS.cpp:182
void SetGearCmd(double gearcmd)
Set the gear extend/retract command, defaults to down.
Definition FGFCS.h:423
void SetCBrake(double cmd)
Sets the center brake group.
Definition FGFCS.h:511
double GetMixtureCmd(int engine) const
Gets the mixture command.
Definition FGFCS.h:248
const std::vector< double > & GetBrakePos() const
Definition FGFCS.h:518
std::string GetComponentValues(const std::string &delimiter) const
Retrieves all component outputs for inclusion in output stream.
Definition FGFCS.cpp:647
double GetDaCmd(void) const
Gets the aileron command.
Definition FGFCS.h:212
double GetDt(void) const
Definition FGFCS.cpp:688
double GetDfCmd(void) const
Gets the flaps command.
Definition FGFCS.h:228
void SetDrPos(int form, double pos)
Sets the rudder position.
Definition FGFCS.cpp:239
double GetWingFoldPos(void) const
Gets the wing fold position (0 unfolded, 1 folded)
Definition FGFCS.h:341
void AddThrottle(void)
Definition FGFCS.cpp:671
bool GetPropFeather(int engine) const
Gets the prop feather position.
Definition FGFCS.h:353
double GetDsbPos(int form=ofRad) const
Gets the speedbrake position.
Definition FGFCS.h:304
void SetRollTrimCmd(double cmd)
Sets the aileron trim command.
Definition FGFCS.h:409
double GetPitchTrimCmd(void) const
Gets the pitch trim command.
Definition FGFCS.h:264
void SetPropFeather(int engine, bool cmd)
Sets the actual prop feather setting for the specified engine.
Definition FGFCS.cpp:457
void SetFeatherCmd(int engine, bool cmd)
Sets the propeller feather command for the specified engine.
Definition FGFCS.cpp:443
void SetDePos(int form, double pos)
Sets the elevator position.
Definition FGFCS.cpp:220
void SetGearPos(double gearpos)
Set the gear extend/retract position, defaults to down.
Definition FGFCS.h:478
void SetMixtureCmd(int engine, double cmd)
Sets the mixture command for the specified engine.
Definition FGFCS.cpp:387
const std::vector< double > & GetThrottleCmd() const
Definition FGFCS.h:243
bool Load(Element *el) override
Loads the Flight Control System.
Definition FGFCS.cpp:471
void SetDsbPos(int form, double pos)
Sets the speedbrake position.
Definition FGFCS.cpp:277
BrakeGroup
Brake grouping enumerators.
Definition FGLGear.h:215
FGPropertyManager * PropertyManager
Definition FGModel.h:117
FGFDMExec * FDMExec
Definition FGModel.h:116
FGModel(FGFDMExec *)
Constructor.
Definition FGModel.cpp:57
OutputForm
Definition FGFCS.h:56
@ ofDeg
Definition FGFCS.h:56
@ NForms
Definition FGFCS.h:56
@ ofNorm
Definition FGFCS.h:56
@ ofRad
Definition FGFCS.h:56
@ ofMag
Definition FGFCS.h:56