How can I get the distance travelled by space platform?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Pithlit
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Sep 12, 2019 7:43 pm
Contact:

How can I get the distance travelled by space platform?

Post by Pithlit »

TL;DR: I would like to read or calculate the travelled distance of my space plattform.

My motivation:
Different areas in space have different densities of asteroids and asteroid chunks.
I would like to automatically adjust the thrust of my space platform, depending on the area of space it is travelling through. (Slower in resourche-rich environments, faster in dangerous areas.)

My approach:
At first, I thought I could just read the distance travelled from the hub and use some combinator logic. Unfortunately the hub does not provide the travelled distance, but only values from and to where the platform currently travels. But there is one promising value: speed

So I can detect the moment, where the travel begins when the destination signals change, and I get the current speed - so I can calculate the distance traveled by constantly adding the speed value. Together with the values of the travel source and destination I could calculate where the space platform currently is. At least that's what I thought.

My combinators:
Hub: read speed (in km/s) -> V
Distance: D + V -> D (loops back to it's own entry, so D is increased)
Distance (in km): D / 60 (because speed is read every tick but unit is km/s)

My problem:
When implementing this, I noticed, that my calculated travel distance is way lower then my actually travelled distance. When at the 15000 km mark, my distance calculator only shows about 8100 km.

When looking closer, I can see the platform speed in the speed display on the right side of the screen shows speed with a higher precision (e.g. 284.35 km/s), while the signal from the hub only uses integers with lower precicion (e.g. 284 km/s). So the signal from the hub is rounded down. I believe this is the root cause of my problems.

Since I limit the fluid supply for my thrusters to limit thrust depending on the distance travelled, my current speed also fluctuates, so I can not just assume it will rise continuously until some limit is reached.

Where I need help:
Does anyone here have an idea how to get the correct value of the currently travelled distance for a space plattform?
jdrexler75
Inserter
Inserter
Posts: 38
Joined: Sat Nov 28, 2020 5:27 pm
Contact:

Re: How can I get the distance travelled by space platform?

Post by jdrexler75 »

A good absolute way to determine distance would be the solar cell efficiency. But I have no idea how to read that in space since everything is connected. Although if you find a steady-state power consumption for your platform you could try aiming for a specific average accumulator recharge rate, I kinda doubt it will be precise enough though.

This would really call for some sort of bayesian filter with frequently-updated but imprecise speed data and rarely-updated but very precise on average accumulator recharge rate. Sounds like there would be a lot of combinators involved... and much fine tuning.
Post Reply

Return to “Gameplay Help”