Space Engineers

Space Engineers

Not enough ratings
Simple Battery Management
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
359.905 KB
3 Jan, 2015 @ 2:32pm
4 Jan, 2015 @ 5:36am
6 Change Notes ( view )

Subscribe to download
Simple Battery Management

Description
The Script aims to use Batteries as an energy backup, and enable them if the usage of the ship/station exceeds the power installed in reactor and solar panels. So the batteries will try to cover always the peak power demands of your ship.

It enables the batteries to discharge only when you have a peak demand of power. Meaning the batteries act as a backup to cover any extra power needs you may have that cannot be fullfilled by either solar panels or reactors.

In the same manner the batteries will only be charged when the reactor and solar panels are not at full capacity and they have excess energy to spare.

Tested using a timer set to 3 second with good result, needs to be iterated using a timer. As for now 1 second is too short for it to work, 2 seconds work sometimes but flickers a bit.

Please keep in mind enough power to run the Timer Block and the Programmable block is required for this script to function.

Script does not count unfinished reactors (tested) or reactors being hacked (tested) when calculating current max power grid.

ISSUE:
Currently there are some issues with things not activating cause not enough power, and power drain not put on reactors... so according to the script there is enough power, when in reality there is not.

Main way used to combat this is by randomly toggling off charging on batteries to see if things improve. If it does, then all batteries gonna stop recharging next turn. This behaviour can be turned off by commenting one line in Main. Second way is to modifying the parameters. Parameters can be found in Main (bottom of script), default values will not modify any thing.

The script does not check if there is uranium in the reactor. It's a bit tricky to solve cause in creative mode reactors doesn't need uranium. For now, make sure reactors without uranium are disabled when playing in survival.


If you're having issues with the script, or just suggestions/ideas, please let me know. /Stiggan
44 Comments
stiggan  [author] 24 Sep, 2020 @ 12:12pm 
I haven't played the game for a long time. In 2016 it worked with the game. What error do you receive?
Merlin 7 Sep, 2020 @ 6:50pm 
Is there a place where the versions of the game this works with is written?
stiggan  [author] 18 Feb, 2020 @ 1:59pm 
I apparently do.
Merlin 2 Jan, 2020 @ 12:49pm 
Who's listening to this in 2020?
Grifka 28 Jan, 2016 @ 5:16pm 
@stiggan, many thanks will be looking forward to the update :)
stiggan  [author] 28 Jan, 2016 @ 4:19pm 
@Grifka Per previous request I'm already looking in to having a filter option to choose which batteries the script will operate on. I've however had a lot to do lately so it's delayed, but there is a planned update on the script to add this.
Grifka 28 Jan, 2016 @ 9:23am 
@stiggan thanks for this script it works really well and delivers exactly what i need for my base.

I do however have a suggestion/request.

Currently my base has Solar Panels and batteries, the idea is the solar panels are the primary source of power during the day and the batteries are the source for the night cycles. My small ships (e.g miner, exploration, scout) are all battery powered and currently when my ships are parked (via connector) i want them to recharge their batteries when not being used. However this scipt doesn't see the two as seperate entities and so, i find that the batteries (on ships) are being depleted. And therefore are out of power when i need them.

Is there a way the script could be updated to exclude batteries that are on different ships? maybe by giving them a tag in the name which could identify which batteries are supposed to be controlled by the script? Or maybe add a tag search for batteries that i want the script to control?
Keyboard Wario 16 Jan, 2016 @ 2:43pm 
@expressocoffee you tell the timer to start after 3 seconds, and put timer into the setup actions of the timer at the end, to start it again.
lyzer 7 Jan, 2016 @ 4:27am 
The problem with the game is if you have batteries and solar panels it takes the electricity to run your base from your batteries instead of taking it from the solars (they have 0 output) so your script works perfectly for me. Since i have the windmill mod which are counted as reactors your script is even more fitting for me so it takes the solar, reactor (windwill) power first and then loads batteries or just uses them as backup. The problem is when i connect ships for example it manges their batteries to.
stiggan  [author] 6 Jan, 2016 @ 5:04pm 
This shouldn't be too hard to make, so I guess I could take a look at it. I haven't played the game for some months now, but from what I read from update logs this script seem obsolete these days? But sure, if you really want to I could take a look at it.