JSBSim Engines

From FlightGear wiki
Revision as of 18:43, 13 October 2011 by Jentron (Talk | contribs)

Jump to: navigation, search

JSBSim provides a framework for aerodynamics. This page will attempt to explain how to create engines for the JSBSim framework. Engines also require thrusters.


FGPiston

Piston engine model. You enter values based on commonly available data and this model creates reasonable output values.

Configuration File Format

<?xml version="1.0"?> 
 <piston_engine name="{string}">
  <minmp unit="{INHG | PA | ATM}"> {number} </minmp>
  <maxmp unit="{INHG | PA | ATM}"> {number} </maxmp>
  <displacement unit="{IN3 | LTR | CC}"> {number} </displacement>
  <bore unit="{IN | M}"> {number} </bore> <!-- Unused -->
  <stroke unit="{IN | M}"> {number} </stroke>
  <cylinders> {number} </cylinders><!-- Unused -->
  <cylinder-head-mass unit="{KG | LBS}"> {number} </cylinder-head-mass> 
  <compression-ratio> {number} </compression-ratio>
  <sparkfaildrop> {number} </sparkfaildrop>
  <maxhp unit="{HP | WATTS}"> {number} </maxhp>
  <static-friction unit="{HP | WATTS}"> {number} </static-friction> <!-- Not installed yet -->
  <cycles> {number} </cycles> 
  <idlerpm> {number} </idlerpm>
  <maxrpm> {number} </maxrpm>
  <maxthrottle> {number} </maxthrottle> <!-- Deprecated / unused -->
  <minthrottle> {number} </minthrottle> <!-- Deprecated / unused -->
  <numboostspeeds> {number} </numboostspeeds>
  <boostoverride> {0 | 1} </boostoverride>
  <boostmanual> {0 | 1} </boostmanual>
  <ratedboost1 unit="{INHG | PA | ATM}"> {number} </ratedboost1>
  <ratedpower1 unit="{HP | WATTS}"> {number} </ratedpower1>
  <ratedrpm1> {number} </ratedrpm1>
  <ratedaltitude1 unit="{FT | M}"> {number} </ratedaltitude1>
 (repeat for speeds 2 and 3)
  <takeoffboost unit="{INHG | PA | ATM}"> {number} </takeoffboost>
 <!-- advanced tags! -->
  <bsfc unit="{LBS/HP*HR | KG/KW*HR}"> {number} </bsfc>
  <volumetric-efficiency> {number} </volumetric-efficiency>
  <air-intake-impedance-factor> {number} </air-intake-impedance-factor>
  <ram-air-factor> {number} </ram-air-factor>
  <cooling-factor> {number} </cooling-factor> 
 </piston_engine>

Parameter definitions

minmp this value is the nominal idle manifold pressure at sea-level without boost. Along with idlerpm, it determines the throttle response slope.
maxmp this value is the nomial maximum manifold pressure at sea-level without boost. Along with maxrpm it determines the resistance of the aircraft's intake system. See air-intake-impedance-factor
displacement this value is used to determine mass air and fuel flow which impacts engine power and cooling.
bore cylinder bore is currently unused.
stroke piston stroke is used to determine the mean piston speed. A longer stroke results in an engine that does not work as well at higher speeds.
cylinders number of cylinders scales the cylinder head mass.
cylinder-head-mass the nominal mass of a cylinder head. A larger value slows changes in engine temperature
compression-ratio the compression ratio affects the change in volumetric efficiency with altitude.
sparkfaildrop this is the percentage drop in horsepower for single magneto operation.
maxhp this value is the nominal power the engine creates at maxrpm. It will determine bsfc if that tag is not input. It also determines the starter motor power.
static-friction this value is the power required to turn an engine that is not running. Used to control and slow a windmilling propeller.
cycles Designate a 2 or 4 stroke engine. Currently only the 4 stroke engine is supported.
idlerpm this value affects the throttle fall off and the engine stops running if it is slowed below 80% of this value. The engine starts running when it reaches 80% of this value.
maxrpm this value is used to calculate air-box resistance and BSFC. It also affects oil pressure among other things.
maxthrottle Deprecated / unused
minthrottle Deprecated / unused
numboostspeed zero (or not present) for a naturally-aspirated engine, either 1, 2 or 3 for a boosted engine. This corresponds to the number of supercharger speeds. Merlin XII had 1 speed, Merlin 61 had 2, a late Griffon engine apparently had 3. No known engine more than 3, although some German engines apparently had a continuously variable-speed supercharger.
boostoverride unused
boostmanual whether a multispeed supercharger will manually or automatically shift boost speeds. On manual shifting the boost speeds is accomplished by controlling propulsion/engine/boostspeed
takeoffboost boost in psi above sea level ambient.
ratedboost[123] the absolute rated boost above sea level ambient (14.7 PSI, 29.92 inHg) for a given boost speed, in psi
ratedpower[123] unused
ratedrpm[123] The rpm at which rated boost is developed
ratedaltitude[123] The altitude up to which rated boost can be maintained. Up to this altitude the boost is maintained constant for a given throttle position by the BCV or wastegate. Beyond this altitude the manifold pressure must drop, since the supercharger is now at maximum unregulated output. The actual pressure multiplier of the supercharger system is calculated at initialisation from this value.
bsfc (Advanced) Indicated Specific Fuel Consumption. The power produced per unit of fuel. Higher numbers give worse fuel economy. This number may need to be lowered slightly from actual BSFC numbers because some internal engine losses are modeled separately.
volumetric-efficiency (Advanced) the nominal volumetric efficiency of the engine. Boosted engines require values above 1.
air-intake-impedance-factor (Advanced) this number is the pressure drop across the intake system. Increasing it reduces available manifold pressure.
ram-air-factor (Advanced) this number creates a pressure increase with an increase in dynamic pressure (aircraft speed).
cooling-factor (Advanced) this number models how efficient the aircraft cooling system is.

Notes

  • Intake & Throttle
    • The intake is modeled by <ram-air-factor>,<minmp>, <maxmp>, and <air-intake-impedance-factor>.
    • <ram-air-factor> is the efficiency of the air scoop intake. 0 turns ram air off. Default is 1. This value is exposed on the property tree so it may be altered at runtime to simulate alternate air, etc. The value can be calculated by (ambient pressure)/(desired pressure)-1 where desired pressure is full throttle at rated RPM.
    • <maxmp> is the maximum manifold pressure achievable. It is used for determining <BSFC> and <air-intake-impedance-factor> if a values are not supplied for those items.
    • <minmp> is used along with <idlerpm> to determine the slope of the throttle response
    • <air-intake-impedance-factor> is the fixed impedance in the air intake system. It is determined by <maxmp> if not supplied. This value is exposed on the property tree so it may be altered at runtime to simulate intake icing, alternate air, etc.
  • Boost
    • <boostmanual> whether a multispeed supercharger will manually or automatically shift boost speeds. On manual shifting the boost speeds is accomplished by controlling propulsion/engine/boostspeed
    • <takeoffboost> - Many aircraft had an extra boost setting beyond rated boost, but not totally uncontrolled as in the already mentioned boost-control-cutout, typically attained by pushing the throttle past a mechanical 'gate' preventing its inadvertant use. This was typically used for takeoff, and emergency situations, generally for not more than five minutes. This is a change in the boost control setting, not the actual supercharger speed, and so would only give extra power below the rated altitude. When TAKEOFFBOOST is specified in the config file (and is above RATEDBOOST1), then the throttle position is interpreted as:
      • 0 to 0.98 : idle manifold pressure to rated boost (where attainable)
      • 0.99, 1.0 : takeoff boost (where attainable).
      • A typical takeoff boost for an earlyish Merlin was about 12psi, compared with a rated boost of 9psi.
      • It is quite possible that other boost control settings could have been used on some aircraft, or that takeoff/extra boost could have activated by other means than pushing the throttle full forward through a gate, but this will suffice for now.
    • <ratedboost[123]> - the absolute rated boost above sea level ambient (14.7 PSI, 29.92 inHg) for a given boost speed, in psi. Eg the Merlin XII had a rated boost of 9psi, giving approximately 39inHg manifold pressure up to the rated altitude.
      • Note that <maxmp> is still the non-boosted max manifold pressure even for boosted engines - effectively this is simply a measure of the pressure drop through the fully open throttle.
    • <ratedaltitude[123]> - The altitude up to which rated boost can be maintained. Up to this altitude the boost is maintained constant for a given throttle position by the BCV or wastegate. Beyond this altitude the manifold pressure must drop, since the supercharger is now at maximum unregulated output. The actual pressure multiplier of the supercharger system is calculated at initialisation from this value.
    • <ratedpower[123]> - The power developed at rated boost at rated altitude at rated rpm.
    • <ratedrpm[123]> - The rpm at which rated power is developed.
  • Power production
    • <sparkfaildrop> is the amount of power you get for single magneto operation, try a value of 0.8 or so.
    • <volumetric-efficiency> controls how much air goes through the engine at a given RPM. Values below 1 for unboosted engines and values over 1 for boosted engines. This value is exposed on the property tree so it may be altered at runtime.
    • <bsfc> is the amount of power the engine produces per unit of fuel consumed. Use it to tune the power produced. This value is exposed on the property tree so it may be altered at runtime.
  • Cooling
    • <cylinder-head-mass> controls how fast the engine heats up and cools off. So if you have a '5-minute' limit on a power setting you can adjust this value so the engine just starts to overheat at the end of the given time frame.
    • <cooling-factor> controls how much 'air' flows over the engine to cool it. Raising the value makes the engine run cooler. This value is exposed on the property tree so it may be altered at runtime to simulate cowl flaps, for example.
  • Tuning
    • Using a constant speed load, set the engine model to full throttle and rated RPM.
    • Set <ram-air-factor> to zero.
    • Adjust <air-intake-impedance-factor> to achieve the proper static full throttle manifold pressure.
    • Increase airspeed to cruise and adjust <ram-air-factor> to achieve the proper dynamic full throttle manifold pressure.
    • Adjust <volumetric-efficiency> first to achieve desired fuel flow rate, leaning engine as required.
    • Adjust <bsfc> to achieve desired power.
    • Some piston engines will have power curves that will need to be altered from default depending on operating conditions. For example engines with multi-speed superchargers will produce less horse power on high speed at the same manifold pressure compared to low speed. Functions can be setup to alter <volumetric-efficiency> and <bsfc> at run time to get the power and fuel consumption curves correct by using different values for high and low supercharger speeds.

FGTurbine

The jet turbine engine

Configuration File Format

<?xml version="1.0"?> 
 <turbine_engine name="{string}">
  <milthrust unit="{LBS | N}"> {number} </milthrust>
  <maxthrust unit="{LBS | N}"> {number} </maxthrust>
  <bypassratio> {number} </bypassratio>
  <bleed> {number} </bleed>
  <tsfc> {number} </tsfc>
  <atsfc> {number} </atsfc>
  <idlen1> {number} </idlen1>
  <idlen2> {number} </idlen2>
  <maxn1> {number} </maxn1>
  <maxn2> {number} </maxn2>
  <augmented> {0 | 1} </augmented>
  <augmethod> {0 | 1 | 2} </augmethod>
  <injected> {0 | 1} </injected>
  <injection-time> {number} </injection-time>
  <function name="IdleThrust"> </function>
  <function name="MilThrust">  </function>
  <function name="AugThrust">  </function>
  <function name="Injection">  </function>
 </turbine_engine>

Parameter definitions

milthrust Maximum thrust, static, at sea level.
maxthrust Afterburning thrust, static, at sea level.
bypassratio Ratio of bypass air flow to core air flow.
bleed Thrust reduction factor due to losses (0.0 to 1.0).
tsfc Thrust-specific fuel consumption at cruise, lbm/hr/lbf
atsfc Afterburning TSFC, lbm/hr/lbf
idlen1 Fan rotor rpm (% of max) at idle
idlen2 Core rotor rpm (% of max) at idle
maxn1 Fan rotor rpm (% of max) at full throttle
maxn2 Core rotor rpm (% of max) at full throttle
augmented 0 = afterburner not installed
1 = afterburner installed
augmethod 0 = afterburner activated by property /engines/engine[n]/augmentation
1 = afterburner activated by pushing throttle above 99% position
2 = throttle range is expanded in the FCS, and values above 1.0 are afterburner range
injected 0 = Water injection not installed
1 = Water injection installed
injection-time Time, in seconds, of water injection duration
function Two functions, IdleThrust and MilThrust must always be defined. AugThrust is required for afterburning (reheated) engines. Injection is for water injected engines. These functions return a multiplier that is applied to the supplied static thrust values. In aeromatic configurations these functions are tables based on sonic velocity and air density

Notes

  • Bypass ratio is used only to estimate engine acceleration time. The effect of bypass ratio on engine efficiency is already included in the TSFC value. Feel free to set this parameter (even for turbojets) to whatever value gives a desired spool-up rate. Default value is 0.
  • The bleed factor is multiplied by thrust to give a resulting thrust after losses. This can represent losses due to bleed, or any other cause. Default value is 0. A common value would be 0.04.
  • Nozzle position, for variable area exhaust nozzles, is provided for users needing to drive a nozzle gauge or animate a virtual nozzle.
  • This model can only be used with the "direct" thruster. See the file: /engine/direct.xml
  • TSFC=fuel consumption per hour/thrust
  • There is a Java program here to calculate thrust vs airspeed and altitude. http://adg.stanford.edu/aa241/propulsion/engmodel.html

FGTurboprop

The turboprop engine

Configuration File Format

<?xml version="1.0"?>

Parameter definitions

milthrust [LBS]
idlen1 [%]
maxn1 [%]
betarangeend[%] if ThrottleCmd < betarangeend/100.0 then engine power=idle, propeller pitch is controled by ThrottleCmd (between MINPITCH and REVERSEPITCH).
if ThrottleCmd > betarangeend/100.0 then engine power increases up to max reverse power reversemaxpower [%] max engine power in reverse mode
maxpower [HP]
psfc power specific fuel consumption [pph/HP] for N1=100%
n1idle_max_delay [-] time constant for N1 change
maxstartenginetime [sec] after this time the automatic starting cycle is interrupted when the engine doesn't start (0=automatic starting not present)
startern1 [%] when starting starter spin up engine to this spin
ielumaxtorque [lb.ft] if torque>ielumaxtorque limiters decrease the throttle (ielu = Integrated Electronic Limiter Unit)
itt_delay [-] time constant for ITT change (ITT = Inter Turbine Temperature)

FGRocket

The rocket engine

Configuration File Format

<?xml version="1.0"?> 
<rocket_engine name="{string}">
  <isp> {number} </isp>
  <builduptime> {number} </builduptime>
  <maxthrottle> {number} </maxthrottle>
  <minthrottle> {number} </minthrottle>
  <slfuelflowmax> {number} </slfuelflowmax>
  <sloxiflowmax>  {number} </sloxiflowmax>
  <variation>
    <thrust> {number} </thrust>
    <total_isp> {number} </total_isp>
  </variation> 
  <thrust_table name="propulsion/thrust_prop_remain" type="internal">
    <tableData>
      {number} {number}
	...
      {number} {number}
    </tableData>
  </thrust_table>
</rocket_engine>

FGElectric

Simple thrust producer. You enter the max power as <power unit="WATTS"> and the engine model produces throttle_setting*power watts of output.

  • Enter the max power as <power unit="WATTS"> and the engine model produces throttle_setting*power watts of output.

Configuration File Format

<?xml version="1.0"?> 
<electric_engine name="{string}">
 <power unit="{HP | WATTS}"> {number} </power>
</electric_engine>

Notes

FGElectric models an electric motor based on the configuration file <power> parameter. The throttle controls motor output linearly from zero to <power>. This power value (converted internally to horsepower) is then used by FGPropeller to apply torque to the propeller. At present there is no battery model available, so this motor does not consume any energy. There is no internal friction.

Sources