FGCoefficient::FGCoefficient( FGFDMExec* fdex )
{
-
FDMExec = fdex;
State = FDMExec->GetState();
Table = 0;
PropertyManager = FDMExec->GetPropertyManager();
- bias=0;
- gain=1;
-
+ Table = (FGTable*)0L;
LookupR = LookupC = 0;
-
- totalValue = 0;
-
- if (debug_lvl & 2) cout << "Instantiated: FGCoefficient" << endl;
+ numInstances = 0;
+ rows = columns = 0;
+
+ StaticValue = 0.0;
+ totalValue = 0.0;
+ bias = 0.0;
+ gain = 1.0;
+
+ filename.erase();
+ description.erase();
+ name.erase();
+ method.erase();
+ multparms.erase();
+ multparmsRow.erase();
+ multparmsCol.erase();
+
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGCoefficient::~FGCoefficient()
{
if (Table) delete Table;
- if (debug_lvl & 2) cout << "Destroyed: FGCoefficient" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
unsigned int midx;
SD = Value = gain*Table->GetValue(rVal, cVal) + bias;
-
for (midx=0; midx < multipliers.size(); midx++) {
Value *= multipliers[midx]->getDoubleValue();
double FGCoefficient::TotalValue(void)
{
switch(type) {
- case 0:
- totalValue=-1;
- return totalValue;
- case 1:
- totalValue=Value();
- return totalValue;
- case 2:
- totalValue=Value( LookupR->getDoubleValue() );
- return totalValue;
- case 3:
- totalValue=Value( LookupR->getDoubleValue(),
- LookupC->getDoubleValue() );
- return totalValue;
- case 4:
- totalValue=0.0;
- return totalValue;
- }
- return totalValue;
-}
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ case UNKNOWN:
+ totalValue = -1;
+ break;
-void FGCoefficient::DumpSD(void)
-{
- cout << " " << name << ": " << SD << endl;
+ case VALUE:
+ totalValue = Value();
+ break;
+
+ case VECTOR:
+ totalValue = Value( LookupR->getDoubleValue() );
+ break;
+
+ case TABLE:
+ totalValue = Value( LookupR->getDoubleValue(),
+ LookupC->getDoubleValue() );
+ break;
+
+ case EQUATION:
+ totalValue = 0.0;
+ break;
+ }
+ return totalValue;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGCoefficient::GetCoefficientValues(void)
+string FGCoefficient::GetSDstring(void)
{
char buffer[10];
string value;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGCoefficient::bind(FGPropertyManager *parent) {
+void FGCoefficient::bind(FGPropertyManager *parent)
+{
string mult;
unsigned i;
node=parent->GetNode(name,true);
node->SetString("description",description);
- if(LookupR) node->SetString("row-parm",LookupR->getName() );
- if(LookupC) node->SetString("column-parm",LookupC->getName() );
+ if (LookupR) node->SetString("row-parm",LookupR->getName() );
+ if (LookupC) node->SetString("column-parm",LookupC->getName() );
mult="";
- if(multipliers.size() == 0)
+ if (multipliers.size() == 0)
mult="none";
for (i=0; i<multipliers.size(); i++) {
mult += multipliers[i]->getName();
- if( i < multipliers.size()-1 ) mult += " ";
+ if ( i < multipliers.size()-1 ) mult += " ";
}
node->SetString("multipliers",mult);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGCoefficient::unbind(void) {
+void FGCoefficient::unbind(void)
+{
node->Untie("SD-norm");
node->Untie("value-lbs");
node->Untie("bias");
node->Untie("gain");
-}
+}
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print