Jump to content

[1.8.1 - 1.12.5] Interstellar Fuel Switch (IFS) 3.29.5


FreeThinker

Recommended Posts

Two of Nertea's mods - CryoEngines and KerbalAtomics - use IFS. See the ModuleManager file at the bottom of my post for specifics. It seems to work as intended, however, a couple interface issues have been noted. First, the "Engineer Report" in the VAB appears to miscalculate the mass of the fuel tanks, using twice the actual dry mass. Second, when you right-click one of the tanks in-flight, there is a line that reads "Dry mass: 0t." Both of these errors don't appear to have any real effect (the game still uses the correct mass values), but it's annoying nonetheless.

If there's a different way to write the IFS config that would avoid these issues, please let me know.

// Lifting tanks
@PART[*]:HAS[@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer],!MODULE[InterstellarFuelSwitch],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]
{
	%LH2ConversionFactor = 10 // <- EDIT HERE (units of LH2 that occupy a volume equivalent to one unit of LF or OX)
	%LH2OUnitRatio = 15 // <- EDIT HERE (LH2:OX unit ratio for LH2O configuration; should correspond to burn ratio of cryogenic engines)
	%mixOXProportion = 0.4 // <- EDIT HERE (proportion of tank volume containing OX; should approximately = 1 / [1 + [LH2OUnitRatio / LH2ConversionFactor]])
	%dryMassPerUnitLH2 = 0.000025 // <- EDIT HERE (dry mass per unit LH2 capacity)
	
	%LF = #$RESOURCE[LiquidFuel]/maxAmount$
	%OX = #$RESOURCE[Oxidizer]/maxAmount$

	%totalCap = #$RESOURCE[LiquidFuel]/maxAmount$
	@totalCap += #$RESOURCE[Oxidizer]/maxAmount$

	%onlyLH2 = #$totalCap$
	@onlyLH2 *= #$LH2ConversionFactor$

	%mixOX = #$totalCap$
	@mixOX *= #$mixOXProportion$
	%mixLH2 = #$mixOX$
	@mixLH2 *= #$LH2OUnitRatio$

	// masses
	%massOffset = #$mass$
	%tempVar = #$totalCap$
	@tempVar *= 0.000625 // standard dry mass per units of LF/OX
	@massOffset -= #$tempVar$ // accounts for non-standard tank mass, which should remain constant across fuel configurations, e.g., extra mass for spaceplane tanks
	
	%onlyLH2mass = #$onlyLH2$
	@onlyLH2mass *= #$dryMassPerUnitLH2$
	@onlyLH2mass += #$massOffset$
	
	%mixLH2mass = #$mixOX$
	@mixLH2mass *= 0.000625
	@tempVar = #$mixLH2$
	@tempVar *= #$dryMassPerUnitLH2$
	@mixLH2mass += #$tempVar$
	@mixLH2mass += #$massOffset$
	
	// costs
	%LFOcost = #$LF$
	@LFOcost *= 1.02
	@cost -= #$LFOcost$
	
	%mixLH2cost = #$mixLH2$
	@mixLH2cost *= 0.03675
	@tempVar = #$mixOX$
	@tempVar *= 0.18
	@mixLH2cost += #$tempVar$
	
	%LFcost = #$totalCap$
	@LFcost *= 0.8
	
	%OXcost = #$totalCap$
	@OXcost *= 0.18
	
	%onlyLH2cost = #$onlyLH2$
	@onlyLH2cost *= 0.03675
	
	!RESOURCE[LiquidFuel] {}
	!RESOURCE[Oxidizer] {}
	
	MODULE
	{
		name = InterstellarFuelSwitch

		volumeMultiplier = 1
		massMultiplier = 1

		resourceGui = LF/OX;LH2/OX;LF;OX;LH2
		resourceNames = LiquidFuel,Oxidizer;LqdHydrogen,Oxidizer;LiquidFuel;Oxidizer;LqdHydrogen

		resourceAmounts = #$../LF$,$../OX$;$../mixLH2$,$../mixOX$;$../totalCap$;$../totalCap$;$../onlyLH2$

		displayCurrentTankCost = true

		hasGUI = true
		showInfo = true

		availableInFlight = false
		availableInEditor = true

		basePartMass = 0
		tankMass = #$../mass$;$../mixLH2mass$;$../mass$;$../mass$;$../onlyLH2mass$
		tankCost = #$../LFOcost$;$../mixLH2cost$;$../LFcost$;$../OXcost$;$../onlyLH2cost$
	}
	MODULE
	{
		name =  ModuleCryoTank
		FuelName = LqdHydrogen
		// in % per hr
		BoiloffRate = 0.05
	}
}

// ZBO tanks
@PART[*]:HAS[@RESOURCE[LqdHydrogen],!MODULE[InterstellarFuelSwitch],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]
{
	%LH2ConversionFactor = 10 // <- EDIT HERE (LH2 vs LF/OX capacity conversion; should be identical to LH2ConversionFactor for lifting tanks above)
	%LH2OUnitRatio = 15 // <- EDIT HERE (LH2:OX unit ratio; should be identical to LH2OUnitRatio for lifting tanks above)
	%mixOXProportion = 0.4 // <- EDIT HERE (proportion of tank volume containing OX; should be identical to mixOXProportion for lifting tanks above)
	%dryMassPerUnitLH2 = 0.00003125 // <- EDIT HERE (dry mass per unit LH2 capacity)
	
	%LH2 = #$RESOURCE[LqdHydrogen]/maxAmount$
	
	%mixOX = #$LH2$
	@mixOX /= #$LH2ConversionFactor$
	@mixOX *= #$mixOXProportion$
	%mixLH2 = #$mixOX$
	@mixLH2 *= #$LH2OUnitRatio$

	// masses
	%mixLH2mass = #$mixOX$
	@mixLH2mass *= 0.000625
	%tempVar = #$mixLH2$
	@tempVar *= #$dryMassPerUnitLH2$
	@mixLH2mass += #$tempVar$
	
	// costs
	%LH2cost = #$cost$
	@LH2cost *= 0.5
	@tempVar = #$LH2$
	@tempVar /= #$LH2ConversionFactor$
	@tempVar *= 0.459
	@LH2cost += #$tempVar$
	@cost -= #$LH2cost$
	
	%mixLH2cost = #$LH2cost$
	@tempVar = 1
	@tempVar -= #$mixOXProportion$
	@mixLH2cost *= #$tempVar$
	@tempVar = #$mixOX$
	@tempVar *= 0.18
	@mixLH2cost += #$tempVar$
	
	!RESOURCE[LqdHydrogen] {}
	
	MODULE
	{
		name = InterstellarFuelSwitch

		volumeMultiplier = 1
		massMultiplier = 1

		resourceGui = LH2;LH2/OX
		resourceNames = LqdHydrogen;LqdHydrogen,Oxidizer

		resourceAmounts = #$../LH2$;$../mixLH2$,$../mixOX$

		displayCurrentTankCost = true

		hasGUI = true
		showInfo = true

		availableInFlight = false
		availableInEditor = true

		basePartMass = 0
		tankMass = #$../mass$;$../mixLH2mass$
		tankCost = #$../LH2cost$;$../mixLH2cost$
	}
	MODULE
	{
		name =  ModuleCryoTank
		FuelName = LqdHydrogen
		// in % per hour
		BoiloffRate = 0.05
		// in Ec per 1000 units per second
		CoolingCost = 0.08
	}
}

 

Link to comment
Share on other sites

Hi, i'm new here but im having a problem.

I'm running ksp 1.0.4 and I have a bunch of mods installed :confused: now I have the problem with the fuel. The fuel tanks are empty and i'm unable to change the tanks, or what so ever.

http://imgur.com/S8JvbZ2

I read about changing something when using FS but i don't understand it. You stated to see original OP but can't find it what to change.

 

MODS:

KSP: 1.0.4 (Win64) - Unity: 4.6.4f1 - OS: Windows 8.1  (6.3.10586) 64bit
Filter Extensions - 2.4.1
USI Tools - 0.6.2
Advanced Jet Engine - 2.4.1
B9 Aerospace Procedural Parts - 0.40
Community Resource Pack - 0.4.9
Connected Living Space - 1.1.3.1
Deadly Reentry - 7.2.2
DMagic Orbital Science - 1.0.8
Ferram Aerospace Research - 0.15.5.1
Firespitter - 7.1.4
RasterPropMonitor - 0.23.2
KAS - 0.5.4
Kerbal Engineer Redux - 1.0.18
Kerbal Joint Reinforcement - 3.1.4
HyperEdit - 1.4.2
KSP-AVC Plugin - 1.1.5
Infernal Robots - 0.21.3
ModularFlightIntegrator - 1.1.1
Near Future Electrical - 0.5.3
PlanetShine - 0.2.4.2
Procedural Parts - 1.1.7
QuickScroll - 1.3.2
RCS Build Aid - 0.7.5
RealChute - 1.3.2.4
RealismOverhaul - 10.5
RealSolarSystem - 10.2
RemoteTech - 1.6.8
SCANsat - 1.1.4.2
SolverEngines - 1.11
TextureReplacer - 2.4.5
TAC Life Support - 0.11.1.20
TweakScale - 2.2.4
Karibou - 0.1.2

Edited by Wesley Petterson
added mod list
Link to comment
Share on other sites

On October 13, 2015 at 1:31 AM, Alshain said:

No, that's the problem. The fuel locking is in stock, but with IFS installed, it's status does not persist. I'll do some more testing and see if I can't confirm it is IFS. It could be the way CCC is configuring it. It's hard for me to tell.

EDIT:

Definitely somehow related to IFS. Here is what it looks like without IFS. If I save the craft and re-load it later, this tank stays locked (that tank is meant to be a refill tank for the lander so I want it not used, using IFS it is supposed to be the only one there with Oxidizer because it is a NERV stage).

Was this issue ever addressed? I really like InterstellarFuelSwitch as I am using it for the latest variant of StockFuelSwitch, but my stock-fuel-switched tanks (and Mk4 tanks) won't/can't load their flowState correctly: even if I can open up a .craft file and see that flowState = false (therefore the resources should be locked), every time the craft is loaded (in VAB or at launch) the resources are unlocked.

This issue doesn't affect FSfuelswitch tanks, or tanks without fuel switching - those "remember" their flowState just fine.

Link to comment
Share on other sites

22 hours ago, PocketBrotector said:

Was this issue ever addressed? I really like InterstellarFuelSwitch as I am using it for the latest variant of StockFuelSwitch, but my stock-fuel-switched tanks (and Mk4 tanks) won't/can't load their flowState correctly: even if I can open up a .craft file and see that flowState = false (therefore the resources should be locked), every time the craft is loaded (in VAB or at launch) the resources are unlocked.

This issue doesn't affect FSfuelswitch tanks, or tanks without fuel switching - those "remember" their flowState just fine.

I checked one release version of the mod later and no it was not fixed.  My computer is down for the count right now so I can't check now.  Before my computer did fail, I just kept with FSFuelSwitch.

Edited by Alshain
Link to comment
Share on other sites

1 hour ago, Alshain said:

I checked one release version of the mod later and no it was not fixed.  My computer is down for the count right now so I can't check now.  Before my computer did fail, I just kept with FSFuelSwitch.

Bummer, but thanks for confirming. I've logged it as a github issue with a link to your original report, so hopefully this gets some attention. 

Link to comment
Share on other sites

  • 2 weeks later...

Not sure if this has been mentioned before, but I'm noticing a discrepancy between weight of the part (using IFS), as reported by MechJeb's vessel info, and KSP's in-game engineer's report.
MechJeb seems to be adding the mass as stated in the standard part parameters and ignoring the basePartMass  value. The latter is adding both together.

Which one should I trust?

 

Edit: After further testing, MechJeb seems to ignore the standard part parameters value if the part uses IFS. Setting that to 0 and setting the basePartMass to the desired pre-fuel mass gives the same weight in both MechJeb and KSP Engineer's report (tankMass is 0). I'm going to assume that this is the actual final weight for the purpose of Delta-V stats.

Was the basePartMass supposed to override the default mass value?

I only noticed this as I was tweaking a custom part file. NearFutureConstruction's truss set also uses IFS and had similar weight discrepancies when I checked.

Edited by gazbach
Link to comment
Share on other sites

  • 2 weeks later...

I'm not sure if this is what @Fraz86 was talking about a few posts above, or if this has already been covered before (I tried to search but found nothing). There seems to be a discrepancy between the mass KER reports and the mass the stock game reports, and it would seem that it originates from IFS.

Changing the tank setup to something else besides stock LF/O changes both the dry mass, and the overall mass of the tank because of the changes in weight as a result of the different contents (for example, LF is a lot heavier than LH2). KER has no problem realizing this and correctly displaying the new mass, but the stock game doesn't recognize this. It seems it is only able to perceive the original stock tank setup (LF/O). Just to note, it does not seem to matter if it is a stock tank or a Fuel Tanks Plus tank, or another mod's or parts pack fuel tank. It seems to be an issue with the stock game, not IFS directly, although I thought maybe the way that IFS reports the mass could have to do with the issue. Maybe if it was altered, the game would display correctly? Only very early in the game, before you have an upgraded launchpad/runway does this make much of a difference.

 

My biggest concern is that the game calculates your mass on the stock's understanding of what the mass is, not the correct mass reported by KER. What if dV is also calculated in this inaccurate way too?

 

Here's a picture to help show what I'm talking about. The main point is that the (stock) mass doesn't change at the bottom right in the second picture:
http://imgur.com/a/wbDEn

Link to comment
Share on other sites

IFS doesn't seem to be working for me in KSP 1.1. I've tried installing it both via CKAN and manually, and AVS tells me that it recognizes it on the main menu and that it's properly updated. But I still don't see the multiple fuel tank loadouts when I right-click any of the stock tanks.

Is there dependency on another mod besides Community Resource? What am I missing?

Link to comment
Share on other sites

On 26-3-2016 at 9:28 PM, KocLobster said:

I'm not sure if this is what @Fraz86 was talking about a few posts above, or if this has already been covered before (I tried to search but found nothing). There seems to be a discrepancy between the mass KER reports and the mass the stock game reports, and it would seem that it originates from IFS.

Changing the tank setup to something else besides stock LF/O changes both the dry mass, and the overall mass of the tank because of the changes in weight as a result of the different contents (for example, LF is a lot heavier than LH2). KER has no problem realizing this and correctly displaying the new mass, but the stock game doesn't recognize this. It seems it is only able to perceive the original stock tank setup (LF/O). Just to note, it does not seem to matter if it is a stock tank or a Fuel Tanks Plus tank, or another mod's or parts pack fuel tank. It seems to be an issue with the stock game, not IFS directly, although I thought maybe the way that IFS reports the mass could have to do with the issue. Maybe if it was altered, the game would display correctly? Only very early in the game, before you have an upgraded launchpad/runway does this make much of a difference.

 

My biggest concern is that the game calculates your mass on the stock's understanding of what the mass is, not the correct mass reported by KER. What if dV is also calculated in this inaccurate way too?

 

Here's a picture to help show what I'm talking about. The main point is that the (stock) mass doesn't change at the bottom right in the second picture:
http://imgur.com/a/wbDEn

Well, I came to the conclusion this is a limitation of the stock Engineering report, which does not seem to understand the mass of a part can change. For stock parts this works fine but not in the case of IFS. That's why I show the mass in the first place because the stock system engineering report is simply wrong.

On 8-4-2016 at 9:19 PM, speedwaystar said:

v1.19 doesn't seem to be working with 1.1 Prerelease, i'm afraid to say.

YkmNrvB.png

You will only get this error when CRP isn't installed correctly

Link to comment
Share on other sites

@FreeThinker

That's unfortunate, thank you for taking the time to look into it and reply, I appreciate the clarification. Since the stock engineering report is wrong, as I assumed, do you know which one the game decides is correct and which one the game makes all its calculations based on? Does the dV, drag, etc. go off of the correct (KER) mass or off the stock mass (wrong)?

Link to comment
Share on other sites

 

Hi there @FreeThinker. Thanks for getting this working in 1.1 so quickly. It's one of the few mods I allow myself to use as a dependency, and it's always worked great. Thanks!

 

One quick possible bug report though (or possibly I've done something wrong). I have a user in the MRS thread who is having a problem with the fuel switching. When enabled, the dry-mass of the tank is being doubled. It looks correct in the right-click menu, but it looks like the base-mass and CFG-defined mass are being added together for everything else, including the engineer's report and mechjeb. Did I just do it wrong by setting the base mass equal to the part's standard dry mass, or did KSP 1.1 change something that's impacting it?

 

Here's the person's screenshot, showing what he's talking about: http://imgur.com/PfnoDho

 

Link to comment
Share on other sites

6 hours ago, NecroBones said:

 

Hi there @FreeThinker. Thanks for getting this working in 1.1 so quickly. It's one of the few mods I allow myself to use as a dependency, and it's always worked great. Thanks!

 

One quick possible bug report though (or possibly I've done something wrong). I have a user in the MRS thread who is having a problem with the fuel switching. When enabled, the dry-mass of the tank is being doubled. It looks correct in the right-click menu, but it looks like the base-mass and CFG-defined mass are being added together for everything else, including the engineer's report and mechjeb. Did I just do it wrong by setting the base mass equal to the part's standard dry mass, or did KSP 1.1 change something that's impacting it?

 

Here's the person's screenshot, showing what he's talking about: http://imgur.com/PfnoDho

 

I have the same issue.

EG - The Rockomax X200-128.

Parts list shows it as 8t

When added on to the vessel, but emptied of its contents, the weight changes between 8 and 16t in Kerbal Engineer.

In flight it seems to act as 16t for dV purposes, which makes it much less efficient than non-fuel-switch tanks.

Link to comment
Share on other sites

Hi, I'm having an issue with 1.1 whenever I use any part which uses Interstellar fuel switch.

In the VAB the dv and mass values keep changing every second or two, also the COM sometimes moves around also, this was happening with a few different mods (mk 2 expansion, fuel tanks+ and Modular Rocket Systems). I've removed all mods apart from Interstellar Fuel Switch, module manager, kerb engineer and stock fuel switch and its still occurring.

This was with the latest 1.19 and CRP .49 (also tried the newer .50)

https://dl.dropboxusercontent.com/u/26687/output_log_IFS.txt

Any ideas? Thanks

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