News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

Intention of certain code in simfab.cc

Started by jamespetts, February 02, 2014, 07:34:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

May I ask anyone who knows: what is the intention of this code, found in simfab.cc:


// if less than 3/4 filled we neary always consume power
currently_producing |= (ausgang[product].menge*4 < ausgang[product].max*3);


This seems to resolve to false even though a factory is producing goods in some cases; is this intended?
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.

TurfIt

Intended. Electric demand turns off when output store is >=75% full.

jamespetts

Interesting. What is the reason for this?
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.

TurfIt

I don't know - it predates my time...
But, at 75% full, the production rate has already fallen way off; Why continue wasting the limited electric on a factory that doesn't need it? The factory clearly doesn't need the boost if it's ending up 75% full. So this behaviour remains a reasonable game mechanic IMO.

jamespetts

Hmm, interesting. I am not sure that this makes much sense in real world terms: a modern factory equipped to run with electricity does not turn off the power and tell all its workers to toil inefficiently by hand when demand is reduced, and the actual rate of production is not reduced in the game in these conditions, either.
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.

TurfIt

Of course it doesn't make sense in the realworld. It is a game after all...
And in the realworld, layoffs do happen.

prissi

They do in Germany, it is called Kurzarbeit. The goverment pays a part of the wage, but the worker only work much less. See http://en.wikipedia.org/wiki/Short_time

kierongreen

In simutrans it's perfectly possible to have a modern factory with no transformer hence no electricity though...

jamespetts

None of these things are really reasons for a factory connected to a substation to stop demanding electricity when its output storage gets to 75% full, though; if a tapering of production is what is intended, why should it apply only to factories connected to electricity, and why should only output storage (and not, say, the input storage of its customers) be taken into account? In any event, a player might design her/his transport network so that a large ship or long train comes and takes away the whole of the factory's output storage just as it is full, so it reaching 75% does not really indicate any reason to slow production in and of itself.

I have removed this function in Experimental, and caused factories to demand electricity whenever they produce anything.
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.

prissi

The factory output per time unit is related to the filling of the output storage since the dawn of simutrans. The more in the output storage, the slower the factory production. Not sure why Hajo designed it this way, but at 75% filled output storage the production is less than 25% compared to an empty one.

Ters

It certainly makes sense that electricity demand is reduced at the same rate as production drops. That electricity demand stops completely makes as much sense as modern factories operating without electricity in the first place. (Or indeed that factories lies dormant for decades waiting for someone to maybe one day provide transportation services.) The power lines in Simutrans must perhaps be seen as dedicated industrial lines for high-power equipment, rather than a generic power grid. Although it does seem somewhat unlikely that they can switch to the public power grid that easily and that they save enough money doing so for short periods.

jamespetts

Quote from: Ters on February 03, 2014, 06:22:04 AM
It certainly makes sense that electricity demand is reduced at the same rate as production drops. That electricity demand stops completely makes as much sense as modern factories operating without electricity in the first place. (Or indeed that factories lies dormant for decades waiting for someone to maybe one day provide transportation services.) The power lines in Simutrans must perhaps be seen as dedicated industrial lines for high-power equipment, rather than a generic power grid. Although it does seem somewhat unlikely that they can switch to the public power grid that easily and that they save enough money doing so for short periods.

There is residual code in Standard that suggests that it was always intended that cities should be able to be electrified, too (and this has been done in Experimental, some time ago now), so the dedicated power grid theory I suspect was not the original intention.
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.

prissi

The code stemmed from me. I originally intended to base this number on the number of working power stations within the city catchment circle. So it would have rather support a "grid" theory.

Nevertheless, power is ment to be scare and used straegically. Hence not consuming for dormant factories seems fair.