Hi Scott,
More than one fuel tank with fuel in it at startup ?
If that's the case, you want to set priorities, with lower being the first
tanks to empty.
it's done with <priority> tags in the tank definition in the jsb config
file.
Or set all tanks but one to 0 content and then fill them up after start up.
That should fix the loop for the time being,
Cheers,
Nic
On Wed, Oct 14, 2009 at 8:56 AM, Scott Hamilton <
scott.hamil...@popplanet.biz> wrote:

>
>
>    I've noticed that a lot of JSBsim files got updated just the other day,
> and today was the first time I've had
>    a chance to try it out.
>
>    I'm working on the A380 which does use JSBsim, and during the engine
> start everything freezes just after
>    the starter is turned false, the ignition is true and the cutoff is
> turned false. This is around N2 = 27%
>
>    Fortunately I had compiled everything with debug, so a quick look in gdb
> reveals at stacktrace (on interrupt signal)
>
> #0  0x000000000068aeb8 in JSBSim::FGTank::Drain (this=0xc4829a0,
> used=1.0180511166896056e-315) at FGTank.cpp:196
> #1  0x000000000066640f in JSBSim::FGEngine::ConsumeFuel (this=0xc47d4c0) at
> FGEngine.cpp:212
> #2  0x00000000006945aa in JSBSim::FGTurbine::Start (this=0xc47d4c0) at
> FGTurbine.cpp:290
> #3  0x0000000000699d61 in JSBSim::FGTurbine::Calculate (this=0xc47d4c0) at
> FGTurbine.cpp:155
> #4  0x00000000006069c4 in JSBSim::FGPropulsion::Run (this=0xbdf8550) at
> FGPropulsion.cpp:147
> #5  0x00000000005670bc in JSBSim::FGFDMExec::Run (this=0xc573220) at
> FGFDMExec.cpp:362
> #6  0x000000000055949d in FGJSBsim::update (this=0xc413fb0,
> dt=0.041666666666666664) at JSBSim.cxx:487
> #7  0x0000000000435ec8 in fgUpdateTimeDepCalcs () at main.cxx:159
> #8  0x00000000004371df in fgMainLoop () at main.cxx:449
> #9  0x000000000049e1ac in fgOSMainLoop () at fg_os_osgviewer.cxx:172
> #10 0x0000000000433e07 in fgMainInit (argc=9, argv=0x7fffffffda58) at
> main.cxx:900
> #11 0x00000000004332e1 in main (argc=9, argv=0x7fffffffda58) at
> bootstrap.cxx:228
>
>
> 196     double FGTank::Drain(double used)
> 197     {
> 198       double remaining = Contents - used;
> 199
> 200       if (remaining >= 0) { // Reduce contents by amount used.
> 201
> 202         Contents -= used;
> 203         PctFull = 100.0*Contents/Capacity;
> 204
>
> the value for 'used' is 0   (which doesn't seem right)
> the values for 'Contents' and 'remaining' are > 0 (they are correct values)
> 'Drain' is called for each tank
>
> It seems this loop in FGEngine.cpp is executed repeatedly with no way out;
>
> 183       while (FuelToBurn > 0.0) {
> 184
> 185         // Count how many fuel tanks with the current priority level
> have fuel.
> 186         // If none, then try next lower priority.  Build the feed
> list.
> 187         while ((TanksWithFuel == 0.0) && (CurrentPriority <=
> Propulsion->GetNumTanks())) {
> 188           for (i=0; i<Propulsion->GetNumTanks(); i++)
> {
> 189             Tank =
> Propulsion->GetTank(i);
> 190             if (Tank->GetType() == FGTank::ttFUEL)
> {
> 191               if ((Tank->GetContents() > 0.0) && ((unsigned
> int)Tank->GetPriority() == CurrentPriority)) {
> 192                  ++TanksWithFuel;
> 193                  FeedList.push_back(i);
> 194                }
> 195             } else {
> 196                cerr << "No oxidizer tanks should be used for this
> engine type." << endl;
> 197             }
> 198           }
> 199           if (TanksWithFuel == 0.0) CurrentPriority++;
> 200         }
> 201
> 202         // No fuel found at any priority!
> 203         if (TanksWithFuel == 0.0) {
> 204           Starved = true;
> 205           return;
> 206         }
> 207
> 208         // Remove equal amount of fuel from each feed tank.
> 209         FuelNeeded = FuelToBurn/TanksWithFuel;
> 210         for (i=0; i<FeedList.size(); i++) {
> 211           Tank = Propulsion->GetTank(FeedList[i]);
> 212           Tank->Drain(FuelNeeded);
> 213           FuelToBurn -= FuelNeeded;
> 214         }
> 215
> 216         // check if we were not able to burn all the fuel we needed to
> at this priority level
> 217         if (FuelToBurn > 0.001) {
>
>
> The value of FuelToBurn is  = 1.4821969375237396e-323
> The value of CurrentPriority = 1 and never changes.
> once I step past line 217, it goes back to line 183 and never seems to
> stop.
>
>
> I'm not a C++ coder, and not much of a gdb debugger, but I hope that helps
> enough if someone else is seeing similar problems.
>     Scott.
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
>


-- 
Be Kind.
Remember, everyone is fighting a hard battle.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to