Jump to content

[WIP][Plugin][1.0.2] RealisticNuke - (More) Realistic Nuclear Rocket Engines


Recommended Posts

I present to you: RealisticNuke! The result of a random chat we had on the KSP Forum Steam group last night. Still extremely WIP.

What it does:

- Removes the LV-N's alternator module and internal energy storage (done with a ModuleManager Config).

- Implements its own energy generation method - the amount of ElectricCharge produced depends on the rate of energy flow to and from the engine. Maximum power is about 7.25 Ec/s. This is achieved when the engine is running close to its maximum operating temperature of 2500 degrees. Once the engine is shut down, power output will gradually decrease but the engine will still produce power several hours after shutdown thanks to residual heat in the reactor core.

- Adds a custom resource - UraniumDioxide. The LV-N has an internal storage that contains 50 units of UraniumDioxide. The engine needs this in order to produce heat. It cannot be refueled, so once the UraniumDioxide is depleted, the engine is useless. Consumes 0.00815 UraniumDioxide per 0.9 LiquidFuel. 50 units is enough to keep it running at full power for about an hour (but the real lifetime is longer because you can't run the engine at full power all the time or it'll overheat and explode). This will need to be tweaked if/when zero-thrust electricity generation is added.

What it doesn't do (yet):

- Produce power when the engine is not producing thrust. This is the #1 problem at the moment. DONE!

- Support Tweakscale.

- Support other NTR engines - for now, it only works with the stock LV-N.

Source and download available at https://github.com/CaptainKorhonen/RealisticNuke. REQUIRES MODULEMANAGER!

Changelog:

0.1.0:

- Initial release.

0.2.0:

- Overhauled the power system. The engine now has a separate "reactor" which produces all the power. Reactor power level can be adjusted in the right-click menu (between 0% and 100%). The engine itself no longer produces heat. UraniumDioxide consumption now depends on the reactor's power level, not throttle setting.

License: GNU GPL V2. You are free to modify and redistribute my code as long as you credit me as the original creator.

Edited by CaptainKorhonen
Link to comment
Share on other sites

- Produce power when the engine is not producing thrust. This is the #1 problem at the moment. Need suggestions on how to do this in a way that fits the stock game.

I never programmed any mod so far but as far as is see and i may be wrong here:

I think the problem here is that you used a hack to crate energy. You used part.RequestResource("ElectricCharge", -powerOutput * TimeWarp.deltaTime);

However this command should be used for parts that are using some resources. By negating powerOutput you made it produce electric charge iunstead of taking it. The drawback here is that it only works as long as the engine is active.

I think the correct aproach is to use

Part.AddResource ( Config node)

and then define it in the part file. However i may be wrong on that, maybe someone with more experience in part creating has another idea on that.

Edited by gpisic
Link to comment
Share on other sites

Consumes 0.00815 UraniumDioxide per 0.9 LiquidFuel.
Realistically a solid-core nuclear thermal rocket engine would never "consume" its nuclear fuel, are you attempting to model a different sort of engine? I mean, you'll certainly get some decay but at the rate you specify I imagine the entire engine would simply break up from fast neutron embrittlement or something.
Link to comment
Share on other sites

Realistically a solid-core nuclear thermal rocket engine would never "consume" its nuclear fuel, are you attempting to model a different sort of engine? I mean, you'll certainly get some decay but at the rate you specify I imagine the entire engine would simply break up from fast neutron embrittlement or something.

The density of the nuclear fuel is zero, its only purpose is to limit the engine's lifespan. The fuel consumption rate will be fixed in the next version - I think I've found a way to separate the engine and the "reactor" (you control the reactor with a slider in the rightclick menu, and thrust and electricity output depends on the reactor's power output - the engine itself doesn't heat the part anymore). Since there's now a reason to keep the reactor running even if the engine isn't used, I can decrease the fuel burn so that it takes years or even decades for it to run out. Or that's the plan, at least. We'll see.

E: To clarify, the fuel consumption was so high because 1 hour worth of fuel is more than enough for just about any mission when it's only used to produce thrust for short periods of time.

Edited by CaptainKorhonen
Link to comment
Share on other sites

The density of the nuclear fuel is zero, its only purpose is to limit the engine's lifespan.
Why would the nuclear fuel density be zero? Uranium is quite dense, there's a reason we use it for kinetic penetrators.
E: To clarify, the fuel consumption was so high because 1 hour worth of fuel is more than enough for just about any mission when it's only used to produce thrust for short periods of time.
Well, to labor the point, that's hardly "realistic". I guess I was hoping for something a bit different but clearly this is just a re-imagining.

Good luck!

Link to comment
Share on other sites

Why would the nuclear fuel density be zero? Uranium is quite dense, there's a reason we use it for kinetic penetrators.

Because no mass is lost as the fuel is turned into nuclear waste since it doesn't just go out the back (Isn't that how a closed reactor system works? Correct me if I'm wrong). I tried to add a NuclearWaste resource with the same mass as UraniumDioxide but it turns out KSP doesn't like negative numbers in the part.cfg's PROPELLANT section. I couldn't be bothered to try to get it working so I just gave UraniumOxide a density of zero so that the mass of the reactor doesn't change as fuel is burnt.

Well, to labor the point, that's hardly "realistic". I guess I was hoping for something a bit different but clearly this is just a re-imagining.

Good luck!

Don't worry, it'll be more realistic. Basically, the idea is this: The engine's right-click menu has a slider for the reactor's power setting. This adjusts the reactor core's power output. At the moment, ElectricCharge output depends on the reactor's temperature, and UraniumOxide consumption depends on the reactor's power setting (Note: Not the engine's power setting! These are two completely independent things now :)).

I'm also planning to modify it so that the temperature also affects thrust and ISP (higher temperature = higher thrust and ISP), but I'm having some trouble doing this.. I've tried assigning the atmosphereCurve to a new FloatCurve and using a for loop to go through all the keys and multiply them with a multiplier (current temperature / maximum temperature) and then replacing the atmosphereCurve with the modified FloatCurve but it doesn't seem to be working. I've looked at the KSP Interstellar "DT Vista" engine source and it seems to do the ISP modification thing in almost the exact same way as I'm doing it, apart from the fact that FractalUK creates a whole new FloatCurve and gives it values, instead of importing the atmosphereCurve and editing it like I'm trying to do.

Edited by CaptainKorhonen
Link to comment
Share on other sites

Because no mass is lost as the fuel is turned into nuclear waste
Well, actually, as you use the fuel for heat you most assuredly do lose mass since the entire process of heating the reaction mass relies on the fission process, which gives up free neutrons (which is why you need shadow shields and have to worry about neutron embrittlement). Other implementations I've seen around here have converted from nuclear fuel to depleted nuclear fuel of some sort.
I've looked at the KSP Interstellar "DT Vista" engine source and it seems to do the ISP modification thing in almost the exact same way as I'm doing it, apart from the fact that FractalUK creates a whole new FloatCurve and gives it values, instead of importing the atmosphereCurve and editing it like I'm trying to do.
That may be an actual limitation of floatCurves, you might want to ask around in plugin development.
Link to comment
Share on other sites

Loss of mass is negligible and can be ignored. If he has trouble getting the UraniumDioxide deplete and NuclearFuel build up, he might as well just use UraniumDioxide depletion and make it massless. It changes nothing and no trouble is caused.

Link to comment
Share on other sites

Loss of mass is negligible and can be ignored. If he has trouble getting the UraniumDioxide deplete and NuclearFuel build up, he might as well just use UraniumDioxide depletion and make it massless. It changes nothing and no trouble is caused.

To add to this: the idea was to make the engine useless once the nuclear core was used up; i.e. it's a sealed system, so no refueling, as originally stated. Therefore, the mass difference is going to be negligible given E = MC^2 (unless he will be producing a MASSIVE amount of power with that hunk of radioactivity AND high efficiency conversion).

It's a closed-loop system, so really no need to make it more complex by adding another resource you wouldn't be able to manipulate anyway. (Mods like Near Future Electrical have resources like Depleted Uranium because you CAN remove the waste material and refuel reactors.)

Given that the engine already had the reactor in it, the one thing you could ask for is to increase the base mass of the engine to accommodate the addition of a power generator. Maybe a handful of kilos at most. (As far as I know, RTG masses are mainly in the shielding, insulation, and fuel. All that is already in-place. Some thermocouples and extra cabling shouldn't be that much more in mass. RTG designers may and should correct me if I'm wrong.)

And some math just for fun: Assuming Wikipedia can be trusted (sometimes it can't), 1 gram of matter = 89.9 terajoules of energy, assuming complete, 100% conversion/efficiency of mass to energy. Using an example Wikipedia cites, the Hiroshima nuke loss less than a gram of mass when it exploded (~63TJ of energy was supposedly released.) For scale, 89.9TJ (1 gram) of energy/power would let a high-end gaming PC drawing 1kw of power run for ~2850 YEARS straight. (Assuming my math is right, anyway...)

So yeah: negligible mass losses = no reason for a waste resource you can't do anything with = massless intake resource.

Edited by StahnAileron
Link to comment
Share on other sites

This sounds good. Nertea is currently working on similar stuff, you maybe could join forces.

How are you ging to handle heat generation? Dies it drop, when the Engine drains fuel?

For now, the heat generation and fuel consumption are constants, but I *may* change them to exponential functions once everything is working nicely (depending on my interest in this project).

Sitrep: The engine's ISP (and therefore thrust as well) now depend on the reactor's temperature. I'll have to edit things a bit as it still produces thrust at a temperature of 4 K, which is more than 16 K lower than the temperature of the fuel (assuming it's liquid hydrogen). I might scrap the stock thermal system integration and replace it with a scripted one as that would make things A LOT simpler and easier both for me and for the people who use the mod. The current system, being 100% physics based, is just way too unpredictable and difficult to control accurately.

Link to comment
Share on other sites

Another status update: My GPU appears to have died and I'll be ordering a new one today or tomorrow. Assuming the store has the card in stock, the project will be on hold for about a week. If not, it could take a lot longer.

EDIT: New graphics card has been acquired and is working well!

Edited by CaptainKorhonen
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...