Windspren

[WIP] [1.4.3] ISRU Extended 0.3

Recommended Posts

Hello everyone!

Because I'm new to mod making (this is my first mod), I thought I'd try starting out with a relatively simple mod.

I use a lot of mods, a few of which require Community Resource Pack as a dependency. Thus, whenever I scan a body for resources, I end up with a fairly large list of things, from Water to CarbonDioxide. However, I never end up using most of these resources, and as most mods only add converter modules for a few of them, the vast majority end up ignored. Many of these resources could be integrated fairly well with Stock mechanics without necessitating new parts or complex processing chains. Thus, this mod attempts to create uses for several resources added by CRP.

 

This is essentially a collection of patches designed to allow stock parts to harvest and convert the resources added by CRP. It will be fully modular, so you don't end up with redundant converters or harvesters for resources you don't want, and it will only use Stock parts (primarily because I have no idea how to texture or model things, but keep that a secret). The stock drills are used for crustal resources, the atmospheric fluid spectro-variometer is used for atmospheric resources, and I plan on using the radial air intake for oceanic resources.

 

For simplicity, resources such as LiquidFuel and Oxidizer are generalized, and are not intended to be fully accurate. In addition, the conversion factors for most of these patches are undoubtedly wrong, partially due to a desire for simplicity and partially because I can't be bothered. If you have a suggestion for a more realistic conversion factor, feel free to tell me! If I ever get into RO, I might consider adding patches for realistic ISRU, but for now I consider this to be a short-ish term project designed to practice my glorious and expansive config-editing skills. This might change depending on community reaction, but don't expect too much for now.  :P 

In addition to this, I plan on including simplified conversion patches for those who don't want to bother carrying tanks for ~5 separate resources; an early example of this is substituting H2 for Ore (electrolyzed water ice) in the Simple Sabitier conversion.

 

Downloads

 

Installation

1. Download the mod

2. Install CRP and ModuleManager, either from the bundled download or from a separate source

3. Select the modules you wish to install. Do not install both the normal and simplified versions at once, as this may lead to issues

 

 

Planned Features

Green: Implemented

Yellow: In progress

Red: On hold

 

Conversions

-Sabitier | LqdHydrogen + CarbonDioxide = LiquidFuel + Water

-Water Electrolysis | Water = LqdHydrogen + Oxidizer

-Simple Water Electrolysis | Water = LiquidFuel + Oxidizer

 

-Water Extraction | Hydrates = Water

-Simple Water Extraction | Ore = Water

 

-SolidFuel Refining | Alumina = SolidFuel   (If I can find a way to allow SolidFuel to be moved)

-Various processes involving MetalOre, RocketParts, MaterialKits, etc. Currently on hold due to the fact that mods that use these resources tend to include their own converters

 

Harvesters

-CO2 Extraction

-Water Mining

 

-Hydrates Mining

-Argon Extraction

-Xenon Extraction

-Oxygen Extraction

-Liquid Water Extraction 

-Oceanic Fuel Extraction (intended for Eve)

 

-Hydrogen Extraction   (Depending on availability in stock atmospheres)

-Alumina Mining   (See SolidFuel Refining)

 

 

Other

-Add part switching to the stock ore tanks to add capacity for every relevant CRP resource

-More realistic resource ratios

 

-Using ModuleManager to add these conversions to ISRU parts from other mods

 

-Interplanetary resources, for use with Bussard collectors and such. This would probably require a new part for the collector, so I'm holding off on it for now

-RealFuels integration, depending on feedback

-Custom atmospheric and oceanic extractors if someone wants to help with that

 

 

 

Changelog

Spoiler

0.3

- Mass is now conserved during reactions

- Stock ore tanks can be switched between several CRP resources

- Balanced CO2 collection

- Added B9 Part Switch support

- Removed Simple Sabitier due to issues with mass balance and redundancy

------------------------------------------------------------------

0.2

- Fixed water miner patch

- Fixed license

- Added heat curves for converters

- Changed file structure

------------------------------------------------------------------

0.1

- Initial release

 

 

 

 

Licensed as Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International

 

 

 

Feedback and suggestions are appreciated!

Edited by Windspren

Share this post


Link to post
Share on other sites

Neat idea! Congrats on your first mod. I have a few suggestions/ideas:

1.) Maybe this is intended but the ISRU converters do not generate heat. (Curves are missing.)

2.) Water miner doesn't work. (Closing brackets ' } ' for @PART{} are missing.)

3.) The Sabatier process generates vast amounts of mass. Per 1 kg input, about 78 kg output are created. If you don't want to do all the volume/density/mass calculations yourself, MM can do this for you (requires some advanced MM configs). Enter the ratio as tons/sec and divide it by the resources density to get units/sec:

Ratio = 0.001						// t/s; 0.001 = 1kg/s
@Ratio /= #$@RESOURCE_DEFINITION[<RescourceName>]/density$		// t/s / t/U = U/s

Replace <ResourceName> with whatever recource you want. More details are in the MM Handbook/Syntax.

4.) There are several mods that add new resource harvesters to the stock drills. To prevent double entrys, it's good to have the patch check for existing harvesters of the same resource:

@PART[RadialDrill]:HAS[!MODULE[ModuleResourceHarvester]:HAS[#ResourceName[<ResourceName>]]]

5.) For modularity I recommend PatchManager:

6 hours ago, Windspren said:

SolidFuel Refining | Alumina = SolidFuel   (If I can find a way to allow SolidFuel to be moved)

6.) Not sure if that is what you want but you can refill empty SRBs by changeing the flow-properties 'temporary' with the FlowMode key in the converter:

		 OUTPUT_RESOURCE
		 {
			ResourceName = SolidFuel
			Ratio = 1
			DumpExcess = false
			FlowMode = STAGE_PRIORITY_FLOW
		 }

7.) I'm no expert on the license stuff but afaik you need to include a copy of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license into your download.

Hope you can put some of this to good use and Happy Modding! :)

Share this post


Link to post
Share on other sites
8 hours ago, DeltaDizzy said:

I can help with the part switching.

Thank you, that would be great!

 

1 hour ago, Eleusis La Arwall said:

Neat idea! Congrats on your first mod. I have a few suggestions/ideas:

1.) Maybe this is intended but the ISRU converters do not generate heat. (Curves are missing.)

2.) Water miner doesn't work. (Closing brackets ' } ' for @PART{} are missing.)

3.) The Sabatier process generates vast amounts of mass. Per 1 kg input, about 78 kg output are created. If you don't want to do all the volume/density/mass calculations yourself, MM can do this for you (requires some advanced MM configs). Enter the ratio as tons/sec and divide it by the resources density to get units/sec:


Ratio = 0.001						// t/s; 0.001 = 1kg/s
@Ratio /= #$@RESOURCE_DEFINITION[<RescourceName>]/density$		// t/s / t/U = U/s

Replace <ResourceName> with whatever recource you want. More details are in the MM Handbook/Syntax.

4.) There are several mods that add new resource harvesters to the stock drills. To prevent double entrys, it's good to have the patch check for existing harvesters of the same resource:


@PART[RadialDrill]:HAS[!MODULE[ModuleResourceHarvester]:HAS[#ResourceName[<ResourceName>]]]

5.) For modularity I recommend PatchManager:

6.) Not sure if that is what you want but you can refill empty SRBs by changeing the flow-properties 'temporary' with the FlowMode key in the converter:


		 OUTPUT_RESOURCE
		 {
			ResourceName = SolidFuel
			Ratio = 1
			DumpExcess = false
			FlowMode = STAGE_PRIORITY_FLOW
		 }

7.) I'm no expert on the license stuff but afaik you need to include a copy of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license into your download.

Hope you can put some of this to good use and Happy Modding! :)

Oh wow, thanks for all that information! I haven't really looked into the finer parts of what MM can do, but I'll be sure to incorporate this into 0.2. As for the license, I included it inside the README, but I can always make it a separate text file if that's preferred.

Share this post


Link to post
Share on other sites
14 minutes ago, Windspren said:

Oh wow, thanks for all that information! I haven't really looked into the finer parts of what MM can do, but I'll be sure to incorporate this into 0.2.

You're welcome! If you invest some time into the finer parts of MM, it will pay off soon enough. Specially with all the converters you'll be doing ;)

9 minutes ago, Windspren said:

As for the license, I included it inside the README, but I can always make it a separate text file if that's preferred.

The README states:

ISRU Extended v0.1

To install, delete the modules you do not wish to add. Only keep one set of each module; do not use both the Simple and normal versions of each one, or issues will result.

Licensed as Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International

To my knowledge that is not sufficient and you need to include copy of the entire license, like this:

https://github.com/BobPalmer/CommunityResourcePack/blob/master/FOR_RELEASE/License_CC.txt

Share this post


Link to post
Share on other sites
4 hours ago, Eleusis La Arwall said:

4.) There are several mods that add new resource harvesters to the stock drills. To prevent double entrys, it's good to have the patch check for existing harvesters of the same resource:


@PART[RadialDrill]:HAS[!MODULE[ModuleResourceHarvester]:HAS[#ResourceName[<ResourceName>]]]

5.) For modularity I recommend PatchManager:

 

1) you cant have more than 1 HAS pass. Your example would be changed to 

@PART[RadialDrill]:HAS[!MODULE[ModuleResourceHarvester],[#ResourceName[<ResourceName>]]]

also are you trying to see if the part doesnt have ModuleResourceHarvester? if so, that would be 

HAS[MODULE[!ModuleResourceHarvester],blah]

2) I think its best if you try and avoid dependencies for your mods. Modularity can be accomplished just fine without Patch Manager, but if @Windspren wants to include it, by all means he can.

Share this post


Link to post
Share on other sites
20 minutes ago, DeltaDizzy said:

1) you cant have more than 1 HAS pass. Your example would be changed to 


@PART[RadialDrill]:HAS[!MODULE[ModuleResourceHarvester],[#ResourceName[<ResourceName>]]]

also are you trying to see if the part doesnt have ModuleResourceHarvester? if so, that would be 


HAS[MODULE[!ModuleResourceHarvester],blah]

I ran a few tests and my example with 2 HAS passes does what I need it to do.

I try to see if the part does not have any ModuleResourceHarvester that has ResourceName = <ResourceName>. So it's a HAS pass inside another HAS pass. The patch you suggested would look for ResourceName at PART-level but I need it to look inside the ModuleResourceHarvester.

Originally I used this in my KeridianDynamics mod to make stock-drills able to harvest MetalOre:

@PART[RadialDrill|MiniDrill]:HAS[!MODULE[ModuleResourceHarvester]:HAS[#ResourceName[MetalOre]]]:FOR[KD610]
//	@PART[RadialDrill|MiniDrill]:HAS[!MODULE[ModuleResourceHarvester],[#ResourceName[MetalOre]]]:FOR[KD610]
{
	+MODULE[ModuleResourceHarvester]:HAS[#ResourceName[Ore]]
	{
		@Efficiency /= 3
		@ResourceName = MetalOre
		@ConverterName = MetalOre Harvester
		@StartActionName = Start MetalOre Harvester
		@StopActionName = Stop MetalOre Harvester
		@ToggleActionName = Toggle MetalOre Harvester
		@INPUT_RESOURCE
		{
			@Ratio *= 2
		}
	}
}

To test the patch I add a new test.cfg in GameData containing:

@PART[RadialDrill|MiniDrill]:FIRST
{
	+MODULE[ModuleResourceHarvester]:HAS[#ResourceName[Ore]]
	{
		@Efficiency /= 3
		@ResourceName = MetalOre
		@ConverterName = MetalOreFIRST
		@StartActionName = Start MetalOreFIRST
		@StopActionName = Stop MetalOreFIRST
		@ToggleActionName = Toggle MetalOreFIRST
		@INPUT_RESOURCE
		{
			@Ratio *= 2
		}
	}
}

1. Run: The RadialDrill has one ModuleResourceHarvester with ConverterName = MetalOreFirst and no further ModuleResourceHarvester for MetalOre. The KD610 patch did not add a second Harvester for MetalOre.
Renamed test.cfg to test.txt
2. Run: The RadialDrill has one ModuleResourceHarvester with ConverterName = MetalOre and no further ModuleResourceHarvester for MetalOre. The KD610 patch did add a Harvester for MetalOre.
Switched to the comma notation you suggested (I've commented out that line in the KD610 patch)
3. Run: No MetalOre Harvester at all on the RadialDrill.

47 minutes ago, DeltaDizzy said:

2) I think its best if you try and avoid dependencies for your mods. Modularity can be accomplished just fine without Patch Manager, but if @Windspren wants to include it, by all means he can.

I fully agree to that, but PatchManager is no hard dependency. If you set up the configs correct, everything works as intended even with PM not installed. You just can't toggle patches from within the game. However I admit that it's easier to delete a folder in GameData than search for a specific patch if a user doesn't want to use PM.

Share this post


Link to post
Share on other sites
7 minutes ago, Eleusis La Arwall said:

I fully agree to that, but PatchManager is no hard dependency.

Well thats's a relief, since im kind of ticked off that a lot of LGG's mods have the 2 new dependencies that are, in my opinion, simply unnecessary.

Edited by DeltaDizzy

Share this post


Link to post
Share on other sites

@Eleusis La Arwall Sorry to bother you, but could you explain a bit more on how to get MM to calculate conversion ratios? I think I understand the math, but I'm not exactly sure on how I would get MM to do all of it for me

Share this post


Link to post
Share on other sites

I suggest to place all the patches that belong to yours in one folder, like

  • GameData\ISRU_Extended\Sabatier\
  • GameData\ISRU_Extended\Water Mining\
  • GameData\ISRU_Extended\Water Electrolysis\
  • GameData\ISRU_Extended\CO2 Extraction\

Share this post


Link to post
Share on other sites

Update for 0.2 is out, incorporating some suggestions from all of you!

 

Changelog:

Spoiler

0.2

- Fixed water miner patch

- Fixed license

- Added heat curves for converters

- Changed file structure

 

Next update is planned to have a fix for conversion ratios and some patch checks for redundant harvesters/converters. If I can fit it in, I'll also try working on the part switching for stock ore tanks

Share this post


Link to post
Share on other sites
2 hours ago, Windspren said:

@Eleusis La Arwall Sorry to bother you, but could you explain a bit more on how to get MM to calculate conversion ratios? I think I understand the math, but I'm not exactly sure on how I would get MM to do all of it for me

Sure, no problem. The converter expects a Ratio in Units per second (U/s) but to prevent violations of mass-conservation you need to convert Units to mass. This can be done with the density of the resource. KSP densitys are given in tons per Unit (t/U). For example your Sabatier has Ratio = .2, multiply that by 0.001 and you get a mass-conversion rate of 0.0002 t/s. Now you would need to do that for the output and make sure the sum over all output-Ratios does not exceed the input-ratios. The easier way is to define Ratio with a value in t/s and have MM divide that by the resources density later.

Ratio = 0.0002

Now comes the important line that converts a t/s Ratio into a U/s Ratio KSP expects:

@Ratio /= #$@RESOURCE_DEFINITION[Water]/density$	

I know you're already familiar with the basic stuff but I'll try to describe the line as detailed as I can: @ tells MM to modify the exisiting key Ratio. /= tells MM to divide the existing value of the key by what comes after the equal sign. # tells MM that a variable follows. $ tells MM that a variable starts and it requires a second $ to close the variable. Here it gets interesting, inside the $ you can navigate through the config like a file-browser. The second @ inside the variable tells MM to change root level (because the resource density is not defined in a PART config). You can target other PARTs, RESOURCE_DEFINITIONs, etc. and navigate through their hierarchy. So $@RESOURCE_DEFINITION[Water]/density$ says: look at the RESOURCE_DEFINITION of Water and obtain the value of density.

To sum it all up, the line means: Modify Ratio by dividing its current value by the density defined in the RESOURCE_DEFINITION of Water.

The full INPUT definition for Water would look like this:

INPUT_RESOURCE
{
	ResourceName = Water
	Ratio = 0.0002
	@Ratio /= #$@RESOURCE_DEFINITION[Water]/density$
	FlowMode = STAGE_PRIORITY_FLOW
}

 

Share this post


Link to post
Share on other sites
43 minutes ago, Eleusis La Arwall said:

Sure, no problem. The converter expects a Ratio in Units per second (U/s) but to prevent violations of mass-conservation you need to convert Units to mass. This can be done with the density of the resource. KSP densitys are given in tons per Unit (t/U). For example your Sabatier has Ratio = .2, multiply that by 0.001 and you get a mass-conversion rate of 0.0002 t/s. Now you would need to do that for the output and make sure the sum over all output-Ratios does not exceed the input-ratios. The easier way is to define Ratio with a value in t/s and have MM divide that by the resources density later.


Ratio = 0.0002

Now comes the important line that converts a t/s Ratio into a U/s Ratio KSP expects:


@Ratio /= #$@RESOURCE_DEFINITION[Water]/density$	

I know you're already familiar with the basic stuff but I'll try to describe the line as detailed as I can: @ tells MM to modify the exisiting key Ratio. /= tells MM to divide the existing value of the key by what comes after the equal sign. # tells MM that a variable follows. $ tells MM that a variable starts and it requires a second $ to close the variable. Here it gets interesting, inside the $ you can navigate through the config like a file-browser. The second @ inside the variable tells MM to change root level (because the resource density is not defined in a PART config). You can target other PARTs, RESOURCE_DEFINITIONs, etc. and navigate through their hierarchy. So $@RESOURCE_DEFINITION[Water]/density$ says: look at the RESOURCE_DEFINITION of Water and obtain the value of density.

To sum it all up, the line means: Modify Ratio by dividing its current value by the density defined in the RESOURCE_DEFINITION of Water.

The full INPUT definition for Water would look like this:


INPUT_RESOURCE
{
	ResourceName = Water
	Ratio = 0.0002
	@Ratio /= #$@RESOURCE_DEFINITION[Water]/density$
	FlowMode = STAGE_PRIORITY_FLOW
}

 

Thanks! That really helped a lot; I mainly wasn't sure where to put the @Ratio node or how to specify which Ratio to modify, but you really helped clear it up. Right now I'm about finished with manually calculating everything, so I'll probably hold off on making it fully MM-automated, but in a future update I'll definitely use this. 

Share this post


Link to post
Share on other sites
21 hours ago, DeltaDizzy said:

I can help with the part switching.

I'm going to start working on this pretty soon, and so I've began looking at the various mods that enable part switching. So far, Interstellar Fuel Switch looks like what I need, but I just wanted to find out what you had in mind. Is there any option for a stock fuel switch, since 1.4 added stock mesh switching? Thanks!

Share this post


Link to post
Share on other sites
2 minutes ago, Windspren said:

I'm going to start working on this pretty soon, and so I've began looking at the various mods that enable part switching. So far, Interstellar Fuel Switch looks like what I need, but I just wanted to find out what you had in mind. Is there any option for a stock fuel switch, since 1.4 added stock mesh switching? Thanks!

Not in stock. I was thinking more along the lines of b9 Part switch. IFS is Bad news, for reasons I will explain later.

Share this post


Link to post
Share on other sites

Realistic conversion ratios have been finished, using actual stoichiometric equations to get a pretty accurate representation of electrolysis and the Sabitier reaction. I'm going to hold off on adding it as a separate version until I can get the part switching done, as you can't really use most of the conversions without dedicated resource storage.

 

I'm also considering scrapping the Simple Sabitier patch, as the number of different resource tanks it requires (CO2, Ore, LiquidFuel, Oxidizer) is only one less than the standard patch (CO2, Water, LH2, LiquidFuel, Oxidizer), which is also far more realistic. Feedback on this is important!

Edited by Windspren

Share this post


Link to post
Share on other sites

I really suggest that you make it PatchManager-ready.

Because having files together in a release where the player has to choose from is not a good idea on the long term.

Or just pack the release in a way that there are two different folders and a comprehensive text file that only says "CHOOSE!"

Share this post


Link to post
Share on other sites
2 minutes ago, Gordon Dry said:

I really suggest that you make it PatchManager-ready.

Because having files together in a release where the player has to choose from is not a good idea on the long term.

Or just pack the release in a way that there are two different folders and a comprehensive text file that only says "CHOOSE!"

I don't really want to add a dependency when simply deleting a few files can replace its functions. Two folders also doesn't make much sense, as there are far more combinations of patches that you can apply depending on what you want.

Share this post


Link to post
Share on other sites

Well, it's just because of - people download and unpack - and then ask here why it's weird...

Share this post


Link to post
Share on other sites
9 minutes ago, Gordon Dry said:

Well, it's just because of - people download and unpack - and then ask here why it's weird...

I'm hoping they'll read the README. If it becomes an issue I can always add information to the OP above the download.

Share this post


Link to post
Share on other sites
On 6/2/2018 at 4:13 AM, DeltaDizzy said:

IFS is Bad news

Would you mind to elaborate? I don't see why IFS should not be suitable for the task at hand.

18 hours ago, Windspren said:

I don't really want to add a dependency when simply deleting a few files can replace its functions.

I share your philosophy to have as few dependencies as possible but there is a difference between dependending on another mod and offering support for another mod. In the case of PatchManager it would be a small change in the file-hierarchy. Instead of putting patches in individual folders inside GameData/ISRU Extended/<Patchfolder> you would have to put them all in GameData/ISRU Extended/PatchManager/ActiveMMPatches. Beside that you only need a small config for each patch to tell PM how to deal with the patch. If users don't have PM installed, all patches are still applied. Manually deleting patches still works, so your mod does not depend on PM.

By supporting other mods you can reach a larger group of people but it also means more work for you. So please don't get me wrong, I'm not here to persuade you to use PM. I personally consider PM a blessing because it made my life so so much easier but this is your decision :)

Share this post


Link to post
Share on other sites
4 hours ago, Eleusis La Arwall said:

Would you mind to elaborate? I don't see why IFS should not be suitable for the task at hand.

The configs can be difficult to write and tweaking the masses means redoing a lot of math and hope you did it right. B9 configs are much easier to write and understand and are much more versatile in case Windspren ever wants to change something.

Share this post


Link to post
Share on other sites
15 hours ago, DeltaDizzy said:

The configs can be difficult to write and tweaking the masses means redoing a lot of math and hope you did it right. B9 configs are much easier to write and understand and are much more versatile in case Windspren ever wants to change something.

Well the difficulty is rather subjective, for me it's easier to write IFS configs but only because I've been using it longer than B9PS. I think they are both easy to write and understand. My point is that B9PS and IFS are both suitable for the task at hand (as is Firespitter), just wasn't sure how to interpret your 'IFS is bad news' statement.

However I'm curious what you mean by ' tweaking the masses means redoing a lot of math '. In my experience IFS can do a lot of the math for you. It gives you multiple approaches to tweak the mass (add mass per setups, fixed fuel-to mass ratio for all or per setup, fixed factors). If you don't need all of that, use the add mass per setup key similar to B9PS. In fact I'm always using IFS when doing mass-configuration because it tells me the fuel to mass ratio right away.

Share this post


Link to post
Share on other sites

0.3 is out! It took me a while due to finals (which will be continuing next week :( ), but I finally added everything I wanted to for this update.

Changelog:

Spoiler

0.3

- Mass is now conserved during reactions

- Stock ore tanks can be switched between several CRP resources

- Balanced CO2 collection

- Added B9 Part Switch support

- Removed Simple Sabitier due to issues with mass balance and redundancy

 

Future plans include more resource extraction, including hydrates and alumina mining, as well as processing for both of those resources.

Share this post


Link to post
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.