Space Engineers

Space Engineers

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

Subscribe to download
Advanced Power Management

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
72 Comments
The Oracle Jul 10, 2021 @ 8:59am 
So there is no indication that the script is running. I am new to scripts and using them. I put it in a programable block and put a timer to it. It triggers but it does not look like its doing anything.
Kevin Starwaster Jan 26, 2021 @ 4:37pm 
I get sometimes you want to use batteries to charge other batteries, especially if you want to shorten the time it takes to recharge.

But you lose energy in the process because there is a penalty when a battery is charged.

To give you an example, take two large grid batteries: Each one has 900 kW hours for a combined 1.8 MW hours. However, if you transfer all of one battery into the other (set one to recharge; the other to discharge) you end up with only 1.6 MW hours. Reverse them so that all the energy flows back into the first battery and you get 1.3 MW hours. That's a pretty substantial loss.
Dragonhost Dec 19, 2019 @ 11:08pm 
That would be realy nice, if you could do that :)
nictheman123 Dec 14, 2019 @ 10:25am 
I never did finish getting the turbines working, I am not familiar with how the scripting works and how I would go about finding them. I do have a version that was working last I checked, but it has been several months since I've even opened SE. If you want I can send you a copy of the script in the latest form I have (I use Notepad++ for most of my coding, I am a CS student and they don't allow us to use IDEs very often) so that's up to you
Fozz  [author] Dec 13, 2019 @ 10:38am 
Would love to see what you come up with Nic, mine was using an existing script with some minor changes to get it functional. As a professional software engineer I struggle with in-game scripting as an IDE and havent gotten a good workspace outside of the game yet which is a big limiter for me
Dragonhost Sep 5, 2019 @ 5:37am 
@nictheman123 , where you able to finish your rework? I'm rally interested to see you version.
nictheman123 Mar 30, 2019 @ 1:50am 
Okay, since I never got a response from Fozz and I found myself bored this week, I have decided to take on refactoring this code myself. It was quite a mess format wise, but I have cleaned that up and am now working on reducing redundancy while keeping the script working. I am also adding the ability to keep batteries outside the system using tags in the block names, which I believe to be working.

After I have all of that, I will try and add turbine support, and then reupload the full thing to the workshop myself, with credit to all the relevant scripters of course.

I'm currently abroad and my thoughts are bouncing between about 12 different things at any given time, so it might take a while, but it is in the works now. Anyone with questions or anyone with coding experience who wants to help, shoot me a dm.
Scruffy Mar 18, 2019 @ 4:05am 
Does this support turbines? need turbine suport, can i add it?
jackik Aug 10, 2018 @ 3:36pm 
If there is no response, could you upload your version of it yourself?
nictheman123 Mar 23, 2018 @ 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.