223 {
224
226
227 for (
unsigned int i=0; i<m_fdm->
GetPropulsion()->GetNumEngines(); i++) {
229 }
230
231
232 double cost = stateSum();
233 for(int i=0;i<1000;i++) {
235 m_fdm->SetTrimStatus(true);
239 m_fdm->SetTrimStatus(false);
242
243 double costNew = stateSum();
244 double dcost = fabs(costNew - cost);
245 if (dcost < std::numeric_limits<double>::epsilon()) {
247 FGLogging log(LogLevel::DEBUG);
248 log << "cost convergd, i: " << i << "\n";
249 }
250 break;
251 }
252 if (i > 1000) {
254 FGLogging log(LogLevel::DEBUG);
255 log << "cost failed to converge, dcost: "
256 << std::scientific
257 << dcost << "\n";
258 }
259 break;
260 }
261 cost = costNew;
262 }
263 }
void EnableOutput(void)
Enables data logging to all outputs.
std::shared_ptr< FGInitialCondition > GetIC(void) const
Returns a pointer to the FGInitialCondition object.
int GetDebugLevel(void) const
Retrieves the current debug level setting.
bool Run(void)
This function executes each scheduled model in succession.
void DisableOutput(void)
Disables data logging to all outputs.
std::shared_ptr< FGPropulsion > GetPropulsion(void) const
Returns the FGPropulsion pointer.
void SuspendIntegration(void)
Suspends the simulation and sets the delta T to zero.
void Initialize(const FGInitialCondition *FGIC)
Initializes the simulation with initial conditions.
void ResumeIntegration(void)
Resumes the simulation by resetting delta T to the correct value.