SHOW:
|
|
- or go back to the newest paste.
1 | -- Title: ComputerCraft BigReactor automatic throttling software for Active reactors. | |
2 | -- Author: MyrddinE | |
3 | -- | |
4 | -- Throttles the reactor based on the level of hot fluid. Because the hot fluid buffer | |
5 | -- is small compared to the generation speed, it updates several times a second to | |
6 | -- maintain the proper temperature. | |
7 | ||
8 | -- Update this to match your reactor's steam volume. | |
9 | - | maxSteam = 9800 |
9 | + | maxSteam = 17200 |
10 | ||
11 | -- Set this to the side your monitor is on, or blank for no monitor. If the monitor is | |
12 | -- connected via a wired modem, set this to the full name of the monitor. | |
13 | - | monitor = '' |
13 | + | monitor = 'top' |
14 | -- monitor = 'right' | |
15 | ||
16 | -- Stick the computer right on the port. If the reactor is attached via a wired modem, | |
17 | -- change the wrap to the full name of the Reactor. | |
18 | reactor = peripheral.wrap('back') | |
19 | ||
20 | -- Sets the monitor to a wrapped peripheral if you have one. | |
21 | if #monitor > 0 then | |
22 | monitor = peripheral.wrap(monitor) | |
23 | width,height = monitor.getSize() | |
24 | monitor.setCursorPos(1,height) | |
25 | else | |
26 | monitor = false | |
27 | end | |
28 | ||
29 | local rod = 70 | |
30 | targetSteam = math.ceil(maxSteam*0.5) | |
31 | ||
32 | -- Run forever. | |
33 | - | rod = math.ceil(100*steam/maxSteam) |
33 | + | |
34 | - | reactor.setAllControlRodLevels(rod) |
34 | + | |
35 | steam = reactor.getHotFluidAmount() | |
36 | rod = (reactor.getControlRodLevel(1) - 1/targetSteam*(targetSteam - steam)) | |
37 | reactor.setAllControlRodLevels(rod) | |
38 | ||
39 | ||
40 | ||
41 | -- Everything below just drives a scrolling monitor display. | |
42 | if monitor then | |
43 | temp = math.floor(reactor.getCasingTemperature()).."C" | |
44 | monitor.scroll(2) | |
45 | monitor.setCursorPos(1,height) | |
46 | monitor.write(rod.."%") | |
47 | monitor.scroll(1) | |
48 | - | sleep(.2) |
48 | + | |
49 | monitor.write(temp) | |
50 | end | |
51 | ||
52 | -- Sleep for a moment. | |
53 | sleep(1) | |
54 | end |