Estimated Time of Crafting Job Completion #1259

Closed
ghost opened this Issue Apr 11, 2015 · 13 comments

Projects

None yet

5 participants

@ghost
ghost commented Apr 11, 2015

So whenever you have a "huge" crafting job that would take some real world hours, display a estimated time of completion for each CPU and maybe for all CPUs. So you have a rough idea of when it's going to be done.

@TheJulianJES
Contributor

Well, I think the system dosen't know when machines will finish, if there is a power loss..

@sci4me
sci4me commented Apr 12, 2015

If there is a power loss, it will just have to re-calculate the ETA. It's "estimated" time of completion.
I also would LOVE this.

@TheJulianJES
Contributor

@sci4me I would like this too but if just the machines loose there power the ME system won't know.

@yueh
Member
yueh commented Apr 12, 2015

Would be nice, but not really feasible. (read that as required amount of work for a little feature)

We do not know how long any machine (this includes assemblers) will need to craft a single item.
It is not really about power loss, but many other things to consider. For example machines that speedup/slowdown based on their stored power or if multiple requests are sharing the same machines, thus blocking them. We cannot even track the actual item to the current task and use it to create some heuristic data and use that to estimate the time.
So it would probably be pretty common that a request, which would take maybe one minute, has an ETA of maybe 5 secs or 30 minutes, so way off the actual time.

@thatsIch
Member

Maybe something simple is fine, like

current time used / estimated time = current processed items / total to be processed items 
@yueh
Member
yueh commented Apr 12, 2015

Hm. These values are not really available. But each task with the remaining amount is available.
Maybe change it to estimate when the sum of them will be 0. I would still expect some pretty spicky behaviour, maybe smoothen it a bit? Something like ETA = (α · Old_ETA) + ((1 − α) · New_ETA)?

@thatsIch
Member

Cant we just adjust the class to contain the initial information?

final int startSize
final int startTime

not sure, how you would determine the New_ETA?

@yueh
Member
yueh commented Apr 12, 2015

Something like this?

int startSize = tasks.size
int startTime = now
int eta = (now - startTime) / (remainingSize / (startSize - remaingSize))

But instead of directly assigning the new value, calculate a weighted mean between the old and new value. So instead of jumping from 2 minutes left to 5 minutes and then back to 3 minutes, it might only jump to 3.5 minutes and then to 3. No idea about the actual weight. Maybe prefer the old value at the beginning (70:30?) and shift towards the new one based on the overall progress? So it will not jump that fast at the beginning, but react a bit faster towards the ending for changes.

@thatsIch
Member

Sounds fine to me

@ghost
ghost commented May 22, 2015

Yes I know it's been a month, but more tips for this.

Power outage prediction (likely to use LOTS of mod APIs): effectively you find where the energy acceptor gets its power from, then find the source (eg EnderIO capacitors, TE tesseracts) and calculate the amount of power in it by power usage rate to find the time left before power runs out. If you wanted to, trace the source providing power to the energy acceptor (eg generator, draconic evolution energy storage multiblock) and do the same (calculate the amount of power in it by power usage rate). Then maybe trace the source of the source providing power for the energy acceptor and calculate. And keep on doing this until you hit the generator (the absolute source) or the game crashes. It's like following your internet connection to a remote server physically (follow the copper/fibre cable outside of your house until you get to the server)
Back on topic: All these times get added up and displayed in the crafting monitor block/GUI. If it's a solar panel in a forever day dimension feeding power to the energy acceptor directly, maybe put the time remaining in power source as infinite (∞). Gets very complicated and far down.

Crafting time: run a simulation of crafting one of each item in molecular assemblers, cache these times and calculate this by how many items there are (eg 8 cobble to 1 furnace takes 1.5 seconds and there are 15 furnaces to craft, so 15_1.5=22.5 seconds, 4 wood planks to 1 crafting table takes 0.5 seconds and there are 10 crafting tables to craft, so 10_0.5=5 seconds)

Sorry if I wasn't very clear.

@XFactHD
Collaborator
XFactHD commented May 22, 2015

What you are proposing won't work because an external mod can't for example follow a tesseract channel and also you would need different compatibility code for every mod that provides Mekanism Joules, EU, RF, etc. to be able to follow the cable.
In some cases you would probably even need to ASM into the cable code.

@ghost
ghost commented May 22, 2015

I'm not expecting it to be added, since it's not likely that your crafting jobs are going to take real world hours. And the code would be crazy for the power outage prediction.

Or maybe forget about the power outage prediction stuff and assume that there will never be a power shortage?

@thatsIch
Member
@yueh yueh closed this in 776d68b Jun 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment