1
0
Fork 0

Add the latest fixes and expose all inertias in the property tree

This commit is contained in:
Erik Hofman 2016-04-06 14:26:30 +02:00
parent ca6424f76a
commit 02174a1df6
11 changed files with 111 additions and 44 deletions

View file

@ -72,7 +72,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.186 2016/01/10 16:32:26 bcoconni Exp $"); IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.187 2016/01/31 11:12:59 bcoconni Exp $");
IDENT(IdHdr,ID_FDMEXEC); IDENT(IdHdr,ID_FDMEXEC);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -612,12 +612,12 @@ void FGFDMExec::ResetToInitialConditions(int mode)
Models[i]->InitModel(); Models[i]->InitModel();
} }
RunIC();
if (Script) if (Script)
Script->ResetEvents(); Script->ResetEvents();
else else
Setsim_time(0.0); Setsim_time(0.0);
RunIC();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4
src/FDM/JSBSim/input_output/FGScript.cpp Normal file → Executable file
View file

@ -58,7 +58,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGScript.cpp,v 1.63 2015/09/28 21:14:15 bcoconni Exp $"); IDENT(IdSrc,"$Id: FGScript.cpp,v 1.64 2016/04/03 17:10:46 bcoconni Exp $");
IDENT(IdHdr,ID_FGSCRIPT); IDENT(IdHdr,ID_FGSCRIPT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -353,7 +353,7 @@ bool FGScript::LoadScript(const string& script, double default_dT,
void FGScript::ResetEvents(void) void FGScript::ResetEvents(void)
{ {
//LocalProperties.ResetToIC(); LocalProperties.ResetToIC();
FDMExec->Setsim_time(StartTime); FDMExec->Setsim_time(StartTime);
for (unsigned int i=0; i<Events.size(); i++) for (unsigned int i=0; i<Events.size(); i++)

View file

@ -114,7 +114,7 @@ public:
private: private:
int sckt; int sckt;
int sckt_in; int sckt_in;
//int udpsckt; int udpsckt;
DirectionType Direction; DirectionType Direction;
ProtocolType Protocol; ProtocolType Protocol;
struct sockaddr_in scktName; struct sockaddr_in scktName;

View file

@ -60,7 +60,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.25 2015/12/09 04:28:18 jberndt Exp $"); IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.26 2016/01/31 11:13:00 bcoconni Exp $");
IDENT(IdHdr,ID_ACCELERATIONS); IDENT(IdHdr,ID_ACCELERATIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -78,6 +78,7 @@ FGAccelerations::FGAccelerations(FGFDMExec* fdmex)
vPQRidot.InitMatrix(); vPQRidot.InitMatrix();
vUVWidot.InitMatrix(); vUVWidot.InitMatrix();
vUVWdot.InitMatrix();
vGravAccel.InitMatrix(); vGravAccel.InitMatrix();
vBodyAccel.InitMatrix(); vBodyAccel.InitMatrix();
vQtrndot = FGQuaternion(0,0,0); vQtrndot = FGQuaternion(0,0,0);
@ -101,6 +102,7 @@ bool FGAccelerations::InitModel(void)
vPQRidot.InitMatrix(); vPQRidot.InitMatrix();
vUVWidot.InitMatrix(); vUVWidot.InitMatrix();
vUVWdot.InitMatrix();
vGravAccel.InitMatrix(); vGravAccel.InitMatrix();
vBodyAccel.InitMatrix(); vBodyAccel.InitMatrix();
vQtrndot = FGQuaternion(0,0,0); vQtrndot = FGQuaternion(0,0,0);

View file

@ -70,14 +70,14 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.92 2015/07/12 19:34:08 bcoconni Exp $"); IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.94 2016/04/03 11:13:19 bcoconni Exp $");
IDENT(IdHdr,ID_FCS); IDENT(IdHdr,ID_FCS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex) FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex), ChannelRate(1)
{ {
int i; int i;
Name = "FGFCS"; Name = "FGFCS";
@ -181,8 +181,10 @@ bool FGFCS::Run(bool Holding)
// Execute system channels in order // Execute system channels in order
for (i=0; i<SystemChannels.size(); i++) { for (i=0; i<SystemChannels.size(); i++) {
if (debug_lvl & 4) cout << " Executing System Channel: " << SystemChannels[i]->GetName() << endl; if (debug_lvl & 4) cout << " Executing System Channel: " << SystemChannels[i]->GetName() << endl;
ChannelRate = SystemChannels[i]->GetRate();
SystemChannels[i]->Execute(); SystemChannels[i]->Execute();
} }
ChannelRate = 1;
RunPostFunctions(); RunPostFunctions();
@ -511,20 +513,24 @@ bool FGFCS::Load(Element* document)
string sOnOffProperty = channel_element->GetAttributeValue("execute"); string sOnOffProperty = channel_element->GetAttributeValue("execute");
string sChannelName = channel_element->GetAttributeValue("name"); string sChannelName = channel_element->GetAttributeValue("name");
int Rate = 0;
if (!channel_element->GetAttributeValue("execrate").empty())
Rate = channel_element->GetAttributeValueAsNumber("execrate");
if (sOnOffProperty.length() > 0) { if (sOnOffProperty.length() > 0) {
FGPropertyNode* OnOffPropertyNode = PropertyManager->GetNode(sOnOffProperty); FGPropertyNode* OnOffPropertyNode = PropertyManager->GetNode(sOnOffProperty);
if (OnOffPropertyNode == 0) { if (OnOffPropertyNode == 0) {
cerr << highint << fgred cerr << channel_element->ReadFrom() << highint << fgred
<< "The On/Off property, " << sOnOffProperty << " specified for channel " << "The On/Off property, " << sOnOffProperty << " specified for channel "
<< channel_element->GetAttributeValue("name") << " is undefined or not " << channel_element->GetAttributeValue("name") << " is undefined or not "
<< "understood. The simulation will abort" << reset << endl; << "understood. The simulation will abort" << reset << endl;
throw("Bad system definition"); throw("Bad system definition");
} else { } else
newChannel = new FGFCSChannel(sChannelName, OnOffPropertyNode); newChannel = new FGFCSChannel(this, sChannelName, Rate,
} OnOffPropertyNode);
} else { } else
newChannel = new FGFCSChannel(sChannelName); newChannel = new FGFCSChannel(this, sChannelName, Rate);
}
SystemChannels.push_back(newChannel); SystemChannels.push_back(newChannel);
@ -690,7 +696,7 @@ void FGFCS::AddGear(unsigned int NumGear)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGFCS::GetDt(void) double FGFCS::GetDt(void) const
{ {
return FDMExec->GetDeltaT()*rate; return FDMExec->GetDeltaT()*rate;
} }
@ -752,6 +758,7 @@ void FGFCS::bind(void)
PropertyManager->Tie("gear/tailhook-pos-norm", this, &FGFCS::GetTailhookPos, &FGFCS::SetTailhookPos); PropertyManager->Tie("gear/tailhook-pos-norm", this, &FGFCS::GetTailhookPos, &FGFCS::SetTailhookPos);
PropertyManager->Tie("fcs/wing-fold-pos-norm", this, &FGFCS::GetWingFoldPos, &FGFCS::SetWingFoldPos); PropertyManager->Tie("fcs/wing-fold-pos-norm", this, &FGFCS::GetWingFoldPos, &FGFCS::SetWingFoldPos);
PropertyManager->Tie("simulation/channel-dt", this, &FGFCS::GetChannelDeltaT);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCS "$Id: FGFCS.h,v 1.49 2015/07/12 19:34:08 bcoconni Exp $" #define ID_FCS "$Id: FGFCS.h,v 1.50 2016/02/27 16:54:15 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -167,7 +167,7 @@ CLASS DOCUMENTATION
@property gear/tailhook-pos-norm @property gear/tailhook-pos-norm
@author Jon S. Berndt @author Jon S. Berndt
@version $Revision: 1.49 $ @version $Revision: 1.50 $
@see FGActuator @see FGActuator
@see FGDeadBand @see FGDeadBand
@see FGFCSFunction @see FGFCSFunction
@ -557,11 +557,12 @@ public:
void AddThrottle(void); void AddThrottle(void);
void AddGear(unsigned int NumGear); void AddGear(unsigned int NumGear);
double GetDt(void); double GetDt(void) const;
FGPropertyManager* GetPropertyManager(void) { return PropertyManager; } FGPropertyManager* GetPropertyManager(void) { return PropertyManager; }
bool GetTrimStatus(void) const { return FDMExec->GetTrimStatus(); } bool GetTrimStatus(void) const { return FDMExec->GetTrimStatus(); }
double GetChannelDeltaT(void) const { return GetDt() * ChannelRate; }
private: private:
double DaCmd, DeCmd, DrCmd, DsCmd, DfCmd, DsbCmd, DspCmd; double DaCmd, DeCmd, DrCmd, DsCmd, DfCmd, DsbCmd, DspCmd;
@ -582,6 +583,7 @@ private:
double GearCmd,GearPos; double GearCmd,GearPos;
double TailhookPos, WingFoldPos; double TailhookPos, WingFoldPos;
SystemType systype; SystemType systype;
int ChannelRate;
typedef std::vector <FGFCSChannel*> Channels; typedef std::vector <FGFCSChannel*> Channels;
Channels SystemChannels; Channels SystemChannels;

52
src/FDM/JSBSim/models/FGFCSChannel.h Normal file → Executable file
View file

@ -44,7 +44,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.5 2015/03/28 14:49:02 bcoconni Exp $" #define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.9 2016/04/03 17:06:24 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -59,7 +59,15 @@ CLASS DOCUMENTATION
/** Represents a <channel> in a control system definition. /** Represents a <channel> in a control system definition.
The <channel> may be defined within a <system>, <autopilot> or <flight_control> The <channel> may be defined within a <system>, <autopilot> or <flight_control>
element. Channels are a way to group sets of components that perform element. Channels are a way to group sets of components that perform
a specific purpose or algorithm. */ a specific purpose or algorithm.
Created within a <system> tag, the channel is defined as follows
<channel name="name" [execute="property"] [execrate="rate"]>
name is the name of the channel - in the old way this would also be used to bind elements
execute [optional] is the property that defines when to execute this channel; an on/off switch
execrate [optional] is the rate at which the channel should execute.
A value of 0 or 1 will execute the channel every frame, a value of 2
every other frame (half rate), a value of 4 is every 4th frame (quarter rate)
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION CLASS DECLARATION
@ -70,10 +78,15 @@ typedef std::vector <FGFCSComponent*> FCSCompVec;
class FGFCSChannel { class FGFCSChannel {
public: public:
/// Constructor /// Constructor
FGFCSChannel(std::string name, FGPropertyNode* node=0) : FGFCSChannel(FGFCS* FCS, const std::string &name, int execRate,
OnOffNode(node), Name(name) FGPropertyNode* node=0)
: fcs(FCS), OnOffNode(node), Name(name)
{ {
ExecRate = execRate < 1 ? 1 : execRate;
// Set ExecFrameCountSinceLastRun so that each components are initialized
ExecFrameCountSinceLastRun = ExecRate;
} }
/// Destructor /// Destructor
~FGFCSChannel() { ~FGFCSChannel() {
for (unsigned int i=0; i<FCSComponents.size(); i++) delete FCSComponents[i]; for (unsigned int i=0; i<FCSComponents.size(); i++) delete FCSComponents[i];
@ -83,7 +96,10 @@ public:
std::string GetName() {return Name;} std::string GetName() {return Name;}
/// Adds a component to a channel /// Adds a component to a channel
void Add(FGFCSComponent* comp) {FCSComponents.push_back(comp);} void Add(FGFCSComponent* comp) {
FCSComponents.push_back(comp);
comp->SetDtForFrameCount(ExecRate);
}
/// Returns the number of components in the channel. /// Returns the number of components in the channel.
size_t GetNumComponents() {return FCSComponents.size();} size_t GetNumComponents() {return FCSComponents.size();}
/// Retrieves a specific component. /// Retrieves a specific component.
@ -99,22 +115,42 @@ public:
void Reset() { void Reset() {
for (unsigned int i=0; i<FCSComponents.size(); i++) for (unsigned int i=0; i<FCSComponents.size(); i++)
FCSComponents[i]->ResetPastStates(); FCSComponents[i]->ResetPastStates();
// Set ExecFrameCountSinceLastRun so that each components are initialized
// after a reset.
ExecFrameCountSinceLastRun = ExecRate;
} }
/// Executes all the components in a channel. /// Executes all the components in a channel.
void Execute() { void Execute() {
// If there is an on/off property supplied for this channel, check // If there is an on/off property supplied for this channel, check
// the value. If it is true, permit execution to continue. If not, return // the value. If it is true, permit execution to continue. If not, return
// and do not execute the channel. // and do not execute the channel.
if (OnOffNode != 0) if (OnOffNode && !OnOffNode->getBoolValue()) return;
if (!OnOffNode->getBoolValue()) return;
for (unsigned int i=0; i<FCSComponents.size(); i++) FCSComponents[i]->Run(); if (fcs->GetDt() != 0.0)
++ExecFrameCountSinceLastRun;
// channel will be run at rate 1 if trimming, or when the next execrate
// frame is reached
if (fcs->GetTrimStatus() || ExecFrameCountSinceLastRun >= ExecRate) {
for (unsigned int i=0; i<FCSComponents.size(); i++)
FCSComponents[i]->Run();
}
if (ExecFrameCountSinceLastRun >= ExecRate)
ExecFrameCountSinceLastRun = 0;
} }
/// Get the channel rate
int GetRate(void) const { return ExecRate; }
private: private:
FGFCS* fcs;
FCSCompVec FCSComponents; FCSCompVec FCSComponents;
FGConstPropertyNode_ptr OnOffNode; FGConstPropertyNode_ptr OnOffNode;
std::string Name; std::string Name;
int ExecRate; // rate at which this system executes, 0 or 1 every frame, 2 every second frame etc..
int ExecFrameCountSinceLastRun;
}; };
} }

View file

@ -51,7 +51,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.54 2015/12/09 04:28:18 jberndt Exp $"); IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.55 2016/03/26 18:54:27 bcoconni Exp $");
IDENT(IdHdr,ID_MASSBALANCE); IDENT(IdHdr,ID_MASSBALANCE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -258,11 +258,11 @@ bool FGMassBalance::Run(bool Holding)
void FGMassBalance::AddPointMass(Element* el) void FGMassBalance::AddPointMass(Element* el)
{ {
double radius=0, length=0;
Element* loc_element = el->FindElement("location"); Element* loc_element = el->FindElement("location");
string pointmass_name = el->GetAttributeValue("name"); string pointmass_name = el->GetAttributeValue("name");
if (!loc_element) { if (!loc_element) {
cerr << "Pointmass " << pointmass_name << " has no location." << endl; cerr << el->ReadFrom() << "Pointmass " << pointmass_name
<< " has no location." << endl;
exit(-1); exit(-1);
} }
@ -274,6 +274,7 @@ void FGMassBalance::AddPointMass(Element* el)
Element* form_element = el->FindElement("form"); Element* form_element = el->FindElement("form");
if (form_element) { if (form_element) {
double radius=0, length=0;
string shape = form_element->GetAttributeValue("shape"); string shape = form_element->GetAttributeValue("shape");
Element* radius_element = form_element->FindElement("radius"); Element* radius_element = form_element->FindElement("radius");
Element* length_element = form_element->FindElement("length"); Element* length_element = form_element->FindElement("length");
@ -401,6 +402,18 @@ void FGMassBalance::bind(void)
(PMF)&FGMassBalance::GetXYZcg); (PMF)&FGMassBalance::GetXYZcg);
PropertyManager->Tie("inertia/cg-z-in", this,3, PropertyManager->Tie("inertia/cg-z-in", this,3,
(PMF)&FGMassBalance::GetXYZcg); (PMF)&FGMassBalance::GetXYZcg);
PropertyManager->Tie("inertia/ixx-slugs_ft2", this,
&FGMassBalance::GetIxx);
PropertyManager->Tie("inertia/iyy-slugs_ft2", this,
&FGMassBalance::GetIyy);
PropertyManager->Tie("inertia/izz-slugs_ft2", this,
&FGMassBalance::GetIzz);
PropertyManager->Tie("inertia/ixy-slugs_ft2", this,
&FGMassBalance::GetIxy);
PropertyManager->Tie("inertia/ixz-slugs_ft2", this,
&FGMassBalance::GetIxz);
PropertyManager->Tie("inertia/iyz-slugs_ft2", this,
&FGMassBalance::GetIyz);
typedef int (FGMassBalance::*iOPV)() const; typedef int (FGMassBalance::*iOPV)() const;
PropertyManager->Tie("inertia/print-mass-properties", this, (iOPV)0, PropertyManager->Tie("inertia/print-mass-properties", this, (iOPV)0,
&FGMassBalance::GetMassPropertiesReport, false); &FGMassBalance::GetMassPropertiesReport, false);

View file

@ -48,7 +48,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.36 2015/08/22 18:09:00 bcoconni Exp $" #define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.37 2016/03/26 18:54:27 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONSS FORWARD DECLARATIONSS
@ -202,7 +202,12 @@ private:
FGColumnVector3 vPMxyz; FGColumnVector3 vPMxyz;
FGColumnVector3 PointMassCG; FGColumnVector3 PointMassCG;
const FGMatrix33& CalculatePMInertias(void); const FGMatrix33& CalculatePMInertias(void);
double GetIxx(void) const { return mJ(1,1); }
double GetIyy(void) const { return mJ(2,2); }
double GetIzz(void) const { return mJ(3,3); }
double GetIxy(void) const { return -mJ(1,2); }
double GetIxz(void) const { return -mJ(1,3); }
double GetIyz(void) const { return -mJ(2,3); }
/** The PointMass structure encapsulates a point mass object, moments of inertia /** The PointMass structure encapsulates a point mass object, moments of inertia
mass, location, etc. */ mass, location, etc. */

View file

@ -49,7 +49,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGFCSComponent.cpp,v 1.41 2015/07/12 19:34:08 bcoconni Exp $"); IDENT(IdSrc,"$Id: FGFCSComponent.cpp,v 1.42 2016/02/27 16:54:15 bcoconni Exp $");
IDENT(IdHdr,ID_FCSCOMPONENT); IDENT(IdHdr,ID_FCSCOMPONENT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -253,9 +253,9 @@ void FGFCSComponent::SetOutput(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGFCSComponent::Run(void) void FGFCSComponent::SetDtForFrameCount(int FrameCount)
{ {
return true; dt = fcs->GetDt() * FrameCount;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -282,11 +282,12 @@ void FGFCSComponent::Clip(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// //
// The old way of naming FCS components allowed upper or lower case, spaces, etc. // The old way of naming FCS components allowed upper or lower case, spaces,
// but then the names were modified to fit into a property name heirarchy. This // etc. but then the names were modified to fit into a property name
// was confusing (it wasn't done intentionally - it was a carryover from the early // hierarchy. This was confusing (it wasn't done intentionally - it was a
// design). We now support the direct naming of properties in the FCS component // carryover from the early design). We now support the direct naming of
// name attribute. The old way is supported in code at this time, but deprecated. // properties in the FCS component name attribute. The old way is supported in
// code at this time, but deprecated.
void FGFCSComponent::bind(void) void FGFCSComponent::bind(void)
{ {

View file

@ -47,7 +47,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.27 2015/07/12 19:34:08 bcoconni Exp $" #define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.28 2016/02/27 16:54:16 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -83,7 +83,7 @@ CLASS DOCUMENTATION
- FGAngle - FGAngle
@author Jon S. Berndt @author Jon S. Berndt
@version $Id: FGFCSComponent.h,v 1.27 2015/07/12 19:34:08 bcoconni Exp $ @version $Id: FGFCSComponent.h,v 1.28 2016/02/27 16:54:16 bcoconni Exp $
@see Documentation for the FGFCS class, and for the configuration file class @see Documentation for the FGFCS class, and for the configuration file class
*/ */
@ -99,8 +99,9 @@ public:
/// Destructor /// Destructor
virtual ~FGFCSComponent(); virtual ~FGFCSComponent();
virtual bool Run(void); virtual bool Run(void) { return true; }
virtual void SetOutput(void); virtual void SetOutput(void);
void SetDtForFrameCount(int FrameCount);
double GetOutput (void) const {return Output;} double GetOutput (void) const {return Output;}
std::string GetName(void) const {return Name;} std::string GetName(void) const {return Name;}
std::string GetType(void) const { return Type; } std::string GetType(void) const { return Type; }