Space Engineers

Space Engineers

79 ratings
Freya Battery Management
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
12.687 KB
6 Dec, 2015 @ 1:59pm
17 Mar, 2016 @ 5:17pm
7 Change Notes ( view )

Subscribe to download
Freya Battery Management

Description
This is obsolete, but fortunately Deeganator has take up the task of updating it! See if you like his version: http://steamproxy.net/sharedfiles/filedetails/?id=911384087

EDIT: This program is getting pretty old and creaky. Keen has changed a lot of things.

Intended to work with the Powerfix mod, may result in blackouts if you are using default power ordering!

Powerfix mod: http://steamproxy.net/sharedfiles/filedetails/?id=570484985

This is a simple script that turns your batteries to recharge during the day, and discharge at night. With the powerfix mod in place, this will not result in blackouts and doesn't require any supplimentary power (such as reactors). It avoids the "neutral battery" issues you may have had.

This MAY work in dedicated servers due to 2/11/16's patch. Unverified.

To use:
Create a programming block. Put this script inside.
Create a timer block. Point it at itself and the programming block, and set it to run every second.
Trigger the timer block.

To display output:
Create a display named "Freya Display" (caps matter).
If the time on the display constantly updates, you're doing it right!

Vehicles:
Do not put Freya on vehicles. Put her on the base, she can automatically charge/discharge vehicles as they dock/undock.

If you have batteries on vehicles, put the word "Vehicle" in their name somewhere. Freya will charge them, and only switch them to discharge when you disconnect the vehicle. You may also name solar panels in the same way, and Freya will consider them not part of the station's power grid.

Best practice is to name each vehicle battery completely uniquely, because the only way Freya can detect disconnections is by name. So if you print 3 of the same vehicle with 2 batteries each, there should be 6 unique battery names with "Vehicle" in them.

Note:
To detect daytime, Freya simply checks to see if at least 50% of the panels have a max output of 10 kW. If you are using modded panels or are otherwise receiving only a tiny portion of light, this can be modified easily: it's a variable near the top.

Recommendations:
Check ownership. The programmable block should have the same owner as all your other blocks. There is currently a bug in Space Engineers which causes programmable blocks to freak out if there's different owners for various blocks on the grid, even if they aren't targeted by the programmable block.

Turn off reactors. They will attempt to charge batteries, which is a waste of uranium.

Remember that batteries have a 20% power tax, meaning that charging a battery with a battery, or with uranium, is not a good idea. You just waste 20% of the power.

You can output to multiple displays if you go into the script and edit the display variable. It's near the top, super easy to see.

Debug:
If you still have brownouts, change the code so that the line "double solarThreshold = 10;" uses a higher number, like 50. This will lower your efficiency, but should reduce the brownouts. This should only be required if you're running the ragged edge of not having enough solar power.

This probably won't work on a dedicated server, since the dedicated server does not calculate shadows.

This only works in English, at least until the devs surface more variables.

If you are getting an exception, please tell me your setup. This is a known level load order bug, and I'm trying to work around it, but apparently it sometimes fails. If it happens, hit "edit" and "remember & exit" without changing anything. This will reload the system and it will work fine.

If Freya thinks it is always day, even at night, you are probably experiencing a known bug I call "midnight sun". The server can think solar panels are getting sun even when each client knows they are not. I don't know how to fix this, although the threshold update may have helped.
Popular Discussions View All (3)
16
23 Jan, 2016 @ 5:28pm
Vehicle Management
Descryant
15
21 Dec, 2015 @ 6:19pm
Doesn't work on server? Don't blame the script!
Skippy The Magnificent
1
4 Feb, 2016 @ 12:44pm
Connectors?
JustSteve
264 Comments
Saki 26 Apr, 2017 @ 9:05pm 
indeed freya is awsome would be an inprovment
Vex 24 Apr, 2017 @ 7:20pm 
Its not that, im just a firm believer of crediting the original author.
Craig P  [author] 24 Apr, 2017 @ 6:04pm 
That's fine, you don't have to bend over backwards for me!
Vex 24 Apr, 2017 @ 6:03pm 
Im also going to be getting a video Explaination and Photos uploaded shortly to assist others on set up, additionally giving you credit in the video.
Vex 24 Apr, 2017 @ 6:02pm 
Apologies i must of misread that beforehand i swore i checked that, but ill defenately update that tonight.
Craig P  [author] 24 Apr, 2017 @ 4:59pm 
Just look at the top of the page. "Updated Mar 17, 2016"
Vex 24 Apr, 2017 @ 4:26pm 
Apologies it looked like it was discounted as of roughly then i saw no other Comments around that time. Can you give me an estimated date? Ill fix that tonight after work.
Craig P  [author] 24 Apr, 2017 @ 12:27pm 
(Only problem I have with your summary is that you say I discontinued this a month after starting it, which is simply incorrect.)
Craig P  [author] 24 Apr, 2017 @ 12:26pm 
Great, I put a link in the description!
Vex 24 Apr, 2017 @ 10:13am 
In this Script Fix, I had to Temporarily Remove Vehicle Function, but in Promises that it will be readded, due to Error Reports working on Fixing it.