[MOD 0.18] RITEG
- Omnifarious
- Filter Inserter
- Posts: 278
- Joined: Wed Jul 26, 2017 3:24 pm
- Contact:
Re: [MOD 0.16] RITEG
This is really balanced. You'll get about the same energy from a single RITEG as you would from your fuel cells in a reactor with no neighbor bonus.
40MW * 200 seconds * 5 fuel cells = 40GJ
Integrating the power output curve over 32 half lives:
integrate 600000*e^(x*(-ln(2)/(12*60*60))) dx from x=0 to 16*12*60*60 means you get 37.39GJ in total out of your RITEG.
You did your math.
The reactor should last for about 398684 or 398685 seconds (aka 12 * 60 * 60 * log(600) / log(2)) which yields about 37.332 GJ of energy during the reactor's actual lifetime, which is only about 9.2 half-lives.
40MW * 200 seconds * 5 fuel cells = 40GJ
Integrating the power output curve over 32 half lives:
integrate 600000*e^(x*(-ln(2)/(12*60*60))) dx from x=0 to 16*12*60*60 means you get 37.39GJ in total out of your RITEG.
You did your math.
The reactor should last for about 398684 or 398685 seconds (aka 12 * 60 * 60 * log(600) / log(2)) which yields about 37.332 GJ of energy during the reactor's actual lifetime, which is only about 9.2 half-lives.
Re: [MOD 0.16] RITEG
It's more balanced as you think. The energy in the new RITEG is 5 x 8GJ exactly, also at the first moment will be exactly 600 kW output power.
The half life period will be calculated for this energy and this power so, that all maths will be always correct.
Exactly maths for new RITEG-1:
starting power: 10000*60 W
half life: 46209.812 seconds or 12,83 hours
starting energy: 40000000000 J or 40 GJ
Energy after 16's half period:
integrate 600000*e^(x*(-ln(2)/(46209.812))) dx from x=0 to 16*(46209.812) = 3.99994 * 10^10 J = 40 GJ
The half life period will be calculated for this energy and this power so, that all maths will be always correct.
Exactly maths for new RITEG-1:
starting power: 10000*60 W
half life: 46209.812 seconds or 12,83 hours
starting energy: 40000000000 J or 40 GJ
Energy after 16's half period:
integrate 600000*e^(x*(-ln(2)/(46209.812))) dx from x=0 to 16*(46209.812) = 3.99994 * 10^10 J = 40 GJ
Re: [MOD 0.16] RITEG
autodeconstruct draft
recommended with recursive blueprints
locale.cfg
diff unified patch RITEG-control.lua
settings.lua
recursive bp POC
recommended with recursive blueprints
locale.cfg
Code: Select all
...
[mod-setting-name]
__RITEG__autodeconstruct-is-enabled=Autodeconstruct
__RITEG__autodeconstruct-health-threshold=Threshold
[mod-setting-description]
__RITEG__autodeconstruct-is-enabled=Enable autodeconstruct the RITEG when it falls below the threshold percentage value
__RITEG__autodeconstruct-health-threshold=Threshold value in percentage for autodeconstruct. When the the RITEG health falls below the threshold it will be marked for autodeconstruct by bot. Valid values: [5,90]
diff unified patch RITEG-control.lua
Code: Select all
@@ -1,5 +1,6 @@
-- local E = 40 -- GJ
-- local P = 600 -- kW
+local mod_name = "__RITEG__"
local ln_2 = 0.69314718
local rtg_names_list = {'RITEG-1'}
local RTG_prop =
@@ -12,11 +13,28 @@
try_init ()
update_recipes ()
add_all_rtgs_to_table ()
+ update_settings ()
end)
+-- update riteg settings
+function update_settings (event)
+ global.rtgs_settings["enabled"] = settings.global[ mod_name .. "autodeconstruct-is-enabled" ].value
+ global.rtgs_settings["threshold"] = settings.global[ mod_name .. "autodeconstruct-health-threshold" ].value
+
+ global.rtgs_settings["max_healths"] = {}
+ for i, e in pairs (rtg_names_list) do
+ global.rtgs_settings["max_healths"][e] = game.entity_prototypes[e].max_health
+ end
+end
+
+-- call update_settings when on_runtime_mod_setting_changed
+script.on_event(defines.events.on_runtime_mod_setting_changed, update_settings)
+
+
script.on_init(function(data)
try_init ()
update_recipes ()
+ update_settings ()
end)
function is_element_in_list (element, list)
@@ -80,6 +98,7 @@
if not global.rtgs then global.rtgs = {} end
if not global.tick_id then global.tick_id = 1 end
if not global.total_rtgs then global.total_rtgs = 0 end
+ if not global.rtgs_settings then global.rtgs_settings = {} end
end
script.on_event(defines.events.on_built_entity, function(event)
@@ -145,6 +164,15 @@
rtg.entity.health = math.floor(power/(50/3))
end
-- end of new code
+
+ -- autodeconstuct
+ if global.rtgs_settings["enabled"] == true then
+ local threshold_health = ( global.rtgs_settings["threshold"] * global.rtgs_settings["max_healths"][rtg.entity.name]) / 100
+ if rtg.entity.health < threshold_health then
+ rtg.entity.order_deconstruction(rtg.entity.force)
+ end
+ end
+ -- end of autodeconsturt
--printAll('RITEG [' .. global.tick_id .. '] has power ' .. rtg['power'] .. 'W and half_life = ' .. rtg['half_life'] .. 's')
global.tick_id = global.tick_id + 1
Code: Select all
local mod_name = "__RITEG__"
data:extend({
{
type = "bool-setting",
name = mod_name .. "autodeconstruct-is-enabled",
setting_type = "runtime-global",
default_value = true,
order = "aa",
},
{
type = "int-setting",
name = mod_name .. "autodeconstruct-health-threshold",
setting_type = "runtime-global",
minimum_value = 5,
maximum_value = 90,
default_value = 5,
order = "ab",
}
})
- Attachments
-
- RITEG_0.1.6.ZIP
- (265.13 KiB) Downloaded 128 times
Re: [MOD 0.16] RITEG
Thanks for your code, it was helpful.
Added new version with auto deconstruct and replacing of old RITEGs.
- Omnifarious
- Filter Inserter
- Posts: 278
- Joined: Wed Jul 26, 2017 3:24 pm
- Contact:
Re: [MOD 0.16] RITEG
Any plans to update this for 0.17?
Last edited by Omnifarious on Mon Mar 04, 2019 1:16 am, edited 2 times in total.
Re: [MOD 0.16] RITEG
Yes, probably today.
- Omnifarious
- Filter Inserter
- Posts: 278
- Joined: Wed Jul 26, 2017 3:24 pm
- Contact:
Re: [MOD 0.17] RITEG
Hey! I was wondering, if I am being retarded, or if you mistyped something? In the recipe for the RITEG I get a strange error -
I know that I do have the Simple Silicon mod, which alters the recipe of the t2 and t3 circuits. Do you mind helping me out finding the cause for this problem?
Pony/Furfag avatar? Opinion discarded.
Re: [MOD 0.17] RITEG
Thanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
https://mods.factorio.com/mod/PlutoniumEnergy
Last edited by darkfrei on Fri Jun 07, 2019 5:24 pm, edited 1 time in total.
Re: [MOD 0.17] RITEG
Your reply rate is higher than any corporate b2b support I have ever worked with . Thank you.darkfrei wrote: βFri Jun 07, 2019 7:03 amThanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
Pony/Furfag avatar? Opinion discarded.
Re: [MOD 0.17] RITEG
Updated, it was earlier an alternative for advanced circuitaka13 wrote: βFri Jun 07, 2019 8:23 amYour reply rate is higher than any corporate b2b support I have ever worked with . Thank you.darkfrei wrote: βFri Jun 07, 2019 7:03 amThanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
Multiple calculations per tick, not tested
- Attachments
-
- 2019-06-07T21_12_05-Factorio 0.17.45.png (118.37 KiB) Viewed 4027 times
Last edited by darkfrei on Mon Jan 27, 2020 9:54 pm, edited 1 time in total.
Re: [MOD 0.17] RITEG
Thank you very much! It works great. And of course, thank you for your mod. A pleasure to play.darkfrei wrote: βFri Jun 07, 2019 7:19 pmUpdated, it was earlier an alternative for advanced circuitaka13 wrote: βFri Jun 07, 2019 8:23 amYour reply rate is higher than any corporate b2b support I have ever worked with . Thank you.darkfrei wrote: βFri Jun 07, 2019 7:03 amThanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
Pony/Furfag avatar? Opinion discarded.
Re: [MOD 0.18] RITEG
https://mods.factorio.com/mod/RITEG/dis ... a405f0bf3a
Crash on changing map-wide settings, possibly due to RITEGs being cloned by warptorio2?
Crash on changing map-wide settings, possibly due to RITEGs being cloned by warptorio2?
Re: [MOD 0.18] RITEG
I don't know how to do that. I have problems with Lua Remote.mrudat wrote: βTue Aug 25, 2020 4:44 pm https://mods.factorio.com/mod/RITEG/dis ... a405f0bf3a
Crash on changing map-wide settings, possibly due to RITEGs being cloned by warptorio2?