Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Early Game Power Systems Control v2
- # by SemlerPDX Dec2025
- define ActiveVents -1129453144
- define SfcVentMars HASH("Active Vent SFC MARS") #Solid Fuel Chamber
- define SfcVentIn HASH("Active Vent SFC IN") #Solid Fuel Chamber
- define SfcVentOut HASH("Active Vent SFC OUT") #Solid Fuel Chamber
- define PipeHeaters -419758574 #gas
- define Generators 813146305
- define Batteries -400115994
- define SolarPanels -539224550 #basic
- #define SolarPanels -1545574413 #heavy
- define DaylightSensors 1076425094
- # Threshold for "dark"
- define IrradianceMin 1
- define SensorOffset 90 # 0, 90, 180, 270
- define DawnVertical 165
- define DawnHorizontal 180
- define ChargeMin 0.10 # 10%
- define ChargeMax 0.50 # 50%
- define RatioMin 0.90 # 90%
- #1-Second Flip-Flip display (Historic Production and Draw)
- define TopOfStack 2
- alias Counter r15
- #Reset Max Historic on Export
- push 0
- push 0
- #Single-use instructions, uncommented and use-once as needed
- #sbn ActiveVents SfcVentMars Mode 1 # 1 == 1nward
- #sbn ActiveVents SfcVentIn Mode 1 # 1 == 1nward
- #sbn ActiveVents SfcVentOut Mode 0 # 0 == 0utward
- #yield
- #sbn ActiveVents SfcVentMars PressureInternal 1500 #kPa
- #sbn ActiveVents SfcVentIn PressureExternal 330 #kPa
- #sbn ActiveVents SfcVentOut PressureExternal 110 #kPa
- #yield
- #sbn ActiveVents SfcVentMars On 0
- #sbn ActiveVents SfcVentIn On 1
- #sbn ActiveVents SfcVentOut On 1
- begin:
- move sp TopOfStack
- brgtz Counter 2
- move Counter 5
- start:
- beqz sp begin
- yield
- #Gather Power Data
- lb r0 Batteries PowerPotential Maximum
- get r1 db 0
- brlt r0 r1 2
- put db 0 r0 #maximum historic production
- lb r0 Batteries PowerActual Maximum
- mul r1 r0 2
- sub r0 r0 r1 #Invert to Negative
- get r1 db 1
- brgt r0 r1 2
- put db 1 r0 #maximum historic power draw
- #Display Data
- sub Counter Counter 1
- and r0 Counter 1
- breqz r0 3
- pop r0
- s db Setting r0
- #Backup Power Toggle
- lb r0 Batteries Ratio Average
- lb r1 Generators On Maximum
- select r1 r1 ChargeMax ChargeMin
- slt r0 r0 r1
- sb Generators On r0
- #Solar Pipe Heat when over N Ratio
- lb r0 Batteries Ratio Average
- sgt r0 r0 RatioMin
- sb PipeHeaters On r0
- #Check Time of Day
- lb r0 DaylightSensors SolarIrradiance Maximum
- blt r0 IrradianceMin nightSleep
- #Follow Sun (in daytime only)
- lb r0 DaylightSensors Vertical Maximum
- lb r1 DaylightSensors Horizontal Maximum
- add r0 r0 SensorOffset
- add r1 r1 SensorOffset
- sb SolarPanels Vertical r0
- sb SolarPanels Horizontal r1
- j start
- nightSleep:
- #Point array at dawn sun
- sb SolarPanels Vertical DawnVertical
- sb SolarPanels Horizontal DawnHorizontal
- j start
Advertisement
Add Comment
Please, Sign In to add comment