Space Engineers

Space Engineers

Advanced Power Management
72 条留言
Luminus 2021 年 7 月 10 日 上午 8:59 
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 2021 年 1 月 26 日 下午 4:37 
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 2019 年 12 月 19 日 下午 11:08 
That would be realy nice, if you could do that :)
nictheman123 2019 年 12 月 14 日 上午 10:25 
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  [作者] 2019 年 12 月 13 日 上午 10:38 
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 2019 年 9 月 5 日 上午 5:37 
@nictheman123 , where you able to finish your rework? I'm rally interested to see you version.
nictheman123 2019 年 3 月 30 日 上午 1:50 
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 2019 年 3 月 18 日 上午 4:05 
Does this support turbines? need turbine suport, can i add it?
jackik 2018 年 8 月 10 日 下午 3:36 
If there is no response, could you upload your version of it yourself?
nictheman123 2018 年 3 月 23 日 下午 7:20 
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 2018 年 3 月 23 日 下午 1:28 
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
Cmdr. DoomForge™ 2017 年 12 月 22 日 上午 1:18 
does this also work with quantum solar panels too?
Svetressito 2017 年 12 月 21 日 下午 8:15 
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  [作者] 2017 年 12 月 7 日 上午 10:43 
thanks for the feedback, I love the concept, would the names of the blocks just include the [Exempt] tag or similar?
Xenith 2017 年 11 月 24 日 上午 2:31 
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 2017 年 11 月 21 日 上午 8:45 
i agree with absolain, if there was a way to manage non-vital systems that would be a great help.
absolain 2017 年 11 月 2 日 上午 10:59 
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 2017 年 10 月 14 日 下午 9:26 
/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
Pounce 2017 年 10 月 14 日 下午 9:26 
the welding flea is docked via connector inside my ship and power managment uses its battery like the ship ones. (drain if heavy workload like assemblers) so an tag for the battery to be ignored by the manager (keep it on loading always like i switch it to while docked) would be perfect. Also i like to keep a few ship batteries always loaded to have an emergenxy pool, so if i could tag them to be "manual" or only on drain if switched so/toggled by an other script qould be helpfull.
Fozz  [作者] 2017 年 10 月 14 日 上午 8:11 
Could you provide a more detailed use case for this? Im not sure I understand the specific issue. Is this when docked?
Pounce 2017 年 10 月 13 日 上午 3:58 
It is a very lovely script but.. is there an way to keep special batteries ALWAYS on load?
My welding flea has ONE battery and it is kinda ackward if it is not charged fully and i have to switch off powermanagment and wait for it to full load (or forget to check and explore new frontiers in an mini ship, as said, ackward)
Merlin 2017 年 9 月 22 日 上午 10:50 
You have my thumb and favorite
Merlin 2017 年 9 月 22 日 上午 10:49 
Oh Im sorry i misread the description. thanks!
Fozz  [作者] 2017 年 9 月 22 日 上午 9:02 
Nick: Thats how its intended to work, if it's not doing that I'll take a look and try and replicate :P
Merlin 2017 年 9 月 20 日 下午 2:38 
This is a great program! Good work. Can you make this program so that the grid will only use reactors if the solar+batteries cannot power everything, but the reactors wont charge the batteries so you don't waste uranium. this would be very useful for a base that only gets sun sometimes and has rectors as a backup but would prefer to stay renewable and not have reactors charge batteries as they are only 80% efficient. Ive subbed to the thread so reply if this is unclear.:steamhappy: If you know of a program that does what I am looking for please direct me to it.
Fozz  [作者] 2017 年 4 月 16 日 上午 10:14 
I just updated this script, I think its working now, there were some breaking changes around charge/discharge controls I finally fixed.

As far as the size limit I'll have to look into that, it'll probably need to be re-written to pull chunks of batteries at a time. Try with the latest version and let me know if the changes optimized the complexity at all
Fozz  [作者] 2017 年 4 月 3 日 下午 12:51 
This is super outdated, if you subscibe you'll probably get notified when I finally get round to fixing it :P
Cpt.NoKills 2017 年 1 月 14 日 上午 1:45 
Is there any working script available for battery management at this date? I tried a lot but all are outdated and give errors
Ngangalaro 2017 年 1 月 13 日 下午 3:19 
I have been experiencing "Script Too Complex" error, which in creative mode it seems to be a situation of having more than 300 or so batteries. I'm guessing it is an array size limit? I haven't tried this script in survival mode yet, and can't comment about the potential issue with it.
Vorg 2016 年 12 月 22 日 下午 10:18 
Script is now broken. Needs to be updated for API :(
aaueer 2016 年 6 月 12 日 上午 5:12 
Is this going to get updated?
Fozz  [作者] 2016 年 5 月 8 日 下午 5:02 
I think its still valid though, I think its on GH if anyone wants to play round with it. It just need to be reworked
Fozz  [作者] 2016 年 5 月 8 日 下午 5:02 
Its kinda out of date, needs to be revamped based on cost rules and some of the new settings
NarrowAscent 2016 年 5 月 5 日 下午 11:14 
Is this script still valid? Have a station I want to reduce uranium use on but saw your comment saying it was redundant
jarhead 2015 年 12 月 12 日 下午 2:42 
its not a bug its a game limitation thats supposed to be there.
if your charging batteries your supposed to lose 20-30% of the total power.
has to due with efficency
Engi 2015 年 12 月 11 日 下午 12:33 
You are very welcome.
Fozz  [作者] 2015 年 12 月 11 日 下午 12:08 
This script needs to be reworked anyway, since the recent updates around mass recharging, I'll have to take a look at this when I have time, thanks!
Engi 2015 年 12 月 11 日 上午 11:22 
I checked it my self months ago. I charged a battery in creative to full on a station block with nothing else, gave myself the materials to build a second battery. Went into survival. Built that second battery next to the fully charged battery and let the charged one charge the new one. This was before the 30% energy when you build a battery with battery scrap. At the end when they equalize. The two capacities added together was 20% less than when the first one was fully charged.
Engi 2015 年 12 月 11 日 上午 11:17 
No, it has always been. Any time a battery recieves power, from no matter what source it only gets 80% of it. It's in the code. When its solar, doesn't matter because its free. But from reactors and batteries, you are lossing power.
Fozz  [作者] 2015 年 12 月 11 日 上午 9:16 
I was not aware of that, was that a recent change? I'll have to revisit this script and avoid using batteries to charge if that's the case
Engi 2015 年 12 月 10 日 下午 8:14 
fozz, If I'm reading all this correctly, you are using batteries with more charge to charge batteries with less charge along with solar to charge them all. Is this correct? But what about the 20% loss of power when charging a battery with another battery? In this case it will take longer to charge up all your batteries. Please correct me if I'm wrong about how your system charges.
Fozz  [作者] 2015 年 10 月 23 日 上午 5:59 
Im please to announce that as of the latest update of Space Engineers this script is redundant! See the release video from Oct 22 2015 for more info
jarhead 2015 年 7 月 26 日 下午 7:48 
can you mke another version of this that can use group names so it can work with a multi level power system?
a_hobo_with_a_stick 2015 年 5 月 20 日 上午 12:08 
Looking in my main build, it was working fine. I deliberately deleted the block, placed a new one, set that up, there was something wrong with that map/game. But yeah, it's odd as other scripts worked in that map but not this script...
Fozz  [作者] 2015 年 5 月 19 日 上午 6:22 
Hmmm, I wonder if there is an upper complexity limit imposed by the script runner. I'll test with a similar setup :P.

I think it's currently batching as much as it can, I may be able to make it less efficient in order for it to scale better.
a_hobo_with_a_stick 2015 年 5 月 18 日 下午 6:57 
I had around 100 Solar panels and 60 batteries. This was on a new map I was using for combat testing, I was messing about making a solar and battery powered hauler. I then thought it might be due to the lack of reactors, so I added one Azimuth's fusion reactor, stopped the timer, loaded another script, told it to remember, then switched it back, started the timer and the same thing... T_T What I'll do is check my main (Creative) map to see if that has the same problem (has a whole much of reactors and batteries. Also I compiled it around 5 times and it came back as complete. I'm stumped, it's probably the game derping as your script should work perfectly.
Fozz  [作者] 2015 年 5 月 18 日 上午 6:33 
Thats news to me, usually that happens when the script tries to execute too many similar steps at once. Try adding more batteries or solar panels. It could be a bad logic loop
a_hobo_with_a_stick 2015 年 5 月 18 日 上午 5:13 
Might have missed what the fix is, but it keeps saying it is too complex and stops the script :/
Fozz  [作者] 2015 年 5 月 17 日 下午 1:39 
I'll have to test that case in non-creative. Generally battery power is much greater than solar, so sometimes it'll need the extra bump from a battery to get going, otherwise you'd need enough solar to provide for one batter to charge PLUS running all other components. +1 for charging one battery off of reactor, even for just a minute or two, to get the entire available power to be solar + one battery
Mihara 2015 年 5 月 16 日 上午 10:04 
@Visentinel, I've noticed that the script typically does nothing when all the batteries are freshly constructed and empty. Set one to recharge, and it will take over and start working.