Drew Kerman

Non-rechargable batteries?

Recommended Posts

KSA currently does not have rechargeable batteries because I like the added logistics it involves for my early program & increased costs. However I haven't really come up with an elegant way of doing this other than to disable the batteries when I am not using them to do stuff like transmit data so that the EC output of whatever alternator the craft has does not recharge them. Pinning PAWs makes this easy to manage but I was hoping there was some config for the RESOURCE {} I could set to enable a one-way flow. Research into this hasn't come up with anything like that though. Just want to make sure I haven't missed anything.

Share this post


Link to post
Share on other sites

Maybe try make a non-transferable resource (like solid fuel) that you can convert to electric charge? That's kinda cheaty but should work.

Share this post


Link to post
Share on other sites
42 minutes ago, Drew Kerman said:

KSA currently does not have rechargeable batteries because I like the added logistics it involves for my early program & increased costs. However I haven't really come up with an elegant way of doing this other than to disable the batteries when I am not using them to do stuff like transmit data so that the EC output of whatever alternator the craft has does not recharge them. Pinning PAWs makes this easy to manage but I was hoping there was some config for the RESOURCE {} I could set to enable a one-way flow. Research into this hasn't come up with anything like that though. Just want to make sure I haven't missed anything.

Why not just kill ModuleAlternator with a MM ? And if have to make it a small battery if it needs a charge ?

Edit- whoops had to edit that it came out all wrong :(

Edited by Mecripp2

Share this post


Link to post
Share on other sites
7 minutes ago, MeCripp said:

Why not just kill ModuleAlternator with a MM ?

Because the alternator is doing its job like it is supposed to, and when the batteries are being used they aren't drained as much because an alternator is there providing some of the juice. I only enable the batteries when something is happening that would overwhelm the ability of the alternator to handle on its own, then I have to disable them again afterwards so the drop in charge usage doesn't cause the extra output of the alternator to flow back into the batteries

I don't understand your second question

Share this post


Link to post
Share on other sites
2 minutes ago, Drew Kerman said:

Because the alternator is doing its job like it is supposed to, and when the batteries are being used they aren't drained as much because an alternator is there providing some of the juice. I only enable the batteries when something is happening that would overwhelm the ability of the alternator to handle on its own, then I have to disable them again afterwards so the drop in charge usage doesn't cause the extra output of the alternator to flow back into the batteries

I don't understand your second question

Have you seen

And you might look at

And try and use Near Future Electrical

and play around with Capacitors ?

Share this post


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

Maybe try make a non-transferable resource (like solid fuel) that you can convert to electric charge? That's kinda cheaty but should work.

oh, I totally forgot solid fuel acts like this. Makes sense. I will apply the same settings as solid fuel to EC and see what happens. Maybe I don't understand the flow/transfer settings properly because I didn't think of this

Share this post


Link to post
Share on other sites
10 minutes ago, Drew Kerman said:

oh, I totally forgot solid fuel acts like this. Makes sense. I will apply the same settings as solid fuel to EC and see what happens. Maybe I don't understand the flow/transfer settings properly because I didn't think of this

changing that when you have solar panels on you would have to watch where you placed them

RESOURCE_DEFINITION
{
  name = ElectricCharge
  density = 0
  unitCost = 0
  hsp = 0
  flowMode = ALL_VESSEL
  transfer = PUMP
  isTweakable = true
}
RESOURCE_DEFINITION
{
  name = SolidFuel
  density = 0.0075
  unitCost = 0.6
  hsp = 920
  flowMode = NO_FLOW
  transfer = NONE
  isTweakable = true
}

If you try that you would want flowMode = STAGE_PRIORITY_FLOW or flowMode = STACK_PRIORITY_SEARCH

EDIT- And making it like SolidFuel would just be a battery full you couldn't get any out or in

Edited by Mecripp2
EDIT

Share this post


Link to post
Share on other sites

Something along these lines will do the trick if you don't want the full-blown features of Real Battery

NRBatt_Resource.cfg

RESOURCE_DEFINITION
{
  name = ElectricChargeNonRechargeable
  title = Non-rechargeable Electric Charge
  abbreviation = EC(NR)
  density = 0
  unitCost = 0.5	//  this should make it so that depleted batteries are worth less when recovered
  hsp = 0
  flowMode = NO_FLOW
  transfer = NONE
  isTweakable = false
}

NRBatt_MM.cfg

@PART[batteryPack]:FINAL
{
	@title = Z-100 Non-Rechargeable Battery Pack

	@RESOURCE[ElectricCharge]
	{
		@amount = 0
		@maxAmount = 0.5
	}

	RESOURCE {
		name = ElectricChargeNonRechargeable
		amount = 100
		maxAmount = 100
	}

	MODULE {
		name = ModuleResourceConverter
		ConverterName = Non-Rechargeable Battery
		StartActionName = Connect Battery
		StopActionName = Disconnect Battery
		ToggleActionName = Toggle Battery
		// IsActivated = true // this would make it plugged in by default, probably a bad idea
		INPUT_RESOURCE
		{
			ResourceName = ElectricChargeNonRechargeable
			Ratio = 0.5
			FlowMode = NO_FLOW
		}
		OUTPUT_RESOURCE
		{
			ResourceName = ElectricCharge
			Ratio = 0.5
			DumpExcess = false
		}
	}
}

 

Edited by cake>pie
spelling

Share this post


Link to post
Share on other sites

I've played around with some resource flow types and have come up with various good results but nothing all-encompassing for what I need. I've decided I'll just leave this to kOS, as I can write a script to detect battery usage and when it spikes over what the alternator is putting out it will activate the batteries, then de-activate them when usage drops. I like this approach now that I think about it because it will be a nice groundwork for an actual power management system I'll need to write eventually for my orbital spacecraft.

@cake>pie a like for your effort but as I said not interested in dealing with RealBattery even to just hack in some of its features.

Share this post


Link to post
Share on other sites

@Drew Kerman You misunderstood. I know you didn't want Real Battery. What I've provided does not require RealBattery, it is a standalone alternative.

The MM cfg file above turns the Z-100 into a non-rechargeable battery, as a sample proof of concept that can be reapplied to other parts. Besides being non-rechargeable, it is also constrained by a maximum power draw of 0.5EC/s.

Share this post


Link to post
Share on other sites
5 minutes ago, cake>pie said:

@Drew Kerman You misunderstood. I know you didn't want Real Battery. What I've provided does not require RealBattery, it is a standalone alternative.

The MM cfg file above turns the Z-100 into a non-rechargeable battery, as a sample proof of concept that can be reapplied to other parts. Besides being non-rechargeable, it is also constrained by a maximum power draw of 0.5EC/s.

I did indeed misunderstand. Loading it up now to check it out

Share this post


Link to post
Share on other sites

@cake>pie great stuff, seems to do what I was asking for. Some questions tho after playing around with it:

1) Do the batteries really still need an EC resource? I disabled it in the editor and that didn't seem to harm anything so I removed it with the MM patch (!RESOURCE[ElectricCharge] {}) and things seem to work fine?

2) Why did you think I wouldn't want them activated at the start? They're useless otherwise - as far as I can see they need to be active to do anything

Share this post


Link to post
Share on other sites

Keep in mind this was a quick and dirty thing I tossed together in a jiffy to see if it fits what you're looking for.

1)

This provides a bare minimum buffer, in case there isn't actually any/enough other EC storage on the craft. I'm not actually sure this is strictly necessary, so you can remove if it seems to work fine for you.

2)

If left on, EC(NR) will be drained in order to charge other EC storage whenever there is empty EC capacity somewhere, regardless of other EC production.
I'm fairly certain you'd rather use any available generator/alternator for charging EC than drain the Nonrechargeable Battery, if given the choice.
That is why I left it on manual activation.

If automatic activation is desired, it should be possible to write a lightweight plugin that checks:

  • vessel total EC production < vessel total EC consumption
  • vessel total EC available < some threshold

and only connect the Nonrechargeable Battery to the rest of the vessel's circuits when those conditions are met.

On the other hand If you do indeed want it to be "on" all the time and not toggleable AlwaysActive = true would be better than IsActivated = true

Edited by cake>pie
derp

Share this post


Link to post
Share on other sites
5 minutes ago, cake>pie said:

If left on, EC(NR) will be drained in order to charge other EC storage whenever there is empty EC capacity somewhere, regardless of other EC production.
I'm fairly certain you'd rather use any available generator/alternator for charging EC than drain the Nonrechargeable Battery, if given the choice.
That is why I left it on manual activation.

If automatic activation is desired, it should be possible to write a lightweight plugin that checks:

  • vessel total EC production < vessel total EC consumption
  • vessel total EC available < some threshold

and only connect the Nonrechargeable Battery to the rest of the vessel's circuits when those conditions are met.

That makes sense, but not applicable for me. Did you mean AlwaysActive = true?

I will let you know if I come across any issues actually using this beyond simple testing but seems to be a solid method!

Share this post


Link to post
Share on other sites
Just now, Drew Kerman said:

That makes sense, but not applicable for me. Did you mean AlwaysActive = true?

derp. fixed.

Share this post


Link to post
Share on other sites

Thanks @cake>pie I'm going to be testing to see if this 'quick fix' can be used to resolve my 'one-shot' electricity consumption issue on the REKT cryopods.

Share this post


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

I've not checked this, but wouldn't this work?


@PART[batteryBank}
{
	@RESOURCE[ElectricCharge]
	{
		@maxAmount = 0
	}
}

I can't check it at the moment, I'm working :(

This does indeed provide 100EC (not modified) with no ability to recharge (maxAmount=0) but it has the side effect of making the part have no right-click part action window.
This means that you won't be able to
- toggle whether the craft can draw resources from the part or not
- specify the part as the source of a resource transfer [or destination, but we don't care about that]

Not sure if there might be other unexpected side effects.

Share this post


Link to post
Share on other sites

Change the max 

5 minutes ago, cake>pie said:

This does indeed provide 100EC (not modified) with no ability to recharge (maxAmount=0) but it has the side effect of making the part have no right-click part action window.
This means that you won't be able to
- toggle whether the craft can draw resources from the part or not
- specify the part as the source of a resource transfer [or destination, but we don't care about that]

Not sure if there might be other unexpected side effects.

Ah change the max amount to a small number 0.0001 perhaps?

Share this post


Link to post
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.