Author Topic: Cargo delivered at industry bug  (Read 789 times)

0 Members and 1 Guest are viewing this topic.

Offline Jando

Cargo delivered at industry bug
« on: April 18, 2017, 11:49:34 AM »
It seems that industries accept too much cargo. A percentage of the cargo delivered seems to vanish after arrival and after the player gets paid for the delivery. The industry chart states that the cargo arrived, but the cargo does not get consumed or put into storage. Here is a screenshot of it:



The 3 graphs shown are from top to bottom: planks arrived, planks consumed, planks in storage. Note that the percentage number of the builder's yard accepting planks (28%) seems to be used to calculate the percentage of delivered planks that get consumed or otherwise used by the industry. The rest of the planks (72%) vanishes.

The above happens for all types of goods and all types of industries it seems, I see the same behaviour with other industries (ironworks, cement works) as well.

Thanks! :)

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #1 on: April 18, 2017, 11:11:56 PM »
Thank you for the report. I am afraid that I cannot see the screenshot - did you host it on Imagur, by any chance? For some reason, I can never see things on Imagur.

Would you be able to upload a saved game in which this can be reproduced reliably? I should be most grateful.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Isaac.Eiland-Hall

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3389
  • Total likes: 254
  • Helpful: 90
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #2 on: April 19, 2017, 02:26:05 AM »
I've hosted the image here:



https://files.simutrans.com/index.php/s/UOIgL3nxmQIH4rN

Also, I'd be glad to set up an account on the site for the uploading of the saved game. :)

Offline Jando

Re: Cargo delivered at industry bug
« Reply #3 on: April 19, 2017, 09:36:49 AM »
...
Also, I'd be glad to set up an account on the site for the uploading of the saved game. :)

Please do so, Isaac. The saved game is waiting for upload on my hard disc. :)

Offline Isaac.Eiland-Hall

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3389
  • Total likes: 254
  • Helpful: 90
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #4 on: April 19, 2017, 03:46:55 PM »
Set up and PM'd. :)

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #5 on: April 19, 2017, 09:04:26 PM »
Thank you for your help, Isaac - it is good to see a new file hosting system in place! Jando - please let me know when you have the saved game uploaded. Thank you.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Cargo delivered at industry bug
« Reply #6 on: April 19, 2017, 09:21:25 PM »
Thank you for your help, Isaac - it is good to see a new file hosting system in place! Jando - please let me know when you have the saved game uploaded. Thank you.

James, for now uploaded to http://simutrans-germany.com/files/upload/Huntbere_1831.sve

Will use new system once I get access sorted.

And now also here I believe: http://files.simutrans.com/index.php/s/nP23nQDMvhQ1Rih
« Last Edit: April 19, 2017, 09:44:44 PM by Jando »

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #7 on: April 19, 2017, 11:49:19 PM »
Thank you very much for that. I am in the process of trying to track this down now, though it is a rather challenging issue, as it appears to occur in very complex industry code which I did not write myself (although which may have been affected by some of what I have written over time).

Would you be able to run some tests to assist me in tracking down this issue (my time is rather limited, so the more that you can help with testing, the quicker that I can fix this)? I am trying to discover whether the problem lies in the actual goods storage at the industries or whether only the statistics are affected. This is more easily done with a producing factory than a pure consumer. If the problem is just with the statistics, then the actual production of the factory should be unaffected (e.g., for a factory with 50% coal and iron ore inputs, delivering 50 units of coal and 50 units of iron ore should result in the production of 100 steel), and this should be apparent from the actual number of goods present at the receiving station. If, however, the problem lies with the actual number of goods tracked as being used by the industry, the actual production will be affected, so considerably fewer units of (for example) steel will be produced.

I notice, for example, at the ironworks at 1102,643, that the storage is shown on the graph as 1 for coal, whereas in fact the storage is given in figures above as 174. This suggests that it may well be a statistical problem, but it would be very helpful to have confirmation before looking in detail at the rather complex code dealing with the statistics rather than the equally complex but very different code dealing with the handling of actual units of product.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Cargo delivered at industry bug
« Reply #8 on: April 20, 2017, 09:18:22 AM »
Hello James!

Sure, I will gladly help with testing and have even some time on my hands to do so. I will track down the other industries on that map today, by now 2 ironworks, a cement works and a brickworks are connected, thus should give us plenty of data.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #9 on: April 20, 2017, 10:05:28 AM »
That is extremely helpful, thank you.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Cargo delivered at industry bug
« Reply #10 on: April 20, 2017, 03:20:35 PM »
First findings: :)

  • The storage graph of all connected industries is always wrong, no matter whether producer or consumer or both. Storage graph of all industries shows either 0, 1 or 2 - no matter the textual information about items stored in the industry window.
  • The arrived graph of all connected industries is always correct and correctly states the number of items delivered to that industry.
  • The ratio between arrived and consumed items is wrong when the industry does not have a consumption of 100% and is correct when the industry does take them at 100%. For an ironworks for example (consumption 50% coal and 50% iron) that means that the max. amount of consumed coal or iron is 50% of the delivered coal or iron. The other 50% of delivered items are not put into storage but are lost instead.
  • The ratio between consumed and produced items is always correct.
  • The ratio between produced and delivered items is correct when the industry produces at 100% and incorrect in all other cases. The behaviour is that when the number is above 100% the industry will deliver less items than it produces, when the number is below 100% the industry delivers more items than it produces.
  • The delivered graph of all connected industries is always correct and correctly states the number of items delivered from that industry to it's freight stop.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #11 on: April 20, 2017, 09:36:19 PM »
Thank you for that. Are these just findings by comparing the content of the graphs? What I am trying to discover, given that the graphs are inconsistent with one another, is with which (if any) of the inconsistent data in the graphs that the actual output of a factory correlates. For example, a steelworks with 50% coal and 50% ore inputs: if 50 actual units of coal and 50 actual units of iron ore are delivered to the factory, does it actually produce 100 units of steel such as actually find their way to the connected stop, or does it produce a lower number (e.g. 25 or somesuch)? This is what I was hoping that you would be able to test.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Cargo delivered at industry bug
« Reply #12 on: April 20, 2017, 11:52:54 PM »
Thank you for that. Are these just findings by comparing the content of the graphs? ...

The data about arrived and delivered items is verified by comparing the graphs to the factually transported items (watching the convoys and checking the number of transported items in line management). I consider the graphs about number of arrived and delivered items as correct.

... For example, a steelworks with 50% coal and 50% ore inputs: if 50 actual units of coal and 50 actual units of iron ore are delivered to the factory, does it actually produce 100 units of steel such as actually find their way to the connected stop, or does it produce a lower number (e.g. 25 or somesuch)? ...

It may even deliver many more items to the stop than what arrived in raw materials. :)

We have multiple steps here, from arrived to consumed, then to produced and to delivered. The bug sits in the steps from arrived to consumed and then from produced to delivered. The middle step from consumed to produced works fine and is correct. The bug also only happens when the percentage numbers in the industry window are not all 100%.

Thus in your (hypothetical?) example of the steelworks (I couldn't actually find one with 50% for both iron and coal, haha) 50% of the arrived materials would get consumed. Out of these the correct number of steel would get produced. How much steel is delivered to the stop solely depends on the percentage number in the production section of the industry window. If this number is 100% all the produced steel would get delivered. If the number is above 100% less items than produced get delivered, if that number is below 100% more items than produced get delivered to the stop.

Sorry, the new files site from Isaac seems to be down, can't post the screenshot right now, or only to Imgur that does not work for you. Back with more info tomorrow. 

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #13 on: April 21, 2017, 12:27:44 AM »
There is a certain critical ambiguity in what you report here, which is what I am trying to unravel: you write,

Quote
Thus in your (hypothetical?) example of the steelworks (I couldn't actually find one with 50% for both iron and coal, haha) 50% of the arrived materials would get consumed. Out of these the correct number of steel would get produced.

Do you mean that the correct number would be produced given the number recorded on the "consumed" graph, or do you mean that the correct number would be produced for the number that had actually arrived?

This distinction is critical, as the former would imply a bug in the actual industry production code, whereas a latter would imply a bug in the code for displaying the graphs.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Jando

Re: Cargo delivered at industry bug
« Reply #14 on: April 21, 2017, 10:19:24 AM »
Screenshot time with a steel mill. :)

The following 4 screnshots show the industry display of a steel mill, first screenshot after the first train with coal arrived (and the loading and unloading of the coal finished), second shot after the iron arrived and unloaded, 3rd screenshot after the delivered coal and iron got processed into steel and the 4th screenshot after the produced steel got loaded on a train to a builder's yard.


http://files.simutrans.com/index.php/s/BMoH7kYSOG0n6QW
120 units of coal arrived, note the number of coal is verified by line management. the industry display shows 120 units arrived in graph but 52 units in storage under consumption at the steel mill (43% of the arrived number)


http://files.simutrans.com/index.php/s/JD9crErXajEA0Nw
120 units of iron arrived, the industry display shows 120 units arrived in graph but 68 units in storage under consumption at the steel mill (57% of the arrived number)


http://files.simutrans.com/index.php/s/wfAYUcSBVoTLGaL
Third screenshot after the steel mill processed these 120 delivered units of coal and 120 delivered units of iron into 48 steel bars as stated by the industry display.


http://files.simutrans.com/index.php/s/KSCw1jwjWK7QWwB
4th screenshot after the 48 steel bars from the industry display became 110 steel bars on the train picking up the load for transport to a builder's yard.

Note that none of the numbers apart from initial delivery comes from any of the graphs, all numbers are from the textual information in the industry display.

Here is a save-game of another steel mill (I was so dumb to overwite the one from the screenshots) connected to an iron mine and colliery and builders' yard. The game is saved just before the first barge with iron ore arrives at the mill with other barges getting coal on their way: http://files.simutrans.com/index.php/s/HbK0oQSgWyHyaS1
« Last Edit: April 21, 2017, 04:02:43 PM by Isaac.Eiland-Hall »

Offline Isaac.Eiland-Hall

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3389
  • Total likes: 254
  • Helpful: 90
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #15 on: April 21, 2017, 04:03:10 PM »
I took the liberty of editing the image links, which must use the image address of the image from the share page, not the URL to the share page itself. :)

Offline Jando

Re: Cargo delivered at industry bug
« Reply #16 on: April 21, 2017, 04:17:56 PM »
I took the liberty of editing the image links, which must use the image address of the image from the share page, not the URL to the share page itself. :)
Thanks, I'm still fighting to get the image on the forums right .)

Offline Ves

Re: Cargo delivered at industry bug
« Reply #17 on: April 21, 2017, 05:09:39 PM »
Quote
Thanks, I'm still fighting to get the image on the forums right .)
What I usually do is right-click the image -> Copy image url/webb addres. Usually works :)

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15135
  • Total likes: 353
  • Helpful: 155
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cargo delivered at industry bug
« Reply #18 on: April 22, 2017, 12:29:56 AM »
That is very useful, thank you: the output factor of the steel mill is 40, which suggests that the production of 110 steel from 120 coal and 120 iron is close to being correct (although I should expect production of only 93; but there might be a boost, of course if passengers were delivered, which they might well have been just from walking). This therefore suggests that the internal statistics (both in the graphs and elsewhere) are where the error is likely to be. I shall have to look at this in more detail in due course. Thank you very much for testing.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.