~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/FDM/JSBSim/FGFDMExec.h

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2011-01-30 15:46:35 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110130154635-rlynmg9n5hzxq5xe
Tags: 2.0.0-3
* Recommend fgfs-aircraft-base and fgfs-models-base.
  Closes. #610276.
* Added note about scenery SharedModels.tgz to README.Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 Date started: 11/17/98
5
5
 file The header file for the JSBSim executive.
6
6
 
7
 
 ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
 
7
 ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
8
8
 
9
9
 This program is free software; you can redistribute it and/or modify it under
10
10
 the terms of the GNU Lesser General Public License as published by the Free Software
41
41
INCLUDES
42
42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
43
 
44
 
#include <models/FGModel.h>
45
 
#include <models/FGOutput.h>
46
 
#include <models/FGInput.h>
47
 
#include <initialization/FGTrim.h>
48
 
#include <initialization/FGInitialCondition.h>
49
 
#include <FGJSBBase.h>
50
 
#include <input_output/FGPropertyManager.h>
51
 
#include <input_output/FGGroundCallback.h>
52
 
#include <input_output/FGXMLFileRead.h>
53
 
#include <models/FGPropagate.h>
 
44
#include "models/FGModel.h"
 
45
#include "models/FGOutput.h"
 
46
#include "models/FGInput.h"
 
47
#include "initialization/FGTrim.h"
 
48
#include "initialization/FGInitialCondition.h"
 
49
#include "FGJSBBase.h"
 
50
#include "input_output/FGPropertyManager.h"
 
51
#include "input_output/FGGroundCallback.h"
 
52
#include "input_output/FGXMLFileRead.h"
 
53
#include "models/FGPropagate.h"
 
54
#include "math/FGColumnVector3.h"
54
55
 
55
56
#include <vector>
56
57
#include <string>
177
178
 
178
179
class FGFDMExec : public FGJSBBase, public FGXMLFileRead
179
180
{
 
181
  struct childData {
 
182
    FGFDMExec* exec;
 
183
    string info;
 
184
    FGColumnVector3 Loc;
 
185
    FGColumnVector3 Orient;
 
186
    bool mated;
 
187
    bool internal;
 
188
 
 
189
    childData(void) {
 
190
      info = "";
 
191
      Loc = FGColumnVector3(0,0,0);
 
192
      Orient = FGColumnVector3(0,0,0);
 
193
      mated = true;
 
194
      internal = false;
 
195
    }
 
196
    
 
197
    void Run(void) {exec->Run();}
 
198
    void AssignState(FGPropagate* source_prop) {
 
199
      exec->GetPropagate()->SetVState(source_prop->GetVState());
 
200
    }
 
201
 
 
202
    ~childData(void) {
 
203
      delete exec;
 
204
    }
 
205
  };
 
206
 
180
207
public:
181
208
 
182
209
  /// Default constructor
195
222
      @param model A pointer to the model being scheduled.
196
223
      @param rate The rate at which to execute the model as described above.
197
224
      @return Currently returns 0 always. */
198
 
  int  Schedule(FGModel* model, int rate);
 
225
  void Schedule(FGModel* model, int rate);
199
226
 
200
227
  /** This function executes each scheduled model in succession.
201
228
      @return true if successful, false if sim should be ended  */
335
362
  FGPropertyManager* GetPropertyManager(void);
336
363
  /// Returns a vector of strings representing the names of all loaded models (future)
337
364
  vector <string> EnumerateFDMs(void);
338
 
  /// Marks this instance of the Exec object as a "slave" object.
339
 
  void SetSlave(bool s) {IsSlave = s;}
 
365
  /// Gets the number of child FDMs.
 
366
  int GetFDMCount(void) {return ChildFDMList.size();}
 
367
  /// Gets a particular child FDM.
 
368
  childData* GetChildFDM(int i) {return ChildFDMList[i];}
 
369
  /// Marks this instance of the Exec object as a "child" object.
 
370
  void SetChild(bool ch) {IsChild = ch;}
340
371
 
341
372
  /** Sets the output (logging) mechanism for this run.
342
373
      Calling this function passes the name of an output directives file to
443
474
  bool holding;
444
475
  bool Constructing;
445
476
  bool modelLoaded;
446
 
  bool IsSlave;
 
477
  bool IsChild;
447
478
  string modelName;
448
479
  string AircraftPath;
449
480
  string FullAircraftPath;
455
486
  bool trim_status;
456
487
  int ta_mode;
457
488
 
458
 
 
459
 
  struct slaveData {
460
 
    FGFDMExec* exec;
461
 
    string info;
462
 
    double x, y, z;
463
 
    double roll, pitch, yaw;
464
 
    bool mated;
465
 
 
466
 
    slaveData(void) {
467
 
      info = "";
468
 
      x = y = z = 0.0;
469
 
      roll = pitch = yaw = 0.0;
470
 
      mated = true;
471
 
    }
472
 
 
473
 
    ~slaveData(void) {
474
 
      delete exec;
475
 
    }
476
 
  };
477
 
 
478
489
  static FGPropertyManager *master;
479
490
 
480
 
  FGModel*            FirstModel;
481
491
  FGGroundCallback*   GroundCallback;
482
492
  FGState*            State;
483
493
  FGAtmosphere*       Atmosphere;
502
512
 
503
513
  vector <string> PropertyCatalog;
504
514
  vector <FGOutput*> Outputs;
505
 
  vector <slaveData*> SlaveFDMList;
 
515
  vector <childData*> ChildFDMList;
 
516
  vector <FGModel*> Models;
506
517
 
507
518
  bool ReadFileHeader(Element*);
508
 
  bool ReadSlave(Element*);
 
519
  bool ReadChild(Element*);
509
520
  bool ReadPrologue(Element*);
 
521
  void ResetToInitialConditions(int mode);
510
522
  bool Allocate(void);
511
523
  bool DeAllocate(void);
512
524