Space Engineers

Space Engineers

Not enough ratings
Advanced Power Management
 
Rate  
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
0.002 MB
Apr 21, 2015 @ 4:05pm
Apr 16, 2017 @ 10:12am
6 Change Notes ( view )

Subscribe to download
Advanced Power Management

Subscribed
Unsubscribe
Description
Advanced Power Management script. This uses excess solar and battery power to charge the batteries with the lowest charge on the ship or station. By charging all batteries in parallel you maximise your power throughput. Semi-Auto and random charging scripts do not achieve this.

How the script works:

1) All full batteries are set to discharge
2) The reactor is checked to determine if power is being drawn from it, if so, switch the recharging battery with the highest charge to discharge, repeat until all batteries are discharging, or the reactor is no longer draining
3) The available power output from the solar panels and batteries not recharging are checked, and if the system can tollerate another battery charging without drawing power from the reactor, the battery with the lowest charge is charged. This is repeated until all batteries are charging/charged, or there is no power surplus available.

This cycle is repeated once per block run, so be sure to put the block on a repeat timer, the faster the time, the faster the system will react to power changes.

This script is based off of the power management script by Stiggan and Malakeh, available here: http://steamcommunity.com/sharedfiles/filedetails/?id=368765260, however works drasticly differently.

How to use the script:

1) Add a programming block to your station or large ship
2) Load this script from the workshop
3) Add a timer block with a suitable delay
4) Configure timer block to trigger the programming block, and then itself

That's it, this script will work for any number of panels, reactors, or batteries, on any ship/station size, and across connected grids. This means you can dock a ship, and use the power manager on a station to initiate charging automatically, in either direction.

Verified to work with these mods:

miniBattery by entspeak
Accumulators by Darth Biomech
VonCeed Solar Panelby VonCeed
Advanced Batteries by SpaceNet Engie
http://steamcommunity.com/sharedfiles/filedetails/?id=380067603
< >
64 Comments
jackik1410 [V-WG] Aug 10 @ 3:36pm 
If there is no response, could you upload your version of it yourself?
nictheman123 Mar 23 @ 7:20pm 
UPDATE: I ended up having that solution break just now and had to add that line to a few other places in the code as well. Fozz, if you want, send me a message and I will give you my latest copy of the code and explain what I've done to it.
nictheman123 Mar 23 @ 1:28pm 
If you want to exempt certain batteries, go to line 114 of the script, add a new line and paste this:

batteries.RemoveAll(battery => battery.CustomName.Contains("[YOUR_TAG_HERE]"));

And then just change the tag to whatever you want to set your exemption tag to. Just tested and I had two batteries with this tag that were higher power but completely ignored by the script. That took me way too long to work out. Love the script btw, once I find out which asteroids have what in my SP world so I can reliably gather mats it will be really handy
Sgt. Forge™ Dec 22, 2017 @ 1:18am 
does this also work with quantum solar panels too?
Diabase Dec 21, 2017 @ 8:15pm 
First, love your script! It makes gameplay a lot more relaxed not having to wory about power all the time :)

Second, it would be nice if you implemented the new self updating code to this script just to get rid of that timer and make things a little bit more stable on servers.

heres a short version of the code if you don't know it already:

public Program()
{
Runtime.UpdateFrequency = UpdateFrequency.Update10;
}

It will make the program update itself every 10th tick,
i did put it in there myself but i do think that others would apreciate it as well.

Thanks for the script and piece of mind <3
Fozz  [author] Dec 7, 2017 @ 10:43am 
thanks for the feedback, I love the concept, would the names of the blocks just include the [Exempt] tag or similar?
Xenith Nov 24, 2017 @ 2:31am 
I gotta agree with @pounce

No idea if this is going to be harmful, but it'd be nice if there was a way to keep charge from bouncing around among batteries like crazy.
TM33z Nov 21, 2017 @ 8:45am 
i agree with absolain, if there was a way to manage non-vital systems that would be a great help.
absolain Nov 2, 2017 @ 10:59am 
Hey Fozz,

I think this is the closest thing to a power management script that I remember using several months ago. I was thinking of making some modifications to it as well.

Specifically, to allow turning off of non-vital systems. I'm just thinking through it now, but tagging systems to describe at what battery level they should run. Like Refinery [p80], Assembler [p60], solar rotors [p0], doors [p0], programmable blocks [p0].

Also, to prioritize some batteries over others, to maintain a quota type system for battery charges (Battery [p90] would charge that battery to fully before allowing other systems to activate and drain charge), addressing pounce's issue.

Just thinking out loud here.
pounce Oct 14, 2017 @ 9:26pm 
/2

Basically i think just an tag [Exempt] or so that makes Power managment not touch theese batteries.

I have plenty solar power on my station and plenty of batteries (booth in the 150 mwh range) but power managment still drains/loads batteries all the time even if solar power way outperforms needs (while batteries should be at 100% loaded because power from solar > need. Not sure what the issue is.

So it is on an constant drain/load cycle when not needed (batteries are at 99.9 full and it drains some and loads some and switches all the time while solar power outperforms need by a large margin for long time.)

It feels as if the script has to drain some batteries even while not needed