Papa_Joe

[1.1.3] PWB Fuel Balancer - Revived!, 07 Sep 2016

Recommended Posts

WIth @codepoet's schedule not allowing him to maintain his mods, He has asked and I have volunteered to continue maintaining:

PWB Fuel Balancer

@codepoet has given me his blessing, and access to his Git Repository, and I am cloning his original thread from HERE into this thread to continue support in his stead.  As everyone knows, he is not gone, just very busy with real life.

screenshot19.png

screenshot23.png

Version 0.1.3.0

DOWNLOAD on GitHub

Source Code on Github

Licensed under CC BY terms (attribution)

Tested with KSP 1.1.3.

Mod Independent:  This mod is standalone and requires no other mods to run.  However to help with installation it will soon be supporting: 

  • KSP-AVC. This mod checks your installed mod versions against the mod's latest version. Let's you know when you need to update.  The next version will include a version file but you can get it now right here.
  • 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 CoM location 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 -

  1. add the PWB Fuel Balancer to your craft
  2. remove any stages that will not be present when using RCS
  3. turn on the CoM indicator
  4. mouse over the PWB Fuel Balancer part
  5. press 'M' to set the CoM position.
  6. 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.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 by Papa_Joe
New Version, 1.1.3 compatibility

Share this post


Link to post
Share on other sites

Release for 1.1.3 coming today.  Here is the change log:

0.1.3.0
* Support of mod changed hands to Papa_Joe from codePoet.  
* Updated to be compatible with KSP 1.1.3
* Restrucutred 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 :) )

Edit:  Added the following to the change log:

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

In the next update, I'll add window position persistence.
 

Just performing some final testing.

Edited by Papa_Joe

Share this post


Link to post
Share on other sites

This seems really rather useful. On my list of things to get after work tonight :) 

Share this post


Link to post
Share on other sites

I'm sorry, this mod seems to be the cause of a major z-buffer issue causing EVA'd kerbals to render on top of everything else... :(

aMuMRKy.jpg

Goes away without PWBFB. Returns with. Not sure how to help debug this, but ask me questions and I will try my best to answer :)

Share this post


Link to post
Share on other sites
1 hour ago, eddiew said:

I'm sorry, this mod seems to be the cause of a major z-buffer issue causing EVA'd kerbals to render on top of everything else... :(

aMuMRKy.jpg

Goes away without PWBFB. Returns with. Not sure how to help debug this, but ask me questions and I will try my best to answer :)

Thanks, let me know any additional info you have.  I'll peek at the code.  those areas were affected by the update from 1.0.5 to 1.1

 

Share this post


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

I'm sorry, this mod seems to be the cause of a major z-buffer issue causing EVA'd kerbals to render on top of everything else... :(

aMuMRKy.jpg

Goes away without PWBFB. Returns with. Not sure how to help debug this, but ask me questions and I will try my best to answer :)

This is not a surprise. PWB-FB does a bunch of funky stuff to do with z-buffers and cameras in order to be able to render the CoM indicator on top of everything else. I believe there are some hard coded z layer numbers in the code based on what else was being used in the game at the time I wrote it. If that has changed then we might need to use a different layer.

However I have not seen the code for over a year so I can;t remember the details.

Share this post


Link to post
Share on other sites

I saw that in code when i refactored it.  Thanks for chiming in @codepoet!  I've also been able to duplicate it.

That is where I'm looking...

Edited by Papa_Joe

Share this post


Link to post
Share on other sites

Don't know if this is caused by a bad mod interaction or not, but after reverting the PWB COM reverts to its' default position, and trying to load a previously saved position from the GUI does not help.  Also, if RCS Build Aid has its' GUI up, PWB will use the ACOM instead of the COM, even if the ACOM and DCOM are deselected in RCSBA. 

Share this post


Link to post
Share on other sites

great news! :)

i tried it really quickly, for me the up/down/left are messed, and it's hard to be precise ( or impossible to fine tune it for small satellite?)

it throws 2 exeptions when loading the scene ( shown by the exeption detector mod)

the bug of @Armageddon is an old one, i remenber it in KSP 0.90

but it's really nice to see it updated , thank you! :cool:

Share this post


Link to post
Share on other sites

Thanks for the feedback.

I've rooted the cause of the z-Buffer issue, and have a fix in my dev build.  I'll track down the others you both have reported.

If you can give me some more info on the up down left behavior?  I tested it and it seemed to work... in what scene, etc.?

 

Edited by Papa_Joe

Share this post


Link to post
Share on other sites

the up/down bug was in SPH editor for sure (on the aeris-4?), in flight i don't know,

but i'll test it on a fresh install and give you a better feedback later, :wink:

do you have access to the 1.2? i wonder if it will be easy to port it to the new fuel flow mechanism

Share this post


Link to post
Share on other sites

Sadly I do not have access to 1.2  I would love that, given the number of mods I support, but I will have to wait, like the rest :)

Share this post


Link to post
Share on other sites
3 hours ago, Skalou said:

I've made more tests on a fresh KSP 1.1.3, only PWB and exeption detector mod,

here is an explicit album of the problems: http://imgur.com/a/v5QJ8

log:https://www.dropbox.com/sh/x8l7po5xgkj3wtx/AACs1BVogbW5YbfrmudgwfIIa?dl=0

let me know if you need more infos or need something on the part or marker models ( but i don't code). :wink:

 

Thanks so much for taking the time to characterize the issues.

1.  I have addressed the exception shown in the image.  It also is shown in the log.

2.  The COM movement key issues appear not to be a bug, so much as a "frame of reference" issue.  As you know in the Editor, when placing a part, you can use the WASD and QE keys to change the orientation of a part when placing.  Note also that these keys do not respect a particular viewpoint.  They are anchored to the VAB or SPH in a specific way.  

I will look into whether or not it is possible to use the node positioning of the balancer part as an anchor point, but as it is if you understand the default behavior it should work "consistently".

New release coming soon, with the bug fixes in place and a feature or 2 added.

Edited by Papa_Joe

Share this post


Link to post
Share on other sites

I remember to issue of orientation in SPH when I wrote it originally. It is just the way thing are in the SPH. It must be the way that Jeb set about making rockets go up and planes go sideways.

Edited by codepoet

Share this post


Link to post
Share on other sites
3 minutes ago, codepoet said:

I remember to issue of orientation in SPH when I wrote it originally. It is just the way thing are in the SPH. It must be the way that Jeb set about making rockets go up and planes go sideways.

Yup, that was exactly my thinking. :) 

Share this post


Link to post
Share on other sites
16 hours ago, linuxgurugamer said:

@Papa_Joe

Would you like me to take care of the CKAN entry for you?

LGG

I would appreciate that.  Thanks!.  I know they are asking me to make a revision to the distribution.  There is a Zip inside the distribution that contains a MM config.   I'm guessing that it is being unzipped by CKAN, but the communication has not been clear.

If you can sift thru that... awesome!

Edited by Papa_Joe

Share this post


Link to post
Share on other sites
12 minutes ago, Papa_Joe said:

I would appreciate that.  Thanks!.  I know they are asking me to make a revision to the distribution.  There is a Zip inside the distribution that contains a MM config.   I'm guessing that it is being unzipped by CKAN, but the communication has not been clear.

If you can sift thru that... awesome!

Ok.  Forward me what they said.  I'll look into this later this evening.

Share this post


Link to post
Share on other sites
22 minutes ago, linuxgurugamer said:

Ok.  Forward me what they said.  I'll look into this later this evening.

Oops... wrong mod.  it was a BDA mod that was causing the issue with CKAN.   Nevermind on that... Press forward with the CKAN for Fuel Balancer.  Thanks!

Been doing a lot of mods lately :) .  Not as many as you though! :P I believe I already have the KSP-AVC version file created.  It will be in the Repo... Edit: and linked in the OP.

Edited by Papa_Joe

Share this post


Link to post
Share on other sites
16 minutes ago, Papa_Joe said:

Oops... wrong mod.  it was a BDA mod that was causing the issue with CKAN.   Nevermind on that... Press forward with the CKAN for Fuel Balancer.  Thanks!

Been doing a lot of mods lately :) .  Not as many as you though! :P I believe I already have the KSP-AVC version file created.  It will be in the Repo... Edit: and linked in the OP.

ok

Share this post


Link to post
Share on other sites
1 hour ago, linuxgurugamer said:

ok

CKAN is updated, as soon as they do a merge, it will be available.

FYI, the download did NOT have a .version file in it

Share this post


Link to post
Share on other sites
53 minutes ago, linuxgurugamer said:

CKAN is updated, as soon as they do a merge, it will be available.

FYI, the download did NOT have a .version file in it

right.  I had it in the repo, but did it after the initial release... it will be in the next update.  Thanks for your help!

 

Edited by Papa_Joe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now