Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-17 Thread Erik Hofman
David Megginson wrote:

Julian Foad writes:

  Ah, glad you're there.  If you're interested and have time to look, my 
  current attempt is at
  
 http://www.btinternet.com/~julianfoad/fgfs/JSB_piston_engine.diff
 http://www.btinternet.com/~julianfoad/fgfs/engine_sound.diff

What's the current status of these?  Are the people who work with
sound in general agreement that they're a good thing?

I've looked at the sound stuff, but without a proper explanation I see 
no need to apply it. Even worse, it doesn't seem to work without some 
code changes.

Erik


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-17 Thread Julian Foad
David Megginson wrote:

Julian Foad writes:

  Ah, glad you're there.  If you're interested and have time to look, my 
  current attempt is at
  
 http://www.btinternet.com/~julianfoad/fgfs/JSB_piston_engine.diff
 http://www.btinternet.com/~julianfoad/fgfs/engine_sound.diff

What's the current status of these?

They're only ideas in progress, and are not right.  Please don't put 
them in CVS as they are.

- Julian



___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-16 Thread David Megginson
Julian Foad writes:

  Ah, glad you're there.  If you're interested and have time to look, my 
  current attempt is at
  
 http://www.btinternet.com/~julianfoad/fgfs/JSB_piston_engine.diff
 http://www.btinternet.com/~julianfoad/fgfs/engine_sound.diff

What's the current status of these?  Are the people who work with
sound in general agreement that they're a good thing?


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-12 Thread Julian Foad
David Luff wrote:


It looks to me like you've
got 2 too many curly brackets in doEnginePower, although I could be
misunderstanding what you're doing there.


Yes, I have got too many.  This is the friction that was applied only 
when starting; I was making it permanent but haven't finished with it. 
Do you agree that it should be permanently in?  Does a constant torque 
sound about right?  That sounds more likely than constant power (which 
means decreasing torque), to me.  Conventional friction would give 
constant torque; I'm not sure how oil and air viscosity behave, but I'd 
expect the torque to increase at higher speeds rather than decrease.

I don't understand how it could have worked with no resistance 
implemented.  A propeller hardly provides any resistance at low speeds, 
so I would have thought you would have needed to tweak the developed 
power down to almost zero at idle.


 What I am concerned about is the throttle minimum being set to 0.2. ...


Ah, thank you for explaining this.  I had not understood the mapping 
onto manifold pressure and the power correlation.  It certainly sounds 
like the power correlation is the thing to un-tweak instead!


This puzzled me: the manifold pressure seems to be modelled as (for a 
given throttle position) independent of speed.  When a real engine is 
running fast and you cut the throttle, the fast air flow will cause a 
very low manifold pressure which will then rise to its new steady value 
as the engine slows down.  Without this effect, throttle changes will 
not take effect as quickly as they should and the speed variation with 
load changes will not be right.  Maybe the effect is too small to be 
important?


I might be attempting too much here; I know how car engines work but 
don't have data to work from (or a lab), and I don't have experience of 
modelling them either.  I will tread carefully and check with you again 
when I make some more progress.


- Julian


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-11 Thread Julian Foad
David Luff wrote:

On 11/10/02 at 4:02 AM Julian Foad wrote:

Ah yes, starting, I seem to recall a lot of hacking and kludging to get
everything to work :-)  There's a number of problems currently:


...


Have fun :-)


Ah, glad you're there.  If you're interested and have time to look, my 
current attempt is at

  http://www.btinternet.com/~julianfoad/fgfs/JSB_piston_engine.diff
  http://www.btinternet.com/~julianfoad/fgfs/engine_sound.diff

but, as I said, not finished.  (Well, it will never be finished.  I 
mean not completely satisfactory as a patch yet.)  It removes some of 
the arbitrary bits - especially the non-linear bits like if RPM  N 
then ... - and makes starting and idling nicer (especially at throttle 
less than the minimum allowed idle setting - it was fun running it below 
500 RPM, on the unstable side of its power curve, after I put the 
friction always present but before I put the idle adjust constant in 
there).

- Julian


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-10 Thread David Megginson
Julian Foad writes:

  Well, I suppose it needs someone to show how the two aims can be 
  compatible.  But it's not easy; it would require becoming familiar with 
  both implementations and re-arranging the interfaces a bit.  While 
  that's the sort of thing I do at work, I'm not yet in a position to do 
  it here.

We can already override parts of JSBSim's internal implementation
(such as its weather model).  There's no reason we couldn't rig up
JSBSim and YASim to take engine parameters from properties as well.
The engine model needs basic information like fuel available, outside
air temperature and humidity, static and dynamic pressure, etc., all
of which are accessible from outside the FDMs.  It would have to feed
back fuel and oil consumption, location and direction of thrust,
amount of thrust, and information about gyroscopic effects.

  3. The engine revs up and slows down very slowly.  For example, when I 
  cut the magnetos from 2000 RPM it takes over a minute to run down and 
  stop.

At a certain point, friction should take over.  I added a kludge in
JSBSim to make that happen.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-10 Thread David Megginson
Andy Ross writes:

  I'd *love* to see good numbers for propeller acceleration, however.
  If one of the Real Pilots out there could go out with a stopwatch and
  get us graphs of RPM vs. time for full throttle acceleration and
  cut-power deceleration I'd be eternally grateful. :)

I don't want to get banned from the flying club (or demonstrate my
limited forced-landing skills), so I'm not going to abuse the engines
by jamming the throttle in hard to full from idle and timing it.  Here
are some unofficial observations, however, from various 172's:

1. The prop accelerates and decelerates very quickly.  You're supposed
   to move the throttle smoothly so that the changes don't happen too
   quickly.

2. During runup, I push the throttle in from 1000RPM to 1700RPM --
   the lag between throttle movement and tach indication is barely
   perceptable (under 0.25 sec).

3. Next, I pull the throttle from 1700RPM to idle.  The drop on the
   tach from 1700RPM to about 600RPM is nearly instantaneous (again,
   under 0.25sec).

4. At shutdown, I set the engine to 1000RPM, then pull the mixture to
   shut it down.  The engine continues to fire for a couple of seconds
   until it burns off all its fuel, but once it stops firing, the
   propeller stops in well under a second.

During takeoff, I have other things to worry about, but I'll guess
that the lag between 1000RPM and max static (2200-2400RPM) takes less
than 0.5sec, possibly again less than 0.25sec.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-09 Thread Julian Foad
David Megginson wrote:


I like the idea as well: it would be nice if the engine were its own
subsystem and we could mix-and-match engines and FDMs (let's try the
J3 cub with 180HP).  Unfortunately, the FDM people haven't been too
enthusiastic: in particular, JSBSim is supposed to run standalone as
well as inside FlightGear, so they need some kind of internal engine
model.


Well, I suppose it needs someone to show how the two aims can be 
compatible.  But it's not easy; it would require becoming familiar with 
both implementations and re-arranging the interfaces a bit.  While 
that's the sort of thing I do at work, I'm not yet in a position to do 
it here.


As for the guts of how the engines are modelled ... I first worked on 
the starting and stopping behaviour of the JSBsim engine.  The 
thermodynamic model of the engine is probably very good but there's lots 
of yucky stuff there to do with starting etc.  I've done some stuff 
there, and in the sound configuration, but not finished.  I'll go into 
that later.

Then I looked at the YASim piston engine to see how that handles 
starting.  Before I try to do anything in there I want to ask about some 
things (Andy?):

1. PistonEngine::calc says

// Calculate manifold pressure as ambient pressure modified for
// turbocharging and reduced by the throttle setting.  According
// to Dave Luff, minimum throttle at sea level corresponds to 6
// manifold pressure.  Assume that this means that minimum MP is
// always 20% of ambient pressure. (But that's too much idle
// power, so use 10% instead!) But we need to produce _zero_
// thrust at that setting, so hold onto the output value
// separately.  Ick.
_mp = pressure * (1 + _boost*(_turbo-1)); // turbocharger
float mp = _mp * (0.1f + 0.9f * _throttle); // throttle
_mp *= _throttle;

What's that bit about the separate output mp?  An engine doesn't 
produce zero thrust at idle, just a low
thrust.  And manifold pressure isn't supposed to be related to thrust in 
a simple way, is it?

Sorry to peer into a nasty bit.  The beauty of Open Source is ... we can 
see the whole thing, warts and all! :-)

2. At the end of the same function,

_egt = corr * (power * 1.1f) / (massFlow * specHeat);
if(_egt  temp) _egt = temp;

When I'm running this at idle, _egt comes out at 80 (kelvin); presumably 
this should be added to ambient temp (which is 288) rather than 
clamped to it:

_egt = corr * (power * 1.1f) / (massFlow * specHeat);
_egt += temp;

3. The engine revs up and slows down very slowly.  For example, when I 
cut the magnetos from 2000 RPM it takes over a minute to run down and 
stop.  There is a negative torque added that should make it stop 
quickly, and I can't see what's wrong with it (that would have this 
effect).  Actually, as acceleration of the engine is equally slow, 
perhaps the problem is in the transfer of the torque to the external 
propulsion system code - perhaps the wrong units?

4. That negative torque: Interpolate it away as we approach cruise 
RPMs, though, to prevent interaction with the power computations. 
Ugly.  Actually, the only way the variable power is used after that 
point is to compute the EGT, and that wants to know thermally developed 
power anyway (i.e. excluding the starter motor contribution and the 
friction reduction) so that should be fine.  I think it would be correct 
to subtract the torque loss at all speeds - in fact, more loss at higher 
speeds because of gas flow turbulence etc.

By the way, the experimental values here were with j3cub-yasim because 
c172-yasim gives a solution failure for elevator.  I have some local 
changes, but nothing in YASim or anything that I think could affect it - 
just in the JSBSim engine, sound handling, joystick, etc.


For all this, my original aim was just to get simple things like a 
realistic cranking speed of about 100 RPM, and some rotation sound while 
the engine is spinning down after being switched off!

- Julian



___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] Engine models: start-up and commonality betweenFDMs

2002-11-09 Thread Andy Ross
Julian Foad wrote:
 David Megginson wrote:
  it would be nice if the engine were its own subsystem and we could
  mix-and-match engines and FDMs

 Well, I suppose it needs someone to show how the two aims can be
 compatible.  But it's not easy; it would require becoming familiar
 with both implementations and re-arranging the interfaces a bit.

Well, for the record, I think this is a great idea.  It really
wouldn't be hard at all to wire up an interface between YASim's
Thruster class and an external engine/propeller representation.

 What's that bit about the separate output mp?  An engine doesn't
 produce zero thrust at idle, just a low thrust.  And manifold
 pressure isn't supposed to be related to thrust in a simple way, is
 it?

I should have written power instead of thrust, of course.  The real
point is that the output power of an ideal engine at peak mixture is
proportional to the mass input, which is proportional to the product
of RPM and manifold pressure.  So an ideal engine will produce zero
power only at zero MP.

...which is ridiculous, of course.  In the real world, engines have a
minimum MP when the throttle is at idle, and produce near-zero usable
power at that MP.  This is because of all kinds of complicated
internal losses (pressure drop across the intake valves, internal
friction, you name it...).  I couldn't simply assume that an engine
that produced 200 HP at 29 inches of MP would produce 41 HP (6/29 of
200) at idle; nor could I come up with a good/broad/general
thermodynamic argument for what those losses should be.

However, I had an empirical number from Dave Luff that engines idle at
about 6 inches.  So I cheated and interpolated from that point
instead. :)

 When I'm running this at idle, _egt comes out at 80 (kelvin);
 presumably this should be added to ambient temp (which is 288)
 rather than clamped to it:

That sounds like a bug.  I'd have to look more carefully at the
physics to be sure.  But adding the temperature to ambient is almost
guaranteed to be wrong.  There are exactly zero adiabatic processes
that are symmetric with change of temperature; that's what the second
law of thermodynamics is all about.  More likely, I'm converting the
units incorrectly or using a miscalibrated value for power due to the
hack above.

 3. The engine revs up and slows down very slowly.  For example, when I
 cut the magnetos from 2000 RPM it takes over a minute to run down
 and stop.

One issue is that the moment of inertia for the Cub looks too big.
The current value is the same as the one for the 172, which has a
larger prop.  All other things being equal, it should scale with the
mass of the propeller; I'd try a value about half of the Cessna's.
This will result in too much stored energy in the prop that has to be
dissipated, and thus a longer run-down (and run-up) time.

You could also try increasing the 10% of cruise torque value that
gets used for internal friction.  I don't have any good numbers for
what is appropriate, so I guessed.  This is the kind of value that
could/should be made tunable via configuration.

I'd *love* to see good numbers for propeller acceleration, however.
If one of the Real Pilots out there could go out with a stopwatch and
get us graphs of RPM vs. time for full throttle acceleration and
cut-power deceleration I'd be eternally grateful. :)

 4. That negative torque: Interpolate it away as we approach cruise
 RPMs, though, to prevent interaction with the power
 computations. Ugly. Actually, the only way the variable power is
 used after that point is to compute the EGT, and that wants to know
 thermally developed power anyway (i.e. excluding the starter motor
 contribution and the friction reduction) so that should be fine.

The engine power numbers are also used to handle the propeller
solution too.  My thinking here appears to have been that I didn't
want an extra value interfering with the solver in funny ways.  It's
possible that all the changes cancel out later; just realize that the
numbers get used outside the function, too.

 By the way, the experimental values here were with j3cub-yasim
 because c172-yasim gives a solution failure for elevator.

Oh dear, is there another solver issue?  This works fine for me.  Are
you absolutely sure you have current YASim code and base package?
Platform/compiler?  This is the solution result that I see:

YASim solution results:
   Iterations: 362
 Drag Coefficient: 18.0245
   Lift Ratio: 90.6643
   Cruise AoA: -0.131865
   Tail Incidence: 0.582091
Approach Elevator: -0.920007
CG: -2.404, -0.033, 0.218

 For all this, my original aim was just to get simple things like a
 realistic cranking speed of about 100 RPM, and some rotation sound
 while the engine is spinning down after being switched off!

The sound issue is trivial -- just have one sound for the propeller
noise that scales with RPM, and another for engine noise that is
gated on /engines[0]/running.  The realistic cranking speed is just a