Jump to content

How to change jet engine parameters?


Flavio hc16

Recommended Posts

So, today i downloaded the 3.2x rescale mod, and I'm loving it for the rockets parts and imho is a nice middle ground between RO and stock, and is doable with stock parts (and for bigger rockets i have spacey/spacey expanded). However i would love to do also some SSTO, but here lies the problem:

orbital speed at 3.2x rescale is around 4.1 kms/s ( from the 2.25 of stock) so i would love to rescale also  the rapier engine so they can bring me around mach 8  at 25-30kms in air-breathing and then from there on switching to the closed cycle. 

 

I already know how to change the performance of rocket engine, but i can't wrap around jet engine parts, and what means what, especially in this parts

PROPELLANT
        {
            name = IntakeAir
            ignoreForIsp = True
            ratio = 6
        }
        atmosphereCurve
        {
            key = 0 3200 0 0
        }
        // Jet params
        atmChangeFlow = True
        useVelCurve = True
        useAtmCurve = True
        // no mach limit
        velCurve
        {
            key = 0 1 0 0.08333334
            key = 0.2 0.98 0.42074 0.42074
            key = 0.7 1.8 2.290406 2.290406
            key = 1.4 4.00 3.887193 3.887193
            key = 3.75 8.5 0 0
            key = 4.5 7.3 -2.831749 -2.831749
            key = 5.5 3 -5.260566 -5.260566
            key = 6 0 -0.02420209 0
        }
        atmCurve
        {
            // higher thrust at altitude than even TRJ
            key = 0 0 0 0
            key = 0.018 0.09 7.914787 7.914787
            key = 0.08 0.3 1.051923 1.051923
            key = 0.35 0.5 0.3927226 0.3927226
            key = 1 1 1.055097 0

 

I know that the 1st number of the  velcurve is the mach number, but everything else?

I have tried with lowering the intake air ratio to 0.6 and almost doubled the 1st number of the velcurve, but even on levelled flight at 20 kms ( high atmosphere line is at 21 kms in 3.2 rescale) the engine get starved for air with a shock-nosecone worth of air intake per engine.

Can someone help me?

Link to comment
Share on other sites

On 10.3.2018 at 5:24 PM, Flavio hc16 said:

I know that the 1st number of the  velcurve is the mach number, but everything else?

I have tried with lowering the intake air ratio to 0.6 and almost doubled the 1st number of the velcurve, but even on levelled flight at 20 kms ( high atmosphere line is at 21 kms in 3.2 rescale) the engine get starved for air with a shock-nosecone worth of air intake per engine.

Jet engine performance is mostly contained within velCurve and atmCurve. Problem is, editing those isn't straightforward at all.

As the names suggest, they are curves (so-called "floatcurves"). Each "key" is a point on the curve, but the whole thing is continuous. It passes through all the keys, but it exists in between them, too. And the path from one key to the next is not a straight line. This is why there are four values for each key.

In the case of velCurve:
- The first is a multiple of 375 m/s.
 -The second one is a thrust multiplier.
- The third one is the inbound tangent.
- The fourth one is the outbound tangent.

Limiting yourself to examining the first two numbers for now, you can see the following behavior:
- At standstill, the engine has exactly the amount of thrust it advertises in the editor: 105 kN.
- Nobody knows why the second key exists, but it makes the engine lose 2% thrust while the plane is moving at ~65 m/s. Wow, so important.
- As you approach the sound barrier, the ramjet component begins to work, and the engine rapidly gains huge amounts of bonus thrust.
- At around 1400 m/s, the thrust peaks at a whopping 8.5 times nominal thrust - nearly 900 kN.
- You continue to have fairly stable high thrust until around 1650 m/s...
- ...but after that, it falls off rapidly. At 2050 m/s, you only have about 300 kN left.
- And finally, at 2250 m/s, it's completely gone. Zero thrust.

And if you're wondering why you never see anything even remotely close to these numbers in actual flight: that's because of atmCurve. Where the first value of each key is air pressure (counted in standard atmospheres) and the second value is a thrust multiplier. Your final thrust value is the result of both curves applying their thrust multipliers. The higher you go, the less thrust you get; in contrast to velCurve, this never gives you a bonus. And since lower altitudes have a lot of drag, there's a tradeoff for you to make: stay lower, and you will have more thrust, but also more drag; go higher, and you escape the drag, but you lose thrust.

And just as with velCurve, the third and fourth values in each key of atmCurve are inbound and outbound tangents.

So what do you need to go faster in atmosphere? More thrust at high airspeeds. Hence, you need either one, or a combination of both, of the following:
- Extending velCurve to go beyond 6x 300 m/s at maximum.
- Adjusting atmCurve to not kill your thrust as quickly as you gain altitude.

It's possible that intake air also plays a role, especially as you gain altitude, but that should be a secondary consideration. First, you need to make the engine capable of going faster before you worry about whether or not it has enough air.

Implementing this would happen either through introducing additional keys, or editing the existing keys to have different values, or a combination of both.

 

If you're now thinking: "wow, this is more complicated than I thought" - well, this is where we get to the third and fourth values, the tangents. What in the world are tangents?!

Simply put, tangents control the shape of the curve as it approaches the key point from one side, and then leaves the key point to the other side. Tangents are entirely optional; if they are left out, then the game will simply guess the shape of the curve, based on interpolating from one key to the next. Problem is, for applications like jet engines in KSP, this guess results in a curve that doesn't do what you want it to do. It would randomly over- or undershoot your specified values at certain points, resulting in an illogical thrust profile. So you need to specify tangents to manually bend the shape of the curve into what you need it to be, always dependant on what numbers you pick for the first two values of each key.

And this, I'm afraid to say, is extremely counterintuitive to do by hand in a text file, without the help of external tools.

In the past, forum user @Taverius wrote a handy tutorial here about how to use the Unity plugin made by forum user @r4m0n here. Unfortunately both of these people have left the community years ago, and Taverius' post is now missing the amazingly helpful pictures it used to have. Still, the download for the floatcurve editor in r4m0n's post remains valid, and if you install Unity, you can use it to get a graphical representation of the curve you're trying to adjust. You can then try to follow what remains of Taverius' tutorial. Alternatively, @Cunjo Carl posted an explanation of the math behind tangents in Taverius' thread, and link to an online spreadsheet that could assist you in building your curve if you don't want to install Unity. I don't know how helpful that is to someone who has never worked with floatcurves before (I have, and I didn't understand it). But in contrast to the other two, he's still with us, and might be able to assist you.

Edited by Streetwind
Link to comment
Share on other sites

2 hours ago, Streetwind said:

Jet engine performance is mostly contained within velCurve and atmCurve. Problem is, editing those isn't straightforward at all.

As the names suggest, they are curves (so-called "floatcurves"). Each "key" is a point on the curve, but the whole thing is continuous. It passes through all the keys, but it exists in between them, too. And the path from one key to the next is not a straight line. This is why there are four values for each key.

In the case of velCurve:
- The first is a multiple of 375 m/s.
 -The second one is a thrust multiplier.
- The third one is the inbound tangent.
- The fourth one is the outbound tangent.

Limiting yourself to examining the first two numbers for now, you can see the following behavior:
- At standstill, the engine has exactly the amount of thrust it advertises in the editor: 105 kN.
- Nobody knows why the second key exists, but it makes the engine lose 2% thrust while the plane is moving at ~65 m/s. Wow, so important.
- As you approach the sound barrier, the ramjet component begins to work, and the engine rapidly gains huge amounts of bonus thrust.
- At around 1400 m/s, the thrust peaks at a whopping 8.5 times nominal thrust - nearly 900 kN.
- You continue to have fairly stable high thrust until around 1650 m/s...
- ...but after that, it falls off rapidly. At 2050 m/s, you only have about 300 kN left.
- And finally, at 2250 m/s, it's completely gone. Zero thrust.

And if you're wondering why you never see anything even remotely close to these numbers in actual flight: that's because of atmCurve. Where the first value of each key is air pressure (counted in standard atmospheres) and the second value is a thrust multiplier. Your final thrust value is the result of both curves applying their thrust multipliers. The higher you go, the less thrust you get; in contrast to velCurve, this never gives you a bonus. And since lower altitudes have a lot of drag, there's a tradeoff for you to make: stay lower, and you will have more thrust, but also more drag; go higher, and you escape the drag, but you lose thrust.

And just as with velCurve, the third and fourth values in each key of atmCurve are inbound and outbound tangents.

So what do you need to go faster in atmosphere? More thrust at high airspeeds. Hence, you need either one, or a combination of both, of the following:
- Extending velCurve to go beyond 6x 300 m/s at maximum.
- Adjusting atmCurve to not kill your thrust as quickly as you gain altitude.

It's possible that intake air also plays a role, especially as you gain altitude, but that should be a secondary consideration. First, you need to make the engine capable of going faster before you worry about whether or not it has enough air.

Implementing this would happen either through introducing additional keys, or editing the existing keys to have different values, or a combination of both.

 

If you're now thinking: "wow, this is more complicated than I thought" - well, this is where we get to the third and fourth values, the tangents. What in the world are tangents?!

Simply put, tangents control the shape of the curve as it approaches the key point from one side, and then leaves the key point to the other side. Tangents are entirely optional; if they are left out, then the game will simply guess the shape of the curve, based on interpolating from one key to the next. Problem is, for applications like jet engines in KSP, this guess results in a curve that doesn't do what you want it to do. It would randomly over- or undershoot your specified values at certain points, resulting in an illogical thrust profile. So you need to specify tangents to manually bend the shape of the curve into what you need it to be, always dependant on what numbers you pick for the first two values of each key.

And this, I'm afraid to say, is extremely counterintuitive to do by hand in a text file, without the help of external tools.

In the past, forum user @Taverius wrote a handy tutorial here about how to use the Unity plugin made by forum user @r4m0n here. Unfortunately both of these people have left the community years ago, and Taverius' post is now missing the amazingly helpful pictures it used to have. Still, the download for the floatcurve editor in r4m0n's post remains valid, and if you install Unity, you can use it to get a graphical representation of the curve you're trying to adjust. You can then try to follow what remains of Taverius' tutorial. Alternatively, @Cunjo Carl posted an explanation of the math behind tangents in Taverius' thread, and link to an online spreadsheet that could assist you in building your curve if you don't want to install Unity. I don't know how helpful that is to someone who has never worked with floatcurves before (I have, and I didn't understand it). But in contrast to the other two, he's still with us, and might be able to assist you.

Thanks you very much for the response

Link to comment
Share on other sites

Fair warning, my math just got 10/10 most confusing in the "Confuse the next poster" forum game. So.... Let me know if it's confusing :D .

Alright, so I'll talk a bit about what those numbers mean and why we use them first, and I'll retread a bit of ground from streetwind who has already given a good description. First, what parts would need editing?
1. Engines (thrust curve and atm curve)
2 optional. Intakes (mach curve) for any except the shock cone
3 optional. Wings (Lift and Drag mach curves, which would be in the physics file rather than the part files)

If you're just looking to do rapier, it shouldn't be too tricky!

Sets of numbers that define a curve like this are called 'Splines' or sometimes 'Tangent curves' depending on the field. Each key represents one point on the graph, and the way we'll plot it (or calculate it) is to plot what's between two of these points.

 

1. Find the data

The data is written in config files using the following format

  key1   = X1  Y1  I1 O1
  key2   = X2  Y2  I2 O2
  key3   = X3  Y3  I3 O3
  key4   = X4  Y4  I4 O4

Where each key defines a point in terms of its x value, y value, incoming tangent=slope (I), and outgoing tangent=slope (O). A good example of these values might be mach values for x (the thing you know), thrust coefficients for y (the thing you want to know), and the I and O tangents for how quickly thrust coefficients change approaching and leaving this point. Plotted as a line, these tangents are the slope coming into and out of the point, so if the I and O are different, there'll be a kink in the line at that point. It seems like a silly way to make a line, but it winds up being an easy way to make a curve with whatever shape you want, and it's quick to calculate on a computer provided you handle memory lookups correctly. For this reason, they're super popular in games where they want silly curves for balance reasons, and they'll need to be using those curves thousands of times a second.


2. Find some coefficients

We'll need some coefficients in a moment, so we plug in some numbers from key1 and some from key2.

  A =  2Y1 +  O1  - 2Y2 + I2
  B = -3Y1 - 2O1 + 3Y2  - I2
  C =    O1
  D =    Y1
 

3. Form the equation

We'll write an equation for the line that goes between the points of key1 and key2. We could try to make this equation in terms of x, but it would be really hard! So instead, first we'll make a convenience variable called u. The fancy term for it is a unitless transform, and it makes life soooooo much easier. Then we'll write an equation for y (the thing we want!) in terms of this u.

u = (x - X1)/( X2  - X1 )           Eq. 1

y = Au3 +Bu2 + Cu + D           Eq. 2

Cool, so if we make up an x value, and we want to know the corresponding y value we simply plug x into Eq 1, and then plug the resulting u into Eq 2 and we get our value! All's we need are those big letters A-D.

 

4. Do this for each key and plot/use the results

Or just borrow the version I have in google sheets. Google sheets is terrible at plotting, because its x axis literally doesn't work. Seriously, how? I go with excel '03, but does anyone else have a suggestion for plotting datasets? I've been considering writing a javascript plotter that would take in keys and print out results, but those take time. If people are interested let me know, otherwise I'll stick to excel!

Here's a link to my google sheets calculator. The coefficients + y values will update automatically, you need to provide x values and key values. When you plug in key values, you can select the line and click+drag the little blue box on the bottom right of your selection box to copy it down over a large section. When you plug in x values, if you put in 2 numbers (say 0, 0.25) select them and do the same box click+drag, it'll generate a series (0, 0.25, 0.5, 0.75, 1....) so it's easier than it looks.

https://docs.google.com/spreadsheets/d/1tOJqRXW4Wo1SWHrNcMaj5yhGBmKHT_NTiezBKlGGeEI/edit?usp=sharing

 

5. Change around the values until you have the curve you want!

 

Please let me know if you have any questions about this stuff. Best of luck!

Link to comment
Share on other sites

21 hours ago, Streetwind said:

In the past, forum user @Taverius wrote a handy tutorial here about how to use the Unity plugin made by forum user @r4m0n here. Unfortunately both of these people have left the community years ago, and Taverius' post is now missing the amazingly helpful pictures it used to have. Still, the download for the floatcurve editor in r4m0n's post remains valid, and if you install Unity, you can use it to get a graphical representation of the curve you're trying to adjust. You can then try to follow what remains of Taverius' tutorial.

The float curve editor was ported to KSP a long time ago

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...