News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Cargo delivered at industry bug

Started by Jando, April 18, 2017, 11:49:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jando

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! :)

jamespetts

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.

Isaac Eiland-Hall

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. :)

Jando

Quote from: Isaac.Eiland-Hall on April 19, 2017, 02:26:05 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. :)

Isaac Eiland-Hall


jamespetts

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.

Jando

#6
Quote from: jamespetts 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.

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

jamespetts

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.

Jando

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.

jamespetts

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.

Jando

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.

jamespetts

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.

Jando

Quote from: jamespetts on April 20, 2017, 09:36:19 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.

Quote from: jamespetts on April 20, 2017, 09:36:19 PM
... 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. 

jamespetts

There is a certain critical ambiguity in what you report here, which is what I am trying to unravel: you write,

QuoteThus 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.

Jando

#14
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

Isaac Eiland-Hall

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. :)

Jando

Quote from: Isaac.Eiland-Hall 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. :)
Thanks, I'm still fighting to get the image on the forums right .)

Ves

QuoteThanks, 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 :)

jamespetts

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.

jamespetts

I have just pushed a fix for a number of errors relating to industry production/consumption/statistics. Would anyone be able to re-test to confirm whether this is fixed? Thank you for the reports.
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.

Jando

Jando runs to the computer to make a brand-new industry heavy map in 1850. :)

I assume this is best tested with a brand-new map cause I see all storage numbers all zero at all already connected industries after the patch. Making a new map should give better data without having to deal with pre-patch and post-patch historical statistics. :) Thank you very much, James, for addressing this issue.

jamespetts

Quote from: Jando on July 28, 2017, 08:32:54 AM
Jando runs to the computer to make a brand-new industry heavy map in 1850. :)

I assume this is best tested with a brand-new map cause I see all storage numbers all zero at all already connected industries after the patch. Making a new map should give better data without having to deal with pre-patch and post-patch historical statistics. :) Thank you very much, James, for addressing this issue.

Yes, it is possible that some historical data from games saved before this fix was applied will be incorrect, but new data should be fine. Thank you 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.

Jando

Made a small test map, used public player to place industry chain colliery/iron mine-steel mill/forest-hardware factory-hardware shop. Findings:

  • All storage graphs on all industries are correct now. No bug with any industry graph found. Verified graphs on non-test map in my normal game as well.
  • Ratios of consumption/production checked and found correct. Steel mill consumed 828 items during first month on fast-forward, hardware factory consumed 156 items. All input and output percentages as stated in industry window found correct.
  • Max. item limit per month in industry window still incorrect - factual consumption (for consumers) and factual production (for suppliers) is a muliple of the stated maximum amount. Your call, James, whether that's a bug or a feature or something to address during balancing. :)
Thank you very much, James.

jamespetts

Thank you very much for testing this: this is very helpful. Looking into this, the problem was more than simply that the max units per month figure was displayed incorrectly: it transpired that a large number of matters related to industry production were not scaled with the meters per tile setting as is intended and as had been assumed when the industries were calibrated. I have now fixed this; would you be able to re-test? 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.

Jando

Sure, I will re-run tests and report back soon.

Jando

That was not quite intended I guess. :)

All industries (no matter whether on new or on old maps) have a max. item count that is a multiple of 16. Have seen max. item numbers ranging from 0 (zero, for many small consumers like pubs, grocers, newsagents, greengrocers, etc.) to 928 (steel mill in 1946).

jamespetts

Thank you for spotting that - that was caused by a loss of precision in one of the calculations, which I think that I have now fixed. Would you be able to re-test? I should be 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.

Jando

#27
Awfully sorry, James, problems ahead.

Made a new small test-map, January 1810 with newest nightly build. Used public player to place grain farm, forest, brewery, orchard and pub. Connected industries, transport by cart, fast-forward game for 6 game-months.

Findings:
- Apart from 1 unit of grain produced by the grain farm during the first month (January 1810) no industry ever produced or consumed anything.
- Upon saving and re-loading all storage numbers at all industries revert to zero.

Sorry, can't upload test map right now, files.simutrans seems to have a problem, cannot login. Edit: Saved game is here: http://files.simutrans.com/index.php/s/aeu169qWYqpA1Uy

Jando

And additional info from my normal game, one game-month on fast forward. I watched the industries that had plenty of stock from deliveries in the month before.

2 power stations (stated as max. 90 and max. 82 units per month) consumed 76 and 77 units of coal, a good fit thus. Smaller industries however consumed nothing. Watched 2 hardware shops (max. units 16 and 24), a fishmonger (max. 20), a pub (max. 13) and a greengrocer (max. 8 units). All had stock in storage at the industry. None of these smaller consumers consumed anything during this month on fast forward.

kittens45


jamespetts

Not yet - I have been very busy at work this week, although I have been working on this when I have time (it is quite a complex problem that I do not fully understand yet). I did push an update yesterday that might result in a small improvement in some cases, but this is not a full fix at this stage.
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.

kittens45

#31
any fix for the next update?

jamespetts

Quote from: kittens45 on August 03, 2017, 11:18:13 PM
any for the next update?

I do not understand the question, I am afraid.
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.

jamespetts

Having spent really rather a long time on this, I think that I have now managed to push a fix for two separate bugs (one relating to the industry production and another relating to checking whether too many goods were in transit.

Would you be able to re-test and confirm the fix when you have a moment? 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.