Advertisement
On_The_Edge

test

Feb 23rd, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.95 KB | None | 0 0
  1. -- Komponenten --
  2. event.ignoreAll()
  3. gpu1 = computer.getGPUs(1)[1]
  4. gpu2 = computer.getGPUs(1)[2]
  5.  
  6. FCScreen = component.proxy("A4F4F5B84ABECA3C00DC4B911D08A25C")
  7. PowerScreen = component.proxy("9884839E45D712B4E80C1EA10678D423")
  8. PowerPole = component.proxy("93C9C4D14EBE274BCB5F90BE120604DD")
  9.  
  10. FCTank1 = component.proxy("8FBB53534CD146B2C164BAA2B239FDFA")
  11. FCTank2 = component.proxy("4A5240694B7F6B7B6A0167A502D56F17")
  12. FCTank3 = component.proxy("23B113894643C8A082F0AD8298719AAE")
  13. FCTank4 = component.proxy("F09587554E2831D602495CB71F83882D")
  14.  
  15. PowerStat = PowerPole:getPowerConnectors()[1]
  16. PowerDet = PowerStat:getCircuit()
  17.  
  18. gpu1:bindScreen(FCScreen)
  19. gpu2:bindScreen(PowerScreen)
  20. FC1w, FC1h = gpu1:getSize()
  21. FC2w, FC2h = gpu2:getSize()
  22.  
  23. gpu1:setsize(FC1w,FC1h)
  24. gpu2:setsize(35,10)
  25. gpu1:setForeground(1,1,1,1)
  26. gpu1:setBackground(0,0,0,0)
  27. gpu2:setForeground(1,1,1,1)
  28. gpu2:setBackground(0,0,0,0)
  29. --event.listen(gpu1)
  30. --event.listen(gpu2)
  31.  
  32.  
  33. -- Bezeichnungen --
  34. line = "-------------------------"
  35.  
  36.  
  37. -- OPTION --
  38. -- Tank1:flush()
  39. -- Tank2:flush()
  40.  
  41.  
  42. -- DATEN --
  43. z = 3  -- Zeilen --
  44. fcx = 1 -- Spalte links Abstand --
  45.  
  46. function getdata()
  47. V1 = FCTank1.fluidcontent
  48. F1 = FCTank1.flowfill*60 - FCTank1.flowdrain*60
  49.  
  50. V1 = math.floor(V1) -- runden --
  51. if V1 > 2400 then V1 ="2400" else
  52. end
  53. F1 = math.floor(F1) -- runden --
  54.  
  55. V2 = FCTank2.fluidcontent
  56. F2 = FCTank2.flowfill*60 - FCTank2.flowdrain*60
  57.  
  58. V2 = math.floor(V2) -- runden --
  59. if V2 > 2400 then V2 ="2400" else
  60. end
  61. F2 = math.floor(F2) -- runden --
  62.  
  63. V3 = FCTank3.fluidcontent
  64. F3 = FCTank3.flowfill*60 - FCTank3.flowdrain*60
  65.  
  66. V3 = math.floor(V3) -- runden --
  67. if V3 > 2400 then V3 ="2400" else
  68. end
  69. F3 = math.floor(F3) -- runden --
  70.  
  71. V4 = FCTank4.fluidcontent
  72. F4 = FCTank4.flowfill*60 - FCTank4.flowdrain*60
  73.  
  74. V4 = math.floor(V4) -- runden --
  75. if V4 > 2400 then V4 ="2400" else
  76. end
  77. F4 = math.floor(F4) -- runden --
  78.  
  79. Capa = PowerDet.capacity
  80. Verbr = PowerDet.consumption
  81. Free = Capa - Verbr
  82. Ausl = (100/Capa)*Verbr
  83.  
  84. Capa = math.floor(Capa)
  85. Verbr = math.floor(Verbr)
  86. Free = math.floor(Free)
  87. Ausl = math.floor(Ausl)
  88. AuslProz = math.floor(Ausl*10)/10
  89. AuslProz = math.floor(AuslProz)
  90. n = AuslProz / 10
  91. -- print(n)
  92. n = math.floor(n)+1
  93. -- print(n)
  94. if n > 10 then n = 10
  95. else
  96. end
  97.  
  98. -- Auslastung --
  99. Ausl = math.floor(Ausl)
  100. end
  101.  
  102. -- AUSGABE Bildschirm 1--
  103. function stream1()
  104. gpu1:fill(0,0,FC1w,FC1h," ")
  105.  
  106. gpu1:setForeground(255,165,0,1)
  107. gpu1:setText(fcx,1,"FUEL CITY")
  108.  
  109. gpu1:setForeground(1,1,1,1)
  110. gpu1:setText(fcx,z,"Tank 1: "..V1.."L")   -- Tank1
  111. gpu1:setText(15,z,"|".."\tNET: "..F1)
  112.  
  113. gpu1:setText(fcx,z+1,line)                -- Trennlinie
  114.  
  115. gpu1:setText(fcx,z+2,"Tank 2: "..V2.."L") -- Tank2
  116. gpu1:setText(15,z+2,"|".."\tNET: "..F2)
  117.  
  118. gpu1:setText(fcx,z+3,line)                -- Trennlinie
  119.  
  120. gpu1:setText(fcx,z+4,"Tank 3: "..V3.."L") -- Tank3
  121. gpu1:setText(15,z+4,"|".."\tNET: "..F3)
  122.  
  123. gpu1:setText(fcx,z+5,line)                -- Trennlinie
  124.  
  125. gpu1:setText(fcx,z+6,"Tank 4: "..V4.."L") -- Tank4
  126. gpu1:setText(15,z+6,"|".."\tNET: "..F4)
  127.  
  128. gpu1:setText(fcx,z+7,line)                -- Trennlinie
  129.  
  130. gpu1:flush()
  131. end
  132.  
  133. function barcolor() -- Farbe für Balken
  134. if n < 7 then gpu2:setBackground(0,255,0,0.5)
  135. end
  136. if n > 7 and n < 9 then gpu2:setBackground(255,120,0,1)
  137. end
  138. if n >= 9 then gpu2:setBackground(255,0,0,1)
  139. else
  140. end
  141. end
  142.  
  143. -- AUSGABE Bildschirm 2--
  144. function stream2()
  145. xn = 14 -- Startabstand (xn) für Balken
  146. gpu2:fill(0,0,FC2w,FC2h," ")
  147.  
  148. gpu2:setForeground(255,165,0,1)
  149. gpu2:setText(fcx,1,"POWER GRID")
  150.  
  151. gpu2:setForeground(1,1,1,1)
  152. gpu2:setText(fcx,z,"CAP:  "..Capa.." MWh")
  153. gpu2:setText(fcx,z+2,"USE:  "..Verbr.." MWh")
  154. gpu2:setText(fcx,z+4,"AUSL: "..Ausl.." %")
  155. gpu2:setText(fcx+12,z+4,"|")
  156. gpu2:setText(fcx+23,z+4,"|")
  157.  
  158. -- gpu2:setBackground(0,255,0,0.5) -- Farbe für Balken
  159. barcolor()
  160. gpu2:fill(xn,z+4,n,1," ") -- Balken Display
  161. gpu2:setBackground(0,0,0,0)
  162. gpu2:flush()
  163. end
  164.  
  165.  
  166. -- RUN --
  167.  
  168. while true do
  169. event.pull(2)
  170. getdata()
  171. stream1()
  172. stream2()
  173. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement