Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Basic Solar Array & Backup Generator Control Script
- # by SemlerPDX Dec2022
- define MinPowerRatio 0.25 #25% Battery Charge, adjust as desired
- define StationBatteries -1388288459 #Large Station Batteries
- define CableAnalyzers 1036015121 #on power line from solar array to batteries
- define SolidGenerators 813146305 #Solid Fuel Generator(s)
- #Signal Wire connection facing 0 (North, see offset note below)
- define SolarArray -1545574413 #Heavy Dual Solar Panels (basic dual == -539224550)
- #Signal Wire connection facing 180 (South, see offset note below)
- define DaylightSensor 1076425094 #Sensor face pointed towards sky
- #Offset value is relative to array & sensor orientations listed above, is NOT the ONLY way
- define RelativeOffset 90 #0, 90, 180, or 270 (see solar tracking guides)
- define MorningV 165 #point at morning sun to get this Vertical value
- define MorningH 186 #point at morning sun to get this Horizontal value
- main:
- yield
- #Engage generator if power low (during night only)
- lb r0 CableAnalyzers PowerActual Maximum
- slez r0 r0
- lb r1 Batteries Ratio Average
- sle r1 r1 MinPowerRatio
- and r0 r0 r1
- lb r1 SolidGenerators On Maximum
- breq r0 r1 2 #skip 2 lines if On state already matches r0
- sb SolidGenerators On r0
- #Check time of day
- lb r0 DaylightSensor SolarIrradiance Maximum
- blt r0 1 resetAngles
- #Follow Sun (during daytime only)
- lb r0 DaylightSensor Vertical Maximum
- lb r1 DaylightSensor Horizontal Maximum
- add r0 r0 RelativeOffset
- add r1 r1 RelativeOffset
- sb SolarArray Vertical r0
- sb SolarArray Horizontal r1
- j main
- resetAngles:
- #Early return if already set
- lb r0 SolarArray Vertical Maximum
- beq r0 MorningV main
- #Point array at morning sun
- sb SolarArray Vertical MorningV
- sb SolarArray Horizontal MorningH
- j main
Advertisement
Comments
-
- See Power Distribution Example video on YouTube: https://www.youtube.com/watch?v=8RfVeTMT71E
Add Comment
Please, Sign In to add comment
Advertisement