Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --ctrlRod,power,fuel,tempCore,tempCase
- fileName="test1.csv"
- file=fs.open(fileName,"w")
- file.writeLine("rodLevel,prodRate,fuelRate,coreTemp,caseTemp")
- file.writeLine("%,fe/t,mb/t,°C,°C")
- file.close()
- ctrlRod = 100
- powerProd,fuelRate,tempCore,tempCase=0,0,0,0
- reactor = peripheral.wrap("back")
- function saveData()
- file=fs.open(fileName,fs.exists(fileName) and "a" or "w")
- print(string.format("%d ,%d ,%.4f ,%d ,%d",ctrlRod,powerProd,fuelRate,tempCore,tempCase))
- file.writeLine(string.format("%d ,%d ,%.4f ,%d ,%d",ctrlRod,powerProd,fuelRate,tempCore,tempCase))
- file.close()
- end
- function measure()
- points = 0
- powerProd,fuelRate,tempCore,tempCase=0,0,0,0
- while points < 20 do
- points = points + 1
- powerProd = powerProd+reactor.getEnergyProducedLastTick()
- fuelRate = fuelRate+reactor.getFuelConsumedLastTick()
- tempCore = tempCore+reactor.getFuelTemperature()
- tempCase = tempCase+reactor.getCasingTemperature()
- sleep(0.25)
- end
- powerProd = powerProd/points
- fuelRate = fuelRate/points
- tempCore = tempCore/points
- tempCase = tempCase/points
- end
- reactor.setAllControlRodLevels(ctrlRod)
- reactor.setActive(true)
- print("waiting for cooling")
- while reactor.getEnergyProducedLastTick() > 10 do
- sleep(2)
- end
- print("starting")
- while ctrlRod >=0 do
- reactor.setAllControlRodLevels(ctrlRod)
- sleep(15)
- measure()
- --print(string.format("rod:%d power:%dfe/t rate:%.4fmb/t core:%d°C case :%d°C",ctrlRod,powerProd,fuelRate,tempCore,tempCase))
- saveData()
- ctrlRod = ctrlRod-1
- end
- print("done")
- reactor.setActive(false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement