linuxgurugamer Posted December 8, 2018 Share Posted December 8, 2018 (edited) Originally written by @codepoet, then maintained for a while by @Papa_Joe, this is another fuel-balancing mod. Original thread is here: https://forum.kerbalspaceprogram.com/index.php?/topic/39263-105-p, second thread is here: https://forum.kerbalspaceprogram.com/index.php?/topic/147144-113-pwb-fuel-balance After numerous attempts to contact @Papa_Joe, I've adopted this mod and made some improvements What is PWB Fuel Balancer? Mod to automatically move fuel between tanks to return the Center of Mass to a preset position for that your vessel is perfectly balanced for RCS operations, or any other reason. The PWB Fuel Balancer allows an optimum location for the Center of Mass of a vessel to be set in the VAB or SPH and then for fuel to be pumped between tanks in flight in order to move the CoM back to that location when they are part full. This is intended to allow for perfect RSC control, allowing for rotation without translation and translation without rotation, assuming that the RCS thrusters have been perfectly located with reference to the CoM location. It is recommended that you also use the RCS Build Aid mod to exactly location the RCS thrusters. It has also been found to be useful for helping spaceplanes maintain balance as they consume fuel. Keyboard Controls It is possible to display a (green) marker to indicate the centre of mass in the VAB/SPH by mousing over the part and pressing D. Set the optimum CoM location by mousing over the part and pressing M. You can display the CoM marker and optimum CoM marker inflight by right clicking on the park, and choosing "toggle marker", also shows the CoL marker. There is also a GUI that can be activated via the app launcher that allows for the manual positioning of the CoM target, both in the VAB and in flight. New Features Added ability to jettison resources. Currently a max of 3 resources are available per part,and empties at a rate of 1% of the maximum tank volume/sec, meaning that a full tank will take 100 seconds to empty. To use, right-click on a part which contains resources. You can either jettison from that part only, or all parts with that resource Added Settings page with the following Specify whether jettison should continue when switching scenes Added color settings sliders to settings page for the edge pulsing color Added edge pulsing to show which parts are venting Added unlimited number of saved positions Changed rate of fuel transfer to be 1/20 of the size of the destination time/sec (previously was doing a max of 50/sec, irregardless of the tank sizes) Automatically added to all parts with ModuleCommand (ie: pods, cockpits, etc) Usage Max Slider Value - Maximum value, both plus and minus, that the sliders will permit. You can always type in a number in the entry fields Low/High - Vertical position of the Saved CoM Fore/Aft - Position of the Saved CoM front-to-back Left/Right - Left/Right position of the Saved CoM Set CoM - Button to set the Saved CoM to the current CoM Show Markers/Hide Markers - Show or hide all markers Add Marker - For regular parts with ModuleCommand, this will add an additional marker Show CoL - In flight only, show the CoL Load - Load the value for the marker and make it the active marker Save - Save the current value of the Saved CoM in the specified marker Windows In the editor, showing window for command parts: In the editor, showing window for PWBFuelBalancer part: In the editor, showing the markers. Green = saved CoM, Yellow = stock CoM, Blue = stock CoL: In flight, Compact view for the PWBFuelBalancer part: In flight, showing Select view with command part selected: In flight, Compact view for a command part: In flight, showing Expanded view: In flight, showing flight markers. Green = Saved CoM, Yellow = CoM, Blue = CoL: Usage: To set the CoM position - Optionally, add one or more PWB Fuel Balancer parts to your craft. The optimum CoM is set to the current CoM when the part is placed, you can change it anytime Remove any stages that will not be present when using RCS Press 'M' to set the CoM position. Press 'D' to display the CoM position To rebalance in flight right click the PWB Fuel Balancer part, or set an action key in the VAB/SPH. The following is an old video from several years ago: Availability Download: https://github.com/linuxgurugamer/PWBFuelBalancerRestored/releases Download: https://spacedock.info/mod/2041/PWB Fuel Balancer Restored Source: https://github.com/linuxgurugamer/PWBFuelBalancerRestored License: CC By 3.0 Donations gratefully accepted https://www.patreon.com/linuxgurugamer Mod Dependencies: Click Through Blocker ToolbarController Module Manager SpaceTuxLibrary Click Through Blocker ToolbarController Supports KSP-AVC. This mod checks your installed mod versions against the mod's latest version. Let's you know when you need to update. CKAN. The Comprehensive Kerbal Archive Network (CKAN) Package Manager (CKAN) is a multi-platform app that manages nearly all your mods from one clean executable. Performs installs, updates, and uninstalls of your mods automatically. What is PWB Fuel Balancer? Mod to automatically move fuel between tanks to return the Center of Mass to a preset position for that your vessel is perfectly balanced for RCS operations, or any other reason. The PWB Fuel Balancer allows an optimum location for the Center of Mass of a vessel to be set in the VAB or SPH and then for fuel to be pumped between tanks in flight in order to move the CoM back to that location when they are part full. This is intended to allow for perfect RSC control, allowing for rotation without translation and translation without rotation, assuming that the RCS thrusters have been perfectly located with reference to the CoM location. It is recommended that you also use the RCS Build Aid mod to exactly location the RCS thrusters. It has also been found to be useful for helping spaceplanes maintain balance as they consume fuel. It is possible to display a (green) marker to indicate the centre of mass in the VAB/SPH by mousing over the part and pressing D. Set the optimum CoMlocation buy turning of CoM in the VAB/SPH, mousong over the part and pressing M. You can display the CoM marker and optimum CoM marker inflight by right clicking on the park, and choosing "toggle marker" There is also a GUI that can be activated via the app launcher that allows to the manual positioning of the CoM target, both in the VAB and in flight. Usage: To set the CoM position - add the PWB Fuel Balancer to your craft remove any stages that will not be present when using RCS turn on the CoM indicator mouse over the PWB Fuel Balancer part press 'M' to set the CoM position. press 'D' to display the CoM position To rebalance in flight right click the PWB Fuel Balancer part, or set an action key in the VAB/SPH. Release History Spoiler 0.1.5 Adoption by LinuxGuruGamer Removed old class: PwbkspFuelBalancer, was in for compatibility with old games Commented out code which prevented click-through Fixed the adjustment of the target to depend on the vessel type, either Plane or anything else Added new KSPEvent to set the COM, also created method SetCOM which is called from other places Added screen message telling player to turn on the COM if it isn't when trying to set a target Added code to show the markerCam only when in flight Fixed case of RotationInEditor (r had been lowercase) Improved the SetCoM code so that the CoMmarker does not have to be on in the editor Added message to window when no fuel balancers are mounted on the vessel Added code to properly find fuel balancers when ship loaded in editor Moved adding methods to GameEvents to the Awake instead of the Start Added logging class Replaced toolbar code with the ToolbarController Deleted commented out code 0.1.3 * Support of mod changed hands to Papa_Joe from codepoet (Thanks codepoet!). * Updated to be compatible with KSP 1.1.3. * Restructured solution to allow for automated build and deploy * Refactored code to improve organization, performance, reduce garbage collection, and use explicit typing. * Got rid of the "horrible" fixedUpdate editorpartcount methodology. implemented OnEditorShipModified for event driven handling of vessel part count changes. (codepoet knows what I mean ) * Added close button to the upper right of the Fuel Balancer window. * Added scene specific window positioning. Editor now starts just to the right of the parts list. Flight now starts a safe margin to the right of the staging tree. 0.1.2 * Rebuilt for KSP 1.0.5 * New control box model (Thanks Skalou) * Semi transparant markers (Thanks Skalou) 0.1.1 Added display/hide target marker to the UI Added 2 save slots to the UI 0.1 Rebuilt against KSP 0.90 Added UI Enabled the naming of individual balancers Enabled the manual moving of balancers in flight and in the editor. 0.0.6 Updated for KSP 0.23.5 changed to be operating from launch rather than when its stage is staged. Renamed the balancing module and part and provided legacy support for existing craft and saves. 0.0.5 Added the part to the "Large Control" tech tree and tested for 0.22 and 0.23 0.0.4 Fixed bugs that occur when the whole vessel is rotated in the editor. Unfortunately this will break backwards compatability (craft created with 0.0.3 will not have the correct CoM location set without returning to the VAB) Added markers to show CoM and optimum CoM locations in VAB and in flight 0.0.3 Added prompts to the VAB / SPH to let the user know when the target CoM has been set Fixed a bug that caused the CoM to be set in the wrong location in the SPH Changed maintaince mode to continue attempting to balance even when a perfect solution is not possible. Changed the name of the part to reflect the fact that it is not just useful for RCS 0.0.2 Added option of Maintain Balance - useful to account for CoM errors that arise when monopropellant is used during RCS manouvers Added the ability for the part to report when it is not possible to achieve a perfect balance. 0.0.1 Initial Release Bugs, comments and requests are welcome. Please create an issue in Github for any requests or bugs. This mod was originally created by @codepoet Edited March 1, 2021 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
Drew Kerman Posted December 8, 2018 Share Posted December 8, 2018 ooooh nice, I really liked this one. Good to see if back under a roof Quote Link to comment Share on other sites More sharing options...
Beetlecat Posted December 8, 2018 Share Posted December 8, 2018 Oh, now this is great! Especially useful for dealing with part failures and leaky tanks. Quote Link to comment Share on other sites More sharing options...
Jesusthebird Posted December 11, 2018 Share Posted December 11, 2018 Pretty dope!! This will come in handy! Quote Link to comment Share on other sites More sharing options...
HeadHunter67 Posted December 25, 2018 Share Posted December 25, 2018 Looks like a nice substitute for the old TAC Fuel Balancer. It would be even nicer if a special component wasn't necessary so I could use it on existing craft out in space. Thanks! Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 27, 2018 Author Share Posted December 27, 2018 On 12/25/2018 at 11:48 AM, HeadHunter67 said: Looks like a nice substitute for the old TAC Fuel Balancer. It would be even nicer if a special component wasn't necessary so I could use it on existing craft out in space. Thanks! That special part is used to store the i fo, y putting multiple on a craft you can have multiple setups. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 29, 2018 Author Share Posted December 29, 2018 New release, 0.1.5.1 Fixed bug where locked tanks would still be filled/emptied Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 30, 2018 Author Share Posted December 30, 2018 New release, 0.1.5.2 Improved the locked tank code Added ability to jettison resources. Currently a max of 3 resources are available per part,and empties at a rateof 1%/sec Optimized code by replacing string comparisons with an Enum. Kept the string for display purposes Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 31, 2018 Author Share Posted December 31, 2018 New release, bug fix 0.1.5.3 Fixed a problem with the jettison code, which was failing on vessels with many parts & tanks Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted January 3, 2019 Author Share Posted January 3, 2019 New release, 0.1.5.4 Fixed jettison code to work properly on multiple vessels and on scene switches Added Settings page to specify whether jettison should continue when switching scenes Added edge pulsing to show which parts are venting Added color settings sliders to settings page Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted January 8, 2019 Author Share Posted January 8, 2019 New release, 0.1.5.5 Added toggles for Saved CoM and Actual CoM Added flag to use KSP skin Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted January 12, 2019 Author Share Posted January 12, 2019 New release, 0.1.5.6 Minor optimizations by commenting out unused callbacks Fixed harmless nullref in editor when deleting the PWB part Quote Link to comment Share on other sites More sharing options...
Zah Posted February 13, 2019 Share Posted February 13, 2019 I think I may have found an issue. After a binary search through my mods, I'm almost certainly sure that this mod causes a transparency issue in my installation. Log:https://mega.nz/#!Rwx0wCLa!8yE2AxQL-TYD6NOPgdVdlUXpblTyfhzoPEJbLphNxG0 Screenshot: Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted February 13, 2019 Author Share Posted February 13, 2019 This mod doesn't do anything with the graphics. I've seen this with stock also Quote Link to comment Share on other sites More sharing options...
Zah Posted February 13, 2019 Share Posted February 13, 2019 2 minutes ago, linuxgurugamer said: This mod doesn't do anything with the graphics. I've seen this with stock also I've seen similar transparency happen with Navhud. But I can produce the transparency just by installing the mod, it's not even activated in the above screenshot. Maybe an issue with the InFlightMarkerCam? Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted February 13, 2019 Author Share Posted February 13, 2019 3 minutes ago, Zah said: I've seen similar transparency happen with Navhud. But I can produce the transparency just by installing the mod, it's not even activated in the above screenshot. Maybe an issue with the InFlightMarkerCam? I'll take a look at it Quote Link to comment Share on other sites More sharing options...
Zah Posted February 13, 2019 Share Posted February 13, 2019 (edited) 31 minutes ago, linuxgurugamer said: I'll take a look at it Now that I'm closing in, I did some more testing and can also cause the same transparency when turning on Kerbal Flight Indicators or NavHud. So must be the camera they produce. Now if that's something unique to my system (nvidia) or a KSP issue... I've seen the transparency on Das's stream when he used NavHud. Edited February 13, 2019 by Zah Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted February 14, 2019 Author Share Posted February 14, 2019 17 hours ago, Zah said: Now that I'm closing in, I did some more testing and can also cause the same transparency when turning on Kerbal Flight Indicators or NavHud. So must be the camera they produce. Now if that's something unique to my system (nvidia) or a KSP issue... I've seen the transparency on Das's stream when he used NavHud. I can confirm it, but I have no idea what's going on, that part of it isn't my code. I'll be asking for some help on this Quote Link to comment Share on other sites More sharing options...
Zah Posted February 14, 2019 Share Posted February 14, 2019 (edited) 1 hour ago, linuxgurugamer said: I can confirm it, but I have no idea what's going on, that part of it isn't my code. I'll be asking for some help on this Thank you! With the camera "always on" in PWB Fuel Balancer it was more apparent than in NavHud so I started testing. Took about three evenings of cycling through 200 mods. It was literally the last mod in my binary search because I put it in a group of "non-graphics related". You can imagine how confused I was when I was done with the "graphics-related mods" and the issue was still there. I even looked through texture files trying to find something. The transparency seems to require light (duh) on the surface, in my above screenshot the sun is in the west of KSC. So maybe it's a bug with the way the game does specular shaders? I have no idea how this works in Unity/KSP. Edit: Two screenshots -- same game state. Against the light shows no transparency, but once you have a surface that reflects light you see it.https://imgur.com/a/0aJBfZS A few further screenshots with other parts:https://imgur.com/a/w3liJBXB Edited February 14, 2019 by Zah Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted February 14, 2019 Author Share Posted February 14, 2019 Could you repost this in the new thread I created about this problem? Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted February 15, 2019 Author Share Posted February 15, 2019 New release, 0.1.5.7 Fixed issue with the mod making parts semitransparent in certain circumstances Quote Link to comment Share on other sites More sharing options...
Zah Posted February 15, 2019 Share Posted February 15, 2019 Thank you so much! I will check tomorrow, already in bed. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted February 27, 2019 Author Share Posted February 27, 2019 New release, 0.1.5.8 Fixed nullref when doing a jettison All Quote Link to comment Share on other sites More sharing options...
Angleton Posted March 22, 2019 Share Posted March 22, 2019 Not working for me. when I right click on the "PWB Fuel Balancer", the only option I have is "aim camera" The resource jettisoning was also unavailable. Quote Link to comment Share on other sites More sharing options...
4x4cheesecake Posted March 22, 2019 Share Posted March 22, 2019 3 hours ago, Angleton said: Not working for me. when I right click on the "PWB Fuel Balancer", the only option I have is "aim camera" The resource jettisoning was also unavailable. Did you install the dependencies as well? On 12/8/2018 at 4:07 AM, linuxgurugamer said: Mod Dependencies: Click Through Blocker ToolbarController If you want to be able to jettison fuel as well, you will also need ModuleManager: *cough* this isn't mentioned anywhere so far, incl. CKAN *cough* @linuxgurugamer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.