Advanced Nuclear reactor management.
#1
Posted 10 September 2013 - 10:40 PM
These reactors are not a joke! They put off at-least 20,000 EU/T combined! And they also require a constant supply of Ice for the coolant, however 2 of these reactors are breeder reactors running at 330 or so Depleted Uranium cells recharged a cycle, so they don't output a ton of energy, but they do output enough energy to bump up the EU/T from 19,200 EU/T to 20,000 EU/T, the last base I had was unprepared for the reactors, and they went critical, and made a giant hole in the world!!! Please help me with this project I'd really like to one day be able to just walk into my base and spend no more than 1 minute turning on all of my reactors, and actually be able to trust that they will be fine. Oh and I'm going to use bundled cables to output signals from the back.
Thanks
~Quinn~ And remember everyone! Have Fun, Have Nukes!
#2
Posted 10 September 2013 - 11:38 PM
Please post your current code, or provide a more detailed set of questions to help us point you in the right direction.
As a note: If you're looking to request a program be written for you instead of seeking help with a program you're writing yourself, I can move this over to General.
#3
Posted 11 September 2013 - 07:22 AM
The only problem is that the reactors in my test world are a several hundred blocks away, because I was working on a prototype nuclear plant ( which exploded because I had a little too less Ice flow coming in ), and therefore when you spawn you will be above a crater, and several hundred blocks away, but I also have pics of the reactors I can post later today. Each reactor has 6 chambers, outputs at least 2400 EU/T, has two reactor cooling units from the MFFS mod (these activate automatically when the forcefield is on), a reactor area projector, two HV transformers, an output cable of glass fiber, and two filters that extract ice from energy condensers pre loaded with RM to be turned into Ice.
#4
Posted 11 September 2013 - 09:00 AM
#5
Posted 11 September 2013 - 09:19 AM
If you're using openperipherals, just connecting a wired modem to the computer and the reactor, putting network cable between them, and right-clicking the modems to connect them should get you started.
With something like this you get the heat of that single reactor:
local reactor = peripheral.wrap("generator_0") -- replace this with whatever shows up if you right-click the reactor modem print(reactor.getHeat())
That's all you need to do to see the heat from a single reactor if you have OpenPeripherals installed.
More info:
http://www.openperip...nuclear-reactor
#6
Posted 11 September 2013 - 11:21 AM
This is how far I've gotten in terms of the startup:
term.clear()
term.setCursorPos(1, 1)
print("Uranium Tech.INC")
write("Enter password: ")
input = read()
password = "Nukes"
if input == password then
print("Password was correct!")
print ()
print ("Logging in")
term.clear()
term.setCursorPos(1,1)
print ("Nuclear Reactor Control Mainframe")
print ()
print ("1. Start/Stop Reactor quad core 1")
print ("2. Start/Stop Reactor quad core 2")
print ("3. Start/Stop Breeder Reactor 1")
print ("4. Start/Stop Breeder Reactor 2")
print ("5. Start/Stop Refueling Process")
print ("6. Re-route Power to the Mass. Fab. Array")
print ("7. Re-route Power back to the main line")
print ("8. Close/Open Maintenance Blast Doors")
print ("9. Start full auto cycles")
print ("10. Activate Self destruct sequence")
print ("11. Cancel and Shutdown")
I'm going to use industrial information panels to display info like heat and cycle stuff like that
All I don't know what to do is how to make the commands work and output a red stone signal through bundled cables, loop back to the main menu, and put another menu attached to the self destruct sequence so when selected it would ask for a password before activating a redstone signal. Eventually I'd like the menu to function and look just like the one for the Nuclear reactor in this video:
#7
Posted 11 September 2013 - 11:52 AM
#8
Posted 11 September 2013 - 12:34 PM
The easiest way for you to control the reactors is to power them using a redstone current via redstone dust.
To control redstone dust adjacent to one of the sides of your computer, you can use the Redstone API:
- To OUTPUT a redstone current, use redstone.setOutput().
- To check whether the redstone from the Thermal Monitor is powered (and therefore if the the reactor has become too hot), use redstone.getInput().
So far you have the basics needed to keep the reactor under control automatically. In order to turn on/off the reactor manually you will need a menu (like the one in your program so far) and to be able to read user inputs. The easiest way to do this is using os.pullEvent() (more specifically os.pullEvent("key")) to read when a user presses one of the number keys related to an option in the menu.
It looks like you already know the basics that fit in between the code suggestions I've given you, so just give it a go on a single reactor. Multiple reactors will be a bit tougher because if each one uses two sides of the computer for inputs/outputs, you will soon run out of sides! You'll have to find a solution to this at a later date, but for the moment, start simple! This is a pretty complex starter project so don't make it any harder than it already is. You can always make it look good at the end, once it's working!
If you get stuck with anything, just ask!
#9
Posted 11 September 2013 - 01:52 PM
Thanks
#11
Posted 11 September 2013 - 02:24 PM
But back to the subject I'm perfectly content with switches and such, but I wanted to upgrade my facility control to be controlled from one place instead of multiple places. All the computer will really do is activate red power bundled cables and deactivate cables through the back, oh and one more question where is the os.pull code supposed to go? and what are variables? :/
#12
Posted 11 September 2013 - 04:55 PM
quinn9009, on 11 September 2013 - 02:24 PM, said:
Stuff like that is incredibly basic. Programming is something you have to learn yourself. If you get stuck people can help you, but no one can help you if you don't put in the effort. And if you don't have the time, simply don't do it!
There's no instant gratification in programming, not even Lua. It's hard work to get somewhat decent at it. There's a reason why after 4 years of university software engineers are still 'junior'.
#13
Posted 11 September 2013 - 04:58 PM
#14
Posted 12 September 2013 - 07:20 AM
while true do
clearTheScreen()
printTheSubMenu()
e, p = os.pullEvent()
if e == char then
if p == someChar then
performAction()
elseif p == goBackChar then
return
end
end
end
end
while true do
clearTheScreen()
printTheMenu()
e, p = os.pullEvent()
if e == char then
if p == someKey then
doSomeStuff()
elseif p == subMenuKey then
subMenu()
elseif p == exitChar then
return
else
whineAboutInvalidOption()
end
end
end
So is this what I need for the code for each menu?
#15
Posted 12 September 2013 - 09:23 AM
#16
Posted 12 September 2013 - 10:13 AM
But I do have some code I've written down, I'm not sure if it works though :/
From what I've read in other posts and from the wiki I'm 60% sure I'm missing some stuff in this code
term.clear()
term.setCursorPos(1, 1)
print("Uranium Tech.INC")
write("Enter password to access controls: ")
input = read(“*”)
if password == “DarkDeath” then
print(“Correct Password user, accessing control mainframe”)
else
print(“Incorrect!”)
sleep (2)
os.reboot ()
term.clear()
term.setCursorPos(1,1)
print ("Nuclear Reactor Control Mainframe")
print ()
print ("1. Start Reactor quad core 1 - Press 1")
print ("2. Start Reactor quad core 2 - Press 2")
print ("3. Start Breeder Reactor 1 - Press 3")
print ("4. Start Breeder Reactor 2 - Press 4")
print (“5. Stop Reactor quad core 1 - Press 5”)
print (“6. Stop Reactor quad core 2 - Press 6”)
print (“7. Stop Breeder Reactor 1 - Press 7”)
print (“8. Stop Breeder Reactor 2 - Press 8”)
print ("9. Start and Stop Refueling Process - Press 9”)
print ("10. Re-route Power to the Mass. Fab. Array - Press q”)
print (“11. Re-route Power to the Main line - Press w”)
print ("11. Close/Open Maintenance Blast Doors - Press e”)
print ("12. Start/Stop full auto cycles - Press r”)
print ("13. Activate Self destruct sequence - Press t”)
print ("14. Cancel and Shutdown - Press y”)
e,p = os.pullEvent()
if e == “char” then
if p == "1" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Starting Reactor quad core 1...")
sleep(2)
redstone.setBundledOutput("back", 1)
sleep(2)
redstone.setBundledOutput("back", 0)
print ()
print (" Reactor quad core 2 Successfully Started")
return
elseif p == "2" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Starting Reactor quad core 2...")
sleep(2)
redstone.setBundledOutput("back", 2)
sleep(2)
redstone.setBundledOutput("back", 0)
print ()
print (" Reactor quad core 2 Successfully Started")
return
elseif p == "3" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Starting Breeder Reactor 1...")
sleep(2)
redstone.setBundledOutput("back", 4)
sleep(3)
redstone.setBundledOutput("back", 0)
print ()
print (" Breeder Reactor 1 Successfully Started")
return
elseif p == "4" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Starting Breeder Reactor 2...")
sleep(2)
redstone.setBundledOutput("back", 8)
sleep(2)
redstone.setBundledOutput("back", 0)
print ()
print (" Breeder Reactor 2 Successfully Started")
return
if p == "5" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Stopping Reactor quad core 1...")
sleep(2)
redstone.setBundledOutput("back", 1)
sleep(2)
redstone.setBundledOutput("back", 0)
print ()
print (" Reactor quad core 2 Successfully Stopped")
return
elseif p == "6" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Stopping Reactor quad core 2...")
sleep(2)
redstone.setBundledOutput("back", 2)
sleep(2)
redstone.setBundledOutput("back", 0)
print ()
print (" Reactor quad core 2 Successfully Stopped")
return
elseif p == "7" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Stopping Breeder Reactor 1...")
sleep(2)
redstone.setBundledOutput("back", 4)
sleep(3)
redstone.setBundledOutput("back", 0)
print ()
print (" Breeder Reactor 1 Successfully Stopped")
return
elseif p == "8" then
term.clear()
term.setCursorPos(1,1)
print ("Loading Mainframe...")
sleep(3)
print ()
print ("Loading Subsystems...")
sleep(2)
print()
print ("Stopping Breeder Reactor 2...")
sleep(2)
redstone.setBundledOutput("back", 8)
sleep(2)
redstone.setBundledOutput("back", 0)
print ()
print (" Breeder Reactor 2 Successfully Stopped")
return
elseif p == “9”
term.clear()
term.setCursorPos(1,1)
print ("Starting Refueling Process”)
print ()
sleep (2)
print (“Please standby this process will take 2.5 minutes”)
redstone.setBundledOutput("back", 16)
sleep (150)
redstone.setBundledOutput("back", 0)
print ()
print (“Reactors refueled”)
sleep (2)
return
elseif p == “q”
term.clear()
term.setCursorPos(1,1)
print ("Rerouting Power from main line to Mass Fab. Array...”)
redstone.setBundledOutput("back", 32)
sleep (3)
redstone.setBundledOutput("back", 0)
print ()
print (“Power rerouted”)
sleep (3)
return
elseif p == “w”
term.clear()
term.setCursorPos(1,1)
print ("Rerouting Power back to the main line”)
redstone.setBundledOutput("back", 32)
sleep (3)
redstone.setBundledOutput("back", 0)
print ()
print (“Re-routed power”)
sleep (3)
return
elseif p == “e”
term.clear()
term.setCursorPos(1,1)
print ("Opening, or closing Blast doors”)
redstone.setBundledOutput("back", 64)
sleep (3)
redstone.setBundledOutput(“back”, 0)
print ()
print (“Done ”)
return
elseif p == “r”
term.clear()
term.setCursorPos(1,1)
print ("Starting or stopping fully automatic cycles”)
print ()
redstone.setBundledOutput("back", 128)
sleep (3)
redstone.setBundledOutput(“back”, 0)
print (“Done ”)
return
elseif p == “t”
term.clear()
term.setCursorPos(1,1)
print ("You have 2 minutes to vacate the area!!!”)
sleep (120)
redstone.setBundledOutput("back", 256)
sleep (3)
redstone.setBundledOutput(“back”, 0)
return
elseif p == “y”
term.clear()
term.setCursorPos(1,1)
print ("Shutting down. . .”)
os.shutdown ()
#17
Posted 12 September 2013 - 10:55 AM
1. As other people have mentioned, people here will look at code you make and help you out fixing errors you cannot fix. What people will not do is make a program for you or go through a massive amount of your code when you say "it doesn't work" or "can someone check this". If you get an error, post the code and the error.
2. If you want to post code use pastebin.com. Don't post a huge amount of code on the forum, it makes things messy and difficult to read. You are less likely to get help.
3. If you don't use pastebin, use spoilers [spoiler.]<your spoiler here>[/spoiler.] (without the " . "s) and code [code.]<your code here>[/code.] (without the " . "s) tags.
If you don't have time to learn computercraft either don't use it or ask in the general forum for someone to make. Maybe you will get lucky?
EDIT: Oh, and format your code (with indents), e.g.,
#18
Posted 12 September 2013 - 11:22 AM
And I got a terrible headache so I'm having a tough time even typing this, I'm just asking if the code is in the right format and if there are anythings than need fixed, Thanks for the tip though
I'm testing the code tonight though, I just wanted a heads up on if there are any errors before I try it.
Thanks
#19
Posted 12 September 2013 - 03:12 PM
Here's a link to the video
http://www.youtube.c...0&v=H5a7S4eF7zw
#20
Posted 12 September 2013 - 04:08 PM
Hydra, on 12 September 2013 - 09:23 AM, said:
It's pseudo-code I used at one point to explain a better way of structuring a series of menu functions. Context is important.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users