The International Simutrans Forum

 

Author Topic: Electricity: City Hall demand vs Substation demand  (Read 1276 times)

0 Members and 1 Guest are viewing this topic.

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Electricity: City Hall demand vs Substation demand
« on: January 22, 2019, 04:40:46 PM »
I can't understand this.

the power demand in the substation has a different value from the one of the city hall. why?
For example, in my current game, the city of Victoria, according to the town hall, has a power demand of 244 KW, but in the substation connected to the city there is a demand of 2.01 KW. Is there a conversion? Doesn't make sense since both use the same power unit...

Note: I have two cities connect to the grid, according to the substations there is a total demand of 2.44 KW (according to town halls it is 296 KW) and my revenue was on the second month just 18.28$ (first month had 0 idk why)
« Last Edit: February 23, 2019, 01:39:44 PM by accord2 »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Electricity: City Hall demand vs Substation demand
« Reply #1 on: January 23, 2019, 11:30:26 PM »
Thank you for the report. Are you able to upload a saved game in which this issue can be reproduced?

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Re: Electricity: City Hall demand vs Substation demand
« Reply #2 on: January 24, 2019, 04:07:23 PM »
Here it is:
https://www.dropbox.com/s/ilmfiwv9u9fcxa7/Greater%20Anglia%201895%208%209.sve?dl=0 (save)
https://www.dropbox.com/s/x9bfi7hxb0lxiqa/trackpak.rar?dl=0 (pak I use in this save)

The towns are: Victoria and Duckenton End
The power station is East of them (right side of screen) near the sea. Its called 'NPGC Coal-fired power station - Victoria'
All the electrical grid is owned by UCC (player)

Thanks :)

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Re: Electricity: City Hall demand vs Substation demand
« Reply #3 on: January 29, 2019, 07:33:12 PM »
Any news about this?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Electricity: City Hall demand vs Substation demand
« Reply #4 on: February 10, 2019, 11:08:14 PM »
Apologies for not having had chance to look into this lately: I have been very busy at home with a domestic project in the last few months.

I note that you have uploaded a few assorted .pak files; may I ask with which pakset that these go?

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Re: Electricity: City Hall demand vs Substation demand
« Reply #5 on: February 11, 2019, 08:15:46 PM »
Do not worry.

Those pak files go with Britain pakset. Sorry, should have told earlier   :-[

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Re: Electricity: City Hall demand vs Substation demand
« Reply #6 on: February 24, 2019, 08:00:09 PM »
I have done some testing.

I created a new map in the year 1890 (the same year my game started) and I connect the new map towns to a gas power plant (the one that doesn't have resources input). In the first year, the bug was there. The substation had a inferior Kw demand than the town. Then with public service I got forward one year, and another one, etc. With time the substation demand increased (always a different value than the town's demand) and in 1975, both town and substation had the same demand value, so the bug was not there.


So this bug only happens in early years.. I don't know why tho.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Electricity: City Hall demand vs Substation demand
« Reply #7 on: February 24, 2019, 09:02:19 PM »
Interesting - this might suggest a rounding error, although further investigation would be needed. There is somewhat of a backlog of bug fixing (especially with some extremely difficult critical bugs), so I am afraid that it might be a while before I get to non-critical bugs such as this one. Thank you for the report, however.

Offline Ranran jp

  • *
  • Posts: 483
  • Languages: ja
Re: Electricity: City Hall demand vs Substation demand
« Reply #8 on: February 24, 2019, 11:02:25 PM »
I guess this is due to the same reasons as I reported in other threads, that is, the data of the city is doubled only for the data of the industrial building.


EDIT:
The number of jobs affects the power demand.

This code is at uint32 stadt_t::get_power_demand() const in simcity.cc
return (((city_history_month[0][HIST_CITICENS] + city_history_month[0][HIST_JOBS] + (city_history_month[0][HIST_VISITOR_DEMAND] / 4)) << POWER_TO_MW) * electricity_per_unit) / 100000;
Since the red variable currently returns the wrong value, the electricity demand also has the wrong value.

I suspect that the city counts the number of factory job twice.
« Last Edit: February 26, 2019, 11:03:28 PM by Ranran »

Offline Elemental

  • *
  • Posts: 9
  • Languages: EN, DE
Re: Electricity: City Hall demand vs Substation demand
« Reply #9 on: February 25, 2019, 11:08:33 AM »
The same thing can also be seen on the Stephenson-Siemens server game: The town of Berkington has one of those early coal plants. The Berkington town hall registers a demand of 168 kW. The substation in Berkington registers a demand of 1.38 kW.

Edit: The year is 1898, that might be important.
« Last Edit: February 25, 2019, 03:07:23 PM by Elemental »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Electricity: City Hall demand vs Substation demand
« Reply #10 on: March 10, 2019, 11:51:29 AM »
Ranran - thank you for your investigations into this. I have just now incorporated your patch to fix the incorrect computation of industry demand. This will be incorporated from to-morrow's nightly build. I should be grateful if anyone could re-test to see whether this problem recurs with the next nightly build.

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Re: Electricity: City Hall demand vs Substation demand
« Reply #11 on: March 11, 2019, 07:17:27 PM »
Sadly the bug still persists :(

Offline Ranran jp

  • *
  • Posts: 483
  • Languages: ja
Re: Electricity: City Hall demand vs Substation demand
« Reply #12 on: March 12, 2019, 09:48:00 AM »
Currently the relationship between KW and MW is not correct.

This difference can be seen when displaying both MW and KW.


Maybe the conversion MW to KW is not correct.
Therefore it displays the wrong KW value in the early days when there is only a small power demand.

I suppose this commit is related to this.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Electricity: City Hall demand vs Substation demand
« Reply #13 on: March 12, 2019, 12:09:12 PM »
I have pushed a fix to the computation of kilowatts (which seem to have been too small by a factor of 100); I should be grateful if people could re-test with the next nightly build to see whether that assists.

Offline accord2 pt

  • *
  • Posts: 236
  • Languages: EN, PT
Re: Electricity: City Hall demand vs Substation demand
« Reply #14 on: March 13, 2019, 04:37:15 PM »
Thank you.

Now, in one city the town hall demand is 60 KW and the substation says the demand is 49.80 KW. In other town, city hall says it is 244 KW while the substation says it is 200.60 KW.

I suppose this is intended?


Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Electricity: City Hall demand vs Substation demand
« Reply #15 on: March 13, 2019, 06:54:27 PM »
Thank you for checking this: this is most helpful.

The difference may be related to industries; in principle, industries in towns should be counted in both places, but industries that are partly inside and partly outside towns may not be counted in the city hall window. Can you check whether there are industries in these towns and, if so, whether any of them are partly outside the towns' boundaries?

Offline Ranran jp

  • *
  • Posts: 483
  • Languages: ja
Re: Electricity: City Hall demand vs Substation demand
« Reply #16 on: March 13, 2019, 10:15:47 PM »
Something weird ???


Be aware of the change in each demand.

Offline Ranran jp

  • *
  • Posts: 483
  • Languages: ja
Re: Electricity: City Hall demand vs Substation demand
« Reply #17 on: March 14, 2019, 04:35:54 PM »
Neither the City Hall demand nor the Substation demand show the correct value.
And even now, the relationship between MW and KW is not correct.

The power demand of this pub is found to be 125 KW.
And when I removed pub, It dropped 125 KW from the Substation demand. This is correct but this only performed subtraction properly.
However, if remove all buildings except pub, it will be displayed as 104.80 KW. At this time, the demand of the city shows 2KW.
And if you remove pub from there, it will be displayed as 0.40 KW of Substation demand and 0 KW of City Hall demand.