Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- this program is designed to control the output
- -- steam proceduce by a really big reactor.
- -- local variables
- local i=0
- local iTurbines = 0
- local mon = peripheral.wrap("monitor_8")
- local reactor = peripheral.wrap("BigReactors-Reactor_7")
- local turbines = {peripheral.find("BigReactors-Turbine")}
- local iNumRods = 0
- local iNumFuelAmount = 0
- local iFuelTemp = 0
- local iCasingTemp = 0
- local iHotAmount = 0
- local iCoolantAmount = 0
- local iVentOff = 0
- local iReactorHeight = 0
- local vRSside = "right" -- this is the side of the computer the redstone single is on
- local bVentSteam = true;
- function WL( color, text)
- i = i + 1
- mon.setCursorPos(1,i)
- mon.setTextColor(color)
- mon.write(text)
- end -- WL Write Line
- local function FormatString( iLength, text)
- local padding = ' '
- local text_len = string.len(text)
- local len_diff = 0
- local new_text = ' '
- len_diff = iLength - text_len
- if len_diff < 1 then
- len_diff = 0
- end -- check for negative values
- new_text = string.sub(padding,1,len_diff) .. text
- return new_text
- end -- FormatString
- function RefreshValues()
- iNumRods = reactor.getNumberOfControlRods()
- iNumFuelAmount = reactor.getFuelAmount()
- iHotAmount = reactor.getHotFluidAmount()
- iCoolantAmount = reactor.getCoolantAmount()
- end -- RefreshValues Variables
- function BoolStr( bBool)
- local temp = "False"
- if bBool then
- temp = "True"
- end
- return temp
- end -- Bool to String
- function SetTurbineVentControl( )
- for x,y in ipairs( turbines) do
- y.setVentOverflow()
- end -- turbine loop
- end -- SetTurbineVentControl
- function GetHeight()
- local min_x = 0
- local min_y = 0
- local min_z = 0
- local max_x = 0
- local max_y = 0
- local max_z = 0
- iReactorHeight = 0
- min_x, min_y, min_z = reactor.getMinimumCoordinate()
- max_x, max_y, max_z = reactor.getMaximumCoordinate()
- iReactorHeight = max_y - min_y - 1
- end -- Get Reactor Height
- -- -------------------------------------------
- -- - Main Loop -
- -- -------------------------------------------
- rs.setOutput(vRSside, bVentSteam)
- SetTurbineVentControl()
- GetHeight()
- while true do
- RefreshValues()
- mon.clear()
- i = 0
- iTurbines = 0
- iFuelTemp = reactor.getFuelTemperature()
- iCasingTemp = reactor.getCasingTemperature()
- iTurbines = #turbines
- WL(colors.white, "Number of Turbines: " .. iTurbines)
- WL(colors.white, "Number of Rods : " .. iNumRods )
- WL(colors.white, "Reactor Height : " .. iReactorHeight )
- WL(colors.white, "Amount of Fuel : " .. iNumFuelAmount)
- WL(colors.white, "Casing Heat : " .. iCasingTemp )
- WL(colors.white, "Core Heat : " .. iFuelTemp )
- WL(colors.white, "Steam Out /T : " .. math.floor(reactor.getEnergyProducedLastTick()) )
- WL(colors.white, "Coolant Reserve : " .. iHotAmount )
- WL(colors.white, "Steam Reserve : " .. iCoolantAmount )
- WL(colors.white, "Vent Steam (trash): " .. BoolStr(bVentSteam) .. " -- Times On: " .. iVentOff )
- if iFuelTemp > 1600 then
- bVentSteam = true;
- iVentOff = iVentOff + 1
- else
- bVentSteam = false;
- end -- check steam level
- rs.setOutput( vRSside, bVentSteam);
- sleep(.5)
- end -- while true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement