Advertisement
drabont

Stationeers - SolarPoSt ICS

Sep 17th, 2019
4,333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #= Solar Power Station ICS = v0.1 ==== by swagman =#
  2. #    ___      _          ___  ☺  ___ _             #
  3. #   / __| ___| |__ _ _ _| _ \___/ __| |_ automated #
  4. #   \__ \/ _ \ / _` | '_|  _/ _ \__ \  _| control  #
  5. #   |___/\___/_\__,_|_| |_| \___/___/\__|  system  #
  6. #==================================================#
  7. # SolarSensor, on floor, connector to the North    #
  8. # SolarPanels, power connector to the West         #
  9. #                                                  #
  10. # Minimal configuration:                           #
  11. #  SLP -solar panel  STBA -stat. battery or APC    #
  12. #    W -batch writer    M -memory                  #
  13. #    H -ic housing      S -solar sensor            #
  14. # Additional:                                      #
  15. #   LD -lcd display, show instant delta power and  #
  16. #       charge ratio of battery array if R present #
  17. #    R -batch reader, get charge ratio of batterys #
  18. # SFGE -solid fuel generator, for backup power     #
  19. #   TT -transformer, it's not a transformer, lol,  #
  20. #       it's a power limiter                       #
  21. #                                                  #
  22. #     SLP SLP SLP SLP                      E       #
  23. #    ~═╧═══╪═══╧═══╪═╕----              N<═╬═>S    #
  24. #          │    LD┌W┌W                     W       #
  25. #          │     └┼┼┼┤                             #
  26. #          │      ├RHM                             #
  27. #    ~══╤══╪═══╗  ├┴┘-----                         #
  28. #      ST ST  SF  ├S                               #
  29. #      BA BA  GE  │                                #
  30. #    ~══╧══╧═══╧══╧═══TT═>                         #
  31. #                                                  #
  32. # logic setup:  H > W > SLP Horizontal             #
  33. #               M > W > SLP Vertical               #
  34. #               STBA > R > Ratio Avg               #
  35. #               S, M, STBA, (LD, R, SFGE) > H      #
  36. #==================================================#
  37. # _\"()|_/-\|2   |'()\/\/[-|2   _\""|"/-\"|"|()|\| #
  38. #= 2019.09.17 17:21  https://youtu.be/5Kv7aRK98HE =#
  39. alias MemoryH db
  40. alias DaySens d0
  41. alias MemoryV d1
  42. alias Battery d2
  43.  
  44. alias LedDisp d3
  45. alias BatRead d4
  46. alias ResPowr d5
  47.  
  48. alias sMod r15
  49. alias sAng r14
  50. alias pPot r13
  51. alias pAct r12
  52.  
  53. alias AngleH r11
  54. alias AngleV r10
  55. alias LedMode r9
  56. alias LedColor r8
  57. alias PowDelta r7
  58. alias BatRatio r6
  59.  
  60. #.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~
  61. loop:
  62. yield
  63. l sAng DaySens SolarAngle
  64. l pAct Battery PowerActual
  65. l pPot Battery PowerPotential
  66.  
  67. move BatRatio 0
  68. brdns BatRead 2 # BatRead device not set - skip loal
  69. l BatRatio BatRead Setting
  70.  
  71. #--AngleV calc
  72. sub r0 75 sAng
  73. div r0 r0 1.5
  74. select AngleV sMod AngleV r0 # if sMod = 0 use r0
  75.  
  76. #--AngleH calc
  77. sgez r0 AngleV # if day
  78. or r0 r0 pPot # or power
  79. select sAng r0 sAng 90 #use sAng, else park override
  80. sub r0 0 sAng # add solar panel orientation offset
  81. select AngleH sMod r0 AngleH # if sMod = 1 use r0
  82.  
  83. #--PowDelta prepare for show
  84. sub PowDelta pPot pAct
  85. sgez r0 PowDelta # if PowDelta >= 0
  86. select LedColor r0 2 4 # color green, else red
  87. move LedMode 2 #0-normal 1-percent 2-watt
  88.  
  89. #--BatRatio prepare for override
  90. and r0 sMod BatRatio # if sMod and BatRatio
  91. breqz r0 4 # =0 - skip override
  92. move PowDelta BatRatio
  93. move LedColor 3
  94. move LedMode 1
  95.  
  96. #--ResPowr On if need and set
  97. slt r0 BatRatio 0.01
  98. brdns ResPowr 2 #if not set - skip save
  99. s ResPowr On r0 #oh, it`s very very symple and bad
  100. # hysteresis needed here
  101.  
  102. #--switch sensor mode and save
  103. xor sMod sMod 1
  104. s DaySens Mode sMod
  105. s MemoryH Setting AngleH
  106. s MemoryV Setting AngleV
  107.  
  108. bdns LedDisp loop #if LedDisp not set, jump to loop
  109. s LedDisp Setting PowDelta
  110. s LedDisp Color LedColor
  111. s LedDisp Mode LedMode
  112. j loop
  113. #.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.   \-(o)-(o)-/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement