Jump to content

[1.1.2] On Demand Fuel Cells (ODFC v1.1)


`Orum

Recommended Posts

Original Thread (A new thread for one of my previous mods, for two reasons.  First, I'm splitting the parts and the plugin itself into two separate items in CKAN.  Secondly, it has been so long that I forgot the password to my original account, and I think I used a temporary email to register it.)

ODFC is a plugin to simulate fuel cells in KSP, and do a better job of it than stock's use of a resource converter.  The main difference is it only generates electricity when it's really needed (batteries almost empty), and otherwise lets electricity of a craft float up and down, as it might in a solar powered vehicle when the sun is eclipsed by another celestial body.  It also allows fuel cells to generate byproducts, aimed at supporting life support mods like TACLS.  It also includes a wealth of documentation in order to ease use of the plugin by anyone potentially interested in creating parts that use the plugin, as well as the source code.

For some example parts that demonstrate the plugin, see Okram Industries Fuel Cells (thread, SpaceDock).  Please keep discussion here related to the plugin.

Download on SpaceDock here or DropBox here.  Also available on CKAN.

Change Log:

v1.1
 - Release split into two pieces; plugin is now distributed separately from the OI parts, to ease CKAN support
 - Updated to support KSP v1.1 (KSP 1.0 was not and will not be supported)
 - UI will now hide certain elements if they are not used (mode switching and fuel used is hidden for those with only a single mode; Byproducts is hidden unless there are at least 2 modes, at least one of which has a byproduct)
 - Info screen will now report units in an easier to read and interpret manner (e.g. 0.36/h instead of 0.0001/s)
 - Fixed a bug where floats were truncated to integers when reading the MaxEC value
 - Changed code to use public KSP/Unity functions where applicable
 - Very small code optimizations and organization

v1.0
 - Initial release (for KSP v0.90)

License: CC-BY-NC-SA-4.0

Edited by `Orum
Add change log
Link to comment
Share on other sites

I've been thinking about that actually, and it should be relatively easy to make it a generic resource converter.  However, this presents another potential problem, as with generic converters, you often want several outputs.  Take for example the common case of converting ore to liquid fuel and oxidizer, and maintaining the 0.9/1.1 fuel ratio.  While this can be done right now with some trivial modification to the code, which amounts to basically swapping anywhere it uses ElectricCharge to instead using LiquidFuel, and then setting up the appropriate configuration for Oxidizer in the part configuration as a byproduct, this has some potential pitfalls.  What if the user has plenty of liquid fuel, but is nil on Oxidizer?  Then the converter won't trigger.

So I've thought of two potential ways around this.  The crude way is to just have a single 'mode' that checks both resources and if either condition is satisfied, performs the conversion (e.g. in the case of Ore -> LF + OX, with full LF and no OX, it would perform the conversion and the LF converted would just disappear).  But this is again wasteful, so I'm thinking of instead allowing for multiple modes to be active simultaneously, but that trigger independently (i.e. it checks all potential conversions, and runs those that are needed).  This is certainly a bit more complex, because for balance reasons one might want a single mode being active to convert faster than if two different modes were active simultaneously, or maybe only have a byproduct when a specific set of modes are not performed at the same time.  However, I've never been one to shy away from necessary complexity, so yes I'm planning on implementing it.  I still have to hash out the final details, so I can't tell you for sure what will be possible yet.

Sorry for the long winded answer, but here's a...

tl;dr version: Yes.  It will be in the next release that's anything more than just supporting a newer version of KSP.

EDIT: Here's an example of what a new config might look like, if you have any feedback, speak now or forever hold your peace.

EDIT2: Just to clarify the previous example, a preempting conversion will only preempt for the portion of the duty cycle it requires.  E.g., if you can convert 0.5 units of MonoPropellant per second, but only require half of that, the other half of the duty cycle could be spent producing LiquidFuel/Oxidizer.

Edited by `Orum
Link to comment
Share on other sites

  • 3 months later...
  • 6 months later...

Documentation is included in the zip file, it's HTML based and should work in any modern browser.  If you're looking for examples, look at the parts I've made that use this mod; just keep in mind that they're under a different license from this plugin.

Link to comment
Share on other sites

  • 2 years later...

I ask because have been working on updating this mod for release shortly.

I have asked @Orum (the mod's original author) for permission/blessing to do so, and that if I haven't heard from him by the 24th of August will go ahead with the release.

The license is ( CC-BY-NC-SA-4.0 ) and allows for such. Will not be releasing parts for this mod because the original license for those parts does not allow for such.

This updated version will not require special parts to work.

Will be looking for beta testers soon, will create new thread and link here.

Thank you in advance to @4x4cheesecake for most of the heavy lifting and @linuxgurugamer for the support and guidance.

here is a teaser:

ohjd8oy.png1.png

 

Edited by zer0Kerbal
Link to comment
Share on other sites

Am releasing a prerelease candidate under terms of the original license ( CC-BY-NC-SA-4.0).

Download on SpaceDock here or Github here

Also available on CKAN.

On Demand Fuel Cells Refueled

zer0Kerbal adopts for curation the mod formerly known as On Demand Fuel Cells (ODFC)

TransparentPodsRepressurized TransparentPodsRepressurized

Continuation of On Demand Fuel Cells (ODFC)  by by @Orum, now continued by zer0Kerbal with massive support from @4x4cheesecake, @linuxgurugamer and additional community support.

The plugin has undergone massive and systematic updates and changes.

On Demand Fuel Cells Refueled : v0.0.1.8 ODFC - Run Fuel Cell, Run!

  *** THIS IS DOES NOT COME WITH ANY PARTS; PLUGIN ONLY *** See below (sic) concerning parts.

DOES NOT COME WITH PARTS, but has a patch to copy the stock Fuel Cell and Fuel Cell Array as new parts.

ohjd8oy.png

The patch has three modes (four if Community Resource Pack is installed correctly).

Features:

  • adjustable fuel cell use - much more than just On/Off operation
  • multiple fuel modes (serial usage - one mode at a time)
  • variable activation threshold
  • configurable to produce byproducts (so O+H2 = EC + H2O)
  • very small memory footprint
  • Brown and Black out protection assistance

Known Issues:

Parts:
DOES NOT COME WITH PARTS. There were custom modeled parts that came with the original ODFC, but they are under a restrictive license (all rights reserved) unlike the plugin which is under the CC-BY-NC-SA-4.0 license. There are plans to release more Fuel Cell Parts under a different release (this is underway). Links will be provided to these additional parts.

StockFuelCells.cfg patch copies the existing Stock Fuel cells (+PART) and adds three (*four) modes of operation:

  1. Monopropellent
  2. Liquid Fuel + Oxidizer
  3. Liquid Fuel + Intake Air
  4. *Hydrogen Gas + Oxygen Gas = Electric Charge + Water

.* If you have the Community Resource Pack correctly installed it will give you the additional mode

 

See Betatest Check list for a list of things we are looking for in this beta test Looking for balance issues,

Requests for additional stock sizes and modes should be made below.

CC 4.0 BY-NC-SA

CC 4.0 BY-NC-SA

links to original:

On Demand Fuel Cells (ODFC) by `Orum'
Licensed under CC 4.0 BY-NC-SA

  • KSP Forums
  • Spacedock
  • Dropbox

new development thread:

 

Link to comment
Share on other sites

Sorry, I actually updated this back in June/July, but never got around to testing it to verify that all of the new features worked.  In any case, it looks like zer0Kerbal has taken over, though I don't think that his is anything more than patches to make the old one work with newer versions of KSP.  Let me know if I'm wrong.

If the community is interested in the other features, I'll try and describe them as best I can.  Basically it has become a more general purpose on-demand converter, which can convert from anything to anything (not just electricity).  As part of this it can now both consume and output several things simultaneously, and not just as byproducts, but as limiters to the conversion.

If you guys are interested, let me know and I'll go through the hassle of updating it again (as it seems at least one version of KSP was released between when I last worked on it and now) and testing.  If not, and you'd rather have zer0Kerbal's version, don't worry.  I won't be offended -_-.

Link to comment
Share on other sites

On 8/30/2019 at 5:43 PM, `Orum said:

Sorry, I actually updated this back in June/July, but never got around to testing it to verify that all of the new features worked.  In any case, it looks like zer0Kerbal has taken over, though I don't think that his is anything more than patches to make the old one work with newer versions of KSP.  Let me know if I'm wrong.

If the community is interested in the other features, I'll try and describe them as best I can.  Basically it has become a more general purpose on-demand converter, which can convert from anything to anything (not just electricity).  As part of this it can now both consume and output several things simultaneously, and not just as byproducts, but as limiters to the conversion.

If you guys are interested, let me know and I'll go through the hassle of updating it again (as it seems at least one version of KSP was released between when I last worked on it and now) and testing.  If not, and you'd rather have zer0Kerbal's version, don't worry.  I won't be offended -_-.

Significant code changes ( The plugin has undergone massive and systematic updates and changes. ).. You can see the changes on Github.

I had looked for the new resource converter code, but it was lost (or so I had thought).

My apologies @`Orum / @Orum if I have overstepped.

How do you want to proceed? Do you want to take this back over (your post makes it seem like this is what you want), or do you want me(us) to continue? if so, would very much be interested in the new resource converter code.

Either way, kindly let me know.

 

Edited by zer0Kerbal
Link to comment
Share on other sites

3 hours ago, zer0Kerbal said:

I had looked for the new resource converter code, but it was lost (or so I had thought).

My apologies @Orum if I have overstepped.

The fault is entirely mine.  In the ~18 or so years I've written and released OSS, this is literally the first time someone other than me has done something with my code (to my knowledge, anyway).  I should have uploaded my changes to GitHub, I just never got in the habit as I've never gotten code/patches from anyone else.  You're entirely within your rights. :)

 

3 hours ago, zer0Kerbal said:

How do you want to proceed? Do you want to take this back over (your post makes it seem like this is what you want), or do you want me(us) to continue? if so, would very much be interested in the new resource converter code.

To be honest, I don't play KSP much any more, as real-life obligations keep getting in the way.  I'd like to turn things over to you, assuming you're willing, but I'd also like to get these last few changes into the plugin before I completely check out.  Well, actually there are a couple other things I have almost complete for KSP, but I don't know if I'll ever get time to finish them. :/ 

So my thoughts are, I'll use your code base, and port the features I wrote over to work with whatever you've done.  You can then approve (or deny!) the pull request, and take over from then out.  If I get the time to work on KSP mods in the future, I'll just submit them to your project if they're ODFC related, or at some point finish the other few things I was working on.  Hopefully one day I'll get around to releasing some new parts, like the iris doors you can see in my forum avatar (in a separate pack, of course), along with some other surprises.

Edited by `Orum
Link to comment
Share on other sites

@`Orum@Orum Sounds great. I was hoping we could collaborate. :) What you have outlined sounds great. I wanted to continue to expand ODFC to what you had said - multipurpose resource converter.

May I suggest that we can have ODFC have two part modules (at least for now) to simplify dev work. Some might just want a fuel cell module - entirely up to you.

This way we can release what we have, and you should feel little to no pressure to get things done. RL is RL.

We have expanded the variable abbreviations in the code - to make it understandable to us. Please, do correct if we got things - um, well, wrong. :P

Any other projects you have lying around, kindly talk to me and maybe we can get your legacy back online.

 

Edited by zer0Kerbal
Link to comment
Share on other sites

21 hours ago, zer0Kerbal said:

May I suggest that we can have ODFC have two part modules (at least for now) to simplify dev work. Some might just want a fuel cell module - entirely up to you.

I should have clarified.  This would still be 'one' plugin, that can still function exactly as it does now (i.e. a fuel cell) if that's all you want.  I merely added additional options if you want to use it as a general purpose converter, which is all controlled by the part config files.

21 hours ago, zer0Kerbal said:

This way we can release what we have, and you should feel little to no pressure to get things done. RL is RL.

Don't stop on my account.  I just need to get the habit of committing what I have done regularly, and if I plan on making big changes, making sure I have the time to finish them before I start.  Right now I'm stretched thin, as I work at a school and classes are resuming, so I don't think I'll get code to you until later this month at the soonest.

21 hours ago, zer0Kerbal said:

We have expanded the variable abbreviations in the code - to make it understandable to us. Please, do correct if we got things - um, well, wrong. :P

Heh, I'll definitely take a look, but I don't always write the most intelligible code.  I have an especially bad habit of naming variables very short, cryptic names, but I'm working on getting better.  I'm certainly a lot better at commenting things than I used to be. :)

21 hours ago, zer0Kerbal said:

Any other projects you have lying around, kindly talk to me and maybe we can get your legacy back online.

Definitely.  I want to get ODFC updated first and then I'll look at some of the other stuff I was working on.  It's somewhat of a collection of random things (hovercraft, iris doors, tractor beams) so I'm not sure whether to ball it all up or release each thing separately.  Either way, they all needed work back when I stopped working on them a few years back, and KSP has gone through a lot of updates since then.  Ultimately it all comes down to how much time I have available.

Link to comment
Share on other sites

rather than quoting @`Orum / @Orum post - will summarize.

Yep - one release - multiple functions. sounds good.

I have had to hold up release because of one showstopper bug -

[BUG 0.0.1.9c] ERROR!'s out when there is only one fuel mode. Was working on stock pod patch, and patch only adds one mode (monoprop - because pods usually have monoprop if they have any fuel). This bug was temporarily fixed by added a second mode in the patch (LFO). working on correcting this bug,

will update the github release to .1.9 but hold off Spacedock/CKAN release until issue is resolved.

All good. Enjoy the rest of your weekend,

 

Edited by zer0Kerbal
Link to comment
Share on other sites

  • 1 year later...
On 8/31/2019 at 2:13 PM, `Orum said:

I'd like to turn things over to you

yes - would love that code / parts / 'surprises'. :D

On 8/31/2019 at 2:13 PM, `Orum said:

I'll use your code base, and port the features I wrote over to work with whatever you've done.  You can then approve (or deny!) the pull request, and take over from then out.  If I get the time to work on KSP mods in the future, I'll just submit them to your project if they're ODFC related, or at some point finish the other few things I was working on.  Hopefully one day I'll get around to releasing some new parts, like the iris doors you can see in my forum avatar (in a separate pack, of course), along with some other surprises.

understood. and Thank you! @`Orum

PS - any way you could add me as an author on SpaceDock (or xfer the listing to me)? would be nice for the end users to only have one listing in CKAN? (could merge new (mine)  listing into original (yours). @HebaruSan @VITAS

I have included you ( @`Orum ) in the pm's I sent to you ( @Orum)

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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