Installer Steam
log på
|
sprog
简体中文 (forenklet kinesisk)
繁體中文 (traditionelt kinesisk)
日本語 (japansk)
한국어 (koreansk)
ไทย (thai)
Български (bulgarsk)
Čeština (tjekkisk)
Deutsch (tysk)
English (engelsk)
Español – España (spansk – Spanien)
Español – Latinoamérica (spansk – Latinamerika)
Ελληνικά (græsk)
Français (fransk)
Italiano (italiensk)
Bahasa indonesia (indonesisk)
Magyar (ungarsk)
Nederlands (hollandsk)
Norsk
Polski (polsk)
Português (portugisisk – Portugal)
Português – Brasil (portugisisk – Brasilien)
Română (rumænsk)
Русский (russisk)
Suomi (finsk)
Svenska (svensk)
Türkçe (tyrkisk)
Tiếng Việt (Vietnamesisk)
Українська (ukrainsk)
Rapporter et oversættelsesproblem
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?
Any larger refresh on timer will work just fine, reason you can't keep a too short value is so changes has a chance to propagate properly and values changing before reading them again. Longer values are fine, it will just make the script take longer to react to changes in power load. I recomend as short value as possible.
I agree margin isn't a good name for this variable, it should be multiplier or similar. Margin just just multiply the total max power. You might want to lower it to say 0.95f, then it's same as making it 5% smaller than it actually is.
Offset is if you instead want to change it by a certain amount instead of a percentage. Offset value is added to the max power value.
Look at line 130 and line 131 and it should be quite clear. When doing a [variable] += [value]; it will add the value to the value in the variable.
In order for batteries to kick in earlier Offset should be a negative value, or margin should be a value smaller than 1.
And I don't understand either of your comments in the Main() part of the code that seem to be adjustable entries for the two variables (offset and margin). Can you explain in more detail?
is it possible to have a video tutorial?
I'm not sure why it's not working for you. For me batteries stayed on charge until the load was too high, then it would switch batteries on to accomodate for the extra load. I used a large thruster to create the load.
This rig had a reactor, but it shouldn't matter.
Did you try to run the script or switch the batteries to charging manually? Perhaps I can take a look at your rig to see if I can find the problem?
I'll take a look and see what I can find out.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=371384476
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=301049181
so the script is not compatible with the mods?
I can see why that would happen... Ah well, I might need to start learning C# then >.< Or whatever is used...
But thanks for the example of your large carrier XD
However as I remember the titan engine is quite a drainer, I suspect it to be easier and quite a space saver to use some large reactors instead of lots of batteries. But I might be wrong, I haven't done the calculation. I anyway like the design of using reactors just for continues power and batteries for power burst, hence why the script works like this.
@matthias22101987 I hope you can get back with some more information, when we made this script the goal was to make a small script which did one thing, and did it well. If it doesn't work with certain mods, perhaps there is a issue with parsing, and I'd like to solve such issues.
Buuuut I kinda love this script https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=372496767&searchtext=script+battery more. Is your script with that one compatible?
2 seconds is flimsy at best, 3 seconds worked for me so far. Issue is that it takes some time for details to update, and in this case if details update to show grid getting power from 1 battery, but an other battery hasn't updated being on charge yet. If this happends then it will see the drain as a real drain, and turn everything on, just to realise it's a false alarm and turn it off again. This can't really be solved in script but is limited by game mechanics I think.
There always gonna be a delay on the batteries with this script, so if it doesn't work for you, I hope you'll find a better solution. Scripting wont solve it unless we can make event based scripting.
Thanks about code! Myself I think it's far from perfect, but I've tried to write it clean and easy to understand. The script shouldn't be too hard for someone with a little programming skill to modify if for example want batteries and solar to cover reactor usage instead.
Hi and thnx for the feedback, can you tell us a bit more in detail how u setup the script to run. The timer more specifically?
If you look at how battery power is calculated, the script doesn't count power drained from charging batteries, script doesn't care if charging batteries overload the grid. Try it with a longer delay between runs, perhaps 5 seconds, cause what you experienced sounds like the script is run again before all details on the blocks has updated.
You wont loose charge, cause the power used to discharge one battery for a few seconds is used to charge the rest. So it simply redistribute power between batteries, and with 50 batteries it pretty much just gonna even out how much power is stored in each. There is a "toggleRandomBattery(2);" in Main(), I would set it to like 200 instead of 2, perhaps more even.
Generaly, if the script turns on and off and on and off charging on all batteries, when charging should be on, then you most likely have a too short delay between runs. With 250 batteries, and some solar panels, you most likely need a longer delay than 3 seconds.
I installed it on my station with 50 batteries and 200 capacitors and 1.2MW worth solar panels, the result was that it would set all batteries to charge, causing the script to think the power was overloaded and set all the batteries to discharge, and then back on as it realizes there's plenty power to recharge some batteries, etc.
Also if 50 batteries are charging and you randomly turn on one capacitor, it'll drain in a matter of seconds, and if you do that with a lot of capacitors at random they will eventually all be drained.
Tl;dr the result of your script was that all my batteries were eventually empty and I couldn't run my assemblers and refineries anymore for 10 minutes ;) I think it may work for small ship scenarios with more reactors and less batteries, but for solar-powered stations not so much.
An easy way to see this is by turning off completly the batteries, if the base is not overloading anymore means that the fake oveload you experience is because of the batteries charging.
The overload you exprience during battery charging is not completly true as the batteries will only receive the energy that is left after all your other power loads will be satisfied.
The game instead of calculating the real power that the batteries are receiving, it calculates the maximum amount of power they can receive when they give you the percentage on your HUD, so pls ignore that message when the batteries are charging.
When a REAL oveload will happen then the batteries will kick in as they should!
Perhaps change the 2 to 4 the lessen the chance of having 2 batteries turned on at the same time. 2 means the chance is 4/6 to turn on a batteryeach turn, while 4 would mean 4/8 (50%).
Please get back to me about your findings, if this or the timer solves it for you, or if it doesn't.
Issue is the difference on the actual power grid and what game tells you. Game tells you how much overloaded you are in order to run everything. This is not what it looks like to the script.
Gravity gen starts, but there is not enough power to turn it on, so it stay off. This means there is no power drain from the gravity gen, since it stay off. This issue I've had lots of trouble solving, and the current solution isn't very pretty (or good), but it should work even tho it might take some time to kick in.
Try setting timer to longer. If this doesn't work, I can try to take a look at your base to see if I can find the error.
It works with multiple batteries.
It does not take into account the whether the batteries are full or not.
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.
It works also if u have no reactors.
and does it work with multiple batterys?
May that be because of damage to reactors and solar panels or increased loads you may have such as overload due to multiple thrusters being used in conjuction with assembler and refinery.
Nice clean code.