Author Topic: pak128.Britain balancing - the big one!  (Read 21957 times)

0 Members and 1 Guest are viewing this topic.

Offline ӔO

  • Devotee
  • *
  • Posts: 2345
  • Total likes: 2
  • Helpful: 66
  • Hopefully helpful
  • Languages: en, jp
Re: pak128.Britain balancing - the big one!
« Reply #35 on: May 09, 2013, 09:43:16 PM »
there are a few MT locomotives that may be hard to balance if they were weighed in favour of freight.

Off the top of my head...
LNER V2
LNER B17
BR 7MT
BR 9F
BR Class 47
BR Class 57

---

For train length, just look at the modern EMU/DMU in service, since they are mostly built to fit within old stations.
Only a few exceptions exist, which are the eurostar in 20 and 16 car length varieties.
Most only operate with up to a 4+4+4 car configuration, which are 9 or 10 tiles.
The next longest train is the APT, which is 11 tiles long in its full configuration.
« Last Edit: May 10, 2013, 12:49:15 AM by ӔO »
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

Offline AP

Re: pak128.Britain balancing - the big one!
« Reply #36 on: May 10, 2013, 08:31:11 PM »
So the summary is that
  • Passenger Locos - Fast but costly to run (profit relies on speedbonus)
  • Freight Locos - Slower but cheaper to run. (profit relies on larger volume transported?)
(Not sure if tractive force also comes into it...)

for Mixed Traffic locomotives, in RL, they could operate in either manner. For Simutrans, I can see two possible solutions:
  • If the game can do it, make the running cost for MT locomotives proportional to operating speed (where the wagons pulled will limit the running speed); or
  • Code the locomotives twice, a Passenger and Freight version, with different values (and possibly liveries too). Name them logically so people use the correct one for the correct type of service. Simutrans doesn't require the 'flexibility' of Mixed Traffic locomotives in the same way the real railways did, to run different services each day etc.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #37 on: May 10, 2013, 09:12:58 PM »
AP, that was the problem from last time that I'm trying to avoid. One workaround I'm contemplating is making rolling stock more expensive to operate and locomotives less expensive. This simulates the fact that you need to supply more energy to accelerate a longer, heavier train so part of the increased cost of the rolling stock actually represents the fuel cost of the loco hauling it (!). I haven;t done any tests yet but I'm hoping this could reduce the gap between MT locos in freight and in pax mode.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #38 on: May 10, 2013, 10:00:28 PM »
Actually, at least for the pak64/japan46 the only way out is to have a high speedbonus for pax. That makes also a good incentive the renew obsolete locos. Otherwise the power of fast pax locos will be also enough to draw long freight trains. I see no way round (apart from a mandantory passenger car than is reuired constrain after any pax loco).

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #39 on: May 11, 2013, 06:38:25 AM »
Thanks prissi - that experience is useful. I might also be tempted to add in constraints as well for certain express locos. I guess I just need to go on and test a few things. While you're reading this, are you able to give me a way of calculating tiles taken to accelerate to top speed given weight, power and gear of a convoy?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #40 on: May 11, 2013, 02:47:53 PM »
There is an excel-sheet in the pak64 repo ant SF. cars.xls will do this exactly. ;)

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #41 on: May 12, 2013, 07:42:10 PM »
Thanks prissi - I've found the file and the bit where it calculates the theoretical heaviest/longest train that a loco can pull. But I can't work out where it does the calculation for number of squares to max velocity. Can you give me a pointer?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #42 on: May 12, 2013, 08:53:53 PM »
That depends on what you full speed is (e.g. within 10% of max speed?), and whether there are slopes or curves in the track. I think this is rather useless for balancing. You get the income per car, you get the number of cars you can pull at full speed => you get the maximum income.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #43 on: May 12, 2013, 09:02:31 PM »
There are two reasons I want to know this (for a long straight track):
1) to compare accelerations of different convoys easily without testing in game and to ensure they accelerate in a graphically "reasonable" distance.
2) to work out roughly what % of the journey will be accelerating for a typical use of this train for balancing purposes (less important).

Is there a way I could calculate this?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #44 on: May 12, 2013, 09:23:19 PM »
IF you put into a frame rate yes. Unfourtunately acceleration will slightly different on frame rate, as the step size will enter into an exact formula. But I think there was once a rough formula around, but I may be on the SF forum.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #45 on: May 13, 2013, 08:55:10 AM »
Ok. For my purposes an approximation will do. How does the code handle acceleration (in terms of power, weight, gear and velocity) and how does it convert km in tiles? If I know these I could have a crack at deriving an appropriate formula.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #46 on: May 13, 2013, 02:05:53 PM »
You cannot convert km to tiles. Or do you mean "how many tiles per month are 100 kmh?" For this the answer was somewhere in the forum, but it will depend obviously on the users bits_per_month setting.

In the code acceleration is linear, i.e. the higher the kW*gear the higher the acceleration, but friction is quadratic. It is balanced in such a way that 200 kW can move 100t at 100 km/h.

accel = 200kW
deccel = 100km/h^2 * 100t

(Please ignore the units, those cannot be combined physically in such a formula. I know, but it feels right in the game.)

Assuming a flat track (additional friction factors 16 for slopes and 4 for bends) this change of speed per ms step "delta_t" is (typically delta_t 25-250 ms):

deccel = speed^2 * weight
delta = (power*gear - deccel) * delta_t / weight

However, at this point I leave it to the read (as I have to go) to convert this into a useful formula. The explicit delta_t inside however does not look to good for it.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #47 on: May 13, 2013, 07:23:15 PM »
Well I had a fun hour or so writing and solving differential equations based on this but when I tried putting in numbers they didn't seem to make sense. I'm guessing part of the problem is the assumption in solving differential equations that dt tends to zero when in fact it is finite. I'm guessing this isn't such a clever idea after all then and I'll just need to do more trial-and-improvement in game to get power/gear balancing right.

However I'm confused there is no conversion between km and tiles. Surely the game must know how far to advance a convoy along a tile given a particular speed? Does this vary with bits per month and delta_t?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #48 on: May 13, 2013, 09:28:46 PM »
Ah, you mean akt_speed and steps.

Well a straight tile has 255 step. The internal speed is (historically) (kmh*64)/5 That is exactly the distance in steps. This a convoi at 100 kmh (speed=1280) will do 25*1280/4096=32000/4096 steps in 25 ms (or kmh*64/5*ms/(4096*255)=tiles. In this example it will be 7.8 steps, or roughtly 1/32th or a tile.

Still I am not sure for what balancing purpose you need this. It could be only monthly maintenance or purchasing costs, as the cost per tile driven must be balanced to the income with mean load per tile, with the latter only depending on the speedbonus.

Offline TurfIt

Re: pak128.Britain balancing - the big one!
« Reply #49 on: May 14, 2013, 12:47:32 AM »
Comparing accelerations of two convois can be easily calculated given their effective power (w/gear) and weight. top speed = sqrt( 2500*power/weight - 2500). At a given speed, the convoi with the higher top speed will be higher accelerating. Further, if the top speed calculated like this is close to the speed limit set in the .dats, it'll take a long time/distance to actually get to that limit. i.e. adjust the power/weight to give the calc top speed some margin over the speed limit to adjust how quickly the convoi gets to the limit.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #50 on: May 14, 2013, 07:56:06 AM »
@prissi - thanks. Just to check that the program now does speedbonus each step: so you get less income while accelerating than at top speed?

@Turfit - that's what I'd already derived as a simpler proxy - good to know I was right!

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4273
  • Total likes: 193
  • Helpful: 149
  • Languages: EN, DE, AT
Re: pak128.Britain balancing - the big one!
« Reply #51 on: May 14, 2013, 09:56:28 AM »
@prissi - thanks. Just to check that the program now does speedbonus each step: so you get less income while accelerating than at top speed?
The velocity relevant for speedbonus calculations is the minimum of the achievable speed of the train (taking loading into account) and the average speed limit of ways the vehicle travels on.
Parsley, sage, rosemary, and maggikraut.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #52 on: May 14, 2013, 11:29:32 AM »
Ah - I thought it had changed so that it was calculated on the average speed of the convoy for the whole journey. If not that certainly makes calculations easier.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: pak128.Britain balancing - the big one!
« Reply #53 on: May 14, 2013, 04:33:25 PM »
No you can happily play with the formula in the pak64 excel and rember that stuff made for innercity travel will not exceed the speed of whatever roads are available as city road when they are introduced.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #54 on: May 20, 2013, 09:06:21 PM »
I've been working on a new spreadsheet to help balancing. I've attached what I've done so far (rail only) along with a few fairly major changes to game balance:
(1) Bonus speeds are much lower - just slower than the fastest PIECE/COOLED GOODS wagon at the time as suggested by neroden to allow more convenient balancing with slower goods types
(2) Speed bonuses simplified - many slower types do not have a speed bonus at all
(3) A knock on of the above means that some things are very profitable indeed - so I've scaled back revenues but also changed the revenues between different types to get approximately reasonable and comparable profits on all convoys for a class 37 mixed class diesel
(4) Wagons now contribute a greater proportion of a convoy's maintenance cost per tile.
(5) Gears are generally lower - acceleration is therefore slower to avoid having situations with overpowered locos being able to haul huge and therefore very profitable convoys.

The spreadsheet also attempts to estimate monthly profits taking into account the track required, station length and the distance covered each month. This involves some fairly crude assumptions (e.g. average speed is 50% of max and basic assumptions about numbers of trains per months - guessed from in-game experience).

So far I've entered some numbers for some BR diesels (values changed from current in-game data are in red).

The monthly profits are fairly large but then again these assume direct routes, no bridges, tunnels, signals etc. that would reduce profits on a real game.

I'd be very grateful if anyone was able to cast an eye over it and (a) check it's error free and (b) that it looks sensible.

If so, then I'll start working through the whole list along these lines - I just don't want to plough ahead and then realise it was all flawed...

Offline kierongreen

  • Dev Team, Coder/patcher
  • Moderator
  • *
  • Posts: 2250
  • Total likes: 47
  • Helpful: 90
Re: pak128.Britain balancing - the big one!
« Reply #55 on: May 20, 2013, 10:13:35 PM »
Zip is empty here?

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #56 on: May 21, 2013, 07:26:24 AM »
Urgh. I'll try again tonight.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #57 on: May 21, 2013, 06:36:27 PM »
try this...

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #58 on: May 27, 2013, 08:27:35 AM »
As I've had no adverse comments I'm assuming people are happy for me to proceed along these lines?

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #59 on: June 05, 2013, 09:04:51 AM »
OK, I've been making good progress on express locos but I've hit a problem with old mixed traffic/goods locos. I'd appreciate any thoughts on how best to proceed...
 
For modern mixed traffic (e.g. class 37) the passenger capacities and goods capacities (of a fully loaded train that can reach approximately max speed for the convoy) are approximately the same. For effective balancing therefore I set the unit revenues for pax and goods as approximately the same (taking speedbonus into account).
 
At the other extreme is the LMR Rocket. With the 4 wheel LMR carriages this can take approx 10 carriages. This results in a capacity of around 200 pax (in a station length of 3!). By contrast, the goods wagons carry just 3t of coal (or other units), but as each unit of goods is heavy, they max out on weight fairly easily and the capacity is less than 20 wagons, i.e. less than 60 units. With the goods unit revenues being approximately the same for pax and goods (as above) this means the goods version has a signficantly lower revenue than the passenger version (in fact the goods version can barely cover the fixed cost of station maintenance).
 
The main reasons for this discrepancy are (1) early goods wagons have much lower capacities than their passenger counterparts (2) goods units are much heavier than pax units so weak locos can pull far less goods early in the game - later on the weight of the carriages themselves makes pax trains much heavier too (3) early pax carriages fit large numbers into short convoy formations compared with modern pax carriages - i.e. pax per tile is much higher earlier in the game.
 
The above problems are exarcerbated early in the game as passenger trains are proportionally a lot faster than goods trains so get a much bigger speedbonus early on.
 
So where do we go from here?
(A) Increase goods unit revenues dramatically - this would make the revenue per convoy approximately equal for the Rocket but would make goods far more profitable by rail late in the game (opposite of reality!) unless I significantly increase maintenance costs for late goods vehicles to counter this effect (would it look odd to have really high goods wagon maintenance costs compared to a pax carriages?)
 
(B) Significantly reduce the capacity of earlier pax carriages - but this would be unrealistic compared to history which goes against the general ideas of pak128.Britain...
 
(C) Reduce the weight of goods units (so 1t of coal weights less than 1t!) allowing much heavily loads to be hauled - but again this is unrealistic and will probably throw the balance of modern trains out of kilter too...
 
(D) Significantly increase the weight of early pax vehicles so that fewer of them can be hauled - but this may result in very short trains...
 
Let me know if you have any views on the above...
 
Also if anyone can point me towards some data about the weights and speeds that particular early locos were able to haul that might help decide the best way forward.
 
 

Offline kierongreen

  • Dev Team, Coder/patcher
  • Moderator
  • *
  • Posts: 2250
  • Total likes: 47
  • Helpful: 90
Re: pak128.Britain balancing - the big one!
« Reply #60 on: June 05, 2013, 01:27:44 PM »
Were mixed locos used much historically? Part of the high passenger density in really old vehicles is down to a vast difference in comfort on trains.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 16073
  • Total likes: 438
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: pak128.Britain balancing - the big one!
« Reply #61 on: June 05, 2013, 01:42:46 PM »
In the very early days, locomotives were generally considered either "goods" or "passenger", but, of course, there were some cargoes - which can loosely be described as "fast freight" - that could command a locomotive of either type: fish and milk, for example, was carried at higher speed and lower density than coal or stone. By the middle of the 19th century, there were many locomotives that would be used for either freight or passenger work - the LNWR "coal tank", built for local coal trains, ended up in use on local passenger trains more than anything as its brakes proved inadequate for coal traffic. Whilst a locomotive designed for heavy freight would be unlikely to be found on a passenger service and a locomotive designed for top express passenger trains would be unlikely to be found working freight, there was a large intermediate area of locomotives which could be and regularly were used either for light freight or secondary passenger work.
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 The Hood

Re: pak128.Britain balancing - the big one!
« Reply #62 on: June 05, 2013, 02:43:01 PM »
Even if we go down the route of completely separating pax from goods early on and defining constraints to force that separation, there is still the issue that even with no maintenance costs the freight loco would barely be profitable with the current base prices. I'm leaning towards (A) above - do either of you or anyone else have any vastly differing views?

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 16073
  • Total likes: 438
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: pak128.Britain balancing - the big one!
« Reply #63 on: June 05, 2013, 03:46:24 PM »
It's hard to see any satisfactory solution, I have to say - this sort of thing is part of the reason that I forked Experimental in the first place.
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 kierongreen

  • Dev Team, Coder/patcher
  • Moderator
  • *
  • Posts: 2250
  • Total likes: 47
  • Helpful: 90
Re: pak128.Britain balancing - the big one!
« Reply #64 on: June 05, 2013, 04:43:06 PM »
Well I'd only go for A in terms of B, C and D being unacceptable in my opinion...

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #65 on: June 05, 2013, 06:21:00 PM »
I can't say I can see many better solutions. I've tried the numbers and, while they look a little odd with such expensive freight wagons in the modern day, they seem to look OK. I guess it's a case of testing it once I've rebalanced the lot and seeing whether it actually works in game and changing it if not.

Offline Vladki

Re: pak128.Britain balancing - the big one!
« Reply #66 on: June 05, 2013, 08:18:33 PM »
If old passenger cars have much higher "density" than modern ones, then also the comfort levels should be much lower, so that could be a nice solution for experimental. For standard, maybe just set the bonus speed higher than the max speed of the train, so that the bonus would be lowered. (I'm not sure how exactly is the bonus calculated though.

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #67 on: June 05, 2013, 09:15:21 PM »
Altering the speed bonus has other knock-ons (mainly affecting the balance of fast freight vs slow freight). That's one problem I've already fixed so I don't want to go back to that...

Offline ӔO

  • Devotee
  • *
  • Posts: 2345
  • Total likes: 2
  • Helpful: 66
  • Hopefully helpful
  • Languages: en, jp
Re: pak128.Britain balancing - the big one!
« Reply #68 on: June 05, 2013, 09:26:08 PM »
if only commodities could change their price over the years...

e, extension request?
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

Offline The Hood

Re: pak128.Britain balancing - the big one!
« Reply #69 on: June 05, 2013, 09:48:38 PM »
That would of course be nice...