Space Engineers

Space Engineers

No hay suficientes valoraciones
Solar Tracker
   
Premiar
Favoritos
Favorito
Quitar
Tamaño
Publicado el
Actualizado el
361.468 KB
4 ENE 2015 a las 16:25
5 ENE 2015 a las 19:25
3 notas sobre cambios ( ver )

Suscríbete para descargar
Solar Tracker

Descripción
This code will attempt to orient a ship via its gyros so its solar panels can provide maximum power.

There are two caveats: all solar panels should only have one side exposed OR all solar panels should have both sides equally exposed.

To use this, make sure your ship has at least one solar panel, at least one gyro, a timer and a trigger block. Configure the trigger to run the code, and also to ‘Trigger now’ on itself.

It mostly works via trial and error and will go through a number of states, starting with rotating along 2 axis at random and then going along each direction from there.

If it cannot reach its target power output (currently set at 85% of maximum solar output), it will begin again until it has satisfied this requirement.

If the panels are more or less perpendicular to the sun the power values won’t change, so as a safeguard the ship will only complete a single full rotation (if it is able to, gyro power dependent) before continuing on.

Finally, if when the program runs for the first time it senses that it is already at or above its target power threshold, it will not switch states.
16 comentarios
ArturTheLord 3 AGO 2019 a las 10:47 
you
Fi77on 15 FEB 2017 a las 12:22 
Has this script been fixed yet?
Ivar418 14 JUN 2016 a las 9:25 
plz fix this
[MTX]Rooster 6 FEB 2016 a las 9:52 
Having a problem with this.. I have one side covered of my panels (well armor block frames, meaning not filled in, but the led status on panel shows all red meaning the blocks are blocking that side of the panel) but the script still insists on aiming the red/covered side at the sun. Even if I manually turn the ship so all panels are 4xled full power, it still turns them to the back side where they are all red. Is there a toggle in the script for which side of the panels is the 'front' side or something I can tweak? It's certainly not aiming the panels based on the most powerful input.. lol as it's turning them to make them all red.. (no power input)
[MTX]Rooster 2 FEB 2016 a las 11:46 
TY dorsai3d - I have been fighting with my prog block and timer for days trying to get this script to work - It did nothing... replaced the top line of code (4 or 5 lines I think) with yours and seems to work! (still seems to move too much, even when aiming dead on at sun) but at least it's working now! :)
damienmccain12 14 ENE 2016 a las 20:08 
it cant find my antenna ,any thoughts?
dorsai3d 13 NOV 2015 a las 19:29 
Wiseguy pointed out the issue, but I want to clarify:
The script tries to load solar panels and gyros into the same List. This now causes the gyro blocks to overwrite the solar panel blocks and breaks the script. Changing the first few lines to this solved the problem:
var blocks = new List<IMyTerminalBlock>();
var GyroBlocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMySolarPanel>(blocks);
GridTerminalSystem.GetBlocksOfType<IMyGyro>(GyroBlocks);
blocks.AddRange(GyroBlocks);
Wiseguy 19 OCT 2015 a las 4:29 
I've tried it last week, in my case it needed a small change but after that it worked :)

In the main()-method it requests all the solar panels and all the gyros. For some reason this did not work in my game, so I requested a list of all the solar panels and a separate list of all gyros, and List<T>.AddRange()'d them together.
Greatheart 16 JUL 2015 a las 8:11 
Does this still work? I'm running it and the beacon is re-named to "State: 0, Power: NaN%". So I guess the script is running but something isn't working. I have a gyro, default solar panel, programmable block, timer block etc.
Azrael 10 ENE 2015 a las 15:46 
Very nice script!
It would be nice, if the script would deactivate the gyro-override at the end, so that you're able to move your ship again =)
Or is it that, what you meant with "gyro-override issues" ?