I wrote

> Sent: 25 July 2004 22:32
> To: 'FlightGear developers discussions'
> Subject: RE: [Flightgear-devel] Tried the Spitfire
> Andy Ross wrote
> > Sent: 25 July 2004 21:07
> > To: FlightGear developers discussions
> > Subject: Re: [Flightgear-devel] Tried the Spitfire
> >
> > Vivian Meazza wrote:
> > > I'm just working on the fuel gauge for the Spitfire, when I
> > > ralised that I haven't modeled the fuel system correctly. At
> > > present both tanks feed into the engine. What should happen is
> > > that the upper tank feeds the lower tank which feeds the
> > > engine. Is there any built-in way of doing this?
> >
> > One way to do this is to always make sure the lower tank is
> > selected, and the uper one is not.  Then have a Nasal timer fire
> > at some sane frequency (mayby 5Hz) or whatnot that takes fuel out
> > of the top tank and adds it to the bottom one according to the
> > current pump configuration.
> >
> > It's not hard, really.  You can look at the existing fuel.nas
> > code for examples.  The only gotcha I can think of is that the
> > frame rate isn't constant: you want to use the time-elapsed
> > property to calculate the amount of fuel to transfer, instead of
> > assuming a constant amount per iteration.
> >
> Thanks Andy. I have already put together a Nasal script, using fuel.nas as
> a
> model. It wasn't hard, once I had figured out how to make it re-iterate.
> Nasal is a delight to use: doing exactly what we want.
> The script tries to model the fuel system. Both tanks are connected to the
> engine, and there is an open pipe connecting them, so fuel is transferred
> from the upper to the lower whenever there is room in the latter until the
> former is empty. So good so far - that bit works. The gotcha is that the
> engine stops when either tank is empty, rather than when there is no fuel
> in
> any tank. I can't see a way around that without tinkering with the logic
> of
> fuel.nas. That said, the logic of fuel does seem a little odd. Have I got
> my
> analysis of the logic wrong? Where is "kill-when-empty" set? I can easily
> adjust fuel.nas to work for the Spitfire, but of course I don't want to
> rot
> up any other model. How to proceed?

I think that something is going wrong in the fuel.nas script.

At line 72 kill-when-empty is being set to true for tank[0] on the first
pass through after it runs out of fuel, thus setting out-of-fuel to true and
stopping the engine. I don't think that this is intended in the script,
despite the comment at line 53!

I attach a revised script which stops this happening, but I had to resort to
some pretty inelegant programming to do it. Is this a NASAL bug, or
something local?



Attachment: fuel.nas
Description: Binary data

Flightgear-devel mailing list

Reply via email to