diff --git a/RealFuels/Resources/RealTankTypes.cfg b/RealFuels/Resources/RealTankTypes.cfg index f72e0968..8cb94d17 100644 --- a/RealFuels/Resources/RealTankTypes.cfg +++ b/RealFuels/Resources/RealTankTypes.cfg @@ -12,6 +12,8 @@ TANK_DEFINITION fillable = True amount = 0.0 maxAmount = 0.0 + wallThickness = 0.0025 + wallConduction = 16 temperature = 90.15 note = (lacks insulation) } @@ -492,7 +494,7 @@ TANK_DEFINITION name = Cryogenic highlyPressurized = False basemass = 0.000019 * volume - outerInsulationFactor = 0.01 + outerInsulationFactor = 0.0005 TANK { name = LqdOxygen @@ -501,6 +503,8 @@ TANK_DEFINITION fillable = True amount = 0.0 maxAmount = 0.0 + wallThickness = 0.0025 + wallConduction = 16 temperature = 90.15 note = (has insulation) } @@ -999,7 +1003,7 @@ TANK_DEFINITION maxAmount = 0.0 temperature = 90.15 wallThickness = 0.0025 - wallConduction = 205 + wallConduction = 16 insulationThickness = 0.038181 insulationConduction = 0.0001 note = (has insulation, pressurized) @@ -1722,6 +1726,8 @@ TANK_DEFINITION fillable = True amount = 0.0 maxAmount = 0.0 + wallThickness = 0.0025 + wallConduction = 16 temperature = 90.15 loss_rate = 0.000000005 note = (lacks insulation) @@ -2936,6 +2942,8 @@ TANK_DEFINITION fillable = True amount = 0.0 maxAmount = 0.0 + wallThickness = 0.0025 + wallConduction = 16 temperature = 90.15 loss_rate = 0.000000005 note = (lacks insulation) @@ -3417,7 +3425,7 @@ TANK_DEFINITION name = BalloonCryo highlyPressurized = False basemass = 0.000005 * volume - outerInsulationFactor = 0.01 + outerInsulationFactor = 0.0005 TANK { name = LqdOxygen @@ -3428,7 +3436,7 @@ TANK_DEFINITION maxAmount = 0.0 temperature = 90.15 wallThickness = 0.0025 - wallConduction = 205 + wallConduction = 16 insulationThickness = 0.0381 insulationConduction = 0.014 note = (has insulation) diff --git a/Source/RealFuels.csproj b/Source/RealFuels.csproj index 49b50f0f..5e1f8225 100644 --- a/Source/RealFuels.csproj +++ b/Source/RealFuels.csproj @@ -3,13 +3,17 @@ Debug AnyCPU + 10.0.0 + 2.0 {0041813D-DCD1-4AC7-8327-85765BF924A3} Library RealFuels RealFuels v3.5 + + false none False ..\..\Build\RealFuels\obj\ @@ -18,11 +22,6 @@ prompt 4 False - - - - - none @@ -32,25 +31,26 @@ prompt 4 False - - - - - - + + False ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\KSP_Data\Managed\Assembly-CSharp.dll - - ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\KSP_Data\Managed\UnityEngine.dll + + False + ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\GameData\ProceduralFairings\KSPAPIExtensions.dll + + + False + ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\GameData\SolverEngines\Plugins\SolverEngines.dll - - - ..\..\..\..\..\..\Games\KSP_win_1.0.4\GameData\RealFuels\Plugins\KSPAPIExtensions.dll + + False - - ..\..\..\..\..\..\Games\KSP_win_1.0.4\GameData\SolverEngines\Plugins\SolverEngines.dll + + False + ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\KSP_Data\Managed\UnityEngine.dll @@ -83,8 +83,7 @@ - cd $(ProjectDir) - - + + \ No newline at end of file diff --git a/Source/RealFuels.sln b/Source/RealFuels.sln index baeba016..27c3b6aa 100644 --- a/Source/RealFuels.sln +++ b/Source/RealFuels.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealFuels", "RealFuels.csproj", "{0041813D-DCD1-4AC7-8327-85765BF924A3}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweakScale_RealFuels", "TweakScale_RealFuels.csproj", "{F2B85F9A-6E39-4525-B31F-A3D764DE28D0}" @@ -20,41 +22,10 @@ Global {F2B85F9A-6E39-4525-B31F-A3D764DE28D0}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2B85F9A-6E39-4525-B31F-A3D764DE28D0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = RealFuels.csproj - Policies = $0 - $0.DotNetNamingPolicy = $1 - $1.DirectoryNamespaceAssociation = None - $1.ResourceNamePolicy = FileFormatDefault - $0.TextStylePolicy = $2 - $2.inheritsSet = VisualStudio - $2.inheritsScope = text/plain - $2.scope = text/x-csharp - $0.CSharpFormattingPolicy = $3 - $3.IndentSwitchBody = True - $3.AnonymousMethodBraceStyle = NextLine - $3.PropertyBraceStyle = NextLine - $3.PropertyGetBraceStyle = NextLine - $3.PropertySetBraceStyle = NextLine - $3.EventBraceStyle = NextLine - $3.EventAddBraceStyle = NextLine - $3.EventRemoveBraceStyle = NextLine - $3.StatementBraceStyle = NextLine - $3.ArrayInitializerBraceStyle = NextLine - $3.BeforeMethodDeclarationParentheses = False - $3.BeforeMethodCallParentheses = False - $3.BeforeConstructorDeclarationParentheses = False - $3.BeforeDelegateDeclarationParentheses = False - $3.NewParentheses = False - $3.inheritsSet = Mono - $3.inheritsScope = text/x-csharp - $3.scope = text/x-csharp - $0.TextStylePolicy = $4 - $4.inheritsSet = VisualStudio - $4.inheritsScope = text/plain - $4.scope = text/plain - EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = modularFuelTanks.csproj + EndGlobalSection EndGlobal diff --git a/Source/RealFuels.userprefs b/Source/RealFuels.userprefs index fd4746ae..c1fe3bbc 100644 --- a/Source/RealFuels.userprefs +++ b/Source/RealFuels.userprefs @@ -1,10 +1,18 @@  - - + + - + + + + + + + + + diff --git a/Source/Tanks/MFSSettings.cs b/Source/Tanks/MFSSettings.cs index 08322780..a7337b4a 100644 --- a/Source/Tanks/MFSSettings.cs +++ b/Source/Tanks/MFSSettings.cs @@ -16,8 +16,9 @@ public class MFSSettings : MonoBehaviour public static float partUtilizationDefault = 86; public static bool partUtilizationTweakable = false; public static string unitLabel = "u"; - public static bool basemassUseTotalVolume = false; + public static bool ferociousBoilOff = true; + public static bool globalConductionCompensation = false; public static HashSet ignoreFuelsForFill; public static Tanks.TankDefinitionList tankDefinitions; @@ -125,14 +126,22 @@ public static void Initialize () if (bool.TryParse (node.GetValue ("partUtilizationTweakable"), out tb)) { partUtilizationTweakable = tb; } - if (node.HasValue ("unitLabel")) { + if (node.HasValue ("unitLabel")) { unitLabel = node.GetValue ("unitLabel"); } if (bool.TryParse(node.GetValue("basemassUseTotalVolume"), out tb)) { basemassUseTotalVolume = tb; } + if (bool.TryParse(node.GetValue("ferociousBoilOff"), out tb)) + { + ferociousBoilOff = tb; + } + if (bool.TryParse(node.GetValue("globalConductionCompensation"), out tb)) + { + globalConductionCompensation = tb; + } - ConfigNode ignoreNode = node.GetNode ("IgnoreFuelsForFill"); + ConfigNode ignoreNode = node.GetNode ("IgnoreFuelsForFill"); if (ignoreNode != null) { foreach (ConfigNode.Value v in ignoreNode.values) { ignoreFuelsForFill.Add (v.name); diff --git a/Source/Tanks/ModuleFuelTanks.cs b/Source/Tanks/ModuleFuelTanks.cs index 6f275bcf..fafcee85 100644 --- a/Source/Tanks/ModuleFuelTanks.cs +++ b/Source/Tanks/ModuleFuelTanks.cs @@ -368,7 +368,6 @@ private IEnumerator CalculateTankLossFunction (float deltaTime) { // Opposite of original boil off code. Finds massLost first. double massLost = 0.0; - double adjustedThermalMass = part.thermalMass / (part.thermalMass - part.resourceThermalMass); double deltaTemp = part.temperature - tank.temperature; double area = tankArea * (tank.maxAmount / volume); @@ -387,14 +386,20 @@ private IEnumerator CalculateTankLossFunction (float deltaTime) //double tankConductivity = 0.03999680026; // Equal to 10cm aluminum + 10cm polyurethane insulation. Conductivity 250 and 0.02. //Equation: (0.2/ 0.1/205 + 0.1/0.02) double q = deltaTemp / ((tank.wallThickness / (tank.wallConduction * area)) + (tank.insulationThickness / (tank.insulationConduction * area))); - q *= adjustedThermalMass; + + if (MFSSettings.ferociousBoilOff) + q *= part.thermalMass / (part.thermalMass - part.resourceThermalMass); + + if (MFSSettings.globalConductionCompensation) + q /= PhysicsGlobals.ConductionFactor; + q *= 0.001d; // convert to kilowatts - //q /= PhysicsGlobals.ConductionFactor; // Turns out we have to compensate for this after all + massLost = q / tank.vsp; #if DEBUG // Only do debugging displays if compiled for debugging. debug1Display += FormatFlux(q); - debug2Display += (massLost * 1000 * 3600).ToString("F4") + "/hr"; + debug2Display += (massLost * 1000 * 3600).ToString("F4") + "kg/hr"; //debug2Display += area.ToString("F2"); //debug1Display = tank.wallThickness + " / " + tank.wallConduction; @@ -420,12 +425,9 @@ private IEnumerator CalculateTankLossFunction (float deltaTime) tank.amount -= lossAmount; double fluxLost = -massLost * tank.vsp; - // fluxLost *= part.thermalMass / (part.thermalMass - part.resourceThermalMass); // Remove extra flux to nullify resource thermal mass + if (MFSSettings.globalConductionCompensation) + fluxLost *= PhysicsGlobals.ConductionFactor; - // subtract heat from boiloff - // Compensate for increased conduction flux - //fluxLost *= PhysicsGlobals.ConductionFactor; - //fluxLost /= adjustedThermalMass; part.AddThermalFlux(fluxLost * deltaTimeRecip); } } @@ -634,10 +636,10 @@ private void UpdateTankType (bool initializeAmounts = true) // Note that the following two fields are highly variable and subject to the whims of whatever RF dev that might want to change them. // (they only show up if this code is compiled in debug mode and are currently for debugging boiloff system) - [KSPField (isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Tank Wall", guiUnits = "")] + [KSPField (isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Heat Penetration", guiUnits = "")] public string debug1Display; - [KSPField (isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Tank Insulation", guiUnits = "")] + [KSPField (isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Boil-off Loss", guiUnits = "")] public string debug2Display; public double partPrevTemperature; diff --git a/Source/TechLevels/TechLevel.cs b/Source/TechLevels/TechLevel.cs index 40a85874..8d0c905d 100644 --- a/Source/TechLevels/TechLevel.cs +++ b/Source/TechLevels/TechLevel.cs @@ -409,7 +409,14 @@ public static bool CanTL(ConfigNode cfg, ConfigNode mod, string type, int level) TechLevel nTL = new TechLevel(); if (!nTL.Load(cfg, mod, type, level)) return false; - return HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || nTL.techRequired.Equals("") || ResearchAndDevelopment.GetTechnologyState(nTL.techRequired) == RDTech.State.Available; + try + { + return HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || nTL.techRequired.Equals("") || ResearchAndDevelopment.GetTechnologyState(nTL.techRequired) == RDTech.State.Available; + } + catch (Exception) + { + return false; + } } } } diff --git a/Source/TweakScale_RealFuels.csproj b/Source/TweakScale_RealFuels.csproj index 2ca33f4d..919d9e7f 100644 --- a/Source/TweakScale_RealFuels.csproj +++ b/Source/TweakScale_RealFuels.csproj @@ -3,13 +3,12 @@ Debug AnyCPU - 10.0.0 - 2.0 {F2B85F9A-6E39-4525-B31F-A3D764DE28D0} Library RealFuels TweakScale_RealFuels v3.5 + 10.7.1 True @@ -41,9 +40,16 @@ ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\KSP_Data\Managed\Assembly-CSharp.dll - - ..\..\SolverEngines\GameData\SolverEngines\Plugins\SolverEngines.dll - False + + ..\..\TweakScale\GameData\TweakScale\plugins\Scale.dll + + + False + ..\..\TweakScale\GameData\TweakScale\plugins\Scale_Redist.dll + + + False + ..\..\..\..\..\..\Games\KSP_win_1.0.4_STOCK\GameData\SolverEngines\Plugins\SolverEngines.dll