Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #= Power Plant CoS = v0.0 ============ by swagman =#
- # ___ ___ ___ ___ #
- # | _ \___| _ \ / __|___/ __| power plant #
- # | _/ _ \ _/ | (__/ _ \__ \ automated #
- # |_| \___/_| \___\___/___/ contrl system #
- #==================================================#
- # >X< )|( -*~*- #
- # (o o) (o o) (o o) #
- # ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- #
- #= https://youtu.be/vbg67d6SbiA ===================#
- define DaySens 1076425094
- define SolidGen 813146305
- define LightSwt 1999523701 #APC def
- alias LightOn d0
- alias LedDisp d1
- alias PanH r15
- alias PanV r14
- alias Shft r13
- alias PrkH r12
- alias Rsrv r11
- alias Hash r10
- alias PChrg r9
- alias PLght r8
- move sp 0
- loop: #============================================#
- yield
- lb PanH DaySens Horizontal Average
- lb PanV DaySens Vertical Average
- bne PanH PanH skip #NaN check
- sgt r0 PanV 75 #if >85 turn on light
- beq r0 PLght skp
- bdns LightOn skp
- s LightOn On r0
- l r1 LightOn PrefabHash
- beq r1 LightSwt skp
- sb r1 On r0
- skp:
- move PLght r0
- sub r0 PrkH 90
- sub r0 r0 Shft #sensor jump point correction
- brge PanH r0 2
- add PanH PanH 360
- add PanH PanH Shft #relative orient. correction
- brgt PanV 90 2 #store PrkH while day
- sub PrkH PanH 180
- div PrkH PrkH 90 #normalize PrkH
- round PrkH PrkH
- mul PrkH PrkH 90
- brle PanV 95 2 #park if V.Sol > 95 deg
- move PanH PrkH
- sub PanV 75 PanV #yeah, sol deg 2 pan perc
- div PanV PanV 1.5
- #work wt solar panels:
- push -2045627372 #def
- push -539224550 #def dual
- push -934345724 #heavy
- push -1545574413 #heavy dual
- pop Hash
- lb r0 Hash Horizontal Average
- brne r0 r0 3
- move r1 r0 #r1 - current Hor.Angle; 4 AutoSet
- lb r2 Hash Ratio Average #r2 - Ratio; 4 AutoSet
- sb Hash Vertical PanV
- sb Hash Horizontal PanH
- brgtz sp -7
- #AutoSet relative orientation
- bltz PanV skip #if night
- bgt r2 0.05 skip #if insol
- sub r0 r1 PanH
- abs r0 r0
- bgt r0 10 skip #if shift
- add Shft Shft 90
- mod Shft Shft 360
- skip: #work wt accumulators:
- j loop #code below not complete
- push 1999523701 #APC
- push -1032513487 #APC rev
- push -400115994 #Battery
- push -1388288459 #Battery Large
- move r1 1
- move r2 0
- move r3 0
- move r4 0
- lp:
- pop Hash
- lb r0 Hash On Average
- bne r0 1 cnt #ignore NaN or not all on
- lb r0 Hash Maximum Minimum
- beqz r0 cnt #ignore if APC without battery
- lb r0 Hash Ratio Minimum
- min r1 r1 r0
- lb r0 Hash Ratio Average
- add r3 r3 r0
- lb r0 Hash Charge Sum
- add r2 r2 r0
- add r4 r4 1
- div r3 r3 r4
- cnt:
- bgtz sp lp
- #start reserv generator
- select r0 Rsrv 0.10 0.05
- slt Rsrv r1 r0
- sb SolidGen On Rsrv
- yield #--temp
- sub r0 r2 PChrg
- move PChrg r2
- sgtz r1 r0
- select r1 r1 2 4
- xor r5 r5 1
- select r0 r5 r0 r3
- select r1 r5 r1 3
- select r3 r5 2 1
- brdns LedDisp 4
- s LedDisp Setting r0
- s LedDisp Color r1
- s LedDisp Mode r3
- s db 12 r3
- j loop
Add Comment
Please, Sign In to add comment