The International Simutrans Forum

 

Author Topic: Electrical issues  (Read 10661 times)

0 Members and 1 Guest are viewing this topic.

Offline jameskuyper

  • *
  • Posts: 78
  • Languages: en
Electrical issues
« on: November 08, 2012, 02:41:17 PM »
While playing the Book Empire scenario of pak64, I noticed some features of electrical power that seemed odd or inconvenient:

A factory's electricity demand is 0 unless it's actually operating: all required inputs (if any) must be in stock, and there must be room for the resulting products (if any). I find this inconvenient. I'd prefer to be able to determine power needs before I start planning my transportation and power transmission routes, long before I've actually built them. Could some way be provided for querying the demand the factory would have if it were operational, even though it currently isn't?

Whenever a factory is operational and connected to power, it operates at the boosted production rate while consuming electricity until it runs out of inputs, storage space for the products, or loses power. This all seems reasonable, but it leads to a counterintuitive result: if production of a factory is already limited by supply of it's inputs or demand for it's outputs, electrifying it will simply increase it's electrical bills, without increasing it's revenue or decreasing it's other expenses. This is good, from the point of view of the company which gets paid to distribute electrical power, and also for the company that gets paid to ship fuel to the power plant. However, under such circumstances, would electrification of a factory make sense from the point of view of the factory's owner? It might make more sense for electrical consumption to be proportional to the increase in the monthly production rate, rather than total production rate - but I don't think that lends itself to the moment-by-moment approach currently used to determine electricity consumption.

The Coal Power Plant's actual production of 928 exactly matched it's production capacity, even though power consumption was only 232.  I'm sure that real power plants don't work that way - I believe that they adjust their power production to maintain a constant voltage level, which will happen only if total production and consumption are synchronized. Trying to produce more than is consumed would cause the voltages to spike until something burned out. I think this should be changed.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Electrical issues
« Reply #1 on: November 08, 2012, 03:00:55 PM »
Could some way be provided for querying the demand the factory would have if it were operational, even though it currently isn't?
The chart can provide this information, along with the boost factor (since it's not necessarily x2 anymore), and passenger mail requirements/boosts. Somewhat cumbersome but nobodies bothered to make this info available in a more convenient format.


However, under such circumstances, would electrification of a factory make sense from the point of view of the factory's owner?
The factories owner wouldn't care as factory finances aren't simulated. The player who's paying maintenence and wasting the limited amount of power on this factory that doesn't need it should care however. What to electrify is a strategic choice in the game for players.


The Coal Power Plant's actual production of 928 exactly matched it's production capacity, even though power consumption was only 232.
The fuel consumption of power plants is independant of electrical production. If a plant has fuel, it consumes at full rate, and makes full power available. It's been asked a couple times if changing this is desirable; No feedback, hence not implemented.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Electrical issues
« Reply #2 on: November 08, 2012, 04:24:44 PM »
Also simutrans is designed that there is not enough power to fully supply all factories. On small maps with few factories it may still work. But on larger maps you will get power shortages, if you connect veverything to the grid.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Electrical issues
« Reply #3 on: November 08, 2012, 05:08:33 PM »
Is this power shortage hardcoded into the program or pakset dependent?

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Electrical issues
« Reply #4 on: November 08, 2012, 05:14:38 PM »
simuconf.tab dependent - electric_promille = 330. 
Pak64 default is for enough electricity to supply 1/3 the factories on the map.

Offline jameskuyper

  • *
  • Posts: 78
  • Languages: en
Re: Electrical issues
« Reply #5 on: November 09, 2012, 04:14:31 AM »
The chart can provide this information, along with the boost factor (since it's not necessarily x2 anymore), and passenger mail requirements/boosts. Somewhat cumbersome but nobodies bothered to make this info available in a more convenient format.

The factories owner wouldn't care as factory finances aren't simulated. The player who's paying maintenence and wasting the limited amount of power on this factory that doesn't need it should care however. What to electrify is a strategic choice in the game for players.

The fuel consumption of power plants is independant of electrical production. If a plant has fuel, it consumes at full rate, and makes full power available. It's been asked a couple times if changing this is desirable; No feedback, hence not implemented.
Thanks. The electricity demand on a transformer goes to zero when the factory is not running; I thought I'd confirmed that the same is true for the electricity demand shown on the chart, but I just checked, ant that's not the case. That's good news.

I know that simutrans is a transportation simulation, and factories are simulated only because, and only insofar as, they provide sources and destinations for goods to be transported. I'm not suggesting that should be changed. I'm just suggesting that the way in which they are simulated in this game should be roughly consistent with them being run for the benefit of their owners. I haven't been able to come up with any simple way for a factory to accept electricity only to the extent that having it provides a benefit to the owner, but I am pointing out the issue in case anyone can suggest a solution.

I do think it's undesirable for power plants to generate more power than the total amount consumed. It would be particularly annoying in a scenario where fuel is in short supply, though I don't know if the game generator allows such scenarios to be created - but such a scenario could certainly be created by hand. If you could refer me to the relevant topics, I could post a reply giving my feedback on that issue.

Offline Fifty

  • *
  • Posts: 280
  • Languages: EN, ES
Re: Electrical issues
« Reply #6 on: November 09, 2012, 04:50:44 AM »
In most cases, I think it is quite realistic that factories all want to be connected to the electrical grid (for the most part). By increasing production with mechanization, a factory owner in real life might be able to either produce more if supply and demand allows, or alternatively to employ fewer shifts of workers. It is thus in the player's best interest to ration the limited power to those industries producing goods that are in shortest supply. If you electrify everything, then power does not serve its purpose of filling in shortages in certain goods at all!

Also remember that many industries have no boost, but are counted into the 33%, including oil rigs, timber plantations, farms, etc, so this number is not quite as low as it seems.

I do think it's undesirable for power plants to generate more power than the total amount consumed. It would be particularly annoying in a scenario where fuel is in short supply, though I don't know if the game generator allows such scenarios to be created - but such a scenario could certainly be created by hand. If you could refer me to the relevant topics, I could post a reply giving my feedback on that issue.

Almost all coal power plants (and nuclear and geothermal) run 24/7, whether or not there is demand for electric power. For these so-called "baseload" plants, it would be difficult to shut down instantaneously or ramp up power production capacity (this is why power is cheap overnight). For oil and gas fired "peaking" plants that operate only during times of peak demand, a scheme could be implemented where, depending on power production, the plant could produce anywhere from between 0 and 200 percent of it's max capacity.

Offline jameskuyper

  • *
  • Posts: 78
  • Languages: en
Re: Electrical issues
« Reply #7 on: November 09, 2012, 01:01:52 PM »
In most cases, I think it is quite realistic that factories all want to be connected to the electrical grid (for the most part). By increasing production with mechanization, a factory owner in real life might be able to either produce more if supply and demand allows, or alternatively to employ fewer shifts of workers.
That sounds reasonable. Taking an example from the game I used for testing: the Oil Field has a base production capacity of 1736 m^3/mo, and an electrically boosted production capacity of 3472m^3/mo; but there's only enough demand for Oil to support actual production of 1885 m^3/mo, so it's operating on a 54% duty cycle. It should therefore generate passengers and mails at 54% of the rate it would have done at full production without electrification, because electrification allows it to meet that production level with fewer workers. That's not how the game currently works: but it could be, and I think that would make it more realistic, without adding too much complexity.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Electrical issues
« Reply #8 on: November 11, 2012, 04:10:39 AM »
I haven't been able to come up with any simple way for a factory to accept electricity only to the extent that having it provides a benefit to the owner
Currently a factory only accepts power if it's producing, and one of its output stores is < 75% full.
Easy to also require all input stores > 25% full. That would make it only accept electricity when its well supplied with raw materials, and when its product is being transported away (sold).

Patch attached implementing. I'd like feedback if such a change is desirable before committing.


I do think it's undesirable for power plants to generate more power than the total amount consumed.
Attached patch also implements an optional setting to have power plants only consume fuel based on their actual electrical output. Was easier than I thought, wish I'd done it sooner! Turn on, and no more endless deliveries of coal to a powerplant that produces no power. Need to start games with something other than the standard coal mine>powerplant route.

Or should this just be always on - skip the option?

Edit: Or just use the existing just_in_time setting?

« Last Edit: November 11, 2012, 05:48:19 AM by TurfIt »

Offline sdog

  • Devotee
  • *
  • Posts: 2052
Re: Electrical issues
« Reply #9 on: November 11, 2012, 05:39:33 AM »
"Need to start games with something other than the standard coal mine>powerplant route."
+1

it ought to be a simuconf.tab option.


However, it might be necessary to have more steady demand, perhaps all connected factories already require some base demand, that goes up when actively producing? Else the effect is a strong positive feedback on income fluctuations. Example:

Player has the very large pak128 steel production chain running, and all factories connected. A blockage anywhere causes the whole production to grind to a halt. Now also the demand for coal or oil for his power plants goes to zero since all factories stopped.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Electrical issues
« Reply #10 on: November 11, 2012, 07:58:03 AM »
I Think that all factory's must have a ground consumption of electric energy.
Get a Endfactory goods to sell that than electric power consumption get higher.
More goods in warehause more electric power consumption.
« Last Edit: November 11, 2012, 08:03:45 AM by greenling »

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Electrical issues
« Reply #11 on: November 11, 2012, 10:13:37 AM »
I think power plants should always consume some fuel to "simulate" power delivered to other things than factories, like houses, street lights, railroad electrification and so on. In effect they should receive a boost from delivering electricity, just like other factories receive a boost from receiving electricity. Or is that what the patch does already?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Electrical issues
« Reply #12 on: November 11, 2012, 10:25:22 AM »
Also if such patch goes in, then one has to make sure that simutrans does not start with a powerline chain, and the AI has to be aware of it. Maybe intead of nothing rather produce only with x % without demand. To keep the boiler hot enough to start whenever needed.

But such a patch (together with the stop production when stores full or more than y % are en route) would certainly make industy more challenging realistic and prevent cheating.

Offline Fifty

  • *
  • Posts: 280
  • Languages: EN, ES
Re: Electrical issues
« Reply #13 on: November 11, 2012, 04:23:53 PM »
I think power plants should always consume some fuel to "simulate" power delivered to other things than factories, like houses, street lights, railroad electrification and so on. In effect they should receive a boost from delivering electricity, just like other factories receive a boost from receiving electricity. Or is that what the patch does already?

I like the idea of some power going to cities, but I think it might need to be done like simutrans experimental with transformers in cities, or alternatively calculated based on population.

I also think it is realistic to have different values based on the type of powerplant. Coal plants, for instance, generally are run 24/7, and cannot vary their production much. Oil plants on the other hand, can start up and shut down quickly. Thus perhaps Coal Plants could perhaps always produce between 75% and 125% of their stated output, based on grid demand, and Oil plants could produce between 0% and 200% of their output.


Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Electrical issues
« Reply #14 on: November 11, 2012, 04:43:51 PM »
I like the idea of some power going to cities, but I think it might need to be done like simutrans experimental with transformers in cities, or alternatively calculated based on population.

I don't want to hassle with building electrical wires and transformers. I run a truck and railroad company, not an electricity company. And power plants feed the national/global electrical grid, not just the nearest city, don't they?

Offline Fifty

  • *
  • Posts: 280
  • Languages: EN, ES
Re: Electrical issues
« Reply #15 on: November 11, 2012, 05:05:34 PM »
I don't want to hassle with building electrical wires and transformers. I run a truck and railroad company, not an electricity company. And power plants feed the national/global electrical grid, not just the nearest city, don't they?

Yes- that's why you could calculate map demand based on population and not be troubled with electricity at all except for industries. Or you could just do a percentage of the plant's power as you suggested, not based on population.

Offline jameskuyper

  • *
  • Posts: 78
  • Languages: en
Re: Electrical issues
« Reply #16 on: November 11, 2012, 07:00:04 PM »
I don't want to hassle with building electrical wires and transformers. I run a truck and railroad company, not an electricity company. And power plants feed the national/global electrical grid, not just the nearest city, don't they?
The game mechanics suggest that the electrical grid is not complete, until some player lays down the wires that make it complete. I agree that having to worry about the grid seems outside the scope of a transportation game.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Electrical issues
« Reply #17 on: November 11, 2012, 07:09:00 PM »
I was a bit unclear. The part about feeding the global grid was referring to the real world, not Simutrans. However, I want Simutrans to follow that if general power consumption should be simulated.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Electrical issues
« Reply #18 on: November 11, 2012, 07:31:27 PM »
Attached patch also implements an optional setting to have power plants only consume fuel based on their actual electrical output. Was easier than I thought, wish I'd done it sooner! Turn on, and no more endless deliveries of coal to a powerplant that produces no power. Need to start games with something other than the standard coal mine>powerplant route.
I would rather like to see a production boost of power stations, if power is actually consumed. (If this is not implemented already - I cannot remember)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Electrical issues
« Reply #19 on: November 11, 2012, 07:57:24 PM »
If power fluctuates between a base level (10-30% lets discuss) and 100% then this would be exactly what Dwachs proposes. And I think this would be a very good idea. If the power station without grid connection then return their base production (like normal factories) then one would not even need to teach the AI new tricks. (Although I see a certain more severe shortage of coal and oil coming. The factorybuilder will amend this to some scale during spawning of new chains though.)

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Electrical issues
« Reply #20 on: November 11, 2012, 08:23:21 PM »
IMO consuming fuel when not delivering any energy is not consistent with the rest of the games just_in_time function. This is all I sought to fix. Rather mixed feedback.

Simulating a factories efficiency is not currently ingame, adding it only for electricity (not a core game component) seems ??. Adding a fixed minimum % consumption to the patch can be easily done. Integrating it with the boost mechanism as suggested requires a complete rewrite of the electrical simulation routines; Rather more than I intended.

Does the AI currently handle factories that don't produce at their full rate?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Electrical issues
« Reply #21 on: November 11, 2012, 08:28:42 PM »
Does the AI currently handle factories that don't produce at their full rate?
The AI can deal with industry chains that are not fully connected and tries to connect missing links. But it cannot deal with power stations that do not consume anything because no power is consumed.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Electrical issues
« Reply #22 on: November 11, 2012, 08:41:09 PM »
I just looked at the AI (first time). It cannot handle electricity period. And it doesn't appear to take the other boosts into account either. Nor does the factory builder for that matter.
The AI also doesn't handle factories that don't produce at full rate. Which is related to the above. It just links things up and spams vehicles until the storage is full. Atleast AFAICT in a few minute quick look.
With patch, the AI would connect to the power plant, deliver fuel until it's full, then get stuck until a player builds the power lines. Adding a powerline building AI is way more that I intend. Easiest fix for the AI to ignore power plants if this option is on. Or abandon the patch.

Edit: Update patch to trunk. Don't build powerplants as first chain. AI ignores powerplants as consumers.
« Last Edit: November 11, 2012, 10:01:28 PM by TurfIt »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Electrical issues
« Reply #23 on: November 11, 2012, 09:56:35 PM »
I think that powerplant should have a baseline consumption, like 30% and then increase until 100%. That is the same as boost. The reason is, that rendering all tutorials void for simutrans will certainly frustate new players. 30% would be enough for baseline survival, even if one not immediately discovered powerline construction. Otherwise I see many "error reports" of not producing/transporting chains.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Electrical issues
« Reply #24 on: November 11, 2012, 10:00:38 PM »
baseline consumption % fixed in code? or new .dat param? or try to integrate with boost (which looks very ugly to implement)?

umm. Trying to reply to what you said about AI and it's disappeared....


Offline sdog

  • Devotee
  • *
  • Posts: 2052
Re: Electrical issues
« Reply #25 on: November 11, 2012, 10:05:25 PM »
The game mechanics suggest that the electrical grid is not complete, until some player lays down the wires that make it complete. I agree that having to worry about the grid seems outside the scope of a transportation game.

From a historical perspective this isn't so absurd. In several areas transportation companies where the first to build electrical grids. They built power plants to power their tram lines, and to have a steadier demand they also became electricity providers for consumers.

Don't forget we have the historical perspective here. Typically the player is starting before a powergrid is available. Having to be built by private companies. Since this is simple enough, it doesn't fall out of the scope of the simulation.


edit: fixes embarrasing typo
« Last Edit: November 12, 2012, 07:53:05 AM by sdog »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Electrical issues
« Reply #26 on: November 11, 2012, 10:32:11 PM »
If not given in dat: Hardcoded (maybe 25%?) Otherwise given in dat. That way pak makers would have full control. And for existing old paks, use 100%, to have the same as today.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Electrical issues
« Reply #27 on: November 12, 2012, 05:46:26 AM »
From a shitorical perspective this isn't so absurd. In several areas transportation companies where the first to build electrical grids. They built power plants to power their tram lines, and to have a steadier demand they also became electricity providers for consumers.

Don't forget we have the historical perspective here. Typically the player is starting before a powergrid is available. Having to be built by private companies. Since this is simple enough, it doesn't fall out of the scope of the simulation.

Since Simutrans doesn't use power plants to drive trams and trains (it could turn into a chicken and egg situation), there should be no requirement for the player to mess with electrical grids, only an option that alters gameplay as little as possible.

Offline colonyan

  • Devotees (Inactive)
  • *
  • Posts: 526
  • Full and Warm
Re: Electrical issues
« Reply #28 on: November 22, 2012, 04:16:09 AM »
Can't a cargo type itself can not become a booster of production in designated industry?
Most typical example could be fertilizers to farms. Others could be crops to animal farm, coal or fuel to concrete or steel mill.
Anything could be designated to form pak specific industry chain structure.
But for years, place for booster was always exclusive to electricity. [Added:] I assume this must be because of the difficulty of
making balance with existing industry chain...
« Last Edit: November 22, 2012, 05:09:16 AM by colonyan »