Space Engineers

Space Engineers

387 ratings
Isy's Solar Alignment Script Guide
By Isy and 1 collaborators
This is a full guide that will explain all the features of my Solar Alignment script.

You can find the script here: http://steamproxy.net/sharedfiles/filedetails/?id=699142028
4
3
11
2
   
Award
Favorite
Favorited
Unfavorite
Basic setup with rotors
The basic setup is very easy. You just need a programmable block with the script and a group of your solar tower rotors named: "Solar Rotors". Below you have a step by step description of what to do:
  • subscribe to my script in the workshop (see link in the title)
  • create a terminal group named 'Solar Rotors' that contains all the rotors of your solar tower
  • build a programmable block
  • open it in the terminal
  • press 'Edit'
  • in the new window, press 'Browse Workshop'
  • select my script 'Isy's Solar Alignment Script' and press 'Ok'
  • the code now appears in the window
  • press 'Check Code' and 'Ok' in the popup window
  • press 'Remember & Exit' and you're done

The script is now running with its basic settings and your solar panels should start aligning.

For a more visual, video guide, watch my quick setup video on youtube:


Note: Game has to be in experimental mode and ingame scripts have to enabled in world options!
How to do that, I explained here:

Basic setup with gyroscopes
Since version 4.0.0 my script supports gyro mode. The idea of gyro mode is to rotate a whole ship or station with gyroscopes instead of rotors. For this to work, you need a reference block like a cockpit or flight seat.

Below you have a step by step description of what to do:
  • subscribe to my script in the workshop (see link in the title)
  • create a terminal group named 'Solar Reference' that contains your flight seat or cockpit
  • build a programmable block
  • open it in the terminal
  • press 'Edit'
  • in the new window, press 'Browse Workshop'
  • select my script 'Isy's Solar Alignment Script' and press 'Ok'
  • the code now appears in the window
  • in the config, search for "useGyroMode" and set the value to true
  • press 'Check Code' and 'Ok' in the popup window
  • press 'Remember & Exit' and you're done

The script is now running with its basic settings and your solar panels should start aligning.

For a more visual, video guide, watch my tutorial video on youtube:
Gyro Mode
Gyro mode uses all gyroscope found on the same grid as the programmable block to rotate the whole ship. It needs a reference block that acts as an orientation for the gyro overrides. This usually is the cockpit or flight seat of your ship but it can be every passenger seat that is pointing to the forward direction of your ship as well.

To get the best efficiency and alignment, you should build all your solar panels in a way, that they are facing in the same direction. The script can work with differently attached panels but will never find the one sweet spot - just like if you had eyes on the back of your head: only one pair of eyes can see the person in front of you ;)

As gyro mode is designed to work in space, some feature of the rotor mode are not available:
  • night mode
  • rotate to sunrise
  • time calculation
  • triggering external timer blocks

Also, every commandline argument except 'pause' is deactivated for gyro mode because they were designed for rotor mode.
Night Mode
The script stops all rotors during the night to avoid unnecessary movement. To be better prepared for the next day, the panels are rotated back to an automatically calculated angle that is based on the first succesful sun lock of the day. If you want to set these values yourself, you can do so by setting manualAngle to true and adjust the angle values.
bool manualAngle = true; int manualAngleYaw= 0; int manualAngleTilt = 0;
Power fallback
With this option, you can enable your reactors or hydrogen engines as a safety fallback, if not enough power is available to power all your machines or if the battery charge gets low. By default, all reactors and hydrogen engines on the same grid will be used. If you only want to use specific ones, put their names or group in the list.

By default, fallback devices are activated on low battery (less than 10% left) and on overload (more than 90% of the max output used). The overload activation will kick in, if the overall power usage of all batteries, solar panels and wind turbines exceeds the set value (default 90% of the max output).

You can enable or disable features by setting their values to true or false. You can also change the tresholds to fit your needs:
// Example: string[] fallbackDevices = { "Small Reactor 1", "Base reactor group", "Hydrogen Engine" }; bool useReactorFallback = false; bool useHydrogenEngineFallback = false; string[] fallbackDevices = { }; // Activation order // By default, the hydrogen engine will be turned on first and the reactors after that if still not enough power is available. // Set this value to false, and the reactors will be used first. bool activateHydrogenEngineFirst = true; // Activation on low battery? // The fallback devices will be active until 'turnOffAtPercent' of the max battery charge after it was turned on at 'turnOnAtPercent'. bool activateOnLowBattery = true; double turnOnAtPercent = 10; double turnOffAtPercent = 15; // Activate on overload? // If the combined output of batteries, solar panels and wind turbines is more than 'overloadPercentage' of their max output, the fallback devices will be turned on. bool activateOnOverload = true; double overloadPercentage = 90;
Base Light Management
The base light management uses a built in time calculating mechanic to switch the lights on or off. 50% of the maximal detected output is considered sunrise/sunset. It works great on planets but poor in space where it is practically eternal day.
// Enable base light management? (Possible values: true | false, default: false) // Lights will be turned on/off based on daytime. bool baseLightManagement = false; // Simple mode: toggle lights based on max. solar output (percentage). Time based toggle will be deactivated. bool simpleMode = false; int simpleThreshold = 50; // Define the times when your lights should be turned on or off. If simple mode is active, this does nothing. int lightOffHour = 8; int lightOnHour = 18; // To only toggle specific lights, declare groups for them. // Example: string[] baseLightGroups = { "Interior Lights", "Spotlights", "Hangar Lights" }; string[] baseLightGroups = { };

Setup options:
  • set baseLightManagement to true in order to activate the light management
  • wait for at least a full day night cycle until the script has calculated the location based time or use simpleMode
  • tweak lightOffHour and lightOnHour or the simpleThreshold to your likings
  • if you only want specific lights to be toggled (by default ALL lights are toggled) create groups for them and put the groupnames in the script
  • Example: string[] baseLightGroups = { "Interior Lights", "Spotlights", "Hangar Lights" }
Command Line Arguments
Type in these arguments in the argmument line of the programmable block or after you pulled down the programmable block to the hotbar of your button panel or flight seat and chose "Run".

Pause the script execution and stop all rotors or gyros:
pause OR stop

Resume the script execution:
pause OR resume

Force the rotors to search for the sun by rotating the panels without locking them in place. After a while, the angle of the best found output gets applied to the rotors:
realign

Set the rotors to a user defined angle and continue the script. The order matters here. If you want to rotate your yaw rotors first, use 'rotate y# t#' and 'rotate t# y#' to rotate the tilt rotor first (# will be a rotor angle in degrees). If you only want to rotate one axis, use 'rotate y#' or 'rotate t#'.
rotate y# t# OR rotate t# y# OR rotate y# OR rotate t#

The same syntax as explained above applies to the 'rotatepause' command which basically does the same as 'rotate' but pauses the script afterwards.
rotatepause y# t# OR rotatepause t# y# OR rotatepause y# OR rotatepause t#

You can also quickly set the rotors to their sunrise position by using sunrise as a parameter.
rotate sunrise OR rotatepause sunrise

Reset the calculated location time:
reset
Rotor Correction Feature
If the rotors of your additional towers are facing the wrong way after using the command line rotation or the manual night mode angles, you probably built your tower not exactly like the first one. To compete against that, you can use the rotor correction feature.

Just add [90], [180] or [270] to your rotor names to shift the rotation for the respective degrees, for example:

'Rotor Solar [90]'
Trigger external timer blocks at specific events
You can trigger external timer blocks for further automation at specific events. All these events are time based and work with the location time feature which makes it not possible to use some of the features in space.

The timer blocks will be triggered with the action "Start" if their delay is higher than 1 and with "Trigger Now" if the delay is exactly 1. Every event needs a timer block name in the exact same order as the events. Calling the same timer block with multiple events requires it's name multiple times in the timers list!

Events can be:
  • any commandline argument, like "pause", "resume", "realign"...
  • "battery##" a battery charge percentage - ## stands for a battery charge percentage, like "battery30" for 30 percent charge
  • "badweather" and "goodweather" which will trigger at the beginning and end of bad weather
  • "sunrise" and "sunset" which will trigger at the beginning and end of the day
  • a time like "15:00"
  • a number for every X seconds

The following example will trigger "Timer 1" at sunrise and sunset, "Timer 2" at 15:00 and "Timer 3" at 30% battery charge.
string[] events = { "sunrise", "sunset", "15:00", "battery30" }; string[] timers = { "Timer 1", "Timer 1", "Timer 2", "Timer 3" };
LCD Output
The following topic explains, how to use LCD panels (regular and block LCDs) of my script. Whenever you add one of the following keywords to a LCD name, the keyword gets transformed to the universal [IsyLCD] keyword. In the custom data, you can then set different options about the LCD as well as the screen, the information should be shown (on blocks like cockpits, programmable blocks and so on). The custom data will look like this:

@# KEYWORD

@# stands for the screen, the information is shown, where # is the screen identifier number from 0 to the max number of screens - 1. A programmable block for example has two screens: The main screen and the keyboard. Both can be used to show the script informations (screen 0 and screen 1). To change the screen, you want to show your informations, just edit the screen identifier number in the custom data.

It is also possible to display informations of different scripts in one block by using this syntax (MMaster's Automatic LCDs 2 uses the same syntax and all of my other scripts).

LCD Keywords
Main LCD
You can display all the main script informations like type solar panel efficiency, battery charge, tank fill levels and location time on the main LCD. Just add the following keyword to a LCD name:
ISA-main

If you did everything correctly, the script should automatically populate the custom data with some settings that can enabled or disabled. For example: if you don't need battery statistics, they can be set to false in the custom data.

Compact LCD
You can show compact statistics on smaller screens like corner LCDs or block type LCDs. The information shown is basically the same as on the main LCD but doesn't waste as much space. This replaces the old corner LCD output.
ISA-compact

You can enable or disable specific informations on the LCD by editing its custom data.

Warning LCD
You can display all current warnings and problems on a dedicated LCD screen. Just add the following keyword to a LCD name:
ISA-warnings

Performance LCD
You can display the script performance (PB terminal output) on a dedicated LCD screen. Just add the following keyword to a LCD name:
ISA-performance
Settings for enthusiasts
In my config section there are some settings for enthusiasts that drastically change the way, the script performs. I highly recommend that you don't change anything there unless you know exactly, what you're doing.

See the code snippet below:
// Use weather detection? This needs solar panels and wind turbines to work and will pause the script in certain weather // conditions, like fog or storms. The variable 'maxBadWeatherMinutes' declares the max duration, the alignment is slowed down // in bad weather conditions. bool useWeatherDetection = true; double maxBadWeatherMinutes = 5; // Check the integrity and general condition of all used blocks? bool checkIntegrity = true; // Output difference in percent between the last locked output and a new alignment: lower values = more frequent alignment (defaults: rotor: 1, gyro: 2) double realignPercentageRotor = 1; double realignPercentageGyro = 2; // Percentage of the max detected output where the script starts night mode (default: 10) double nightPercentage = 10; // Percentage of the max detected output where the script detects night for time calculation (default: 50) double nightTimePercentage = 50; // Rotor speeds (speeds are automatically scaled between these values based on the output) float rotorMinSpeed = 0.05f; float rotorMaxSpeed = 1.0f; // Rotor options float rotorTorqueLarge = 33600000f; float rotorTorqueSmall = 448000f; bool setInertiaTensor = true; bool setRotorLockWhenStopped = false; // Min gyro RPM, max gyro RPM and gyro power for gyro mode const double minGyroRPM = 0.1; const double maxGyroRPM = 1; const float gyroPower = 1f; // Automatically pause aligning while using gyro mode and sitting in the cockpit? bool autoPauseGyroMode = true;