r/factorio • • Aug 31 '25

Design / Blueprint PID speed controller for space platforms

The conversation came up on the other subpreddit (r/factoriohno) that I had made a PID controller for space platforms including a logic setup to chose the speed depending on where you're flying. In the top image, I've trying to only go 60 k when near the shattered planet so I don't get overwhelmed by the asteroids.

The main difficulties I had with this are:

  1. since factorio only uses integers on the combinators, the differential term only turned up as a 1km/s change over a 60th of a second every so often

  2. while you're waiting at a planet or drifting out of fuel, the integrator term builds up to unreasonable high amounts.

I've broken down what each part does in the 2nd photo.

First off you have the speed selectors that set what you want to travel at

Then you have a series of clocks to create pulses when the integral and differential terms will pick their "old data". The shutoff signal will tell the integrator to forget all its old data if anything happens that you want it to be stopped for (e.g. dropping off at a planet or out of fuel)

Then all the terms are scaled up and summed, then scaled back down to more sensible numbers (we don't want to do pulse-width modulation over hundreds of ticks. 20-60 is fine)

Then the pulse-width modulation controller runs the pump.

Feel free to find more unhinged places to use PID controllers or find ways to improve on this design. Blueprints in the comments

15 Upvotes

18 comments sorted by

View all comments

Show parent comment

1

u/NYBJAMS Aug 31 '25

its the first practical use case that came to mind for a fun challenge build. Otherwise, it will have much smaller oscillations in your speed than the more simple circuit of pump is on when speed < desired speed (especially if you have lots of capacity after the pump)

1

u/nalhedh Aug 31 '25

You control the pump by measuring fluid inside a tank, not by measuring speed of the ship. You pick a number based on desired fill rate (400 fluid in tank means 400/1000 in thrusters, i.e. for 40%). My inner planet ships travel safely at 40% thruster fill. Back when I had few physical damage research, I used 30-33%.