Posted 11 September 2012 - 06:49 AM
I have begun recently to create a reactor control interface for the reactors I am going to be using in my new complex, the plan is to have four reactors powering most of the underground facility. Only one of the reactors have be build thus far, a starting reactor that is intended for light duty, no having to be monitered or externally controlled, but providing constant power to charge the battery stores. While I could most likely program the functions for this first reactor, being a simple text menu; it is the later models that I am nowhere near prepared for. The further reactors will have to be shut down before the entirety of the uranium cell is spent due to the heat they will be generating.
The reactor setup I have is rather simple, the reactor itself has only one input that is used to shut it down. The heat level is monitered using a Sensor, and there is an attached alarm system. I have two computers set up right now. Both are set up on either side of the sensor controller, the computer on the right side is used to display to the screen next to it using the ccSensors, in-build dash_reactor program, I had to split the computers earlier because I could not get the programs to successfully multitask.
The computer on the left side is what I plan to use for controlling and monitoring the reactor, and obviously, it will need to do both simultaneously. As it is set up the computer has two peripherals, one being the sensor controller to the right, and the other being the bundle of wires to the left side. In the bundle the red cable controls the reactor, a signal submitted there will cause the reactor to shut down; the blue cable is attached to the alarm system, submitting power to that one will cause the alarm to go off.
The way I envision it working is allowing the user to select through a menu (the outline of that is included later), and be able to select functions, including shutting down the reactor, and starting it up. those two functions simple functions, I have finished. However, on the other hand, I need the computer to monitor the reactor, and shut it down at a certain point (= value stored in a local variable) to allow it to cool until another point before starting up again. If the reactor gets too hot, then I would like the alarm to go off; and when the reactor is about to start up I would like the alarm to sound for an amount of time.as well.
This is the code I have so far:
The menu code, is used over from a program I made before, which I copied from another program online, I can't remember who it was though(It's been too long for me to recall).
Variables Declared: (Most are here to be changed in case different types are used in a different reactor. Cable bundle is on the right side in one setup, the left side on another.)
AlarmC = the color of the alarm wire
ReactorSD = the color of the Reactor Shut Down wire
bside = the side the cable bundle hooks into
sside = the side the sensor controller is on
storagefull = antiqated from my first visions of the system, was/is going to be used for measuring the energy storage, and turning the reactor system off if the storage is full
alrmlgth = the length that the alarm will sound when the reactor is starting up
rout = the current status of the colors in the cable bundle
The menu schematic:
The biggest part of my problem is using the parallel function, in that I can't successfully do so, and numerous google searches haven't turned up and really good tutorial/documentation on using it. It might also be worth noting that the Tekkit version of CC is 1.3 so Coroutines could be poisonous
So in short, what I need help with:
The reactor setup I have is rather simple, the reactor itself has only one input that is used to shut it down. The heat level is monitered using a Sensor, and there is an attached alarm system. I have two computers set up right now. Both are set up on either side of the sensor controller, the computer on the right side is used to display to the screen next to it using the ccSensors, in-build dash_reactor program, I had to split the computers earlier because I could not get the programs to successfully multitask.
The computer on the left side is what I plan to use for controlling and monitoring the reactor, and obviously, it will need to do both simultaneously. As it is set up the computer has two peripherals, one being the sensor controller to the right, and the other being the bundle of wires to the left side. In the bundle the red cable controls the reactor, a signal submitted there will cause the reactor to shut down; the blue cable is attached to the alarm system, submitting power to that one will cause the alarm to go off.
The way I envision it working is allowing the user to select through a menu (the outline of that is included later), and be able to select functions, including shutting down the reactor, and starting it up. those two functions simple functions, I have finished. However, on the other hand, I need the computer to monitor the reactor, and shut it down at a certain point (= value stored in a local variable) to allow it to cool until another point before starting up again. If the reactor gets too hot, then I would like the alarm to go off; and when the reactor is about to start up I would like the alarm to sound for an amount of time.as well.
This is the code I have so far:
local AlarmC = colors.blue
local ReactorSD = colors.red
local bside = "left"
local sside = "right"
local Storagefull = false
w, h = term.getSize()
local alrmlgth = 5
local rout = 0
local function shutdown()
rout = colors.combine(rout, ReactorSD)
rs.setBundledOutput(bside, rout)
end
local function startup(alrmlgth)
rout = colors.combine(rout, AlarmC)
rs.setBundledOutput(bside, rout)
sleep(alrmlgth)
rout = colors.subtract(rout, AlarmC)
rout = colors.subtract(rout, ReactorSD)
end
local function menu(...) -- ver 0.1
local sel = 1
local list = {...}
local offX,offY = term.getCursorPos()
local curX,curY = term.getCursorPos()
while true do
if sel > #list then sel = 1 end
if sel < 1 then sel = #list end
for i = 1,#list do
term.setCursorPos(offX,offY+i-1)
if sel == i then
print("["..list[i].."]") -- very customisible example print(">"..list[i])
else
print(" "..list[i].." ") -- very customisible
end
end
while true do
local e,e1,e2,e3,e4,e5 = os.pullEvent()
if e == "key" then
if e1 == 200 then -- up key
sel = sel-1
break
end
if e1 == 208 then -- down key
sel = sel+1
break
end
if e1 == 28 then
term.setCursorPos(curX,curY)
return list[sel],sel
end
end
end
end
end
term.clear()
term.setCursorPos(1,1)
print("Reactor Menu")
local selection = menu("Reactor Statistics","Reactor Functions","Utilities")
if selection == "Reactor Statistics" then
elseif selection == "Reactor Functions" then
elseif selection == "Utilities" then
end
The menu code, is used over from a program I made before, which I copied from another program online, I can't remember who it was though(It's been too long for me to recall).
Variables Declared: (Most are here to be changed in case different types are used in a different reactor. Cable bundle is on the right side in one setup, the left side on another.)
AlarmC = the color of the alarm wire
ReactorSD = the color of the Reactor Shut Down wire
bside = the side the cable bundle hooks into
sside = the side the sensor controller is on
storagefull = antiqated from my first visions of the system, was/is going to be used for measuring the energy storage, and turning the reactor system off if the storage is full
alrmlgth = the length that the alarm will sound when the reactor is starting up
rout = the current status of the colors in the cable bundle
The menu schematic:
- Reactor Statistics
- Reactor Functions
- Startup
- Shutdown
- Refuel
- Supply
- Ice
- 1 Block
- 4 Blocks
- Back
- Water
- 1 Bucket
- Back
- Cooling Cells
- 1 Cell
- Back
- Hull Armor
- 1 Cell
- Back
- Heat Dissipaters
- 1 Cell
- Back
- Back
- Back
- Utilities
- Select Reactor
- Alarm
- Test Alarm
- Startup Alarm Length
- Back
- Back
The biggest part of my problem is using the parallel function, in that I can't successfully do so, and numerous google searches haven't turned up and really good tutorial/documentation on using it. It might also be worth noting that the Tekkit version of CC is 1.3 so Coroutines could be poisonous
So in short, what I need help with:
- Build a program to monitor the reactor
- Be able to be controlled by the user
- ?Maybe be able to do both and update the monitor as well?