Page 1 of 1

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

Posted: Wed Oct 30, 2024 2:30 am
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 448 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 448 times
Edit: Forgot to put a version in the title.

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

Posted: Thu Oct 31, 2024 5:44 pm
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.