Jump to content

[0.20] Modular Fuel System 1.3/realistic fuels, reconfigurable fuel tanks and engines


ialdabaoth

Recommended Posts

Me again, sorry.

I still don't quite get how this is supposed to work.

Using an FL-T400 tanks with an LV-909:

standard liquidfuel + oxidizer, action group menu says 370 isp, mechjeb delta-v/engineer redux give 3663 delta-v

liquidH2 + LiquidOxygen, action group menu says 460 isp, which would lead me to believe that it would be a lot more efficient and therefore provide more delta-v, but mechjeb/engineering redux say 1481 delta-v

Seriously, what is is i'm missing with this mod?

So, First One you can burn at longer time..

Second one you don't... Thats my interpretation.. Assuming Isp are all the same.. but apparently they are not =P

Link to comment
Share on other sites

@erbmur the idea is that the H2 is much lighter, but has better fuel efficiency. So a tank of the same mass will give you much more delta-v. A tank of the same volume will be much lighter and will probably give you less delta-v. In effect it means you can make a bigger rocket which weighs the same but has more delta-v. You can also use the less powerful but more efficient of the larger engines to squeeze out a bit more because your rocket is lighter.

The usual strategy in real life (if you're using H2) is to use a mix. The first stage will be low isp but high density fuel (so you don't have as much bulk and air resistance), but you can save a lot of weight in your upper stages by using the light H2 (and bulk doesn't matter as much because the upper stage and payload is light anyway), this in turn makes your first stage much lighter because it doesn't carry as much.

Another strategy is to use solid rockets as your dense, less efficient lower stage (this is effectively what the space shuttle did except it burned hydrogen from launch as well because the upper stage engines are already there and pointing in the right direction). Sometimes there's even a combination of all three fuel types.

This being said, there are some bugs in the current (previous?) release which mean that changing the fuel of an engine using the GUI gives odd results (either gives you 3x the delta-v you should have or 1/3rd depending on the motor)

Edited by SchroedingersHat
Link to comment
Share on other sites

To parse this, start by setting the tank's remaining usable volume to its total volume, obviously. In this example, I'm gonna say that's 3000 liters, just to pick a round number.

Now iterate over the "TANK" nodes. For each one of type "fixed," divide the maxAmount by the utilization and subtract that from the remaining usable volume. In pseudocode:


remainingVolume = volume
foreach tank {
if tank is fixed {
remainingVolume -= tank.maxAmount / tank.utilization
}
}

Just to walk through that, in this case we'd start out with a volume of 3000 liters, then subtract 10.0 ÷ 0.9 from it (2988.8), then subtract 1.0 ÷ 0.9 (2987.7), then subtract 200.0 ÷ 0.85, leaving us with about 2752.5 of remaining volume.

Then we iterate again, looking this time at the proportional tanks. For each one, take the remaining usable volume, multiply it by the amount (which is a fraction less than or equal to one), then multiply by the utilization.


foreach tank {
if tank is proportional {
tank.maxAmount = remainingVolume * tank.maxAmount * tank.utilization
}
}

Here we have two proportional tanks, RP1 and LOX. For RP1, that'd be 2752.5 liters × 0.35 × 0.85, or about 818.9 liters. For LOX, it's 2752.5 liters × 0.65 × 0.80, or 1431.3 liters.

If we add it all up to check our work, we have the 10 liters of Oâ‚‚, the liter of COâ‚‚, 200 liters of hydrazine, 818.9 liters of RP1 and 1431.3 liters of LOX, all of which come to a total of 2461.2 liters, giving us an overall utilization fraction of 82.04%, which is right on the money.

Now, just to reiterate, this is only a suggestion. I think this would be an easy-to-use, (relatively) easy-to-code and pretty darned flexible system for allocating tank volume. It wouldn't be way better than what you have now, but I think it'd be better, and if I'm suggesting you need to open up the patient anyway, 'cause of my aforementioned bug, then I think changes along these lines might be worth considering.

Bottom line, though? Spectacular mod, as always, and thanks very much for it.

Note: The method you described will NOT give the expected results if you have different utilization factors. But, since I already have the correct formula built into the 'configure for engines' code, there's no reason not to just reuse that. ;)

Here's what I'm doing for the next version:

1. "efficiency" will be changed to "utilization" (I like this better, I just couldn't find the right term when I was writing the mod)

2. this syntax:


{
name = LiquidH2
efficiency = 0.99
mass = 0.0
temperature = -253
loss_rate = 0.0000000002
amount = 0.73 * volume
maxAmount = 0.73 * volume
note = (requires insulation)
}

will change to this:


{
name = LiquidH2
utilization = 0.99
mass = 0.0
temperature = -253
loss_rate = 0.0000000002
amount = full
maxAmount = 73%
note = (requires insulation)
}

3. All tank definitions with a '%' in their maxAmount will be processed AFTER all tank definitions with a static maxAmount.

4. amount will no longer take proportional values. It's either a static value, 0, or the word "full". Anything else is semantically ambiguous.

Link to comment
Share on other sites

Note: The method you described will NOT give the expected results if you have different utilization factors.

Really? Darn. I must have missed something when I was doing the arithmetic. Sorry about that. I should've pounded on it more before posting my suggestion.

In any case, regarding the other changes you're going to make, thank you so much. That's awesome, and I'm really looking forward to what comes next. Your mods are on my relatively short list of won't-play-without.

Link to comment
Share on other sites

Really? Darn. I must have missed something when I was doing the arithmetic. Sorry about that. I should've pounded on it more before posting my suggestion.

It's all good - here's the reason why, if you're curious.

Let's say I want a 27% LOX / 73% LH2 mix.

Let's say that for this tank, LOX has 0.9 Utilization and LH2 has 0.8, and my available volume for the mix is 1000.

1000 * 0.27 * 0.9 = 243

1000 * 0.73 * 0.8 = 584

that's 827 units of actual LOX+LH2. note that 243/827 is 0.294, and 584 / 827 is 0.706; we do NOT have a 27%/73% ratio, and will wind up with about 65 volume worth of LH2 left over after our engine runs out of LOX.

Link to comment
Share on other sites

Oh! I see what you mean. The method I described gives you the "right" answer, in that it gives you exactly what you asked for … but what you asked for in the method I described didn't add up to what you really wanted. Duh. I totally should've thought of that. My blind spot is that I've been thinking in terms of pretty simplistic tank construction, with either common or separate bulkheads that give an overall utilization fraction that's true of both bipropellants. It didn't occur to me that somebody might want to specify different utilizations for each of the two biprops. So of course, doing it your way is way better. Thanks for explaining.

Link to comment
Share on other sites

Hi, I have been messing about with my own custom configs to try and formulate a variable burn rate segmental SRB (I cheated and made the fuel pump transferable, it seemed like the only way) and have tripped over a bug, I don't know if it's been mentioned, If I configure the engine to have 2 configs of fuel type with 2 different ISPs the ISPs are not being changed when I change engine config, and I believe they are supposed to? I checked on of the normal Rocketry engines which I checked in the config has different ISPs and they don't change between fuel configs either.

This mod is great, I really like it. Being able to use LH2/LO2 fuel is way more efficient than the default fuels (not to mention better for Kerbin's environment ;)) and I like how you can choose differnt fuels to give you different balances of thrust and ISP etc. (well, if the ISP worked ;) ) so you can tune each stage to get better performance.

Also, something else that sprung to mind is is it worth introducing some kind of tank barrier penalty, so that when you have more than one tank per fuel module it loses you a small percentage of the volume (realistic, as you'd have to close one tank, fit a structural bulkhead of some kind and start another) It gets a little complex when you look at it as you;d have to take into account how many tanks the original module had installed (generally 2) and then take into account if you would lose or gain from your new config, for e.g. if you went from a single tank to 2 tanks in the module you;d lose abit of volume, but if you went from a default 2 tanks to 1 tank in the module you'd gain a little bit etc. Just a thought that shot into my head :)

Keep up the good work :D

Edited by MDBenson
Link to comment
Share on other sites

Help!

When I apply this mod to my game, My game freezes when loading into game..

If I remove it, game works fine...

Mods I have:

RemoteTech

Kethane 5.1

DummyWeight

MechJeb2.0

I got the same problem, the debug console said something about an error patching .cfg files.

Link to comment
Share on other sites

Updated! I think the delta-V problem has been solved. Confirm?

Seems to check out for me (didn't do any math except approximations in my head). Mechjeb is giving wholly coherent results which match the ratios of Isps reported, too.

Side-thought for other users and whoever was curating cfgs (Chestburster?):

Hypergolic fuels and Mono-prop (change to hydrazine? Make H2O2 available as an oxidizer and monoprop? probably pick just one to avoid spammyness) for the smaller engines (ant, small rockomax, the 2 and 3 power AEIS engines etc)

Link to comment
Share on other sites

Seems to check out for me (didn't do any math except approximations in my head). Mechjeb is giving wholly coherent results which match the ratios of Isps reported, too.

Side-thought for other users and whoever was curating cfgs (Chestburster?):

Hypergolic fuels and Mono-prop (change to hydrazine? Make H2O2 available as an oxidizer and monoprop? probably pick just one to avoid spammyness) for the smaller engines (ant, small rockomax, the 2 and 3 power AEIS engines etc)

:( Unfortunately, I wasn't able to get RCS blocks to allow user-selectable fuels in the VAB.

Also: I'm pretty sure 'Oxidizer' *is* H2O2, and MonoPropellant is actually HAN, not Hydrazine (Hydrazine can't get 260 isp).

I had tried to allow Oxidizer as a selectable monopropellant at 190 isp, but alas, it was not to be.

Link to comment
Share on other sites

The new version is working well for me so far. I haven't really beat it up yet, but so far no complaints. Getting the Isp-reporting thing fixed is a real win, so thanks for that.

I have a suggestion, though. In ModularEngines.cs, if you add a SetConfiguration call to the end of OnLoad, the module will apply whichever config is specified under "configuration" in the config file, if any, at load time, so it gets reported correctly in the VAB GUI. Specifically:


ModularEngines.cs
292,294d291
<
< if (!configuration.Equals(""))
< SetConfiguration (configuration);

This let me take my override file for the stock LV-T45 from this:


@PART[liquidEngine2]:Final
{
@mass = 1.457
@MODULE[ModuleEngines]
{
@maxThrust = 200
@heatProduction = 200
@PROPELLANT[LiquidFuel]
{
@name = RP1
@ratio = 0.35
}
@PROPELLANT[Oxidizer]
{
@name = LOX
@ratio = 0.65
DrawGauge = True
}
@atmosphereCurve
{
@key,0 = 0 370
@key,1 = 1 300
}
}
MODULE
{
name = ModuleEngineConfigs
configuration = RP1/LOX
CONFIG
{
name = RP1/LOX
thrustVectorTransformName = thrustTransform
exhaustDamage = True
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 200
heatProduction = 200
fxOffset = 0, 0, 0.574338
PROPELLANT
{
name = RP1
ratio = 0.35
DrawGauge = True
}
PROPELLANT
{
name = LOX
ratio = 0.65
DrawGauge = True
}
atmosphereCurve
{
key = 0 370
key = 1 300
}
}
CONFIG
{
name = LH2/LOX
thrustVectorTransformName = thrustTransform
exhaustDamage = True
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 200
heatProduction = 200
fxOffset = 0, 0, 0.574338
PROPELLANT
{
name = LH2
ratio = 0.73
DrawGauge = True
}
PROPELLANT
{
name = LOX
ratio = 0.27
DrawGauge = True
}
atmosphereCurve
{
key = 0 420
key = 1 365
}
}
}
}

down to this:


@PART[liquidEngine2]:Final
{
@mass = 1.457
MODULE
{
name = ModuleEngineConfigs
configuration = RP1/LOX
CONFIG
{
name = RP1/LOX
thrustVectorTransformName = thrustTransform
exhaustDamage = True
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 200
heatProduction = 200
fxOffset = 0, 0, 0.574338
PROPELLANT
{
name = RP1
ratio = 0.35
DrawGauge = True
}
PROPELLANT
{
name = LOX
ratio = 0.65
DrawGauge = True
}
atmosphereCurve
{
key = 0 370
key = 1 300
}
}
CONFIG
{
name = LH2/LOX
thrustVectorTransformName = thrustTransform
exhaustDamage = True
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 200
heatProduction = 200
fxOffset = 0, 0, 0.574338
PROPELLANT
{
name = LH2
ratio = 0.73
DrawGauge = True
}
PROPELLANT
{
name = LOX
ratio = 0.27
DrawGauge = True
}
atmosphereCurve
{
key = 0 420
key = 1 365
}
}
}
}

Link to comment
Share on other sites

:( Unfortunately, I wasn't able to get RCS blocks to allow user-selectable fuels in the VAB.

I was more thinking of going the other way (the smallest engines have liquidfuel removed as an option and can either run on H2O2 (or Oxidizer, it seems. I'd always assumed it was some kind of nitrogen compound -- NTO as it turns out) or monoprop.

This was inspired by many of the KOSMOS modules which have integrated monoprop tanks and monoprop thrusters (in addition to rcs).

Link to comment
Share on other sites

Love the continued work on this mod!

Does this fix the issue that was occurring with the B9 Saber engines not having a menu appearing in the VAB/SPH and not being able to fill tanks to accommodate for their fuel ratio needs?

Link to comment
Share on other sites

Love the continued work on this mod!

Does this fix the issue that was occurring with the B9 Saber engines not having a menu appearing in the VAB/SPH and not being able to fill tanks to accommodate for their fuel ratio needs?

Partially. You get an option to fill with 100% LH2, but not an option to fill with LiquidOxygen, because it only sees the 'active' engine.

Link to comment
Share on other sites

Well, it's a start! Once again I just have to say that after I started using this mod i have really started to re-enjoy kerbal (if that is such a word?)

To anybody who may be having the same thoughts about the sabers as I am, I found a workaround where I just put any other rocket onto the end of the craft and and configure that to use the same fuels as the sabers, auto-fill the tanks accordingly, and then just replace the rocket.

Link to comment
Share on other sites

Just add a different engine to get the option for the correct ratio. Or just add about 20% of your total tank volume as LOX since you need some LH2 for jet-mode anyway.

@ialdaboth did you add some of my configs? So i can update the others and kick them out of the pack.

I will work on a real-world config next, giving the engines and fuels proper values. Got some ideas in my head and can't wait to test them at home xD

Link to comment
Share on other sites

Speaking of the SABER, it seems stupidly good in its air breathing configuration.

I can't find much info on the real thing, but assuming it isn't running lean (my gut says no considering that the limiting factor is cooling air), I _think_ the H2/air ratio should be 2:8 (assuming I did all my maths right). I'm also finding wildly conflicting figures on its Isp. Not only that but I'm having trouble figuring out when people are talking about effective Isp (only considering fuel mass and treating intake substances as a boost to Isp rather than reaction mass) and when they are talking about Isp of all the mass flow.

On top of that I don't know if KSP considers IntakeAir as reaction mass or takes it into account with the high Isp ratings on the jet engines.

Link to comment
Share on other sites

Speaking of the SABER, it seems stupidly good in its air breathing configuration.

I can't find much info on the real thing, but assuming it isn't running lean (my gut says no considering that the limiting factor is cooling air), I _think_ the H2/air ratio should be 2:8 (assuming I did all my maths right). I'm also finding wildly conflicting figures on its Isp. Not only that but I'm having trouble figuring out when people are talking about effective Isp (only considering fuel mass and treating intake substances as a boost to Isp rather than reaction mass) and when they are talking about Isp of all the mass flow.

On top of that I don't know if KSP considers IntakeAir as reaction mass or takes it into account with the high Isp ratings on the jet engines.

It considers IntakeAir as reaction mass.

Link to comment
Share on other sites

It considers IntakeAir as reaction mass.

Yes, I just found that out with some experiments. It seems that that means many of the numbers for air breathing engines are way off (i think the turbofan turns out pretty close as it's listed Isp is extremely low and it's fuel/intakeair ratio has too much fuel).

In that case, looking at the numbers I have for the SABER (hydrogen has a vacuum Isp of 460 and the effective Isp is quoted as 3600) it should have an Isp of 460 (maybe a bit less? I imagine the nozzle will be designed for vacuum) and a fuel (mass) ratio of 8:1 (in KSP's fuel units that'd be closer 7:4). This seems a little off as it'd mean it's running very rich. Something is still off -- maybe they're just inefficient in air? Makes sense given it's the very bleeding edge of engineering.

Edit: I realize what's off. I'm not accounting for the difference in exhaust velocity. If you're moving at mach 5 you'd take off pretty close to half of your exhaust velocity because you're speeding the air that you use up by that much before pushing it in the other direction. That accounts for the factor of two I'm missing from my original calculations.

Edited by SchroedingersHat
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...