Jump to content

RealFuels KSP-Interstellar Integration Config


Northstar1989

Recommended Posts

This is a thread to work on a better RealFuels + KSP-Interstellar integration config.

Basically, the idea is rather simple. It would re-name the KSP-Interstellar fuels as RealFuels where appropriate (for instance Methane at LiquidMethane, and LiquidFuel as LiquidHydrogen), and adjust the fuel consumption rates, conversion/production rates (for instance in the products made by Water Electrolysis) and tank capacities to account for the new resource densities and equal the same masses as before where re-naming changed the resource density.

There would also be an attempt to up-rate the Interstellar Meth/LOX engine to realistic TWR/ISP levels for the RealFuels "Stockalike" config (which updates stock parts to realistic TWR and ISP values without changing their thrust...)

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

Use ModuleManager for that. Shouldn't be all that hard.

MUCH easier said than done. That requires a knowledge (and preferably experience) of how to create ModuleManage patches- of which I have no idea.

Based on your posts on the RealFuels thread, it sounds like you already began to tackle this before. Maybe I could convince you to start work on an "official" patch that could be permanently posted on the RealFuels release thread front page in the future?

There's even a cfg file in the RealFuels folder to do that, but I'm guessing by your posting this lots that it's outdated?

Uhhh, yeah. Outdated, and more importantly, incomplete. The patch in the latest release of RealFuels doesn't address Ammonia, Methane, or Meth/LOX as NTR propellants. Nor does it address the KSP-Interstellar tank specifically designed to hold Ammonia, or the rate the refnieries harvest Ammonia at (the reduction in resource-density means they need to harvest Ammonia at an increased rate).

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

@Regex Just to make sure you're aware, there already is a config file in the RealFuels release for KSP-Interstellar integration. The problem with it is, it's outdated, and doesn't apply all the fixes that are necessary for full-compatibility (fixes to ISRU, or use of Methane, Meth/LOX, or Ammonia for Nuclear Thermal Rockets, for instance)

NathanKell

EDIT: It appears I might have been wrong about the mass-ratios produced by the resource-converters in KSP-Interstellar. They MAY actually be smart enough to correct for changes in resource densities, like was suggested on the RealFuels thread. However the ISRU *extraction* rate of Ammonia (when being harvested raw from the environment, as on Jool/Eve, rather than produced via the Haber Process) is still not fixed in KSP-Interstellar without a MM patch; nor is the use of Ammonia, Methane, or Methane/LOX in NTR's changed to use the RealFuels equivalents either...

There are ISRU reactions to produce Ammonia (from atmospheric Nitrogen deposits, and LiquidFuel- representing the Haber Process), Methane (from atmospheric CO2 deposits, and LiquidFuel- representing the Sabatier Reaction), and LiquidOxygen/Aluminum (from Mun/Ike regolith- via "Alumina Electrolysis"- likely representing electrolysis of aluminum-oxide rocks/sand/soil via the Hall-Heroult Process) in KSP-Interstellar... It appears that the KSP-Interstellar converter modules that perform these reactions are smart enough to auto-adjust for changes in resource density, but this should be double-checked to make sure everything is working right...

The extraction rate of Ammonia in the ISRU refineries (when being harvested directly from the environment) needs to be increased by 1.12748:1 to reflect the reduction if resource density in RealFuels... (basically, increased by 12.75%) The EXTRACTION modules, unlike the converter modules, do NOT auto-adjust for changes in resource density.

Regards,

Northstar

P.S. This careful analysis revealed that the resource density of LiquidMethane *might* be too low in RealFuels. It appears it should be approximately 35% denser to achieve the correct mass-ratio with LiquidOxygen... Of course, this analysis is based on molecular masses rather than the actual densities you can pack the fuels into liquid form in real life...

Edited by Northstar1989
Link to comment
Share on other sites

@Regex Just to make sure you're aware, there already is a config file in the RealFuels release for KSP-Interstellar integration. The problem with it is, it's outdated, and doesn't apply all the fixes that are necessary for full-compatibility (fixes to ISRU, or use of Methane, Meth/LOX, or Ammonia for Nuclear Thermal Rockets, for instance)

Well, you're a smart guy and I've already given you a link to the ModuleManager Docs. I'm really only trying to help you get a head start since you seem really insistent on getting someone to take this on and no one has jumped at the chance; seems really urgent if you make one thread and post in two others. I am in no way interested in taking that on but I do want to help you. Sorry if I have disappointed.

Link to comment
Share on other sites

For reference, the current resource densities in RealFuels, as of the last 0.24.2 release:

name = LiquidOxygen

density = 0.001141

name = LiquidH2

density = 0.00007085

name = LqdAmmonia

density = 0.000604

name = LqdMethane

density = 0.00042262

Their counterparts in Stock/KSP-I (assuming LiquidFuel = LiquidHydrogen, as this is the assumption KSP-Interstellar makes for ISRU purposes) as of the last 0.24.2 release:

name = Oxidizer

density = 0.005

name = LiquidFuel

density = 0.005

name = Ammonia

density = 0.000681

name = LqdMethane

density = 0.00186456

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

Well, you're a smart guy and I've already given you a link to the ModuleManager Docs. I'm really only trying to help you get a head start since you seem really insistent on getting someone to take this on and no one has jumped at the chance; seems really urgent if you make one thread and post in two others. I am in no way interested in taking that on but I do want to help you. Sorry if I have disappointed.

As I've already put forth, I don't have the faintest idea how to go about generating a ModuleManager patch. And if I made this my first attempt, I'd likely end up screwing a lot of things up- which would be really bad for such an important integration config as RealFuels/KSP-Interstellar. Plus, just as importantly, I have (almost) no experience in programming and no idea how to do things like Pull Requests to integrate the new config into the next RealFuels release...

TBH, though, I'd be most interested in seeing NathanKell take up the mantle of this, as there is already an (outdated/incomplete) config for KSP-Interstellar in the RealFuels release; and he has a LOT more experience working with his own mod than I do...

Edited by Northstar1989
Link to comment
Share on other sites

regex pointed you at the docs; MM is really not that hard to use.

I'm sorry to say I'm busy enough that I don't have time to take it on myself (and I know *nothing* about KSPI, so that's not helpful either); heck I just handed Deadly Reentry off to Starwaster.

Link to comment
Share on other sites

As I've already put forth, I don't have the faintest idea how to go about generating a ModuleManager patch. And if I made this my first attempt, I'd likely end up screwing a lot of things up- which would be really bad for such an important integration config as RealFuels/KSP-Interstellar. Plus, just as importantly, I have (almost) no experience in programming and no idea how to do things like Pull Requests to integrate the new config into the next RealFuels release...

TBH, though, I'd be most interested in seeing NathanKell take up the mantle of this, as there is already an (outdated/incomplete) config for KSP-Interstellar in the RealFuels release; and he has a LOT more experience working with his own mod than I do...

As mentioned in my PM, I may be willing to write up the configs, but I would want good, solid numbers on conversion rates, compression rates, and so forth. I can say that LiquidFuel maps much more accurately to RP-1 (a refined form of Kerosene) than to H2. Overall, RealFuels tanks are 5x the size, and fuels are 1/5th the density when compared to stock. NathanielKell's numbers for density have checked out against Wikipedia and the few more credible sources I've checked, so i'd be going with his numbers and conversion rates whenever there's a discrepancy.

For these resources, the conversion is quite simple;

Oxidizer & LiquidFuel are multiplied by 5 and summed for the total tank space. It'd be close enough.

Ammonia can be converted in terms of space to LqdAmmonia/Ammonia * tank size.

Do the same for Methane, and that's it!

Honestly, if MM was just a liiiiittle more powerful, I could write a like 30 line config file to handle the whole thing, but alas, MM can't assign one part value to another dynamically....

The problem comes with things like the MW resource, which maps inaccurately to Electric Charge depending on the mod used, and finding where all these values are located, and what they are. I've got time & will to write up the files, but not to hunt down all the values from the parts files and compile them into a readable format. Either way, we'll see how it goes, but no guarantees unless I've got the numbers.

Link to comment
Share on other sites

dreadicon: it can now. It supports variables, and relative locations; you can go all the way up to gamedatabase root and then down again to the other part. :)

wait, WHAT!? OK, ditching last 15 minutes of work to investigate NAO. I know I proposed a format/implementation syntax a month or two ago, and he sounded cautiously interested, but I didnt think he'd actually do it! w00t!

Link to comment
Share on other sites

Uhhhh, OK. I'm not sure what *that* tangent with NAO and roots and all that was about, but anyways, back to the main topic...

I decided to see what I *COULD* do with my current level of understanding, and the .CFG file already available to me as a reference, and came up with the following fixes for using LqdAmmonia and Meth/LOX in KSP-I NTR's, and making the KSP-I radial Ammonia tank hold LqdAmmonia instead:


@BASIC_NTR_PROPELLANT[Methalox]
{
@guiName = Methalox
@PROPELLANT[LqdMethane]
{
@ratio = 0.443
}
@PROPELLANT[Oxidizer]
{
@name = LqdOxygen
@ratio = 0.557
@DrawGauge = False
}
}

@BASIC_NTR_PROPELLANT[Ammonia]
{
@guiName = Ammonia
@PROPELLANT[Ammonia]
{
@name = LqdAmmonia
}
}

@PART[FNAmmoniaTank]
{
MODULE
{
name = ModuleFuelTanks
volume = 10731
type = Default
}
}

Tested it, and it works in Sandbox mode with KSP-Interstellar installed. For the Meth/LOX combustion ratio, I just copied the ratio NathanKell was already using for the KSP-I chemical Meth/LOX engine- although I think it may burn a little too Methane-rich for the real-life analog (Raptor).

For that matter, the real-life Raptor engine is also supposed to have better ISP than the KSP-Interstellar one, and since RealFuels already reduces the density of its fuels, it might be good to replace its stats with those of the real-life proposed design (321s ASL, 380s vacuum) to buff it back up closer to realism.

Also, the shortcut I took for converting the Ammonia tank was just to give it exactly the same volume as it had capacity in Ammonia. This might be a flawed assumption- I think it leads to too low of a fuel fraction for the tank...

Regards,

Northstar

EDIT: For anyone trying to use these fixes as-is, I have updated the code here to use the new resource name for liquid oxygen introduced in RealFuels v8.0: "LqdOxygen" instead of "LiquidOxygen". Remember, this only solves a couple of the NTR fuel issues in KSP-Interstellar and makes the Ammonia tank modular- you'll still need the other fixes in the KSP-Interstellar/RealFuels integration config present in RealFuels v8.0 and before... (RealFuels v8.1 removed the config while myself and Dreadicon work on an updated one)

Edited by Northstar1989
Link to comment
Share on other sites

  • 2 weeks later...
Engines don't run stoich. Russians tend to run ox-rich, and US engines fuel-rich.

Indeed, but he *MAY* have a point. The 443:557 ratio of Methane to LOX for the Interstellar Meth/LOX engines (this was the ratio already included in the pre-existing and incomplete/outdated integration config) seems far too fuel-rich to me, considering Methane and LOX burn in a close to 1:4 mass ratio...

CH4 + 2 O2 --> CO2 + 2 H2O

Also, yes Kejchal, I think you did it wrong. It doesn't appear you entered the correct balanced reaction into that website to start with...

If you used the densities for LiquidMethane and LiquidOxygen currently used in RealFuels (I posted these on the first page, it doesn't matter what densities you could find on Wikipedia- they may not be at the same temperature/pressure conditions), the LiquidOxygen is 2.698249 times more dense than LiquidMethane, but burns in a 16.043 : 63.996 mass-ratio according to the website you linked to, meaning the stoichiometric reaction ratio in KSP (in terms of units/volume) should be...

1 : 1.477514

Or, when set to volume-fraction as KSP uses (i.e. if only 2/5ths of the volume fed into a reaction was of a given resource, its ratio would be "0.40")

LiquidMethane: 0.40363

LiquidOxygen: 0.59637

Notice those two numbers have to add up to 1 for it to work properly in KSP, hence I chose a # of significant figures such that I could do that while minimizing rounding errors... (my actual results could have been to more sig. figs., but it would have only complicated things)

The current integration-config, on the other hand, uses 0.443 and 0.557 for the volume-fractions.

EDIT: Some more research reveals the ratio currently in use is probably fairly accurate. Meth/Lox engines actually are a LOT more efficient when run fuel-rich, unlike Kero/LOX or Hydro/LOX, which both pay significant penalties for running fuel-rich (but are often built as-such because running Oxygen-rich requires much more advanced metallurgy to do properly- of the sort that only the Russians had until recently, when the US bought several such Russian engines and associated documentation in order to figure out how to replicate them...)

The ISP of the KSP-Interstellar Meth/LOX chemical engine still isn't up to snuff yet, though- the REAL engine has a sea-level ISP of 321s and a vacuum ISP of 380s, whereas the specs of the current RealFuels/Interstellar engine are significantly worse... (this is a holdover from normal Interstellar- RealFuels simply doesn't do anything to increase the ISP to accurate levels, while decreasing the fuel density and thus nerfing Meth/LOX...)

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

KSP-Interstellar's Meth/LOX engine lags far behind the Space-X "Raptor" in almost every possible design criteria. Here are just *SOME* of the specifications for comparison:

Interstellar's "Deinonychus 1-D"

Thrust 1425 kN (thrust does not vary with atmospheric pressure in stock engine module)

Mass 3500 kg (for the record- what TWR is that?)

ASL ISP 309 s

VAC ISP 368 s

Space-X's "Raptor"

ASL Thrust 6900 kN

VAC Thrust 8200 kN

Mass Unknown- but TWR predicted likely to exceed 120

ASL ISP 321 s

VAC ISP 380 s

Keep in mind that the "Deinonychus 1-D" is not available until "Experimental Rocketry" - the *very last* tech node in the rocketry series of the tech-tree! So, it would be perfectly reasonable to expect it to significantly out-perform Kero/LOX engines in many ways, considering its higher tech level (as a Meth/LOX engine, it is in fact a bit further towards the "high ISP" end of the fuel-density vs. ISP spectrum than Kero/LOX engines...)

Regards,

Northstar

Link to comment
Share on other sites

Cross-posting like mad, as usual :rolleyes:

Let me start off by saying that I highly respect the great deal of work you do for KSP modding, and the input you have on most forum threads- but there's no reason to roll eyes at me...

I've got to make sure it's seen by all the related parties. In this case, it's perfectly appropriate- as the other places this is cross-posted are the base RealFuels thread (only AFTER the code changes were first introduced here, and as they didn't come to NathanKell's attention from this post), and in the "Stockalike" engine config for RealFuels- due solely to the fact that you seemed to think it more appropriate for ISP/TWR changes to the Meth/LOX engine to be included in the engine config than in the base mod...

Roll your own engine config for Real Fuels to address the methane engine issue.

First of all, creating a separate config that applies a MM patch to the same part could create potential issues, could it not? Thus, it would seem to me that whatever lines on code were created to address this issue should best be integrated into the same config file as the MM changes to the resources consumed by the Meth/LOX engine...

Now I can see two potential fixes to this problem...

The first, is that the engine ISP/TWR fixes simply be integrated into the same RealFuels/KSP-Interstellar integration config already present in the base RealFuels install that changes the resources consumed by this (and a number of other) engines. Then, if any engine config wanted to change the engine values further (say to scale the engine up to Realism Overhaul scale with one of the two scaled-up engine configs), they would release a version of the KSP-I integration config that overwrote the one in the base install.

The second, is that the engine ISP/TWR fixes be left out of the base RealFuels install, but the fixes/changes I already came up with be included (the modular fuel tank fix for the Ammonia tank and the additional NTR fuel mixes I provide MM patches for here- which are in exactly the same spirit as the fixes in the config already in the base RealFuels install: of simply causing existing Interstellar fuel-modes to use RealFuels resources and density-adjusted ratios rather than the Interstellar resources being replaced in the fuel tanks and such...) as well as any similar changes that myself or Dreadicon come up with before the integration config is revised (or in second revisions later, if this is done quickly). But any ISP/TWR changes to the Interstellar Meth/LOX engine myself/Dreadicon come up with be left out, and those be included in an alternate version of the integration config for the "Stockalike" engines config that would then have to overwrite the base RealFuels integration config when installed.

Either solution will require some instance of re-writing, and require at least *some* of the engine configs to check that they're not overwriting a more updated base-config with a more out-of-date engine config in the future, when further changes might be made to the base config by other people. But the first solution at least ensures that thhe "Stockalike" config doesn't need to do this- and honestly, I doubt many/any players using the "Real Engines" or "Reaching for the Stars" engine configs would want to play with KSP-Interstellar installed anyways, as there aren't "real" engines/technologies yet... (but instead reside in the realm of the moderately-distant but definitely-feasible future...)

A THIRD, and possibly best, solution; would be to include the engine ISP/TWR fixes in a separate config file from all the other KSP-Interstellar integration changes, which would reside in the config in the base RealFuels mod. But my concern is, once again, wouldn't applying two different MM patches to the same Meth/LOX engine (one to change the resources used, and another to change the TWR/ISP) cause issues?

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

Engine stats belong in engine configs, simple as that. You can either roll your own to fit your needs/playstyle or you can cajole another maintainer into adding what you'd like to see. Real Fuels conveniently has a spreadsheet in or near the OP that will help you roll a custom config or help another maintainer if you want to go that route.

For fuel related stuff, like adding LqdWater to tanks, write a ModuleManager config to add KSPI fuels to RF Tank Types.

Link to comment
Share on other sites

I've got to make sure it's seen by all the related parties. In this case, it's perfectly appropriate- as the other places this is cross-posted are the base RealFuels thread (only AFTER the code changes were first introduced here, and as they didn't come to NathanKell's attention from this post), and in the "Stockalike" engine config for RealFuels- due solely to the fact that you seemed to think it more appropriate for ISP/TWR changes to the Meth/LOX engine to be included in the engine config than in the base mod...

While that may be true it also makes it very hard for someone like myself to help you out, since I have to check several different threads and potentially reply in several different places to the exact same question.

So, regarding the basic issue, that being you want KSPI to work with Real Fuels, and considering that you are an opinionated person with strong feelings about how things should work (that's not an insult, it's just The Way Things Are*), there are a few things you need to do

The config for fuel tanks belongs with Real Fuels because Real Fuels is all about fuels and mixtures. While it may concern itself with engines in a limited sense, it is not intended to deal with ISPs, thrust, mass, etc...

Real Fuels doesn't work properly without an engine config but it helpfully provides you a spreadsheet that can generate ModuleManager scripts based on the data you provide. You generally only use one engine config because, as you so astutely noticed, having multiple ModuleManager configs edit that same item quickly runs into problems even though Sarbian has added tools to help deal with that. That means you either have to roll your own engine config (which I strongly suggest given your strong opinions) or get someone to add the changes you want to their config.

One thing you can do as far as the engine config is concerned is to create a config that only concerns itself with KSPI engines. This can sit alongside another engine config (I assume you use the Stockalike config) and override their own values. Look into the :final modifier in ModuleManager for an idea of how to do this.

And that's pretty much it. I thought I'd post here again just to drive this point home, all you need for KSPI interaction with Real Fuels is two things. Learning ModuleManager and doing a bit of Excel work is pretty much all you need.

* I should again stress that this is not an insult. You bring a lot of good data to the community and that is appreciated, but you also have strong opinions on balance that may clash with a mod author's vision of how their mod should be balanced. This is why you learning ModuleManager would benefit everyone, including you. You can easily get what you want, share it with others, demonstrate to authors how your changes would work and whether they can benefit, etc... It helps take you from being a mere commentor to being a contributor, which is always a good thing.

Edited by regex
Link to comment
Share on other sites

For fuel related stuff, like adding LqdWater to tanks, write a ModuleManager config to add KSPI fuels to RF Tank Types.

How? That's the information I'm still trying to find out...

Dreadicon says he already came up with a solution that adds LqdWater storage capability to any tank that can hold Kerosene, but I'm not exactly sure what he meant by that- and if he means he went and modified each and every individual stock and mod tank currently made to work with RealFuels, it sounds like a particularly inelegant solution (and won't work as new tanks are added, such as the NovaPunch2 K1 Heavy Lifter Tanks...)

Engine stats belong in engine configs, simple as that.

Also, on this note, and given the other posts and some of my discussion with Dreadicon (who is also working on a Realfuels/KSP-Interstellar integration config, and in fact now has an early, not fully-tested version out on his dev thread...), now looking at this at a not 3 AM hour, I think the simplest solution to the problem of the KSP-Interstellar Meth/LOX engine is that the MM patches to it (and the other KSP-Interstellar engines) need to be *REMOVED* from the base RealFuels integration config, and migrated over to the individual engine configs.

There are three KSP-Interstellar engines that are currently altered by the base RealFuels (no engine config installed) file: the Al-Hybrid Rocket (it's like an SRB- both engine and tanks in one part), the Meth/LOX engine, and the DT-Vista engine. All of these should be REMOVED from the base config, and migrated over to individual engine configs so that these configs can also alter things like their ISP and TWR to be more realistic (generally this actually means lighter/ more efficient) rather than balanced against stock...

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

How? That's the information I'm still trying to find out...

As I was trying to tell you in the Real Fuels thread, the key is in the Tank Types config file. You'll basically be adding the resource to a particular tank type. Ensure that the tank you want to add it to is using the particular tank type you specify.

Link to comment
Share on other sites

As I was trying to tell you in the Real Fuels thread, the key is in the Tank Types config file. You'll basically be adding the resource to a particular tank type. Ensure that the tank you want to add it to is using the particular tank type you specify.

I'm still not quite sure what you're trying to describe, but I send a link to your post to Dreadicon, so hopefully he'll be able to figure it out.

Also, would this work with ProceduralParts+RealFuels installed? The ideal solution would make LqdWater available in all ProceduralParts+RealFuels procedural tanks, when both of those mods are installed... (it might also be wise to have a fix to add LqdWater for just ProceduralParts w/o RealFuels, but that is obviously a bit beyond your scope...)

Regards,

Northstar

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...