Rate-limited Pumps Mod?

Looking for a mod? Have a review on a mod you'd like to share?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

Raiguard wrote:
Wed Sep 23, 2020 8:20 pm
The only way I can foresee going about this is to add 10,000 different pump prototypes that each have a different pumping rate. You simply cannot change a pump's flow rate at runtime, so barring an addition to the base game, it'll have to do.
InfinityPipeFilter.percentage has value type double. It's just the gui that imposes limits on the value range.
Attachments
1.png
1.png (14.32 KiB) Viewed 3193 times
1337.png
1337.png (15.62 KiB) Viewed 3193 times
5999.png
5999.png (21.35 KiB) Viewed 3193 times
6of9.png
6of9.png (15.9 KiB) Viewed 3193 times
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

eradicator wrote:
Wed Sep 23, 2020 9:28 pm
InfinityPipeFilter.percentage has value type double. It's just the gui that imposes limits on the value range.
Yeah, I realized this after posting as well. Regardless, I'm working with the devs and it's fairly likely that a solution will be made using the infinity pipe. Stay tuned.
Don't forget, you're here forever.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

Factorio 1.1 will let you set infinity pipes to constantly add or remove a certain amount of liquid to/from themselves. This lets you test input or output rates, but does not let you rate-limit in the middle of a system. I will see about making it so pumps can have their speed changed at runtime for that usecase.
Don't forget, you're here forever.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Rate-limited Pumps Mod?

Post by Qon »

Raiguard wrote:
Wed Sep 23, 2020 8:20 pm
The only way I can foresee going about this is to add 10,000 different pump prototypes that each have a different pumping rate. You simply cannot change a pump's flow rate at runtime, so barring an addition to the base game, it'll have to do.
Raiguard wrote:
Sat Sep 26, 2020 12:29 am
Factorio 1.1 will let you set infinity pipes to constantly add or remove a certain amount of liquid to/from themselves. This lets you test input or output rates, but does not let you rate-limit in the middle of a system. I will see about making it so pumps can have their speed changed at runtime for that usecase.
Instead of having 10k prototypes, add one for each power of two and do a binary numbers addition of them. then it's just log2(n) pump entities required for precision down to 1/tick. For flow up to 12k/second or 720k/tick that's just 20 static entities needed.

If it's possible to make multi-entity pumps just like the miniloader is composed of several hidden inserters then you could also make it a single dynamic entity to the player.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

Qon wrote:
Sat Sep 26, 2020 9:08 am
Instead of having 10k prototypes, add one for each power of two and do a binary numbers addition of them. then it's just log2(n) pump entities required for precision down to 1/tick. For flow up to 12k/second or 720k/tick that's just 20 static entities needed.
That was actually my first thought. But unlike inserters you can't have more than one (working) fluid box per tile as far as i understand. So you'd need a complicated mess of parallel pumps with manifold-mod style pipes and the whole thing would need to be 5x5+ to get anywhere. And the tooltip wouldn't work either ofc.

And well, infinipipes already have that precision anway.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

Qon wrote:
Sat Sep 26, 2020 9:08 am
Instead of having 10k prototypes, add one for each power of two and do a binary numbers addition of them. then it's just log2(n) pump entities required for precision down to 1/tick. For flow up to 12k/second or 720k/tick that's just 20 static entities needed.

If it's possible to make multi-entity pumps just like the miniloader is composed of several hidden inserters then you could also make it a single dynamic entity to the player.
That's a smart idea, though I'm not too sure if it would be able to work completely properly. I haven't really messed with fluids all that much.

Another idea someone had was to make a few different speed pumps, then use control behavior to enable/disable them at certain intervals to simulate a certain amount of throughput. But that would incur a running performance cost that I would like to avoid if I can.

Hopefully, pumps will just straight-up gain the ability to change their pumping speed. We'll see.
Don't forget, you're here forever.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Rate-limited Pumps Mod?

Post by Qon »

eradicator wrote:
Sat Sep 26, 2020 3:03 pm
But unlike inserters you can't have more than one (working) fluid box per tile as far as i understand.
Awwww :(
eradicator wrote:
Sat Sep 26, 2020 3:03 pm
And well, infinipipes already have that precision anway.
Yes, but I suggested this for flow rate limiting, not fluid creation limiting. If you want reduced flow in a system of fluids that are created in a non-cheated way or want to appy the rate limiting anywhere after the creation then this is needed.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by darkfrei »

Raiguard wrote:
Sat Sep 26, 2020 5:11 pm
Hopefully, pumps will just straight-up gain the ability to change their pumping speed. We'll see.
The offshore pump doesn't support any fuel. It's impossible to make them depended from electric energy or fuel generator.

But you can make an assembling machine, that looks like the offshore pump and makes the water from nothing. For example 1 fluid of water per second.

Yoyobuae
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by Yoyobuae »

Workaround #2:
Screenshot_2020-09-26_21-31-45.png
Screenshot_2020-09-26_21-31-45.png (243.96 KiB) Viewed 2848 times
Just like every other machine in Factorio, the speed of a pump is proportional to the amount of power it is supplied with. Vanilla pumps have a pretty crap power usage value of 29kW which translates to 483.333333333 J/tick. Such a value is a pain to work with so instead I made my own pump.

My modified pump doesn't have any power drain and has a power usage of 720kW which translates to 12000 J/tick. So supplying this pump with 1 J/tick slows down its pump rate to 1 fluid/s, so it becomes extremely easy to set the exact pump rate by configuring the Electric Energy Interface that's supplying it with power.

The cool thing about Electric Energy Interfaces is that they can be configured at runtime via Lua API.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

Has the rather large drawback of being unusable inside an existing factory though. Or with typical "creative" style wide-area power poles. But it's a very nice approach.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Yoyobuae
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by Yoyobuae »

eradicator wrote:
Sun Sep 27, 2020 3:51 am
Has the rather large drawback of being unusable inside an existing factory though. Or with typical "creative" style wide-area power poles. But it's a very nice approach.
Also works with burner energy source.

To control the amount of energy fed per tick in that case requires using fuels with specific fuel values (1 J fuel = 1 J/tick). The maximum item stack size is 4294967295, which should last pretty much forever.

EDIT: Or with a fluid energy source:
Screenshot_2020-09-27_00-01-06.png
Screenshot_2020-09-27_00-01-06.png (208.79 KiB) Viewed 2771 times
Fluid energy sources are particularly interesting because fluids can have different temperature, and the temperature controls their energy content. So with the right setup of heat capacity, and fluid consumption rate one can precisely control the energy available to the pump. In the above screenshot I setup things such that 1ºC = 1J = 1 fluid/s.

EDIT2: This would've been a lot easier if there was an energy_source type which allows directly setting the J/tick power supply, configurable from Lua API.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

Yoyobuae wrote:
Sun Sep 27, 2020 3:59 am
Fluid energy source
Holy crap, you're a genius. The fluid energy source method works perfectly, and I have implemented it into Editor Extensions:

Image

(note: you can set any integer value between 0 - 30,000, not just the slider increments)

Now I need to add the circuit and logistic connections to this GUI so you can continue using them if you want...
Don't forget, you're here forever.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

Raiguard wrote:
Tue Sep 29, 2020 1:00 am
(note: you can set any integer value between 0 - 30,000, not just the slider increments)
Any particular reason why the upper limit is so low?
I.e. the Electric Energy Interface also has a GUI slider with a much lower range than the actually allowed values - allowing advanced usage without making the gui clunky to use.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

eradicator wrote:
Tue Sep 29, 2020 1:27 am
Raiguard wrote:
Tue Sep 29, 2020 1:00 am
(note: you can set any integer value between 0 - 30,000, not just the slider increments)
Any particular reason why the upper limit is so low?
I.e. the Electric Energy Interface also has a GUI slider with a much lower range than the actually allowed values - allowing advanced usage without making the gui clunky to use.
Vanilla pumps are only capable of 12,000 per second, and you can only achieve that with storage tanks. With a regular vanilla pipe, the max limit is 6000 / second. I feel like 30,000 is a good high number, but it would be fairly trivial to increase it if needed.

Edit: should mention that the upper limit is based on the prototype, so adjusting the upper limit requires tweaking the pump's prototype properties.
Don't forget, you're here forever.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

Raiguard wrote:
Tue Sep 29, 2020 1:32 am
Vanilla pumps are only capable of 12,000 per second, and you can only achieve that with storage tanks. With a regular vanilla pipe, the max limit is 6000 / second. I feel like 30,000 is a good high number, but it would be fairly trivial to increase it if needed.
Well, mods do crazy things sometimes. And for testing crazy builds (or crazy mods ;) higher numbers might come in handy. Huge tanks are not uncommon either, and 30 seems like a strangely odd number. And above all: This is factorio. So increasing the manual input limit to 100k or 1M without changing the slider limits might come in handy.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

eradicator wrote:
Tue Sep 29, 2020 1:38 am
Well, mods do crazy things sometimes. And for testing crazy builds (or crazy mods ;) higher numbers might come in handy. Huge tanks are not uncommon either, and 30 seems like a strangely odd number. And above all: This is factorio. So increasing the manual input limit to 100k or 1M without changing the slider limits might come in handy.
Fair enough. I increased the non-slider maximum to 600,000 / s. Unfortunately I can't make it a nice, round number like 1M because the number has to be divisible by 60 in order to avoid rounding errors.
Don't forget, you're here forever.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

That sounds like a good factorian compromise :). Thanks.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

There's one minor flaw with the super pump that I've found: in order to make the throughput capabilities so ridiculous, I had to give the pump's fluidbox a ridiculous height (1500, vs. a regular pipe's 1). Because of this, if the output backs up, the pipe will amass a ridiculous amount of buffer. And if a new output is connected (i.e. a storage tank), the pump will practically teleport its buffer into that tank because it will run at max speed for a few ticks.

I'm not sure that there's anything I can do about it, but if anyone has any ideas, I'm all ears!
Don't forget, you're here forever.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Rate-limited Pumps Mod?

Post by eradicator »

Raiguard wrote:
Tue Sep 29, 2020 2:19 am
I'm not sure that there's anything I can do about it, but if anyone has any ideas, I'm all ears!
You mean other than listening to on_built and active=false'ing the pump unless both sides are connected?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 447
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Rate-limited Pumps Mod?

Post by raiguard »

eradicator wrote:
Tue Sep 29, 2020 2:35 am
You mean other than listening to on_built and active=false'ing the pump unless both sides are connected?
Well, this thread is full of good insight! I'll try that. Thanks! :)
Don't forget, you're here forever.

Post Reply

Return to “Questions, reviews and ratings”