Jump to content

KSP Interstellar Extended Continued Development Thread


FreeThinker

Recommended Posts

Edit: Looks like tweak scale is having a problem with prices. New version? Anyhow when i activate tweak scale prices a borked it seems.

Please install TweakScale 1.51.1 this should avert the problem

- - - Updated - - -


PART
{
name = DustyPlasma
module = Part
author = AAristisan, Fractal, FreeThinker, Northstar1989

Notice that I took the liberty of adding my name to the end of the authors list after yours? :)

Regards,

Northstar

Ok, I will make the adjustments

Link to comment
Share on other sites

Following the installation steps for this has broken the prices for buying things with no other mods other than ATM installed. Testing it on a fresh ksp install the 1st command pod you buy costs 12 funds after the recent update.

Unless i've gotten the install completely borked and wrong (Which might be the case.)

Edit: Looks like tweak scale is having a problem with prices. New version? Anyhow when i activate tweak scale prices a borked it seems.

Tweakscale released a new version with a fix

Link to comment
Share on other sites

The .625m and 1.25m Cylindrical Nitrogen radiators consume lqdnitrogen even when there is no room to store the resulting nitrogen. The 2.5m one does the opposite. I happen to prefer the latter, as I have been using vessels that store a large amount of the liquid form (for density) and convert it to the gas as needed.

Link to comment
Share on other sites

The .625m and 1.25m Cylindrical Nitrogen radiators consume lqdnitrogen even when there is no room to store the resulting nitrogen. The 2.5m one does the opposite. I happen to prefer the latter, as I have been using vessels that store a large amount of the liquid form (for density) and convert it to the gas as needed.

I will split active cooler function into 2 sub functions. Controlled Nitrogen Cooling (existing cooling effect without wasting any nitrogen) and Emergency Bitrogen Cooling, which reduces waste heat twice as fast but waste half the nitrogen into space.

Edited by FreeThinker
Link to comment
Share on other sites

Okay, so I checked back and KSPI says it implemented the Haber process a few versions ago, but I just played around a bit with the refineries it with Extended here and I found no Haber process in them. I don't see a note here of it being removed, or on Boris's thread, or Fractal's...

So I went code-diving, basically, found the source code (very educational to someone who's never even touched the modding scene. I think I went insane for a bit), I went even deeper, and I'm guessing either the math's being redone or the process is broken or something?

Did it not play nicely with the addition of nitrogen tanks?

Welp, I guess I'll just force the game to let me do it by using Regolith...

EDIT: Okay, I'm most certainly a crazy person, but after a little bit of testing, I have as close a ratio will get to the right values, or at least as much as my tiny calculator will get me.

6574.3405275779376498800959232614 units of Nitrogen

0.3551 units of LiquidFuel

14.684287812041116005873715124816 units of Ammonia.

I've done a very tiny bit of testing, but the little KER readout that tells me the mass of my ship says the mass doesn't change by a single kilogram after making 10,881 units of ammonia.

Edited by Kohai_Khaos
Link to comment
Share on other sites

The Haber process in implemented in the FNFefinery and the code is indeed quite complicated.

I have actualy nevr taken the time to test it realy, but I have taken a new look at the code which is quite complicated

I simplified the code to the most relevant part:


double nitrogen_rate_to_add_t = (InterstellarResourcesConfiguration.Instance.Nitrogen, hydrogen_rate_t / density_nitrogen) * density_nitrogen / GameConstants.ammoniaHydrogenFractionByMass;

This seems wrong, What I think it should be is


double nitrogen_rate_to_add_t = hydrogen_rate_t / (1 - GameConstants.ammoniaNitrogenFractionByMass) / density_nitrogen;

Edited by FreeThinker
Link to comment
Share on other sites

I've redownloaded the file, tested again, and then I noticed something, glancing through the code.

You confirmed for me that the code I want is in the FNRefinery.cs file in the source code, fine enough. Then I compared it tothe InterstellarRefinery.cs file.

And then I stared at the refinery code for 2 seconds and I know what the problem is.

All those little refineries, at least in my game, had

MODULE
{
name = InterstellarRefinery
}

When it should have been

MODULE
{
name = FNRefinery
}

I don't know why my modules were set up wrong, especially since I cleaned and redid a bunch of my mods recently, but that's why I didn't have a haber process (I made this change and it readded a haber process to my test refinery that at least made a bit of ammonia to see if it worked).

If it's supposed to be using InterstellarRefinery and therefore the GUI Fractal made, the InterstellarRefinery.cs file does not have the Haber process referenced anywhere as far as I can tell, which would be why the GUI doesn't display it.

EDIT: I can confirm that the ratio is definitely off for its production, though: I just tested and I gain bunches of mass outside of atmosphere, draining from radial nitrogen tanks. Unless the thing can pick up nitrogen from over 100,000 meters above Kerbin, it's off.

EDIT: Okay, this is getting too in-depth and mathematical for me to want to waste your thread with, I'm going to go to PMs.

Edited by Kohai_Khaos
Link to comment
Share on other sites

The Haber process in implemented in the FNFefinery and the code is indeed quite complicated.

I have actualy nevr taken the time to test it realy, but I have taken a new look at the code which is quite complicated

I simplified the code to the most relevant part:


double nitrogen_rate_to_add_t = (InterstellarResourcesConfiguration.Instance.Nitrogen, hydrogen_rate_t / density_nitrogen) * density_nitrogen / GameConstants.ammoniaHydrogenFractionByMass;

This seems wrong, What I think it should be is


double nitrogen_rate_to_add_t = hydrogen_rate_t / (1 - GameConstants.ammoniaNitrogenFractionByMass) / density_nitrogen;

OK, I'm not sure I understand any of this or why it's coded the way it is...

What does "double nitrogen_rate_to_add_t" mean, first of all? Specifically, is the rate in terms of Liters/second or in terms of mass-rate (kg/s, tons/s, etc.)? And why are you solving for "double nitrogen_rate_to_add_t" when it looks like you should be solving for "ammonia_rate_to_add_t" instead?

Wouldn't it make the most sense just to add Ammonia (the Haber Process is N2 + 3 H2 --> 2 NH3) at the mass-rate nitrogen is consumed divided by the mass-fraction of nitrogen in ammonia (82.242%) as follows:

Ammonia_rate_to_add_t = nitrogen_rate_t / GameConstants.ammoniaNitrogenFractionByMass

Or, barring that (if "nitrogen_rate_t" isn't currently a function) then just do it in terms of hydrogen-consumption like such:

Ammonia_rate_to_add_t = hydrogen_rate_t / GameConstants.ammoniaHydrogenFractionByMass

If "nitrogen_rate_t", "hydrogen_rate_t", and "Ammonia_rate_to_add_t" (if that last one is a valid function) are in terms of Liters/second (as 1 unit = 1 Liter) instead of mass-rate (kg/second, tons/second, etc.), then simply compensate for the density-ratio of the two resources and use one of the following equations:

Ammonia_rate_to_add_t = (nitrogen_rate_t * density_nitrogen) / (GameConstants.ammoniaNitrogenFractionByMass * density_ammonia)

Ammonia_rate_to_add_t = (hydrogen_rate_t * density_hydrogen) / (GameConstants.ammoniaHydrogenFractionByMass * density_ammonia)

FreeThinker, the second equation you posted is overly-complicated. For example, it calculates GameConstants.ammoniaHydrogenFractionByMass by subtracting GameConstants.ammoniaNitrogenFractionByMass from 1, instead of just using GameConstants.ammoniaHydrogenFractionByMass directly.

Regards,

Northstar

Edited by Northstar1989
Link to comment
Share on other sites

I've redownloaded the file, tested again, and then I noticed something, glancing through the code.

You confirmed for me that the code I want is in the FNRefinery.cs file in the source code, fine enough. Then I compared it tothe InterstellarRefinery.cs file.

And then I stared at the refinery code for 2 seconds and I know what the problem is.

All those little refineries, at least in my game, had

MODULE
{
name = InterstellarRefinery
}

When it should have been

MODULE
{
name = FNRefinery
}

I don't know why my modules were set up wrong, especially since I cleaned and redid a bunch of my mods recently, but that's why I didn't have a haber process (I made this change and it readded a haber process to my test refinery that at least made a bit of ammonia to see if it worked).

If it's supposed to be using InterstellarRefinery and therefore the GUI Fractal made, the InterstellarRefinery.cs file does not have the Haber process referenced anywhere as far as I can tell, which would be why the GUI doesn't display it.

Lol, I now realize the FNRefinery is dead code. The correct code is referenced in the InterstellarRefinery. It must have been the code which fractal original wrote before he improved the Gui.


public override void OnStart(PartModule.StartState state)
{
if (state == StartState.Editor) return;
System.Random rnd = new System.Random();
_window_ID = rnd.Next(int.MaxValue);
_refinery_activities = new List<IRefineryActivity>();
_refinery_activities.Add(new NuclearFuelReprocessor(this.part));
_refinery_activities.Add(new AluminiumElectrolyser(this.part));
_refinery_activities.Add(new SabatierReactor(this.part));
_refinery_activities.Add(new WaterElectroliser(this.part));
_refinery_activities.Add(new AnthraquinoneProcessor(this.part));
_refinery_activities.Add(new MonopropellantProducer(this.part));
_refinery_activities.Add(new UF4Ammonolysiser(this.part));
RenderingManager.AddToPostDrawQueue(0, OnGUI);
}

indeed the Haber process is not mentioned.

This also explains why FNRefinery was a total mess, it was abandoned dead code...

- - - Updated - - -

FreeThinker, the second equation you posted is overly-complicated. For example, it calculates GameConstants.ammoniaHydrogenFractionByMass by subtracting GameConstants.ammoniaNitrogenFractionByMass from 1, instead of just using GameConstants.ammoniaHydrogenFractionByMass directly.

Just forget anything I said about it, it's dead code, we need to define a new class specificly for the haberprocess

Edited by FreeThinker
Link to comment
Share on other sites

I'm trying to create new code for calculation of Haber process, could anyone verify if my calculations are correct:


public void UpdateFrame(double rate_multiplier)
{
_current_power = PowerRequirements * rate_multiplier;

_current_rate = CurrentPower / PluginHelper.HaberProcessEnergyPerTon;

double ammoniaNitrogenFractionByMass = (1 - GameConstants.ammoniaHydrogenFractionByMass);

double hydrogen_rate = _current_rate * GameConstants.ammoniaHydrogenFractionByMass;
double nitrogen_rate = _current_rate * ammoniaNitrogenFractionByMass;

_hydrogen_consumption_rate = _part.RequestResource(InterstellarResourcesConfiguration.Instance.Hydrogen, hydrogen_rate * TimeWarp.fixedDeltaTime / _hydrogen_density) * _hydrogen_density / TimeWarp.fixedDeltaTime;

_atmospheric_nitrogen_rate = FlightGlobals.getStaticPressure(_vessel.transform.position) * ORSAtmosphericResourceHandler.getAtmosphericResourceContentByDisplayName(_vessel.mainBody.flightGlobalsIndex, "Nitrogen") * _current_rate * 10;
if (_atmospheric_nitrogen_rate > nitrogen_rate)
_nitrogen_consumption_rate = nitrogen_rate;
else
_nitrogen_consumption_rate = _part.RequestResource(InterstellarResourcesConfiguration.Instance.Nitrogen, nitrogen_rate * TimeWarp.fixedDeltaTime / _nitrogen_density) * _nitrogen_density / TimeWarp.fixedDeltaTime;

if (_hydrogen_consumption_rate > 0 && _nitrogen_consumption_rate > 0)
_ammonia_production_rate = -_part.RequestResource(InterstellarResourcesConfiguration.Instance.Ammonia, -_nitrogen_consumption_rate / ammoniaNitrogenFractionByMass * TimeWarp.fixedDeltaTime / _ammonia_density) * _ammonia_density / TimeWarp.fixedDeltaTime;

updateStatusMessage();
}

Edited by FreeThinker
Link to comment
Share on other sites

So, I am adamant about the idea that the proper career should start with Sounding Rockets and unmanned tech, advancing to manned, and then future tech/warp. Is there any word on if there will be a compatible tree that will wrap Interstellar + Remote Tech + Mod-Oriented Tech Tree (Unmanned)?

Or better yet, drop the MuMech Treeloader and use the one that seems to be used by every other mod I have seen? I think it's Tech Manager, which has an "Unofficial KSP Interstellar" entry in it when Interstellar is present in my GameData folder. The need for the MuMech Treeloader is confusing as both loaders are presented at a new game start. it's like having to enter a car and exit the other side to enter and drive another car sitting next to the first. Can't we just go around?

Link to comment
Share on other sites

So, I am adamant about the idea that the proper career should start with Sounding Rockets and unmanned tech, advancing to manned, and then future tech/warp. Is there any word on if there will be a compatible tree that will wrap Interstellar + Remote Tech + Mod-Oriented Tech Tree (Unmanned)?

Or better yet, drop the MuMech Treeloader and use the one that seems to be used by every other mod I have seen? I think it's Tech Manager, which has an "Unofficial KSP Interstellar" entry in it when Interstellar is present in my GameData folder. The need for the MuMech Treeloader is confusing as both loaders are presented at a new game start. it's like having to enter a car and exit the other side to enter and drive another car sitting next to the first. Can't we just go around?

we already are only using techmanager

Link to comment
Share on other sites

You can safely get rid of TreeLoader, it's abandoned software and TechManager is currently (0.90) the only tech tree manager that actually works.

FreeThinker's KSPI Extended is properly integrated with the Communty Tech Tree (CTT), which is probably the one you should use if you want to have a lot of mods play together properly.

Link to comment
Share on other sites

I'm trying to create new code for calculation of Haber process, could anyone verify if my calculations are correct:

Well first I need to know what your intentions were for each line of code...

public void UpdateFrame(double rate_multiplier)

What does this mean, first of all? What is it there for? What is it supposed to do?

{

_current_power = PowerRequirements * rate_multiplier;

Does "_current_power" represent the currently available power-levels or the amount available relative to the needs of the reaction? And what does "rate_multiplier" indicate?

Does "rate_multiplier" indicate the rate the reaction proceeds at relative to the amount of power consumed? (where higher "rate_multiplier" indicates a faster reaction)

The more energy-hungry the reaction the slower it is going to proceed at a given amount of available power. The faster the reaction's inherent progress the faster it will proceed for a given amount of power. Where is the term for the amount of electricity available for the reaction in the first place though? If this is what "_current_power" indicates, then it should be *completely* unrelated to the power requirements or rate_multiplier of the reaction and should be derived solely from the reactor/solar panel capacities and other energy-demands of the ship where this is all taking place...

_current_rate = CurrentPower / PluginHelper.HaberProcessEnergyPerTon;

This one makes a lot more sense. Reaction rate (what I assume "_current_rate" indicates) should indeed be proportional to the available power levels ( is this what "CurrentPower" means? How does this relate to "_current_power" from before?) and inversely-proportional to the power-requirements per ton of the reaction.

This is where the "rate_multiplier" should factor in though- the available power on the ship should be completely unaffected by a reaction's rate-multiplier, but rate for a given reaction should of course be affected by it... So, the above two equations should probably look more like the following:

CurrentPower = reactor_capacity - Other_PowerRequirements

and

_current_rate = rate_multiplier * CurrentPower / PluginHelper.HaberProcessEnergyPerTon

You'll notice I assumed "_current_power" and "CurrentPower" were the same thing (why have two terms with confusingly similar names?), and made up two terms to reflect the reactor capacity on the ship and other power-requirements on this ship... It doesn't make sense to ignore other power-draws on the ship when calculating available power-levels (like you appeared to do earlier) and even less sense to calculate the available power-levels in terms of the inherent rate (the rate-multiplier) of a chemical reaction: two terms that should be completely independent of each other...

double ammoniaNitrogenFractionByMass = (1 - GameConstants.ammoniaHydrogenFractionByMass);

Please see where I clarified this is my last post. The nitrogen-fraction of ammonia is always equal to 1 minus the nitrogen-fraction of hydrogen (and vise-versa) so there is absolutely no need for the "double" modifier here (it is completely inappropriate to be doubling, halving, etc. anything in this calculation)

ammoniaNitrogenFractionByMass = (1 - GameConstants.ammoniaHydrogenFractionByMass)

The above accurately describes the relationship of the two. Why is nitrogen-fraction not also a GameConstant though? Like ammonia's hydrogen-fraction it never changes...

Or, does "double" refer to double floating-point accuracy in the calculation (in which case nothing needs to be changed).

double hydrogen_rate = _current_rate * GameConstants.ammoniaHydrogenFractionByMass;

double nitrogen_rate = _current_rate * ammoniaNitrogenFractionByMass;

What do these terms even mean? The current rate of what, exactly? If it's the current rate the Haber Process is proceeding at, it's completely inaccurate. These would be calculated one of two ways depending on whether rates are in terms of volume or mass (please see my post earlier- I asked a lot of questions that would have helped with teasing apart this code...)

If the rates are already mass-rates, then the following equations apply:

hydrogen_rate = _current_rate * GameConstants.ammoniaHydrogenFractionByMass

nitrogen_rate = _current_rate * ammoniaNitrogenFractionByMass

Once again, no multiplication of either value is required. Or, did the "double" term refer to using double floating-point accuracy of the equation? In which case what you had before was fine...

_hydrogen_consumption_rate = _part.RequestResource(InterstellarResourcesConfiguration.Instance.Hydrogen, hydrogen_rate * TimeWarp.fixedDeltaTime / _hydrogen_density) * _hydrogen_density / TimeWarp.fixedDeltaTime;

OK, so back to the question I asked before: are rates given in terms of volume or mass-rates?

Either way, if I'm reading this equation correctly, you multiply by a TimeWarp-factor only to divide it right back out, and divide by hydrogen_density only to multiply it back in. What's with that? It means the current equation is just a much more complicated way of writing:

_hydrogen_consumption_rate = _part.RequestResource(InterstellarResourcesConfiguration.Instance.Hydrogen, hydrogen_rate)

Whatever that even means... You're going to have to explain what this whole "InterstellarResourcesConfiguration.Instance" bit means if you want me (or most anyone else) to help you better...

Will analyze the rest of the code in a little bit. Need to take a bathroom-break and grab some food right now...

Regards,

Northstar

Link to comment
Share on other sites

Released Version 0.7.21 for Kerbal Space Program 0.90 Released on 2015-03-11

  • Added charged Particle Store to Antimatter Reactors
  • Antimatter reactors produce 80% charged particles
  • Doubled energy concentration antimatter
  • Magnetic Nozzle can now be connected to Antimatter reactors
  • Magnetic Nozzle can now be stack connected over a maximum part distance of 100
  • Power required to use magnetic nozzle depends on distance of Magnetic nozzle from ChargedReactor
  • When NFT-E is installed, all KSPI reactors, nozzles and radiators scale down in thermal power production/requirement by a factor of 500
  • Added Haber Process

- - - Updated - - -

OK, so back to the question I asked before: are rates given in terms of volume or mass-rates?

all rates are mass-rates

Edited by FreeThinker
Link to comment
Share on other sites

No why would you want that?

simian endeavors has several beautiful radial-attaching engines based off of various star trek ships. I would love to make MM patches to convert them to the KSPI vista, mpd, thermal, and magnetic drives. the former function as is, but the other two do not.

Link to comment
Share on other sites

simian endeavors has several beautiful radial-attaching engines based off of various star trek ships. I would love to make MM patches to convert them to the KSPI vista, mpd, thermal, and magnetic drives. the former function as is, but the other two do not.

Interesting. I had some ideas to allow radial attached engines but my main concern is that the connection between radial attached parts is not good enough for most parts, but I might include some exceptions for radial engine parts. Where can I find these radial attacked engines?

By the way, could anyone help me with improving the trust FX effects of electric engines, they are just horrible

Edited by FreeThinker
Link to comment
Share on other sites

Interesting. I had some ideas to allow radial attached engines but my main concern is that the connection between radial attached parts is not good enough for most parts, but I might include some exceptions for radial engine parts. Where can I find these radial attacked engines?

By the way, could anyone help me with improving the trust FX effects of electric engines, they are just horrible

Forum thread: http://forum.kerbalspaceprogram.com/threads/75625-WIP-Simian-Endeavors-v0-3-2-May-23 (he has not updated in quite a while)

Download link: http://www./download/ixqw1db1m1d39h9/SimianEndeavors0.3.2.zip

Author: BobsYerUncle

It just occurred to me that it might be possible to use that welding mod to make a single part module consisting of (essentially) a barrel with each respective pair attached (thereby giving it regular stack nodes).

EDIT:

I am currently working on doing just that.

I have been using the following two FX's (needs smokescreen and MP_Nazari):


MODEL_MULTI_PARTICLE_PERSIST
{
name = flameThermBlue
modelName = MP_Nazari/FX/flameion
transformName = thrustTransform
emission = 0.0 0.0
emission = 0.05 1.25
emission = 0.75 1.50
emission = 1.0 4.00
speed = 0.0 1.98
speed = 1.0 1.50
energy = 0.0 0.33 // Same for energy
energy = 1.0 1.25 // Same for energy
size = 0.0 .2
size = 1.0 .6
fixedEmissions = false
}

MODEL_MULTI_PARTICLE_PERSIST
{
name = flamethrust
modelName = MP_Nazari/FX/flamenuke
transformName = thrustTransform
emission = 0.0 0.0
emission = 0.37 0.00
emission = 0.67 0.33
emission = 1.0 0.55
speed = 0.0 0.75
speed = 1.0 0.97
energy = 0.0 0.50 // Same for energy
energy = .25 1.20 // Same for energy
offset = -0.15 0.0
size = 0.0 2.0
size = .5 2.0
fixedEmissions = false
}

Edited by ABZB
Link to comment
Share on other sites

I have created parts as I suggested above. I have posted them to my dropbox. The file includes :

-cfgs that create a single part using various of those models and a stock fuel tank, for:

Attila

Magnetic Nozzle

MPD

Thermal Turbojet

Vista

-a MM config removing the original engine cfgs

https://www.dropbox.com/s/ualws8vtu28czxw/SimianEndeavorsKSPI.zip?dl=0

You need to also download the Simian Endeavors engine pack, linked in the above post.

MP_Nazari's FX pack and Smokescreen are dependencies.

Edited by ABZB
Link to comment
Share on other sites

Are all of the RealFuels compatibility MM files now included in this mod? After installing KSP-I Extended 0.7.21, I can't fill any of the tanks for RealFuels (debug console shows error messages like "[Error]: Unable to find tank definition for type "Cryogenic" reverting." when selecting a tank).

Link to comment
Share on other sites

SpaceHungryMan,

I might consider looking for mod-conflicts. I am currently running KSP-Intestellar Extended and RealFuels together without this issue (although I am running RealFuels 8.3). However if your code solves the issue, and others are experiencing the same issue, I can't see why not to use it...

I was unable to add Water and CarbonDioxide because those exact resource names already exist due to TACLS and NFT.

TACLS and NFT aren't part of RealFuels. They will be going in on CRP, but that hasn't been finalized yet. So, there shouldn't be any reason a RealFuels config can't add these resources to RealFuels tanks- the tank definitions do not include any data on the resources they contain except the name. Thus, there should be no conflict with adding these resources to RealFuels tanks (although KSP-Interstellar should have compatibility issues even loading up in the first place if another mod has identically-named resources with different densities/costs...

Any naming conflicts with TACLS and NFT will also become moot when the next CRP is out anyways (as we will have a communal Water and CarbonDioxide resource).

Regards,

Northstar

- - - Updated - - -

On an entirely different note- the plasma thrusters aren't working anymore...

6SGvwsr.png

Besides displaying an ISP of "0" or "infinity" in the VAB and not giving a Delta-V readout with the Kerbal Engineer sub-module of MechJeb, now they say they're propellant-deprived even when they have plenty of propellant available...

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