%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGMSIS.h"
-#include "FGState.h"
-#include <math.h> /* maths functions */
-#include <stdlib.h> /* for malloc/free */
-#include <stdio.h> /* for printf */
+#include "models/FGAuxiliary.h"
+#include <cmath> /* maths functions */
#include <iostream> // for cout, endl
+using namespace std;
+
namespace JSBSim {
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGMSIS.cpp,v 1.13 2010/02/25 05:21:36 jberndt Exp $";
static const char *IdHdr = ID_MSIS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (FGModel::Run()) return true;
if (FDMExec->Holding()) return false;
+ RunPreFunctions();
+
//do temp, pressure, and density first
if (!useExternal) {
// get sea-level values
// get at-altitude values
Calculate(Auxiliary->GetDayOfYear(),
Auxiliary->GetSecondsInDay(),
- Propagate->Geth(),
+ Propagate->GetAltitudeASL(),
Propagate->GetLocation().GetLatitudeDeg(),
Propagate->GetLocation().GetLongitudeDeg());
intTemperature = output.t[1] * 1.8;
CalculateDerived();
+ RunPostFunctions();
+
Debug(2);
return false;
double ylog;
a = zhm / (xmm-xm);
if (!((dm>0) && (dd>0))) {
- printf("dnet log error %e %e %e\n",dm,dd,xm);
+ cerr << "dnet log error " << dm << ' ' << dd << ' ' << xm << ' ' << endl;
if ((dd==0) && (dm==0))
dd=1;
if (dm==0)
}
h = xa[khi] - xa[klo];
if (h==0.0)
- printf("bad XA input to splint");
+ cerr << "bad XA input to splint" << endl;
a = (xa[khi] - x)/h;
b = (x - xa[klo])/h;
yi = a * ya[klo] + b * ya[khi] + ((a*a*a - a) * y2a[klo] + (b*b*b - b) * y2a[khi]) * h * h/6.0;
double *u;
double sig, p, qn, un;
int i, k;
- u=(double*)malloc(sizeof(double)*n);
+ u=new double[n];
if (u==NULL) {
- printf("Out Of Memory in spline - ERROR");
+ cerr << "Out Of Memory in spline - ERROR" << endl;
return;
}
if (yp1>0.99E30) {
for (k=n-2;k>=0;k--)
y2[k] = y2[k] * y2[k+1] + u[k];
- free(u);
+ delete u;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (p[99]==0)
p[99]=pset;
if (p[99]!=pset) {
- printf("Wrong parameter set for glob7s\n");
+ cerr << "Wrong parameter set for glob7s" << endl;
return -1;
}
for (j=0;j<14;j++)
if (sqrt(diff*diff)<test)
return;
if (l==ltest) {
- printf("ERROR: ghp7 not converging for press %e, diff %e",press,diff);
+ cerr << "ERROR: ghp7 not converging for press " << press << ", diff " << diff << endl;
return;
}
xm = output->d[5] / xn / 1.66E-24;