Page 1 of 2

[REQUEST] UPS Friendly Nuclear Reactor

Posted: Tue Jul 03, 2018 7:53 pm
by Krelian
Hi, I just made my first megabase, feed by 28 nuclear reactors. Then reached the dreaded UPS hit. I Really dont like the idea of covering half the world in solar panels, so i want to stick with nuclear power. Plus I like the mini game of producing enriched uranium.
The problem (UPS wise) with nuclear reactors is, the heat and fluid mechanics. So I would like a simplified version that avoid that.

The request is rather simple (i think, i have ZERO knowledge of modding, or I would do this myself).

At the most basic but functional level:
A nuclear reactor just like the vanilla one, but that doesnt use fluids, or heat. Just place it, put a nuclear fuel inside, and it generates the Electricity of equivalent vanilla nuclear reactor + turbines would.

Slighty better:
A nuclear reactor, that also comes with a big turbine attached to a side (or one of those nuclear plant chimneys). The cost of the building should be what a reactor + heat exchangers + copper cables + turbines cost in vanilla.

Best version:
Like above, but the end with the turbine/chimney must be placed on water, to force the player to be near water, as in vanilla happens.

All of the above basically only ask nuclear fuel as imput, and output electricity. No fluids, no heat.

As I have seem most people use the 2x2 reactor setting, a single reactor should give 1/4 power of what vanilla 2x2 arrangement gives. In vanilla, the 2x2 + turbines produces 480 MW. So this one should produce 120 MW. The cost to build should be what in vanilla cost 1 reactor + 12 heat exchangers + 21 turbines, and a bunch of heat cables.

Well, that is it.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Wed Jul 04, 2018 8:01 am
by bobingabout
Currently, not possible via modding (Everything is possible via modding if you use scripts, just bear with me while I explain) because there is no template entity (something that exists already) that does what you want. Nothing takes in burner fuel (nuclear is just a category of burner power) and outputs electricity.

Most people who attempt to do this use complex entities, that's where you actually still have a nuclear reactor, boiler, and steam turbine all placed on top of each other, with their interactions controlled via scripts to move the heat and fluids, rather than heatpipes and pipes. If anything, this would just cause more UPS issues.

So, although possible to do what you want in a mod (put fuel in reactor, get power), it wouldn't achieve your intended goal (reduce UPS) because the method to do it would cause more UPS issues than it would solve.


I think the devs were going to try and do a fluid system overhaul for 0.17, they were talking about it at least, hopefully if they do this, it will reduce UPS problems for nuclear power.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Wed Jul 04, 2018 10:23 am
by Aeternus
Can an assembler prototype require a negative amount of power? If so it'd be real easy to do.
Assembler (Nuclear Reactor) with recipy: Power Generation (nuclear fuel -> spent nuclear fuel). 200s recipy time. -40 MW power "requirement". Module effects disallowed.

Alternative would be to do it by scripting. Assuming a static power supply can be created and turned on/off by script it'd be doable to make the above as well. It'd require some on-tick scripting through so I'm not sure if that'd be good ups wise.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Wed Jul 04, 2018 10:31 am
by darkfrei
Krelian wrote:At the most basic but functional level:
A nuclear reactor just like the vanilla one, but that doesnt use fluids, or heat. Just place it, put a nuclear fuel inside, and it generates the Electricity of equivalent vanilla nuclear reactor + turbines would.
Like RITEG? https://mods.factorio.com/mods/darkfrei/RITEG

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Wed Jul 04, 2018 11:20 am
by eradicator
bobingabout wrote:Most people who attempt to do this use complex entities, that's where you actually still have a nuclear reactor, boiler, and steam turbine all placed on top of each other, with their interactions controlled via scripts to move the heat and fluids, rather than heatpipes and pipes. If anything, this would just cause more UPS issues.
I tend to agree on the "most people would do this" part, but that's a stupid solution. You need three entities for this. A free fluid source, a standard boiler, and a standard generator. Put them next to each other so they input directely into each other. You can even let the player do this and just make them look nicely aligned. Bump all the values and voila, you just replaced 12 heat exchangers, 20 turbines and hundrets of (heat-)pipes with three entities that have a total of 4 fluid boxes. No scripting required. No need to use an actual nuclear-reactor prototype or heat. Would that improve performance? Yes. Would it make nuclear basically the same as a "super duper solar panel"? Yes.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 8:03 am
by bobingabout
eradicator wrote:
bobingabout wrote:Most people who attempt to do this use complex entities, that's where you actually still have a nuclear reactor, boiler, and steam turbine all placed on top of each other, with their interactions controlled via scripts to move the heat and fluids, rather than heatpipes and pipes. If anything, this would just cause more UPS issues.
I tend to agree on the "most people would do this" part, but that's a stupid solution. You need three entities for this. A free fluid source, a standard boiler, and a standard generator. Put them next to each other so they input directely into each other. You can even let the player do this and just make them look nicely aligned. Bump all the values and voila, you just replaced 12 heat exchangers, 20 turbines and hundrets of (heat-)pipes with three entities that have a total of 4 fluid boxes. No scripting required. No need to use an actual nuclear-reactor prototype or heat. Would that improve performance? Yes. Would it make nuclear basically the same as a "super duper solar panel"? Yes.
Actually, it depends how much you want the reactor functionallity (Constantly burn fuel when inserted if you need it or not, and have a neighbour bonus), because the boiler itself can burn fuel too, so you could set that to burn nuclear fuel, reducing the number of entities to 2. but at this point it's basically just nuclear powered boilers.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 12:35 pm
by eradicator
bobingabout wrote:Actually, it depends how much you want the reactor functionallity (Constantly burn fuel when inserted if you need it or not, and have a neighbour bonus), because the boiler itself can burn fuel too, so you could set that to burn nuclear fuel, reducing the number of entities to 2. but at this point it's basically just nuclear powered boilers.
Constant burn is a good argument, yea. For that you'd need an actual reactor, you'd end up with 4 entities then. Regarding neighbour bonus OP said he wants that baked into the entity, so that's not needed, though could be done anyway i guess. (Though it would look ugly as you'd have to do the numbers for full neighbour bonus, so the build-in turbine would show low available performance when not neighboured.) I'm not sure how you get down to two entities, because "nuclear boiler" is exactly what i described (water+boiler+turbine=3).

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 4:17 pm
by Krelian
bobingabout wrote:Currently, not possible via modding (Everything is possible via modding if you use scripts, just bear with me while I explain) because there is no template entity (something that exists already) that does what you want. Nothing takes in burner fuel (nuclear is just a category of burner power) and outputs electricity.

Most people who attempt to do this use complex entities, that's where you actually still have a nuclear reactor, boiler, and steam turbine all placed on top of each other, with their interactions controlled via scripts to move the heat and fluids, rather than heatpipes and pipes. If anything, this would just cause more UPS issues.

So, although possible to do what you want in a mod (put fuel in reactor, get power), it wouldn't achieve your intended goal (reduce UPS) because the method to do it would cause more UPS issues than it would solve.


I think the devs were going to try and do a fluid system overhaul for 0.17, they were talking about it at least, hopefully if they do this, it will reduce UPS problems for nuclear power.

Thanks for the thoughtful reply Bob.
As I mentioned earlier, I have no experience with modding, so this probably is wrong, but wouldn't a script that activates every 200 seconds (what in vanilla nuclar fuel last) that makes a solar panel disguised as nuclear reactor, take one nuclear fuel and make it dissapear, be less UPS consuming, than the whole standard nuclear plant setup, with hundred of pipes, heat cables, turbines and heat exchangers updating every tick?

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 4:20 pm
by Krelian
darkfrei wrote:
Krelian wrote:At the most basic but functional level:
A nuclear reactor just like the vanilla one, but that doesnt use fluids, or heat. Just place it, put a nuclear fuel inside, and it generates the Electricity of equivalent vanilla nuclear reactor + turbines would.
Like RITEG? https://mods.factorio.com/mods/darkfrei/RITEG
Didn't knew that mod, but it is not what I am looking for. That looks more like a giant Solar panel to me, place and forget. As Bob explained, probable that's what the mod's author used as a template. Thanks for the suggestion anyway.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 4:25 pm
by Krelian
eradicator wrote:
bobingabout wrote:Actually, it depends how much you want the reactor functionallity (Constantly burn fuel when inserted if you need it or not, and have a neighbour bonus), because the boiler itself can burn fuel too, so you could set that to burn nuclear fuel, reducing the number of entities to 2. but at this point it's basically just nuclear powered boilers.
Constant burn is a good argument, yea. For that you'd need an actual reactor, you'd end up with 4 entities then. Regarding neighbour bonus OP said he wants that baked into the entity, so that's not needed, though could be done anyway i guess. (Though it would look ugly as you'd have to do the numbers for full neighbour bonus, so the build-in turbine would show low available performance when not neighboured.) I'm not sure how you get down to two entities, because "nuclear boiler" is exactly what i described (water+boiler+turbine=3).
I actually like your idea. Disguise a Boiler and a Generator as a Nuclear reactor and nuclear plant, make it use exclusively Nuclear fuel, and boost their stats to match a vanilla nuclear setup. Three entities is much better than the hundreds it will be reeplacing. That's brilliant.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 4:44 pm
by eradicator
Krelian wrote:I actually like your idea. Disguise a Boiler and a Generator as a Nuclear reactor and nuclear plant, make it use exclusively Nuclear fuel, and boost their stats to match a vanilla nuclear setup. Three entities is much better than the hundreds it will be reeplacing. That's brilliant.
Here's how i'd build it, notice that all entities connect directly to each other:
easy_reactor.png
easy_reactor.png (27.52 KiB) Viewed 6658 times
As the factorio engine (does it have a catchy name yet?) supports graphic layering you could even repurpose the original graphics and make i.e. the turbine look like 20 turbines graphically (minus the steam probably). Still a bit tricky to make for a total modding beginner, but nothing undoable.

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 4:46 pm
by Krelian
eradicator wrote:
Krelian wrote:I actually like your idea. Disguise a Boiler and a Generator as a Nuclear reactor and nuclear plant, make it use exclusively Nuclear fuel, and boost their stats to match a vanilla nuclear setup. Three entities is much better than the hundreds it will be reeplacing. That's brilliant.
Here's how i'd build it, notice that all entities connect directly to each other:
easy_reactor.png
As the factorio engine (does it have a catchy name yet?) supports graphic layering you could even repurpose the original graphics and make i.e. the turbine look like 20 turbines graphically (minus the steam probably). Still a bit tricky to make for a total modding beginner, but nothing undoable.
Still a bit tricky to make for a total modding beginner, but nothing undoable

That is why I posted this on Request forum :oops:

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 5:03 pm
by eradicator
Krelian wrote:That is why I posted this on Request forum :oops:
I know nobody tells you that, but look at the other posts in this forum and the number of replies they have.
Reality says: Make it yourself or it won't happen unless you win the lottery. The constraint on making mods is not a lack of ideas, it's a lack of time. And - speaking for myself - i'm more motivated making my own ideas happen in that limited time ;).

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 6:15 pm
by Krelian
eradicator wrote:
Krelian wrote:That is why I posted this on Request forum :oops:
I know nobody tells you that, but look at the other posts in this forum and the number of replies they have.
Reality says: Make it yourself or it won't happen unless you win the lottery. The constraint on making mods is not a lack of ideas, it's a lack of time. And - speaking for myself - i'm more motivated making my own ideas happen in that limited time ;).
Oh... thanks for the heads up on the meta xD, it makes sense.
I will be reading some tutorials then.
regards

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 7:53 pm
by darkfrei
Krelian wrote:
Didn't knew that mod, but it is not what I am looking for. That looks more like a giant Solar panel to me, place and forget. As Bob explained, probable that's what the mod's author used as a template. Thanks for the suggestion anyway.
It's not a type of cheat, the total energy is 40 GJ and only on start has power 600 kW. If you don't use it, the energy will be also decreased.

You can ask the help on this forum viewforum.php?f=25

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Thu Jul 05, 2018 8:32 pm
by eradicator
Krelian wrote:Oh... thanks for the heads up on the meta xD, it makes sense.
I will be reading some tutorials then.
regards
I recommend concentrating on making the new reactor "buildings" (==entities/prototypes) first. Making new buildings is quite easy once you understand the basics. The tricky part will be writing the script that makes them feel "like one thing" in the game, if you want that. I also noticed, that if you slam in a tank into my earlier layout, you can keep the possibility of steam-readout and thus the ability to built a circuit-controlled fuel management. Or you could slam an accu in the back for a similar effect.
easy_reactor.png
easy_reactor.png (33.25 KiB) Viewed 6619 times
Fake graphics like this? (hm wait....would it need twice as many turbines for 4 reactors?)
easy-reactor-mockup.jpg
easy-reactor-mockup.jpg (442.95 KiB) Viewed 6585 times

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Mon Aug 27, 2018 9:50 am
by mrudat
Would it work to,

Have two chests and a half-accumulator placed down as part the 'nuclear power plant' entity.

The accumulator would have the equivalent capacity to the steam holding tanks, presumably 2-3 times as much energy as in a single set of nuclear fuel cells.

It would have a charge throughput of 0, and a discharge throughput of n * steam turbine power.

A script would run once every 100 seconds or so, and:
  • check that
    • there is enough empty capacity in the accumulator to store another set of nuclear fuel
    • there are enough fuel cells to feed all of the internal 'reactors'
    • there is enough room to store the used up fuel cells in the output chest
  • If the checks pass
    • add the energy to the accumulator - I know Factorissimo2 does this for energy transfer every tick (by default)
    • remove the fuel cells from the input chest
    • delay for 200 seconds, then dump the used up fuel cells into the output chest
I'm reasonably certain that this matches the behaviour of a nuclear power plant, but has far fewer moving pieces.

Actually, thinking about it a little more, I think it might be possible to do better (perhaps).

I believe that a mod can subscribe to a circuit network interface, and it is only called when the values change, so, in theory:
  • (boldly assuming we can get accumulator charge circuit connection out of fake accumulator) wire 'accumulator' to decider combinator, for when it's under 50% full
  • wire decider output to an 'inserter' interface that triggers the above script

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Mon Aug 27, 2018 4:31 pm
by eradicator
mrudat wrote: I believe that a mod can subscribe to a circuit network interface, and it is only called when the values change
Nope. What you mean is checking .fulfilled on a CircuitConditionSpecification. You still need to do that in on_tick. And any sort of circuit access is slow in lua. "Fullfilled" is only popular because it's way faster than reading the whole circuit connection and verifying conditions on the lua side.

Would "scripting stuff every 100 200 seconds" work? Sure. 200 seconds == one fuel cycle.
But as the thread asks explicitly for UPS friendly any sort of scripting is undesirable. I mean...otherwise you could just script a "batch reactor" that fills a huge accumulator once per hour and consumes a whole stack of fuel cells or something (which would still cause relevant script overhead if there aren't enough input cells).

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Mon Aug 27, 2018 10:43 pm
by mrudat
I suspect that a script run once every 200 seconds (per power plant) might be cheaper (at present, at least) than 3 fluid-box-connections per power-plant running constantly (pump->boiler, boiler->tank, tank->turbine), but I'm uncertain of the relative costs of 3 fluid box connections for 200s vs a script run once every 200s. Could be worth doing a benchmark?

Re: [REQUEST] UPS Friendly Nuclear Reactor

Posted: Tue Aug 28, 2018 4:19 am
by eradicator
mrudat wrote:I suspect that a script run once every 200 seconds (per power plant) might be cheaper (at present, at least) than 3 fluid-box-connections per power-plant running constantly (pump->boiler, boiler->tank, tank->turbine), but I'm uncertain of the relative costs of 3 fluid box connections for 200s vs a script run once every 200s. Could be worth doing a benchmark?
The point i wanted to make is "how accurate do you want the simulation to be." My suggestion above simulates correctly on a per-tick basis (and can take in actual water if that part is desirable). And as i said, you can reduce the cost of any script-based solution by increasing the delay to arbitrarily high numbers. Script based solutions also don't get any animations, you just get a static "magic box" → less immersion. And also writing distributed on_tick scripts is far more error prone than just spawning a few entities from a coding perspective.

Feel free to do a benchmark...