]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGFDMExec.cpp
Latest jsbsim updates.
[flightgear.git] / src / FDM / JSBSim / FGFDMExec.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGFDMExec.cpp
4  Author:       Jon S. Berndt
5  Date started: 11/17/98
6  Purpose:      Schedules and runs the model routines.
7  Called by:    The GUI.
8
9  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
10
11  This program is free software; you can redistribute it and/or modify it under
12  the terms of the GNU General Public License as published by the Free Software
13  Foundation; either version 2 of the License, or (at your option) any later
14  version.
15
16  This program is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19  details.
20
21  You should have received a copy of the GNU General Public License along with
22  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23  Place - Suite 330, Boston, MA  02111-1307, USA.
24
25  Further information about the GNU General Public License can also be found on
26  the world wide web at http://www.gnu.org.
27
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30
31 This class wraps up the simulation scheduling routines.
32
33 HISTORY
34 --------------------------------------------------------------------------------
35 11/17/98   JSB   Created
36
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 COMMENTS, REFERENCES,  and NOTES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 INCLUDES
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
44
45 #ifdef FGFS
46 #  include <simgear/compiler.h>
47 #  ifdef FG_HAVE_STD_INCLUDES
48 #    include <iostream>
49 #    include <ctime>
50 #    include <iterator>
51 #  else
52 #    include <iostream.h>
53 #    include <time.h>
54 #    include <iterator.h>
55 #  endif
56 #else
57 #  include <iostream>
58 #  include <ctime>
59 #  include <iterator>
60 #endif
61
62 #include "FGFDMExec.h"
63 #include "FGState.h"
64 #include "FGAtmosphere.h"
65 #include "FGFCS.h"
66 #include "FGPropulsion.h"
67 #include "FGAircraft.h"
68 #include "FGTranslation.h"
69 #include "FGRotation.h"
70 #include "FGPosition.h"
71 #include "FGAuxiliary.h"
72 #include "FGOutput.h"
73 #include "FGConfigFile.h"
74
75 static const char *IdSrc = "$Id$";
76 static const char *IdHdr = "ID_FDMEXEC";
77
78 char highint[5]  = {27, '[', '1', 'm', '\0'      };
79 char halfint[5]  = {27, '[', '2', 'm', '\0'      };
80 char normint[6]  = {27, '[', '2', '2', 'm', '\0' };
81 char reset[5]    = {27, '[', '0', 'm', '\0'      };
82 char underon[5]  = {27, '[', '4', 'm', '\0'      };
83 char underoff[6] = {27, '[', '2', '4', 'm', '\0' };
84 char fgblue[6]   = {27, '[', '3', '4', 'm', '\0' };
85 char fgcyan[6]   = {27, '[', '3', '6', 'm', '\0' };
86 char fgred[6]    = {27, '[', '3', '1', 'm', '\0' };
87 char fggreen[6]  = {27, '[', '3', '2', 'm', '\0' };
88 char fgdef[6]    = {27, '[', '3', '9', 'm', '\0' };
89
90 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 GLOBAL DECLARATIONS
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
93
94 short debug_lvl;  // This describes to any interested entity the debug level
95                   // requested by setting the JSBSIM_DEBUG environment variable.
96                   // The bitmasked value choices are as follows:
97                   // a) unset: In this case (the default) JSBSim would only print
98                   //    out the normally expected messages, essentially echoing
99                   //    the config files as they are read. If the environment
100                   //    variable is not set, debug_lvl is set to 1 internally
101                   // b) 0: This requests JSBSim not to output any messages
102                   //    whatsoever.
103                   // c) 1: This value explicity requests the normal JSBSim
104                   //    startup messages
105                   // d) 2: This value asks for a message to be printed out when
106                   //    a class is instantiated
107                   // e) 4: When this value is set, a message is displayed when a
108                   //    FGModel object executes its Run() method
109                   // f) 8: When this value is set, various runtime state variables
110                   //    are printed out periodically
111
112 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 CLASS IMPLEMENTATION
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
115
116 // Constructor
117
118 FGFDMExec::FGFDMExec(void)
119 {
120   Frame       = 0;
121   FirstModel  = 0;
122   Error       = 0;
123   State       = 0;
124   Atmosphere  = 0;
125   FCS         = 0;
126   Propulsion  = 0;
127   Aircraft    = 0;
128   Translation = 0;
129   Rotation    = 0;
130   Position    = 0;
131   Auxiliary   = 0;
132   Output      = 0;
133
134   terminate = false;
135   frozen = false;
136   modelLoaded = false;
137   Scripted = false;
138
139   cout << "\n\n     " << highint << underon << "JSBSim Flight Dynamics Model v"
140                                  << JSBSIM_VERSION << underoff << normint << endl;
141   cout << halfint << "            [cfg file spec v" << NEEDED_CFG_VERSION << "]\n\n";
142   cout << normint << "JSBSim startup beginning ...\n\n";
143
144   try {
145     char* num = getenv("JSBSIM_DEBUG");
146     if (!num) debug_lvl = 1;
147     else debug_lvl = atoi(num); // set debug level
148   } catch (...) {               // if error set to 1
149     debug_lvl = 1;
150   }
151
152   if (debug_lvl & 2) cout << "Instantiated: FGFDMExec" << endl;
153
154   Allocate();
155 }
156
157 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158
159 FGFDMExec::~FGFDMExec() {
160   DeAllocate();
161   if (debug_lvl & 2) cout << "Destroyed:    FGFDMExec" << endl;
162 }
163
164 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165
166 bool FGFDMExec::Allocate(void) {
167
168   bool result=true;
169
170   Atmosphere  = new FGAtmosphere(this);
171   FCS         = new FGFCS(this);
172   Propulsion  = new FGPropulsion(this);
173   Aircraft    = new FGAircraft(this);
174   Translation = new FGTranslation(this);
175   Rotation    = new FGRotation(this);
176   Position    = new FGPosition(this);
177   Auxiliary   = new FGAuxiliary(this);
178   Output      = new FGOutput(this);
179
180   State       = new FGState(this);
181
182   // Initialize models so they can communicate with each other
183
184   if (!Atmosphere->InitModel()) {
185     cerr << fgred << "Atmosphere model init failed" << fgdef << endl;
186     Error+=1;}
187   if (!FCS->InitModel())        {
188     cerr << fgred << "FCS model init failed" << fgdef << endl;
189     Error+=2;}
190   if (!Propulsion->InitModel()) {
191     cerr << fgred << "FGPropulsion model init failed" << fgdef << endl;
192     Error+=4;}
193   if (!Aircraft->InitModel())   {
194     cerr << fgred << "Aircraft model init failed" << fgdef << endl;
195     Error+=8;}
196   if (!Translation->InitModel()){
197     cerr << fgred << "Translation model init failed" << fgdef << endl;
198     Error+=16;}
199   if (!Rotation->InitModel())   {
200     cerr << fgred << "Rotation model init failed" << fgdef << endl;
201     Error+=32;}
202   if (!Position->InitModel())   {
203     cerr << fgred << "Position model init failed" << fgdef << endl;
204     Error+=64;}
205   if (!Auxiliary->InitModel())  {
206     cerr << fgred << "Auxiliary model init failed" << fgdef << endl;
207     Error+=128;}
208   if (!Output->InitModel())     {
209     cerr << fgred << "Output model init failed" << fgdef << endl;
210     Error+=256;}
211
212   if (Error > 0) result = false;
213
214   // Schedule a model. The second arg (the integer) is the pass number. For
215   // instance, the atmosphere model gets executed every fifth pass it is called
216   // by the executive. Everything else here gets executed each pass.
217
218   Schedule(Atmosphere,  1);
219   Schedule(FCS,         1);
220   Schedule(Propulsion,  1);
221   Schedule(Aircraft,    1);
222   Schedule(Rotation,    1);
223   Schedule(Translation, 1);
224   Schedule(Position,    1);
225   Schedule(Auxiliary,   1);
226   Schedule(Output,     1);
227
228   modelLoaded = false;
229
230   return result;
231 }
232
233 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234
235 bool FGFDMExec::DeAllocate(void) {
236
237   if ( Atmosphere != 0 )  delete Atmosphere;
238   if ( FCS != 0 )         delete FCS;
239   if ( Propulsion != 0)   delete Propulsion;
240   if ( Aircraft != 0 )    delete Aircraft;
241   if ( Translation != 0 ) delete Translation;
242   if ( Rotation != 0 )    delete Rotation;
243   if ( Position != 0 )    delete Position;
244   if ( Auxiliary != 0 )   delete Auxiliary;
245   if ( Output != 0 )      delete Output;
246   if ( State != 0 )       delete State;
247
248   FirstModel  = 0L;
249   Error       = 0;
250
251   State       = 0;
252   Atmosphere  = 0;
253   FCS         = 0;
254   Propulsion  = 0;
255   Aircraft    = 0;
256   Translation = 0;
257   Rotation    = 0;
258   Position    = 0;
259   Auxiliary   = 0;
260   Output      = 0;
261
262   modelLoaded = false;
263   return modelLoaded;
264 }
265
266 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267
268 int FGFDMExec::Schedule(FGModel* model, int rate)
269 {
270   FGModel* model_iterator;
271
272   model_iterator = FirstModel;
273
274   if (model_iterator == 0L) {                  // this is the first model
275
276     FirstModel = model;
277     FirstModel->NextModel = 0L;
278     FirstModel->SetRate(rate);
279
280   } else {                                     // subsequent model
281
282     while (model_iterator->NextModel != 0L) {
283       model_iterator = model_iterator->NextModel;
284     }
285     model_iterator->NextModel = model;
286     model_iterator->NextModel->SetRate(rate);
287
288   }
289   return 0;
290 }
291
292 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
293
294 bool FGFDMExec::Run(void)
295 {
296   FGModel* model_iterator;
297
298   if (frozen) return true;
299
300   model_iterator = FirstModel;
301   if (model_iterator == 0L) return false;
302
303   if (Scripted) {                                              
304     RunScript();
305     if (State->Getsim_time() >= EndTime) return false;
306   }
307
308   if (debug_lvl & 4)
309     cout << "================== Frame: " << Frame << "  Time: "
310          << State->Getsim_time() << endl;
311
312   while (!model_iterator->Run()) {
313     model_iterator = model_iterator->NextModel;
314     if (model_iterator == 0L) break;
315   }
316
317   Frame++;
318   State->IncrTime();
319
320   return true;
321 }
322
323 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324
325 bool FGFDMExec::RunIC(FGInitialCondition *fgic)
326 {
327   State->Suspend();
328   State->Initialize(fgic);
329   Run();
330   State->Resume();
331   return true;
332 }
333
334 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335
336 bool FGFDMExec::LoadModel(string APath, string EPath, string model)
337 {
338   bool result = false;
339   
340   if (modelLoaded) {
341     DeAllocate();
342     Allocate();
343   }
344   
345   AircraftPath = APath;
346   EnginePath   = EPath;
347   result = Aircraft->LoadAircraft(AircraftPath, EnginePath, model);
348
349   if (result) {
350     modelLoaded = true;
351   } else {
352     cerr << fgred
353          << "FGFDMExec: Failed to load aircraft and/or engine model"
354          << fgdef << endl;
355   }
356
357   cout << "\n\nJSBSim startup complete\n\n";
358   return result;
359 }
360
361 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362
363 bool FGFDMExec::LoadScript(string script)
364 {
365   FGConfigFile Script(script);
366   string token="";
367   string aircraft="";
368   string initialize="";
369   bool result=false;
370   float dt=0.0;
371   struct condition *newCondition;
372
373   if (!Script.IsOpen()) return false;
374
375   Script.GetNextConfigLine();
376   ScriptName = Script.GetValue("name");
377   Scripted = true;
378   cout << "Reading Script File " << ScriptName << endl;
379
380   while (Script.GetNextConfigLine() != "EOF" && Script.GetValue() != "/runscript") {
381     token = Script.GetValue();
382     if (token == "use") {
383       if ((token = Script.GetValue("aircraft")) != "") {
384         aircraft = token;
385         cout << "  Use aircraft: " << token << endl;
386       } else if ((token = Script.GetValue("initialize")) != "") {
387         initialize = token;
388         cout << "  Use reset file: " << token << endl;
389       } else {
390         cerr << "Unknown 'use' keyword: \"" << token << "\"" << endl;
391       }
392     } else if (token == "run") {
393       StartTime = strtod(Script.GetValue("start").c_str(), NULL);
394       State->Setsim_time(StartTime);
395       EndTime   = strtod(Script.GetValue("end").c_str(), NULL);
396       dt        = strtod(Script.GetValue("dt").c_str(), NULL);
397       State->Setdt(dt);
398       Script.GetNextConfigLine();
399       token = Script.GetValue();
400       while (token != "/run") {
401
402         if (token == "when") {
403           Script.GetNextConfigLine();
404           token = Script.GetValue();
405           newCondition = new struct condition();
406           while (token != "/when") {
407             if (token == "parameter") {
408               newCondition->TestParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
409               newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
410               newCondition->Comparison.push_back(Script.GetValue("comparison"));
411             } else if (token == "set") {
412               newCondition->SetParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
413               newCondition->SetValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
414               newCondition->Triggered.push_back(false);
415               newCondition->OriginalValue.push_back(0.0);
416               newCondition->newValue.push_back(0.0);
417               newCondition->StartTime.push_back(0.0);
418               newCondition->EndTime.push_back(0.0);
419               string tempCompare = Script.GetValue("type");
420               if      (tempCompare == "FG_DELTA") newCondition->Type.push_back(FG_DELTA);
421               else if (tempCompare == "FG_BOOL")  newCondition->Type.push_back(FG_BOOL);
422               else if (tempCompare == "FG_VALUE") newCondition->Type.push_back(FG_VALUE);
423               else                                newCondition->Type.push_back((eType)0);
424               tempCompare = Script.GetValue("action");
425               if      (tempCompare == "FG_RAMP") newCondition->Action.push_back(FG_RAMP);
426               else if (tempCompare == "FG_STEP") newCondition->Action.push_back(FG_STEP);
427               else if (tempCompare == "FG_EXP")  newCondition->Action.push_back(FG_EXP);
428               else                               newCondition->Action.push_back((eAction)0);
429               
430               if (Script.GetValue("persistent") == "true")
431                 newCondition->Persistent.push_back(true);
432               else
433                 newCondition->Persistent.push_back(false);
434                 
435               newCondition->TC.push_back(strtod(Script.GetValue("tc").c_str(), NULL));
436               
437             } else {
438               cerr << "Unrecognized keyword in script file: \" [when] " << token << "\"" << endl;
439             }
440             Script.GetNextConfigLine();
441             token = Script.GetValue();
442           }
443           Conditions.push_back(*newCondition);
444           Script.GetNextConfigLine();
445           token = Script.GetValue();
446
447         } else {
448           cerr << "Error reading script file: expected \"when\", got \"" << token << "\"" << endl;
449         }
450
451       }
452     } else {
453       cerr << "Unrecognized keyword in script file: \"" << token << "\" [runscript] " << endl;
454     }
455   }
456
457   if (aircraft == "") {
458     cerr << "Aircraft file not loaded in script" << endl;
459     exit(-1);
460   }
461
462   // print out conditions for double-checking
463
464   vector <struct condition>::iterator iterConditions = Conditions.begin();
465
466   int count=0;
467
468   cout << "\n  Script goes from " << StartTime << " to " << EndTime
469        << " with dt = " << dt << endl << endl;
470
471   while (iterConditions < Conditions.end()) {
472     cout << "  Condition: " << count++ << endl;
473     cout << "    if (";
474
475     for (int i=0; i<iterConditions->TestValue.size(); i++) {
476       if (i>0) cout << " and" << endl << "        ";
477       cout << "(" << State->paramdef[iterConditions->TestParam[i]]
478                   << iterConditions->Comparison[i] << " "
479                   << iterConditions->TestValue[i] << ")";
480     }
481     cout << ") then {" << endl;
482
483     for (int i=0; i<iterConditions->SetValue.size(); i++) {
484       cout << "      set" << State->paramdef[iterConditions->SetParam[i]]
485            << "to " << iterConditions->SetValue[i];
486
487       switch (iterConditions->Type[i]) {
488       case FG_VALUE:
489         cout << " (constant";
490         break;
491       case FG_DELTA:
492         cout << " (delta";
493         break;
494       case FG_BOOL:
495         cout << " (boolean";
496         break;
497       default:
498         cout << " (unspecified type";
499       }
500
501       switch (iterConditions->Action[i]) {
502       case FG_RAMP:
503         cout << " via ramp";
504         break;
505       case FG_STEP:
506         cout << " via step";
507         break;
508       case FG_EXP:
509         cout << " via exponential approach";
510         break;
511       default:
512         cout << " via unspecified action";
513       }
514
515       if (!iterConditions->Persistent[i]) cout << endl
516                          << "                              once";
517       else cout << endl
518                          << "                              repeatedly";
519
520       if (iterConditions->Action[i] == FG_RAMP ||
521           iterConditions->Action[i] == FG_EXP) cout << endl
522                          << "                              with time constant "
523                          << iterConditions->TC[i];
524     }
525     cout << ")" << endl << "    }" << endl << endl;
526
527     iterConditions++;
528   }
529
530   cout << endl;
531
532   result = LoadModel("aircraft", "engine", aircraft);
533   if (!result) {
534     cerr << "Aircraft file " << aircraft << " was not found" << endl;
535           exit(-1);
536   }
537   if ( ! State->Reset("aircraft", aircraft, initialize))
538                  State->Initialize(2000,0,0,0,0,0,0.5,0.5,40000);
539
540   return true;
541 }
542
543 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
544
545 void FGFDMExec::RunScript(void)
546 {
547   vector <struct condition>::iterator iC = Conditions.begin();
548   bool truth;
549   bool WholeTruth;
550
551   int count=0;
552
553   float currentTime = State->Getsim_time();
554   float newSetValue;
555
556   while (iC < Conditions.end()) {
557     // determine whether the set of conditional tests for this condition equate
558     // to true
559     for (int i=0; i<iC->TestValue.size(); i++) {
560            if (iC->Comparison[i] == "lt")
561               truth = State->GetParameter(iC->TestParam[i]) <  iC->TestValue[i];
562       else if (iC->Comparison[i] == "le")
563               truth = State->GetParameter(iC->TestParam[i]) <= iC->TestValue[i];
564       else if (iC->Comparison[i] == "eq")
565               truth = State->GetParameter(iC->TestParam[i]) == iC->TestValue[i];
566       else if (iC->Comparison[i] == "ge")
567               truth = State->GetParameter(iC->TestParam[i]) >= iC->TestValue[i];
568       else if (iC->Comparison[i] == "gt")
569               truth = State->GetParameter(iC->TestParam[i]) >  iC->TestValue[i];
570       else if (iC->Comparison[i] == "ne")
571               truth = State->GetParameter(iC->TestParam[i]) != iC->TestValue[i];
572       else
573               cerr << "Bad comparison" << endl;
574
575       if (i == 0) WholeTruth = truth;
576       else        WholeTruth = WholeTruth && truth;
577
578       if (!truth && iC->Persistent[i] && iC->Triggered[i]) iC->Triggered[i] = false;
579     }
580
581     // if the conditions are true, do the setting of the desired parameters
582
583     if (WholeTruth) {
584       for (int i=0; i<iC->SetValue.size(); i++) {
585         if ( ! iC->Triggered[i]) {
586           iC->OriginalValue[i] = State->GetParameter(iC->SetParam[i]);
587           switch (iC->Type[i]) {
588           case FG_VALUE:
589             iC->newValue[i] = iC->SetValue[i];
590             break;
591           case FG_DELTA:
592             iC->newValue[i] = iC->OriginalValue[i] + iC->SetValue[i];
593             break;
594           case FG_BOOL:
595             break;
596           default:
597             cerr << "Invalid Type specified" << endl;
598             break;
599           }
600           iC->Triggered[i] = true;
601           iC->StartTime[i] = currentTime;
602         }
603
604         switch (iC->Action[i]) {
605         case FG_RAMP:
606           newSetValue = (currentTime - iC->StartTime[i])/(iC->TC[i])
607                       * (iC->newValue[i] - iC->OriginalValue[i]) + iC->OriginalValue[i];
608           if (newSetValue > iC->newValue[i]) newSetValue = iC->newValue[i];
609           break;
610         case FG_STEP:
611           newSetValue = iC->newValue[i];
612           break;
613         case FG_EXP:
614           newSetValue = (1 - exp(-(currentTime - iC->StartTime[i])/(iC->TC[i])))
615               * (iC->newValue[i] - iC->OriginalValue[i]) + iC->OriginalValue[i];
616           break;
617         default:
618           cerr << "Invalid Action specified" << endl;
619           break;
620         }
621         State->SetParameter(iC->SetParam[i], newSetValue);
622       }
623     }
624     iC++;
625   }
626 }
627
628 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629
630 void FGFDMExec::Debug(void)
631 {
632     //TODO: Add your source code here
633 }
634