Jump to content

[1.12.x] Fusebox Continued - electric charge tracker and build helper


linuxgurugamer

Recommended Posts

With @Ratzap ok, I've adopted this mod  The original thread is here: http://forum.kerbalspaceprogram.com/index.php?/topic/46064-105-fusebox-electric-charge-tracker-and-build-helper-152-released-24th-jan-16/

The new version for KSP 1.4.1 has new dependencies

New Dependencies

Important note:  If the dependencies are missing, NO PARTS WILL BE LOADED

CKAN has been updated to install the dependencies, if needed

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.

Source Code:  https://github.com/linuxgurugamer/FuseBoxContinued

Download: https://spacedock.info/mod/1263/FuseBox Continued

License:  GPLv2

This now includes 2 files from Virgin Kalactic, those two files are covered by the MIT license

Donations gratefully accepted

Patreon.png

https://www.patreon.com/linuxgurugamer

Major changes for 1.2.2:

  •     Initial release for 1.2
  •     Reorganized code, moving into different files
  •     Added TrackResource.cs and PartReplacement.cs from the old Virgin Kalactic
  •     In flight resources are monitored using actual values.  
  •     Replaced 3x/sec polling of entire vessel with events in Editor
  •     In Flight, polling only gets the values from the TrackResource class
  •     Added Log.cs for logging
  •     Added version file

In flight, the mod gets the actual usage, not estimated, and will work with any other mod that uses the standard way to get and set resource (ie:  ElectricalCharge) usage.  If a mod has a custom module which isn't accounted for, then the only issue will be that you won't be able to disable it from the monitor, and it won't be accounted for in the VAB.

Unsupported Mods

KSPI-E

Converting from AmpYear to FuseBox

  • If you have any vessels with a reserve battery installed, the reserve battery will be converted into a regular battery

I know the drill, pics or no clicks:

AM7z88b.jpg

 

Edited by linuxgurugamer
Link to comment
Share on other sites

Mostly in that it didn't always compute production/consumption for mod-supplied modules.  I'd occasionally build a ship with lots of power and go to check, and it would say there's no production (because none of the production was something it recognized) etc.

Also, the planet drop-down list tends to list each planet multiple times.

Link to comment
Share on other sites

4 minutes ago, DStaal said:

Mostly in that it didn't always compute production/consumption for mod-supplied modules.  I'd occasionally build a ship with lots of power and go to check, and it would say there's no production (because none of the production was something it recognized) etc.

Also, the planet drop-down list tends to list each planet multiple times.

I didn't even look at the planet dropdown list, it was working for me.  

If you do see the missing production issue, let me know what mods are missing production

Let me know if you see this again

Edited by linuxgurugamer
Link to comment
Share on other sites

OUTSTANDING! While I've generally been using AmpYear for EC monitoring it leaves a lot to be desired when it comes to other mods.  I used Fusebox all the way up until Ratzap stopped supporting it and have missed it ever since.  Once again thanks for your herculean efforts in the maintenance and revival of some really great mods!

Link to comment
Share on other sites

So you asked about mods that aren't getting picked up by Fusebox.  Since both of these are handled through custom plugins I'm not sure what may or may not be exposed to hook onto for data.  So far it's only...

WildBlue solar panels from Pathfinder/MOLE etc...specifically the ones @Angel-125 is handling through Wild Blue Tools like the the Sombrero Solar Array or SPF-6

SSTU Solar panels - all of them.  @Shadowmage handles all of his solar panels through his plugin so none of them are picked up by Fusebox.

 

Link to comment
Share on other sites

12 hours ago, rasta013 said:

So you asked about mods that aren't getting picked up by Fusebox.  Since both of these are handled through custom plugins I'm not sure what may or may not be exposed to hook onto for data.  So far it's only...

WildBlue solar panels from Pathfinder/MOLE etc...specifically the ones @Angel-125 is handling through Wild Blue Tools like the the Sombrero Solar Array or SPF-6

SSTU Solar panels - all of them.  @Shadowmage handles all of his solar panels through his plugin so none of them are picked up by Fusebox.

 

Thanks, I'll get on it.

Also, I found a bug in the editor with reaction wheels, it is assuming the wheels are using a lot more EC than they do.  

Re the solar panels, is the problem only in the editor, or in flight as well?

Link to comment
Share on other sites

17 hours ago, rasta013 said:

OUTSTANDING! While I've generally been using AmpYear for EC monitoring it leaves a lot to be desired when it comes to other mods.  I used Fusebox all the way up until Ratzap stopped supporting it and have missed it ever since.  Once again thanks for your herculean efforts in the maintenance and revival of some really great mods!

Some mods take more time than others to revive.  This was one of them.  Although someone had gotten it working in a basic fashion for 1.2.2 (kudos to him), it still had the performance issue which I had to fix by redoing some code and adding in more.

So as of now, I expect to have to continue to work on this to add in missing mods.

I do miss the reserve battery from Ampyear, though.  I may ask @JPLRepoif it would be ok to include in here

Link to comment
Share on other sites

15 minutes ago, linuxgurugamer said:

I do miss the reserve battery from Ampyear, though.  I may ask @JPLRepoif it would be ok to include in here

Should you manage to ensure compatibility with Ampyear (not only about reserve batteries, that add-on adds custom modules e.g. AYPart with many parts in a savegame) I would certainly switch (back) to Fusebox, now that it gets the love it deserves (and becoming compatible with most other add-ons). Otherwise have to start a whole new save after switching to Fusebox.

Anyway, please keep doing as you started with this add-on, it always had great potential, have to thank @Ratzap for how he designed it; but you seem able to solve some of the long-standing issues this add-on kept showing.

Link to comment
Share on other sites

11 minutes ago, diomedea said:

Should you manage to ensure compatibility with Ampyear (not only about reserve batteries, that add-on adds custom modules e.g. AYPart with many parts in a savegame) I would certainly switch (back) to Fusebox, now that it gets the love it deserves (and becoming compatible with most other add-ons). Otherwise have to start a whole new save after switching to Fusebox.

Anyway, please keep doing as you started with this add-on, it always had great potential, have to thank @Ratzap for how he designed it; but you seem able to solve some of the long-standing issues this add-on kept showing.

I have no idea what AYPart is, other than something that Ampyear is using.

I would have to do some research on this

And, of course, it depends on @JPLRepo's permission for the batteries.

Edited by linuxgurugamer
Link to comment
Share on other sites

ive been struggling trying to nail down a couple problems with a huge over-modded install, and after installing your version when i loaded a ship in-space the console had about 90k lines of this over a 3ish minute period:

 

    ModuleEngines.RequestPropellant (Double mass)
    ModuleEngines.CalculateThrust ()
    ModuleEngines.ThrustUpdate ()
    ModuleEngines.FixedUpdate ()
[EXC 19:30:43.393] NullReferenceException: Object reference not set to an instance of an object
    PartSet.GetOrCreateList (Int32 id, Boolean pulling)
    PartSet.RequestResource (.Part part, Int32 id, Double demand, Boolean usePri)
    Part.requestResource (.Part origin, Int32 resourceID, ResourceFlowMode flowMode, Double demand)
    Part.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartEventTypes+SingleCallBack3Arg`4[System.Double,System.String,System.Double,ResourceFlowMode].Invoke (System.String arg1, Double arg2, ResourceFlowMode arg3)
    PartReplacement.PartTapIn.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartTapIn.RequestResource (Int32 resourceID, Double demand, ResourceFlowMode flowMode)
    ModuleEngines.RequestPropellant (Double mass)
    ModuleEngines.CalculateThrust ()
    ModuleEngines.ThrustUpdate ()
    ModuleEngines.FixedUpdate ()
[EXC 19:30:43.405] NullReferenceException: Object reference not set to an instance of an object
    PartSet.GetOrCreateList (Int32 id, Boolean pulling)
    PartSet.RequestResource (.Part part, Int32 id, Double demand, Boolean usePri)
    Part.requestResource (.Part origin, Int32 resourceID, ResourceFlowMode flowMode, Double demand)
    Part.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartEventTypes+SingleCallBack3Arg`4[System.Double,System.String,System.Double,ResourceFlowMode].Invoke (System.String arg1, Double arg2, ResourceFlowMode arg3)
    PartReplacement.PartTapIn.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartTapIn.RequestResource (Int32 resourceID, Double demand, ResourceFlowMode flowMode)
    ModuleEngines.RequestPropellant (Double mass)
    ModuleEngines.CalculateThrust ()
    ModuleEngines.ThrustUpdate ()
    ModuleEngines.FixedUpdate ()
[EXC 19:30:43.429] NullReferenceException: Object reference not set to an instance of an object
    PartSet.GetOrCreateList (Int32 id, Boolean pulling)
    PartSet.RequestResource (.Part part, Int32 id, Double demand, Boolean usePri)
    Part.requestResource (.Part origin, Int32 resourceID, ResourceFlowMode flowMode, Double demand)
    Part.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartEventTypes+SingleCallBack3Arg`4[System.Double,System.String,System.Double,ResourceFlowMode].Invoke (System.String arg1, Doub

 

followed by a couple thousand lines of:

[LOG 19:33:20.401] FuseBox:OnGUI.GetTotalConsumption: 0.0900032874896599
[LOG 19:33:20.402] FuseBox:OnGUI: -2.94092311435891
[LOG 19:33:20.403] FuseBox:TrackResource.Reset
[LOG 19:33:20.734] FuseBox:OnGUI.GetTotalConsumption: 0.0900079543621683
[LOG 19:33:20.735] FuseBox:OnGUI: -2.94083208461418
[LOG 19:33:20.736] FuseBox:TrackResource.Reset
[LOG 19:33:21.067] FuseBox:OnGUI.GetTotalConsumption: 0.0900052032832475
[LOG 19:33:21.069] FuseBox:OnGUI: -2.94074096976789
[LOG 19:33:21.070] FuseBox:TrackResource.Reset
[LOG 19:33:21.414] FuseBox:OnGUI.GetTotalConsumption: 0.0900027138895184
[LOG 19:33:21.415] FuseBox:OnGUI: -2.94064690927232
[LOG 19:33:21.416] FuseBox:TrackResource.Reset
[LOG 19:33:21.750] FuseBox:OnGUI.GetTotalConsumption: 0.0900031751661984
[LOG 19:33:21.752] FuseBox:OnGUI: -2.94055293566068
[LOG 19:33:21.752] FuseBox:TrackResource.Reset
[LOG 19:33:22.107] [3/19/2017 7:33:22 PM [x] Sc

 

as i said, its an install that is insanely modded and was giving me trouble last week ~ the error is probably elsewhere... but just in case wanted to leave this here.  but reverting to the recompiled verson from realgecko works normally

 

Edited by TK421d
Link to comment
Share on other sites

14 minutes ago, TK421d said:

ive been struggling trying to nail down a couple problems with a huge over-modded install, and after installing your version when i loaded a ship in-space the console had about 90k lines of this over a 3ish minute period:

 

    ModuleEngines.RequestPropellant (Double mass)
    ModuleEngines.CalculateThrust ()
    ModuleEngines.ThrustUpdate ()
    ModuleEngines.FixedUpdate ()
[EXC 19:30:43.393] NullReferenceException: Object reference not set to an instance of an object
    PartSet.GetOrCreateList (Int32 id, Boolean pulling)
    PartSet.RequestResource (.Part part, Int32 id, Double demand, Boolean usePri)
    Part.requestResource (.Part origin, Int32 resourceID, ResourceFlowMode flowMode, Double demand)
    Part.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartEventTypes+SingleCallBack3Arg`4[System.Double,System.String,System.Double,ResourceFlowMode].Invoke (System.String arg1, Double arg2, ResourceFlowMode arg3)
    PartReplacement.PartTapIn.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartTapIn.RequestResource (Int32 resourceID, Double demand, ResourceFlowMode flowMode)
    ModuleEngines.RequestPropellant (Double mass)
    ModuleEngines.CalculateThrust ()
    ModuleEngines.ThrustUpdate ()
    ModuleEngines.FixedUpdate ()
[EXC 19:30:43.405] NullReferenceException: Object reference not set to an instance of an object
    PartSet.GetOrCreateList (Int32 id, Boolean pulling)
    PartSet.RequestResource (.Part part, Int32 id, Double demand, Boolean usePri)
    Part.requestResource (.Part origin, Int32 resourceID, ResourceFlowMode flowMode, Double demand)
    Part.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartEventTypes+SingleCallBack3Arg`4[System.Double,System.String,System.Double,ResourceFlowMode].Invoke (System.String arg1, Double arg2, ResourceFlowMode arg3)
    PartReplacement.PartTapIn.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartTapIn.RequestResource (Int32 resourceID, Double demand, ResourceFlowMode flowMode)
    ModuleEngines.RequestPropellant (Double mass)
    ModuleEngines.CalculateThrust ()
    ModuleEngines.ThrustUpdate ()
    ModuleEngines.FixedUpdate ()
[EXC 19:30:43.429] NullReferenceException: Object reference not set to an instance of an object
    PartSet.GetOrCreateList (Int32 id, Boolean pulling)
    PartSet.RequestResource (.Part part, Int32 id, Double demand, Boolean usePri)
    Part.requestResource (.Part origin, Int32 resourceID, ResourceFlowMode flowMode, Double demand)
    Part.RequestResource (System.String resourceName, Double demand, ResourceFlowMode flowMode)
    PartReplacement.PartEventTypes+SingleCallBack3Arg`4[System.Double,System.String,System.Double,ResourceFlowMode].Invoke (System.String arg1, Doub

 

followed by a couple thousand lines of:

[LOG 19:33:20.401] FuseBox:OnGUI.GetTotalConsumption: 0.0900032874896599
[LOG 19:33:20.402] FuseBox:OnGUI: -2.94092311435891
[LOG 19:33:20.403] FuseBox:TrackResource.Reset
[LOG 19:33:20.734] FuseBox:OnGUI.GetTotalConsumption: 0.0900079543621683
[LOG 19:33:20.735] FuseBox:OnGUI: -2.94083208461418
[LOG 19:33:20.736] FuseBox:TrackResource.Reset
[LOG 19:33:21.067] FuseBox:OnGUI.GetTotalConsumption: 0.0900052032832475
[LOG 19:33:21.069] FuseBox:OnGUI: -2.94074096976789
[LOG 19:33:21.070] FuseBox:TrackResource.Reset
[LOG 19:33:21.414] FuseBox:OnGUI.GetTotalConsumption: 0.0900027138895184
[LOG 19:33:21.415] FuseBox:OnGUI: -2.94064690927232
[LOG 19:33:21.416] FuseBox:TrackResource.Reset
[LOG 19:33:21.750] FuseBox:OnGUI.GetTotalConsumption: 0.0900031751661984
[LOG 19:33:21.752] FuseBox:OnGUI: -2.94055293566068
[LOG 19:33:21.752] FuseBox:TrackResource.Reset
[LOG 19:33:22.107] [3/19/2017 7:33:22 PM [x] Sc

 

as i said, its an install that is insanely modded and was giving me trouble last week ~ the error is probably elsewhere... but just in case wanted to leave this here.  but reverting to the recompiled verson from realgecko works normally

 

The OnGUI messages are spam, you can ignore them, will be fixed in the next release.

I'll look into the nullref.  I assume this was an existing ship in an existing save?  Did they appear anywhere else, or just that one spot?

Link to comment
Share on other sites

14 minutes ago, linuxgurugamer said:

The OnGUI messages are spam, you can ignore them, will be fixed in the next release.

I'll look into the nullref.  I assume this was an existing ship in an existing save?  Did they appear anywhere else, or just that one spot?

yes its was an existing ship, that i went to directly after loading the game.   every reference i see previous is regular MM patch loading.

~snip, now irrelevant ~

here's the full log https://drive.google.com/file/d/0B7nacTvbJiHGX1hmejJ3YzNUTzg/view?usp=sharing

Edited by TK421d
Link to comment
Share on other sites

@TK421d, thanks, but the first batch was sufficient, I found and fixed it:

New release, 0.1.3:

  • Added back ScanSat
  • Added back TAC-LS
  • Added Deep Freeze
  • Fixed EC rate for Reaction Wheels in the Editor, it was being multipled by the torque, should be x3 (pitch, roll & yaw each have their own usage)
  • Fixed filter not being applied in editor until a part change
  • Fixed log spam from OnGUI
  • Fixed nullref exception from PartReplacement
Link to comment
Share on other sites

14 minutes ago, TK421d said:

havnt ever mentioned it around here, but my wife owns a little restaurant/bar.  you my friend would always drink free.  :)

Where is "here"?

Unfortunately (or fortunately, depending on your point of view), I don't drink

Please test the new release and let me know how it works.

For all interested regarding switching from Ampyear to Fusebox, you can ignore the AYPart, it's only used to "save and load the AmpYear Emergency Shutdown Procedure settings for each part."

So, I'm going to create a do-nothing AYPart class to stop any errors, will also put in a check for Ampyear to be sure both aren't running at the same time

Edited by linuxgurugamer
Link to comment
Share on other sites

4 hours ago, linuxgurugamer said:

Thanks, I'll get on it.

Also, I found a bug in the editor with reaction wheels, it is assuming the wheels are using a lot more EC than they do.  

Re the solar panels, is the problem only in the editor, or in flight as well?

It's in both editor and flight...

...and just saw the new version and will start banging on this today...

Link to comment
Share on other sites

I do not see the point in making this mod like my mod?
Why don't you kep this mod the way it was?
AmpYear is a different mod and I don't understand why you would want to make this mod like it.
Seems to defeat the purpose.
I'd also prefer you didn't use my code in this mod. Of course licenses permit, but I prefer you didn't.
This mod should be it's own.

Link to comment
Share on other sites

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