SHARE
TWEET

Reactor/Turbine Script

peregrin5 Aug 23rd, 2019 (edited) 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- My Personal Big Reactors Temperature Control Script
  2.  
  3. local turbine = peripheral.wrap("BigReactors-Turbine_0")
  4. local reactor = peripheral.wrap("BigReactors-Reactor_1")
  5. local RFhigh = 990000
  6. local RFlow = 800000
  7.  
  8. -- Set Optimal RPM Speeds and reactor temperature
  9. local optimalRPM = 1800
  10. local optimalTemp = 760.08
  11.  
  12. turbine.setActive(true)
  13.  
  14. while true do
  15.   if turbine.getEnergyStored() >= RFhigh then
  16.     reactor.setActive(false)
  17.   elseif turbine.getEnergyStored() <= RFlow then
  18.     reactor.setActive(true)
  19.   end
  20.  
  21.   if turbine.getActive() == true then
  22.     local flowRate = turbine.getFluidFlowRateMax()
  23.     local currentRPM = turbine.getRotorSpeed()
  24.     local highRPM = optimalRPM + 5
  25.     local lowRPM = optimalRPM - 5
  26.  
  27.     if currentRPM >= highRPM then
  28.       turbine.setFluidFlowMaxRate(flowRate - 1)
  29.     elseif currentRPM <= lowRPM and flowRate < 2000 then
  30.       turbine.setFluidFlowMaxRate(flowRate + 1)
  31.     end
  32.   end
  33.  
  34.   if reactor.getActive() == true then
  35.     local rodLevel = reactor.getControlRodLevel(0)
  36.     if reactor.getFuelTemperature() >= optimalTemp and rodLevel <= 100 then
  37.       reactor.setAllControlRodLevels(rodLevel + 5)
  38.     elseif reactor.getFuelTemperature() <= optimalTemp and rodLevel >= 0 then
  39.       reactor.setAllControlRodLevels(rodLevel - 5)
  40.     end
  41.   end
  42.   sleep(10)
  43. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top