Jump to content

[1.10+] SolverEngines


NathanKell
 Share

Recommended Posts

SolverEngines is by NathanKell and blowfish, based on the work of camlost for AJE.

Installation:

Merge the zip's GameData folder with your KSP/GameData folder. After installing, inside KSP/GameData should be a SolverEngines folder (and inside that, Icons and Plugins folders).

Note: Unless a mod you are using requires this, do not install it. It's for developers, not end users.

Download

GitHub (source)

License: LGPL.

SolverEngines is at its heart a replacement paradigm for how KSP deals with engines, splitting engines into a partmodule and an engine solver. Instead of a single engine module that does everything, or that is specifically geared to a single type of enigne, and instead of needing to keep a stock engine module present but then override its values every tick, SolverEngines decouples the engine module from the code that handles performance (the solver).

SolverEngines consists of five parts: the engine module and the engine solver, a replacement for the intake module that is geared to work with SolverEngines, a GUI for various flight and engine stats, and a replacement for ModuleAnimateHeat. The engine module derives from ModuleEnignesFX (and therefore is visible to MechJeb and KER), and handles all direct KSP interaction. The solver gets input data, and exposes various public methods for the module to get information back. The intake module derives from ModuleResourceIntake.

ModuleAnimateEmissive replaces ModuleAnimateHeat with a more flexible, configurable module. It can either be linked to a part's temperature (the default) or be told what state it should be each frame (so SolverEngines can control emissive animations directly).

NOTE: With the exception of ModuleAnimateEmissive, SolverEngines is **not a mod for end-users**. It is a mod for developers, who should derive classes from ModuleEnginesSolver and EngineSolver (as AJE and RealFuels do). It will do nothing on its own.

To use SolverEngines, implement two classes: a class that derives from EngineSolver that handles all calculation of thrust, Isp, and fuel flow given the passed-in parameters (and any new ones necessary), and a class that derives from ModuleEnginesSolver and overrides CreateEngine() to create an engine solver of the new type (and passes it any creation stats). Also override the info methods so proper info is displayed. You may also need to override other virtual methods in ModuleEnginesSolver (like UpdateFlightConditions and UpdateThrottle) depending on your engine's need for more status information or other requirements, and methods like OnStart or OnLoad to deal with more complexity.

Note that SolverEngines uses the [KSPAssembly] tag. Add this line to your AssemblyInfo.cs file to make KSP aware that your assembly depends on SolverEngines:

[assembly: KSPAssemblyDependency("SolverEngines", 1, 0)]

(Example, in AJE.)

SolverEngines will also automatically create overheat bars if engineTemp approaches maxEngineTemp, and will set all ModuleAnimateEmissive modules on the part to solver.GetEmissive() each tick.

SolverEngines includes a GUI to display useful information about engines in flight, and additional info about air-breathing engines using SolverEngines when they are present. The GUI will display an icon on blizzy87's toolbar if available, or on the stock toolbar if it is not. All fields in the display GUI can be disabled in the settings window, and the display units can be changed in the units window.

See AJE or RealFuels for examples of how to implement SolverEngines in practice.

Edited by NathanKell
Link to comment
Share on other sites

Neat, but how is this better than using the stock engine modules?

SolverEngines doesn't do anything by itself. Rather, it provides an API for other plugins to use custom calculations for engine thrust and fuel consumption. This is mainly targeted at realism mods (AJE and RealFuels) but really can be used anywhere the stock engine calculations are deemed insufficient. For instance, if you wanted to vary Isp with throttle, you couldn't do that in stock so you'd need a custom calculation.

Link to comment
Share on other sites

  • 2 weeks later...

I am still getting engines not re igniting with the latest version on GIT. I can get them to reignite if I shut them down with throttle !=0 and reloading the save and starting the engines. Is the solver engines on the AJE any different or do i NEED engine ignitor? Really hope a fix is found this is quite annoying. I am using RealFuels with all engines running moduleEnginesRF

Edited by Svm420
Link to comment
Share on other sites

I am still getting engines not re igniting with the latest version on GIT. I can get them to reignite if I shut them down with throttle !=0 and reloading the save and starting the engines. Is the solver engines on the AJE any different or do i NEED engine ignitor? Really hope a fix is found this is quite annoying. I am using RealFuels with all engines running moduleEnginesRF

Are you talking about AJE engines specifically? If so, make sure you have the latest version of AJE and SolverEngines from Github, and if the issue persists, I need full reproduction steps.

Link to comment
Share on other sites

Are you talking about AJE engines specifically? If so, make sure you have the latest version of AJE and SolverEngines from Github, and if the issue persists, I need full reproduction steps.

No not AJE I am only using solver engines with RealFuels. Anytime I bring throttle down to 0 and raise it above 0 the engine is no longer running and will not restart without doing the save load process I mentioned above. I had wondered if the solver engines that comes with AJE had solved this issue. I am using the latest solver engine available on the solver engine Github not the last release

Link to comment
Share on other sites

No not AJE I am only using solver engines with RealFuels. Anytime I bring throttle down to 0 and raise it above 0 the engine is no longer running and will not restart without doing the save load process I mentioned above. I had wondered if the solver engines that comes with AJE had solved this issue. I am using the latest solver engine available on the solver engine Github not the last release

I'm pretty sure the issue is fixed. You need to update RealFuels from Github as well. The version of SolverEngines on AJE's Github page is indeed the latest.

Link to comment
Share on other sites

  • 2 weeks later...

Yep,I'm coding a Mod about (Rocket,so far) Engine's Development using SolverEngines and found it really should be a stock(faceplam for Squad(joking,actually everyone is doing a good job)

http://forum.kerbalspaceprogram.com/threads/125579-WIP-Help-needed-Engine-Development-Customable-Nozzle-PowerCycle-and-more-%28My-first-KSP-mod

Link to comment
Share on other sites

  • 2 weeks later...

When I try to install AJE from CKAN it comes up with both solver engines and animate emissives as dependencies but when it tries to install them they conflict with each other, preventing me from installing AJE or any other mods that I'm trying to install at the same time.

Link to comment
Share on other sites

Is there any way of varying the mass of an engine when you change the fuel mix type? Also, could you maybe put an option in to change the ISP values for different config types to the real value in seconds, rather than a fraction of the standard isp? If you're not too busy that is... thanks! Also, would it be possible to make a cheatsheet with all of the different variables for a config and what they do on it?

Edited by Deserdi Verimas
Link to comment
Share on other sites

  • 3 months later...

Log spam when using SolverEngines 1.9 and RF 10.6.1.

[EXC 22:10:21.185] NullReferenceException: Object reference not set to an instance of an object DeadlyReentry.ModuleHeatShield.FixedUpdate ()

[EXC 22:10:21.186] NullReferenceException: Object reference not set to an instance of an object

DeadlyReentry.ModuleHeatShield.FixedUpdate ()

[EXC 22:10:21.191] MissingFieldException: Field 'SolverEngines.ModuleEnginesSolver.actualThrottle' not found.

SolverEngines.ModuleEnginesSolver.FixedUpdate ()

RealFuels.ModuleEnginesRF.FixedUpdate ()

[EXC 22:10:21.194] MissingFieldException: Field 'SolverEngines.ModuleEnginesSolver.actualThrottle' not found.

SolverEngines.ModuleEnginesSolver.FixedUpdate ()

RealFuels.ModuleEnginesRF.FixedUpdate ()

[EXC 22:10:21.195] NullReferenceException: Object reference not set to an instance of an object

DeadlyReentry.ModuleHeatShield.FixedUpdate ()

[EXC 22:10:21.196] NullReferenceException: Object reference not set to an instance of an object

DeadlyReentry.ModuleHeatShield.FixedUpdate ()

[EXC 22:10:21.215] MissingFieldException: Field 'SolverEngines.ModuleEnginesSolver.actualThrottle' not found.

SolverEngines.ModuleEnginesSolver.FixedUpdate ()

RealFuels.ModuleEnginesRF.FixedUpdate ()

[EXC 22:10:21.218] MissingFieldException: Field 'SolverEngines.ModuleEnginesSolver.actualThrottle' not found.

SolverEngines.ModuleEnginesSolver.FixedUpdate ()

RealFuels.ModuleEnginesRF.FixedUpdate ()

[EXC 22:10:21.219] NullReferenceException: Object reference not set to an instance of an object

DeadlyReentry.ModuleHeatShield.FixedUpdate ()

[EXC 22:10:21.220] NullReferenceException: Object reference not set to an instance of an object

DeadlyReentry.ModuleHeatShield.FixedUpdate ()

[EXC 22:10:21.225] MissingFieldException: Field 'SolverEngines.ModuleEnginesSolver.actualThrottle' not found.

SolverEngines.ModuleEnginesSolver.FixedUpdate ()

RealFuels.ModuleEnginesRF.FixedUpdate ()

fixed by using newer versions

Edited by 01010101lzy
Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
  • 2 months later...
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.

 Share

×
×
  • Create New...