INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include <math.h>
-#include <float.h>
-
#include "FGKinemat.h"
+#include "input_output/FGXMLElement.h"
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGKinemat.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $";
static const char *IdHdr = ID_FLAPS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGKinemat::Run(void )
{
- double dt = fcs->GetState()->Getdt();
+ double dt0 = dt;
Input = InputNodes[0]->getDoubleValue() * InputSigns[0];
if (DoScale) Input *= Detents[NumDetents-1];
- if (IsOutput) Output = OutputNode->getDoubleValue();
+ if (IsOutput) Output = OutputNodes[0]->getDoubleValue();
if (Input < Detents[0])
Input = Detents[0];
// Process all detent intervals the movement traverses until either the
// final value is reached or the time interval has finished.
- while ( 0.0 < dt && !EqualToRoundoff(Input, Output) ) {
+ while ( dt0 > 0.0 && !EqualToRoundoff(Input, Output) ) {
// Find the area where Output is in
int ind;
double ThisDt = fabs((ThisInput-Output)/Rate);
// and clip to the timestep size
- if (dt < ThisDt) {
- ThisDt = dt;
+ if (dt0 < ThisDt) {
+ ThisDt = dt0;
if (Output < Input)
Output += ThisDt*Rate;
else
// is met even in inexact arithmetics ...
Output = ThisInput;
- dt -= ThisDt;
+ dt0 -= ThisDt;
}
}
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
- cout << " INPUT: " << InputNodes[0]->getName() << endl;
+ cout << " INPUT: " << InputNodes[0]->GetName() << endl;
cout << " DETENTS: " << NumDetents << endl;
for (int i=0;i<NumDetents;i++) {
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
}
- if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
+ if (IsOutput) {
+ for (unsigned int i=0; i<OutputNodes.size(); i++)
+ cout << " OUTPUT: " << OutputNodes[i]->getName() << endl;
+ }
if (!DoScale) cout << " NOSCALE" << endl;
}
}