Jump to content




Advanced Nuclear reactor management.


53 replies to this topic

#1 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 10 September 2013 - 10:40 PM

First things first (This is going to be a heavy request): I'm new to using Lua, and cc, but I am a pro at anything Tekkit classic ( excluding CC ). I've got a Nuclear power plant with 10 Mark V 2400 EU/T reactors, and I'd like to make a CC program to control each reactor separately from one console. I've looked at recent forums about this topic, and most don't fit the bill in terms of how many reactors there will be, or what I'd like to have for the main menu options. It should go from boot to A password menu that you enter the password from - to the Main menu and from there be able to Turn on each reactor ( when a reactor is turned on the cooling systems auto start ), a Shutdown for each reactor, Start a timer for extracting Depleted uranium cells and refueling the reactors ( all I'll need is the option to activate a redstone signal that will start a redpower timer ), an option to reroute the power from the main factory's, machines, battery, and EMC Generator to my base's mass fabricator array ( using splitter cables for the main cable turing on, and shutting off splitter cables for the line to the mass fabricator array ), a cancel and shutdown option, and an option to open or close the maintenance blast doors to go into the core.

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 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 10 September 2013 - 11:38 PM

Split into new topic.

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 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 11 September 2013 - 07:22 AM

I'm sorry but I have no Idea where to even begin with writing this code, :( but I can provide links to download my worlds with the reactors to help get an Idea of what your dealing with :P

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 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 11 September 2013 - 09:00 AM

So if I have nothing at all written I'll be stuck writing this on my own D: ?

#5 Hydra

  • Members
  • 9 posts

Posted 11 September 2013 - 09:19 AM

Creating a program like this costs time. No one is just going to spend hours writing a custom program for you. If you write one yourself and get stuck somewhere people will be happy to help.

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 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 11 September 2013 - 11:21 AM

I just don't know how to write the coding or how any of it works :(

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 :P

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 Hydra

  • Members
  • 9 posts

Posted 11 September 2013 - 11:52 AM

If you don't know how it works you'll have to learn it. We all had to. There's plenty of tutorials on the wiki, start there first. I'm getting the feeling you don't want to learn but just want a ready-made program.

#8 Rsstn

  • Members
  • 53 posts
  • LocationLondon, UK

Posted 11 September 2013 - 12:34 PM

As the others say, you'll need to learn this for yourself, but here's where to start:

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:

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 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 11 September 2013 - 01:52 PM

I'd like to learn, I'd be more than happy to, but time is of the essence to me, I have little to no time ever online, I mostly do my building in Single Player Offline, and when I get the chance I play on the server Retribution Gaming.net on Tekkit Classic. But however I do have ways to download video's and watch them later. And copy and paste written tutorials, if you could please give me a link to the page about how to add a function to a command I'd be more than appreciative.

Thanks :)

#10 Rsstn

  • Members
  • 53 posts
  • LocationLondon, UK

Posted 11 September 2013 - 01:57 PM

 quinn9009, on 11 September 2013 - 01:52 PM, said:

how to add a function to a command

Sorry, I don't quite understand what you mean by that, can you explain again in a different way what you need explaining?

#11 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 11 September 2013 - 02:24 PM

I don't understand how to select a command from the list and make it work. In other words I don't know how to code it to where I can select an option press a button and turn on or off a redstone signal. I'm going to use bundled cables, I've got all the wiring down, It's just how messy it is, I could just wire everything up to a single switch and use that, but I like to keep things nice and neat ( I usually play on a laggy old computer that only goes up to 40 FPS max! ), but my real laptop will be out of the repair shop soon :D

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 Hydra

  • Members
  • 9 posts

Posted 11 September 2013 - 04:55 PM

 quinn9009, on 11 September 2013 - 02:24 PM, said:

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? :/

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 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 11 September 2013 - 04:58 PM

I mean I've had some experience, and I am a fast learner, but yeah I guess your right. I'll do some work on it and test it tomorrow night, then Friday I'll post if I need any help. Thanks anyways :)

#14 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 12 September 2013 - 07:20 AM

Ok, I've found some code from another post: localfunction subMenu()
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 Hydra

  • Members
  • 9 posts

Posted 12 September 2013 - 09:23 AM

You need to understand code, not 'find and copy-paste it'. If you would have understood any lua you would have seen that the above does not work at all. Again you've done nothing to actually understand programming.

#16 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 12 September 2013 - 10:13 AM

Well I'm sorry I don't know anything on how lua works! D:

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 :P”)

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 :P”)

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 campicus

  • Members
  • 164 posts

Posted 12 September 2013 - 10:55 AM

Hey mate. Your obviously new so here are a few tips for using the forums :)

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.,

Spoiler


#18 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 12 September 2013 - 11:22 AM

Sorry, I'm felling kinda sick today :(
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 quinn9009

  • Members
  • 31 posts
  • LocationIowa

Posted 12 September 2013 - 03:12 PM

Just found a youtube video series to help me learn programming :D

Here's a link to the video :P

http://www.youtube.c...0&v=H5a7S4eF7zw

#20 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 12 September 2013 - 04:08 PM

 Hydra, on 12 September 2013 - 09:23 AM, said:

You need to understand code, not 'find and copy-paste it'. If you would have understood any lua you would have seen that the above does not work at all. Again you've done nothing to actually understand programming.

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