PropertyManager->Untie("aero/bi2vel");
PropertyManager->Untie("aero/ci2vel");
PropertyManager->Untie("aero/alpha-wing-rad");
+ PropertyManager->Untie("aero/stall-hyst-norm");
PropertyManager->Untie("systems/stall-warn-norm");
for ( i=0; i<NAxes; i++ ) {
FGAuxiliary::~FGAuxiliary()
{
+ unbind();
Debug(1);
}
FGFCS::~FGFCS()
{
+ unbind( PropertyManager->GetNode("fcs") );
+ unbind( PropertyManager->GetNode("ap") );
+ PropertyManager->Untie( "gear/gear-cmd-norm" );
+ PropertyManager->Untie( "gear/gear-pos-norm" );
+
ThrottleCmd.clear();
ThrottlePos.clear();
MixtureCmd.clear();
PropAdvanceCmd.clear();
PropAdvance.clear();
- unbind();
unsigned int i;
for (i=0;i<APComponents.size();i++) delete APComponents[i];
for (i=0;i<FCSComponents.size();i++) delete FCSComponents[i];
-
+
Debug(1);
}
if ( (((*Components)[i])->GetType() == "AEROSURFACE_SCALE"
|| ((*Components)[i])->GetType() == "KINEMAT")
&& ((*Components)[i])->GetOutputNode() ) {
- nodeName = ((*Components)[i])->GetOutputNode()->GetName();
+ nodeName = ((*Components)[i])->GetOutputNode()->GetName();
if ( nodeName == "elevator-pos-rad" ) {
ToNormalize[iDe]=i;
} else if ( nodeName == "left-aileron-pos-rad"
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGFCS::unbind(void)
+void FGFCS::unbind(FGPropertyManager *node)
{
- PropertyManager->Untie("fcs/aileron-cmd-norm");
- PropertyManager->Untie("fcs/elevator-cmd-norm");
- PropertyManager->Untie("fcs/rudder-cmd-norm");
- PropertyManager->Untie("fcs/flap-cmd-norm");
- PropertyManager->Untie("fcs/speedbrake-cmd-norm");
- PropertyManager->Untie("fcs/spoiler-cmd-norm");
- PropertyManager->Untie("fcs/pitch-trim-cmd-norm");
- PropertyManager->Untie("fcs/roll-trim-cmd-norm");
- PropertyManager->Untie("fcs/yaw-trim-cmd-norm");
- PropertyManager->Untie("gear/gear-cmd-norm");
- PropertyManager->Untie("fcs/left-aileron-pos-rad");
- PropertyManager->Untie("fcs/mag-left-aileron-pos-rad");
- PropertyManager->Untie("fcs/left-aileron-pos-norm");
- PropertyManager->Untie("fcs/right-aileron-pos-rad");
- PropertyManager->Untie("fcs/mag-right-aileron-pos-rad");
- PropertyManager->Untie("fcs/right-aileron-pos-norm");
- PropertyManager->Untie("fcs/elevator-pos-rad");
- PropertyManager->Untie("fcs/mag-elevator-pos-rad");
- PropertyManager->Untie("fcs/elevator-pos-norm");
- PropertyManager->Untie("fcs/rudder-pos-rad");
- PropertyManager->Untie("fcs/mag-rudder-pos-rad");
- PropertyManager->Untie("fcs/rudder-pos-norm");
- PropertyManager->Untie("fcs/flap-pos-deg");
- PropertyManager->Untie("fcs/flap-pos-norm");
- PropertyManager->Untie("fcs/speedbrake-pos-rad");
- PropertyManager->Untie("fcs/mag-speedbrake-pos-rad");
- PropertyManager->Untie("fcs/speedbrake-pos-norm");
- PropertyManager->Untie("fcs/spoiler-pos-rad");
- PropertyManager->Untie("fcs/mag-spoiler-pos-rad");
- PropertyManager->Untie("fcs/spoiler-pos-norm");
- PropertyManager->Untie("gear/gear-pos-norm");
- PropertyManager->Untie("ap/elevator_cmd");
- PropertyManager->Untie("ap/aileron_cmd");
- PropertyManager->Untie("ap/rudder_cmd");
- PropertyManager->Untie("ap/throttle_cmd");
- PropertyManager->Untie("ap/attitude_setpoint");
- PropertyManager->Untie("ap/altitude_setpoint");
- PropertyManager->Untie("ap/heading_setpoint");
- PropertyManager->Untie("ap/airspeed_setpoint");
- PropertyManager->Untie("ap/acquire_attitude");
- PropertyManager->Untie("ap/acquire_altitude");
- PropertyManager->Untie("ap/acquire_heading");
- PropertyManager->Untie("ap/acquire_airspeed");
- PropertyManager->Untie("ap/attitude_hold");
- PropertyManager->Untie("ap/altitude_hold");
- PropertyManager->Untie("ap/heading_hold");
- PropertyManager->Untie("ap/airspeed_hold");
- PropertyManager->Untie("ap/wingslevel_hold");
+ int N = node->nChildren();
+ for(int i=0;i<N;i++) {
+ if(node->getChild(i)->nChildren() ) {
+ unbind( (FGPropertyManager*)node->getChild(i) );
+ } else if( node->getChild(i)->isTied() ) {
+ node->getChild(i)->untie();
+ }
+ }
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void bind(void);
void bindModel(void);
- void unbind(void);
+ void unbind(FGPropertyManager *node);
private:
double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+void checkTied( FGPropertyManager *node ) {
+ int N = node->nChildren();
+ string name;
+ for(int i=0;i<N;i++) {
+ if(node->getChild(i)->nChildren() ) {
+ checkTied( (FGPropertyManager*)node->getChild(i) );
+ } else if( node->getChild(i)->isTied() ) {
+ name=((FGPropertyManager*)node->getChild(i))->GetFullyQualifiedName();
+ cerr << name << " is tied" << endl;
+ }
+ }
+}
+
// Constructor
FGFDMExec::FGFDMExec(FGPropertyManager* root)
else master = root;
instance = master->GetNode("/fdm/jsbsim",IdFDM,true);
- instance->SetDouble("zero",0);
+
Debug(0);
{
try {
DeAllocate();
+ checkTied( instance );
} catch ( string msg ) {
cout << "Caught error: " << msg << endl;
}
-
+
for (unsigned int i=1; i<SlaveFDMList.size(); i++) delete SlaveFDMList[i]->exec;
SlaveFDMList.clear();
-
+
Debug(1);
}
delete IC;
delete Trim;
-
+
+
+
FirstModel = 0L;
Error = 0;
return string( getName() );
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+string FGPropertyManager::GetFullyQualifiedName(void) {
+ vector<string> stack;
+ stack.push_back( getDisplayName(true) );
+ SGPropertyNode* tmpn=getParent();
+ bool atroot=false;
+ while( !atroot ) {
+ stack.push_back( tmpn->getDisplayName(true) );
+ if( !tmpn->getParent() )
+ atroot=true;
+ else
+ tmpn=tmpn->getParent();
+ }
+
+ string fqname="";
+ for(unsigned i=stack.size()-1;i>0;i--) {
+ fqname+= stack[i];
+ fqname+= "/";
+ }
+ fqname+= stack[0];
+ return fqname;
+
+}
+
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGPropertyManager::GetBool (const string &name, bool defaultValue)
* Get the name of a node
*/
string GetName( void );
+
+ /**
+ * Get the fully qualified name of a node
+ * This function is very slow, so is probably useful for debugging only.
+ */
+ string GetFullyQualifiedName(void);
/**
* Get a bool value for a property.
PropertyManager->Untie("velocities/mach-norm");
PropertyManager->Untie("aero/alphadot-rad_sec");
PropertyManager->Untie("aero/betadot-rad_sec");
+ PropertyManager->Untie("aero/mag-beta-rad");
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
bool result;
- //fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
- fdmex = new FGFDMExec();
+ fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
State = fdmex->GetState();
Atmosphere = fdmex->GetAtmosphere();
}
/******************************************************************************/
FGJSBsim::~FGJSBsim(void) {
- delete fdmex;
+ delete fdmex;
}
/******************************************************************************/
*AC_cfg >> token;
}
}
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components",true) );
+ FGFCSComponent::bind();
Debug(0);
}
ID = 0;
Input = 0.0;
Output = 0.0;
- OutputNode = 0;
+ OutputNode = 0;
IsOutput = false;
PropertyManager=fcs->GetPropertyManager();
+ treenode = 0;
Debug(0);
}
FGFCSComponent::~FGFCSComponent()
{
- unbind();
Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGFCSComponent::bind(FGPropertyManager *node) {
- string tmp = "fcs/" + node->mkPropertyName(Name, true);
+void FGFCSComponent::bind(void) {
+ string tmp = "fcs/" + PropertyManager->mkPropertyName(Name, true);
FGPropertyManager *tmpn;
PropertyManager->Tie( tmp,this, &FGFCSComponent::GetOutput);
- node = node->GetNode( node->mkPropertyName(Name, true), true );
+ tmp = "fcs/components/" + PropertyManager->mkPropertyName(Name, true);
+ treenode = PropertyManager->GetNode( tmp, true );
for(unsigned i=0;i<InputNodes.size();i++) {
- tmpn=node->GetNode( "input-property",(int)i,true );
+ tmpn=treenode->GetNode( "input-property",(int)i,true );
tmpn->setStringValue( InputNodes[i]->GetName().c_str() );
}
- if(OutputNode) node->SetString("output-property",OutputNode->GetName());
- node->Tie("output-value",this,&FGFCSComponent::GetOutput);
- node->SetString("type",Type);
+ if(OutputNode) treenode->SetString("output-property",OutputNode->GetName());
+ treenode->Tie("output-value",this,&FGFCSComponent::GetOutput);
+ treenode->SetString("type",Type);
}
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFCSComponent::unbind(void) {
- string name = "fcs";
- FGPropertyManager *node=PropertyManager->GetNode(name);
- name += "/" + PropertyManager->mkPropertyName(Name, true);
- PropertyManager->Untie( name );
-
- name = "fcs/components/"
- + PropertyManager->mkPropertyName(Name, true);
- node= PropertyManager->GetNode(name);
- node->Untie("output-value");
-}
-
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
inline string GetType(void) const { return Type; }
virtual double GetOutputPct(void) const { return 0; }
- virtual void bind(FGPropertyManager *node);
- virtual void unbind( void );
+ virtual void bind();
FGPropertyManager* resolveSymbol(string token);
protected:
enum eInputType {itPilotAC, itFCS, itAP, itBias} InputType;
FGFCS* fcs;
FGPropertyManager* PropertyManager;
+ FGPropertyManager* treenode;
string Type;
string Name;
int ID;
cerr << "Unknown filter type" << endl;
break;
}
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components",true) );
+ FGFCSComponent::bind();
Debug(0);
}
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include "FGGain.h"
+#include "FGGain.h"
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_GAIN;
}
}
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components",true) );
+ FGFCSComponent::bind();
+ if (Type == "AEROSURFACE_SCALE")
+ treenode->Tie( "output-norm", this, &FGGain::GetOutputPct );
Debug(0);
}
FGGain(FGFCS* fcs, FGConfigFile* AC_cfg);
~FGGain();
- double GetOutputPct() { return OutputPct; }
+ double GetOutputPct() const { return OutputPct; }
bool Run (void);
Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME");
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components",true) );
+ FGFCSComponent::bind();
Debug(0);
}
OutputNode = PropertyManager->GetNode(sOutputIdx);
}
}
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components") );
+ FGFCSComponent::bind();
+ treenode->Tie("output-norm", this, &FGKinemat::GetOutputPct );
Debug(0);
}
FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg);
~FGKinemat();
- double GetOutputPct() { return OutputPct; }
+ double GetOutputPct() const { return OutputPct; }
bool Run (void );
}
}
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components",true) );
+ FGFCSComponent::bind();
Debug(0);
}
Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME");
- FGFCSComponent::bind( PropertyManager->GetNode("fcs/components",true) );
+ FGFCSComponent::bind();
Debug(0);
}