Sync. w. JSBSIm one more time to fix at least one bug
This commit is contained in:
parent
27a7305736
commit
81b9bb61e5
7 changed files with 39 additions and 12 deletions
|
@ -392,10 +392,16 @@ bool FGFDMExec::RunIC(void)
|
|||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
// A private, internal function call for Tie-ing to a property, so it needs an
|
||||
// argument. Nothing is done with the argument, yet.
|
||||
// argument.
|
||||
|
||||
void FGFDMExec::ResetToInitialConditions(int mode)
|
||||
{
|
||||
if (mode == 1) {
|
||||
for (unsigned int i=0; i<Outputs.size(); i++) {
|
||||
Outputs[i]->SetStartNewFile(true);
|
||||
}
|
||||
}
|
||||
|
||||
ResetToInitialConditions();
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
bool RunScript(void);
|
||||
|
||||
void ResetEvents(void) {
|
||||
for (int i=0; i<Events.size(); i++) Events[i].reset();
|
||||
for (unsigned int i=0; i<Events.size(); i++) Events[i].reset();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -139,7 +139,7 @@ bool FGFCS::InitModel(void)
|
|||
DfPos[i] = DsbPos[i] = DspPos[i] = 0.0;
|
||||
}
|
||||
|
||||
for (int i=0; i<Systems.size(); i++) {
|
||||
for (unsigned int i=0; i<Systems.size(); i++) {
|
||||
if (Systems[i]->GetType() == "LAG" ||
|
||||
Systems[i]->GetType() == "LEAD_LAG" ||
|
||||
Systems[i]->GetType() == "WASHOUT" ||
|
||||
|
@ -150,10 +150,9 @@ bool FGFCS::InitModel(void)
|
|||
} else if (Systems[i]->GetType() == "PID" ) {
|
||||
((FGPID*)Systems[i])->ResetPastStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i=0; i<FCSComponents.size(); i++) {
|
||||
for (unsigned int i=0; i<FCSComponents.size(); i++) {
|
||||
if (FCSComponents[i]->GetType() == "LAG" ||
|
||||
FCSComponents[i]->GetType() == "LEAD_LAG" ||
|
||||
FCSComponents[i]->GetType() == "WASHOUT" ||
|
||||
|
@ -166,7 +165,7 @@ bool FGFCS::InitModel(void)
|
|||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<APComponents.size(); i++) {
|
||||
for (unsigned int i=0; i<APComponents.size(); i++) {
|
||||
if (APComponents[i]->GetType() == "LAG" ||
|
||||
APComponents[i]->GetType() == "LEAD_LAG" ||
|
||||
APComponents[i]->GetType() == "WASHOUT" ||
|
||||
|
|
|
@ -128,11 +128,13 @@ FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
|
|||
sFirstPass = dFirstPass = true;
|
||||
socket = 0;
|
||||
flightGearSocket = 0;
|
||||
runID_postfix = 0;
|
||||
Type = otNone;
|
||||
SubSystems = 0;
|
||||
enabled = true;
|
||||
StartNewFile = false;
|
||||
delimeter = ", ";
|
||||
Filename = "";
|
||||
BaseFilename = Filename = "";
|
||||
DirectivesFile = "";
|
||||
output_file_name = "";
|
||||
|
||||
|
@ -155,8 +157,25 @@ FGOutput::~FGOutput()
|
|||
|
||||
bool FGOutput::InitModel(void)
|
||||
{
|
||||
char fname[1000] = "";
|
||||
|
||||
if (!FGModel::InitModel()) return false;
|
||||
|
||||
if (Filename.size() > 0 && StartNewFile) {
|
||||
int idx = BaseFilename.find_last_of(".");
|
||||
int len = BaseFilename.length();
|
||||
string extension = "";
|
||||
if (idx != string::npos) {
|
||||
extension = BaseFilename.substr(idx, len-idx);
|
||||
len -= extension.length();
|
||||
}
|
||||
sprintf(fname, "%s_%d%s", BaseFilename.substr(0,len).c_str(), runID_postfix++, extension.c_str());
|
||||
Filename = string(fname);
|
||||
datafile.close();
|
||||
StartNewFile = false;
|
||||
dFirstPass = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -216,7 +235,7 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
if (fname == "COUT" || fname == "cout") {
|
||||
buffer = cout.rdbuf();
|
||||
} else {
|
||||
datafile.open(fname.c_str());
|
||||
if (!datafile.is_open()) datafile.open(fname.c_str());
|
||||
buffer = datafile.rdbuf();
|
||||
}
|
||||
|
||||
|
@ -946,7 +965,7 @@ bool FGOutput::Load(Element* element)
|
|||
else
|
||||
flightGearSocket = new FGfdmSocket(name, port, FGfdmSocket::ptTCP); // create tcp socket (default)
|
||||
} else {
|
||||
Filename = name;
|
||||
BaseFilename = Filename = name;
|
||||
}
|
||||
if (!document->GetAttributeValue("rate").empty()) {
|
||||
OutRate = (int)document->GetAttributeValueAsNumber("rate");
|
||||
|
|
|
@ -148,6 +148,7 @@ public:
|
|||
|
||||
|
||||
void SetType(string);
|
||||
void SetStartNewFile(bool tt) {StartNewFile = tt;}
|
||||
void SetSubsystems(int tt) {SubSystems = tt;}
|
||||
inline void Enable(void) { enabled = true; }
|
||||
inline void Disable(void) { enabled = false; }
|
||||
|
@ -181,7 +182,9 @@ private:
|
|||
enum {otNone, otCSV, otTab, otSocket, otTerminal, otFlightGear, otUnknown} Type;
|
||||
bool sFirstPass, dFirstPass, enabled;
|
||||
int SubSystems;
|
||||
string output_file_name, delimeter, Filename, DirectivesFile;
|
||||
int runID_postfix;
|
||||
bool StartNewFile;
|
||||
string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile;
|
||||
ofstream datafile;
|
||||
FGfdmSocket* socket;
|
||||
FGfdmSocket* flightGearSocket;
|
||||
|
|
|
@ -216,7 +216,7 @@ void FGPropulsion::InitRunning(int n)
|
|||
{
|
||||
if (n > 0) { // A specific engine is supposed to be initialized
|
||||
|
||||
if (n >= GetNumEngines() ) {
|
||||
if (n >= (int)GetNumEngines() ) {
|
||||
cerr << "Tried to initialize a non-existent engine!" << endl;
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ private:
|
|||
/* MESO7 */
|
||||
double meso_tn1[5];
|
||||
double meso_tn2[4];
|
||||
double meso_tn3[3];
|
||||
double meso_tn3[5];
|
||||
double meso_tgn1[2];
|
||||
double meso_tgn2[2];
|
||||
double meso_tgn3[2];
|
||||
|
|
Loading…
Add table
Reference in a new issue