[boskid][2.0.12] Loader entity with energy source does not operate at advertised speed

This subforum contains all the issues which we already resolved.
kryojenik
Inserter
Inserter
Posts: 27
Joined: Fri Jun 26, 2020 8:18 pm
Contact:

[boskid][2.0.12] Loader entity with energy source does not operate at advertised speed

Post by kryojenik »

Loader entities that have an energy source configured may not operate at the correct speed. The loaders (and belts) below, from the top down, are supposed to operate at the following Item/s speeds:
3.75
15
30
45
60
90
135
180
225
270

The displays show the item rate passing by x100. In the upper picture the loaders do not have an energy source and operate at the expected speeds. The lower screenshot shows loaders that consume electricity. If a loader has a speed between 60 and 120 items per second it will only output 60 items / second. At 120 it will start outputting 120/s. Then several speeds above 120 only output 120/s until around 225/s. Strangely the 270/s drops below the 180/s loader.

All of the belts connected to the loaders are the appropriate speed. Using faster belts on the the loaders does not change the behavior.

The mod providing the loaders has as mod setting to add or not add electricity consumption.

Code: Select all

  if settings.startup["mdrn-use-electricity"].value then
    entity.energy_source = {type = "electric", usage_priority = "secondary-input", drain = "2kW"}
    entity.energy_per_item = "4kJ"
  end
Loaders do not consume energy (No energy source)
Loaders do not consume energy (No energy source)
Screenshot 2024-10-29 205533 (Medium).png (722.41 KiB) Viewed 597 times
Loaders do consume energy (Have an energy source configured)
Loaders do consume energy (Have an energy source configured)
Screenshot 2024-10-29 205703 (Medium).png (742.33 KiB) Viewed 597 times
Edit: Forgot to put a version in the title.
Attachments
BugReport-EnergySource.zip
Save game showing issue
(630.61 KiB) Downloaded 12 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3016
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.12] Loader entity with energy source does not operate at advertised speed

Post by boskid »

Thanks for the report and the save file i could use when observe loader speeds. Issue is now fixed for 2.0.14.

Issue was caused by the electric energy source buffer size being sized for an average transfer speed (for example 2.5 items/tick) but since items are not divisible, in such case a loader in some ticks would transfer 2 items and in some ticks it would transfer 3 items, however due to buffer size computation it only held energy for 2.5 transfers (the average) so in the next tick the buffer would not be enough to pay for the 3 items transfers fully and loader would be blocked for 1 tick causing it to not transfer items. Fix was to make buffer up-sized to the ceil(2.5) [example] so it is sized for the worst case, not for the average.
Post Reply

Return to “Resolved Problems and Bugs”