Space Engineers

Space Engineers

Freya Battery Management
Doesn't work on server? Don't blame the script!
I have done some testing with this script on my server, on a planet, and have come to the conclusion that there is some sort of communication error between the client/server in reguards to the day/night cycle (at least with planets, not sure about non-planet game modes).

EXAMPLE: create a grid (base) with a couple of batteries, timer block, programming block, a light and a single solar panel. put the script in the programming block, set up the timer and run the timer. At first, it seems everything is running fine, but after some time oddities begin. After a while at night, solar panel will show output of 0 (current and max), freya will have a threashold all the way up to 100 even, and freya will still trying to run in day mode, even though freya herself reports 0% from the solar panel....but this is inconsistant.

There are times where she will refuse to run properly unless you have the threshold set all the way upto 100+, and being solars only put out 120 max, this high of a setting is almost useless...but wait, there are times when the default setting of 10 will work just fine? And, not to mention, there are times when the setting just doesnt seem to matter at all. I have seen it where a single solar, with a setting of 100, the solar panel outputting 118, during the day, freya also reports this in the LCD screen (something like 95%, but then, all of a sudden, she flips over to night mode...because the solar lost all power, and it is pointing directly at the sun, showing 4 green dots on it, but in the control panel, max power is ticking down and current power shows 0...W.T.F.

In short, there is something really funky going on with the netcode on how the sun/solars comunicate their info between client/server...it is almost like there is a sync issue between them, even though during my testing both simulation speed AND server speed were both at 1.0.

TL:DR - script aint working? Its not the script, its the server software. The only one that can fix this is keen.
< >
Näytetään 1-15 / 15 kommentista
Craig P  [kehittäjä] 9.12.2015 klo 20.26 
The standalone server application probably doesn't calculate LOS on light, it'd be expensive. So on the server (where you can't see), the panels probably count as if there were no planets or blocks or shadows or anything.

Can't do much about it, I'm afraid.
Nope. But, I am not 100% sure it is a LOS issue (but, it could play a HUGE part of it), because there were brief moments when it would work just fine, with a threshold of 10, on my server, and then there are times where it would just derp right out.

It almost seems like the sun position is correct between client/server (hence why solars work properly *most* of the time), but when it comes down to capturing the raw data in a script to manipulate it (like these types of scripts for example), there is either raw information being passed on, or just the oppasite, being omitted, when trying to gab it in this method, something is lost, or additional carbage is added to it, throwing off the script.

Not sure how to fully explain it, best way is like this...when the solar panels are working by themselves, the power info is working properly, but as soon as something interferes with that flow of data (a script trying to read that info for example), its almost like the balance of that flow of data is disrupted, causing havoc with trying to utilize that data.

That would also explain why scripts that try to calculate the best position based off of power from the solar derp out on servers (like the stop at max power script), where ones that are item based (like Midspace's Experimental Solar Tracker) that use its own block to track the sun work just fine.


I dunno, maybe im just talking out of my arse...but the bottom line is still true...this is an issue only keen can fix.

Edit...really? a clean-worded version for a persons "rear-end" is filtered? haha, that made my night!
Viimeisin muokkaaja on Skippy The Magnificent; 9.12.2015 klo 20.43
Craig P  [kehittäjä] 9.12.2015 klo 20.54 
I think that when the solar panels drop down below 10 kW, it's because the sun is on their edge.

Solar tracking would work fine - it'd orient correctly, even if there was a planet in the way.
Viimeisin muokkaaja on Craig P; 9.12.2015 klo 20.55
Craig P  [kehittäjä] 10.12.2015 klo 6.12 
If I'm right, I think I can make it work on dedicated servers. If you're running a dedicated server, can you please check and see if Freya turns to night mode at sunset/sunrise?
I would be more then happy to. Let me test it and I will get back to you.
Ok, To help clarify so you have an idea of how I am testing Freya 2.0, here is a screenshot of my "testing station"...

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=572815295

Mods in use on this grid: Midspace's Experimental Solar Tracker, Freya 2.0, and extreme light and the day cycle is set to 20 mins.

Freya is set with default settings and the timer block is set at 1 second intervals. As soon as the solar panel looses power (sun sets), everything shuts down. Even by trying by forcing the batteries on, freya will right-away switch them back to recharge, thinking its still day light out, and everything goes dark. This continues until sunrise again. Short Version, she stays in daytime mode. It might be worth noting here that even with 1 solar panel, she reports 101% for solar and the solar output was only 113kW.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=572822351


Once the solar looses power, any theshold under 100~110 fails to kick it to night. There is a brief point when the sun sensor is pointing straight down, when freya will actually trigger to night correctly (with threshold set at 10), but as soon as the sun sensor moves roughly 5~10 degrees away from straight down, is when she will act up again. This also holds true when the sun sensor is facing straight up (high noon), freya will kick into night mode. At this point it might be worth noteing that the max solar output is at about 113kw and slowly ticking down, and the current output is at 0.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=572849266
When it gets to be about afternoon-ish (and the current output goes back up), she will switch back to day mode.

Tested this over a couple of cycles to be sure.

Correction: It almost seems like reguardless of the threshold setting, freya is ignoring it (at least, to some degree). I watched this during sunset when the solar's max and current power dropped below 100 (the threshold was set to 100), and refused to switch to night. It is not until WELL after sunset with a threshold of 100 when she will kick over to night setting.
Viimeisin muokkaaja on Skippy The Magnificent; 10.12.2015 klo 12.18
Craig P  [kehittäjä] 11.12.2015 klo 13.00 
OK, since you have a solar tracker installed, I can't do anything. The panel will always be pointed at the sun, even when the sun is setting or on the wrong side of the planet.

For untracked solar panels, I think there will be a zero-out at dusk and dawn. If that's the case, I can do something about it.
Viimeisin muokkaaja on Craig P; 11.12.2015 klo 13.00
Craig P  [kehittäjä] 11.12.2015 klo 14.16 
After doing some tests, it's clear the server is freaking borked. Using the Storage variable, I can clearly see that the server's values for the solar panels are total nonsense, and it appears to be largely random as to whether the server thinks they're always in direct sun or always in pitch-black night.
Craig P lähetti viestin:
After doing some tests, it's clear the server is freaking borked. Using the Storage variable, I can clearly see that the server's values for the solar panels are total nonsense, and it appears to be largely random as to whether the server thinks they're always in direct sun or always in pitch-black night.

To be honest, this is the answer I was most expecting. Yes, I do have a solar tracker installed on the server, and even then when just watching the solar panels output, when the sun drops below the horizon the panels output hits 0, and when the sun rises on the horizon, the panels begin outputing power, as you would expect.

With that said, reguardless of what is used, the script should work 100% as-is, no questions asked, but still gets odd results, like when it is "high noon" and the solar panel's output itself suddenly drops to 0, even though it is DIRECTLY FACING the sun?!? That right there made me highly question how the information on the server itself is being calculated. This is also the same reason why some solar tracking mods that are script-based and try to orientate themselves based off of the output of the solars simply don't work on servers, like this one...

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=367344570

I have even done some tests (not as extensive, so no solid proof) with just a solar panel right on the station, no rotors or sun sensors used at all, and still got questionable results...they did make a little more sense, but only a fractional amount of sense.

The long and the short of it is this...for best solar/battery managment currently as of this post, is to use your battery fix mod and a sun-tracking mod (that works, lol). Your battey fix mod has made a big difference just by itself, simply because it will try to favor using the solar panel's power above the batteries/reactors power.
Craig P  [kehittäjä] 11.12.2015 klo 17.46 
Yeah, I guess that's the case. Thanks for your help!
More then happy to help. If I can be of any further/future assistance, feel free to let me know.
Now if I can just find a good tutorial on script writing, lol.

I understand the basics, or logistics behind writing scripts (just not fluent in writing actual code, but that I can figure out), once apon a time ago I played alot with AutoIT, lol. I just have no clue as to what calls are available to use (how to trigger the blocks through a script more or less).
Craig P  [kehittäjä] 11.12.2015 klo 19.28 
I published a quick guide on how to get started, just look in my uploads if you want to try it.
Rex 18.12.2015 klo 6.09 
Out of curiosity, since your script is based on the output of the solar panel, would the solar panel actually have any output if the batteries themselves weren't able to receive further input? This would explain why you're having false night cycles based on the 0 output. It would also explain why a higher threshold would sometimes trigger the correct response, since the batteries would have more of a chance to deplete themselves if their recharge period was shorter.

It could also explain why you're getting kicked back into your night cycle if the timer checks the output before the batteries have a chance to receive the charge.

I'm not saying that's the case, since I have no experience with what you're attempting, but it's a variable that could explain some of the results you're getting. Let me know.
Viimeisin muokkaaja on Rex; 18.12.2015 klo 6.10
Rex 18.12.2015 klo 6.50 
One more thing...

If my theory is correct, you would need a steady power sink greater or equal to your threshold to maintain your day cycle. This would work better with a lower threshold, of course, and could probably be easily maintained by something like a gravity generator, spotlight, beacon, or antenna if their inputs are high enough. Then, once your solar panel produces less than the threshold again (presumably night), your batteries should switch to discharge to maintain the power sink.

The real trick is getting your batteries back into recharge mode. If your batteries are still discharging when the solar panel is receiving sunlight, then I don't know how well your power sink would prioritize the solar panel to provide enough output to trigger your day cycle.
Viimeisin muokkaaja on Rex; 18.12.2015 klo 6.54
Craig P  [kehittäjä] 21.12.2015 klo 18.19 
No, the output is separate from the max output.
< >
Näytetään 1-15 / 15 kommentista
Sivua kohden: 1530 50