Project Air Breathing Turbojet Engine Model for Orbiter

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
Model behaves appropriately with altitude. At Mach = 0.82 I got the following thrusts at full throttle without afterburner:

1 km 43.26 kN
5 km 38.27 kN
10 km 27.11 kN
12.5 km 19.78 kN

This is definitely going to put a service ceiling on whatever aircraft uses this engine in Orbiter. It would be possible to determine a flame-out condition and shut the engine off, but even without it the thrust simply disappears with altitude.
 
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
More data:

SNECMA_M53_P2_Sea_Level_Model_Data.jpg
Here is a map of engine thrust while stationary at sea level.

Note how the thrust isn't linear with throttle setting. Unlike rocket engines where the throttle directly controls the reaction mass, in jet engines the reaction mass is also dependent on flight conditions (Mach number, pressure, and temperature).

To implement this in the existing Orbiter thruster framework will require two thruster definitions - one dummy thruster to take the user-input throttle level, which is then used to calculate thrust and variable Isp in the jet engine model, which are then passed to a second thruster that actually provides the thrust using SetThrusterLevel and SetThrusterIsp.
SNECMA_M53_P2_10km_Mach_0_5_Model_Data.jpg
Here is a map of engine thrust at 10 km and Mach 0.5

This shows the variation in thrust with altitude and Mach number compared to sea level thrust.
SNECMA_M53_P2_5km_FT_Model_Data.jpg
Here is a map of engine thrust at 5 km at full throttle without afterburner at varying Mach number.

This shows the variation in thrust with flight Mach number.

Thrust decreases because it is equal to the change in momentum of the mass of air passing through the engine. As velocity increases, the inlet momentum increases and decreases the overall thrust.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
1657746292217.png

Got Kev33's Mirage2000 to compile and load into Orbiter 2016! If anyone knows where Kev33 (Kevin Shanow IIRC) is, I need to get permission from him to use his meshes and animations before possibly releasing this as an add-on to the public.

Now to code in my engine model, tie it to the thrusters, and maybe we can fly this jet with its proper engine!
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,272
Reaction score
3,244
Points
203
Location
Toulouse
Ask @asbjos, he updated the T-38 from Kev's meshes, maybe he has his e-mail.
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,272
Reaction score
3,244
Points
203
Location
Toulouse
Well, without more details it can be a lot of things. A mesh with a meshgroup that has only 1 vertex will crash Orbiter (sometimes, not always). Of course it can be the code too.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
I got Kev's cleaned code to compile and the addon ran fine in Orbiter. Something in the implementation of the jet engine code is awry.

EDIT: I wonder if Orbiter is happy with a dummy propellant tank with no fuel, or a thruster with 0 thrust. Hmmm...
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,272
Reaction score
3,244
Points
203
Location
Toulouse
I got Kev's cleaned code to compile and the addon ran fine in Orbiter. Something in the implementation of the jet engine code is awry.

EDIT: I wonder if Orbiter is happy with a dummy propellant tank with no fuel, or a thruster with 0 thrust. Hmmm...

Yeah, careful generating equations that divide stuff by zero, computers don't like that...
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
EDIT: I wonder if Orbiter is happy with a dummy propellant tank with no fuel, or a thruster with 0 thrust. Hmmm...

Just read martins fine API documentation.... You can create a thruster with NULL as propellant resource for disabling the thruster.

If no propellant resource is specified, the thruster is disabled until it is linked to a resource by SetThrusterResource().
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
It seems that there is some problem with the tanks, but more with their handle declarations. I'm still learning how C++ code needs to be organized and I suspect something is not in the correct location.

Just read martins fine API documentation.... You can create a thruster with NULL as propellant resource for disabling the thruster.

EDIT: In fact I am now getting this:

Error C2660 'VESSEL::CreatePropellantResource': function does not take 0 arguments

for this code:

dummy_fuel_tank = CreatePropellantResource(); //no fuel

It only compiles if I have a value in the argument. But even if I do this and get it to compile this line is where the crash occurs. I'm not seeing what the issue as the main tank and thruster implementation seems to do fine.
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Allow me to kidnap you for a tour inside the brain of a C++ coder. When I am confused about the signature of a function (What the Error C2660 tells me), I look it up:

  1. CTRL + Left click on VesselAPI.h or open it manually in your project.
  2. In the center drop down menu at the top of the editor view, which should say something like "Global scope", you select VESSEL
  3. In the right drop down menu there, you scroll along or type the first letters of CreatePropellantResource and select it.
  4. Now you should read this one, including the doxygen comment on top:
C++:
/// \name Fuel management
    //@{
    /**
     * \brief Create a new propellant resource ("fuel tank")
     *
     * Propellant resources are a component of the vessel's propulsion
     * system. They can hold propellants and distribute them to connected
     * engines to generate thrust.
     * \param maxmass maximum propellant capacity of the tank [kg]
     * \param mass initial propellant mass of the resource [kg]
     * \param efficiency fuel efficiency factor (>0)
     * \return propellant resource handle
     * \note Orbiter doesn't distinguish between propellant and oxidant. A
     *   "propellant resource" is assumed to be a combination of fuel and
     *   oxidant resources.
     * \note The interpretation of a propellant resource (liquid or solid
     *   propulsion system, ion drive, etc.) is up to the vessel developer.
     * \note The rate of fuel consumption depends on the thrust level and
     *   Isp (fuel-specific impulse) of the thrusters attached to the
     *   resource.
     * \note The fuel efficiency rating, together with a thruster's Isp
     *   rating, determines how much fuel is consumed per second to obtain a
     *   given thrust: \f$R = F (e \cdot Isp)^{-1}\f$ with fuel rate R
     *   [kg/s], thrust F [N], efficiency e and fuel-specific impulse Isp
     *   [m/s].
     * \note If mass < 0 then mass = maxmass is substituted.
     * \sa DelPropellantResource, SetPropellantMaxMass, SetPropellantMass,
     *   SetPropellantEfficiency, GetPropellantMaxMass, GetPropellantMass,
     *   GetPropellantEfficiency
     */
    PROPELLANT_HANDLE CreatePropellantResource (double maxmass, double mass=-1.0, double efficiency=1.0) const;

So, as you can see, the first parameter maxmass is mandatory and can't be omitted, while the other two have a default value and can be left away.

So, with that knowledge, you can now decide that your small dummy fuel tank needs a maximum mass parameter.

I don't know what happens if you enter 0.0. Maybe you accidentially create a black hole. Or a division by zero error.

But you are allowed to enter the upper bound for the mass of a hypothetical graviton particle: 8.9E-59 ...............
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
Allow me to kidnap you for a tour inside the brain of a C++ coder. When I am confused about the signature of a function (What the Error C2660 tells me), I look it up:

  1. CTRL + Left click on VesselAPI.h or open it manually in your project.
  2. In the center drop down menu at the top of the editor view, which should say something like "Global scope", you select VESSEL
  3. In the right drop down menu there, you scroll along or type the first letters of CreatePropellantResource and select it.
  4. Now you should read this one, including the doxygen comment on top:
C++:
/// \name Fuel management
    //@{
    /**
     * \brief Create a new propellant resource ("fuel tank")
     *
     * Propellant resources are a component of the vessel's propulsion
     * system. They can hold propellants and distribute them to connected
     * engines to generate thrust.
     * \param maxmass maximum propellant capacity of the tank [kg]
     * \param mass initial propellant mass of the resource [kg]
     * \param efficiency fuel efficiency factor (>0)
     * \return propellant resource handle
     * \note Orbiter doesn't distinguish between propellant and oxidant. A
     *   "propellant resource" is assumed to be a combination of fuel and
     *   oxidant resources.
     * \note The interpretation of a propellant resource (liquid or solid
     *   propulsion system, ion drive, etc.) is up to the vessel developer.
     * \note The rate of fuel consumption depends on the thrust level and
     *   Isp (fuel-specific impulse) of the thrusters attached to the
     *   resource.
     * \note The fuel efficiency rating, together with a thruster's Isp
     *   rating, determines how much fuel is consumed per second to obtain a
     *   given thrust: \f$R = F (e \cdot Isp)^{-1}\f$ with fuel rate R
     *   [kg/s], thrust F [N], efficiency e and fuel-specific impulse Isp
     *   [m/s].
     * \note If mass < 0 then mass = maxmass is substituted.
     * \sa DelPropellantResource, SetPropellantMaxMass, SetPropellantMass,
     *   SetPropellantEfficiency, GetPropellantMaxMass, GetPropellantMass,
     *   GetPropellantEfficiency
     */
    PROPELLANT_HANDLE CreatePropellantResource (double maxmass, double mass=-1.0, double efficiency=1.0) const;

So, as you can see, the first parameter maxmass is mandatory and can't be omitted, while the other two have a default value and can be left away.

So, with that knowledge, you can now decide that your small dummy fuel tank needs a maximum mass parameter.

I don't know what happens if you enter 0.0. Maybe you accidentially create a black hole. Or a division by zero error.

But you are allowed to enter the upper bound for the mass of a hypothetical graviton particle: 8.9E-59 ...............
I've also tried setting the argument to a higher value and it makes no difference. I may be misinterpreting the debugger.

I'm getting this now when I start the debugger: "No symbol file loaded for orbiter.exe", but it launches Orbiter as it should.

I get this from the debugger when the break occurs:

"Exception thrown at 0x00513C7C in orbiter.exe: 0xC0000005: Access violation reading location 0xFE1B23B4."
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Ok, that sounds like you put an invalid handle somewhere into Orbiter. Orbiter has no symbols (unless you compile it with symbols.................... no), so that message is perfectly fine. What does the log tell you, how far did you come during loading? If you know, how far you went, you can then try next to set a breakpoint at the beginning of the possible Orbiter callbacks and go through your code by executing it in single steps.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
Ok, that sounds like you put an invalid handle somewhere into Orbiter. Orbiter has no symbols (unless you compile it with symbols.................... no), so that message is perfectly fine. What does the log tell you, how far did you come during loading? If you know, how far you went, you can then try next to set a breakpoint at the beginning of the possible Orbiter callbacks and go through your code by executing it in single steps.
I am hunting for the log now. The VS GUI is ... rich in detail.

Does the IDE need to be set to Debug vs Release for debugging?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I am hunting for the log now. The VS GUI is ... rich in detail.

Debugging is more art than science, especially if you are debugging multithreaded code. Luckily Orbiter is single threaded and we can go through the problem methodically.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,327
Reaction score
3,248
Points
138
Location
Massachusetts
From the Debug output I get several dozen lines like this for different dlls:

'orbiter.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
...

And it ends with

Exception thrown at 0x00513C7C in orbiter.exe: 0xC0000005: Access violation reading location 0xFE1B23B4.
 
Top