This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
CoolisTheName007's profile picture

Auto Reactor - Uranium Refilling + Ice Cooling

Started by CoolisTheName007, 29 September 2012 - 11:48 AM
CoolisTheName007 #1
Posted 29 September 2012 - 01:48 PM
CoolisTheName007 Automatic Reactor TUTORIAL
EDIT:Only works on single player, due to ccSensors SMP bugs. Which is now being fixed as opensource, check OpenCCSensors.
My MC username: CoolisTheName007

Description:
This setup will allow you to, with only ONE minimalist control room, have as many reactors as needed, running SAFELY and FOREVER and WITHOUT manual interaction, with an uptime > 99%. Tested in SPP and SMP, on a 20 slots server. No noticeable increase in lag by observing FPS change.

-Function: continuous maintenance of IC2 reactors by:
  • Retrieval of Near Depleted AND Re-enriched Cells
  • Refilling of Uranium Cells
  • Cooling with Ice
-User Interface:

  • Only initial interaction is needed. Default values for parameters are provided, there is no need to modify them if this tutorial is followed.
  • GIANT screen for automation status
-Anti-lag considerations:
  • Configurable delay between program's updates. Default is a no-lag 5 seconds sleep.
Program:http://pastebin.com/tjvD0kF2

Written Tutorial: https://docs.google....v2Xw/edit?pli=1

Youtube:
[media]http://www.youtube.com/watch?v=DLd0QLxrK5U&feature=plcp[/media]

Sorry for the generally poor content of the video, if people show interest I will make a full tutorial.

World Save:
https://docs.google....RXdxc1J6RDlvU2M

It's a Tekkit 3.1.2 world save.

Requirements :

Reactor Cooling Type:
Ice-Cooled

Mods: All of the following are standard Tekkit 3.1 content, but may have been removed in some servers:

-Minimum requirements:

  • Redpower2
  • IndustrialCraft2
  • ComputerCraft
  • ccSensors
-Requirements for which there may be a work around:
  • Thermal Control (alternative emergency shutdown systems?)
  • Wireless Redstone (connect all by wire?)
  • EquivalentExchange2 (ice factory, or rewriting the program to allow other cooling methods?)
IN CASE OF PROBLEMS:
The best solution is to make me go to wherever you are playing. In case that's too difficult, just post it here.

NOTE for CC Forums:
For now, this is just a user-directed tutorial. If there is interest in this I will explain how the program works. Or maybe it can be understood from the code?
Has anyone made anything similar?
I tried to make my program lag-neutral, by inserting large sleeps whenever possible. It seems to work, comments?
I have no experience in automatically transferring ComputerCraft programs to servers. I had to copy the last one manually because the server host couldn't find anything similar to the path above, although there are people who say it does exist:http://www.computercraft.info/forums2/index.php?/topic/2160-question-floppy-disks-on-online-servers/
Help anyone?
Doyle3694 #2
Posted 29 September 2012 - 01:52 PM
You should add that you use tekkit and ccsensors
CoolisTheName007 #3
Posted 29 September 2012 - 03:06 PM
You should add that you use tekkit and ccsensors
Thanks, that's in the tutorial, but makes sense here.
noobbait #4
Posted 01 October 2012 - 08:47 PM
Hey,

Love your script, but I get an error on my server complaining about "too long without a yield", have you come across it before?

Thanks
noobbait #5
Posted 01 October 2012 - 08:49 PM
Also what are the rules exactly for making the script remember the reactor parameters?

Ie .. the ice to uranium ratio and all that

Is rebooting enough or does the reactor data file have to be deleted each time too?
CoolisTheName007 #6
Posted 03 October 2012 - 11:05 AM
About the "too long without a yield":
When I forgot to put a sleep inside while loops, that happened. Just to play safe, I just used the program again in my world and everything worked. In case I made some dumb mistake copying the files, I copied it again to pastebin. I know for sure it works on a server, I tested it myself on a server which isn't mine.
I also added a 1 second sleep that wont diminish efficiency and shouldn't really be necessary, but should at least stop it from freezing; if it does stop freezing, it may have something to do with not using Tekkit 3.1.2, or putting other stuff other than ice, re-enriched cells or near-depleted cells in the reactor.
Another reason this may be happening is because you missed some part of the construction? I didn't make the program resistant to missing the sensor controller, for instance.
-So try copying it again and tell me what happens!

About resetting the program:
Also what are the rules exactly for making the script remember the reactor parameters?

Ie .. the ice to uranium ratio and all that

Is rebooting enough or does the reactor data file have to be deleted each time too?
So do you want it to remember? It should do that automatically, why to delete the reactor file (AR_reactors) if you want it to remember? Do you get pass the point where the monitor lits up with info?

Well,the script saves 2 files the first time you run the program, one is AR_reactors, and saves which reactors are to be monitored and the slots which must have ice for each of them. The other one is AR_params, and that saves the parameters. Both are saved to the disk. To reset, you have to delete both.
There's is no ice to uranium ratio, have you read it the written tutorial? Maybe it's too long and people just skip it, or maybe I forgot to put that in there?

Anyway thanks for the interest! I'm making a full video tutorial soon.
noobbait #7
Posted 03 October 2012 - 03:25 PM
I initially messed up the construction, the wire leading out of the bottom to disable the bundled cable was coming out of my disk drive not the computer (doh!, they all look the same from the back :(/>/> anyways ever since I fixed that it started refilling properly and stuff. My only issue now is the occasional yielding issue. I'll try the new pastebin version and let you know.
noobbait #8
Posted 03 October 2012 - 03:42 PM
I have a small suggestion as far as the main handler is concerned ..

throw in a term.restore() into the error handler at the bottom, this way when it crashes .. you can type on the small terminal :(/>/>

So anyways when I re-copied the script I diffed it before updating and there is a small change in the main loop where it sleep(1) ..

Altho I had it complain about yielding twice before I settled on a reboot ..

Maybe its sensitive to overloaded servers?

Would it be possible to use os.pullEvent in there somewhere? (does the sensor controller send out events when it updates?) they could be a good alternative to sleeping and I'm pretty sure those work a lot better for yielding (I've had a fancy rednet door system run forever without yield erroring)

Looking deeper .. even if the controller doesn't send events you could use os.startTimer to just wake up every X seconds instead of sleeping .. i think pullEvent is a lot more efficient than sleep and may avoid those issues.
noobbait #9
Posted 03 October 2012 - 03:45 PM
Hmm .. and 5 minutes later its back to the same error ..
Fatal_Exception #10
Posted 03 October 2012 - 11:23 PM
This is how sleep is implemented:
function sleep( _nTime )
  local timer = os.startTimer( _nTime )
  repeat
	local sEvent, param = os.pullEvent( "timer" )
  until param == timer
end

So there's no reason to manually use a timer.
noobbait #11
Posted 03 October 2012 - 11:48 PM
Hmm .. so much for that idea .. so why would it complain about not yielding if it gets to sit on a pull event for 5 seconds at a time … ?
noobbait #12
Posted 04 October 2012 - 05:07 PM
Interesting .. on a faster server its been behaving .. but I also peppered in a few sleep 0's in the main reactor update loops
CoolisTheName007 #13
Posted 04 October 2012 - 05:39 PM
Interesting .. on a faster server its been behaving .. but I also peppered in a few sleep 0's in the main reactor update loops

What do you mean with sleep 0's ? I'm really interested in making this work for everyone.
Has anyone tried the world save? I would like to get feedback on that.
I also had the idea to:
-get rid of external timers, any ideas on how to implement them, so that I can turn off/on the virtual timers with a simple function call?
-add a external redstone control to turn automation on/off, so that you can allow people to activate the program without actually giving them access to the computer. That should be simple with some checks for off orders in the loops and events for turning on.
grazazel #14
Posted 28 November 2012 - 12:42 PM
Hi great setup, 1 thing I think would help with the tutorial is if you add a list of all components used at the start, this would allow people to get all components ready
CoolisTheName007 #15
Posted 28 November 2012 - 01:12 PM
snip
This only works on single player.
grazazel #16
Posted 28 November 2012 - 10:28 PM
darn is there any work around for the sensors
CoolisTheName007 #17
Posted 29 November 2012 - 02:18 AM
snip
Bunch of people working on it.
DragonT4 #18
Posted 16 January 2013 - 12:27 AM
263: nil error. little help please lol s='Entry{name=\''..reactor.name..'\', target=\''..reactor.target..'\', sensor=\''..reactor.sensor..'\', size=\''..reactor.size..'\', pos=\''..reactor.pos..'\', ice_slots_start=\''..compress(reactor.ice_slots_start)..'\'}'
CoolisTheName007 #19
Posted 17 January 2013 - 12:32 AM
263: nil error. little help please lol s='Entry{name=\''..reactor.name..'\', target=\''..reactor.target..'\', sensor=\''..reactor.sensor..'\', size=\''..reactor.size..'\', pos=\''..reactor.pos..'\', ice_slots_start=\''..compress(reactor.ice_slots_start)..'\'}'
Sorry for the delay, I'm quite busy at the moment. Can you please post the full error? "nil error" isn't the full error, I'm sure. I'll try to fix it then.