Ratzap

[1.05] Fusebox - electric charge tracker and build helper. 1.52 released 24th Jan 16

577 posts in this topic

I like many others have lost missions to forgetting to attach a solar panel or got a probe alllll the way to it's destination only to discover that it runs out of charge 1/3 of the way round the dark side. So I set about writing a plugin which will stop me being so daft - Fusebox was born.

It's active in the SPH/VAB and in flight. In the editor when you load a ship or select a root part it will open up. It shows you the amount of battery you have (in build maximum = current always of course), the amount of generated charge per second and the amount of drain per second. The latter are rounded to 2 decimal places. If the drain exceeds generation, drain will turn red and it will print a message telling you how long your battery will last at that drain. There is an adjustable warp halter based on battery level and an orbital darkness calculator so you can optimize your battery levels for specific flights.

You will need a little common sense in the build phase as the plugin cannot tell if your panels will all be able to see the sun or not. It cannot tell that rover wheels will not be burning charge while en route to the Mun etc. To that end there are the filters, click sub groups in and out of the calculation in order to see if certain part groups are balanced - fiddle with it, you'll soon get the hang of it. Click the toolbar icon to switch to concise/minimize mode (it also minimizes the filters), click again to re-open. The plugin remembers window positions and filter settings. Click filters to see the filter box, click a filter on/off to include/exclude from the calculations. Pick GUI style by clicking settings. Also in settings is the toggle for emergency warp halt and the threshold for it.

New technique used to avoid references so the one build in the zip does all the supported mods in the release notes.

Gotchas: reaction wheels are estimated in the VAB and untracked in flight - the KSP code as it stands does not return any usage information so it's impossible to find out. The estimation in VAB is based on observation of one axis full torque and the published documentation of how it's supposed to work. This is why the reaction wheel filter is off by default.

Thanks to Hakan for the initial CKAN config and Pamidur for the RPM addin code.

I know the drill, pics or no clicks:

AM7z88b.jpg

KerbalCurse: http://kerbal.curseforge.com/ksp-mods/220284-fusebox

Dropbox here: https://dl.dropboxusercontent.com/u/71576136/Fusebox_1_52.zip

Known bugs:

Science lab - same as wheels, impossible to know when it is using charge

Updated to 1.52 - Recompiled for 1.0.5 and updated DLLs

 

Spoiler

 

Updated to 1.51 - Recompiled for updated DLLs, added kOS support

Updated to 1.50 - Added support for modded solar systems (RSS, 6.4x etc)

Updated to 1.45 - linked to latest and some fixes.

Updated to 1.41 - Linked with latest AntennaRange, Aviation Lights, KAS, NF Solar, RT2, Scansat, TacLS, Telemachus. Skin bug fixed.

Updated to 1.3 - Recompile for new dependancies. BTSM and TACLS back in, fresh scansat and RT2

Updated to 1.2 - Recompile for 0.90.0. Remove support for mods not updated to new KSP version.

Updated to 1.1 - Recompile for 0.25 and fresh mods. Biomatic not 0.25 so dropped. Rudimentary BTSM support added.

Updated to 1.0a - Updated for 0.24.2 and compliance with mod rules

Updated to 1.0 - added precision change, toggle for icon anim, filter re-org, bugfixes

Updated to 0.99 - new near future, bug fix and add electric engine throttle slider in the VAB under filters

Updated to 0.98 - new SCANsat, new telemachus. Add AntennaRange

Updated to 0.97 - bug fixes, add some mods back

Updated to 0.96 - bug fixes

Updated to 0.95 - http://forum.kerbalspaceprogram.com/threads/50077-0-23-Fusebox-electric-charge-tracker-and-build-helper-0-9-released-01-03-14?p=1107578&viewfull=1#post1107578

Updated to 0.9 - Orbital darkness calculator added.

Updated to 0.8f - KAS relink and hopefully got the version checking smoother

Updated to 0.8e – no more reported bugs so wrap-up release.

Updated to 0.8d - fix for runtime loader checking

Updated to 0.8c - SPH fix, RT2 in editor fix, extra long battery timer

Updated to 0.8a - Warp cleanup, minimize icon, RT2 filter, cosmetics

Updated to 0.8 - Toolbar integration, emergency warp halt and should handle other mods cleaner.

Updated to 0.7b - recompile for 0.23 DLLs and KAS/Kethane updates

Updated to 0.7 - One version does all, supports Aviation Lights, KAS, Near Future, Kethane, Remote Tech 2, Telemachus, SCANsat (partial). Better antenna calculations and time to empty correct.

Updated to 0.6 - support for antennae and new aviation lights

Updated to 0.5a - fix bugs I put in with 0.5

Updated to 0.5 - Add concise mode

Updated to 0.4d - KAS 0.4.2 changed magnet method

Updated to 0.4c - KAS 0.4 winch calculation corrected and Kethane converters work fully

Updated to 0.4b - KAS 0.4 support in the 2 builds with KAS

Updated to 0.4a - Hides when F2 pressed, changed default GUI to "KSP window 2" (aka mechjeb look), added settings to change skins, changed windows to use autoextend. *warning* Delete the old version or the config.xml in it.

 

 

 

The source is in the zip file and license is GPLv2.

Edited by Ratzap
New version
11 people like this

Share this post


Link to post
Share on other sites

Let me know of parts which don't work (stock, mod and part name please) or wrong numbers in the calculations. Mod authors who'd like to have their parts included drop me a PM.

Share this post


Link to post
Share on other sites

Ah, so this is what you were working on! Awesome!

Can you include Remotetech Antenna, dish, and SPU electricity numbers? You can read from the partname's module's confignode so no dependency needed.

Share this post


Link to post
Share on other sites
Ah, so this is what you were working on! Awesome!

Can you include Remotetech Antenna, dish, and SPU electricity numbers? You can read from the partname's module's confignode so no dependency needed.

I'll take a look, RT1 or 2? If they haven't overloaded the PartModule subclass (like ModuleEngines etc) then they'll simply work. The confignode would be ok for the VAB/SPH but in flight it'd need to query the live methods or variables to get back the 'right now' usage.

Share this post


Link to post
Share on other sites

Right, sorry, hadn't used it yet so forgot about flight mode. :o

RT1, I was thinking, but only selfishly (I'm still using it, as are, it appears, a number of folks, because RT2 is still very much in playtest-at-most mode). RT2 would be more long-term, though.

Both, obviously, would be best. ;)

Share this post


Link to post
Share on other sites
RT1, I was thinking, but only selfishly (I'm still using it, as are, it appears, a number of folks, because RT2 is still very much in playtest-at-most mode). RT2 would be more long-term, though.

Both, obviously, would be best. ;)

I have both RT versions here so I had a quick look in the part.cfg files. RT1 has one overload - ModuleRTAnimatedAntenna - but even the biggest sat dish has EnergyDrain1 = 0.02777778 so I'd say that's negligible enough to simply not bother with. The rest of the parts all use stock subclasses. RT2 dishes don't appear to use any charge at all (maybe the author decided why bother when they are consuming nothing anyway), the microsats all use stock subclasses.

Share this post


Link to post
Share on other sites
this is good but alot of items it dont reconize

Such as? If you list them along with a pack they come from something can be done. Some things simply have not implemented an interface to their charge data making it impossible for me to add them.

Share this post


Link to post
Share on other sites

Dude, just wanted to point out that you must have saved me about 3 hours play in the last week. It takes a LONG time to get a jet powered craft out of Kerban system only to run out of power and have to revert so thanks for removing that rather annoying part of my design process (it doesn't need to make sense or be logical in any way, if I call it "process" that's what it is hmkay) :)

Share this post


Link to post
Share on other sites
Such as? If you list them along with a pack they come from something can be done. Some things simply have not implemented an interface to their charge data making it impossible for me to add them.

its alot of differnt parts. some will work from a pack then others wont show up. put the .cfg change in descrpiton so we can add it to parts that dont seem to come up right.

Share this post


Link to post
Share on other sites
Dude, just wanted to point out that you must have saved me about 3 hours play in the last week. It takes a LONG time to get a jet powered craft out of Kerban system only to run out of power and have to revert so thanks for removing that rather annoying part of my design process (it doesn't need to make sense or be logical in any way, if I call it "process" that's what it is hmkay) :)

You're welcome, that's why it exists though because I kept doing the same thing.

its alot of differnt parts. some will work from a pack then others wont show up. put the .cfg change in descrpiton so we can add it to parts that dont seem to come up right.

That's not how it works. If the mods you're using have used a standard PartModule subclass they will be picked up. If they have written their own overrides then the plugin needs to be linked to their .dll and use their override. Give me a concrete example so I can show you what I mean.

Share this post


Link to post
Share on other sites

ill check next time i play. off top of my head think the generators from the hybrid ion pack didnt show up but not sure ill check some later

nvm the genarators show up

Edited by sidfu

Share this post


Link to post
Share on other sites

Awesome! This will greatly help with those Ion engines and wondering if I have enough solar panels. It's these little add ons that make KSP so much more user friendly.

Share this post


Link to post
Share on other sites

New version posted. Affects users of any of the 3 Kethane builds (converters now show the right amounts when running).

Share this post


Link to post
Share on other sites

Does this mod recognize the pseudo 'RTG' in the Fustek Expansion utilities module?

Share this post


Link to post
Share on other sites

ok, i have copied the version "With_all" into my gamedata area, restarted ksp and pulled up a previously built craft. when i select the root part, nothing. what basic step or concept am i missing here? thanks for any help, and yes, i did look at previous posts but it there is a step there i missed it. thanks for any and all help.

Share this post


Link to post
Share on other sites
Does this mod recognize the pseudo 'RTG' in the Fustek Expansion utilities module?

Yes, that is implemented as a ModuleGenerator so it's a standard subclass and gets recognised.

ok, i have copied the version "With_all" into my gamedata area, restarted ksp and pulled up a previously built craft. when i select the root part, nothing. what basic step or concept am i missing here? thanks for any help, and yes, i did look at previous posts but it there is a step there i missed it. thanks for any and all help.

Did you go into the With_all and merge the GameData there with <KSP_Home>\GameData (noddy question but needs to be asked). So after copying you should have a 'Fusebox' folder inside your GameData with the other mods.

You should not need to select any parts, as soon as you load a craft the fusebox window should pop open in the top right corner which you can then drag about. There's no setup or hot key, so long as it loaded with KSP it just appears. If you check the file position and it's still not showing up, look inside your <KSP_Home>\KSP.log, see if there's any errors there.

Share this post


Link to post
Share on other sites

yes, that is what i did. I selected the With_all, and popped the contents of the GameData folder into my GameData folder. It is sitting there with all of the other sub-dirs, like mechjeb2, Kethane, etc..... Nothing in top right corner. MechJeb on upper right side of screen...

Share this post


Link to post
Share on other sites
yes, that is what i did. I selected the With_all, and popped the contents of the GameData folder into my GameData folder. It is sitting there with all of the other sub-dirs, like mechjeb2, Kethane, etc..... Nothing in top right corner. MechJeb on upper right side of screen...

Take a look in your KSP.log and see if there's anything there about Fusebox not loading. Also do you have all 3 mods - Kethane, KAS and aviation lights? With_all is built for all 3, if any are not installed it won't work.

Share this post


Link to post
Share on other sites

Ok, i bet that is it. I have KAS disabled at the moment, not in GameData. is there some method, or .cfg, or way, that when i pull mods out for debuging and such that i will NOT have to change the fuzebox load? Or maybe just modify some parameter file???

thanks.

EDIT: I typically run with kethane, aviation lights and 'sometimes' with KAS.. I am currently chasing a bothersome bug that seems to be a conflict with KAS so that is why it is pulled at this time.

thanks.

Edited by drtedastro
more info

Share this post


Link to post
Share on other sites
Ok, i bet that is it. I have KAS disabled at the moment, not in GameData. is there some method, or .cfg, or way, that when i pull mods out for debuging and such that i will NOT have to change the fuzebox load? Or maybe just modify some parameter file???

I wish there was but sadly it's not possible technically. C# will allow some wiggle room on dynamic link loading but you have to reference the assembly something is in at compile time to get a .dll out. As soon as that happens, the presence of that assembly is checked when KSP loads the dll and if it's not there it defers until the end of the load process. If it is still not found by then, the dll load for fusebox fails.

About all I can suggest is use the With_kethane build when you don't have KAS loaded. Aviation lights are very low drain so not seeing those shouldn't be a huge problem. I'd rather not have to add another build to the zip.

Share this post


Link to post
Share on other sites

Mod works as advertised - handy :)

One request though, would it be possible to use the mostly-transparent UI mechjeb uses?

Also, for some reason the fusebox window remains visible even if you turn off the UI with F2, at least when the window is rolled up.

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